

/* 
 * flowplayer.js 3.2.6. The Flowplayer API
 * 
 * Copyright 2009-2011 Flowplayer Oy
 * 
 * This file is part of Flowplayer.
 * 
 * Flowplayer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Flowplayer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Flowplayer.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Date: 2011-02-04 05:45:28 -0500 (Fri, 04 Feb 2011)
 * Revision: 614 
 */
(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.slice(0,q)||"*";var o=s.slice(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).slice(2,10)}var h=function(t,r,s){var q=this,p={},u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.slice(0,v.length-1);var w="onBefore"+v.slice(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var o=this,s={},u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var z=q._api().fp_getPlugin(p);if(!z){return}i(o,z);delete o.methods;if(!u){m(z.methods,function(){var B=""+this;o[B]=function(){var C=[].slice.call(arguments);var D=q._api().fp_invoke(p,B,C);return D==="undefined"||D===undefined?o:D}});u=true}}var A=s[w];if(A){var y=A.apply(o,v);if(w.slice(0,1)=="_"){delete s[w]}return y}return o}})};function b(q,G,t){var w=this,v=null,D=false,u,s,F=[],y={},x={},E,r,p,C,o,A;i(w,{id:function(){return E},isLoaded:function(){return(v!==null&&v.fp_play!==undefined&&!D)},getParent:function(){return q},hide:function(H){if(H){q.style.height="0px"}if(w.isLoaded()){v.style.height="0px"}return w},show:function(){q.style.height=A+"px";if(w.isLoaded()){v.style.height=o+"px"}return w},isHidden:function(){return w.isLoaded()&&parseInt(v.style.height,10)===0},load:function(J){if(!w.isLoaded()&&w._fireEvent("onBeforeLoad")!==false){var H=function(){u=q.innerHTML;if(u&&!flashembed.isSupported(G.version)){q.innerHTML=""}if(J){J.cached=true;j(x,"onLoad",J)}flashembed(q,G,{config:t})};var I=0;m(a,function(){this.unload(function(K){if(++I==a.length){H()}})})}return w},unload:function(J){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(J){J(false)}return w}if(u.replace(/\s/g,"")!==""){if(w._fireEvent("onBeforeUnload")===false){if(J){J(false)}return w}D=true;try{if(v){v.fp_close();w._fireEvent("onUnload")}}catch(H){}var I=function(){v=null;q.innerHTML=u;D=false;if(J){J(true)}};setTimeout(I,50)}else{if(J){J(false)}}return w},getClip:function(H){if(H===undefined){H=C}return F[H]},getCommonClip:function(){return s},getPlaylist:function(){return F},getPlugin:function(H){var J=y[H];if(!J&&w.isLoaded()){var I=w._api().fp_getPlugin(H);if(I){J=new l(H,I,w);y[H]=J}}return J},getScreen:function(){return w.getPlugin("screen")},getControls:function(){return w.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return w.getPlugin("logo")._fireEvent("onUpdate")}catch(H){}},getPlay:function(){return w.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(H){return H?k(t):t},getFlashParams:function(){return G},loadPlugin:function(K,J,M,L){if(typeof M=="function"){L=M;M={}}var I=L?e():"_";w._api().fp_loadPlugin(K,J,M,I);var H={};H[I]=L;var N=new l(K,null,w,H);y[K]=N;return N},getState:function(){return w.isLoaded()?v.fp_getState():-1},play:function(I,H){var J=function(){if(I!==undefined){w._api().fp_play(I,H)}else{w._api().fp_play()}};if(w.isLoaded()){J()}else{if(D){setTimeout(function(){w.play(I,H)},50)}else{w.load(function(){J()})}}return w},getVersion:function(){var I="flowplayer.js 3.2.6";if(w.isLoaded()){var H=v.fp_getVersion();H.push(I);return H}return I},_api:function(){if(!w.isLoaded()){throw"Flowplayer "+w.id()+" not loaded when calling an API method"}return v},setClip:function(H){w.setPlaylist([H]);return w},getIndex:function(){return p},_swfHeight:function(){return v.clientHeight}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var H="on"+this;if(H.indexOf("*")!=-1){H=H.slice(0,H.length-1);var I="onBefore"+H.slice(2);w[I]=function(J){j(x,I,J);return w}}w[H]=function(J){j(x,H,J);return w}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var H=this;w[H]=function(J,I){if(!w.isLoaded()){return w}var K=null;if(J!==undefined&&I!==undefined){K=v["fp_"+H](J,I)}else{K=(J===undefined)?v["fp_"+H]():v["fp_"+H](J)}return K==="undefined"||K===undefined?w:K}});w._fireEvent=function(Q){if(typeof Q=="string"){Q=[Q]}var R=Q[0],O=Q[1],M=Q[2],L=Q[3],K=0;if(t.debug){g(Q)}if(!w.isLoaded()&&R=="onLoad"&&O=="player"){v=v||c(r);o=w._swfHeight();m(F,function(){this._fireEvent("onLoad")});m(y,function(S,T){T._fireEvent("onUpdate")});s._fireEvent("onLoad")}if(R=="onLoad"&&O!="player"){return}if(R=="onError"){if(typeof O=="string"||(typeof O=="number"&&typeof M=="number")){O=M;M=L}}if(R=="onContextMenu"){m(t.contextMenu[O],function(S,T){T.call(w)});return}if(R=="onPluginEvent"||R=="onBeforePluginEvent"){var H=O.name||O;var I=y[H];if(I){I._fireEvent("onUpdate",O);return I._fireEvent(M,Q.slice(3))}return}if(R=="onPlaylistReplace"){F=[];var N=0;m(O,function(){F.push(new h(this,N++,w))})}if(R=="onClipAdd"){if(O.isInStream){return}O=new h(O,M,w);F.splice(M,0,O);for(K=M+1;K<F.length;K++){F[K].index++}}var P=true;if(typeof O=="number"&&O<F.length){C=O;var J=F[O];if(J){P=J._fireEvent(R,M,L)}if(!J||P!==false){P=s._fireEvent(R,M,L,J)}}m(x[R],function(){P=this.call(w,O,M);if(this.cached){x[R].splice(K,1)}if(P===false){return false}K++});return P};function B(){if($f(q)){$f(q).getParent().innerHTML="";p=$f(q).getIndex();a[p]=w}else{a.push(w);p=a.length-1}A=parseInt(q.style.height,10)||q.clientHeight;E=q.id||"fp"+e();r=G.id||E+"_api";G.id=r;t.playerId=E;if(typeof t=="string"){t={clip:{url:t}}}if(typeof t.clip=="string"){t.clip={url:t.clip}}t.clip=t.clip||{};if(q.getAttribute("href",2)&&!t.clip.url){t.clip.url=q.getAttribute("href",2)}s=new h(t.clip,-1,w);t.playlist=t.playlist||[t.clip];var I=0;m(t.playlist,function(){var K=this;if(typeof K=="object"&&K.length){K={url:""+K}}m(t.clip,function(L,M){if(M!==undefined&&K[L]===undefined&&typeof M!="function"){K[L]=M}});t.playlist[I]=K;K=new h(K,I,w);F.push(K);I++});m(t,function(K,L){if(typeof L=="function"){if(s[K]){s[K](L)}else{j(x,K,L)}delete t[K]}});m(t.plugins,function(K,L){if(L){y[K]=new l(K,L,w)}});if(!t.plugins||t.plugins.controls===undefined){y.controls=new l("controls",null,w)}y.canvas=new l("canvas",null,w);u=q.innerHTML;function J(L){var K=w.hasiPadSupport&&w.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(F[0].url)&&!K){return true}if(!w.isLoaded()&&w._fireEvent("onBeforeClick")!==false){w.load()}return f(L)}function H(){if(u.replace(/\s/g,"")!==""){if(q.addEventListener){q.addEventListener("click",J,false)}else{if(q.attachEvent){q.attachEvent("onclick",J)}}}else{if(q.addEventListener){q.addEventListener("click",f,false)}w.load()}}setTimeout(H,0)}if(typeof q=="string"){var z=c(q);if(!z){throw"Flowplayer cannot access element: "+q}q=z;B()}else{B()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var t=arguments[1],q=(arguments.length==3)?arguments[2]:{};if(typeof t=="string"){t={src:t}}t=i({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:false},t);if(typeof o=="string"){if(o.indexOf(".")!=-1){var s=[];m(n(o),function(){s.push(new b(this,k(t),k(q)))});return new d(s)}else{var r=c(o);return new b(r!==null?r:o,t,q)}}else{if(o){return new b(o,t,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var e=typeof jQuery=="function";var i={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(e){jQuery.tools=jQuery.tools||{};jQuery.tools.flashembed={version:"1.0.4",conf:i}}function j(){if(c.done){return false}var l=document;if(l&&l.getElementsByTagName&&l.getElementById&&l.body){clearInterval(c.timer);c.timer=null;for(var k=0;k<c.ready.length;k++){c.ready[k].call()}c.ready=null;c.done=true}}var c=e?jQuery:function(k){if(c.done){return k()}if(c.timer){c.ready.push(k)}else{c.ready=[k];c.timer=setInterval(j,13)}};function f(l,k){if(k){for(key in k){if(k.hasOwnProperty(key)){l[key]=k[key]}}}return l}function g(k){switch(h(k)){case"string":k=k.replace(new RegExp('(["\\\\])',"g"),"\\$1");k=k.replace(/^\s?(\d+)%/,"$1pct");return'"'+k+'"';case"array":return"["+b(k,function(n){return g(n)}).join(",")+"]";case"function":return'"function()"';case"object":var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push('"'+m+'":'+g(k[m]))}}return"{"+l.join(",")+"}"}return String(k).replace(/\s/g," ").replace(/\'/g,'"')}function h(l){if(l===null||l===undefined){return false}var k=typeof l;return(k=="object"&&l.push)?"array":k}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function b(k,n){var m=[];for(var l in k){if(k.hasOwnProperty(l)){m[l]=n(k[l])}}return m}function a(r,t){var q=f({},r);var s=document.all;var n='<object width="'+q.width+'" height="'+q.height+'"';if(s&&!q.id){q.id="_"+(""+Math.random()).substring(9)}if(q.id){n+=' id="'+q.id+'"'}if(q.cachebusting){q.src+=((q.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(q.w3c||!s){n+=' data="'+q.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(q.w3c||s){n+='<param name="movie" value="'+q.src+'" />'}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+='<param name="'+l+'" value="'+q[l]+'" />'}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?g(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='<param name="flashvars" value=\''+o+"' />"}n+="</object>";return n}function d(m,p,l){var k=flashembed.getVersion();f(this,{getContainer:function(){return m},getConf:function(){return p},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){f(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="<h2>Flash version "+q+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(m.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(m.tagName=="A"){m.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}if(document.all){window[p.id]=document.getElementById(p.id)}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return}}if(!l){return}if(typeof m=="string"){m={src:m}}var o=f({},i);f(o,m);return new d(l,o,k)};f(window.flashembed,{getVersion:function(){var m=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return m}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:g,getHTML:a});if(e){jQuery.fn.flashembed=function(l,k){var m=null;this.each(function(){m=flashembed(this,l,k)});return l.api===false?this:m}}})();

/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, Jï¿½Ã¶rn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
 *
 */

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are three supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
	metadata : {
		defaults : {
			type: 'class',
			name: 'metadata',
			cre: /({.*})/,
			single: 'metadata'
		},
		setType: function( type, name ){
			this.defaults.type = type;
			this.defaults.name = name;
		},
		get: function( elem, opts ){
			var settings = $.extend({},this.defaults,opts);
			// check for empty string in single property
			if ( !settings.single.length ) settings.single = 'metadata';
			
			var data = $.data(elem, settings.single);
			// returned cached data if it already exists
			if ( data ) return data;
			
			data = "{}";
			
			if ( settings.type == "class" ) {
				var m = settings.cre.exec( elem.className );
				if ( m )
					data = m[1];
			} else if ( settings.type == "elem" ) {
				if( !elem.getElementsByTagName )
					return undefined;
				var e = elem.getElementsByTagName(settings.name);
				if ( e.length )
					data = $.trim(e[0].innerHTML);
			} else if ( elem.getAttribute != undefined ) {
				var attr = elem.getAttribute( settings.name );
				if ( attr )
					data = attr;
			}
			
			if ( data.indexOf( '{' ) <0 )
			data = "{" + data + "}";
			
			data = eval("(" + data + ")");
			
			$.data( elem, settings.single, data );
			return data;
		}
	}
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
	return $.metadata.get( this[0], opts );
};

})(jQuery);

/**
 * jQuery Validation Plugin 1.8.1
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2011 JÃ¶rn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,
a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),
minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator");e="on"+e.type.replace(/^validate/,
"");f.settings[e]&&f.settings[e].call(f,this[0])}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=this.settings.rules;
c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",a).validateDelegate(":radio, :checkbox, select, option","click",a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",
[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement=a=this.clean(a);this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,
a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},
objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==
a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,
this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.clean(a);if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=
c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=
this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==undefined)return arguments[a]},defaultMessage:function(a,b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+
a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];
this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);
this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass().addClass(this.settings.errorClass);d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||
"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},
idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},
depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<
0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},
email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b=
{};a=c(a);for(var d in c.validator.methods){var e=a.attr(d);if(e)b[d]=e}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===
false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&
a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},
methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=
e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=
e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||
a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(a)},
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9-]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);

/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';(7($){$.w.W=7(6){2(!5.E){B(\'W: 3Q A 3M - 3E 3v 1q\');8 5}2(R 6==\'7\'){6={M:6}}3 Y=5.13(\'Y\');3 J=(R Y===\'3a\')?$.3C(Y):\'\';2(J){J=(J.3x(/^([^#]+)/)||[])[1]}J=J||N.1S.1V||\'\';6=$.2D(11,{J:J,M:$.2C.M,m:5[0].2o(\'2s\')||\'2N\',1C:/^3y/i.33(N.1S.1V||\'\')?\'39:I\':\'4i:49\'},6);3 16={};5.K(\'4-1l-2L\',[5,6,16]);2(16.16){B(\'W: A 2K 1I 4-1l-2L K\');8 5}2(6.2f&&6.2f(5,6)===I){B(\'W: A S 1I 2f 1Q\');8 5}3 n,v,a=5.2q(6.19);2(6.d){6.P=6.d;Q(n 2j 6.d){2(6.d[n]44 1n){Q(3 k 2j 6.d[n]){a.z({l:n,p:6.d[n][k]})}}r{v=6.d[n];v=$.42(v)?v():v;a.z({l:n,p:v})}}}2(6.2g&&6.2g(a,5,6)===I){B(\'W: A S 1I 2g 1Q\');8 5}5.K(\'4-A-2M\',[a,5,6,16]);2(16.16){B(\'W: A 2K 1I 4-A-2M K\');8 5}3 q=$.2n(a);2(6.m.3Z()==\'2N\'){6.J+=(6.J.1M(\'?\')>=0?\'&\':\'?\')+q;6.d=C}r{6.d=q}3 $4=5,14=[];2(6.2a){14.z(7(){$4.2a()})}2(6.2t){14.z(7(){$4.2t()})}2(!6.1j&&6.D){3 2O=6.M||7(){};14.z(7(d){3 w=6.3U?\'3T\':\'3V\';$(6.D)[w](d).1d(2O,3r)})}r 2(6.M){14.z(6.M)}6.M=7(d,2u,9){3 L=6.L||6;Q(3 i=0,O=14.E;i<O;i++){14[i].3X(L,[d,2u,9||$4,$4])}};3 2J=$(\'F:45\',5).E>0;3 25=\'1o/4-d\';3 1o=($4.13(\'2Z\')==25||$4.13(\'2Q\')==25);2(6.2k!==I&&(2J||6.2k||1o)){2(6.2I){$.46(6.2I,28)}r{28()}}r{$.4f(6)}5.K(\'4-A-4h\',[5,6]);8 5;7 28(){3 4=$4[0];2($(\':F[l=A],:F[Z=A]\',4).E){4c(\'48: 47 2m 3S 1A 4b l 3N Z 3z "A".\');8}3 s=$.2D(11,{},$.2C,6);s.L=s.L||s;3 Z=\'3w\'+(27 3D().3s()),w=\'3t\'+Z;3 $u=$(\'<2k Z="\'+Z+\'" l="\'+Z+\'" 2F="\'+s.1C+\'" />\');3 u=$u[0];$u.3B({3R:\'3O\',3j:\'-2E\',3d:\'-2E\'});3 9={S:0,V:C,1i:C,2u:0,3L:\'n/a\',3K:7(){},2w:7(){},3G:7(){},3F:7(){B(\'3H 2z...\');3 e=\'S\';5.S=1;$u.13(\'2F\',s.1C);9.G=e;s.G&&s.G.1a(s.L,9,\'G\',e);g&&$.1c.K("2A",[9,s,e]);s.1L&&s.1L.1a(s.L,9,\'G\')}};3 g=s.2G;2(g&&!$.2v++){$.1c.K("3I")}2(g){$.1c.K("3J",[9,s])}2(s.2H&&s.2H.1a(s.L,9,s)===I){2(s.2G){$.2v--}8}2(9.S){8}3 1E=0;3 1h=4.T;2(1h){3 n=1h.l;2(n&&!1h.1p){s.P=s.P||{};s.P[n]=1h.p;2(1h.m=="1f"){s.P[n+\'.x\']=4.15;s.P[n+\'.y\']=4.18}}}7 21(){3 t=$4.13(\'D\'),a=$4.13(\'Y\');4.1t(\'D\',Z);2(4.2o(\'2s\')!=\'2B\'){4.1t(\'2s\',\'2B\')}2(4.2o(\'Y\')!=s.J){4.1t(\'Y\',s.J)}2(!s.4j){$4.13({2Q:\'1o/4-d\',2Z:\'1o/4-d\'})}2(s.1T){1y(7(){1E=11;1e()},s.1T)}3 1Z=[];2R{2(s.P){Q(3 n 2j s.P){1Z.z($(\'<F m="4U" l="\'+n+\'" p="\'+s.P[n]+\'" />\').2Y(4)[0])}}$u.2Y(\'1g\');u.30?u.30(\'2i\',1e):u.4S(\'2S\',1e,I);4.A()}4R{4.1t(\'Y\',a);2(t){4.1t(\'D\',t)}r{$4.4P(\'D\')}$(1Z).2y()}}2(s.4W){21()}r{1y(21,10)}3 d,f,2T=50;7 1e(){2(9.S){8}3 f=u.31?u.31.2X:u.32?u.32:u.2X;2(!f||f.1S.1V==s.1C){2(!1E)8}u.2W?u.2W(\'2i\',1e):u.4N(\'2S\',1e,I);3 1v=11;2R{2(1E){4s\'1T\'}3 1O=s.1j==\'U\'||f.20||$.4u(f);B(\'1O=\'+1O);2(!1O&&N.1J&&(f.1g==C||f.1g.1D==\'\')){2(--2T){B(\'4v 4w 1Q, 1U 1A 4q\');1y(1e,4k);8}}9.V=f.1g?f.1g.1D:f.1u?f.1u.1D:C;9.1i=f.20?f.20:f;9.2w=7(2V){3 2U={\'34-m\':s.1j};8 2U[2V]};3 1W=/(1R|3b)/.33(s.1j);2(1W||s.1N){3 1P=f.1H(\'1N\')[0];2(1P){9.V=1P.p}r 2(1W){3 1l=f.1H(\'1l\')[0];3 b=f.1H(\'1g\')[0];2(1l){9.V=1l.4o}r 2(b){9.V=b.1D}}}r 2(s.1j==\'U\'&&!9.1i&&9.V!=C){9.1i=2P(9.V)}d=3n(9,s.1j,s)}4x(e){B(\'G 4y:\',e);1v=I;9.G=e;s.G&&s.G.1a(s.L,9,\'G\',e);g&&$.1c.K("2A",[9,s,e])}2(9.S){B(\'2z S\');1v=I}2(1v){s.M&&s.M.1a(s.L,d,\'M\',9);g&&$.1c.K("4G",[9,s])}g&&$.1c.K("4I",[9,s]);2(g&&!--$.2v){$.1c.K("4E")}s.1L&&s.1L.1a(s.L,9,1v?\'M\':\'G\');1y(7(){$u.4C(\'4-1r-2i\');$u.2y();9.1i=C},3h)}3 2P=$.4O||7(s,f){2(N.3o){f=27 3o(\'4D.4B\');f.4z=\'I\';f.4A(s)}r{f=(27 4F()).4K(s,\'2r/U\')}8(f&&f.1u&&f.1u.3p!=\'1X\')?f:C};3 22=$.22||7(s){8 N[\'4J\'](\'(\'+s+\')\')};3 3n=7(9,m,s){3 1z=9.2w(\'34-m\')||\'\',U=m===\'U\'||!m&&1z.1M(\'U\')>=0,d=U?9.1i:9.V;2(U&&d.1u.3p===\'1X\'){$.G&&$.G(\'1X\')}2(s&&s.3l){d=s.3l(d,m)}2(R d===\'3a\'){2(m===\'1R\'||!m&&1z.1M(\'1R\')>=0){d=22(d)}r 2(m==="3b"||!m&&1z.1M("39")>=0){$.4p(d)}}8 d}}};$.w.1Y=7(6){2(5.E===0){3 o={s:5.3m,c:5.L};2(!$.35&&o.s){B(\'1U 1A 36, 4n 1Y\');$(7(){$(o.s,o.c).1Y(6)});8 5}B(\'4m; 4l 2m 4r 4M 3m\'+($.35?\'\':\' (1U 1A 36)\'));8 5}8 5.3e().37(\'A.4-1r\',7(e){2(!e.4t()){e.4L();$(5).W(6)}}).37(\'3f.4-1r\',7(e){3 D=e.D;3 $h=$(D);2(!($h.54(":A,F:1f"))){3 t=$h.51(\':A\');2(t.E==0){8}D=t[0]}3 4=5;4.T=D;2(D.m==\'1f\'){2(e.3c!=1b){4.15=e.3c;4.18=e.4Z}r 2(R $.w.1s==\'7\'){3 1s=$h.1s();4.15=e.3k-1s.3d;4.18=e.3i-1s.3j}r{4.15=e.3k-D.4Q;4.18=e.3i-D.4V}}1y(7(){4.T=4.15=4.18=C},3h)})};$.w.3e=7(){8 5.4T(\'A.4-1r 3f.4-1r\')};$.w.2q=7(19){3 a=[];2(5.E===0){8 a}3 4=5[0];3 1B=19?4.1H(\'*\'):4.2m;2(!1B){8 a}3 i,j,n,v,h,O,2p;Q(i=0,O=1B.E;i<O;i++){h=1B[i];n=h.l;2(!n){2l}2(19&&4.T&&h.m=="1f"){2(!h.1p&&4.T==h){a.z({l:n,p:$(h).17()});a.z({l:n+\'.x\',p:4.15},{l:n+\'.y\',p:4.18})}2l}v=$.1w(h,11);2(v&&v.1G==1n){Q(j=0,2p=v.E;j<2p;j++){a.z({l:n,p:v[j]})}}r 2(v!==C&&R v!=\'1b\'){a.z({l:n,p:v})}}2(!19&&4.T){3 $F=$(4.T),F=$F[0];n=F.l;2(n&&!F.1p&&F.m==\'1f\'){a.z({l:n,p:$F.17()});a.z({l:n+\'.x\',p:4.15},{l:n+\'.y\',p:4.18})}}8 a};$.w.4X=7(19){8 $.2n(5.2q(19))};$.w.53=7(12){3 a=[];5.1d(7(){3 n=5.l;2(!n){8}3 v=$.1w(5,12);2(v&&v.1G==1n){Q(3 i=0,O=v.E;i<O;i++){a.z({l:n,p:v[i]})}}r 2(v!==C&&R v!=\'1b\'){a.z({l:5.l,p:v})}});8 $.2n(a)};$.w.1w=7(12){Q(3 17=[],i=0,O=5.E;i<O;i++){3 h=5[i];3 v=$.1w(h,12);2(v===C||R v==\'1b\'||(v.1G==1n&&!v.E)){2l}v.1G==1n?$.52(17,v):17.z(v)}8 17};$.1w=7(h,12){3 n=h.l,t=h.m,1k=h.2c.2h();2(12===1b){12=11}2(12&&(!n||h.1p||t==\'1x\'||t==\'4Y\'||(t==\'24\'||t==\'26\')&&!h.2b||(t==\'A\'||t==\'1f\')&&h.4&&h.4.T!=h||1k==\'H\'&&h.29==-1)){8 C}2(1k==\'H\'){3 1K=h.29;2(1K<0){8 C}3 a=[],23=h.6;3 1m=(t==\'H-1m\');3 O=(1m?1K+1:23.E);Q(3 i=(1m?1K:0);i<O;i++){3 X=23[i];2(X.1q){3 v=X.p;2(!v){v=(X.2x&&X.2x[\'p\']&&!(X.2x[\'p\'].4g))?X.2r:X.p}2(1m){8 v}a.z(v)}}8 a}8 $(h).17()};$.w.2t=7(){8 5.1d(7(){$(\'F,H,1N\',5).3g()})};$.w.3g=$.w.3P=7(){8 5.1d(7(){3 t=5.m,1k=5.2c.2h();2(t==\'2r\'||t==\'3u\'||1k==\'1N\'){5.p=\'\'}r 2(t==\'24\'||t==\'26\'){5.2b=I}r 2(1k==\'H\'){5.29=-1}})};$.w.2a=7(){8 5.1d(7(){2(R 5.1x==\'7\'||(R 5.1x==\'3A\'&&!5.1x.4d)){5.1x()}})};$.w.4e=7(b){2(b===1b){b=11}8 5.1d(7(){5.1p=!b})};$.w.1q=7(H){2(H===1b){H=11}8 5.1d(7(){3 t=5.m;2(t==\'24\'||t==\'26\'){5.2b=H}r 2(5.2c.2h()==\'38\'){3 $1F=$(5).3W(\'H\');2(H&&$1F[0]&&$1F[0].m==\'H-1m\'){$1F.3Y(\'38\').1q(I)}5.1q=H}})};7 B(){2($.w.W.43){3 2e=\'[40.4] \'+1n.4a.41.1a(3r,\'\');2(N.2d&&N.2d.B){N.2d.B(2e)}r 2(N.1J&&N.1J.3q){N.1J.3q(2e)}}}})(4H);',62,315,'||if|var|form|this|options|function|return|xhr||||data||doc||el||||name|type|||value||else|||io||fn|||push|submit|log|null|target|length|input|error|select|false|url|trigger|context|success|window|max|extraData|for|typeof|aborted|clk|xml|responseText|ajaxSubmit|op|action|id||true|successful|attr|callbacks|clk_x|veto|val|clk_y|semantic|call|undefined|event|each|cb|image|body|sub|responseXML|dataType|tag|pre|one|Array|multipart|disabled|selected|plugin|offset|setAttribute|documentElement|ok|fieldValue|reset|setTimeout|ct|not|els|iframeSrc|innerHTML|timedOut|sel|constructor|getElementsByTagName|via|opera|index|complete|indexOf|textarea|isXml|ta|callback|json|location|timeout|DOM|href|scr|parsererror|ajaxForm|extraInputs|XMLDocument|doSubmit|parseJSON|ops|checkbox|mp|radio|new|fileUpload|selectedIndex|resetForm|checked|tagName|console|msg|beforeSerialize|beforeSubmit|toLowerCase|onload|in|iframe|continue|elements|param|getAttribute|jmax|formToArray|text|method|clearForm|status|active|getResponseHeader|attributes|remove|upload|ajaxError|POST|ajaxSettings|extend|1000px|src|global|beforeSend|closeKeepAlive|fileInputs|vetoed|serialize|validate|GET|oldSuccess|toXml|encoding|try|load|domCheckCount|headers|header|detachEvent|document|appendTo|enctype|attachEvent|contentWindow|contentDocument|test|content|isReady|ready|bind|option|javascript|string|script|offsetX|left|ajaxFormUnbind|click|clearFields|100|pageY|top|pageX|dataFilter|selector|httpData|ActiveXObject|nodeName|postError|arguments|getTime|_|password|element|jqFormIO|match|https|of|object|css|trim|Date|no|abort|setRequestHeader|aborting|ajaxStart|ajaxSend|getAllResponseHeaders|statusText|process|or|absolute|clearInputs|skipping|position|must|replaceWith|replaceTarget|html|parent|apply|find|toUpperCase|jquery|join|isFunction|debug|instanceof|file|get|Form|Error|blank|prototype|have|alert|nodeType|enable|ajax|specified|notify|about|skipEncodingOverride|250|zero|terminating|queuing|textContent|globalEval|available|found|throw|isDefaultPrevented|isXMLDoc|requeing|onLoad|catch|caught|async|loadXML|XMLDOM|removeData|Microsoft|ajaxStop|DOMParser|ajaxSuccess|jQuery|ajaxComplete|eval|parseFromString|preventDefault|by|removeEventListener|parseXML|removeAttr|offsetLeft|finally|addEventListener|unbind|hidden|offsetTop|forceSync|formSerialize|button|offsetY||closest|merge|fieldSerialize|is'.split('|'),0,{}));
 
// ----------------------------------------------------------------------------
// Pagination Plugin - A jQuery Plugin to paginate content
// v 1.0 Beta
// Dual licensed under the MIT and GPL licenses.
// ----------------------------------------------------------------------------
// Copyright (C) 2010 Rohit Singh Sengar
// http://rohitsengar.cueblocks.net/
// ----------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ----------------------------------------------------------------------------

//------------ initializing all the values needed in paginator. -----------------

	//--- Variables for internal use ----

	var pageElement = Array();

	var paginatorId = '';

	var currentPage = 1; // current page, default 1

	var allItems = 0; // no. of repeating items in the container where paginator is applied

	var lastPage = 1; // last page, default 1

	//--- Attributes that can be changed according to use ---

	var startPage = 1; // start page

	var itemsPerPage = 4; // no. of items you want to show on one page

	var firstPageSymbol = '<< First'; // to indicate First Page

	var previousPageSymbol = '< Prev'; // to indicate Previous Page

	var nextPageSymbol = 'Next >'; // to indicate Next Page

	var lastPageSymbol = 'Last >>'; // to indicate Last Page

	var separator = '  '; // To separate paginator's items

	var paginatorPosition = 'bottom'; // where you want the paginator to be. Accepted values are 'top','bottom','both'

	var paginatorStyle = 3; // To define which style of paginator you need.
	// 1 - for << | < | 1 | 2 | 3 | > | >>
	// 2 - for << | < | 1/8 | > | >>
	// 3 - for < | 1 | 2 | 3 | >
	// 4 - for < | >
    
	var enablePageOfOption = false; // it shows on which are you currently, i.e. Page 3 of 6 Page(s), if turned true
    
	var enableGoToPage = false; // shows a drop down of all pages for go/jump to any page user want to go, if turned true. Useful incase there are large no. of pages
    
    var textGoToPage = 'Go to'; // text for above option. You can change it to 'Jump to Page' or anything you like. The above option needs to turned on for this.
    
	var enableSelectNoItems = false; // if you want to change items per page on the fly.
    
    var textSelectNoItems = 'Items Per Page'; // text for above option. You can change it to 'Change No. of tag/page' or anything you like. The above option needs to turned on for this.

	var paginatorValues = Array(5,10,15,20,25,30); // list of values for above option (enableSelectNoItems).

    var anchorLink = 'javascript:void(0);'; // if you want to change href of the paginator anchor text (links for page) to '#' or to something else. As # is append on the address bar upon clicking I used javascript:void(); which is clean.
    
    var showIfSinglePage = true; // set it tp false if you don't want to show paginator incase there is only one page, true if show paginator even if there is just one page.


//-----------functions starts----------------------------------------------------
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1c.1d.1e({1f:A(){j=M;R(1g){y\'1h\':{j.S(\'<m 7="u"></m>\');z}y\'1i\':{j.N(\'<m 7="u"></m>\');z}y\'1j\':{j.S(\'<m 7="u"></m>\');j.N(\'<m 7="u"></m>\');z}T:{j.N(\'<m 7="u"></m>\')}}O()},1k:A(){$(\'.u\').1l();j.B().P()}});A O(){9(n<1)n=5;J=j.B().U;9(J%n==0)q=V(J/n);v q=V(J/n)+1;9((F<1)||(F>q))F=1;9(!1m){9(q>1)r(F,1)}v r(F,1)}A r(a,b){9(a<0){9(a==-1)a=w-1;v a=w+1}w=a;G=(w-1)*n;9(!b){j.1n("W",A(){Q();j.B().X();j.B().Y(G,n+G).P();j.1o("W")})}v{Q();j.B().X();j.B().Y(G,n+G).P()}}A Q(){$(".u").Z("");t a=\'\';t b=\'\';t c=\'\';t d=\'\';t e=\' 8 \'+w+\' 10 \'+q+\' 8(s) \';t f=\' \'+1p+\' <K 11="r(M.C);" >\';t g=\' \'+1q+\' <K 11="n=1r(M.C);O();" >\';12(t i=0;i<D.U;i++){9(n==D[i])g+=\'<x C="\'+D[i]+\'" L="L">\'+D[i]+\'</x>\';v g+=\'<x C="\'+D[i]+\'">\'+D[i]+\'</x>\'}g+=\'</K>\';9(w==1){6=\'<a k="\'+l+\'" 7="o" h="13 8">\'+14+\'</a>\'+p;a=b=6;6=\'<a k="\'+l+\'" 7="o" h="15 8">\'+16+\'</a>\'+p;a+=6;b+=6;c+=6;d+=6}v{6=\'<a k="\'+l+\'" 7="H" I="r(1);" h="13 8">\'+14+\'</a>\'+p;a=b=6;6=\'<a k="\'+l+\'" 7="H" I="r(-1);" h="15 8">\'+16+\'</a>\'+p;a+=6;b+=6;c+=6;d+=6}12(t i=1;i<=q;i++){9(i==w){a+=\'<a k="\'+l+\'" 7="o" h="8 \'+i+\'">\'+i+\'</a>\'+p;b+=\'<a k="\'+l+\'" 7="o" h="8 \'+i+\'">\'+i+\'/\'+q+\'</a>\'+p;c+=\'<a k="\'+l+\'" 7="o" h="8 \'+i+\'">\'+i+\'</a>\'+p;f+=\'<x C="\'+i+\'" L="L">\'+i+\'</x>\'}v{6=\'<a k="\'+l+\'" 7="H" I="r(\'+i+\');" h="8 \'+i+\'">\'+i+\'</a>\'+p;a+=6;c+=6;f+=\'<x C="\'+i+\'">\'+i+\'</x>\'}}f+=\'</K>\';9(w==q){6=\'<a k="\'+l+\'" 7="o" h="17 8">\'+18+\'</a>\';a+=6;b+=6;c+=6;d+=6;6=p+\'<a k="\'+l+\'" 7="o" h="19 8">\'+1a+\'</a>\';a+=6;b+=6}v{6=\'<a k="\'+l+\'" 7="H" I="r(-2);" h="17 8">\'+18+\'</a>\';a+=6;b+=6;c+=6;d+=6;6=p+\'<a k="\'+l+\'" 7="H" I="r(\'+q+\');" h="19 8">\'+1a+\'</a>\';a+=6;b+=6}R(1s){y 1:6=a;z;y 2:6=b;z;y 3:6=c;z;y 4:6=d;z;T:6=a}9(1t)6+=\'<E 7="o" h="8 1u">\'+e+\'</E>\';9(1v)6+=\'<E 7="o" h="1b 8">\'+f+\'</E>\';9(1w)6+=\'<E 7="o" h="1b 1x. 10 1y 1z 1A">\'+g+\'</E>\';$(".u").Z(6)}',62,99,'||||||style|class|Page|if||||||||title||paginatorId|href|anchorLink|div|itemsPerPage|inactive|separator|lastPage|appendContent||var|paginator|else|currentPage|option|case|break|function|children|value|paginatorValues|span|startPage|till|active|onclick|allItems|select|selected|this|after|initPaginator|show|createPaginator|switch|before|default|length|parseInt|medium|hide|slice|html|of|onchange|for|First|firstPageSymbol|Previous|previousPageSymbol|Next|nextPageSymbol|Last|lastPageSymbol|Select|jQuery|fn|extend|pagination|paginatorPosition|top|bottom|both|depagination|remove|showIfSinglePage|fadeOut|fadeIn|textGoToPage|textSelectNoItems|Number|paginatorStyle|enablePageOfOption|Information|enableGoToPage|enableSelectNoItems|no|items|per|page'.split('|'),0,{}));

(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}
fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)
return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];return colors[jQuery.trim(color).toLowerCase()];}
function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))
break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};})(jQuery);

(function( $ )
{
	$.extend( 
	{
		jTwitter: function( username, numPosts, fnk ) 
		{
			var info = {};
			
			// If no arguments are sent or only username is set
			if( username == 'undefined' || numPosts == 'undefined' ) 
			{
				return;
			}
			else if( $.isFunction( numPosts ) ) 
			{
				// If only username and callback function is set
				fnk = numPosts;
				numPosts = 5;
			}
			
			var url = 'http://twitter.com/status/user_timeline/' + username + '.json?count=' + numPosts + '&callback=?';

			$.getJSON( url, function( data )
			{
				if( $.isFunction( fnk ) ) 
				{
					fnk.call( this, data );
				}
			});
		}
	});
})( jQuery );

var browser = function() {
  var ua = navigator.userAgent;
  return {
	ie: ua.match(/MSIE\s([^;]*)/)
  };
}();

function time_ago(dateString)
{
	  var rightNow = new Date();
	  var then = new Date(dateString);

	 if (browser.ie) {
		// IE can't parse these crazy Ruby dates
		then = Date.parse(dateString.replace(/( \+)/, ' UTC$1'));
	 }

	  var diff = rightNow - then;

	  var second = 1000,
		  minute = second * 60,
		  hour = minute * 60,
		  day = hour * 24,
		  week = day * 7;

	  if (isNaN(diff) || diff < 0) {
		return ""; // return blank string if unknown
	  }

	  if (diff < second * 2) {
		// within 2 seconds
		return "right now";
	  }

	  if (diff < minute) {
		return Math.floor(diff / second) + " seconds ago";
	  }

	  if (diff < minute * 2) {
		return "about 1 minute ago";
	  }

	  if (diff < hour) {
		return Math.floor(diff / minute) + " minutes ago";
	  }

	  if (diff < hour * 2) {
		return "about 1 hour ago";
	  }

	  if (diff < day) {
		return  Math.floor(diff / hour) + " hours ago";
	  }

	  if (diff > day && diff < day * 2) {
		return "yesterday";
	  }

	  if (diff < day * 365) {
		return Math.floor(diff / day) + " days ago";
	  }

	  else {
		return "over a year ago";
	  }
};

function convertString(str) 
{
	var tweet = str;
	tweet = tweet.replace(/http([s]?):\/\/([^\ \)$]*)/g,"<a rel='nofollow' class='external' href='http$1://$2'>http$1://$2</a>");
	tweet = tweet.replace(/(^|\s)@(\w+)/g, "$1@<a class='external' href='http://www.twitter.com/$2'>$2</a>");
	
	$('a[class*="external"]').click(function()
    {
		$('a[class*="external"]').attr('target', '_blank');
	});
	
	return tweet;
}

$.validator.addMethod("defaultValidate", function(value, element, param) 
{
	if (value == element.defaultValue) 
	{
		return false;
	}
	else
	{
		return true;
	}
}, "This field is required");

function resetForm(id)
{
	$('#' + id).each(function()
	{
		this.reset();
	});
}

function load_dealer_results () {
	var searchData = $('#dealer-search').serialize();
	$.getJSON("/dealer/get_dealers?" + searchData + "", function ( data ) {
		var results = "",
			split = searchData.split('&'),	
			link = split[1];
			
		if ( data !== null ) {
			$.each(data.results, function () {
				$.each(this, function ( k, v ) {
					$.each(v, function () {
						results += '<li><a href="/dealer?' + link + '"><strong>' + this.dealerName + '</strong>' + this.suburb + ', ' + this.state +', ' + this.postcode + '</a></li>';
					});
				});
			});

			$( '#dealer-search' ).attr( 'action', '/dealer?' + link + '' );
			$( '.results' ).html( '<div class="show-results">Showing <em style="font-style: normal;">3</em> of ' + data.resultsTotal + ' <span>Results</span></div><ul>' + results + '</ul><p class="see-all"><a href="/dealer?' + link + '">See all</a></p>');
			
			var count = $('.results li').size();
			$('.show-results em').html('' + count + '');
			
		} else {
			$( '#dealer-search' ).attr( 'action', '/dealer' );
			$( '.results' ).html('<div class="no-results">No results</div>');
		}
	});
}

function display_loader () {
	$( '.results' ).html( '<div class="loading"><img src="/images/build-fpv/backgrounds/loader.gif"></div>' );
}

$().ready(function()
{
	$('a[class*="external"]').click(function()
    {
		$('a[class*="external"]').attr('target', '_blank');
	});
	
	if (!$('body').is('.home, .dealer'))
	{
		SetSlideoutMenu();
	}
	
	if ($('body').hasClass('home'))
	{
		//flowPlayer();
		videoPlayer();
	}
	
	
	// Find a dealer
	$( '#dealer-search' ).keyup( function ( e ) {
		e.preventDefault();
		display_loader();
		load_dealer_results();
	} );
	

	$('.video').find('a').each(function(e)
	{
		var $this = $(this);
		$this.click(function()
		{
			$('body').append('<div id="galleryBackground" />');
			$('#galleryBackground').css({'opacity':'0.8'}).fadeIn('fast');
			$('body').append('<div id="galleryPopup" />');
			
			var image = $this.attr('href');
			var caption = $this.attr('title');
			var currentSlide = e+1;

			var windowWidth = document.documentElement.clientWidth;
			var windowHeight = document.documentElement.clientHeight;
			var popupHeight = $("#galleryPopup").height();
			var popupWidth = $("#galleryPopup").width();
			var left = windowWidth/2-popupWidth/2;
			var leftPos = left;
			
			var link = $this.attr('href');
			var videoLink = link.split('/');
			
			$("#galleryPopup").css({'height':'375px','position':'fixed','top':'95px','z-index':'9999','left':leftPos}).html('<div class="galleryContainer clearfix"><a class="close" href="#"></a><iframe src="http://player.vimeo.com/video/' + videoLink[3] + '?title=0&amp;byline=0&amp;portrait=0&amp;color=88c021&amp;autoplay=1" width="750" height="360" frameborder="0"></iframe></div>');
			
			$('.close').click(function()
			{
				$('#galleryBackground, #galleryPopup').remove();
				return false;
			});
			
			return false;
		});
	});
	
	
	function enlargeImagePopup(id, src, caption) {
	
		var body = $('body');
	
		body.append('<div id="galleryBackground" />').find('#galleryBackground').css({
			display: 'block',
			background: '#000',
			opacity: 0.8
		});
		body.append('<div id="galleryPopup" class="galleryPane" />');
		
		var windowWidth = document.documentElement.clientWidth;
		var windowHeight = document.documentElement.clientHeight;
		var popupHeight = $("#galleryPopup").height();
		var popupWidth = $("#galleryPopup").width();
		var top = windowHeight/2-popupHeight/2;
		var left = windowWidth/2-popupWidth/2;
		var topPos = top;
		var leftPos = left;
		
		$('#galleryPopup').css({
			position: 'fixed',
			top: topPos,
			left: leftPos,
			zIndex: 9999
		});
		
		$(window).resize(function() {
			var windowWidth = document.documentElement.clientWidth;
			var windowHeight = document.documentElement.clientHeight;
			var popupHeight = $("#galleryPopup").height();
			var popupWidth = $("#galleryPopup").width();
			var top = windowHeight/2-popupHeight/2;
			var left = windowWidth/2-popupWidth/2;
			var topPos = top;
			var leftPos = left;
			
			$('#galleryPopup').css({
				position: 'fixed',
				top: topPos,
				left: leftPos,
				zIndex: 9999
			});
		});
		
		var html = '<div class="galleryContainer clearfix">';
				html += '<a class="close" href="#"></a>';
				html += '<img src="' + src + '" width="750" height="540" alt="" class="imageDisplay" />';
				html += '<p class="caption">' + caption + '</p>';
				html += '<span class="arrow-prev"><a href="#" class="prev"><</a></span><span class="arrow-next"><a href="#" class="next">></a></span>';
			html += '</div>';
		
		$('#galleryPopup').html('' + html + '');
		
		$('.prev').click(function(e) {
			e.preventDefault();
			var active = $('.gallery-list').find('.image.active');
			if ( active.length == 0 ) active = $('.gallery-list').find('.image:first');
			
			var prev = active.prev('.image').length ? active.prev('.image') : $('.gallery-list').find('li:last');
			
			active.removeClass('active');
			prev.addClass('active');
			
			id = prev.attr('id'),
			caption = prev.find('a').attr('title');

			$('#galleryBackground, #galleryPopup').remove();
			enlargeImagePopup(prev.attr('id'), $('#' + id).find('a').attr('href'), caption);
		}).mouseenter(function() {
			$('.prev').css({'opacity':'0.6'});
		}).mouseleave(function() {
			$('.prev').css({'opacity':'0'});
		});
		
		$('.next').click(function(e) {
			e.preventDefault();
			var active = $('.gallery-list').find('.image.active');
			if ( active.length == 0 ) active = $('.gallery-list').find('.image:last');
			
			var next = active.next('.image').length ? active.next('.image') : $('.gallery-list').find('li:first');
			
			active.removeClass('active');
			next.addClass('active');
			
			id = next.attr('id'),
			caption = next.find('a').attr('title');

			$('#galleryBackground, #galleryPopup').remove();
			enlargeImagePopup(next.attr('id'), $('#' + id).find('a').attr('href'), caption);
		}).mouseenter(function() {
			$('.next').css({'opacity':'0.6'});
		}).mouseleave(function() {
			$('.next').css({'opacity':'0'});
		});

		$('.close').click(function(e){
			e.preventDefault();
			$('.gallery-list li').removeClass('active');
			$('#galleryBackground, #galleryPopup').remove();
		});
	}
	
	$('.gallery-list li').mouseenter(function()
	{
		$(this).find('.black').stop().show().animate({'opacity':'0.3'}, 200, 'easeOutExpo');
		$(this).find('.overlay').stop().show().animate({'left':'0'}, 200, 'easeOutExpo');
	}).mouseleave(function()
	{
		$(this).find('.black').stop().show().animate({'opacity':'0'}, 200, 'easeOutExpo');
		$(this).find('.overlay').stop().show().animate({'left':'65'}, 200, 'easeOutExpo');
	}).click(function(e)
	{
		e.preventDefault();
		
		var $this = $(this),
			id = $this.attr('id'),
			caption = $this.find('a').attr('title'),
			image = $this.find('a').attr('href');
		
		enlargeImagePopup(id, image, caption);
		
		$('.gallery-list li#' + id).addClass('active');
		
	});
	
	$(document).keydown(function(e) {
		if ( e.keyCode === 27 ) {
			$('#galleryBackground, #galleryPopup').remove();
		}
	});
	
	
	
	var url = document.URL.split('#')[1];
	if(url === undefined)
	{
		url = '';
	}
	
	if (url !== '')
	{
		tabs(url);
	}
	$('.specs').click(function()
	{
		tabs('tab-3');
		return false;
	});
	
	var pageType = 'press_list';
	
	$('#tabs div.tab').hide();
	$('#tabs div.tab.active').show();
	$('#tabs ul.tabs li a.tabLink').click(function()
	{
		var currentTab = $(this).attr('href');
		
		if (currentTab == '#tab-3')
		{
			$('.inner').addClass('engine').removeClass('gt');
		}
		else
		{
			$('.inner').removeClass('engine').addClass('gt');
		}
		
		if (currentTab == '#tab-2')
		{
			pageType = 'news_list';
			$('.paginator').remove();
			$("." + pageType).pagination();
		}
		else
		{
			pageType = 'press_list';
			$('.paginator').remove();
			$("." + pageType).pagination();
		}
		
		$('#tabs ul.tabs li').removeClass('active');
		$(this).parent().addClass('active');
		$('#tabs div.tab').hide();
		$(currentTab).show();
		return false;
	});
	
	$('#history div.unit').hide();
	$('#history div.unit.active').show();
	$('#history ul.models li a').click(function()
	{
		var currentTab = $(this).attr('href');
		
		$('#history ul.models li').removeClass('active');
		$(this).parent().parent().parent().addClass('active');
		$('#history div.unit').hide();
		$(currentTab).show();
		return false;
	});
	
	if ( $( 'body' ).hasClass( 'build-FPV' ) ) {
	
	} else {
		$("." + pageType).pagination();
	
	
		$('.news .col2 .twitter').append('<div class="tweet" />');
		$.jTwitter('officialFPV', 1, function(data)
		{
			$('.news .col2 .tweet').empty();
			$.each(data, function(i, post)
			{
				var date = time_ago(post.created_at);
				var reply = '<a class="twtr-reply" href="http://twitter.com/?status=@officialFPV%20&in_reply_to_status_id=' + post.id + '&in_reply_to=bikes_direct_au">reply<\/a>';
				var retweetText = convertString(post.text);
				var status = '<a class="twtr-reply" href="http://twitter.com/officialFPV/status/' + post.id + '">' + date + '</a>';
				$('.news .col2 .tweet').append('<div>' + retweetText + '</div><span class="tweet-icon"><a href="http://twitter.com/@officialFPV" target="_blank">FPV</a></span>');
			});
		});
	
	}

	
	$('#register')
		.bind('expand', function(e, $sourceElement)
		{
			if ($sourceElement)
			{
			
				var ebSession = '[SessionID]';
				var ebRand = Math.random()+'';
				ebRand = ebRand * 1000000;
				
				$('body').find('.end').remove();
				$('body').prepend('<scr'+'ipt src="HTTP://bs.serving-sys.com/BurstingPipe/ActivityServer.bs? cn=as&amp;ActivityID=149852&amp;rnd=' + ebRand + '&amp;Session='+ebSession+'" class="start"></scr' + 'ipt>');
			
				$sourceElement.removeClass('expand').addClass('collapse').text('Close');
				$('#register-panel').stop().show().css({'height': 0}).animate({'height':150, 'opacity': 1},{queue: false, duration: 600, easing: 'easeOutExpo'}).removeClass('expand').addClass('collapse');
			}
		})
		.bind('collapse', function(e, $sourceElement)
		{
			if ($sourceElement)
			{
				$sourceElement.removeClass('collapse').addClass('expand').text('Register');
				$('#register-panel').animate({'height':0, 'opacity': 0},{queue: false, duration: 600, easing: 'easeInExpo'}).removeClass('collapse').addClass('expand');
				$('#registerForm')
					.css(
						{
							'margin' : '20px 0 0 0'	
						}
					);
				$('#register-panel .success')
					.hide();
			}
		});

	$('#register').click(function(e)
	{
		var $t = $(e.target);
		if($t.is('a:not(.disabled)'))
		{
			$(this).trigger($t.attr('class'), [$t]);
		}
		return false;
	});
	
	// Form validation
	$('#registerForm').validate(
	{
		rules:
		{
			'cm-name': "defaultValidate",
			'cm-f-jlr': "defaultValidate",
			'cm-mo-mo':
			{
				required: true,
				email: true
			},
			'confirmemail':
			{
				required: true,
				equalTo: "#email"
			}
		},
		messages:
		{
			'cm-name': "Please enter your first name.",
			'cm-f-jlr': "Please enter your last name.",
			'cm-mo-mo': "Please enter a valid email address.",
			'confirmemail':
			{
				required: "Please enter a valid email address.",
				equalTo: "Please enter the same email address."
			}
		}
	});

	
	$('#enquiry')
		.validate(
			{
				submitHandler: function(form)
				{
					//$(form).ajaxSubmit(contactOptions);
					//console.log($(form).serialize());
					$.ajax(
						{
							type: "POST",
							url: "/js/dataconnect.php",
							data: $(form).serialize(),
							success: function(data)
							{
								var ebSession = '[SessionID]';
								var ebRand = Math.random()+'';
								ebRand = ebRand * 1000000;
								
								$('body').find('.start').remove();
								$('body').prepend('<scr'+'ipt src="HTTP://bs.serving-sys.com/BurstingPipe/ActivityServer.bs? cn=as&amp;ActivityID=149853&amp;rnd=' + ebRand + '&amp;Session='+ebSession+'" class="end"></scr' + 'ipt>');
								
								//console.log(data);
								$('.row-send').html('<strong class="heading">Thank you for your request.</strong>');
								
							},
							error: function()
							{
								//console.log('error');
							}
						}
					);
					return false;
				},
				highlight: function(element)
				{
					$(element).parent().addClass("att");
				},
				unhighlight: function(element)
				{
					$(element).parent().removeClass("att");
				},
				rules:
				{
					firstname : "defaultValidate",
					surname: "defaultValidate",
					address: "defaultValidate",
					suburb: "defaultValidate",
					postcode: "defaultValidate",
					mobile: "defaultValidate",
					email: 
					{
						required: true,
						email: true
					}
				},
				messages:
				{
					firstname: "Please enter your first name",
					surname: "Please enter your surname",
					address: "Please enter your address",
					suburb: "Please enter your suburb",
					postcode: "Please enter your postcode",
					mobile: "Please enter your mobile phone",
					email: "Please enter a valid address"
				}
			}
		);
	
	$('#register-panel .success').fadeOut();
	
	$('#registerForm')
		.submit(function(e)
			{
				e.preventDefault();
				$.getJSON(this.action + "?callback=?", $(this).serialize(), function(data)
				{
					if(data.Status === 400)
					{
						$('#register-panel .success')
							.fadeIn()
							.css(
								{
									'position' : 'absolute',
									'top' : '10px',
									'right' : '10px',
									'font-size' : '11px'
								}
							)
							.html(data.Message);
						$('#register-panel')
							.animate(
								{
									'height' : '220px'	
								}
							);
						$('#registerForm')
							.css(
								{
									'margin' : '40px 0 0 0'	
								}
							);
					}
					else
					{
						/*var ebRand = Math.random()+'';
						ebRand = ebRand * 1000000;
						$('body').find('.start').remove();
						$('body').prepend('<scr'+'ipt src="HTTP://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&amp;ActivityID=149853&amp;rnd=' + ebRand + '" class="end"></scr' + 'ipt>');*/

					
						$('#register-panel .success')
							.fadeIn()
							.css(
								{
									'position' : 'absolute',
									'top' : '10px',
									'right' : '10px',
									'font-size' : '11px'
								}
							)
							.html('Thank you for registering to FPV! ');
						$('#register-panel')
							.animate(
								{
									'height' : '200px'	
								}
							);
						$('#registerForm')
							.css(
								{
									'margin' : '40px 0 0 0'	
								}
							);
						resetForm('registerForm');
					}
				});
			}
		);

	
	$('#contactUsForm .success')
		.fadeOut();
	var contactOptions = {
		type: "POST",
		url: "/js/send-contact-us.php",
		data: $('#contactUsForm').serialize(),
		success: function(html)
		{
			var ebRand = Math.random()+'';
			ebRand = ebRand * 1000000;
			$('body').find('.start').remove();
			$('body').prepend('<scr'+'ipt src="HTTP://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&amp;ActivityID=149855&amp;rnd=' + ebRand + '" class="end"></scr' + 'ipt>');
		
			$('#contactUsForm .success')
				.fadeIn()
				.css(
					{
						'padding' : '10px 0 10px 0'
					}
				)
				.html(html);
		},
		resetForm: true
	};
	
	$('#contactUsForm')
		.validate(
			{
				submitHandler: function(form)
				{
					$(form).ajaxSubmit(contactOptions);
				},
				rules:
				{
					'firstname' : 'defaultValidate',
					'lastname' : 'defaultValidate',
					'comments' : 'defaultValidate',
					'email':
					{
						required: true,
						email: true
					}
				},
				messages:
				{
					'firstname' : 'Please enter your first name',
					'lastname' : 'Please enter your last name',
					'comments' : 'Please enter your comment(s)',
					'email' : 'Please enter a valid email address'
				}
			}
		);
	
	
	$('.rev')
		.css(
			{
				'background' : 'url(/images/general/csg-4e65603ac8ae8.png) 0 -1128px'
			}
		)
		.click(function()
			{
				var $this = $(this);
				$this
					.css(
						{
							backgroundPosition : '0 -1783px'
						}
					);
				document.getElementById('audio').currentTime = 0;
				document.getElementById('audio').play();
			}
		)
		.mouseleave(function()
			{
				var $this = $(this);
				$this
					.css(
						{
							backgroundPosition : '0 -1128px'
						}
					);
			}
		);
		
	
		
	$('.rev2')
		.css(
			{
				'display' : 'block',
				'width' : '209px',
				'height' : '130px',
				'background' : 'url(/images/general/csg-4e65603ac8ae8.png) 0 -1267px'
			}
		)
		.click(function()
			{
				var $this = $(this);
				$this
					.css(
						{
							'background-position' : '0 -1636px'
						}
					);
				//this.play();
				document.getElementById('audio').currentTime = 0;
				document.getElementById('audio').play();
			}
		)
		.mouseleave(function()
			{
				var $this = $(this);
				$this
					.css(
						{
							'background-position' : '0 -1267px'
						}
					);
				//document.getElementById('audio').currentTime = 0;
				//document.getElementById('audio').pause();
			}
		);
	
	var modelList = $('.model-list').find('ul');
		
	$(modelList)
		.find('li')
		.children('a')
		.each(function()
			{
				var $this = $(this),
					img = $this.find('img'),
					model = $this.find('.model'),
					date = $this.find('.date'),
					arrow = $this.find('.arrow');
					
				date
					.css(
						{
							'color' : '#fff',
							'font-size' : '45px',
							'font-family' : "'Gothic821Regular'",
							'line-height' : '46px',
							'position' : 'absolute',
							'top' : '10px',
							'left' : '15px',
							'z-index' : '41'
						}
					);
					
				model
					.css(
						{
							'color' : '#fff',
							'font-size' : '30px',
							'font-family' : "'Gothic821Regular'",
							'font-weight' : 'normal',
							'position' : 'absolute',
							'top' : '30px',
							'left' : '110px',
							'z-index' : '30'
						}
					);
					
				arrow
					.css(
						{
							'background' : 'url(/images/history/arrow.png) no-repeat 0 0',
							'position' : 'absolute',
							'left' : '250px',
							'top' : '25px',
							'height' : '80px',
							'width' : '80px',
							'z-index' : '31'
						}
					);
					
				/*$this
					.find('.info')
					.css(
						{
							'height' : '65px',
							'padding' : '0',
							'z-index' : '5',
							'background' : 'none',
							'font-size' : '0',
							'bottom' : '0'
						}
					)
					.children('.date')
					.css(
						{
							'background' : 'none',
							'font-size' : '46px',
							'line-height' : '46px',
							'padding' : '8px 12px 8px 12px'
						}
					);*/
				//model.css({'vertical-align':'bottom','padding':'0 0 14px 0','font-size':'20px','position':'relative','z-index':'2'});
				/*$this
					.append('<div class="overlay" />')
					.find('.overlay')
					.css(
						{
							'width' : '327px',
							'height' : '65px',
							'background' : '#2a3033',
							'position' : 'absolute',
							'bottom' : '-65px',
							'left' : '0',
							'z-index': '2'
						}
					);*/
				
				//$this.find('.model').hide();
				$this
					.mouseenter(function()
						{
							var $this = $(this),
								img = $this.find('img'),
								model = $this.find('.model'),
								date = $this.find('.date'),
								arrow = $this.find('.arrow');
								
								/*$this
									.find('.overlay')
									.animate(
										{
											'bottom' : '0'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);*/
									
									
									model
									.animate(
										{
											'color':'#3b3934'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
									
										date
									.animate(
										{
											'color':'#3b3934'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
									
									arrow
									.animate(
										{
											'left':'300px'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
									
									
									
								
								img
									.animate(
										{
											'top': '65px'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
								//model.css({'color:#282b34':'1'});
								//#2a3033
						}
					)
					.mouseleave(function()
						{
							var $this = $(this),
								img = $this.find('img'),
								model = $this.find('.model'),
								date = $this.find('.date'),
								arrow = $this.find('.arrow');
								
								/*$this
									.find('.overlay')
									.animate(
										{
											'bottom' : '-65px'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);*/
									
									date
									.animate(
										{
											'color':'#fff'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
									
									arrow
									.animate(
										{
											'left':'250px'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
								
								img
									.animate(
										{
											'top': '0'
										},
										{
											queue : false,
											duration : 300,
											easing : 'easeInOutExpo'
										}
									);
								//model.css({'vertical-align':'bottom','padding':'0 0 14px 0','font-size':'20px','position':'relative','z-index':'2'});
						}
					)
					.css(
						{
							'display' : 'block',
							'width' : '327px',
							'height' : '255px',
							'background' : '#dcd9d2',
							'position' : 'relative'
						}
					);
				
				img
					.css(
						{
							'position' : 'absolute',
							'top' : '0',
							'left' : '0',
							'z-index' : '40'
						}
					);
			}
		);
	
	$("input[type$='text']").focus(function() 
	{
		if( this.value === this.defaultValue ) 
		{
			this.value = "";
		}
	}).blur(function() 
	{
		if( !this.value.length ) 
		{
			this.value = this.defaultValue;
		}
	});
	
	$("textarea").focus(function() 
	{
		if( this.value === this.defaultValue ) 
		{
			this.value = "";
		}
	}).blur(function() 
	{
		if( !this.value.length ) 
		{
			this.value = this.defaultValue;
		}
	});
});


function tabs(url)
{
	$('#tabs ul.tabs li').find('a').each(function()
	{
		var link = $(this).attr('href');
		var href = link.split('#');
		$(this).parent().removeClass('active');
		
		if(href[1] != undefined)
		{
			if(href[1] === url)
			{
				$(this).parent().addClass('active');
				$('#' + href[1]).addClass('active');
			}
			if ('#' + href[1] === '#tab-3')
			{
				$('.inner').removeClass('gt').addClass('engine');
				$('#tabs div.tab').removeClass('active').hide();
				$('#tabs div#tab-3').addClass('active').show();
			}
			else
			{
				$('.inner').removeClass('engine').addClass('gt');
			}
		}
	});
}

function videoPlayer()
{
	/*var video = document.getElementById('video');
	if (typeof video.loop == 'boolean')
	{
		video.loop = true;
	}
	else
	{
		video.addEventListener('ended', function()
		{
			this.currentTime = 0;
			this.play()
		}, false);
	}
	video.addEventListener('click', playControl, false);
	video.play();
	
	function playControl()
	{
		if (video.paused == false)
		{
			video.pause();
			this.firstChild.nodeValue = 'Play';
		} 
		else 
		{
			video.play();
			this.firstChild.nodeValue = 'Pause';
		}
	}*/
}

function SetSlideoutMenu()
{
	//$('.side-panel').addClass('side-panel-hidden');
	$('.side-panel').delay(800).animate({'height': 42}, {queue: true, duration: 600, easing: 'easeOutExpo'}).toggleClass('side-panel-hidden');
	
	$('.side-panel-hidden').mouseenter(function()
	{
		$(this).stop().animate({height: 438}, {queue: false, duration: 600, easing: 'easeOutExpo'}).removeClass('side-panel-hidden').addClass('side-panel-show');
	}).mouseleave(function()
	{
		$(this).stop().animate({ height: 42 }, {queue: false, duration: 600, easing: 'easeOutExpo'}).toggleClass('side-panel-hidden side-panel-show');
	});
	
	
	$('.showroom').click(function() {
		if($(this).parents().hasClass('side-panel-hidden')){
			$('.side-panel').stop().animate({'height': 438}, {queue: false, duration: 600, easing: 'easeOutExpo'}).toggleClass('side-panel-hidden side-panel-show');
		} else {
			$('.side-panel').stop().animate({'height': 42}, {queue: false, duration: 600, easing: 'easeOutExpo'}).toggleClass('side-panel-hidden side-panel-show');
		}
		return false;
	});
}

function flowPlayerPlay()
{
	flowplayer("player", {src: "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", wmode: "transparent"},
	{
		clip:
		{
			autoPlay: true,
			autoBuffering: true,
			onBeforeFinish: function () 
			{
				// hide play again button
				//this.getPlugin("play").css({opacity: 0});
				return false;
			}
		},
		plugins: 
		{
			//controls: null		
		}
	});
}

function flowPlayerPause()
{
	var player = flowplayer("player", {src: "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", wmode: "transparent"},
	{
		clip:
		{
			autoPlay: false,
			autoBuffering: true,
			onBeforeFinish: function () 
			{
				// hide play again button
				//this.getPlugin("play").css({opacity: 0});
				return false;
			}
		},
		plugins: 
		{
			//controls: null		
		}
	});
	player.pause();
}
