
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0
build: 1549
*/
if (typeof YUI === "undefined"|| !YUI || YUI.version !== '3.0.0') {
	(function(){var I={},B=new Date().getTime(),A,E,H=function(){if(window.addEventListener){return function(M,L,K,J){M.addEventListener(L,K,(!!J));};}else{if(window.attachEvent){return function(L,K,J){L.attachEvent("on"+K,J);};}else{return function(){};}}}(),F=function(){if(window.removeEventListener){return function(M,L,K,J){M.removeEventListener(L,K,!!J);};}else{if(window.detachEvent){return function(L,K,J){L.detachEvent("on"+K,J);};}else{return function(){};}}}(),D=function(){YUI.Env.windowLoaded=true;YUI.Env.DOMReady=true;F(window,"load",D);},C={"io.xdrReady":1,"io.xdrResponse":1},G=Array.prototype.slice;if(typeof YUI==="undefined"||!YUI){YUI=function(O,N,M,L,J){var K=this,R=arguments,Q,P=R.length;if(!(K instanceof YUI)){return new YUI(O,N,M,L,J);}else{K._init();for(Q=0;Q<P;Q++){K._config(R[Q]);}K._setup();return K;}};}YUI.prototype={_config:function(N){N=N||{};var O=this.config,L,K,J,M;M=O.modules;for(L in N){if(M&&L=="modules"){J=N[L];for(K in J){if(J.hasOwnProperty(K)){M[K]=J[K];}}}else{if(L=="win"){O[L]=N[L].contentWindow||N[L];O.doc=O[L].document;}else{O[L]=N[L];}}}},_init:function(){var J="3.0.0",K=this;if(J.indexOf("@")>-1){J="test";}K.version=J;K.Env={mods:{},cdn:"http://yui.yahooapis.com/"+J+"/build/",bootstrapped:false,_idx:0,_used:{},_attached:{},_yidx:0,_uidx:0,_loaded:{}};K.Env._loaded[J]={};if(YUI.Env){K.Env._yidx=(++YUI.Env._yidx);K.Env._guidp=("yui_"+J+"-"+K.Env._yidx+"-"+B).replace(/\./g,"_");K.id=K.stamp(K);I[K.id]=K;}K.constructor=YUI;K.config={win:window||{},doc:document,debug:true,useBrowserConsole:true,throwFail:true,bootstrap:true,fetchCSS:true,base:function(){var L,M,O,N;M=document.getElementsByTagName("script");for(O=0;O<M.length;O=O+1){N=M[O].src.match(/^(.*)yui\/yui[\.\-].*js(\?.*)?$/);L=N&&N[1];if(L){break;}}return L||K.Env.cdn;}(),loaderPath:"loader/loader-min.js"};},_setup:function(J){this.use("yui-base");},applyTo:function(P,O,L){if(!(O in C)){this.log(O+": applyTo not allowed","warn","yui");return null;}var K=I[P],N,J,M;if(K){N=O.split(".");J=K;for(M=0;M<N.length;M=M+1){J=J[N[M]];if(!J){this.log("applyTo not found: "+O,"warn","yui");}}return J.apply(K,L);}return null;},add:function(K,M,J,L){YUI.Env.mods[K]={name:K,fn:M,version:J,details:L||{}};return this;},_attach:function(K,O){var T=YUI.Env.mods,L=this.Env._attached,Q,P=K.length,M,N,R,S,J;for(Q=0;Q<P;Q=Q+1){M=K[Q];N=T[M];if(!L[M]&&N){L[M]=true;R=N.details;S=R.requires;J=R.use;if(S){this._attach(this.Array(S));}if(N.fn){N.fn(this);}if(J){this._attach(this.Array(J));}}}},use:function(){if(this._loading){this._useQueue=this._useQueue||new this.Queue();this._useQueue.add(G.call(arguments,0));return this;}var K=this,U=G.call(arguments,0),Z=YUI.Env.mods,b=K.Env._used,V,O=U[0],M=false,X=U[U.length-1],W=K.config.bootstrap,P,R,N,Q=[],J=[],S=K.config.fetchCSS,T=function(d){if(b[d]){return;}var Y=Z[d],c,e,a;if(Y){b[d]=true;e=Y.details.requires;a=Y.details.use;}else{if(!YUI.Env._loaded[K.version][d]){Q.push(d);}else{b[d]=true;}}if(e){if(K.Lang.isString(e)){T(e);}else{for(c=0;c<e.length;c=c+1){T(e[c]);}}}J.push(d);},L;if(typeof X==="function"){U.pop();}else{X=null;}L=function(Y){Y=Y||{success:true,msg:"not dynamic"};if(X){X(K,Y);}if(K.fire){K.fire("yui:load",K,Y);}K._loading=false;if(K._useQueue&&K._useQueue.size()&&!K._loading){K.use.apply(K,K._useQueue.next());}};if(O==="*"){U=[];for(P in Z){if(Z.hasOwnProperty(P)){U.push(P);}}if(X){U.push(X);}return K.use.apply(K,U);}if(K.Loader){M=true;V=new K.Loader(K.config);V.require(U);V.ignoreRegistered=true;V.allowRollup=false;V.calculate(null,(S)?null:"js");U=V.sorted;}N=U.length;for(R=0;R<N;R=R+1){T(U[R]);}N=Q.length;if(N){Q=K.Object.keys(K.Array.hash(Q));}if(W&&N&&K.Loader){K._loading=true;V=new K.Loader(K.config);V.onSuccess=L;V.onFailure=L;V.onTimeout=L;V.context=K;V.attaching=U;V.require((S)?Q:U);V.insert(null,(S)?null:"js");}else{if(W&&N&&K.Get&&!K.Env.bootstrapped){K._loading=true;U=K.Array(arguments,0,true);K.Get.script(K.config.base+K.config.loaderPath,{onEnd:function(){K._loading=false;K.Env.bootstrapped=true;K._attach(["loader"]);K.use.apply(K,U);}});return K;}else{if(N){}K._attach(J);L();}}return K;},namespace:function(){var J=arguments,N=null,L,K,M;for(L=0;L<J.length;L=L+1){M=(""+J[L]).split(".");N=this;for(K=(M[0]=="YAHOO")?1:0;K<M.length;K=K+1){N[M[K]]=N[M[K]]||{};N=N[M[K]];}}return N;},log:function(){},error:function(K,J){if(this.config.throwFail){throw (J||new Error(K));}else{this.message(K,"error");}return this;},guid:function(J){var K=this.Env._guidp+(++this.Env._uidx);return(J)?(J+K):K;},stamp:function(L,M){if(!L){return L;}var J=(typeof L==="string")?L:L._yuid;if(!J){J=this.guid();if(!M){try{L._yuid=J;}catch(K){J=null;}}}return J;}};A=YUI.prototype;for(E in A){YUI[E]=A[E];}YUI._init();H(window,"load",D);YUI.Env.add=H;YUI.Env.remove=F;})();
}

YUI.add("yui-base",function(B){function A(){this._init();this.add.apply(this,arguments);}A.prototype={_init:function(){this._q=[];},next:function(){return this._q.shift();},add:function(){B.Array.each(B.Array(arguments,0,true),function(C){this._q.push(C);},this);return this;},size:function(){return this._q.length;}};B.Queue=A;(function(){B.Lang=B.Lang||{};var R=B.Lang,G="array",I="boolean",D="date",M="error",S="function",H="number",K="null",F="object",O="regexp",N="string",C=Object.prototype.toString,P="undefined",E={"undefined":P,"number":H,"boolean":I,"string":N,"[object Function]":S,"[object RegExp]":O,"[object Array]":G,"[object Date]":D,"[object Error]":M},J=/^\s+|\s+$/g,Q="";R.isArray=function(L){return R.type(L)===G;};R.isBoolean=function(L){return typeof L===I;};R.isFunction=function(L){return R.type(L)===S;};R.isDate=function(L){return R.type(L)===D;};R.isNull=function(L){return L===null;};R.isNumber=function(L){return typeof L===H&&isFinite(L);};R.isObject=function(T,L){return(T&&(typeof T===F||(!L&&R.isFunction(T))))||false;};R.isString=function(L){return typeof L===N;};R.isUndefined=function(L){return typeof L===P;};R.trim=function(L){try{return L.replace(J,Q);}catch(T){return L;}};R.isValue=function(T){var L=R.type(T);
switch(L){case H:return isFinite(T);case K:case P:return false;default:return !!(L);}};R.type=function(L){return E[typeof L]||E[C.call(L)]||(L?F:K);};})();(function(){var C=B.Lang,D=Array.prototype,E=function(M,J,L){var I=(L)?2:B.Array.test(M),H,G,F;if(I){try{return D.slice.call(M,J||0);}catch(K){F=[];for(H=0,G=M.length;H<G;H=H+1){F.push(M[H]);}return F;}}else{return[M];}};B.Array=E;E.test=function(H){var F=0;if(C.isObject(H)){if(C.isArray(H)){F=1;}else{try{if("length" in H&&!("tagName" in H)&&!("alert" in H)&&(!B.Lang.isFunction(H.size)||H.size()>1)){F=2;}}catch(G){}}}return F;};E.each=(D.forEach)?function(F,G,H){D.forEach.call(F||[],G,H||B);return B;}:function(G,I,J){var F=(G&&G.length)||0,H;for(H=0;H<F;H=H+1){I.call(J||B,G[H],H,G);}return B;};E.hash=function(H,G){var K={},F=H.length,J=G&&G.length,I;for(I=0;I<F;I=I+1){K[H[I]]=(J&&J>I)?G[I]:true;}return K;};E.indexOf=(D.indexOf)?function(F,G){return D.indexOf.call(F,G);}:function(F,H){for(var G=0;G<F.length;G=G+1){if(F[G]===H){return G;}}return -1;};E.numericSort=function(G,F){return(G-F);};E.some=(D.some)?function(F,G,H){return D.some.call(F,G,H);}:function(G,I,J){var F=G.length,H;for(H=0;H<F;H=H+1){if(I.call(J,G[H],H,G)){return true;}}return false;};})();(function(){var D=B.Lang,C="__",E=function(H,G){var F=G.toString;if(D.isFunction(F)&&F!=Object.prototype.toString){H.toString=F;}};B.merge=function(){var G=arguments,I={},H,F=G.length;for(H=0;H<F;H=H+1){B.mix(I,G[H],true);}return I;};B.mix=function(F,O,H,N,L,M){if(!O||!F){return F||B;}if(L){switch(L){case 1:return B.mix(F.prototype,O.prototype,H,N,0,M);case 2:B.mix(F.prototype,O.prototype,H,N,0,M);break;case 3:return B.mix(F,O.prototype,H,N,0,M);case 4:return B.mix(F.prototype,O,H,N,0,M);default:}}var K=M&&D.isArray(F),J,I,G;if(N&&N.length){for(J=0,I=N.length;J<I;++J){G=N[J];if(G in O){if(M&&D.isObject(F[G],true)){B.mix(F[G],O[G]);}else{if(!K&&(H||!(G in F))){F[G]=O[G];}else{if(K){F.push(O[G]);}}}}}}else{for(J in O){if(M&&D.isObject(F[J],true)){B.mix(F[J],O[J]);}else{if(!K&&(H||!(J in F))){F[J]=O[J];}else{if(K){F.push(O[J]);}}}}if(B.UA.ie){E(F,O);}}return F;};B.cached=function(H,F,G){F=F||{};return function(L,K){var J=(K)?Array.prototype.join.call(arguments,C):L,I=F[J];if(!(J in F)||(G&&F[J]==G)){F[J]=H.apply(H,arguments);}return F[J];};};})();(function(){B.Object=function(H){var G=function(){};G.prototype=H;return new G();};var E=B.Object,D=undefined,C=function(J,I){var H=(I===2),F=(H)?0:[],G;for(G in J){if(H){F++;}else{if(J.hasOwnProperty(G)){F.push((I)?J[G]:G);}}}return F;};E.keys=function(F){return C(F);};E.values=function(F){return C(F,1);};E.size=function(F){return C(F,2);};E.hasKey=function(G,F){return(F in G);};E.hasValue=function(G,F){return(B.Array.indexOf(E.values(G),F)>-1);};E.owns=function(G,F){return(G.hasOwnProperty(F));};E.each=function(J,I,K,H){var G=K||B,F;for(F in J){if(H||J.hasOwnProperty(F)){I.call(G,J[F],F,J);}}return B;};E.getValue=function(J,I){var H=B.Array(I),F=H.length,G;for(G=0;J!==D&&G<F;G=G+1){J=J[H[G]];}return J;};E.setValue=function(L,J,K){var I=B.Array(J),H=I.length-1,F,G=L;if(H>=0){for(F=0;G!==D&&F<H;F=F+1){G=G[I[F]];}if(G!==D){G[I[F]]=K;}else{return D;}}return L;};})();B.UA=function(){var F=function(J){var K=0;return parseFloat(J.replace(/\./g,function(){return(K++==1)?"":".";}));},I=navigator,H={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:I.cajaVersion,secure:false,os:null},E=I&&I.userAgent,G=B.config.win.location,D=G&&G.href,C;H.secure=D&&(D.toLowerCase().indexOf("https")===0);if(E){if((/windows|win32/i).test(E)){H.os="windows";}else{if((/macintosh/i).test(E)){H.os="macintosh";}}if((/KHTML/).test(E)){H.webkit=1;}C=E.match(/AppleWebKit\/([^\s]*)/);if(C&&C[1]){H.webkit=F(C[1]);if(/ Mobile\//.test(E)){H.mobile="Apple";}else{C=E.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);if(C){H.mobile=C[0];}}C=E.match(/AdobeAIR\/([^\s]*)/);if(C){H.air=C[0];}}if(!H.webkit){C=E.match(/Opera[\s\/]([^\s]*)/);if(C&&C[1]){H.opera=F(C[1]);C=E.match(/Opera Mini[^;]*/);if(C){H.mobile=C[0];}}else{C=E.match(/MSIE\s([^;]*)/);if(C&&C[1]){H.ie=F(C[1]);}else{C=E.match(/Gecko\/([^\s]*)/);if(C){H.gecko=1;C=E.match(/rv:([^\s\)]*)/);if(C&&C[1]){H.gecko=F(C[1]);}}}}}}return H;}();(function(){var F=["yui-base"],D,I=B.config,H=YUI.Env.mods,G,E;B.use.apply(B,F);if(I.core){D=I.core;}else{D=[];G=["get","loader","yui-log","yui-later"];for(E=0;E<G.length;E++){if(H[G[E]]){D.push(G[E]);}}}B.use.apply(B,D);})();},"3.0.0");YUI.add("get",function(A){(function(){var C=A.UA,B=A.Lang,E="text/javascript",F="text/css",D="stylesheet";A.Get=function(){var M={},K=0,U=false,W=function(a,X,b){var Y=b||A.config.win,c=Y.document,e=c.createElement(a),Z;for(Z in X){if(X[Z]&&X.hasOwnProperty(Z)){e.setAttribute(Z,X[Z]);}}return e;},T=function(Y,Z,X){var a={id:A.guid(),type:F,rel:D,href:Y};if(X){A.mix(a,X);}return W("link",a,Z);},S=function(Y,Z,X){var a={id:A.guid(),type:E,src:Y};if(X){A.mix(a,X);}return W("script",a,Z);},N=function(c){var X=M[c],Y,a,g,e,j,b,Z,f;if(X){Y=X.nodes;a=Y.length;g=X.win.document;e=g.getElementsByTagName("head")[0];if(X.insertBefore){j=L(X.insertBefore,c);if(j){e=j.parentNode;}}for(b=0;b<a;b=b+1){Z=Y[b];if(Z.clearAttributes){Z.clearAttributes();}else{for(f in Z){delete Z[f];}}e.removeChild(Z);}}X.nodes=[];},P=function(Y,Z,X){return{tId:Y.tId,win:Y.win,data:Y.data,nodes:Y.nodes,msg:Z,statusText:X,purge:function(){N(this.tId);}};},O=function(b,a,X){var Y=M[b],Z;if(Y&&Y.onEnd){Z=Y.context||Y;Y.onEnd.call(Z,P(Y,a,X));}},V=function(a,Z){var X=M[a],Y;if(X.timer){clearTimeout(X.timer);}if(X.onFailure){Y=X.context||X;X.onFailure.call(Y,P(X,Z));}O(a,Z,"failure");},L=function(X,a){var Y=M[a],Z=(B.isString(X))?Y.win.document.getElementById(X):X;if(!Z){V(a,"target node not found: "+X);}return Z;},I=function(a){var X=M[a],Z,Y;if(X.timer){clearTimeout(X.timer);}X.finished=true;if(X.aborted){Z="transaction "+a+" was aborted";V(a,Z);return;}if(X.onSuccess){Y=X.context||X;X.onSuccess.call(Y,P(X));}O(a,Z,"OK");},Q=function(Z){var X=M[Z],Y;if(X.onTimeout){Y=X.context||X;X.onTimeout.call(Y,P(X));
}O(Z,"timeout","timeout");},H=function(Z,c){var Y=M[Z],b,g,f,e,a,X,i;if(Y.timer){clearTimeout(Y.timer);}if(Y.aborted){b="transaction "+Z+" was aborted";V(Z,b);return;}if(c){Y.url.shift();if(Y.varName){Y.varName.shift();}}else{Y.url=(B.isString(Y.url))?[Y.url]:Y.url;if(Y.varName){Y.varName=(B.isString(Y.varName))?[Y.varName]:Y.varName;}}g=Y.win;f=g.document;e=f.getElementsByTagName("head")[0];if(Y.url.length===0){I(Z);return;}X=Y.url[0];if(!X){Y.url.shift();return H(Z);}if(Y.timeout){Y.timer=setTimeout(function(){Q(Z);},Y.timeout);}if(Y.type==="script"){a=S(X,g,Y.attributes);}else{a=T(X,g,Y.attributes);}J(Y.type,a,Z,X,g,Y.url.length);Y.nodes.push(a);if(Y.insertBefore){i=L(Y.insertBefore,Z);if(i){i.parentNode.insertBefore(a,i);}}else{e.appendChild(a);}if((C.webkit||C.gecko)&&Y.type==="css"){H(Z,X);}},G=function(){if(U){return;}U=true;var X,Y;for(X in M){if(M.hasOwnProperty(X)){Y=M[X];if(Y.autopurge&&Y.finished){N(Y.tId);delete M[X];}}}U=false;},R=function(Y,X,Z){Z=Z||{};var c="q"+(K++),a,b=Z.purgethreshold||A.Get.PURGE_THRESH;if(K%b===0){G();}M[c]=A.merge(Z,{tId:c,type:Y,url:X,finished:false,nodes:[]});a=M[c];a.win=a.win||A.config.win;a.context=a.context||a;a.autopurge=("autopurge" in a)?a.autopurge:(Y==="script")?true:false;if(Z.charset){a.attributes=a.attributes||{};a.attributes.charset=Z.charset;}setTimeout(function(){H(c);},0);return{tId:c};},J=function(Z,e,d,Y,c,b,X){var a=X||H;if(C.ie){e.onreadystatechange=function(){var f=this.readyState;if("loaded"===f||"complete"===f){e.onreadystatechange=null;a(d,Y);}};}else{if(C.webkit){if(Z==="script"){e.addEventListener("load",function(){a(d,Y);});}}else{e.onload=function(){a(d,Y);};e.onerror=function(f){V(d,f+": "+Y);};}}};return{PURGE_THRESH:20,_finalize:function(X){setTimeout(function(){I(X);},0);},abort:function(Y){var Z=(B.isString(Y))?Y:Y.tId,X=M[Z];if(X){X.aborted=true;}},script:function(X,Y){return R("script",X,Y);},css:function(X,Y){return R("css",X,Y);}};}();})();},"3.0.0");YUI.add("yui-log",function(A){(function(){var D=A,F="yui:log",B="undefined",C={debug:1,info:1,warn:1,error:1},E;D.log=function(I,Q,G,O){var H=D,P=H.config,K=false,N,L,J,M;if(P.debug){if(G){N=P.logExclude;L=P.logInclude;if(L&&!(G in L)){K=1;}else{if(N&&(G in N)){K=1;}}}if(!K){if(P.useBrowserConsole){J=(G)?G+": "+I:I;if(typeof console!=B&&console.log){M=(Q&&console[Q]&&(Q in C))?Q:"log";console[M](J);}else{if(typeof opera!=B){opera.postError(J);}}}if(H.fire&&!O){if(!E){H.publish(F,{broadcast:2,emitFacade:1});E=1;}H.fire(F,{msg:I,cat:Q,src:G});}}}return H;};D.message=function(){return D.log.apply(D,arguments);};})();},"3.0.0",{requires:["yui-base"]});YUI.add("yui-later",function(A){(function(){var B=A.Lang,C=function(K,E,L,G,H){K=K||0;E=E||{};var F=L,J=A.Array(G),I,D;if(B.isString(L)){F=E[L];}if(!F){}I=function(){F.apply(E,J);};D=(H)?setInterval(I,K):setTimeout(I,K);return{id:D,interval:H,cancel:function(){if(this.interval){clearInterval(D);}else{clearTimeout(D);}}};};A.later=C;B.later=C;})();},"3.0.0",{requires:["yui-base"]});YUI.add("yui",function(A){},"3.0.0",{use:["yui-base","get","yui-log","yui-later"]});

YUI.add("oop",function(F){var E=F.Lang,D=F.Array,C=Object.prototype,B="_~yuim~_";F.augment=function(A,T,I,R,N){var L=T.prototype,P=null,S=T,O=(N)?F.Array(N):[],H=A.prototype,M=H||A,Q=false,G,J,K;if(H&&S){G={};J={};P={};F.each(L,function(V,U){J[U]=function(){for(K in G){if(G.hasOwnProperty(K)&&(this[K]===J[K])){this[K]=G[K];}}S.apply(this,O);return G[U].apply(this,arguments);};if((!R||(U in R))&&(I||!(U in this))){if(E.isFunction(V)){G[U]=V;this[U]=J[U];}else{this[U]=V;}}},P,true);}else{Q=true;}F.mix(M,P||L,I,R);if(Q){T.apply(M,O);}return A;};F.aggregate=function(H,G,A,I){return F.mix(H,G,A,I,0,true);};F.extend=function(I,H,A,K){if(!H||!I){F.error("extend failed, verify dependencies");}var J=H.prototype,G=F.Object(J);I.prototype=G;G.constructor=I;I.superclass=J;if(H!=Object&&J.constructor==C.constructor){J.constructor=H;}if(A){F.mix(G,A,true);}if(K){F.mix(I,K,true);}return I;};F.each=function(H,G,I,A){if(H.each&&H.item){return H.each.call(H,G,I);}else{switch(D.test(H)){case 1:return D.each(H,G,I);case 2:return D.each(F.Array(H,0,true),G,I);default:return F.Object.each(H,G,I,A);}}};F.clone=function(I,J,M,N,H,L){if(!E.isObject(I)){return I;}var K,G=L||{},A;switch(E.type(I)){case"date":return new Date(I);case"regexp":return new RegExp(I.source);case"function":K=F.bind(I,H);break;case"array":K=[];break;default:if(I[B]){return G[I[B]];}A=F.guid();K=(J)?{}:F.Object(I);I[B]=A;G[A]=I;}if(!I.addEventListener&&!I.attachEvent){F.each(I,function(P,O){if(!M||(M.call(N||this,P,O,this,I)!==false)){if(O!==B){this[O]=F.clone(P,J,M,N,H||I,G);}}},K);}if(!L){F.each(G,function(P,O){delete P[B];});G=null;}return K;};F.bind=function(A,H){var G=arguments.length>2?F.Array(arguments,2,true):null;return function(){var J=E.isString(A)?H[A]:A,I=(G)?G.concat(F.Array(arguments,0,true)):arguments;return J.apply(H||J,I);};};F.rbind=function(A,H){var G=arguments.length>2?F.Array(arguments,2,true):null;return function(){var J=E.isString(A)?H[A]:A,I=(G)?F.Array(arguments,0,true).concat(G):arguments;return J.apply(H||J,I);};};},"3.0.0");

YUI.add("dom-base",function(D){(function(H){var R="nodeType",F="ownerDocument",E="defaultView",J="parentWindow",M="tagName",O="parentNode",Q="firstChild",L="previousSibling",P="nextSibling",K="contains",G="compareDocumentPosition",N=document.documentElement,I=/<([a-z]+)/i;H.DOM={byId:function(T,S){S=S||H.config.doc;return S.getElementById(T);},children:function(U,S){var T=[];if(U){S=S||"*";T=H.Selector.query("> "+S,U);}return T;},firstByTag:function(S,T){var U;T=T||H.config.doc;if(S&&T.getElementsByTagName){U=T.getElementsByTagName(S)[0];}return U||null;},getText:(N.textContent!==undefined)?function(T){var S="";if(T){S=T.textContent;}return S||"";}:function(T){var S="";if(T){S=T.innerText;}return S||"";},setText:(N.textContent!==undefined)?function(S,T){if(S){S.textContent=T;}}:function(S,T){if(S){S.innerText=T;}},previous:function(S,U,T){return H.DOM.elementByAxis(S,L,U,T);},next:function(S,U,T){return H.DOM.elementByAxis(S,P,U,T);},ancestor:function(S,U,T){return H.DOM.elementByAxis(S,O,U,T);},elementByAxis:function(S,V,U,T){while(S&&(S=S[V])){if((T||S[M])&&(!U||U(S))){return S;}}return null;},contains:function(T,U){var S=false;if(!U||!T||!U[R]||!T[R]){S=false;}else{if(T[K]){if(H.UA.opera||U[R]===1){S=T[K](U);}else{S=H.DOM._bruteContains(T,U);}}else{if(T[G]){if(T===U||!!(T[G](U)&16)){S=true;}}}}return S;},inDoc:function(S,T){T=T||S[F];var U=S.id;if(!U){U=S.id=H.guid();}return !!(T.getElementById(U));},create:function(X,Z){if(typeof X==="string"){X=H.Lang.trim(X);}if(!Z&&H.DOM._cloneCache[X]){return H.DOM._cloneCache[X].cloneNode(true);}Z=Z||H.config.doc;var T=I.exec(X),W=H.DOM._create,Y=H.DOM.creators,V=null,S,U;if(T&&Y[T[1]]){if(typeof Y[T[1]]==="function"){W=Y[T[1]];}else{S=Y[T[1]];}}U=W(X,Z,S).childNodes;if(U.length===1){V=U[0].parentNode.removeChild(U[0]);}else{V=H.DOM._nl2frag(U,Z);}if(V){H.DOM._cloneCache[X]=V.cloneNode(true);}return V;},_nl2frag:function(T,W){var U=null,V,S;if(T&&(T.push||T.item)&&T[0]){W=W||T[0].ownerDocument;U=W.createDocumentFragment();if(T.item){T=H.Array(T,0,true);}for(V=0,S=T.length;V<S;V++){U.appendChild(T[V]);}}return U;},CUSTOM_ATTRIBUTES:(!N.hasAttribute)?{"for":"htmlFor","class":"className"}:{"htmlFor":"for","className":"class"},setAttribute:function(U,S,V,T){if(U&&U.setAttribute){S=H.DOM.CUSTOM_ATTRIBUTES[S]||S;U.setAttribute(S,V,T);}},getAttribute:function(V,S,U){U=(U!==undefined)?U:2;var T="";if(V&&V.getAttribute){S=H.DOM.CUSTOM_ATTRIBUTES[S]||S;T=V.getAttribute(S,U);if(T===null){T="";}}return T;},isWindow:function(S){return S.alert&&S.document;},_fragClones:{div:document.createElement("div")},_create:function(T,U,S){S=S||"div";var V=H.DOM._fragClones[S];if(V){V=V.cloneNode(false);}else{V=H.DOM._fragClones[S]=U.createElement(S);}V.innerHTML=T;return V;},_removeChildNodes:function(S){while(S.firstChild){S.removeChild(S.firstChild);}},_cloneCache:{},addHTML:function(W,V,T){if(typeof V==="string"){V=H.Lang.trim(V);}var U=H.DOM._cloneCache[V],S=W.parentNode;if(U){U=U.cloneNode(true);}else{if(V.nodeType){U=V;}else{U=H.DOM.create(V);}}if(T){if(T.nodeType){T.parentNode.insertBefore(U,T);}else{switch(T){case"replace":while(W.firstChild){W.removeChild(W.firstChild);}W.appendChild(U);break;case"before":S.insertBefore(U,W);break;case"after":if(W.nextSibling){S.insertBefore(U,W.nextSibling);}else{S.appendChild(U);}break;default:W.appendChild(U);}}}else{W.appendChild(U);}return U;},VALUE_SETTERS:{},VALUE_GETTERS:{},getValue:function(U){var T="",S;if(U&&U[M]){S=H.DOM.VALUE_GETTERS[U[M].toLowerCase()];if(S){T=S(U);}else{T=U.value;}}return(typeof T==="string")?T:"";},setValue:function(S,T){var U;if(S&&S[M]){U=H.DOM.VALUE_SETTERS[S[M].toLowerCase()];if(U){U(S,T);}else{S.value=T;}}},_bruteContains:function(S,T){while(T){if(S===T){return true;}T=T.parentNode;}return false;},_getRegExp:function(T,S){S=S||"";H.DOM._regexCache=H.DOM._regexCache||{};if(!H.DOM._regexCache[T+S]){H.DOM._regexCache[T+S]=new RegExp(T,S);}return H.DOM._regexCache[T+S];},_getDoc:function(S){S=S||{};return(S[R]===9)?S:S[F]||S.document||H.config.doc;},_getWin:function(S){var T=H.DOM._getDoc(S);return T[E]||T[J]||H.config.win;},_batch:function(V,Z,Y,U,T,X){Z=(typeof name==="string")?H.DOM[Z]:Z;var S,W=[];if(Z&&V){H.each(V,function(a){if((S=Z.call(H.DOM,a,Y,U,T,X))!==undefined){W[W.length]=S;}});}return W.length?W:V;},_testElement:function(T,S,U){S=(S&&S!=="*")?S.toUpperCase():null;return(T&&T[M]&&(!S||T[M].toUpperCase()===S)&&(!U||U(T)));},creators:{},_IESimpleCreate:function(S,T){T=T||H.config.doc;return T.createElement(S);}};(function(W){var X=W.DOM.creators,S=W.DOM.create,V=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,U="<table>",T="</table>";if(W.UA.ie){W.mix(X,{tbody:function(Z,a){var b=S(U+Z+T,a),Y=b.children.tags("tbody")[0];if(b.children.length>1&&Y&&!V.test(Z)){Y[O].removeChild(Y);}return b;},script:function(Y,Z){var a=Z.createElement("div");a.innerHTML="-"+Y;a.removeChild(a[Q]);return a;}},true);W.mix(W.DOM.VALUE_GETTERS,{button:function(Y){return(Y.attributes&&Y.attributes.value)?Y.attributes.value.value:"";}});W.mix(W.DOM.VALUE_SETTERS,{button:function(Z,a){var Y=Z.attributes.value;if(!Y){Y=Z[F].createAttribute("value");Z.setAttributeNode(Y);}Y.value=a;}});}if(W.UA.gecko||W.UA.ie){W.mix(X,{option:function(Y,Z){return S("<select>"+Y+"</select>",Z);},tr:function(Y,Z){return S("<tbody>"+Y+"</tbody>",Z);},td:function(Y,Z){return S("<tr>"+Y+"</tr>",Z);},tbody:function(Y,Z){return S(U+Y+T,Z);}});W.mix(X,{legend:"fieldset",th:X.td,thead:X.tbody,tfoot:X.tbody,caption:X.tbody,colgroup:X.tbody,col:X.tbody,optgroup:X.option});}W.mix(W.DOM.VALUE_GETTERS,{option:function(Z){var Y=Z.attributes;return(Y.value&&Y.value.specified)?Z.value:Z.text;},select:function(Z){var a=Z.value,Y=Z.options;if(Y&&a===""){if(Z.multiple){}else{a=W.DOM.getValue(Y[Z.selectedIndex],"value");}}return a;}});})(H);})(D);var B,A,C;D.mix(D.DOM,{hasClass:function(G,F){var E=D.DOM._getRegExp("(?:^|\\s+)"+F+"(?:\\s+|$)");return E.test(G.className);},addClass:function(F,E){if(!D.DOM.hasClass(F,E)){F.className=D.Lang.trim([F.className,E].join(" "));
}},removeClass:function(F,E){if(E&&A(F,E)){F.className=D.Lang.trim(F.className.replace(D.DOM._getRegExp("(?:^|\\s+)"+E+"(?:\\s+|$)")," "));if(A(F,E)){C(F,E);}}},replaceClass:function(F,E,G){B(F,G);C(F,E);},toggleClass:function(F,E){if(A(F,E)){C(F,E);}else{B(F,E);}}});A=D.DOM.hasClass;C=D.DOM.removeClass;B=D.DOM.addClass;},"3.0.0",{requires:["oop"]});YUI.add("dom-style",function(A){(function(E){var C="documentElement",B="defaultView",D="ownerDocument",L="style",N="float",F="cssFloat",G="styleFloat",J="transparent",H="getComputedStyle",M=E.config.doc,I=undefined,K=/color$/i;E.mix(E.DOM,{CUSTOM_STYLES:{},setStyle:function(R,O,S,Q){Q=Q||R.style;var P=E.DOM.CUSTOM_STYLES;if(Q){if(S===null){S="";}if(O in P){if(P[O].set){P[O].set(R,S,Q);return;}else{if(typeof P[O]==="string"){O=P[O];}}}Q[O]=S;}},getStyle:function(R,O){var Q=R[L],P=E.DOM.CUSTOM_STYLES,S="";if(Q){if(O in P){if(P[O].get){return P[O].get(R,O,Q);}else{if(typeof P[O]==="string"){O=P[O];}}}S=Q[O];if(S===""){S=E.DOM[H](R,O);}}return S;},setStyles:function(P,Q){var O=P.style;E.each(Q,function(R,S){E.DOM.setStyle(P,S,R,O);},E.DOM);},getComputedStyle:function(P,O){var R="",Q=P[D];if(P[L]){R=Q[B][H](P,null)[O];}return R;}});if(M[C][L][F]!==I){E.DOM.CUSTOM_STYLES[N]=F;}else{if(M[C][L][G]!==I){E.DOM.CUSTOM_STYLES[N]=G;}}if(E.UA.opera){E.DOM[H]=function(Q,P){var O=Q[D][B],R=O[H](Q,"")[P];if(K.test(P)){R=E.Color.toRGB(R);}return R;};}if(E.UA.webkit){E.DOM[H]=function(Q,P){var O=Q[D][B],R=O[H](Q,"")[P];if(R==="rgba(0, 0, 0, 0)"){R=J;}return R;};}})(A);(function(D){var B=parseInt,C=RegExp;D.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(E){if(!D.Color.re_RGB.test(E)){E=D.Color.toHex(E);}if(D.Color.re_hex.exec(E)){E="rgb("+[B(C.$1,16),B(C.$2,16),B(C.$3,16)].join(", ")+")";}return E;},toHex:function(F){F=D.Color.KEYWORDS[F]||F;if(D.Color.re_RGB.exec(F)){F=[Number(C.$1).toString(16),Number(C.$2).toString(16),Number(C.$3).toString(16)];for(var E=0;E<F.length;E++){if(F[E].length<2){F[E]=F[E].replace(D.Color.re_hex3,"$1$1");}}F="#"+F.join("");}if(F.length<6){F=F.replace(D.Color.re_hex3,"$1$1");}if(F!=="transparent"&&F.indexOf("#")<0){F="#"+F;}return F.toLowerCase();}};})(A);(function(D){var W="hasLayout",K="px",L="filter",B="filters",T="opacity",M="auto",G="borderWidth",J="borderTopWidth",Q="borderRightWidth",V="borderBottomWidth",H="borderLeftWidth",I="width",O="height",R="transparent",S="visible",C="getComputedStyle",Z=undefined,X=document.documentElement,P=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,E=function(Y){return Y.currentStyle||Y.style;},N={CUSTOM_STYLES:{},get:function(Y,b){var a="",c;if(Y){c=E(Y)[b];if(b===T&&D.DOM.CUSTOM_STYLES[T]){a=D.DOM.CUSTOM_STYLES[T].get(Y);}else{if(!c||(c.indexOf&&c.indexOf(K)>-1)){a=c;}else{if(D.DOM.IE.COMPUTED[b]){a=D.DOM.IE.COMPUTED[b](Y,b);}else{if(P.test(c)){a=N.getPixel(Y,b)+K;}else{a=c;}}}}}return a;},sizeOffsets:{width:["Left","Right"],height:["Top","Bottom"],top:["Top"],bottom:["Bottom"]},getOffset:function(b,g){var d=E(b)[g],Y=g.charAt(0).toUpperCase()+g.substr(1),f="offset"+Y,a="pixel"+Y,e=N.sizeOffsets[g],c="";if(d===M||d.indexOf("%")>-1){c=b["offset"+Y];if(e[0]){c-=N.getPixel(b,"padding"+e[0]);c-=N.getBorderWidth(b,"border"+e[0]+"Width",1);}if(e[1]){c-=N.getPixel(b,"padding"+e[1]);c-=N.getBorderWidth(b,"border"+e[1]+"Width",1);}}else{if(!b.style[a]&&!b.style[g]){b.style[g]=d;}c=b.style[a];}return c+K;},borderMap:{thin:"2px",medium:"4px",thick:"6px"},getBorderWidth:function(a,c,Y){var b=Y?"":K,d=a.currentStyle[c];if(d.indexOf(K)<0){if(N.borderMap[d]){d=N.borderMap[d];}else{}}return(Y)?parseFloat(d):d;},getPixel:function(b,Y){var d=null,a=E(b),e=a.right,c=a[Y];b.style.right=c;d=b.style.pixelRight;b.style.right=e;return d;},getMargin:function(b,Y){var c,a=E(b);if(a[Y]==M){c=0;}else{c=N.getPixel(b,Y);}return c+K;},getVisibility:function(a,Y){var b;while((b=a.currentStyle)&&b[Y]=="inherit"){a=a.parentNode;}return(b)?b[Y]:S;},getColor:function(a,Y){var b=E(a)[Y];if(!b||b===R){D.DOM.elementByAxis(a,"parentNode",null,function(c){b=E(c)[Y];if(b&&b!==R){a=c;return true;}});}return D.Color.toRGB(b);},getBorderColor:function(a,Y){var b=E(a),c=b[Y]||b.color;return D.Color.toRGB(D.Color.toHex(c));}},F={};try{if(X.style[T]===Z&&X[B]){D.DOM.CUSTOM_STYLES[T]={get:function(a){var c=100;try{c=a[B]["DXImageTransform.Microsoft.Alpha"][T];}catch(b){try{c=a[B]("alpha")[T];}catch(Y){}}return c/100;},set:function(a,d,Y){var c,b;if(d===""){b=E(a);c=(T in b)?b[T]:1;d=c;}if(typeof Y[L]=="string"){Y[L]="alpha("+T+"="+d*100+")";if(!a.currentStyle||!a.currentStyle[W]){Y.zoom=1;}}}};}}catch(U){}try{document.createElement("div").style.height="-1px";}catch(U){D.DOM.CUSTOM_STYLES.height={set:function(b,c,a){var Y=parseFloat(c);if(isNaN(Y)||Y>=0){a.height=c;}else{}}};D.DOM.CUSTOM_STYLES.width={set:function(b,c,a){var Y=parseFloat(c);if(isNaN(Y)||Y>=0){a.width=c;}else{}}};}F[I]=F[O]=N.getOffset;F.color=F.backgroundColor=N.getColor;F[G]=F[J]=F[Q]=F[V]=F[H]=N.getBorderWidth;F.marginTop=F.marginRight=F.marginBottom=F.marginLeft=N.getMargin;F.visibility=N.getVisibility;F.borderColor=F.borderTopColor=F.borderRightColor=F.borderBottomColor=F.borderLeftColor=N.getBorderColor;if(!D.config.win[C]){D.DOM[C]=N.get;}D.namespace("DOM.IE");D.DOM.IE.COMPUTED=F;D.DOM.IE.ComputedStyle=N;})(A);},"3.0.0",{requires:["dom-base"]});YUI.add("dom-screen",function(A){(function(F){var D="documentElement",O="compatMode",M="position",C="fixed",K="relative",G="left",H="top",I="BackCompat",N="medium",E="borderLeftWidth",B="borderTopWidth",P="getBoundingClientRect",J="getComputedStyle",L=/^t(?:able|d|h)$/i;F.mix(F.DOM,{winHeight:function(R){var Q=F.DOM._getWinSize(R).height;return Q;},winWidth:function(R){var Q=F.DOM._getWinSize(R).width;
return Q;},docHeight:function(R){var Q=F.DOM._getDocSize(R).height;return Math.max(Q,F.DOM._getWinSize(R).height);},docWidth:function(R){var Q=F.DOM._getDocSize(R).width;return Math.max(Q,F.DOM._getWinSize(R).width);},docScrollX:function(Q){var R=F.DOM._getDoc(Q);return Math.max(R[D].scrollLeft,R.body.scrollLeft);},docScrollY:function(Q){var R=F.DOM._getDoc(Q);return Math.max(R[D].scrollTop,R.body.scrollTop);},getXY:function(){if(document[D][P]){return function(T){var a=null,U,R,V,Y,X,Q,S,W,Z;if(T){if(F.DOM.inDoc(T)){U=F.DOM.docScrollX(T);R=F.DOM.docScrollY(T);V=T[P]();Z=F.DOM._getDoc(T);a=[V.left,V.top];if(F.UA.ie){Y=2;X=2;W=Z[O];Q=F.DOM[J](Z[D],E);S=F.DOM[J](Z[D],B);if(F.UA.ie===6){if(W!==I){Y=0;X=0;}}if((W==I)){if(Q!==N){Y=parseInt(Q,10);}if(S!==N){X=parseInt(S,10);}}a[0]-=Y;a[1]-=X;}if((R||U)){a[0]+=U;a[1]+=R;}}else{a=F.DOM._getOffset(T);}}return a;};}else{return function(R){var T=null,Q,V,S,U;if(R){if(F.DOM.inDoc(R)){T=[R.offsetLeft,R.offsetTop];Q=R;V=((F.UA.gecko||F.UA.webkit>519)?true:false);while((Q=Q.offsetParent)){T[0]+=Q.offsetLeft;T[1]+=Q.offsetTop;if(V){T=F.DOM._calcBorders(Q,T);}}if(F.DOM.getStyle(R,M)!=C){Q=R;while((Q=Q.parentNode)){S=Q.scrollTop;U=Q.scrollLeft;if(F.UA.gecko&&(F.DOM.getStyle(Q,"overflow")!=="visible")){T=F.DOM._calcBorders(Q,T);}if(S||U){T[0]-=U;T[1]-=S;}}T[0]+=F.DOM.docScrollX(R);T[1]+=F.DOM.docScrollY(R);}else{T[0]+=F.DOM.docScrollX(R);T[1]+=F.DOM.docScrollY(R);}}else{T=F.DOM._getOffset(R);}}return T;};}}(),_getOffset:function(Q){var S,R=null;if(Q){S=F.DOM.getStyle(Q,M);R=[parseInt(F.DOM[J](Q,G),10),parseInt(F.DOM[J](Q,H),10)];if(isNaN(R[0])){R[0]=parseInt(F.DOM.getStyle(Q,G),10);if(isNaN(R[0])){R[0]=(S===K)?0:Q.offsetLeft||0;}}if(isNaN(R[1])){R[1]=parseInt(F.DOM.getStyle(Q,H),10);if(isNaN(R[1])){R[1]=(S===K)?0:Q.offsetTop||0;}}}return R;},getX:function(Q){return F.DOM.getXY(Q)[0];},getY:function(Q){return F.DOM.getXY(Q)[1];},setXY:function(R,U,X){var S=F.DOM.setStyle,W,V,Q,T;if(R&&U){W=F.DOM.getStyle(R,M);V=F.DOM._getOffset(R);if(W=="static"){W=K;S(R,M,W);}T=F.DOM.getXY(R);if(U[0]!==null){S(R,G,U[0]-T[0]+V[0]+"px");}if(U[1]!==null){S(R,H,U[1]-T[1]+V[1]+"px");}if(!X){Q=F.DOM.getXY(R);if(Q[0]!==U[0]||Q[1]!==U[1]){F.DOM.setXY(R,U,true);}}}else{}},setX:function(R,Q){return F.DOM.setXY(R,[Q,null]);},setY:function(Q,R){return F.DOM.setXY(Q,[null,R]);},_calcBorders:function(S,T){var R=parseInt(F.DOM[J](S,B),10)||0,Q=parseInt(F.DOM[J](S,E),10)||0;if(F.UA.gecko){if(L.test(S.tagName)){R=0;Q=0;}}T[0]+=Q;T[1]+=R;return T;},_getWinSize:function(T){var V=F.DOM._getDoc(),U=V.defaultView||V.parentWindow,W=V[O],S=U.innerHeight,R=U.innerWidth,Q=V[D];if(W&&!F.UA.opera){if(W!="CSS1Compat"){Q=V.body;}S=Q.clientHeight;R=Q.clientWidth;}return{height:S,width:R};},_getDocSize:function(R){var S=F.DOM._getDoc(),Q=S[D];if(S[O]!="CSS1Compat"){Q=S.body;}return{height:Q.scrollHeight,width:Q.scrollWidth};}});})(A);(function(G){var D="top",C="right",H="bottom",B="left",F=function(L,K){var N=Math.max(L[D],K[D]),O=Math.min(L[C],K[C]),I=Math.min(L[H],K[H]),J=Math.max(L[B],K[B]),M={};M[D]=N;M[C]=O;M[H]=I;M[B]=J;return M;},E=G.DOM;G.mix(E,{region:function(J){var K=E.getXY(J),I=false;if(J&&K){I=E._getRegion(K[1],K[0]+J.offsetWidth,K[1]+J.offsetHeight,K[0]);}return I;},intersect:function(K,I,M){var J=M||E.region(K),L={},O=I,N;if(O.tagName){L=E.region(O);}else{if(G.Lang.isObject(I)){L=I;}else{return false;}}N=F(L,J);return{top:N[D],right:N[C],bottom:N[H],left:N[B],area:((N[H]-N[D])*(N[C]-N[B])),yoff:((N[H]-N[D])),xoff:(N[C]-N[B]),inRegion:E.inRegion(K,I,false,M)};},inRegion:function(L,I,J,N){var M={},K=N||E.region(L),P=I,O;if(P.tagName){M=E.region(P);}else{if(G.Lang.isObject(I)){M=I;}else{return false;}}if(J){return(K[B]>=M[B]&&K[C]<=M[C]&&K[D]>=M[D]&&K[H]<=M[H]);}else{O=F(M,K);if(O[H]>=O[D]&&O[C]>=O[B]){return true;}else{return false;}}},inViewportRegion:function(J,I,K){return E.inRegion(J,E.viewportRegion(J),I,K);},_getRegion:function(K,L,I,J){var M={};M[D]=M[1]=K;M[B]=M[0]=J;M[H]=I;M[C]=L;M.width=M[C]-M[B];M.height=M[H]-M[D];return M;},viewportRegion:function(J){J=J||G.config.doc.documentElement;var I=false,L,K;if(J){L=E.docScrollX(J);K=E.docScrollY(J);I=E._getRegion(K,E.winWidth(J)+L,K+E.winHeight(J),L);}return I;}});})(A);},"3.0.0",{requires:["dom-base","dom-style"]});YUI.add("selector-native",function(A){(function(G){G.namespace("Selector");var E="compareDocumentPosition",F="ownerDocument",D="yui-tmp-",C=0;var B={_foundCache:[],useNative:true,_compare:("sourceIndex" in document.documentElement)?function(K,J){var I=K.sourceIndex,H=J.sourceIndex;if(I===H){return 0;}else{if(I>H){return 1;}}return -1;}:(document.documentElement[E]?function(I,H){if(I[E](H)&4){return -1;}else{return 1;}}:function(L,K){var J,H,I;if(L&&K){J=L[F].createRange();J.setStart(L,0);H=K[F].createRange();H.setStart(K,0);I=J.compareBoundaryPoints(1,H);}return I;}),_sort:function(H){if(H){H=G.Array(H,0,true);if(H.sort){H.sort(B._compare);}}return H;},_deDupe:function(H){var I=[],J,K;for(J=0;(K=H[J++]);){if(!K._found){I[I.length]=K;K._found=true;}}for(J=0;(K=I[J++]);){K._found=null;K.removeAttribute("_found");}return I;},query:function(I,P,Q,H){P=P||G.config.doc;var M=[],J=(G.Selector.useNative&&document.querySelector&&!H),L=[[I,P]],N,R,K,O=(J)?G.Selector._nativeQuery:G.Selector._bruteQuery;if(I&&O){if(!H&&(!J||P.tagName)){L=B._splitQueries(I,P);}for(K=0;(N=L[K++]);){R=O(N[0],N[1],Q);if(!Q){R=G.Array(R,0,true);}if(R){M=M.concat(R);}}if(L.length>1){M=B._sort(B._deDupe(M));}}return(Q)?(M[0]||null):M;},_splitQueries:function(J,M){var I=J.split(","),K=[],N="",L,H;if(M){if(M.tagName){M.id=M.id||G.guid();N="#"+M.id+" ";}for(L=0,H=I.length;L<H;++L){J=N+I[L];K.push([J,M]);}}return K;},_nativeQuery:function(H,I,J){try{return I["querySelector"+(J?"":"All")](H);}catch(K){return G.Selector.query(H,I,J,true);}},filter:function(I,H){var J=[],K,L;if(I&&H){for(K=0;(L=I[K++]);){if(G.Selector.test(L,H)){J[J.length]=L;}}}else{}return J;},test:function(N,I,J){var K=false,H=I.split(","),M,L,O;if(N&&N.tagName){J=J||N.ownerDocument;if(!N.id){N.id=D+C++;
}for(L=0;(O=H[L++]);){O+="#"+N.id;M=G.Selector.query(O,J,true);K=(M===N);if(K){break;}}}return K;}};G.mix(G.Selector,B,true);})(A);},"3.0.0",{requires:["dom-base"]});YUI.add("selector-css2",function(G){var H="parentNode",D="tagName",E="attributes",A="combinator",F="pseudos",C=G.Selector,B={SORT_RESULTS:true,_children:function(M,I){var J=M.children,L,K=[],N,O;if(M.children&&I&&M.children.tags){K=M.children.tags(I);}else{if((!J&&M[D])||(J&&I)){N=J||M.childNodes;J=[];for(L=0;(O=N[L++]);){if(O.tagName){if(!I||I===O.tagName){J.push(O);}}}}}return J||[];},_regexCache:{},_re:{attr:/(\[.*\])/g,pseudos:/:([\-\w]+(?:\(?:['"]?(.+)['"]?\)))*/i},shorthand:{"\\#(-?[_a-z]+[-\\w]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w]*)":"[className~=$1]"},operators:{"":function(J,I){return G.DOM.getAttribute(J,I)!=="";},"~=":"(?:^|\\s+){val}(?:\\s+|$)","|=":"^{val}-?"},pseudos:{"first-child":function(I){return G.Selector._children(I[H])[0]===I;}},_bruteQuery:function(M,Q,S){var N=[],I=[],P=C._tokenize(M),L=P[P.length-1],R=G.DOM._getDoc(Q),J,O,K;if(P[0]&&R===Q&&(J=P[0].id)&&R.getElementById(J)){Q=R.getElementById(J);}if(L){J=L.id;O=L.className;K=L.tagName||"*";if(J){if(R.getElementById(J)){I=[R.getElementById(J)];}}else{if(O){I=Q.getElementsByClassName(O);}else{if(K){I=Q.getElementsByTagName(K||"*");}}}if(I.length){N=C._filterNodes(I,P,S);}}return N;},_filterNodes:function(R,N,P){var W=0,V,X=N.length,Q=X-1,M=[],T=R[0],a=T,Y=G.Selector.getters,L,U,K,O,I,S,J,Z;for(W=0;(a=T=R[W++]);){Q=X-1;O=null;testLoop:while(a&&a.tagName){K=N[Q];J=K.tests;V=J.length;if(V&&!I){while((Z=J[--V])){L=Z[1];if(Y[Z[0]]){S=Y[Z[0]](a,Z[0]);}else{S=a[Z[0]];if(S===undefined&&a.getAttribute){S=a.getAttribute(Z[0]);}}if((L==="="&&S!==Z[2])||(L.test&&!L.test(S))||(L.call&&!L(a,Z[0]))){if((a=a[O])){while(a&&(!a.tagName||(K.tagName&&K.tagName!==a.tagName))){a=a[O];}}continue testLoop;}}}Q--;if(!I&&(U=K.combinator)){O=U.axis;a=a[O];while(a&&!a.tagName){a=a[O];}if(U.direct){O=null;}}else{M.push(T);if(P){return M;}break;}}}T=a=null;return M;},_getRegExp:function(K,I){var J=C._regexCache;I=I||"";if(!J[K+I]){J[K+I]=new RegExp(K,I);}return J[K+I];},combinators:{" ":{axis:"parentNode"},">":{axis:"parentNode",direct:true},"+":{axis:"previousSibling",direct:true}},_parsers:[{name:E,re:/^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,fn:function(K,L){var J=K[2]||"",I=G.Selector.operators,M;if((K[1]==="id"&&J==="=")||(K[1]==="className"&&document.getElementsByClassName&&(J==="~="||J==="="))){L.prefilter=K[1];L[K[1]]=K[3];}if(J in I){M=I[J];if(typeof M==="string"){M=G.Selector._getRegExp(M.replace("{val}",K[3]));}K[2]=M;}if(!L.last||L.prefilter!==K[1]){return K.slice(1);}}},{name:D,re:/^((?:-?[_a-z]+[\w-]*)|\*)/i,fn:function(J,K){var I=J[1].toUpperCase();K.tagName=I;if(I!=="*"&&(!K.last||K.prefilter)){return[D,"=",I];}if(!K.prefilter){K.prefilter="tagName";}}},{name:A,re:/^\s*([>+~]|\s)\s*/,fn:function(I,J){}},{name:F,re:/^:([\-\w]+)(?:\(['"]?(.+)['"]?\))*/i,fn:function(I,J){var K=C[F][I[1]];if(K){return[I[2],K];}else{return false;}}}],_getToken:function(I){return{tagName:null,id:null,className:null,attributes:{},combinator:null,tests:[]};},_tokenize:function(K){K=K||"";K=C._replaceShorthand(G.Lang.trim(K));var J=C._getToken(),P=K,O=[],Q=false,M,N,L,I;outer:do{Q=false;for(L=0;(I=C._parsers[L++]);){if((M=I.re.exec(K))){if(I!==A){J.selector=K;}K=K.replace(M[0],"");if(!K.length){J.last=true;}if(C._attrFilters[M[1]]){M[1]=C._attrFilters[M[1]];}N=I.fn(M,J);if(N===false){Q=false;break outer;}else{if(N){J.tests.push(N);}}if(!K.length||I.name===A){O.push(J);J=C._getToken(J);if(I.name===A){J.combinator=G.Selector.combinators[M[1]];}}Q=true;}}}while(Q&&K.length);if(!Q||K.length){O=[];}return O;},_replaceShorthand:function(J){var K=C.shorthand,L=J.match(C._re.attr),O=J.match(C._re.pseudos),N,M,I;if(O){J=J.replace(C._re.pseudos,"!!REPLACED_PSEUDO!!");}if(L){J=J.replace(C._re.attr,"!!REPLACED_ATTRIBUTE!!");}for(N in K){if(K.hasOwnProperty(N)){J=J.replace(C._getRegExp(N,"gi"),K[N]);}}if(L){for(M=0,I=L.length;M<I;++M){J=J.replace("!!REPLACED_ATTRIBUTE!!",L[M]);}}if(O){for(M=0,I=O.length;M<I;++M){J=J.replace("!!REPLACED_PSEUDO!!",O[M]);}}return J;},_attrFilters:{"class":"className","for":"htmlFor"},getters:{href:function(J,I){return G.DOM.getAttribute(J,I);}}};G.mix(G.Selector,B,true);G.Selector.getters.src=G.Selector.getters.rel=G.Selector.getters.href;if(G.Selector.useNative&&document.querySelector){G.Selector.shorthand["\\.(-?[_a-z]+[-\\w]*)"]="[class~=$1]";}},"3.0.0",{requires:["selector-native"]});YUI.add("selector",function(A){},"3.0.0",{use:["selector-native","selector-css2"]});YUI.add("dom",function(A){},"3.0.0",{use:["dom-base","dom-style","dom-screen","selector"]});

YUI.add("event-custom-base",function(E){E.Env.evt={handles:{},plugins:{}};(function(){var F=0,G=1;E.Do={objs:{},before:function(I,K,L,M){var J=I,H;if(M){H=[I,M].concat(E.Array(arguments,4,true));J=E.rbind.apply(E,H);}return this._inject(F,J,K,L);},after:function(I,K,L,M){var J=I,H;if(M){H=[I,M].concat(E.Array(arguments,4,true));J=E.rbind.apply(E,H);}return this._inject(G,J,K,L);},_inject:function(H,J,K,M){var N=E.stamp(K),L,I;if(!this.objs[N]){this.objs[N]={};}L=this.objs[N];if(!L[M]){L[M]=new E.Do.Method(K,M);K[M]=function(){return L[M].exec.apply(L[M],arguments);};}I=N+E.stamp(J)+M;L[M].register(I,J,H);return new E.EventHandle(L[M],I);},detach:function(H){if(H.detach){H.detach();}},_unload:function(I,H){}};E.Do.Method=function(H,I){this.obj=H;this.methodName=I;this.method=H[I];this.before={};this.after={};};E.Do.Method.prototype.register=function(I,J,H){if(H){this.after[I]=J;}else{this.before[I]=J;}};E.Do.Method.prototype._delete=function(H){delete this.before[H];delete this.after[H];};E.Do.Method.prototype.exec=function(){var J=E.Array(arguments,0,true),K,I,N,L=this.before,H=this.after,M=false;for(K in L){if(L.hasOwnProperty(K)){I=L[K].apply(this.obj,J);if(I){switch(I.constructor){case E.Do.Halt:return I.retVal;case E.Do.AlterArgs:J=I.newArgs;break;case E.Do.Prevent:M=true;break;default:}}}}if(!M){I=this.method.apply(this.obj,J);}for(K in H){if(H.hasOwnProperty(K)){N=H[K].apply(this.obj,J);if(N&&N.constructor==E.Do.Halt){return N.retVal;}else{if(N&&N.constructor==E.Do.AlterReturn){I=N.newRetVal;}}}}return I;};E.Do.AlterArgs=function(I,H){this.msg=I;this.newArgs=H;};E.Do.AlterReturn=function(I,H){this.msg=I;this.newRetVal=H;};E.Do.Halt=function(I,H){this.msg=I;this.retVal=H;};E.Do.Prevent=function(H){this.msg=H;};E.Do.Error=E.Do.Halt;})();var D="after",B=["broadcast","bubbles","context","contextFn","currentTarget","defaultFn","details","emitFacade","fireOnce","host","preventable","preventedFn","queuable","silent","stoppedFn","target","type"],C=9,A="yui:log";E.EventHandle=function(F,G){this.evt=F;this.sub=G;};E.EventHandle.prototype={detach:function(){var F=this.evt,G;if(F){if(E.Lang.isArray(F)){for(G=0;G<F.length;G++){F[G].detach();}}else{F._delete(this.sub);}}}};E.CustomEvent=function(F,G){G=G||{};this.id=E.stamp(this);this.type=F;this.context=E;this.logSystem=(F==A);this.silent=this.logSystem;this.subscribers={};this.afters={};this.preventable=true;this.bubbles=true;this.signature=C;this.applyConfig(G,true);};E.CustomEvent.prototype={applyConfig:function(G,F){if(G){E.mix(this,G,F,B);}},_on:function(J,H,G,F){if(!J){this.log("Invalid callback for CE: "+this.type);}var I=new E.Subscriber(J,H,G,F);if(this.fireOnce&&this.fired){E.later(0,this,E.bind(this._notify,this,I,this.firedWith));}if(F==D){this.afters[I.id]=I;this.hasAfters=true;}else{this.subscribers[I.id]=I;this.hasSubscribers=true;}return new E.EventHandle(this,I);},subscribe:function(H,G){var F=(arguments.length>2)?E.Array(arguments,2,true):null;return this._on(H,G,F,true);},on:function(H,G){var F=(arguments.length>2)?E.Array(arguments,2,true):null;return this._on(H,G,F,true);},after:function(H,G){var F=(arguments.length>2)?E.Array(arguments,2,true):null;return this._on(H,G,F,D);},detach:function(J,H){if(J&&J.detach){return J.detach();}var K=0,G=this.subscribers,F,I;for(F in G){if(G.hasOwnProperty(F)){I=G[F];if(I&&(!J||J===I.fn)){this._delete(I);K++;}}}return K;},unsubscribe:function(){return this.detach.apply(this,arguments);},_notify:function(I,H,F){this.log(this.type+"->"+"sub: "+I.id);var G;G=I.notify(H,this);if(false===G||this.stopped>1){this.log(this.type+" cancelled by subscriber");return false;}return true;},log:function(G,F){if(!this.silent){}},fire:function(){if(this.fireOnce&&this.fired){this.log("fireOnce event: "+this.type+" already fired");return true;}else{var F=E.Array(arguments,0,true);this.fired=true;this.firedWith=F;if(this.emitFacade){return this.fireComplex(F);}else{return this.fireSimple(F);}}},fireSimple:function(F){if(this.hasSubscribers||this.hasAfters){this._procSubs(E.merge(this.subscribers,this.afters),F);}this._broadcast(F);return this.stopped?false:true;},fireComplex:function(F){F[0]=F[0]||{};return this.fireSimple(F);},_procSubs:function(I,G,F){var J,H;for(H in I){if(I.hasOwnProperty(H)){J=I[H];if(J&&J.fn){if(false===this._notify(J,G,F)){this.stopped=2;}if(this.stopped==2){return false;}}}}return true;},_broadcast:function(G){if(!this.stopped&&this.broadcast){var F=E.Array(G);F.unshift(this.type);if(this.host!==E){E.fire.apply(E,F);}if(this.broadcast==2){E.Global.fire.apply(E.Global,F);}}},unsubscribeAll:function(){return this.detachAll.apply(this,arguments);},detachAll:function(){return this.detach();},_delete:function(F){if(F){delete F.fn;delete F.context;delete this.subscribers[F.id];delete this.afters[F.id];}}};E.Subscriber=function(H,G,F){this.fn=H;this.context=G;this.id=E.stamp(this);this.args=F;this.events=null;};E.Subscriber.prototype={_notify:function(J,H,I){var F=this.args,G;switch(I.signature){case 0:G=this.fn.call(J,I.type,H,J);break;case 1:G=this.fn.call(J,H[0]||null,J);break;default:if(F||H){H=H||[];F=(F)?H.concat(F):H;G=this.fn.apply(J,F);}else{G=this.fn.call(J);}}return G;},notify:function(G,I){var J=this.context,F=true;if(!J){J=(I.contextFn)?I.contextFn():I.context;}if(E.config.throwFail){F=this._notify(J,G,I);}else{try{F=this._notify(J,G,I);}catch(H){E.error(this+" failed: "+H.message,H);}}return F;},contains:function(G,F){if(F){return((this.fn==G)&&this.context==F);}else{return(this.fn==G);}}};(function(){var F=E.Lang,H=":",I="|",J="~AFTER~",K=E.cached(function(L,N){if(!N||!F.isString(L)||L.indexOf(H)>-1){return L;}return N+H+L;}),G=E.cached(function(O,Q){var N=O,P,R,L;if(!F.isString(N)){return N;}L=N.indexOf(J);if(L>-1){R=true;N=N.substr(J.length);}L=N.indexOf(I);if(L>-1){P=N.substr(0,(L));N=N.substr(L+1);if(N=="*"){N=null;}}return[P,(Q)?K(N,Q):N,R,N];}),M=function(L){var N=(F.isObject(L))?L:{};this._yuievt=this._yuievt||{id:E.guid(),events:{},targets:{},config:N,chain:("chain" in N)?N.chain:E.config.chain,defaults:{context:N.context||this,host:this,emitFacade:N.emitFacade,fireOnce:N.fireOnce,queuable:N.queuable,broadcast:N.broadcast,bubbles:("bubbles" in N)?N.bubbles:true}};
};M.prototype={on:function(Q,U,O,V){var Z=G(Q,this._yuievt.config.prefix),a,b,N,g,X,W,d,R=E.Env.evt.handles,P,L,S,e=E.Node,Y,T;if(F.isObject(Q)){if(F.isFunction(Q)){return E.Do.before.apply(E.Do,arguments);}a=U;b=O;N=E.Array(arguments,0,true);g={};P=Q._after;delete Q._after;E.each(Q,function(f,c){if(f){a=f.fn||((E.Lang.isFunction(f))?f:a);b=f.context||b;}N[0]=(P)?J+c:c;N[1]=a;N[2]=b;g[c]=this.on.apply(this,N);},this);return(this._yuievt.chain)?this:new E.EventHandle(g);}W=Z[0];P=Z[2];S=Z[3];if(e&&(this instanceof e)&&(S in e.DOM_EVENTS)){N=E.Array(arguments,0,true);N.splice(2,0,e.getDOMNode(this));return E.on.apply(E,N);}Q=Z[1];if(this instanceof YUI){L=E.Env.evt.plugins[Q];N=E.Array(arguments,0,true);N[0]=S;if(e){Y=N[2];if(Y instanceof E.NodeList){Y=E.NodeList.getDOMNodes(Y);}else{if(Y instanceof e){Y=e.getDOMNode(Y);}}T=(S in e.DOM_EVENTS);if(T){N[2]=Y;}}if(L){d=L.on.apply(E,N);}else{if((!Q)||T){d=E.Event._attach(N);}}}if(!d){X=this._yuievt.events[Q]||this.publish(Q);d=X._on(U,O,(arguments.length>3)?E.Array(arguments,3,true):null,(P)?"after":true);}if(W){R[W]=R[W]||{};R[W][Q]=R[W][Q]||[];R[W][Q].push(d);}return(this._yuievt.chain)?this:d;},subscribe:function(){return this.on.apply(this,arguments);},detach:function(P,U,O){var T=this._yuievt.events,Z,d,c=E.Node,Y=(this instanceof c);if(!P&&(this!==E)){for(Z in T){if(T.hasOwnProperty(Z)){d=T[Z].detach(U,O);}}if(Y){E.Event.purgeElement(c.getDOMNode(this));}return d;}var X=G(P,this._yuievt.config.prefix),V=F.isArray(X)?X[0]:null,R=(X)?X[3]:null,b,L,Q=E.Env.evt.handles,S,N,W,a=function(g,f){var e=g[f];if(e){while(e.length){b=e.pop();b.detach();}}};if(V){S=Q[V];P=X[1];if(S){if(P){a(S,P);}else{for(Z in S){if(S.hasOwnProperty(Z)){a(S,Z);}}}return(this._yuievt.chain)?this:true;}}else{if(F.isObject(P)&&P.detach){d=P.detach();return(this._yuievt.chain)?this:d;}else{if(Y&&((!R)||(R in c.DOM_EVENTS))){N=E.Array(arguments,0,true);N[2]=c.getDOMNode(this);return E.detach.apply(E,N);}}}L=E.Env.evt.plugins[R];if(this instanceof YUI){N=E.Array(arguments,0,true);if(L&&L.detach){return L.detach.apply(E,N);}else{if(!P||(!L&&c&&(P in c.DOM_EVENTS))){N[0]=P;return E.Event.detach.apply(E.Event,N);}}}W=T[P];if(W){d=W.detach(U,O);}return(this._yuievt.chain)?this:d;},unsubscribe:function(){return this.detach.apply(this,arguments);},detachAll:function(L){return this.detach(L);},unsubscribeAll:function(){return this.detachAll.apply(this,arguments);},publish:function(O,P){var N,R,L,Q=this._yuievt.config.prefix;O=(Q)?K(O,Q):O;if(F.isObject(O)){L={};E.each(O,function(T,S){L[S]=this.publish(S,T||P);},this);return L;}N=this._yuievt.events;R=N[O];if(R){if(P){R.applyConfig(P,true);}}else{R=new E.CustomEvent(O,(P)?E.mix(P,this._yuievt.defaults):this._yuievt.defaults);N[O]=R;}return N[O];},addTarget:function(L){this._yuievt.targets[E.stamp(L)]=L;this._yuievt.hasTargets=true;},removeTarget:function(L){delete this._yuievt.targets[E.stamp(L)];},fire:function(P){var S=F.isString(P),O=(S)?P:(P&&P.type),R,L,N,Q=this._yuievt.config.prefix;O=(Q)?K(O,Q):O;R=this.getEvent(O,true);if(!R){if(this._yuievt.hasTargets){L=(S)?arguments:E.Array(arguments,0,true).unshift(O);return this.bubble(null,L,this);}N=true;}else{L=E.Array(arguments,(S)?1:0,true);N=R.fire.apply(R,L);R.target=null;}return(this._yuievt.chain)?this:N;},getEvent:function(N,L){var P,O;if(!L){P=this._yuievt.config.prefix;N=(P)?K(N,P):N;}O=this._yuievt.events;return(O&&N in O)?O[N]:null;},after:function(O,N){var L=E.Array(arguments,0,true);switch(F.type(O)){case"function":return E.Do.after.apply(E.Do,arguments);case"object":L[0]._after=true;break;default:L[0]=J+O;}return this.on.apply(this,L);},before:function(){return this.on.apply(this,arguments);}};E.EventTarget=M;E.mix(E,M.prototype,false,false,{bubbles:false});M.call(E);YUI.Env.globalEvents=YUI.Env.globalEvents||new M();E.Global=YUI.Env.globalEvents;})();},"3.0.0",{requires:["oop"]});

(function(){var GLOBAL_ENV=YUI.Env,C=YUI.config,D=C.doc,POLL_INTERVAL=C.pollInterval||40,_ready=function(e){GLOBAL_ENV._ready();};if(!GLOBAL_ENV._ready){GLOBAL_ENV._ready=function(){if(!GLOBAL_ENV.DOMReady){GLOBAL_ENV.DOMReady=true;if(D.removeEventListener){D.removeEventListener("DOMContentLoaded",_ready,false);}}};
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
if(navigator.userAgent.match(/MSIE/)){if(self!==self.top){document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;_ready();}};}else{GLOBAL_ENV._dri=setInterval(function(){try{document.documentElement.doScroll("left");clearInterval(GLOBAL_ENV._dri);GLOBAL_ENV._dri=null;_ready();}catch(ex){}},POLL_INTERVAL);}}else{D.addEventListener("DOMContentLoaded",_ready,false);}}})();YUI.add("event-base",function(A){(function(){var C=YUI.Env,B=function(){A.fire("domready");};A.publish("domready",{fireOnce:true});if(C.DOMReady){B();}else{A.before(B,C,"_ready");}})();(function(){var C=A.UA,B={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9,63272:46,63273:36,63275:35},D=function(F){try{if(F&&3==F.nodeType){F=F.parentNode;}}catch(E){return null;}return A.one(F);};A.DOMEventFacade=function(L,F,E){E=E||{};var H=L,G=F,I=A.config.doc,M=I.body,N=H.pageX,K=H.pageY,J,O;this.altKey=H.altKey;this.ctrlKey=H.ctrlKey;this.metaKey=H.metaKey;this.shiftKey=H.shiftKey;this.type=H.type;this.clientX=H.clientX;this.clientY=H.clientY;if(!N&&0!==N){N=H.clientX||0;K=H.clientY||0;if(C.ie){N+=Math.max(I.documentElement.scrollLeft,M.scrollLeft);K+=Math.max(I.documentElement.scrollTop,M.scrollTop);}}this._yuifacade=true;this._event=H;this.pageX=N;this.pageY=K;J=H.keyCode||H.charCode||0;if(C.webkit&&(J in B)){J=B[J];}this.keyCode=J;this.charCode=J;this.button=H.which||H.button;this.which=this.button;this.target=D(H.target||H.srcElement);this.currentTarget=D(G);O=H.relatedTarget;if(!O){if(H.type=="mouseout"){O=H.toElement;}else{if(H.type=="mouseover"){O=H.fromElement;}}}this.relatedTarget=D(O);if(H.type=="mousewheel"||H.type=="DOMMouseScroll"){this.wheelDelta=(H.detail)?(H.detail*-1):Math.round(H.wheelDelta/80)||((H.wheelDelta<0)?-1:1);}this.stopPropagation=function(){if(H.stopPropagation){H.stopPropagation();}else{H.cancelBubble=true;}E.stopped=1;};this.stopImmediatePropagation=function(){if(H.stopImmediatePropagation){H.stopImmediatePropagation();}else{this.stopPropagation();}E.stopped=2;};this.preventDefault=function(P){if(H.preventDefault){H.preventDefault();}H.returnValue=P||false;E.prevented=1;};this.halt=function(P){if(P){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){A.Env.evt.dom_wrappers={};A.Env.evt.dom_map={};var H=A.Env.evt,J=YUI.Env.add,D=YUI.Env.remove,G=function(){YUI.Env.windowLoaded=true;A.Event._load();D(window,"load",G);},B=function(){A.Event._unload();D(window,"unload",B);},C="domready",E="~yui|2|compat~",F=function(L){try{return(L&&typeof L!=="string"&&A.Lang.isNumber(L.length)&&!L.tagName&&!L.alert);}catch(K){return false;}},I=function(){var M=false,N=0,L=[],O=H.dom_wrappers,K=null,P=H.dom_map;return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var Q=A.Event;if(!Q._interval){Q._interval=setInterval(A.bind(Q._poll,Q),Q.POLL_INTERVAL);}},onAvailable:function(Q,U,Y,R,V,X){var W=A.Array(Q),S,T;for(S=0;S<W.length;S=S+1){L.push({id:W[S],fn:U,obj:Y,override:R,checkReady:V,compat:X});}N=this.POLL_RETRYS;setTimeout(A.bind(A.Event._poll,A.Event),0);T=new A.EventHandle({_delete:function(){if(T.handle){T.handle.detach();return;}var a,Z;for(a=0;a<W.length;a++){for(Z=0;Z<L.length;Z++){if(W[a]===L[Z].id){L.splice(Z,1);}}}}});return T;},onContentReady:function(U,R,T,S,Q){return this.onAvailable(U,R,T,S,true,Q);},attach:function(T,S,R,Q){return A.Event._attach(A.Array(arguments,0,true));},_createWrapper:function(W,V,Q,R,U){var X=A.stamp(W),T="event:"+X+V,S;if(false===U){T+="native";}if(Q){T+="capture";}S=O[T];if(!S){S=A.publish(T,{silent:true,bubbles:false,contextFn:function(){S.nodeRef=S.nodeRef||A.one(S.el);return S.nodeRef;}});S.el=W;S.key=T;S.domkey=X;S.type=V;S.fn=function(Y){S.fire(A.Event.getEvent(Y,W,(R||(false===U))));};S.capture=Q;if(W==A.config.win&&V=="load"){S.fireOnce=true;K=T;}O[T]=S;P[X]=P[X]||{};P[X][T]=S;J(W,V,S.fn,Q);}return S;},_attach:function(W,S){var a,e=A.Event,c,U,Z,Q,T=false,V,X=W[0],Y=W[1],R=W[2]||A.config.win,d=S&&S.facade,b=S&&S.capture;if(W[W.length-1]===E){a=true;}if(!Y||!Y.call){return false;}if(F(R)){c=[];A.each(R,function(g,f){W[2]=g;c.push(e._attach(W,S));});return new A.EventHandle(c);}else{if(A.Lang.isString(R)){if(a){U=A.DOM.byId(R);}else{U=A.Selector.query(R);switch(U.length){case 0:U=null;break;case 1:U=U[0];break;default:W[2]=U;return e._attach(W,S);}}if(U){R=U;}else{V=this.onAvailable(R,function(){V.handle=e._attach(W,S);},e,true,false,a);return V;}}}if(!R){return false;}if(A.Node&&R instanceof A.Node){R=A.Node.getDOMNode(R);}Z=this._createWrapper(R,X,b,a,d);if(R==A.config.win&&X=="load"){if(YUI.Env.windowLoaded){T=true;}}if(a){W.pop();}Q=W[3];V=Z._on(Y,Q,(W.length>4)?W.slice(4):null);if(T){Z.fire();}return V;},detach:function(X,Z,S,U){var W=A.Array(arguments,0,true),a,V,T,Y,Q,R;if(W[W.length-1]===E){a=true;}if(X&&X.detach){return X.detach();}if(typeof S=="string"){if(a){S=A.DOM.byId(S);}else{S=A.Selector.query(S);T=S.length;if(T<1){S=null;}else{if(T==1){S=S[0];}}}}if(!S){return false;}if(F(S)){Y=true;for(V=0,T=S.length;V<T;++V){W[2]=S[V];Y=(A.Event.detach.apply(A.Event,W)&&Y);}return Y;}if(!X||!Z||!Z.call){return this.purgeElement(S,false,X);}Q="event:"+A.stamp(S)+X;R=O[Q];if(R){return R.detach(Z);}else{return false;}},getEvent:function(T,R,Q){var S=T||window.event;return(Q)?S:new A.DOMEventFacade(S,R,O["event:"+A.stamp(R)+T.type]);},generateId:function(Q){var R=Q.id;if(!R){R=A.stamp(Q);Q.id=R;}return R;},_isValidCollection:F,_load:function(Q){if(!M){M=true;if(A.fire){A.fire(C);}A.Event._poll();}},_poll:function(){if(this.locked){return;
}if(A.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var V=!M,U,W,R,Q,T,S;if(!V){V=(N>0);}U=[];W=function(Z,a){var Y,X=a.override;if(a.compat){if(a.override){if(X===true){Y=a.obj;}else{Y=X;}}else{Y=Z;}a.fn.call(Y,a.obj);}else{Y=a.obj||A.one(Z);a.fn.apply(Y,(A.Lang.isArray(X))?X:[]);}};for(R=0,Q=L.length;R<Q;++R){T=L[R];if(T&&!T.checkReady){S=(T.compat)?A.DOM.byId(T.id):A.Selector.query(T.id,null,true);if(S){W(S,T);L[R]=null;}else{U.push(T);}}}for(R=0,Q=L.length;R<Q;++R){T=L[R];if(T&&T.checkReady){S=(T.compat)?A.DOM.byId(T.id):A.Selector.query(T.id,null,true);if(S){if(M||(S.get&&S.get("nextSibling"))||S.nextSibling){W(S,T);L[R]=null;}}else{U.push(T);}}}N=(U.length===0)?0:N-1;if(V){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;},purgeElement:function(W,X,V){var S=(A.Lang.isString(W))?A.Selector.query(W,null,true):W,R=this.getListeners(S,V),T,Q,U;if(R){for(T=0,Q=R.length;T<Q;++T){U=R[T];U.detachAll();D(U.el,U.type,U.fn,U.capture);delete O[U.key];delete P[U.domkey][U.key];}}if(X&&S&&S.childNodes){for(T=0,Q=S.childNodes.length;T<Q;++T){this.purgeElement(S.childNodes[T],X,V);}}},getListeners:function(U,T){var V=A.stamp(U,true),Q=P[V],S=[],R=(T)?"event:"+V+T:null;if(!Q){return null;}if(R){if(Q[R]){S.push(Q[R]);}R+="native";if(Q[R]){S.push(Q[R]);}}else{A.each(Q,function(X,W){S.push(X);});}return(S.length)?S:null;},_unload:function(Q){A.each(O,function(S,R){S.detachAll();D(S.el,S.type,S.fn,S.capture);delete O[R];delete P[S.domkey][R];});},nativeAdd:J,nativeRemove:D};}();A.Event=I;if(A.config.injected||YUI.Env.windowLoaded){G();}else{J(window,"load",G);}if(A.UA.ie){A.on(C,I._poll,I,true);}A.on("unload",B);I.Custom=A.CustomEvent;I.Subscriber=A.Subscriber;I.Target=A.EventTarget;I.Handle=A.EventHandle;I.Facade=A.EventFacade;I._poll();})();A.Env.evt.plugins.available={on:function(D,C,F,E){var B=arguments.length>4?A.Array(arguments,4,true):[];return A.Event.onAvailable.call(A.Event,F,C,E,B);}};A.Env.evt.plugins.contentready={on:function(D,C,F,E){var B=arguments.length>4?A.Array(arguments,4,true):[];return A.Event.onContentReady.call(A.Event,F,C,E,B);}};},"3.0.0",{requires:["event-custom-base"]});YUI.add("event-delegate",function(B){var I=B.Event,F=B.Lang,E={},A={mouseenter:"mouseover",mouseleave:"mouseout"},H=function(K){try{if(K&&3==K.nodeType){return K.parentNode;}}catch(J){}return K;},D=function(K,P,M){var Q=H((P.target||P.srcElement)),N=E[K],T,O,L,S,R;var J=function(X,U,V){var W;if(!X||X===V){W=false;}else{W=B.Selector.test(X,U)?X:J(X.parentNode,U,V);}return W;};for(T in N){if(N.hasOwnProperty(T)){O=N[T];S=N.fn;L=null;if(B.Selector.test(Q,T,M)){L=Q;}else{if(B.Selector.test(Q,((T.replace(/,/gi," *,"))+" *"),M)){L=J(Q,T,M);}}if(L){if(!R){R=new B.DOMEventFacade(P,M);R.container=R.currentTarget;}R.currentTarget=B.Node.get(L);B.publish(O,{contextFn:function(){return R.currentTarget;}});if(S){S(R,O);}else{B.fire(O,R);}}}}},G=function(M,L,K){var O={focus:I._attachFocus,blur:I._attachBlur},N=O[M],J=[M,function(P){D(L,(P||window.event),K);},K];if(N){return N(J,{capture:true,facade:false});}else{return I._attach(J,{facade:false});}},C=B.cached(function(J){return J.replace(/[|,:]/g,"~");});B.Env.evt.plugins.delegate={on:function(O,N,M,J,K){var L=B.Array(arguments,0,true);L.splice(3,1);L[0]=J;return B.delegate.apply(B,L);}};I.delegate=function(R,U,K,W){if(!W){return false;}var O=B.Array(arguments,0,true),M=K,N;if(F.isString(K)){M=B.Selector.query(K,null,true);if(!M){N=I.onAvailable(K,function(){N.handle=I.delegate.apply(I,O);},I,true,false);return N;}}M=B.Node.getDOMNode(M);var S=B.stamp(M),L="delegate:"+S+R+C(W),J=R+S,Q=E[J],T,V,P;if(!Q){Q={};if(A[R]){if(!I._fireMouseEnter){return false;}R=A[R];Q.fn=I._fireMouseEnter;}T=G(R,J,M);B.after(function(X){if(T.sub==X){delete E[J];B.detachAll(L);}},T.evt,"_delete");Q.handle=T;E[J]=Q;}P=Q.listeners;Q.listeners=P?(P+1):1;Q[W]=L;O[0]=L;O.splice(2,2);V=B.on.apply(B,O);B.after(function(){Q.listeners=(Q.listeners-1);if(Q.listeners===0){Q.handle.detach();}},V,"detach");return V;};B.delegate=I.delegate;},"3.0.0",{requires:["node-base"]});YUI.add("event-mousewheel",function(C){var B="DOMMouseScroll",A=function(E){var D=C.Array(E,0,true),F;if(C.UA.gecko){D[0]=B;F=C.config.win;}else{F=C.config.doc;}if(D.length<3){D[2]=F;}else{D.splice(2,0,F);}return D;};C.Env.evt.plugins.mousewheel={on:function(){return C.Event._attach(A(arguments));},detach:function(){return C.Event.detach.apply(C.Event,A(arguments));}};},"3.0.0",{requires:["node-base"]});YUI.add("event-mouseenter",function(F){var C=F.Event,E=F.Lang,B=F.Env.evt.plugins,D={},A={on:function(M,O,H){var L=F.Array(arguments,0,true),J=H,K;if(E.isString(H)){J=F.all(H);if(J.size()===0){K=C.onAvailable(H,function(){K.handle=F.on.apply(F,L);},C,true,false);return K;}}var R=(M==="mouseenter")?"mouseover":"mouseout",Q=M+":"+F.stamp(J)+R,I=D[Q],N,P,G;if(!I){N=F.on(R,F.rbind(C._fireMouseEnter,F,Q),J);F.after(function(S){if(N.sub==S){delete D[Q];F.detachAll(Q);}},N.evt,"_delete");I={};I.handle=N;D[Q]=I;}G=I.count;I.count=G?(G+1):1;L[0]=Q;L.splice(2,1);P=F.on.apply(F,L);F.after(function(){I.count=(I.count-1);if(I.count===0){I.handle.detach();}},P,"detach");return P;}};C._fireMouseEnter=function(J,H){var G=J.relatedTarget,I=J.currentTarget;if(I!==G&&!I.contains(G)){F.publish(H,{contextFn:function(){return I;}});F.fire(H,J);}};B.mouseenter=A;B.mouseleave=A;},"3.0.0",{requires:["node-base"]});YUI.add("event-key",function(A){A.Env.evt.plugins.key={on:function(E,G,B,K,C){var I=A.Array(arguments,0,true),F,J,H,D;F=K&&K.split(":");if(!K||K.indexOf(":")==-1||!F[1]){I[0]="key"+((F&&F[0])||"press");return A.on.apply(A,I);}J=F[0];H=(F[1])?F[1].split(/,|\+/):null;D=(A.Lang.isString(B)?B:A.stamp(B))+K;D=D.replace(/,/g,"_");if(!A.getEvent(D)){A.on(E+J,function(P){var Q=false,M=false,N,L,O;for(N=0;N<H.length;N=N+1){L=H[N];O=parseInt(L,10);if(A.Lang.isNumber(O)){if(P.charCode===O){Q=true;}else{M=true;}}else{if(Q||!M){Q=(P[L+"Key"]);M=!Q;}}}if(Q){A.fire(D,P);}},B);
}I.splice(2,2);I[0]=D;return A.on.apply(A,I);}};},"3.0.0",{requires:["node-base"]});YUI.add("event-focus",function(A){(function(){var I=A.UA,J=A.Event,E=A.Env.evt.plugins,C=I.ie,F=(I.opera||I.webkit),D={focus:(C?"focusin":(F?"DOMFocusIn":"focus")),blur:(C?"focusout":(F?"DOMFocusOut":"blur"))},G={capture:(I.gecko?true:false)},H=function(M,L){var K=A.Array(M,0,true);K[0]=D[K[0]];return J._attach(K,L);},B={on:function(){return H(arguments,G);}};J._attachFocus=H;J._attachBlur=H;E.focus=B;E.blur=B;})();},"3.0.0",{requires:["node-base"]});YUI.add("event-resize",function(A){(function(){var C,B,E="window:resize",D=function(F){if(A.UA.gecko){A.fire(E,F);}else{if(B){B.cancel();}B=A.later(A.config.windowResizeDelay||40,A,function(){A.fire(E,F);});}};A.Env.evt.plugins.windowresize={on:function(H,G){if(!C){C=A.Event._attach(["resize",D]);}var F=A.Array(arguments,0,true);F[0]=E;return A.on.apply(A,F);}};})();},"3.0.0",{requires:["node-base"]});YUI.add("event",function(A){},"3.0.0",{use:["event-base","event-delegate","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize"]});

YUI.add("pluginhost",function(C){var A=C.Lang;function B(){this._plugins={};}B.prototype={plug:function(G,D){if(G){if(A.isFunction(G)){this._plug(G,D);}else{if(A.isArray(G)){for(var E=0,F=G.length;E<F;E++){this.plug(G[E]);}}else{this._plug(G.fn,G.cfg);}}}return this;},unplug:function(E){if(E){this._unplug(E);}else{var D;for(D in this._plugins){if(this._plugins.hasOwnProperty(D)){this._unplug(D);}}}return this;},hasPlugin:function(D){return(this._plugins[D]&&this[D]);},_initPlugins:function(E){this._plugins=this._plugins||{};var G=(this._getClasses)?this._getClasses():[this.constructor],D=[],H={},F,I,K,L,J;for(I=G.length-1;I>=0;I--){F=G[I];L=F._UNPLUG;if(L){C.mix(H,L,true);}K=F._PLUG;if(K){C.mix(D,K,true);}}for(J in D){if(D.hasOwnProperty(J)){if(!H[J]){this.plug(D[J]);}}}if(E&&E.plugins){this.plug(E.plugins);}},_destroyPlugins:function(){this._unplug();},_plug:function(F,D){if(F&&F.NS){var E=F.NS;D=D||{};D.host=this;if(this.hasPlugin(E)){this[E].setAttrs(D);}else{this[E]=new F(D);this._plugins[E]=F;}}},_unplug:function(F){var E=F,D=this._plugins;if(A.isFunction(F)){E=F.NS;if(E&&(!D[E]||D[E]!==F)){E=null;}}if(E){if(this[E]){this[E].destroy();delete this[E];}if(D[E]){delete D[E];}}}};B.plug=function(E,I,G){var J,H,D,F;if(E!==C.Base){E._PLUG=E._PLUG||{};if(!A.isArray(I)){if(G){I={fn:I,cfg:G};}I=[I];}for(H=0,D=I.length;H<D;H++){J=I[H];F=J.NAME||J.fn.NAME;E._PLUG[F]=J;}}};B.unplug=function(E,H){var I,G,D,F;if(E!==C.Base){E._UNPLUG=E._UNPLUG||{};if(!A.isArray(H)){H=[H];}for(G=0,D=H.length;G<D;G++){I=H[G];F=I.NAME;if(!E._PLUG[F]){E._UNPLUG[F]=I;}else{delete E._PLUG[F];}}}};C.namespace("Plugin").Host=B;},"3.0.0",{requires:["yui-base"]});

YUI.add("node-base",function(C){var G=".",E="nodeName",I="nodeType",B="ownerDocument",H="tagName",D="_yuid",F=function(L){var K=L[D];if(K&&F._instances[K]&&F._instances[K]._node!==L){L[D]=null;}K=C.stamp(L);if(!K){K=C.guid();}this[D]=K;this._node=L;F._instances[K]=this;this._stateProxy=L;if(this._initPlugins){this._initPlugins();}},J=function(L){var K=null;if(L){K=(typeof L==="string")?function(M){return C.Selector.test(M,L);}:function(M){return L(F.get(M));};}return K;};F.NAME="Node";F.re_aria=/^(?:role$|aria-)/;F.DOM_EVENTS={abort:true,beforeunload:true,blur:true,change:true,click:true,close:true,command:true,contextmenu:true,drag:true,dragstart:true,dragenter:true,dragover:true,dragleave:true,dragend:true,drop:true,dblclick:true,error:true,focus:true,keydown:true,keypress:true,keyup:true,load:true,message:true,mousedown:true,mousemove:true,mouseout:true,mouseover:true,mouseup:true,mousemultiwheel:true,mousewheel:true,submit:true,mouseenter:true,mouseleave:true,scroll:true,reset:true,resize:true,select:true,textInput:true,unload:true};C.mix(F.DOM_EVENTS,C.Env.evt.plugins);F._instances={};F.getDOMNode=function(K){if(K){return(K.nodeType)?K:K._node||null;}return null;};F.scrubVal=function(L,K){if(K&&L){if(typeof L==="object"||typeof L==="function"){if(I in L||C.DOM.isWindow(L)){L=F.get(L);}else{if((L.item&&!L._nodes)||(L[0]&&L[0][I])){L=C.all(L);}}}}else{if(L===undefined){L=K;}}return L;};F.addMethod=function(K,M,L){if(K&&M&&typeof M==="function"){F.prototype[K]=function(){L=L||this;var O=C.Array(arguments),N;if(O[0]&&O[0] instanceof F){O[0]=O[0]._node;}if(O[1]&&O[1] instanceof F){O[1]=O[1]._node;}O.unshift(this._node);N=F.scrubVal(M.apply(L,O),this);return N;};}else{}};F.importMethod=function(M,K,L){if(typeof K==="string"){L=L||K;F.addMethod(L,M[K],M);}else{C.each(K,function(N){F.importMethod(M,N);});}};F.one=function(N){var K=null,M,L;if(N){if(typeof N==="string"){if(N.indexOf("doc")===0){N=C.config.doc;}else{if(N.indexOf("win")===0){N=C.config.win;}else{N=C.Selector.query(N,null,true);}}if(!N){return null;}}else{if(N instanceof F){return N;}}L=N._yuid;K=F._instances[L];M=K?K._node:null;if(!K||(M&&N!==M)){K=new F(N);}}return K;};F.get=function(){return F.one.apply(F,arguments);};F.create=function(){return F.get(C.DOM.create.apply(C.DOM,arguments));};F.ATTRS={text:{getter:function(){return C.DOM.getText(this._node);},setter:function(K){C.DOM.setText(this._node,K);return K;}},"options":{getter:function(){return this._node.getElementsByTagName("option");}},"elements":{getter:function(){return C.all(this._node.elements);}},"children":{getter:function(){var N=this._node,M=N.children,O,L,K;if(!M){O=N.childNodes;M=[];for(L=0,K=O.length;L<K;++L){if(O[L][H]){M[M.length]=O[L];}}}return C.all(M);}},value:{getter:function(){return C.DOM.getValue(this._node);},setter:function(K){C.DOM.setValue(this._node,K);return K;}},data:{getter:function(){return this._data;},setter:function(K){this._data=K;return K;}}};F.DEFAULT_SETTER=function(K,M){var L=this._stateProxy,N;if(K.indexOf(G)>-1){N=K;K=K.split(G);C.Object.setValue(L,K,M);}else{if(L[K]!==undefined){L[K]=M;}}return M;};F.DEFAULT_GETTER=function(K){var L=this._stateProxy,M;if(K.indexOf&&K.indexOf(G)>-1){M=C.Object.getValue(L,K.split(G));}else{if(L[K]!==undefined){M=L[K];}}return M;};C.augment(F,C.Event.Target);C.mix(F.prototype,{toString:function(){var M="",L=this[D]+": not bound to a node",K=this._node;if(K){M+=K[E];if(K.id){M+="#"+K.id;}if(K.className){M+="."+K.className.replace(" ",".");}M+=" "+this[D];}return M||L;},get:function(K){var L;if(this._getAttr){L=this._getAttr(K);}else{L=this._get(K);}if(L){L=C.Node.scrubVal(L,this);}return L;},_get:function(K){var L=F.ATTRS[K],M;if(L&&L.getter){M=L.getter.call(this);}else{if(F.re_aria.test(K)){M=this._node.getAttribute(K,2);}else{M=F.DEFAULT_GETTER.apply(this,arguments);}}return M;},set:function(K,M){var L=F.ATTRS[K];if(this._setAttr){this._setAttr.apply(this,arguments);}else{if(L&&L.setter){L.setter.call(this,M);}else{if(F.re_aria.test(K)){this._node.setAttribute(K,M);}else{F.DEFAULT_SETTER.apply(this,arguments);}}}return this;},setAttrs:function(K){if(this._setAttrs){this._setAttrs(K);}else{C.Object.each(K,function(L,M){this.set(M,L);},this);}return this;},getAttrs:function(L){var K={};if(this._getAttrs){this._getAttrs(L);}else{C.Array.each(L,function(M,N){K[M]=this.get(M);},this);}return K;},create:F.create,compareTo:function(K){var L=this._node;if(K instanceof C.Node){K=K._node;}return L===K;},inDoc:function(L){var K=this._node;L=(L)?L._node||L:K[B];if(L.documentElement){return C.DOM.contains(L.documentElement,K);}},getById:function(M){var L=this._node,K=C.DOM.byId(M,L[B]);if(K&&C.DOM.contains(L,K)){K=C.one(K);}else{K=null;}return K;},ancestor:function(K){return F.get(C.DOM.elementByAxis(this._node,"parentNode",J(K)));},previous:function(L,K){return F.get(C.DOM.elementByAxis(this._node,"previousSibling",J(L),K));},next:function(M,L,K){return F.get(C.DOM.elementByAxis(this._node,"nextSibling",J(L),K));},one:function(K){return C.one(C.Selector.query(K,this._node,true));},query:function(K){return this.one(K);},all:function(K){var L=C.all(C.Selector.query(K,this._node));L._query=K;return L;},queryAll:function(K){return this.all(K);},test:function(K){return C.Selector.test(this._node,K);},remove:function(K){var L=this._node;L.parentNode.removeChild(L);if(K){this.destroy(true);}return this;},replace:function(K){var L=this._node;L.parentNode.replaceChild(K,L);return this;},purge:function(L,K){C.Event.purgeElement(this._node,L,K);},destroy:function(K){delete F._instances[this[D]];if(K){this.purge(true);}if(this.unplug){this.unplug();}this._node._yuid=null;this._node=null;this._stateProxy=null;},invoke:function(R,L,K,Q,P,O){var N=this._node,M;if(L&&L instanceof C.Node){L=L._node;}if(K&&K instanceof C.Node){K=K._node;}M=N[R](L,K,Q,P,O);return C.Node.scrubVal(M,this);},each:function(L,K){K=K||this;return L.call(K,this);},item:function(K){return this;},size:function(){return this._node?1:0;},insert:function(M,K){var L=this._node;
if(M){if(typeof K==="number"){K=this._node.childNodes[K];}if(typeof M!=="string"){if(M._node){M=M._node;}else{if(M._nodes||(!M.nodeType&&M.length)){C.each(M._nodes,function(N){C.DOM.addHTML(L,N,K);});return this;}}}C.DOM.addHTML(L,M,K);}return this;},prepend:function(K){return this.insert(K,0);},append:function(K){return this.insert(K,null);},setContent:function(K){C.DOM.addHTML(this._node,K,"replace");return this;},hasMethod:function(L){var K=this._node;return(K&&(typeof K==="function"));}},true);C.Node=F;C.get=C.Node.get;C.one=C.Node.one;var A=function(K){if(typeof K==="string"){this._query=K;K=C.Selector.query(K);}else{K=C.Array(K,0,true);}A._instances[C.stamp(this)]=this;this._nodes=K;};A.NAME="NodeList";A.getDOMNodes=function(K){return K._nodes;};A._instances=[];A.each=function(K,N,M){var L=K._nodes;if(L&&L.length){C.Array.each(L,N,M||K);}else{}};A.addMethod=function(K,M,L){if(K&&M){A.prototype[K]=function(){var O=[],N=arguments;C.Array.each(this._nodes,function(T){var S="_yuid",Q=C.Node._instances[T[S]],R,P;if(!Q){Q=A._getTempNode(T);}R=L||Q;P=M.apply(R,N);if(P!==undefined&&P!==Q){O[O.length]=P;}});return O.length?O:this;};}else{}};A.importMethod=function(M,K,L){if(typeof K==="string"){L=L||K;A.addMethod(K,M[K]);}else{C.each(K,function(N){A.importMethod(M,N);});}};A._getTempNode=function(L){var K=A._tempNode;if(!K){K=C.Node.create("<div></div>");A._tempNode=K;}K._node=L;K._stateProxy=L;return K;};C.mix(A.prototype,{item:function(K){return C.one((this._nodes||[])[K]);},each:function(M,L){var K=this;C.Array.each(this._nodes,function(O,N){O=C.one(O);return M.call(L||O,O,N,K);});return K;},batch:function(L,K){var M=this;C.Array.each(this._nodes,function(P,O){var N=C.Node._instances[P[D]];if(!N){N=A._getTempNode(P);}return L.call(K||N,N,O,M);});return M;},some:function(M,L){var K=this;return C.Array.some(this._nodes,function(O,N){O=C.one(O);L=L||O;return M.call(L,O,N,K);});},toFrag:function(){return C.one(C.DOM._nl2frag(this._nodes));},indexOf:function(K){return C.Array.indexOf(this._nodes,C.Node.getDOMNode(K));},filter:function(K){return C.all(C.Selector.filter(this._nodes,K));},modulus:function(M,L){L=L||0;var K=[];A.each(this,function(O,N){if(N%M===L){K.push(O);}});return C.all(K);},odd:function(){return this.modulus(2,1);},even:function(){return this.modulus(2);},destructor:function(){delete A._instances[this[D]];},refresh:function(){var L,K=this._nodes;if(this._query){if(K&&K[0]&&K[0].ownerDocument){L=K[0].ownerDocument;}this._nodes=C.Selector.query(this._query,L||C.config.doc);}return this;},on:function(N,M,L){var K=C.Array(arguments,0,true);K.splice(2,0,this._nodes);K[3]=L||this;return C.on.apply(C,K);},after:function(N,M,L){var K=C.Array(arguments,0,true);K.splice(2,0,this._nodes);K[3]=L||this;return C.after.apply(C,K);},size:function(){return this._nodes.length;},toString:function(){var N="",M=this[D]+": not bound to any nodes",K=this._nodes,L;if(K&&K[0]){L=K[0];N+=L[E];if(L.id){N+="#"+L.id;}if(L.className){N+="."+L.className.replace(" ",".");}if(K.length>1){N+="...["+K.length+" items]";}}return N||M;}},true);A.importMethod(C.Node.prototype,["append","detach","detachAll","insert","prepend","remove","set","setContent"]);A.prototype.get=function(L){var O=[],N=this._nodes,M=false,P=A._getTempNode,K,Q;if(N[0]){K=C.Node._instances[N[0]._yuid]||P(N[0]);Q=K._get(L);if(Q&&Q.nodeType){M=true;}}C.Array.each(N,function(R){K=C.Node._instances[R._yuid];if(!K){K=P(R);}Q=K._get(L);if(!M){Q=C.Node.scrubVal(Q,K);}O.push(Q);});return(M)?C.all(O):O;};C.NodeList=A;C.all=function(K){return new A(K);};C.Node.all=C.all;C.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(K){C.Node.prototype[K]=function(O,M,L){var N=this.invoke(K,O,M,L);return N;};});F.importMethod(C.DOM,["contains","setAttribute","getAttribute"]);C.NodeList.importMethod(C.Node.prototype,["getAttribute","setAttribute"]);(function(L){var K=["hasClass","addClass","removeClass","replaceClass","toggleClass"];L.Node.importMethod(L.DOM,K);L.NodeList.importMethod(L.Node.prototype,K);})(C);if(!document.documentElement.hasAttribute){C.Node.prototype.hasAttribute=function(K){return C.DOM.getAttribute(this._node,K)!=="";};}C.Node.ATTRS.type={setter:function(L){if(L==="hidden"){try{this._node.type="hidden";}catch(K){this.setStyle("display","none");this._inputType="hidden";}}else{try{this._node.type=L;}catch(K){}}return L;},getter:function(){return this._inputType||this._node.type;},_bypassProxy:true};},"3.0.0",{requires:["dom-base","selector-css2","event-base"]});YUI.add("node-style",function(A){(function(C){var B=["getStyle","getComputedStyle","setStyle","setStyles"];C.Node.importMethod(C.DOM,B);C.NodeList.importMethod(C.Node.prototype,B);})(A);},"3.0.0",{requires:["dom-style","node-base"]});YUI.add("node-screen",function(A){A.each(["winWidth","winHeight","docWidth","docHeight","docScrollX","docScrollY"],function(B){A.Node.ATTRS[B]={getter:function(){var C=Array.prototype.slice.call(arguments);C.unshift(A.Node.getDOMNode(this));return A.DOM[B].apply(this,C);}};});A.Node.ATTRS.scrollLeft={getter:function(){var B=A.Node.getDOMNode(this);return("scrollLeft" in B)?B.scrollLeft:A.DOM.docScrollX(B);},setter:function(C){var B=A.Node.getDOMNode(this);if(B){if("scrollLeft" in B){B.scrollLeft=C;}else{if(B.document||B.nodeType===9){A.DOM._getWin(B).scrollTo(C,A.DOM.docScrollY(B));}}}else{}}};A.Node.ATTRS.scrollTop={getter:function(){var B=A.Node.getDOMNode(this);return("scrollTop" in B)?B.scrollTop:A.DOM.docScrollY(B);},setter:function(C){var B=A.Node.getDOMNode(this);if(B){if("scrollTop" in B){B.scrollTop=C;}else{if(B.document||B.nodeType===9){A.DOM._getWin(B).scrollTo(A.DOM.docScrollX(B),C);}}}else{}}};A.Node.importMethod(A.DOM,["getXY","setXY","getX","setX","getY","setY"]);A.Node.ATTRS.region={getter:function(){var B=A.Node.getDOMNode(this);if(B&&!B.tagName){if(B.nodeType===9){B=B.documentElement;
}else{if(B.alert){B=B.document.documentElement;}}}return A.DOM.region(B);}};A.Node.ATTRS.viewportRegion={getter:function(){return A.DOM.viewportRegion(A.Node.getDOMNode(this));}};A.Node.importMethod(A.DOM,"inViewportRegion");A.Node.prototype.intersect=function(B,D){var C=A.Node.getDOMNode(this);if(B instanceof A.Node){B=A.Node.getDOMNode(B);}return A.DOM.intersect(C,B,D);};A.Node.prototype.inRegion=function(B,D,E){var C=A.Node.getDOMNode(this);if(B instanceof A.Node){B=A.Node.getDOMNode(B);}return A.DOM.inRegion(C,B,D,E);};},"3.0.0",{requires:["dom-screen"]});YUI.add("node-pluginhost",function(A){A.Node.plug=function(){var B=A.Array(arguments);B.unshift(A.Node);A.Plugin.Host.plug.apply(A.Base,B);return A.Node;};A.Node.unplug=function(){var B=A.Array(arguments);B.unshift(A.Node);A.Plugin.Host.unplug.apply(A.Base,B);return A.Node;};A.mix(A.Node,A.Plugin.Host,false,null,1);A.NodeList.prototype.plug=function(){var B=arguments;A.NodeList.each(this,function(C){A.Node.prototype.plug.apply(A.one(C),B);});};A.NodeList.prototype.unplug=function(){var B=arguments;A.NodeList.each(this,function(C){A.Node.prototype.unplug.apply(A.one(C),B);});};},"3.0.0",{requires:["node-base","pluginhost"]});YUI.add("node-event-delegate",function(A){A.Node.prototype.delegate=function(F,E,B){var D=Array.prototype.slice.call(arguments,3),C=[F,E,A.Node.getDOMNode(this),B];C=C.concat(D);return A.delegate.apply(A,C);};},"3.0.0",{requires:["node-base","event-delegate","pluginhost"]});YUI.add("node",function(A){},"3.0.0",{skinnable:false,use:["node-base","node-style","node-screen","node-pluginhost","node-event-delegate"],requires:["dom","event-base","event-delegate","pluginhost"]});


/*
Copyright (c) 2009, adMarketplace.com. All rights reserved.
 */

(function () {
    var p, k;

	// reduce to one or the other
	if (typeof AMP === 'undefined' || !AMP) {

		/**
		 * The AMP global namespace object. If AMP is already defined, the existing
		 * AMP object will not be overwritten so that defined namespaces are
		 * preserved.
		 * 
		 * @class AMP
		 * @constructor
		 * @global
		 * @param o  Optional configuration object. This object is stored in AMP.config.
		 */

		// global AMP
		// Make a function, disallow direct instantiation
		AMP = function(o) {
			var A = this;

			// Allow instantiation without the new operator
			if (!(A instanceof AMP)) {
				return new AMP(o);
			} else {
				// set up the core environment
				A.init(o);
				return A;
			}
		};
	}

	// The prototype contains functions that are required to allow the external
	// modules to be registered and for the instance to be initialized.
	AMP.prototype = {

		// Initialize this A instance
		// @param o is the config options
		init : function(o) {
			var A = this, v = '2.0';

			o = o || {};
			o.win = o.win || window || {};
			o.win = o.win.contentWindow || o.win;
			o.doc = o.win.document;
			o.debug = o.debug ? o.debug : false;
			o.throwfail = typeof o.throwfail !== 'undefined' ? o.throwfail
					: true;
			o.browserUrl = document.location && document.location.href ?  document.location.href : "";

			A.config = o;
			if (v.indexOf('@') > -1) {
				v = 'test';
			}

			A.version = v;
			A.constructor = AMP;
		},

		 
		// Register a module
		// @param name {string} module name
		// @param fn {Function} entry point into the module that is used to bind module to the AMP instance
		// @return {AMP} the AMP instance 
		add: function(name, fn) {
			try {
				if (typeof fn !== 'function') {
					throw {message:'Second parameter has to be a function!'};
				}	
				if (typeof name !== 'string' || name === '' ) {
					throw {message:'First parameter has to be a non empty string!'};
				}
				switch (name) {
				case 'flashWidget':
					AMP.prototype[name] = fn;
					break;
				case 'jsWidget':
					AMP.prototype[name] = fn;
					break;
				case 'actionMonitor':
					AMP.prototype[name] = fn;
					break;
				case 'userInfo':
					AMP.prototype[name] = fn.apply(AMP); // call userInfo function to get an object
					break;
				case 'iframe':
					AMP.prototype[name] = fn;
					break;
				}
				return this; // chain support
			 
			} catch(e) {
				this.error('.add:' + e.message);
			}
		 },
		
		 
		// attache functions to a module
		// @param mName {string}  module name
		// @param fName {string} function name
		// @param fn {function}
		// @return {AMP} the AMP instance
		attacheTo: function(mName, fName, fn) {
			 try {
				 if (typeof mName !== 'string' || mName === '') {
					 throw {message:'Module name has to be a non empty string!'};
				 }
				 if (typeof fName !== 'string' || fName === '') {
					 throw {message:'Function name has to be a non empty string!'};
				 }
				 if (typeof fn !== 'function') {
					 throw {message:'Last(3) parameter has to be a function!'};
				 }
				 AMP.prototype[mName].prototype[fName] = fn;
			 
				 //keep all the attached modules under the attached name
				 AMP.prototype[mName].attached = AMP.prototype[mName].prototype;
				 return this; // chain support
			} catch(e) {
				this.error('.attacheTo:' + e.message);
			}
		},

		
		// Set to use a module; Verifies that the module exist
		// @param name {string} module name
		// @param fn {Function}
		// @return {AMP} the AMP instance
		use : function() {
			var i;
			try {
				if (arguments.length < 2) {
					throw {message:'Not enought parameter!'};
				}
				for (i = 0; i < arguments.length - 1; i += 1) {
					if (this[arguments[i]] === undefined) {
						throw {message:'The assigned ' + arguments[i] + ' module name does not exists!'};
					}
				}

				if (typeof arguments[arguments.length - 1] !== 'function') {
					throw {message:'The last argument is not a function!'};
				}

				arguments[arguments.length - 1](this);
				return this; // chain support
			} catch(e) {
				this.error('.use:' + e.message);
			}
		},


		// Report an error. The reporting mechanism is controled by the 'throwfail'
		// configuration attribute. If throwfail is false, the message is
		// written to the Logger, otherwise a JS error is thrown
		// @param msg {string} the error message
		// @param e {Error} Optional JS error that was caught. If supplied and throwfail is specified, this error will be re-thrown.
		// @return {AMP} this AMP instance
		error : function(msg, e) {
			msg = msg ? 'AMP' + msg : msg; //add 'AMP:' to the error message
			if (this.config.throwfail) {
				throw (e || msg);
			} else {
				if (!this.config.url && !this.config.url.error) {
					this.config.throwfail = true;
					this.error('.error: Error log url missing!');
					return null;
				}
				
				this.config.throwfail = true;  // do not log multiple times one error
				if (e) { // if is an error object log the error message
					this.log(this.config.url.error, '&msg=' + e.message);
				} else {
					this.log(this.config.url.error, '&msg=' + msg);
				}
			}
			return this; // chain support
		},


		// Log a message.
		// @param logUrl {string} the log url
		// @param msg {string} the message; optional
		// @return {AMP} this AMP instance
		log : function(logUrl, paramList) {

			if (!logUrl) {
				this.error('AMP.log: Missing log url!');
				return null;
			}

			var img, that = this,

			// Checks if the page is https.
			isHttps = function() {
				return that.config.browserUrl.indexOf('https') === 0;
			};

			logUrl = this.addCacheBuster(logUrl, false); 
			
			if (paramList) {
				logUrl = logUrl + paramList;
			}
			
			// if the page url is https set log url to https
			logUrl = isHttps() ? 'https' + logUrl.substr(4) : logUrl;    
			img = new Image();
			img.onload = function() {
			};
			img.onerror = function() {
				// because we don't return am img this doesn't work
				//that.error('AMP.log: Log delivery error! (logUrl:' + logUrl + ')');
			};
			img.src = logUrl;

			return this;
		},


		// Add cachebuster to the url.
		// @param url {string}
		// @param encode {boolean}
		// @return {string} chachebusted url
		addCacheBuster : function(url, encode) {
			var aorq, cachebuster, d, t;
			try {
				if (url === undefined) {
					return url;
				}
				d = new Date();
				t = d.getTime();
				aorq = !encode && url.indexOf('?') === -1 ? '?' : '&';    //and or questionmark
				cachebuster = encode ? encodeURIComponent(aorq + 'cachebuster=' + t)
					: aorq + 'cachebuster=' + t;
				return url && url + cachebuster;
			} catch(e) {
				this.error('.addCacheBuster:' + e.message);
			}
		},


		// Create a length length random sring.
		// param length {integer}
		// @return {string} rand string
		randString : function(length) {
			var chars = "abcdefghijklmnopqrstuvwxyz1234567890", randstr = "", i, c;
			try {
				for (i = 0; i < length; i += 1) {
					c = Math.floor(Math.random() * 36);
					randstr += chars.charAt(c);
				}
				return randstr;
			} catch(e) {
				this.error('.randString:' + e.message);
			}
		},
				
		
		// Create a new object which prototype is o
		// @param object
		// @return {object}
		object : function(o) {
			function F() {};
            F.prototype = typeof o === 'object' && o ? o : Object.prototype;
            return new F();
		},
		
		
		// ampEncode (xor and double urlencode)
		// @param string
		// @param string
		// @return {string} encoded string
		encode : function(s, key) {
			var i, j, res = ''; 
			try {
				for(i = 0, j = 0; i < s.length; i++, j++) {
					if (j >= key.length ) {
						j = 0;
					}
					res += String.fromCharCode(key.charCodeAt(j)^s.charCodeAt(i));
				}
				return encodeURIComponent(encodeURIComponent(res)); 
			} catch(e) {
				this.error('.randString:' + e.message);
			}
		}
	};

	// Give the AMP global the same properties as an instance.
	p = AMP.prototype;

	// inheritance utilities are not available yet
	for (k in p) {
		if (true) {
			AMP[k] = p[k];
		}
	}

	// set up the environment
	AMP.init();

})();


(function() {
	var ua = navigator.userAgent.toLowerCase(), S = {
		version : "3.0rc1",
		adapter : null,
		cache : [],
		client : {
			isIE : ua.indexOf("msie") > -1,
			isIE6 : ua.indexOf("msie 6") > -1,
			isIE7 : ua.indexOf("msie 7") > -1,
			isGecko : ua.indexOf("gecko") > -1 && ua.indexOf("safari") == -1,
			isWebkit : ua.indexOf("applewebkit/") > -1,
			isWindows : ua.indexOf("windows") > -1 || ua.indexOf("win32") > -1,
			isMac : ua.indexOf("macintosh") > -1 || ua.indexOf("mac os x") > -1,
			isLinux : ua.indexOf("linux") > -1
		},
		content : null,
		current : -1,
		dimensions : null,
		gallery : [],
		expando : "shadowboxCacheKey",
		libraries : {
			Prototype : "prototype",
			jQuery : "jquery",
			MooTools : "mootools",
			YAHOO : "yui",
			dojo : "dojo",
			Ext : "ext"
		},
		options : {
			adapter : null,
			animate : true,
			animateFade : true,
			autoplayMovies : true,
			continuous : false,
			ease : function(x) {
				return 1 + Math.pow(x - 1, 3)
			},
			enableKeys : true,
			errors : {
				fla : {
					name : "Flash",
					url : "http://www.adobe.com/products/flashplayer/"
				},
				qt : {
					name : "QuickTime",
					url : "http://www.apple.com/quicktime/download/"
				},
				wmp : {
					name : "Windows Media Player",
					url : "http://www.microsoft.com/windows/windowsmedia/"
				},
				f4m : {
					name : "Flip4Mac",
					url : "http://www.flip4mac.com/wmv_download.htm"
				}
			},
			ext : {
				img : [ "png", "jpg", "jpeg", "gif", "bmp" ],
				swf : [ "swf" ],
				flv : [ "flv", "m4v" ],
				qt : [ "dv", "mov", "moov", "movie", "mp4" ],
				wmp : [ "asf", "wm", "wmv" ],
				qtwmp : [ "avi", "mpg", "mpeg" ]
			},
			flashParams : {
				bgcolor : "#000000",
				allowfullscreen : true
			},
			flashVars : {},
			flashVersion : "9.0.115",
			handleOversize : "resize",
			handleUnsupported : "link",
			language : "en",
			onChange : null,
			onClose : null,
			onFinish : null,
			onOpen : null,
			players : [ "img" ],
			showMovieControls : true,
			skipSetup : false,
			slideshowDelay : 0,
			useSizzle : true,
			viewportPadding : 20,
			troubleElements : [ "select", "object", "embed", "canvas" ]
		},
		path : "",
		plugins : null,
		ready : false,
		regex : {
			domain : /:\/\/(.*?)[:\/]/,
			inline : /#(.+)$/,
			rel : /^(light|shadow)box/i,
			gallery : /^(light|shadow)box\[(.*?)\]/i,
			unsupported : /^unsupported-(\w+)/,
			param : /\s*([a-z_]*?)\s*=\s*(.+)\s*/
		},
		applyOptions : function(opts) {
			if (opts) {
				default_options = apply( {}, S.options);
				apply(S.options, opts)
			}
		},
		revertOptions : function() {
			apply(S.options, default_options)
		},
		change : function(index) {
			if (!S.gallery) {
				return
			}
			if (!S.gallery[index]) {
				if (!S.options.continuous) {
					return
				} else {
					index = index < 0 ? S.gallery.length - 1 : 0
				}
			}
			S.current = index;
			if (typeof slide_timer == "number") {
				clearTimeout(slide_timer);
				slide_timer = null;
				slide_delay = slide_start = 0
			}
			if (S.options.onChange) {
				S.options.onChange()
			}
			loadContent()
		},
		close : function() {
			if (!active) {
				return
			}
			active = false;
			listenKeys(false);
			if (S.content) {
				S.content.remove();
				S.content = null
			}
			if (typeof slide_timer == "number") {
				clearTimeout(slide_timer)
			}
			slide_timer = null;
			slide_delay = 0;
			if (S.options.onClose) {
				S.options.onClose()
			}
			S.skin.onClose();
			S.revertOptions()
		},
		contentId : function() {
			return content_id
		},
		error : function(msg) {
			if (!S.debug) {
				return
			}
			if (typeof window.console != "undefined"
					&& typeof console.log == "function") {
				console.log(msg)
			} else {
				alert(msg)
			}
		},
		getCurrent : function() {
			return S.current > -1 ? S.gallery[S.current] : null
		},
		hasNext : function() {
			return S.gallery.length > 1
					&& (S.current != S.gallery.length - 1 || S.options.continuous)
		},
		init : function(opts) {
			if (initialized) {
				return
			}
			initialized = true;
			opts = opts || {};
			init_options = opts;
			if (opts) {
				apply(S.options, opts)
			}
			for ( var e in S.options.ext) {
				S.regex[e] = new RegExp(".(" + S.options.ext[e].join("|")
						+ ")s*$", "i")
			}
			if (!S.path) {
				var pathre = /(.+\/)shadowbox\.js/i, path;
				each(document.getElementsByTagName("script"), function(s) {
					path = pathre.exec(s.src);
					if (path) {
						S.path = path[1];
						return false
					}
				})
			}
			if (S.options.adapter) {
				S.adapter = S.options.adapter.toLowerCase()
			} else {
				for ( var lib in S.libraries) {
					if (typeof window[lib] != "undefined") {
						S.adapter = S.libraries[lib];
						break
					}
				}
				if (!S.adapter) {
					S.adapter = "base"
				}
			}
			if (S.options.useSizzle && !window.Sizzle) {
				if (window.jQuery) {
					window.Sizzle = jQuery.find
				} else {
					U.include(S.path + "libraries/sizzle/sizzle.js")
				}
			}
			if (!S.lang) {
				U.include(S.path + "languages/shadowbox-" + S.options.language
						+ ".js")
			}
			each(S.options.players, function(p) {
				if ((p == "swf" || p == "flv") && !window.swfobject) {
					U.include(S.path + "libraries/swfobject/swfobject.js")
				}
				if (!S[p]) {
					U.include(S.path + "players/shadowbox-" + p + ".js")
				}
			});
			if (!S.lib) {
				U.include(S.path + "adapters/shadowbox-" + S.adapter + ".js")
			}
			waitDom(waitLibs)
		},
		isActive : function() {
			return active
		},
		isPaused : function() {
			return slide_timer == "paused"
		},
		load : function() {
			if (S.ready) {
				return
			}
			S.ready = true;
			if (S.skin.options) {
				apply(S.options, S.skin.options);
				apply(S.options, init_options)
			}
			S.skin.init();
			if (!S.options.skipSetup) {
				S.setup()
			}
		},
		next : function() {
			S.change(S.current + 1)
		},
		open : function(obj) {
			if (U.isLink(obj)) {
				if (S.inCache(obj)) {
					obj = S.cache[obj[S.expando]]
				} else {
					obj = S.buildCacheObj(obj)
				}
			}
			if (obj.constructor == Array) {
				S.gallery = obj;
				S.current = 0
			} else {
				if (!obj.gallery) {
					S.gallery = [ obj ];
					S.current = 0
				} else {
					S.current = null;
					S.gallery = [];
					each(S.cache, function(c) {
						if (c.gallery && c.gallery == obj.gallery) {
							if (S.current == null && c.content == obj.content
									&& c.title == obj.title) {
								S.current = S.gallery.length
							}
							S.gallery.push(c)
						}
					});
					if (S.current == null) {
						S.gallery.unshift(obj);
						S.current = 0
					}
				}
			}
			obj = S.getCurrent();
			if (obj.options) {
				S.revertOptions();
				S.applyOptions(obj.options)
			}
			var item, remove, m, format, replace, oe = S.options.errors, msg, el;
			for ( var i = 0; i < S.gallery.length; ++i) {
				item = S.gallery[i] = apply( {}, S.gallery[i]);
				remove = false;
				if (m = S.regex.unsupported.exec(item.player)) {
					if (S.options.handleUnsupported == "link") {
						item.player = "html";
						switch (m[1]) {
						case "qtwmp":
							format = "either";
							replace = [ oe.qt.url, oe.qt.name, oe.wmp.url,
									oe.wmp.name ];
							break;
						case "qtf4m":
							format = "shared";
							replace = [ oe.qt.url, oe.qt.name, oe.f4m.url,
									oe.f4m.name ];
							break;
						default:
							format = "single";
							if (m[1] == "swf" || m[1] == "flv") {
								m[1] = "fla"
							}
							replace = [ oe[m[1]].url, oe[m[1]].name ]
						}
						msg = S.lang.errors[format].replace(/\{(\d+)\}/g,
								function(m, n) {
									return replace[n]
								});
						item.content = '<div class="amp_sb-message">' + msg
								+ "</div>"
					} else {
						remove = true
					}
				} else {
					if (item.player == "inline") {
						m = S.regex.inline.exec(item.content);
						if (m) {
							var el = U.get(m[1]);
							if (el) {
								item.content = el.innerHTML
							} else {
								S.error("Cannot find element with id " + m[1])
							}
						} else {
							S
									.error("Cannot find element id for inline content")
						}
					} else {
						if (item.player == "swf" || item.player == "flv") {
							var version = (item.options && item.options.flashVersion)
									|| S.options.flashVersion;
							if (!swfobject.hasFlashPlayerVersion(version)) {
								item.width = 310;
								item.height = 177
							}
						}
					}
				}
				if (remove) {
					S.gallery.splice(i, 1);
					if (i < S.current) {
						--S.current
					} else {
						if (i == S.current) {
							S.current = i > 0 ? i - 1 : i
						}
					}
					--i
				}
			}
			if (S.gallery.length) {
				if (!active) {
					if (typeof S.options.onOpen == "function"
							&& S.options.onOpen(obj) === false) {
						return
					}
					S.skin.onOpen(obj, loadContent)
				} else {
					loadContent()
				}
				active = true
			}
		},
		pause : function() {
			if (typeof slide_timer != "number") {
				return
			}
			var time = new Date().getTime();
			slide_delay = Math.max(0, slide_delay - (time - slide_start));
			if (slide_delay) {
				clearTimeout(slide_timer);
				slide_timer = "paused";
				if (S.skin.onPause) {
					S.skin.onPause()
				}
			}
		},
		play : function() {
			if (!S.hasNext()) {
				return
			}
			if (!slide_delay) {
				slide_delay = S.options.slideshowDelay * 1000
			}
			if (slide_delay) {
				slide_start = new Date().getTime();
				slide_timer = setTimeout(function() {
					slide_delay = slide_start = 0;
					S.next()
				}, slide_delay);
				if (S.skin.onPlay) {
					S.skin.onPlay()
				}
			}
		},
		previous : function() {
			S.change(S.current - 1)
		},
		setDimensions : function(height, width, max_h, max_w, tb, lr, resizable) {
			var h = height = parseInt(height), w = width = parseInt(width), pad = parseInt(S.options.viewportPadding) || 0;
			var extra_h = 2 * pad + tb;
			if (h + extra_h >= max_h) {
				h = max_h - extra_h
			}
			var extra_w = 2 * pad + lr;
			if (w + extra_w >= max_w) {
				w = max_w - extra_w
			}
			var resize_h = height, resize_w = width, change_h = (height - h)
					/ height, change_w = (width - w) / width, oversized = (change_h > 0 || change_w > 0);
			if (resizable && oversized && S.options.handleOversize == "resize") {
				if (change_h > change_w) {
					w = Math.round((width / height) * h)
				} else {
					if (change_w > change_h) {
						h = Math.round((height / width) * w)
					}
				}
				resize_w = w;
				resize_h = h
			}
			S.dimensions = {
				height : h + tb,
				width : w + lr,
				inner_h : h,
				inner_w : w,
				top : (max_h - (h + extra_h)) / 2 + pad,
				left : (max_w - (w + extra_w)) / 2 + pad,
				oversized : oversized,
				resize_h : resize_h,
				resize_w : resize_w
			}
		},
		setup : function(links, opts) {
			each(S.findLinks(links), function(link) {
				S.addCache(link, opts)
			})
		},
		teardown : function(links) {
			each(S.findLinks(links), S.removeCache)
		},
		findLinks : function(links) {
			if (!links) {
				var links = [], rel;
				each(document.getElementsByTagName("a"), function(a) {
					rel = a.getAttribute("rel");
					if (rel && S.regex.rel.test(rel)) {
						links.push(a)
					}
				})
			} else {
				var len = links.length;
				if (len) {
					if (window.Sizzle) {
						if (typeof links == "string") {
							links = Sizzle(links)
						} else {
							if (len == 2 && links.push
									&& typeof links[0] == "string"
									&& links[1].nodeType) {
								links = Sizzle(links[0], links[1])
							}
						}
					}
				} else {
					links = [ links ]
				}
			}
			return links
		},
		inCache : function(link) {
			return typeof link[S.expando] == "number"
					&& S.cache[link[S.expando]]
		},
		addCache : function(link, opts) {
			if (!S.inCache(link)) {
				link[S.expando] = S.cache.length;
				S.lib.addEvent(link, "click", handleClick)
			}
			S.cache[link[S.expando]] = S.buildCacheObj(link, opts)
		},
		removeCache : function(link) {
			S.lib.removeEvent(link, "click", handleClick);
			S.cache[link[S.expando]] = null;
			delete link[S.expando]
		},
		clearCache : function() {
			each(S.cache, function(obj) {
				S.removeCache(obj.link)
			});
			S.cache = []
		},
		buildCacheObj : function(link, opts) {
			var obj = {
				link : link,
				title : link.getAttribute("title"),
				options : apply( {}, opts || {}),
				content : link.href
			};
			if (opts) {
				each( [ "player", "title", "height", "width", "gallery" ],
						function(option) {
							if (typeof obj.options[option] != "undefined") {
								obj[option] = obj.options[option];
								delete obj.options[option]
							}
						})
			}
			if (!obj.player) {
				obj.player = S.getPlayer(obj.content)
			}
			var rel = link.getAttribute("rel");
			if (rel) {
				var match = rel.match(S.regex.gallery);
				if (match) {
					obj.gallery = escape(match[2])
				}
				each(rel.split(";"), function(parameter) {
					match = parameter.match(S.regex.param);
					if (match) {
						if (match[1] == "options") {
							eval("apply(obj.options," + match[2] + ")")
						} else {
							obj[match[1]] = match[2]
						}
					}
				})
			}
			return obj
		},
		getPlayer : function(content) {
			var r = S.regex, p = S.plugins, m = content.match(r.domain), same_domain = m
					&& document.domain == m[1];
			if (content.indexOf("#") > -1 && same_domain) {
				return "inline"
			}
			var q = content.indexOf("?");
			if (q > -1) {
				content = content.substring(0, q)
			}
			if (r.img.test(content)) {
				return "img"
			}
			if (r.swf.test(content)) {
				return p.fla ? "swf" : "unsupported-swf"
			}
			if (r.flv.test(content)) {
				return p.fla ? "flv" : "unsupported-flv"
			}
			if (r.qt.test(content)) {
				return p.qt ? "qt" : "unsupported-qt"
			}
			if (r.wmp.test(content)) {
				if (p.wmp) {
					return "wmp"
				}
				if (p.f4m) {
					return "qt"
				}
				if (S.client.isMac) {
					return p.qt ? "unsupported-f4m" : "unsupported-qtf4m"
				}
				return "unsupported-wmp"
			}
			if (r.qtwmp.test(content)) {
				if (p.qt) {
					return "qt"
				}
				if (p.wmp) {
					return "wmp"
				}
				return S.client.isMac ? "unsupported-qt" : "unsupported-qtwmp"
			}
			return "iframe"
		}
	}, U = S.util = {
		animate : function(el, p, to, d, cb) {
			var from = parseFloat(S.lib.getStyle(el, p));
			if (isNaN(from)) {
				from = 0
			}
			var delta = to - from;
			if (delta == 0) {
				if (cb) {
					cb()
				}
				return
			}
			var op = p == "opacity";
			function fn(ease) {
				var to = from + ease * delta;
				if (op) {
					U.setOpacity(el, to)
				} else {
					el.style[p] = to + "px"
				}
			}
			if (!d || (!op && !S.options.animate)
					|| (op && !S.options.animateFade)) {
				fn(1);
				if (cb) {
					cb()
				}
				return
			}
			d *= 1000;
			var begin = new Date().getTime(), ease = S.options.ease, end = begin
					+ d, time, timer = setInterval(function() {
				time = new Date().getTime();
				if (time >= end) {
					clearInterval(timer);
					fn(1);
					if (cb) {
						cb()
					}
				} else {
					fn(ease((time - begin) / d))
				}
			}, 10)
		},
		apply : function(o, e) {
			for ( var p in e) {
				o[p] = e[p]
			}
			return o
		},
		clearOpacity : function(el) {
			var s = el.style;
			if (window.ActiveXObject) {
				if (typeof s.filter == "string" && (/alpha/i).test(s.filter)) {
					s.filter = s.filter.replace(/[\w\.]*alpha\(.*?\);?/i, "")
				}
			} else {
				s.opacity = ""
			}
		},
		each : function(obj, fn, scope) {
			for ( var i = 0, len = obj.length; i < len; ++i) {
				if (fn.call(scope || obj[i], obj[i], i, obj) === false) {
					return
				}
			}
		},
		get : function(id) {
			return document.getElementById(id)
		},
		include : function() {
			var includes = {};
			return function(file) {
				if (includes[file]) {
					return
				}
				includes[file] = true;
				var head = document.getElementsByTagName("head")[0], script = document
						.createElement("script");
				script.src = file;
				head.appendChild(script)
			}
		}(),
		isLink : function(obj) {
			if (!obj || !obj.tagName) {
				return false
			}
			var up = obj.tagName.toUpperCase();
			return up == "A" || up == "AREA"
		},
		removeChildren : function(el) {
			while (el.firstChild) {
				el.removeChild(el.firstChild)
			}
		},
		setOpacity : function(el, o) {
			var s = el.style;
			if (window.ActiveXObject) {
				s.zoom = 1;
				s.filter = (s.filter || "").replace(/\s*alpha\([^\)]*\)/gi, "")
						+ (o == 1 ? "" : " alpha(opacity=" + (o * 100) + ")")
			} else {
				s.opacity = o
			}
		}
	}, apply = U.apply, each = U.each, init_options, initialized = false, default_options = {}, content_id = "amp_sb-content", active = false, slide_timer, slide_start, slide_delay = 0;
	if (navigator.plugins && navigator.plugins.length) {
		var names = [];
		each(navigator.plugins, function(p) {
			names.push(p.name)
		});
		names = names.join();
		var f4m = names.indexOf("Flip4Mac") > -1;
		S.plugins = {
			fla : names.indexOf("Shockwave Flash") > -1,
			qt : names.indexOf("QuickTime") > -1,
			wmp : !f4m && names.indexOf("Windows Media") > -1,
			f4m : f4m
		}
	} else {
		function detectPlugin(n) {
			try {
				var axo = new ActiveXObject(n)
			} catch (e) {
			}
			return !!axo
		}
		S.plugins = {
			fla : detectPlugin("ShockwaveFlash.ShockwaveFlash"),
			qt : detectPlugin("QuickTime.QuickTime"),
			wmp : detectPlugin("wmplayer.ocx"),
			f4m : false
		}
	}
	function waitDom(cb) {
		if (document.addEventListener) {
			document.addEventListener("DOMContentLoaded", function() {
				document.removeEventListener("DOMContentLoaded",
						arguments.callee, false);
				cb()
			}, false)
		} else {
			if (document.attachEvent) {
				document.attachEvent("onreadystatechange", function() {
					if (document.readyState === "complete") {
						document.detachEvent("onreadystatechange",
								arguments.callee);
						cb()
					}
				});
				if (document.documentElement.doScroll && window == window.top) {
					(function() {
						if (S.ready) {
							return
						}
						try {
							document.documentElement.doScroll("left")
						} catch (error) {
							setTimeout(arguments.callee, 0);
							return
						}
						cb()
					})()
				}
			}
		}
		if (typeof window.onload == "function") {
			var oldonload = window.onload;
			window.onload = function() {
				oldonload();
				cb()
			}
		} else {
			window.onload = cb
		}
	}
	function waitLibs() {
		if (S.lib && S.lang) {
			S.load()
		} else {
			setTimeout(waitLibs, 0)
		}
	}
	function handleClick(e) {
		var link;
		if (U.isLink(this)) {
			link = this
		} else {
			link = S.lib.getTarget(e);
			while (!U.isLink(link) && link.parentNode) {
				link = link.parentNode
			}
		}
		S.lib.preventDefault(e);
		if (link) {
			S.open(link);
			if (S.gallery.length) {
				S.lib.preventDefault(e)
			}
		}
	}
	function listenKeys(on) {
		if (!S.options.enableKeys) {
			return
		}
		S.lib[(on ? "add" : "remove") + "Event"]
				(document, "keydown", handleKey)
	}
	function handleKey(e) {
		var code = S.lib.keyCode(e), handler;
		switch (code) {
		case 81:
		case 88:
		case 27:
			handler = S.close;
			break;
		case 37:
			handler = S.previous;
			break;
		case 39:
			handler = S.next;
			break;
		case 32:
			handler = typeof slide_timer == "number" ? S.pause : S.play
		}
		if (handler) {
			S.lib.preventDefault(e);
			handler()
		}
	}
	function loadContent() {
		var obj = S.getCurrent();
		if (!obj) {
			return
		}
		var p = obj.player == "inline" ? "html" : obj.player;
		if (typeof S[p] != "function") {
			S.error("Unknown player: " + p)
		}
		var change = false;
		if (S.content) {
			S.content.remove();
			change = true;
			S.revertOptions();
			if (obj.options) {
				S.applyOptions(obj.options)
			}
		}
		U.removeChildren(S.skin.bodyEl());
		S.content = new S[p](obj);
		listenKeys(false);
		S.skin.onLoad(S.content, change, function() {
			if (!S.content) {
				return
			}
			if (typeof S.content.ready != "undefined") {
				var id = setInterval(function() {
					if (S.content) {
						if (S.content.ready) {
							clearInterval(id);
							id = null;
							S.skin.onReady(contentReady)
						}
					} else {
						clearInterval(id);
						id = null
					}
				}, 100)
			} else {
				S.skin.onReady(contentReady)
			}
		});
		if (S.gallery.length > 1) {
			var next = S.gallery[S.current + 1] || S.gallery[0];
			if (next.player == "img") {
				var a = new Image();
				a.src = next.content
			}
			var prev = S.gallery[S.current - 1]
					|| S.gallery[S.gallery.length - 1];
			if (prev.player == "img") {
				var b = new Image();
				b.src = prev.content
			}
		}
	}
	function contentReady() {
		if (!S.content) {
			return
		}
		S.content.append(S.skin.bodyEl(), content_id, S.dimensions);
		S.skin.onFinish(finishContent)
	}
	function finishContent() {
		if (!S.content) {
			return
		}
		if (S.content.onLoad) {
			S.content.onLoad()
		}
		if (S.options.onFinish) {
			S.options.onFinish()
		}
		if (!S.isPaused()) {
			S.play()
		}
		listenKeys(true)
	}
	AMP.Shadowbox = S;
})();
(function() {
	var g = AMP.Shadowbox, f = g.util, q = false, b = [], m = [ "amp_sb-nav-close",
			"amp_sb-nav-next", "amp_sb-nav-play", "amp_sb-nav-pause", "amp_sb-nav-previous" ], o = {
		markup : '<div id="amp_sb-container"><div id="amp_sb-overlay"></div><div id="amp_sb-wrapper"><div id="amp_sb-title"><div id="amp_sb-title-inner"></div></div><div id="amp_sb-body"><div id="amp_sb-body-inner"></div><div id="amp_sb-loading"><a onclick="AMP.Shadowbox.close()">{cancel}</a></div></div><div id="amp_sb-info"><div id="amp_sb-info-inner"><div id="amp_sb-counter"></div><div id="amp_sb-nav"><a id="amp_sb-nav-close" title="{close}" onclick="AMP.Shadowbox.close()"></a><a id="amp_sb-nav-next" title="{next}" onclick="AMP.Shadowbox.next()"></a><a id="amp_sb-nav-play" title="{play}" onclick="AMP.Shadowbox.play()"></a><a id="amp_sb-nav-pause" title="{pause}" onclick="AMP.Shadowbox.pause()"></a><a id="amp_sb-nav-previous" title="{previous}" onclick="AMP.Shadowbox.previous()"></a></div><div style="clear:both"></div></div></div></div></div>',

		options : {
			animSequence : "sync",
			autoDimensions : false,
			counterLimit : 10,
			counterType : "default",
			displayCounter : true,
			displayNav : true,
			fadeDuration : 0.35,
			initialHeight : 160,
			initialWidth : 320,
			modal : false,
			overlayColor : "#000",
			overlayOpacity : 0.8,
			resizeDuration : 0.35,
			showOverlay : true,
			troubleElements : [ "select", "object", "embed", "canvas" ]
		},
		init : function() {
			var s = o.markup.replace(/\{(\w+)\}/g, function(w, x) {
				return g.lang[x]
			});
			g.lib.append(document.body, s);
			if (g.client.isIE6) {
				f.get("amp_sb-body").style.zoom = 1;
				var u, r, t = /url\("(.*\.png)"\)/;
				f
						.each(
								m,
								function(w) {
									u = f.get(w);
									if (u) {
										r = g.lib
												.getStyle(u, "backgroundImage")
												.match(t);
										if (r) {
											u.style.backgroundImage = "none";
											u.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="
													+ r[1]
													+ ",sizingMethod=scale);"
										}
									}
								})
			}
			var v;
			g.lib.addEvent(window, "resize", function() {
				if (v) {
					clearTimeout(v);
					v = null
				}
				if (g.isActive()) {
					v = setTimeout(function() {
						o.onWindowResize();
						var w = g.content;
						if (w && w.onWindowResize) {
							w.onWindowResize()
						}
					}, 50)
				}
			})
		},
		bodyEl : function() {
			return f.get("amp_sb-body-inner")
		},
		onOpen : function(u, r) {
			e(false);
			var t = g.options.autoDimensions && "height" in u ? u.height
					: g.options.initialHeight, s = g.options.autoDimensions
					&& "width" in u ? u.width : g.options.initialWidth;
			f.get("amp_sb-container").style.display = "block";
			var v = p(t, s);
			d(v.inner_h, v.top, false);
			h(v.width, v.left, false);
			i(r)
		},
		onLoad : function(s, t, r) {
			k(true);
			j(t, function() {
				if (!s) {
					return
				}
				if (!t) {
					f.get("amp_sb-wrapper").style.display = ""
				}
				r()
			})
		},
		onReady : function(r) {
			var t = g.content;
			if (!t) {
				return
			}
			var s = p(t.height, t.width, t.resizable);
			o.resizeContent(s.inner_h, s.width, s.top, s.left, true,
					function() {
						l(r)
					})
		},
		onFinish : function(r) {
			k(false, r)
		},
		onClose : function() {
			i();
			e(true)
		},
		onPlay : function() {
			c("play", false);
			c("pause", true)
		},
		onPause : function() {
			c("pause", false);
			c("play", true)
		},
		onWindowResize : function() {
			var t = g.content;
			if (!t) {
				return
			}
			var s = p(t.height, t.width, t.resizable);
			h(s.width, s.left, false);
			d(s.inner_h, s.top, false);
			var r = f.get(g.contentId());
			if (r) {
				if (t.resizable && g.options.handleOversize == "resize") {
					r.height = s.resize_h;
					r.width = s.resize_w
				}
			}
		},
		resizeContent : function(s, t, w, v, u, r) {
			var y = g.content;
			if (!y) {
				return
			}
			var x = p(y.height, y.width, y.resizable);
			switch (g.options.animSequence) {
			case "hw":
				d(x.inner_h, x.top, u, function() {
					h(x.width, x.left, u, r)
				});
				break;
			case "wh":
				h(x.width, x.left, u, function() {
					d(x.inner_h, x.top, u, r)
				});
				break;
			default:
				h(x.width, x.left, u);
				d(x.inner_h, x.top, u, r)
			}
		}
	};
	function n() {
		f.get("amp_sb-container").style.top = document.documentElement.scrollTop
				+ "px"
	}
	function e(r) {
		if (r) {
			f.each(b, function(s) {
				s[0].style.visibility = s[1] || ""
			})
		} else {
			b = [];
			f.each(g.options.troubleElements, function(s) {
				f.each(document.getElementsByTagName(s), function(t) {
					b.push( [ t, t.style.visibility ]);
					t.style.visibility = "hidden"
				})
			})
		}
	}
	function i(r) {
		var s = f.get("amp_sb-overlay"), t = f.get("amp_sb-container"), v = f
				.get("amp_sb-wrapper");
		if (r) {
			if (g.client.isIE6) {
				n();
				g.lib.addEvent(window, "scroll", n)
			}
			if (g.options.showOverlay) {
				q = true;
				s.style.backgroundColor = g.options.overlayColor;
				f.setOpacity(s, 0);
				if (!g.options.modal) {
					g.lib.addEvent(s, "click", g.close)
				}
				v.style.display = "none"
			}
			t.style.visibility = "visible";
			if (q) {
				var u = parseFloat(g.options.overlayOpacity);
				f.animate(s, "opacity", u, g.options.fadeDuration, r)
			} else {
				r()
			}
		} else {
			if (g.client.isIE6) {
				g.lib.removeEvent(window, "scroll", n)
			}
			g.lib.removeEvent(s, "click", g.close);
			if (q) {
				v.style.display = "none";
				f.animate(s, "opacity", 0, g.options.fadeDuration, function() {
					t.style.display = "";
					v.style.display = "";
					f.clearOpacity(s)
				})
			} else {
				t.style.visibility = "hidden"
			}
		}
	}
	function c(t, r) {
		var s = f.get("amp_sb-nav-" + t);
		if (s) {
			s.style.display = r ? "" : "none"
		}
	}
	function k(s, r) {
		var u = f.get("amp_sb-loading"), w = g.getCurrent().player, v = (w == "img" || w == "html");
		if (s) {
			function t() {
				f.clearOpacity(u);
				if (r) {
					r()
				}
			}
			f.setOpacity(u, 0);
			u.style.display = "";
			if (v) {
				f.animate(u, "opacity", 1, g.options.fadeDuration, t)
			} else {
				t()
			}
		} else {
			function t() {
				u.style.display = "none";
				f.clearOpacity(u);
				if (r) {
					r()
				}
			}
			if (v) {
				f.animate(u, "opacity", 0, g.options.fadeDuration, t)
			} else {
				t()
			}
		}
	}
	function a(u) {
		var z = g.getCurrent();
		f.get("amp_sb-title-inner").innerHTML = z.title || "";
		var C, t, x, D, s;
		if (g.options.displayNav) {
			C = true;
			var B = g.gallery.length;
			if (B > 1) {
				if (g.options.continuous) {
					t = s = true
				} else {
					t = (B - 1) > g.current;
					s = g.current > 0
				}
			}
			if (g.options.slideshowDelay > 0 && g.hasNext()) {
				D = !g.isPaused();
				x = !D
			}
		} else {
			C = t = x = D = s = false
		}
		c("close", C);
		c("next", t);
		c("play", x);
		c("pause", D);
		c("previous", s);
		var r = "";
		if (g.options.displayCounter && g.gallery.length > 1) {
			var B = g.gallery.length;
			if (g.options.counterType == "skip") {
				var y = 0, w = B, v = parseInt(g.options.counterLimit) || 0;
				if (v < B && v > 2) {
					var A = Math.floor(v / 2);
					y = g.current - A;
					if (y < 0) {
						y += B
					}
					w = g.current + (v - A);
					if (w > B) {
						w -= B
					}
				}
				while (y != w) {
					if (y == B) {
						y = 0
					}
					r += '<a onclick="AMP.Shadowbox.change(' + y + ');"';
					if (y == g.current) {
						r += ' class="amp_sb-counter-current"'
					}
					r += ">" + (y++) + "</a>"
				}
			} else {
				var r = (g.current + 1) + " " + g.lang.of + " " + B
			}
		}
		f.get("amp_sb-counter").innerHTML = r;
		u()
	}
	function j(u, s) {
		var y = f.get("amp_sb-wrapper"), B = f.get("amp_sb-title"), v = f
				.get("amp_sb-info"), r = f.get("amp_sb-title-inner"), z = f
				.get("amp_sb-info-inner"), A = parseInt(g.lib.getStyle(r, "height")) || 0, x = parseInt(g.lib
				.getStyle(z, "height")) || 0;
		var w = function() {
			r.style.visibility = z.style.visibility = "hidden";
			a(s)
		};
		if (u) {
			f.animate(B, "height", 0, 0.35);
			f.animate(v, "height", 0, 0.35);
			f.animate(y, "paddingTop", A, 0.35);
			f.animate(y, "paddingBottom", x, 0.35, w)
		} else {
			B.style.height = v.style.height = "0px";
			y.style.paddingTop = A + "px";
			y.style.paddingBottom = x + "px";
			w()
		}
	}
	function l(u) {
		var s = f.get("amp_sb-wrapper"), w = f.get("amp_sb-title"), v = f
				.get("amp_sb-info"), z = f.get("amp_sb-title-inner"), y = f
				.get("amp_sb-info-inner"), x = parseInt(g.lib.getStyle(z, "height")) || 0, r = parseInt(g.lib
				.getStyle(y, "height")) || 0;
		z.style.visibility = y.style.visibility = "";
		if (z.innerHTML != "") {
			f.animate(w, "height", x, 0.35);
			f.animate(s, "paddingTop", 0, 0.35)
		}
		f.animate(v, "height", r, 0.35);
		f.animate(s, "paddingBottom", 0, 0.35, u)
	}
	function d(u, z, y, r) {
		var A = f.get("amp_sb-body"), x = f.get("amp_sb-wrapper"), w = parseInt(u), v = parseInt(z);
		if (y) {
			f.animate(A, "height", w, g.options.resizeDuration);
			f.animate(x, "top", v, g.options.resizeDuration, r)
		} else {
			A.style.height = w + "px";
			x.style.top = v + "px";
			if (r) {
				r()
			}
		}
	}
	function h(x, z, y, r) {
		var v = f.get("amp_sb-wrapper"), u = parseInt(x), t = parseInt(z);
		if (y) {
			f.animate(v, "width", u, g.options.resizeDuration);
			f.animate(v, "left", t, g.options.resizeDuration, r)
		} else {
			v.style.width = u + "px";
			v.style.left = t + "px";
			if (r) {
				r()
			}
		}
	}
	function p(r, u, t) {
		var s = f.get("amp_sb-body-inner"),
		sw = f.get("amp_sb-wrapper"), so = f.get("amp_sb-overlay"),
				tb = sw.offsetHeight - s.offsetHeight, lr = sw.offsetWidth
						- s.offsetWidth, max_h = so.offsetHeight,
				max_w = so.offsetWidth;
		g.setDimensions(r, u, max_h, max_w, tb, lr, t);
		return g.dimensions
	}
	g.skin = o
})();

if (typeof AMP.Shadowbox == "undefined") {
	throw "Unable to load AMP.Shadowbox adapter, AMP.Shadowbox not found"
}
(function(d) {
	var a = document.defaultView, c;
	if (d.client.isIE6) {
		c = [];
		function b() {
			var h;
			for ( var g = 0, f = c.length; g < f; ++g) {
				h = c[g];
				h[0].detachEvent("on" + h[1], h[2])
			}
			window.detachEvent("onunload", b)
		}
		window.attachEvent("onunload", b)
	}
	d.lib = {
		getStyle : a && a.getComputedStyle ? function(h, g) {
			var e, f;
			if (g == "float") {
				g = "cssFloat"
			}
			if (e = h.style[g]) {
				return e
			}
			if (f = a.getComputedStyle(h, "")) {
				return f[g]
			}
			return null
		} : function(i, h) {
			var f, g;
			if (h == "opacity") {
				if (typeof i.style.filter == "string") {
					var e = i.style.filter.match(/alpha\(opacity=(.+)\)/i);
					if (e) {
						var j = parseFloat(e[1]);
						if (!isNaN(j)) {
							return (j ? j / 100 : 0)
						}
					}
				}
				return 1
			}
			if (h == "float") {
				h = "styleFloat"
			}
			if (f = i.style[h]) {
				return f
			}
			if (g = i.currentStyle) {
				return g[h]
			}
			return null
		},
		remove : function(e) {
			e.parentNode.removeChild(e)
		},
		getTarget : function(g) {
			var f = g.target ? g.target : g.srcElement;
			return f.nodeType == 3 ? f.parentNode : f
		},
		getPageXY : function(g) {
			var f = g.pageX
					|| (g.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft));
			var h = g.pageY
					|| (g.clientY + (document.documentElement.scrollTop || document.body.scrollTop));
			return [ f, h ]
		},
		preventDefault : function(f) {
			if (f.preventDefault) {
				f.preventDefault()
			} else {
				f.returnValue = false
			}
		},
		keyCode : function(f) {
			return f.which ? f.which : f.keyCode
		},
		addEvent : function(g, e, f) {
			if (c) {
				c[c.length] = arguments
			}
			if (g.addEventListener) {
				g.addEventListener(e, f, false)
			} else {
				if (g.attachEvent) {
					g.attachEvent("on" + e, f)
				}
			}
		},
		removeEvent : function(g, e, f) {
			if (g.removeEventListener) {
				g.removeEventListener(e, f, false)
			} else {
				if (g.detachEvent) {
					g.detachEvent("on" + e, f)
				}
			}
		},
		append : function(g, f) {
			if (g.insertAdjacentHTML) {
				g.insertAdjacentHTML("BeforeEnd", f)
			} else {
				if (g.lastChild) {
					var e = g.ownerDocument.createRange();
					e.setStartAfter(g.lastChild);
					var h = e.createContextualFragment(f);
					g.appendChild(h)
				} else {
					g.innerHTML = f
				}
			}
		}
	}
})(AMP.Shadowbox);
if (typeof AMP.Shadowbox == "undefined") {
	throw "Unable to load AMP.Shadowbox language file, AMP.Shadowbox not found."
}
AMP.Shadowbox.lang = {
	code : "en",
	of : "of",
	loading : "loading",
	cancel : "",
	next : "Next",
	previous : "Previous",
	play : "Play",
	pause : "Pause",
	close : "Close",
	errors : {
		single : 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',
		shared : 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',
		either : 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'
	}
};
(function(b) {
	var a = b.util, c = 20;
	b.flv = function(d) {
		this.obj = d;
		this.resizable = true;
		this.height = d.height ? parseInt(d.height, 10) : 300;
		if (b.options.showMovieControls == true) {
			this.height += c
		}
		this.width = d.width ? parseInt(d.width, 10) : 300
	};
	b.flv.prototype = {
		append : function(l, e, n) {
			this.id = e;
			var j = document.createElement("div");
			j.id = e;
			l.appendChild(j);
			var k = n.resize_h, o = n.resize_w, f = b.path
					+ "libraries/mediaplayer/player.swf", m = b.options.flashVersion, d = b.path
					+ "libraries/swfobject/expressInstall.swf", g = a.apply( {
				file : this.obj.content,
				height : k,
				width : o,
				autostart : (b.options.autoplayMovies ? "true" : "false"),
				controlbar : (b.options.showMovieControls ? "bottom" : "none"),
				backcolor : "0x000000",
				frontcolor : "0xCCCCCC",
				lightcolor : "0x557722"
			}, b.options.flashVars), i = b.options.flashParams;
			swfobject.embedSWF(f, e, o, k, m, d, g, i)
		},
		remove : function() {
			swfobject.expressInstallCallback();
			swfobject.removeSWF(this.id)
		}
	}
})(AMP.Shadowbox);
(function(a) {
	a.html = function(b) {
		this.obj = b;
		this.height = b.height ? parseInt(b.height, 10) : 300;
		this.width = b.width ? parseInt(b.width, 10) : 500
	};
	a.html.prototype = {
		append : function(b, e, c) {
			this.id = e;
			var d = document.createElement("div");
			d.id = e;
			d.className = "html";
			d.innerHTML = this.obj.content;
			b.appendChild(d)
		},
		remove : function() {
			var b = document.getElementById(this.id);
			if (b) {
				a.lib.remove(b)
			}
		}
	}
})(AMP.Shadowbox);
(function(a) {
	a.iframe = function(c) {
		this.obj = c;
		var b = document.getElementById("amp_sb-overlay");
		this.height = c.height ? parseInt(c.height, 10) : b.offsetHeight;
		this.width = c.width ? parseInt(c.width, 10) : b.offsetWidth
	};
	a.iframe.prototype = {
		append : function(b, e, d) {
			this.id = e;
			var c = '<iframe id="'
					+ e
					+ '" name="'
					+ e
					+ '" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"';
			if (a.client.isIE) {
				c += ' allowtransparency="true"';
				if (a.client.isIE6) {
					c += " src=\"javascript:false;document.write('');\""
				}
			}
			c += "></iframe>";
			b.innerHTML = c
		},
		remove : function() {
			var b = document.getElementById(this.id);
			if (b) {
				a.lib.remove(b);
				if (a.client.isGecko) {
					delete window.frames[this.id]
				}
			}
		},
		onLoad : function() {
			var b = a.client.isIE ? document.getElementById(this.id).contentWindow
					: window.frames[this.id];
			b.location.href = this.obj.content
		}
	}
})(AMP.Shadowbox);
(function(h) {
	var e = h.util, i, k, j = "amp_sb-drag-layer", d;
	function b() {
		i = {
			x : 0,
			y : 0,
			start_x : null,
			start_y : null
		}
	}
	function c(m, o, l) {
		if (m) {
			b();
			var n = [
					"position:absolute",
					"height:" + o + "px",
					"width:" + l + "px",
					"cursor:" + (h.client.isGecko ? "-moz-grab" : "move"),
					"background-color:"
							+ (h.client.isIE ? "#fff;filter:alpha(opacity=0)"
									: "transparent") ].join(";");
			h.lib.append(h.skin.bodyEl(), '<div id="' + j + '" style="' + n
					+ '"></div>');
			h.lib.addEvent(e.get(j), "mousedown", g)
		} else {
			var p = e.get(j);
			if (p) {
				h.lib.removeEvent(p, "mousedown", g);
				h.lib.remove(p)
			}
			k = null
		}
	}
	function g(m) {
		h.lib.preventDefault(m);
		var l = h.lib.getPageXY(m);
		i.start_x = l[0];
		i.start_y = l[1];
		k = e.get(h.contentId());
		h.lib.addEvent(document, "mousemove", f);
		h.lib.addEvent(document, "mouseup", a);
		if (h.client.isGecko) {
			e.get(j).style.cursor = "-moz-grabbing"
		}
	}
	function a() {
		h.lib.removeEvent(document, "mousemove", f);
		h.lib.removeEvent(document, "mouseup", a);
		if (h.client.isGecko) {
			e.get(j).style.cursor = "-moz-grab"
		}
	}
	function f(o) {
		var q = h.content, p = h.dimensions, n = h.lib.getPageXY(o);
		var m = n[0] - i.start_x;
		i.start_x += m;
		i.x = Math.max(Math.min(0, i.x + m), p.inner_w - q.width);
		k.style.left = i.x + "px";
		var l = n[1] - i.start_y;
		i.start_y += l;
		i.y = Math.max(Math.min(0, i.y + l), p.inner_h - q.height);
		k.style.top = i.y + "px"
	}
	h.img = function(m) {
		this.obj = m;
		this.resizable = true;
		this.ready = false;
		var l = this;
		d = new Image();
		d.onload = function() {
			l.height = m.height ? parseInt(m.height, 10) : d.height;
			l.width = m.width ? parseInt(m.width, 10) : d.width;
			l.ready = true;
			d.onload = "";
			d = null
		};
		d.src = m.content
	};
	h.img.prototype = {
		append : function(l, o, n) {
			this.id = o;
			var m = document.createElement("img");
			m.id = o;
			m.src = this.obj.content;
			m.style.position = "absolute";
			m.setAttribute("height", n.resize_h);
			m.setAttribute("width", n.resize_w);
			l.appendChild(m)
		},
		remove : function() {
			var l = e.get(this.id);
			if (l) {
				h.lib.remove(l)
			}
			c(false);
			if (d) {
				d.onload = "";
				d = null
			}
		},
		onLoad : function() {
			var l = h.dimensions;
			if (l.oversized && h.options.handleOversize == "drag") {
				c(true, l.resize_h, l.resize_w)
			}
		},
		onWindowResize : function() {
			if (k) {
				var p = h.content, o = h.dimensions, n = parseInt(h.lib
						.getStyle(k, "top")), m = parseInt(h.lib.getStyle(k,
						"left"));
				if (n + p.height < o.inner_h) {
					k.style.top = o.inner_h - p.height + "px"
				}
				if (m + p.width < o.inner_w) {
					k.style.left = o.inner_w - p.width + "px"
				}
			}
		}
	}
})(AMP.Shadowbox);
(function(a) {
	var b = 16;
	a.qt = function(c) {
		this.obj = c;
		this.height = c.height ? parseInt(c.height, 10) : 300;
		if (a.options.showMovieControls == true) {
			this.height += b
		}
		this.width = c.width ? parseInt(c.width, 10) : 300
	};
	a.qt.prototype = {
		append : function(l, e, n) {
			this.id = e;
			var f = a.options, g = String(f.autoplayMovies), o = String(f.showMovieControls);
			var k = "<object", i = {
				id : e,
				name : e,
				height : this.height,
				width : this.width,
				kioskmode : "true"
			};
			if (a.client.isIE) {
				i.classid = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
				i.codebase = "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"
			} else {
				i.type = "video/quicktime";
				i.data = this.obj.content
			}
			for ( var h in i) {
				k += " " + h + '="' + i[h] + '"'
			}
			k += ">";
			var j = {
				src : this.obj.content,
				scale : "aspect",
				controller : o,
				autoplay : g
			};
			for ( var c in j) {
				k += '<param name="' + c + '" value="' + j[c] + '">'
			}
			k += "</object>";
			l.innerHTML = k
		},
		remove : function() {
			var f = this.id;
			try {
				document[f].Stop()
			} catch (d) {
			}
			var c = document.getElementById(f);
			if (c) {
				a.lib.remove(c)
			}
		}
	}
})(AMP.Shadowbox);
(function(b) {
	var a = b.util;
	b.swf = function(c) {
		this.obj = c;
		this.resizable = true;
		this.height = c.height ? parseInt(c.height, 10) : 300;
		this.width = c.width ? parseInt(c.width, 10) : 300
	};
	b.swf.prototype = {
		append : function(k, d, m) {
			this.id = d;
			var i = document.createElement("div");
			i.id = d;
			k.appendChild(i);
			var j = m.resize_h, n = m.resize_w, e = this.obj.content, l = b.options.flashVersion, c = b.path
					+ "libraries/swfobject/expressInstall.swf", f = b.options.flashVars, g = b.options.flashParams;
			swfobject.embedSWF(e, d, n, j, l, c, f, g)
		},
		remove : function() {
			swfobject.expressInstallCallback();
			swfobject.removeSWF(this.id)
		}
	}
})(AMP.Shadowbox);
(function(a) {
	var b = (a.client.isIE ? 70 : 45);
	a.wmp = function(c) {
		this.obj = c;
		this.height = c.height ? parseInt(c.height, 10) : 300;
		if (a.options.showMovieControls) {
			this.height += b
		}
		this.width = c.width ? parseInt(c.width, 10) : 300
	};
	a.wmp.prototype = {
		append : function(c, j, i) {
			this.id = j;
			var e = a.options, f = e.autoplayMovies ? 1 : 0;
			var d = '<object id="' + j + '" name="' + j + '" height="'
					+ this.height + '" width="' + this.width + '"', h = {
				autostart : e.autoplayMovies ? 1 : 0
			};
			if (a.client.isIE) {
				d += ' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"';
				h.url = this.obj.content;
				h.uimode = e.showMovieControls ? "full" : "none"
			} else {
				d += ' type="video/x-ms-wmv"';
				d += ' data="' + this.obj.content + '"';
				h.showcontrols = e.showMovieControls ? 1 : 0
			}
			d += ">";
			for ( var g in h) {
				d += '<param name="' + g + '" value="' + h[g] + '">'
			}
			d += "</object>";
			c.innerHTML = d
		},
		remove : function() {
			var f = this.id;
			if (a.client.isIE) {
				try {
					window[f].controls.stop();
					window[f].URL = "non-existent.wmv";
					window[f] = function() {
					}
				} catch (d) {
				}
			}
			var c = document.getElementById(f);
			if (c) {
				setTimeout(function() {
					a.lib.remove(c)
				}, 10)
			}
		}
	}
})(AMP.Shadowbox);
/*
 * SWFObject v2.1 <http://code.google.com/p/swfobject/> Copyright (c) 2007-2008
 * Geoff Stearns, Michael Williams, and Bobby van der Sluis This software is
 * released under the MIT License
 * <http://www.opensource.org/licenses/mit-license.php>
 */
var swfobject = function() {
	var UNDEF = "undefined", OBJECT = "object", SHOCKWAVE_FLASH = "Shockwave Flash", SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", FLASH_MIME_TYPE = "application/x-shockwave-flash", EXPRESS_INSTALL_ID = "SWFObjectExprInst", win = window, doc = document, nav = navigator, domLoadFnArr = [], regObjArr = [], objIdArr = [], listenersArr = [], script, timer = null, storedAltContent = null, storedAltContentId = null, isDomLoaded = false, isExpressInstallActive = false;
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF
				&& typeof doc.getElementsByTagName != UNDEF
				&& typeof doc.createElement != UNDEF, playerVersion = [ 0, 0, 0 ], d = null;
		if (typeof nav.plugins != UNDEF
				&& typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d
					&& !(typeof nav.mimeTypes != UNDEF
							&& nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) {
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"),
						10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(
						/^.*r(.*)$/, "$1"), 10) : 0
			}
		} else {
			if (typeof win.ActiveXObject != UNDEF) {
				var a = null, fp6Crash = false;
				try {
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7")
				} catch (e) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
						playerVersion = [ 6, 0, 21 ];
						a.AllowScriptAccess = "always"
					} catch (e) {
						if (playerVersion[0] == 6) {
							fp6Crash = true
						}
					}
					if (!fp6Crash) {
						try {
							a = new ActiveXObject(SHOCKWAVE_FLASH_AX)
						} catch (e) {
						}
					}
				}
				if (!fp6Crash && a) {
					try {
						d = a.GetVariable("$version");
						if (d) {
							d = d.split(" ")[1].split(",");
							playerVersion = [ parseInt(d[0], 10),
									parseInt(d[1], 10), parseInt(d[2], 10) ]
						}
					} catch (e) {
					}
				}
			}
		}
		var u = nav.userAgent.toLowerCase(), p = nav.platform.toLowerCase(), webkit = /webkit/
				.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,
				"$1")) : false, ie = false, windows = p ? /win/.test(p) : /win/
				.test(u), mac = p ? /mac/.test(p) : /mac/.test(u);
		/*
		 * @cc_on ie = true; @if (@_win32) windows = true; @elif (@_mac) mac =
		 * true; @end @
		 */
		return {
			w3cdom : w3cdom,
			pv : playerVersion,
			webkit : webkit,
			ie : ie,
			win : windows,
			mac : mac
		}
	}();
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {
				doc
						.write("<script id=__ie_ondomload defer=true src=//:><\/script>");
				script = getElementById("__ie_ondomload");
				if (script) {
					addListener(script, "onreadystatechange", checkReadyState)
				}
			} catch (e) {
			}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() {
				if (/loaded|complete/.test(doc.readyState)) {
					callDomLoadFunctions()
				}
			}, 10)
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc
					.addEventListener("DOMContentLoaded", callDomLoadFunctions,
							null)
		}
		addLoadEvent(callDomLoadFunctions)
	}();
	function checkReadyState() {
		if (script.readyState == "complete") {
			script.parentNode.removeChild(script);
			callDomLoadFunctions()
		}
	}
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return
		}
		if (ua.ie && ua.win) {
			var s = createElement("span");
			try {
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t)
			} catch (e) {
				return
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null
		}
		var dl = domLoadFnArr.length;
		for ( var i = 0; i < dl; i++) {
			domLoadFnArr[i]()
		}
	}
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn()
		} else {
			domLoadFnArr[domLoadFnArr.length] = fn
		}
	}
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false)
		} else {
			if (typeof doc.addEventListener != UNDEF) {
				doc.addEventListener("load", fn, false)
			} else {
				if (typeof win.attachEvent != UNDEF) {
					addListener(win, "onload", fn)
				} else {
					if (typeof win.onload == "function") {
						var fnOld = win.onload;
						win.onload = function() {
							fnOld();
							fn()
						}
					} else {
						win.onload = fn
					}
				}
			}
		}
	}
	function main() {
		var rl = regObjArr.length;
		for ( var i = 0; i < rl; i++) {
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj
							.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj
							.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) {
						if (ua.webkit && ua.webkit < 312) {
							fixParams(obj)
						}
						setVisibility(id, true)
					} else {
						if (regObjArr[i].expressInstall
								&& !isExpressInstallActive
								&& hasPlayerVersion("6.0.65")
								&& (ua.win || ua.mac)) {
							showExpressInstall(regObjArr[i])
						} else {
							displayAltContent(obj)
						}
					}
				}
			} else {
				setVisibility(id, true)
			}
		}
	}
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for ( var i = 0; i < al; i++) {
					if (a[i].nodeName == "DATA") {
						e.setAttribute("src", a[i].nodeValue)
					} else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue)
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for ( var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
						e.setAttribute(c[j].getAttribute("name"), c[j]
								.getAttribute("value"))
					}
				}
			}
			obj.parentNode.replaceChild(e, obj)
		}
	}
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId
				}
			} else {
				storedAltContent = abstractAltContent(obj)
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310"
			}
			if (!(/%$/.test(regObj.height))
					&& parseInt(regObj.height, 10) < 137) {
				regObj.height = "137"
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", dt = doc.title, fv = "MMredirectURL="
					+ win.location
					+ "&MMplayerType="
					+ pt
					+ "&MMdoctitle="
					+ dt, replaceId = regObj.id;
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj);
				obj.style.display = "none";
				var fn = function() {
					obj.parentNode.removeChild(obj)
				};
				addListener(win, "onload", fn)
			}
			createSWF( {
				data : regObj.expressInstall,
				id : EXPRESS_INSTALL_ID,
				width : regObj.width,
				height : regObj.height
			}, {
				flashvars : fv
			}, replaceId)
		}
	}
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj);
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			var fn = function() {
				obj.parentNode.removeChild(obj)
			};
			addListener(win, "onload", fn)
		} else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj)
		}
	}
	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML
		} else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for ( var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM")
								&& !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true))
						}
					}
				}
			}
		}
		return ac
	}
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (el) {
			if (typeof attObj.id == UNDEF) {
				attObj.id = id
			}
			if (ua.ie && ua.win) {
				var att = "";
				for ( var i in attObj) {
					if (attObj[i] != Object.prototype[i]) {
						if (i.toLowerCase() == "data") {
							parObj.movie = attObj[i]
						} else {
							if (i.toLowerCase() == "styleclass") {
								att += ' class="' + attObj[i] + '"'
							} else {
								if (i.toLowerCase() != "classid") {
									att += " " + i + '="' + attObj[i] + '"'
								}
							}
						}
					}
				}
				var par = "";
				for ( var j in parObj) {
					if (parObj[j] != Object.prototype[j]) {
						par += '<param name="' + j + '" value="' + parObj[j]
								+ '" />'
					}
				}
				el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
						+ att + ">" + par + "</object>";
				objIdArr[objIdArr.length] = attObj.id;
				r = getElementById(attObj.id)
			} else {
				if (ua.webkit && ua.webkit < 312) {
					var e = createElement("embed");
					e.setAttribute("type", FLASH_MIME_TYPE);
					for ( var k in attObj) {
						if (attObj[k] != Object.prototype[k]) {
							if (k.toLowerCase() == "data") {
								e.setAttribute("src", attObj[k])
							} else {
								if (k.toLowerCase() == "styleclass") {
									e.setAttribute("class", attObj[k])
								} else {
									if (k.toLowerCase() != "classid") {
										e.setAttribute(k, attObj[k])
									}
								}
							}
						}
					}
					for ( var l in parObj) {
						if (parObj[l] != Object.prototype[l]) {
							if (l.toLowerCase() != "movie") {
								e.setAttribute(l, parObj[l])
							}
						}
					}
					el.parentNode.replaceChild(e, el);
					r = e
				} else {
					var o = createElement(OBJECT);
					o.setAttribute("type", FLASH_MIME_TYPE);
					for ( var m in attObj) {
						if (attObj[m] != Object.prototype[m]) {
							if (m.toLowerCase() == "styleclass") {
								o.setAttribute("class", attObj[m])
							} else {
								if (m.toLowerCase() != "classid") {
									o.setAttribute(m, attObj[m])
								}
							}
						}
					}
					for ( var n in parObj) {
						if (parObj[n] != Object.prototype[n]
								&& n.toLowerCase() != "movie") {
							createObjParam(o, n, parObj[n])
						}
					}
					el.parentNode.replaceChild(o, el);
					r = o
				}
			}
		}
		return r
	}
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);
		p.setAttribute("value", pValue);
		el.appendChild(p)
	}
	function removeSWF(id) {
		var obj = getElementById(id);
		if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
			if (ua.ie && ua.win) {
				if (obj.readyState == 4) {
					removeObjectInIE(id)
				} else {
					win.attachEvent("onload", function() {
						removeObjectInIE(id)
					})
				}
			} else {
				obj.parentNode.removeChild(obj)
			}
		}
	}
	function removeObjectInIE(id) {
		var obj = getElementById(id);
		if (obj) {
			for ( var i in obj) {
				if (typeof obj[i] == "function") {
					obj[i] = null
				}
			}
			obj.parentNode.removeChild(obj)
		}
	}
	function getElementById(id) {
		var el = null;
		try {
			el = doc.getElementById(id)
		} catch (e) {
		}
		return el
	}
	function createElement(el) {
		return doc.createElement(el)
	}
	function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [ target, eventType, fn ]
	}
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0;
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0]
				&& pv[1] == v[1] && pv[2] >= v[2])) ? true : false
	}
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"))
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF
				&& doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl)
			}
		}
	}
	function setVisibility(id, isVisible) {
		var v = isVisible ? "visible" : "hidden";
		if (isDomLoaded && getElementById(id)) {
			getElementById(id).style.visibility = v
		} else {
			createCSS("#" + id, "visibility:" + v)
		}
	}
	function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars ? encodeURIComponent(s) : s
	}
	var cleanup = function() {
		if (ua.ie && ua.win) {
			window.attachEvent("onunload", function() {
				var ll = listenersArr.length;
				for ( var i = 0; i < ll; i++) {
					listenersArr[i][0].detachEvent(listenersArr[i][1],
							listenersArr[i][2])
				}
				var il = objIdArr.length;
				for ( var j = 0; j < il; j++) {
					removeSWF(objIdArr[j])
				}
				for ( var k in ua) {
					ua[k] = null
				}
				ua = null;
				for ( var l in swfobject) {
					swfobject[l] = null
				}
				swfobject = null
			})
		}
	}();
	return {
		registerObject : function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
				return
			}
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr;
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false)
		},
		getObjectById : function(objectIdStr) {
			var r = null;
			if (ua.w3cdom) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
						r = o
					} else {
						if (typeof n.SetVariable != UNDEF) {
							r = n
						}
					}
				}
			}
			return r
		},
		embedSWF : function(swfUrlStr, replaceElemIdStr, widthStr, heightStr,
				swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr
					|| !heightStr || !swfVersionStr) {
				return
			}
			widthStr += "";
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = {};
				if (attObj && typeof attObj === OBJECT) {
					for ( var i in attObj) {
						if (attObj[i] != Object.prototype[i]) {
							att[i] = attObj[i]
						}
					}
				}
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = {};
				if (parObj && typeof parObj === OBJECT) {
					for ( var j in parObj) {
						if (parObj[j] != Object.prototype[j]) {
							par[j] = parObj[j]
						}
					}
				}
				if (flashvarsObj && typeof flashvarsObj === OBJECT) {
					for ( var k in flashvarsObj) {
						if (flashvarsObj[k] != Object.prototype[k]) {
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + k + "="
										+ flashvarsObj[k]
							} else {
								par.flashvars = k + "=" + flashvarsObj[k]
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true)
					}
				})
			} else {
				if (xiSwfUrlStr && !isExpressInstallActive
						&& hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
					isExpressInstallActive = true;
					setVisibility(replaceElemIdStr, false);
					addDomLoadEvent(function() {
						var regObj = {};
						regObj.id = regObj.altContentId = replaceElemIdStr;
						regObj.width = widthStr;
						regObj.height = heightStr;
						regObj.expressInstall = xiSwfUrlStr;
						showExpressInstall(regObj)
					})
				}
			}
		},
		getFlashPlayerVersion : function() {
			return {
				major : ua.pv[0],
				minor : ua.pv[1],
				release : ua.pv[2]
			}
		},
		hasFlashPlayerVersion : hasPlayerVersion,
		createSWF : function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom) {
				return createSWF(attObj, parObj, replaceElemIdStr)
			} else {
				return undefined
			}
		},
		removeSWF : function(objElemIdStr) {
			if (ua.w3cdom) {
				removeSWF(objElemIdStr)
			}
		},
		createCSS : function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl)
			}
		},
		addDomLoadEvent : addDomLoadEvent,
		addLoadEvent : addLoadEvent,
		getQueryParamValue : function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return urlEncodeIfNecessary(q)
			}
			if (q) {
				var pairs = q.substring(1).split("&");
				for ( var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return urlEncodeIfNecessary(pairs[i]
								.substring((pairs[i].indexOf("=") + 1)))
					}
				}
			}
			return ""
		},
		expressInstallCallback : function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block"
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false
				}
			}
		}
	}
}();
AMP.Shadowbox.options.players = [ "flv", "html", "iframe", "img", "qt", "swf",
		"wmp" ];
AMP.Shadowbox.options.useSizzle = false;// userInfo module
AMP.add('userInfo', function() {

	var A = this,
	that = A.object(),
	isFrame, siteUrl, docReferrer, userAgent, vendor, platform, os, historyLength, isCookieEnabled, userLanguage, isOnline, isWindowInFocus, winWidth, winHeight, winX, winY, docWidth, docHeight, docScrollX, docScrollY, screenWidth, screenHeight, colorDepth, isJavaEnabled, 
	myYui,
	windowFocusOn = true;	
	
	
	
	// return is frame {1/0}  **VERIFIED**
	isFrame = function () {
		return self !== top ? 1 : 0;
	};
	
	
	
	// Return site url  **VERIFIED**
	// @return {String}
	siteUrl = function() {
		var url = '';
		if (typeof document.location.href !== 'undefined') {
		url = document.location.href;
		} else if(typeof self.location.href !== 'undefined') {
			url = self.location.href;
		} else if(typeof document.url !== 'undefined') {
			url = document.url;
		} else if(typeof document.location.hostname !== 'undefined') {
			url = document.location.hostname;
		} else if(typeof document.domain !== 'undefined') {
			url = document.domain;
		} else if(typeof document.documentURI !== 'undefined') {
			url = document.documentURI;
		} else if(typeof document.baseURI !== 'undefined') {
			url = document.baseURI;
		}
		return url;
	};
	
	
	
	// Return doc referrer url  **VERIFIED**
	// @return {String}
	docReferrer = function() {
		return document.referrer ? document.referrer : '';
	};
	
	
	// User agent  **VERIFIED**
	// return {string}
	userAgent = function() {
		return navigator.userAgent ? navigator.userAgent : '';
	};
	
	
	
	// Name of the browser vendor for the current browser  **VERIFIED--**
	// return {string}
	vendor = function() {
		return navigator.vendor ? navigator.vendor : '';
	};
	
	
	
	// User platform  **VERIFIED**
	// @return {string}
	platform = function() {
		return navigator.platform ? navigator.platform : '';
	};
	
	
	
	// Operating system  **VERIFIED--**
	// return {string}
	os = function() {
		return navigator.oscpu ? navigator.oscpu : '';
	};
	
	
	
	// History length  **VERIFIED**
	// @return {integer}
	historyLength = function() {
		return window.history.length ? window.history.length : '';
	};
	
	
	
	// User cookie enabled  **VERIFIED**
	// @return {1/0/''}
	isCookieEnabled = function() {
		return typeof navigator.cookieEnabled !== 'undefined' ?  (navigator.cookieEnabled ? 1 : 0) : '';
	};
	
	
	
	// Java enabled  **VERIFIED**
	// @return {1/0/''}
	isJavaEnabled = function() {
		return typeof navigator.javaEnabled === 'function' ?  (navigator.javaEnabled() ? 1 : 0) : '';
	};
	
	
	
	// User language  **VERIFIED**
	// @return {string}
	userLanguage = function() {
		return navigator.language ? navigator.language : (navigator.browserLanguage ? navigator.browserLanguage : '');
	};
	
	
	
	// Indicating whether the browser is online or not  **VERIFIED**
	// @return {string}
	isOnline = function() {
		return typeof navigator.onLine !== 'undefined' ? (navigator.onLine === true ?  1 : 0) : '';
	} ;
	
	
	
	// Is window in focus or not 
	// @return {1/0}
	isWindowInFocus = function() {
		if (myYui !== 'undefined') {
			return windowFocusOn === true ? 1 : 0;
		} else {
			A.error('userInfo: YUI is not defined');
		}
	};
	
	
	
	// Window x position
	// @return {integer}
	winX = function() {
		return typeof window.screenLeft === 'number' ? window.screenLeft : (window.screenX !== undefined ? window.screenX : '');
	};
	
	
	
	// Window y position
	// @return {integer}
	winY = function() {
		return typeof window.screenTop === 'number' ? window.screenTop : (window.screenY !== undefined ? window.screenY : '');
	};
	
	
	
	// Document width  **VERIFIED**
	// @return {integer}
	docWidth = function() {
		var doc = window.document;
		if (typeof window.innerWidth === 'number') {
			return window.innerWidth;
		} else if (doc.documentElement !== undefined && doc.documentElement.clientWidth !== undefined && doc.documentElement.clientWidth !== 0) {
			return doc.documentElement.clientWidth;
		} else if (doc.body !== undefined && doc.body.clientWidth !== undefined) {
			return doc.body.clientWidth; 
		} else {
			return '';
		}
	};
	
	
	
	// Document height **VERIFIED**
	// @return {integer}
	docHeight = function(e) {
		var doc = window.document;
		if (typeof window.innerHeight === 'number') {
			return window.innerHeight;
		}  else if (doc.documentElement !== undefined && doc.documentElement.clientHeight !== undefined && doc.documentElement.clientWidth !== 0) {
			return doc.documentElement.clientHeight;
		} else if (doc.body !== undefined && doc.body.clientHeight !== undefined) {
			return doc.body.clientHeight;
		} else {
			return '';
		}
	};
	
	
	
	// Amount page has been scroll horizontally  **VERIFIED**
	// @return {integer}
	docScrollX = function() {
		var doc = window.document;
		if(typeof(window.pageXOffset) === 'number') {
			return window.pageXOffset;
		} else if(doc.body !== undefined && doc.body.scrollLeft !== undefined && doc.body.scrollLeft !== 0) {
		    return doc.body.scrollLeft;
		} else if(doc.documentElement !== undefined && doc.documentElement.scrollLeft !== undefined) {
		    return doc.documentElement.scrollLeft;
		} else {
			return '';
		}
	};
	
	
	
	// Amount page has been scroll vertically  **VERIFIED**
	// @return {integer}
	docScrollY = function() {
		var doc = window.document;
		if(typeof(window.pageYOffset) === 'number') {
			return window.pageYOffset;
		} else if(doc.body !== undefined && doc.body.scrollTop !== undefined && doc.body.scrollTop !== 0) {
		    return doc.body.scrollTop;
		} else if(doc.documentElement !== undefined && doc.documentElement.scrollTop !== undefined) {
		    return doc.documentElement.scrollTop;
		} else {
			return '';
		}
	};
	
	
	
	// Screen width  **VERIFIED**
	// @return {integer}
	screenWidth = function() {
		if (window.screen !== undefined) {
			return window.screen.width;
		} else if (window.java !== undefined) {
			return java.awt.Toolkit.getDefaultToolkit().getScreenSize().screen.width;
		} else {
			return '';
		}
	};
	
	
	
	// Screen height  **VERIFIED**
	// @return {integer}
	screenHeight = function() {
		if (window.screen !== undefined) {
			return window.screen.height;
		} else if (window.java !== undefined) {
			return java.awt.Toolkit.getDefaultToolkit().getScreenSize().screen.height;
		} else {
			return '';
		}
	};
	
	
	
	// colorDepth  **VERIFIED**
	// @return {integer}
	colorDepth = function() {
		return window.screen !== undefined ? window.screen.colorDepth : '';
	};
	
	
	
	// set function from global use
	that.isFrame = isFrame;
	that.siteUrl = siteUrl;
	that.docReferrer = docReferrer;
	that.userAgent = userAgent;
	that.vendor = vendor;
	that.platform = platform;
	that.os = os;
	that.historyLength = historyLength;
	that.isCookieEnabled = isCookieEnabled;
	that.isJavaEnabled = isJavaEnabled;
	that. userLanguage = userLanguage;
	that.isOnline = isOnline;
	that.isWindowInFocus = isWindowInFocus;
	that.winX = winX;
	that.winY = winY;
	that.docWidth = docWidth;
	that.docHeight = docHeight;
	that.docScrollX = docScrollX;
	that.docScrollY = docScrollY;
	that.screenWidth = screenWidth;
	that.screenHeight = screenHeight;
	that.colorDepth = colorDepth;
	
	return that;
	
});


/*
Copyright (c) 2009, adMarketplace.com. All rights reserved.
*/

// jsWidget module
// @param config {object}
AMP.add('jsWidget', function(config) {
	var A = this,
	that = A.object(A.jsWidget.attached),   //attached contains the functions which we attache seperatly (not in this module)
	myYui,
	skip = 0,
	isNext = true,
	setQueryId = true,
	FRONTEND_FILTER_ADD_URL_PARAMETER_NAME = '&dp=',
	createContainer, prevAds, nextAds, loadingSign, loadStyle, loadFeedData, setEct, urlCutHttp, urlCutLength, frontendFilter, adFrontendFilterValueToUrl, getQueryId, createDynamicParameter, init;
	
	that.adData = {};
	if (!config) {
		A.error('.jsWidget: config object missing!');
		return;
	}
	
	// Create widget container
	createContainer = function(show) {
		var id = config.id, 
			searchBoxLocation = config.searchboxlocation,
			searchBoxTopHtml = '',
			searchBoxBottomHtml = '',
			searchBoxHtml,
			
			// it depends on the iframe
			onSubmitValue = A.userInfo.isFrame() ? 'true' : 'false',
			visibility = show === false ? 'visibility:hidden' : '';
		
		if (searchBoxLocation !== 0) {
			searchBoxHtml = 				
				'<div id="amp_w_s_' + id + '" style="">' +
					'<form id="amp_search_' + id + '" name="amp_search_web" style="" onSubmit="return ' + onSubmitValue + ';">' +
						'<input type="text" id="amp_form_input_' + id + '" style="" name="kw" />' +
						'<input name="search" id="amp_form_submit_web_' + id + '" type="submit" value="web">' +
						'<input name="search" id="amp_form_submit_site_' + id + '" type="submit" value="site">' +
					'</form>' +
				'</div>';
				
			if (searchBoxLocation === 1) {
				searchBoxTopHtml = searchBoxHtml;
			} else if (searchBoxLocation === 2) {
				searchBoxBottomHtml = searchBoxHtml;
			}
		}
	
		document.write(
			'<div id="amp_w_' + id + '" style="' + visibility + '">' +
				'<div id="amp_ad_popup_' + id + '" style="display:none; z-index:10000"></div>' +
				'<div id="amp_link_popup_' + id + '" style="display: none; z-index:10000"></div>' +
				searchBoxTopHtml +
				'<div id="amp_w_spacer_top_' + id + '" style="display:none;"></div>' +
				'<div id="amp_w_c_' + id + '" style=""></div>' +
				'<div id="amp_w_spacer_bottom_' + id + '" style="display:none;"></div>' +
				searchBoxBottomHtml +
				'<div id="amp_w_b_' + id + '" style=""></div>' +
			'</div>'
		);
	};

	
	// Previous navigation handler (it spports just widget type 4)
	prevAds = function() {
		if (skip > 0) {
			skip -= 1;
			that.skip = skip;
			if (config.searchboxlocation !== 0) {
				that.newSearch_4();
			}
		}
	};


	// Next navigation handler (it supports just widget type 4)
	nextAds = function () {
		if (isNext) {
			skip += 1;
			that.skip = skip;
			if (config.searchboxlocation !== 0) {
				that.newSearch_4();
			}
		}
	};

	
	// Show the loading sign (im the that period when we call wdg)
	// @param searchBoxSearch {boolean}
	loadingSign = function(searchBoxSearch) {
		//search from search box
		if (searchBoxSearch) {
			myYui.get('#amp_top_ads_' + config.id).set('innerHTML', '<div style="text-align: center"><img src="' + config.url.server + '/images/busy.gif" border=0/></div>');
			myYui.get('#amp_right_ads_' + config.id).set('innerHTML', '<div style="text-align: center"><img src="' + config.url.server + '/images/busy.gif" border=0/></div>');
			myYui.get('#amp_middle_ads_' + config.id).set('innerHTML','<div style="text-align: center"><img src="' + config.url.server + '/images/busy.gif" border=0/></div>');
		}
		else {
			myYui.get('#amp_w_c_' + config.id).set('innerHTML','<div style="text-align: center"><img src="' + config.url.server + '/images/busy.gif" border=0/></div>');
		}
	};
		
		
	// Load the widget css(style); create a new style which contains the css
	// @param tid {integer}
	loadStyle = function(tid) {
		myYui.Get.css(config.url.css,
				{
					onSuccess: function(o) {
						switch (tid) {
							case 1:
								loadFeedData();
								break;
							case 2:
								loadFeedData();
								break;
							case 3:
								loadFeedData();
								break;
							case 4:
								break;
						}
				
				},
				onFailure: function(o) {}
			});
	};
		
		
	// Load feed server data to the page with a callback function
	// @param callbackFn {string}
	// @param kw {string}
	// @param searchType {string}
	// @param isYahooBoss {boolean}
	loadFeedData = function(callbackFn, kw, searchType, isYahooBoss) {
		var siteUrl, url, start;
		try {
			setQueryId = true;
			
			if (callbackFn === undefined) {
				callbackFn = 'showData_' + config.tid
			}
				
			// show loading sign
			kw ? loadingSign(true) : loadingSign();
				
			if (!isYahooBoss) {
				url = config.url.wdg;
					
				if (kw) {
					url += '&kw=' + kw;
				}
	
				if (skip > 0) {
					url += '&skip='+ skip; 
				}
				
				url += '&fname=' + callbackFn;
				
				siteUrl = A.userInfo.siteUrl();
				url += '&url=' + encodeURIComponent(siteUrl);
					
			} else {    //YAHOO BOSS CALL
				url = config.url.yahooboss;
				start = 6*skip;
				if (searchType === 'site') {
					siteUrl = that.siteSearch.url;
					siteUrl = siteUrl && siteUrl.indexOf('www.') === 0 ? siteUrl.substr(4) : siteUrl;
					kw += ' site:' + siteUrl;
				}
				url += callbackFn;
				
				// replace the keyword and start macros
				url = url.replace(/{KEYWORD}/, kw);
				url = url.replace(/{START}/, start);
			}
				
			myYui.Get.script(A.addCacheBuster(url),
				{
					onSuccess: function(o) {
			 				o.purge(); // removes the script node immediately after
										// executing;
								},
					onFailure: function(o) {
									//log it
								}
				});
		} catch(e) {
			A.error('.jsWidget.loadFeedData:' + e.message);
		}
	};
	
	
	
	// Set clickurl to go to external click tracker
	// @param clickurl {string}
	// @retun {string}
	setEct = function (clickurl) {
		return config.url && config.url.ect && config.url.ect !== '' ? config.url.ect + encodeURIComponent(clickurl) : clickurl;
	};
		
	
	// Format url - cut http
	// @param url {string}
	// @return {string}
	urlCutHttp = function (url) {
		url = url.toLowerCase();
		if (url.indexOf('http://') === 0) {
			url = url.substring(7);
		}
		return url;
	};
		
	
	// Format url - cut length
	// @param url {string}
	// @param l {integer}
	// @return {string}
	urlCutLength = function (url, l) {
		if (url.length > l) {
			url = url.substring(0,l-3) + '...';
		}
		return url;
	};
		
		
	// Fronend filter handler
	frontendFilter = (function() {
		var x, y, mouseMovementCount = 0,
			value = false;
		return {
			check: function(e) {
				try {
					if (mouseMovementCount === 0) {
						x = e.pageX;
						y = e.pageY;
						mouseMovementCount++;
					}else if (value === false && (mouseMovementCount > 0) && (x !== e.pageX || y !== e.pageY)) {
						value = true;
						myYui.detach('frontendFilter_'+ config.id + '|mousemove');
						if (typeof that.adData['tid' + config.tid] === 'undefined') {
							myYui.on('amp_w_' + config.id + '_dataloaded', adFrontendFilterValueToUrl);
						} else {
							adFrontendFilterValueToUrl();
						}
						
						// if they make a new search
						if (config.searchboxlocation !== 0) {
							myYui.on('amp_w_' + config.id + '_new_search_data_loaded', adFrontendFilterValueToUrl, that, true);
							if (typeof that.wt4AdDataLoaded !== 'undefined' && that.wt4AdDataLoaded === true) {
								adFrontendFilterValueToUrl(true);
							}
						}
						mouseMovementCount++;
					} else if(value === false && x === e.pageX && y === e.pageY) {
						mouseMovementCount++;
					}
				} catch(e) {
					A.error('.jsWidget.frontendFilter.check:' + e.message);
				}
			},
			getValue: function() {
				return value;
			}
		}
	})();
		
		
	// Ad fronendfilter value to the url
	// @param isSearchBoxSearch {boolean}
	adFrontendFilterValueToUrl = function(isSearchBoxSearch) {
		var allLinks, adData, adDataNr, i, id, node, forntendAddUrlValue, dynamicParametValue,href, pos, clickurl;
		try {
			if (isSearchBoxSearch) {
				clickurl = that.adData['tid4'][0].clickurl;
			} else {
				clickurl = that.adData['tid' + config.tid][0].clickurl;
			}
			
			forntendAddUrlValue = createDynamicParameter(1, clickurl);
				
			if(isSearchBoxSearch === true) {
				//there are 7 amp ads in the search box popup
				// if is ect have to encode the frontend filter value
				forntendAddUrlValue = config.url && config.url.ect ? encodeURIComponent(forntendAddUrlValue) : forntendAddUrlValue;
				for(i = 0; i < 7; i++) {
					id = '#amp_w_4_' + config.tid + '_' + config.id + '_link_' + i;
					node = myYui.get(id);
					if (node) {
						
						//remove dp value; set that when data loaded
						href =  node.get('href');
						pos = href ? href.search(/&dp=/) : -1;
						if (pos !== -1) {
							href = href.substr(0, pos);
						}
							
						node.set('href', href + forntendAddUrlValue);
					}
				}
			} else {
					//if the widget is a cloud
				if (config.tid === 1) {
					//update all link in the data array (for ad popup)
					adData = that.adData['tid' + config.tid];
					adDataNr = adData.length;
					for(i=0; i<adDataNr; i++) {
						href = adData[i].clickurl;
						
						// remove dp value; set that when data loaded
						pos = href ? href.search(/&dp=/) : -1;
						if (pos !== -1) {
							href = href.substr(0, pos);
						}
						
						adData[i].clickurl = href + forntendAddUrlValue;
					}
				}
			
				//update all ad link on the widget box
				forntendAddUrlValue = config.url && config.url.ect ? encodeURIComponent(forntendAddUrlValue) : forntendAddUrlValue;
				allLinks = '#amp_w_c_' + config.id;
				myYui.all('#amp_w_c_' + config.id + ' a').each(function(node) {
					href = node.get('href');
						
					// remove dp value; set that when data loaded
					if (config.url && config.url.ect) {
						pos = href ? href.lastIndexOf("%26dp%3D") : -1;
					} else {
						pos = href ? href.lastIndexOf("&dp=") : -1;
					}
					
					if (pos !== -1) {
						href = href.substr(0, pos);
					}
					
					node.set('href', href + forntendAddUrlValue);
				});
			}
		} catch(e) {
			A.error('.jsWidget.adFrontendFilterValueToUrl:' + e.message);
		}
	};
		
	
	// Get reverse query id from url
	// @param url {string}
	// return {string}
	getQueryId = function(url) {
		var fromV1, fromV2, queryId;
		fromV1 = url.match(/[&?]queryid=(\d+)/);
		fromV1 = fromV1 && fromV1[1] && fromV1[1] !== "0" ? fromV1[1] : null;
			
			
		if(!fromV1) {
			fromV2 = url.match(/[&?]key=(\d+).(\d+)/);
			fromV2 = fromV2 && fromV2[1] && fromV2[1] !== "0"  ? fromV2[1] : null;
		}
		
		queryId = fromV1 || fromV2;
		
		// reverse queryId
		if (queryId) {
			queryId  = queryId.split('').reverse().join('');
		} else {
			//if there is no query id set to " " (one space)
			queryId = ' ';
		}
		
		return queryId;
	};
		
		
	// Creates dynamic parameter
	// return {string}
	createDynamicParameter = (function() {
		var queryId;
		return function(mmValue, url) {
			var dynamicParameterValue;
			
			// need this for encoding
			if (setQueryId === true || queryId === undefined || !queryId || queryId === " ") {
				setQueryId = false;
				queryId = getQueryId(url);
			}
						
			// we can add more values to dynamic parameter here
			dynamicParameterValue = 'mm=' + mmValue;
			
			return FRONTEND_FILTER_ADD_URL_PARAMETER_NAME + A.encode(dynamicParameterValue, queryId);
		}
	})();
	
	
	// EXTEND 'that' OBJECT
	// Initialize and create widget container; impressions logging
	that.create = function(show) { 
		try {
			//if impression log url is set
			if (config.url && config.url.impression) {
				A.log(config.url.impression);    // log impressions
			}
			createContainer(show);
			if (show !== false) {
				init();    // initialize
			}
				
		} catch (e) {
			A.error('.jsWidget.create:' + e.message);
			return null;
		}
	};
	
	that.show = function() {
		init();
	};
	
	
	// Initialize the widget
	init =  function() {
		var ye, bottomHtml,
		id = config.id,
		tid = config.tid,
		clickJsHandler = config.clickjshandler;
		
		clickJsHandler = clickJsHandler ? 'onclick="' + clickJsHandler + '; return false"' : '';
		bottomHtml = '<a id ="amp_link_' +  id + '" href="http://www.admarketplace.com" ' + clickJsHandler + ' target="_blank">ads by adMarketplace</a>';
		
		
		// Set functions to global use
		that.setEct = setEct;
		that.isFrame = A.userInfo.isFrame;
		that.loadFeedData = loadFeedData;
		that.isNext = isNext;
		that.skip = skip;
		that.urlCutHttp = urlCutHttp;
		that.urlCutLength = urlCutLength;
		that.prevAds = prevAds;
		that.nextAds = nextAds;
		that.createDynamicParameter = createDynamicParameter;
		
		YUI().use("node", function(Y) {
			Y.on('available', function() {  
				
				if (Y.get('#amp_w_' + id).getStyle('visibility') == "hidden") {
					Y.get('#amp_w_' + id).setStyle('visibility', 'visible');
				}
		
				// initialize adMarketplace link action (-1 means amp link)
				if (config.usefrontendfilter && config.usefrontendfilter === true) {
					//initialize frontendfilter action 
					Y.on('frontendFilter_' + id + '|mousemove', frontendFilter.check, document);
				}
		
				//set myYui for global use
				that.myYui = myYui = Y;
		
				// initialize different widget types
				switch (tid) {
				case 1:
					that.init_1();
					loadStyle(tid);
					break;
				case 2:
					that.init_2();
					loadStyle(tid);
					break;
				case 3:
					that.init_3();
					loadStyle(tid);
					break;
				case 4:
					that.init_4();
					loadStyle();					
					break;
				}
		
				if (tid != 4) {
					Y.get('#amp_w_b_' + id).set('innerHTML',bottomHtml);
					ye = Y.get('#amp_link_' + id);
					ye.on("mouseover", that.adPopup.mouseOver, that, '#amp_link_popup_' + config.id ,-1);
					ye.on("mouseout", that.adPopup.mouseOut, that, '#amp_link_popup_' + config.id);
					ye = Y.get('#amp_link_popup_' + id);
					ye.on("mouseover", that.adPopup.mouseOverPopup);
					ye.on("mouseout", that.adPopup.mouseOutPopup, that, '#amp_link_popup_' + config.id);
				}
		
			}, '#amp_w_' + id)
		});
		
	};
	

	// Amp link and ad popup box
	that.adPopup = (function() {
		var currNr = -2, //(default; -1 is amp ad)
		mouseInAdPopup = false,
		
		clickJsHandler = config.clickjshandler;
		clickJsHandler = clickJsHandler ? 'onclick="' + clickJsHandler + '; return false"' : '';
		
		return {
			mouseOver: function(e, id, nr) {
				currNr = nr;
				that.adPopup.show(e, id, nr);
			},
			mouseOut: function(e, id) {
				currNr = -2;
				setTimeout(function(){
					that.adPopup.hide(e,id);
				},500);
			},
			show: function(e, id, nr) {
				var x = e.pageX,
					y = e.pageY,
					element = myYui.get(id),
					winWidth, winHeight, widgetWidth, widgetHeight, 
					widget, adPopupWidth, widgetXY, allWidth, allHeight,
					howMuchUp;
				try {
					setTimeout(function() {
						if (nr === currNr) {
							that.adPopup.generate(element, nr);
	
							if (!A.userInfo.isFrame() && config.confinedplacement === false) {
								winWidth = element.get('winWidth');
								if (x + 300 > winWidth) {
									x -= x+300-winWidth+50;
								}
							} else {   	// if has to show the popup box inside in the widget box
								widget = myYui.get('#amp_w_' + config.id);
								widgetWidth = parseInt(widget.getStyle('width'), 10);
								widgetHeight = parseInt(widget.getStyle('height'), 10);
								
								if (widgetWidth >= 300) {
									adPopupWidth = 248;
									element.setStyle('width',adPopupWidth + 'px'); 
								} else if (widgetWidth <= 300) {
									adPopupWidth = widgetWidth-15;
									element.setStyle('width',adPopupWidth + 'px'); 
								}
								
								widgetXY = widget.getXY();
								
								allWidth = widgetXY[0] + widgetWidth;
								if (x+adPopupWidth+24 >= allWidth) {
									x -= x+adPopupWidth-allWidth+6;
								}
								
								allHeight = widgetXY[1] + widgetHeight;
								howMuchUp = 80;
								if (widgetWidth < 200)
									howMuchUp = 130;
								if (y+howMuchUp >= allHeight) {
									y -= y+howMuchUp-allHeight;
								}
							}
							element.setStyle('display', 'block');
							element.setXY([x,y]);
						}
					}, 500);
				
				} catch (e) {
					A.error('.jsWidget.adPopup.show:' + e.message);
					return null;
				}
			},
			hide: function(e, id) {
				var element = myYui.get(id);
				if (!mouseInAdPopup) {
					element.set('innerHTML', '').setStyle('display', 'none');
				}
			},
			generate: function(element, nr) {
				var html='', ad, title, description, clickurl, displayurl, id, kw, img;  ;
				
				// amp ad
				if (nr === -1) {
					html = '<a href="http://www.pubmarketplace.com" ' + clickJsHandler + 'target="_blank"><div class="amp_ad"><div class="amp_ad_title">Monetize Your Website</div><div class="amp_ad_desc">High CPC\'s & Exclusive Advertisers<br/>Huge Revenue Opportunity.</div><div class="amp_ad_url">www.adMarketplace.com</div></div></a>';
					element.set('innerHTML', html);
					return null;
				}
				
				id = 'amp_w_1_' + config.tid + '_' + config.id + '_link_c';
				
				ad = that.adData['tid' + config.tid][nr];  // set that.adData['tid' + config.tid] in showData
				title = ad.title;
				description = ad.description;
				clickurl = that.setEct(ad.clickurl);  // if ect is set then
														// set the clickurl to
														// go to ect
				displayurl = urlCutHttp(ad.displayurl);
				displayurl = that.urlCutLength(displayurl, 35);
				
				// original type id, widget type id, widget id

				html += '<a id="' + id + '" href="' + clickurl + '" ' + clickJsHandler + ' target="_blank">';
				html += '<div class="amp_ad">';
				html += '<div class="amp_ad_title">' + title + '</div>';
				html += '<div class="amp_ad_desc">' + description + '</div>';
				html += '<div class="amp_ad_url">' + displayurl + '</div>';
				html += '</div></a>';
				
				element.set('innerHTML', html);
				
				// log ad box open
				if (config.url.adboxopenlog) {
					kw = ad.kw;
					clickurl = encodeURIComponent(ad.clickurl);
					A.log(config.url.adboxopenlog , '&kw='+kw+'&clickurl='+clickurl);
				}
			},
			mouseOverPopup: function(e) {
				mouseInAdPopup = true;
			},
			mouseOutPopup: function(e, id) {
				if(!myYui.get(id).contains(e.relatedTarget)) {
					mouseInAdPopup = false;
					that.adPopup.hide(e, id);
				}
			}
		}
	})();
	
	
	// Return widget id
	// @return {integer}
	that.getConfigId = function(){
		return config.id;
	};
	
	
	// Return widget search box location
	// @return {integer}
	that.getConfigSearchboxlocation = function() {
		return config.searchboxlocation;
	};
	
	
	// Return widget type id
	// @return {integer}
	that.getConfigTid = function() {
		return config.tid;
	};
	
	
	// Return widget security code
	// @return {string}
	that.getConfigSc = function() {
		return config.sc;
	};
	
	
	// Return external click tracker url
	// @return {string}
	that.getConfigUrlEct = function() {
		if (config.url && config.url.ect && config.url.ect !== '') {
			return  config.url.ect;
		} else {
			return false;
		}
	};

	
	// Return publisher affiliate id
	// @return {string}
	that.getConfigAid = function() {
		return config.aid || 'unknown';
	};
	
	
	// Return static content server url
	// @return {string|undefined}
	that.getConfigUrlServer = function() {
		return  config.url && config.url.server;
	};
	
	
	// Return search page (search.php) url
	// @return {string}
	that.getConfigUrlSearchpage = function() {
		return  (config.url && config.url.searchpage) || 'http://pmp.ampxchange.com/v3';
	};
	
	
	// Return skip
	// @return {integer}
	that.getSkip = function() {
		return skip;
	};
	
	
	// Return search type for search box
	// @return {string}
	that.getSearchType = function() {
		var webTab, siteTab;
		webTab = myYui.get('#web_results_button_' + config.id);
		siteTab = myYui.get('#site_results_button_' + config.id);
		 if (webTab.get('className') === 'active_button') {
			 return 'web';
		 } else if (siteTab.get('className') === 'active_button') {
			 return 'site';
		 } else return false;
	};
	
	
	// Return usefrontendfilter setting
	// @return {boolean}
	that.getUfef = function() {
		return config.usefrontendfilter;
	};
	
	
	// Return wdg url
	// @return {string}
	that.getWdgurl = function() {
		return config.url && config.url.wdg;
	};
	
	
	// Return yahoo boss feed url
	// @return {string}
	that.getYbfurl = function() {
		return config.url && config.url.yahooboss;
	};
	

	// Return site url (which is in the database)
	// @return {string}
	that.getSiteurl = function() {
		return config.url && config.url.site;
	};
	
	
	// Return site url (which is in the database)
	// @return {string}
	that.getServerurl = function() {
		return config.url && config.url.server;
	};
	
	
	// Return click js handler js function name (for demo widgets)
	// @return {string}
	that.getClickJsHandler = function() {
		return config.clickjshandler;
	};
	
	
	// Log an error from the attached function; Helps protecting the AMP class
	that.error = function(msg, e) {
		A.error(msg, e);
	};

	that.siteSearch = {};
	that.siteSearch.url = "";

	return that;
});

// wt4 attached functions 
// wt4 initialize
AMP.attacheTo('jsWidget', 'init_4', function() {
	var that, id, tid, sc, ecturl, serverurl, aid, searchboxlocation, form, formInput,
	searchPopupInputFocus, inputFocus, selectTab, closeSearchPopup, openSearchPopup, openSearchWindow,
	skip, stype, ufef, wdgurl, ybfurl, siteurl, searchpageurl, addElementToForm, searchButtonType, setFormName, typedInSb;
	
	that = this;
	id = that.getConfigId();
	tid = that.getConfigTid();
	sc = that.getConfigSc();
	ecturl = that.getConfigUrlEct();
	serverurl = that.getConfigUrlServer();
	aid = that.getConfigAid();
	searchboxlocation = that.getConfigSearchboxlocation();
	skip = that.getSkip();

	ufef = that.getUfef();
	wdgurl = that.getWdgurl();
	ybfurl = that.getYbfurl();
	siteurl = that.getSiteurl();
	searchpageurl = that.getConfigUrlSearchpage();
	
	// add extra elements to form
	// @param {dom form element}
	addElementToForm = function(form) {
		 var id_element, tid_element, sc_element, ect_url_element, aid_element, skip_element, 
		 stype_element, ufef_element, wdgurl_element, ybfurl_element, siteurl_element ;
		 // add the id field
		 id_element = document.createElement("input");
		 id_element.setAttribute("type", "hidden");  
		 id_element.setAttribute("value", id);  
		 id_element.setAttribute("name", "id");
		 form.appendChild(id_element);
		 
		 		 
		 // add the type id field
		 tid_element = document.createElement("input");
		 tid_element.setAttribute("type", "hidden");  
		 tid_element.setAttribute("value", tid);  
		 tid_element.setAttribute("name", "tid");
		 form.appendChild(tid_element);
		 
		 // add the security code field
		 sc_element = document.createElement("input");
		 sc_element.setAttribute("type", "hidden");  
		 sc_element.setAttribute("value", sc);  
		 sc_element.setAttribute("name", "sc");
		 form.appendChild(sc_element);
		 
		 if (ecturl) {
			 // add the ectUrl field
			 ect_url_element = document.createElement("input");
			 ect_url_element.setAttribute("type", "hidden");  
			 ect_url_element.setAttribute("value", ecturl);  
			 ect_url_element.setAttribute("name", "ecturl");
			 form.appendChild(ect_url_element);
		 }
		 
		 // add the aid url
		 aid_element = document.createElement("input");
		 aid_element.setAttribute("type", "hidden");  
		 aid_element.setAttribute("value", aid);  
		 aid_element.setAttribute("name", "aid");
		 form.appendChild(aid_element);
		 
		 // add skip
		 if (skip) {
			 skip_element = document.createElement("input");
			 skip_element.setAttribute("type", "hidden");  
			 skip_element.setAttribute("value", skip);  
			 skip_element.setAttribute("name", "skip");
			 form.appendChild(skip_element);
		 }
		 
		 //add search type
		 if (stype) {
			 stype_element = document.createElement("input");
			 stype_element.setAttribute("type", "hidden");  
			 stype_element.setAttribute("value", stype);  
			 stype_element.setAttribute("name", "stype");
			 form.appendChild(stype_element);
		 }
		 
		 //add usefrontend filter
		 if (ufef) {
			 ufef_element = document.createElement("input");
			 ufef_element.setAttribute("type", "hidden");  
			 ufef_element.setAttribute("value", ufef);  
			 ufef_element.setAttribute("name", "ufef");
			 form.appendChild(ufef_element);
		 }
		 
		 // add wdg url
		 if (wdgurl) {
			 wdgurl_element = document.createElement("input");
			 wdgurl_element.setAttribute("type", "hidden");  
			 wdgurl_element.setAttribute("value", wdgurl);  
			 wdgurl_element.setAttribute("name", "wdgurl");
			 form.appendChild(wdgurl_element);
		 }
		 
		 // add yahoo boss feed url
		 if (ybfurl) {
			 ybfurl_element = document.createElement("input");
			 ybfurl_element.setAttribute("type", "hidden");  
			 ybfurl_element.setAttribute("value", ybfurl);  
			 ybfurl_element.setAttribute("name", "ybfurl");
			 form.appendChild(ybfurl_element);
		 }
		 
		 // add site url
		 if (siteurl) {
			 siteurl_element = document.createElement("input");
			 siteurl_element.setAttribute("type", "hidden");  
			 siteurl_element.setAttribute("value", siteurl);  
			 siteurl_element.setAttribute("name", "siteurl");
			 form.appendChild(siteurl_element);
		 }
	 };
	 
	 // Change search box input value to nothing
	 // @param e {event}
	 inputFocus = function(e) {
		typedInSb = true;
		e.target.set('value','');
	    that.myYui.detach('focus', inputFocus, '#amp_form_input_' + id);
	 };
	 
	 
	 // Popup input focus default settings
	 // @param e {event}
	 searchPopupInputFocus = function(e) {
		this.skip = 0;
		this.isNext = false; 
	 };
	 
	 
	 // Web or the site tab selection
	 // @param e {event}
	 selectTab = function(e) {
	 	that.skip = 0;
	 	that.isNext = false;
	 	that.myYui.get('#web_results_button_' + id).set('className', 'inactive_button');
	 	that.myYui.get('#site_results_button_' + id).set('className', 'inactive_button');
	 	this.set('className','active_button');
	 	that.newSearch_4();
	 };
	 
	 
	 // Close search popup
	 // @param e {event}
	 closeSearchPopup = function(e) {
		 var id = that.getConfigId();
		 that.myYui.get('#web_results_button_' + id).set('className', 'active_button');
		 that.myYui.get('#site_results_button_' + id).set('className', 'inactive_button');
		 that.myYui.get('#amp_search_' + id).set("name", "web");
		 
		 AMP.Shadowbox.close();
		/* var target = e.target, id = that.getConfigId();
		 if (e.target.get('id') === "amp_sb-overlay") {
			 openSearchWindow(that);
		 }*/
		 that.skip = 0;
		 that.isNext = false;
		 that.myYui.get('#amp_form_input_' + id).focus();
	 };
	 
	 
	 var sbOpenCompleteHandler = function(e) {
		 
		 	if (searchButtonType == "site") {
			 	that.myYui.get('#web_results_button_' + id).set('className', 'inactive_button');
			 	that.myYui.get('#site_results_button_' + id).set('className', 'active_button');
		 	}
	    	//set search popup close action
	    	that.myYui.on('click', closeSearchPopup, ['#amp_w_n_b_h_r_' + id, '#amp_sb-overlay']);

	    	//set ad box new search action
	    	that.myYui.on('submit', that.newSearch_4, '#new_amp_search_' + id, that);
	    	
	    	//set site/web search selections
	    	that.myYui.on('click', selectTab, ['#site_results_button_' + id, '#web_results_button_' + id]);
	    	
	    	//next/prev navigation action setup
	    	that.myYui.on('click', that.nextAds,'#amp_w_n_b_n_' + id , that);
	    	that.myYui.on('click', that.prevAds, '#amp_w_n_b_p_' + id, that);
	    	
	    	that.myYui.get('#amp_form_searchpopup_input_' + id).focus();
	    	
	    	//search popup input focus
	    	that.myYui.on('focus', searchPopupInputFocus, '#amp_form_searchpopup_input_' + id, that);

			
			if (!typedInSb) {
	    		that.myYui.get('#amp_form_searchpopup_input_' + id).set('value', 'best travel deals');
	    	} else {
	    		that.myYui.get('#amp_form_searchpopup_input_' + id).set('value', that.myYui.get('#amp_form_input_' + id).get('value'));
	    	}
	 		that.newSearch_4();
	 };
	 
	 // Open search popup
	 // @param e {event}
	 openSearchPopup = function(e) {
		 
	 	var formInput = that.myYui.get('#amp_form_input_' + id);
	 	if( formInput.get('value') !== '' ) {	
			
	 		var serverUrl = that.getServerurl();
			var	popupBox = 
					'<div id="amp_w_n_b_' + id + '" style="">' +
						'<div id="amp_w_n_b_h_' + id + '" style="background: url(' + serverUrl + '/images/background_gradient.gif) repeat-x;">' +
							'<div id="amp_w_n_b_h_l_' + id + '" style=""><img src="' + serverUrl + '/images/logo.gif" width="300" height="33" border=0></div>' +
							'<div id="amp_w_n_b_h_r_' + id + '" style=""><img border="0" width="22" height="22" src="' + serverUrl + '/images/close_x.gif"></div>' +
						'</div>' +
						'<div id="amp_w_n_b_s_' + id + '" style="">' +
							'<div id="search_div_' + id + '" style="">' +
								'<form action="#" id="new_amp_search_' + id + '" onSubmit="return false;">' +
									'<p id="amp_search_text_' + id + '"> Search This Site & The Web</p>' +
									'<input id="amp_form_searchpopup_input_' + id + '" type="text">' +
									'<input id="amp_form_new_button_' + id + '" type="image" src="' + serverUrl + '/images/search.gif" width="75" height="22" name="submit" value="Search">' +
								'</form>' +
							'</div>' +
							'<div id="amp_search_tabs_' + id + '">' +
								'<ul>' +
									'<li id="web_results_button_' + id + '" class="active_button" >Web results</li>' +
									'<li id="site_results_button_' + id + '" class="inactive_button">Site results</li>' +
								'</ul>' +
							'</div>' +
						'</div>' +
						'<div id="amp_w_n_c_' + id + '" style="">' +
							'<table>' +
								'<tr>' +
									'<td id="amp_top_ads_' + id + '" valign="top"></td>' +
									'<td id="amp_right_ads_' + id + '" style="" rowspan=2 valign="top"></td>' +
								'</tr>' +
								'<tr>' +
									'<td id="amp_middle_ads_' + id + '" style="width:780px" valign="top"></td>' +
								'</tr>' +
							'</table>' +
						'</div>' +
						'<div id="amp_w_n_b_np_' + id + '">' +
							'<span id="amp_w_n_b_p_' + id + '">&lt;&lt;&nbsp; Previous</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + 
							'<span id="amp_w_n_b_n_' + id + '">Next &nbsp;&gt;&gt;</span>' +
						'</div>' +
						'<div id="amp_w_n_b_b_' + id + '"></div>' +
					'</div>';

			
			if (e.target.get("id") == 'amp_search_' + id && e.target.get("name") == "site") {
				searchButtonType = "site";
			} else {
				searchButtonType = "web";
			}
			
	 	    AMP.Shadowbox.open({
	 	        content: popupBox,
	 	        player: "html",
	 	        height: 641,
	 	        width: 1024,
	 	        options : {onFinish: sbOpenCompleteHandler}
	 	    });
	 	} 
	 };
	 
	 
	 // Open search page in background
	 // @param that {jsWidget object}
	 openSearchWindow = function(that) {
		 var winfeatures, newWin,
		 	 url, id, tid, sc, ecturl, serverurl, aid, searchboxlocation, skip, stype, ufef, wdgurl, ybfurl, siteurl;
		 
		 
		id = that.getConfigId();
		tid = that.getConfigTid();
		sc = that.getConfigSc();
		ecturl = that.getConfigUrlEct();
		serverurl = that.getConfigUrlServer();
		aid = that.getConfigAid();
		skip = that.getSkip();
		stype = that.getSearchType();
		ufef = that.getUfef();
		wdgurl = that.getWdgurl();
		ybfurl = that.getYbfurl();
		siteurl = that.getSiteurl();
		
		url = searchpageurl + "/?id=" + id + "&tid=" + tid + "&sc=" + sc;
		
		if(ecturl) {
			url += "&ecturl=" + encodeURIComponent(ecturl);
		}
		
		if(serverurl) {
			url += "&serverurl=" + serverurl;
		}
		
		if(aid) {
			url += "&aid=" + aid;
		}
		
		if(skip) {
			url += "&skip=" + skip;
		}
		
		if(stype) {
			url += "&stype=" + stype;
		}
		
		if(ufef) {
			url += "&ufef=" + ufef;
		}
		
		if(wdgurl) {
			url += "&wdgurl=" + encodeURIComponent(wdgurl);
		}
		
		if(ybfurl) {
			url += "&ybfurl=" + encodeURIComponent(ybfurl);
		}
		
		if(siteurl) {
			url += "&siteurl=" + encodeURIComponent(siteurl);
		}
		 
		inputId = that.myYui.get('#amp_form_searchpopup_input_' + id);

		url += '&kw=' + inputId.get('value');
		
		newWinFeatures = "width=1200,height=800,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0";

		newWin = window.open(url, "_blank", newWinFeatures);
		newWin.blur();
		window.focus();
	};
		
	
	setFormName = function(e) {
		that.myYui.get('#amp_search_' + id).set("name", e.target.get("value"));
	};
	

	 // if no content placement
	 if (!that.isFrame()) {
	 		
    	//set search action 
    	that.myYui.on('submit',  openSearchPopup, '#amp_search_' + id, that);
    	
    	that.myYui.on('click',  setFormName, ['#amp_form_submit_site_' + id, '#amp_form_submit_web_' + id] , that);
    	
    
    } else {
    	form = that.myYui.get('#amp_search_' + id);
    	form.set('action', searchpageurl).set('method', 'get').set('target', '_blank');
    	addElementToForm(form);
    }
    
    // initialize infocus input box action
    that.myYui.on('focus', inputFocus, '#amp_form_input_' + id);
    
	
    // initialize the search box content
	formInput = that.myYui.get('#amp_form_input_' + id);
	if (formInput) {
		formInput.set('value','search');
	}
});


// wt4 show data
// @param jsonData {object}
AMP.attacheTo('jsWidget', 'showData_4', function(jsonData) {
	var that, id, clickJsHandler, 
	i, j,
	result, adData, adNr, ad, nextButton, prevButton,
	html;

	that = this;
	id = that.getConfigId();
	clickJsHandler = that.getClickJsHandler();
	clickJsHandler = clickJsHandler ? 'onclick="' + clickJsHandler + '; return false"' : '';

	try {
	
		//verify jsonData results, if something wrong throw an error
		if (!jsonData) {
			throw {message:'Error(1011): no response data'};
		}
		
		if (typeof jsonData.ysearchresponse === 'undefined'  || typeof jsonData.ysearchresponse.resultset_web === 'undefined') {
				throw {name:'errorToDisplay', message:'No results!'};
		}
	
		result = jsonData.ysearchresponse;
		adData = result.resultset_web;
		adNr = adData.length;	
	
		//set isnext (requested 6 ads)
		if (adNr === 6) {
			that.isNext = true;
		}
	
		
	
		html = '';
		for(i = 0; i < adNr; i++) {
			ad = adData[i];
		
			html += '<a href="' + ad.clickurl + '" target="_blank" ' + clickJsHandler + '>';
			html += '<div class="amp_ad">';
			html += '<div class="amp_ad_title">' + ad.title + '</div>';
			html += '<div class="amp_ad_desc">' + ad['abstract'] + '</div>';
			html += '<div class="amp_ad_url">' + ad.dispurl + '</div>';
			html += '</div></a>';
		
		}
	
		that.myYui.get('#amp_middle_ads_' + id).set('innerHTML', html);
		nextButton = that.myYui.get('#amp_w_n_b_n_' + id);
		prevButton = that.myYui.get('#amp_w_n_b_p_' + id);
		
		if (that.isNext) {
			nextButton.setStyle('display', 'inline');
		}
		else {
			nextButton.setStyle('display', 'none');
		}
	
		if(that.skip > 0) {
			prevButton.setStyle('display', 'inline');
		}
		else {
			prevButton.setStyle('display', 'none');
		}
		
	} catch(e) {
		if (e.name && e.name === 'errorToDisplay') {
			that.myYui.get('#amp_middle_ads_' + id).set('innerHTML', '<p style="text-align:center;font-size:9pt; padding:0px; margin: 0px;">' + e.message+ '<p>');
			that.myYui.get('#amp_w_n_b_n_' + id).setStyle('display', 'none');
			that.myYui.get('#amp_w_n_b_p_' + id).setStyle('display', 'none');
		} else {
			that.error('.jsWidget.showData_4:' + e.message);
		}
	}
});


// wt4 show top right data
// @param jsonData
AMP.attacheTo('jsWidget', 'showTopRightData_4', function(jsonData) {
	var that, id, tid, clickJsHandler,
	i, j,
	result, adData, adNr, rows, columns, ad, adTitle, showKw,
	rightAds, topAds,
	html, clickurl, displayurl, linkId, 
	widgetContent,
	tdWidth;

	that = this;
	id = that.getConfigId();
	tid =  that.getConfigTid();
	clickJsHandler = that.getClickJsHandler();
	clickJsHandler = clickJsHandler ? 'onclick="' + clickJsHandler + '; return false"' : '';

	try {
	
		//verify jsonData results, if something wrong throw an error
		if (!jsonData || !jsonData.result) {
			throw {message:'Error(1011): no response data'};
		}
		
		if (jsonData.result.ads === undefined  || (jsonData.result.ads && jsonData.result.ads.adlistings && jsonData.result.ads.adlistings.length === 0)) {
			if (jsonData.result.error.message === '') {
				throw {name:'errorToDisplay', message:'No results!'};
			} else {
				throw {name:'errorToDisplay', message:'Error(' + jsonData.result.error.code + '): ' +jsonData.result.error.message};
			}
		}
	
		result = jsonData.result;
		adData = result.ads.adlistings;
		adNr = adData.length;
	
		rightAds = that.myYui.get('#amp_right_ads_' + id);
		topAds = that.myYui.get('#amp_top_ads_' + id);
		showKw = result.extraparameter && result.extraparameter.showkw ? result.extraparameter.showkw : false;    // shows keyword instead title
		
		
		if (adNr === 0) {
			topAds.setStyle('backgroundColor', '#FFFFFF').setStyle('height', '0px').set('innerHTML','');
			rightAds.setStyle('backgroundColor', '#FFFFFF').set('innerHTML','');
			return;
		}
		
		
		//add dynamic parameter to click url
		for(i=0; i< adData.length; i++) {
			adData[i].clickurl += that.createDynamicParameter(0,adData[i].clickurl);
		}
		

		
		html = '';
		linkId = 'amp_w_4_' + tid + '_' + id + '_link_';
		for(i = 0; i< 2 && i < adNr; i++) {
			ad = adData[i];
			clickurl = that.setEct(ad.clickurl);
			displayurl = that.urlCutHttp(ad.displayurl);
		
			if (showKw && ad.kw) {
				adTitle = ad.kw;
			} else {
				adTitle = ad.title;
			}
			
			// original type id, widget type id, widget id
			html += '<a id="' + linkId + i + '" class="amp_w_ad_link_' + id + '" href="' + clickurl + '" ' + clickJsHandler + ' target="_blank">'
			html += '<div class="amp_ad">';
			html += '<div class="amp_ad_title">' + adTitle + '</div>';
			html += '<div class="amp_ad_desc">' + ad.description + '</div>';
			html += '<div class="amp_ad_url">' + displayurl + '</div>';
			html += '</div></a>';
		}
		topAds.set('innerHTML', '<table cellpadding="0"; cellspacing="0"><tr><td width="630px">' + html + '</td><td width="130px" valign="top" align="right"><div style="text-align: right; font-size: 11px; padding-right:4px; color:#75AA40 "><a href="http://www.admarketplace.com" ' + clickJsHandler + ' target="_blank" style="color:#75AA40; font-size: 11px; text-decoration: none">sponsored links</a></div></td></tr></table>') ;	
		
		
		if(i >= adNr) {
			rightAds.setStyle('backgroundColor', '#FFFFFF').set('innerHTML','');
		} else {	
			html = '';
			for(j = i; j < adNr; j++) {
				ad = adData[j];
				clickurl = that.setEct(ad.clickurl);
				displayurl = that.urlCutHttp(ad.displayurl);
		
				if (showKw && ad.kw) {
					adTitle = ad.kw;
				} else {
					adTitle = ad.title;
				}
				
				// original type id, widget type id, widget id
				html += '<a id="' + linkId + j + '" class="amp_w_ad_link_' + id + '" href="' + clickurl + '" ' + clickJsHandler + ' target="_blank">'
				html += '<div class="amp_ad">';
				html += '<div class="amp_ad_title">' + adTitle + '</div>';
				html += '<div class="amp_ad_desc">' + ad.description + '</div>';
				html += '<div class="amp_ad_url">' + displayurl + '</div>';
				html += '</div></a>';
			}
			rightAds.set('innerHTML', html);
		}
		
		that.wt4AdDataLoaded = true;
		that.adData['tid4'] = adData;
		that.myYui.fire('amp_w_' + id + '_new_search_data_loaded');
		
	} catch(e) {
		if (e.name && e.name === 'errorToDisplay') {
			that.myYui.get('#amp_top_ads_' + id).setStyle('height','0px').setStyle('backgroundColor','#FFFFFF').set('innerHTML','');
			that.myYui.get('#amp_right_ads_' + id).setStyle('backgroundColor','#FFFFFF').set('innerHTML','');
		} else {
			that.error('.jsWidget.showTopRightData_4:' + e.message);
		}
	}
});


// wt4 new search (newSearch_4)
AMP.attacheTo('jsWidget', 'newSearch_4', function() {
	var id, webTab, siteTab, url, inputBox, inputBoxValue;
	id = this.getConfigId();
	
	this.wt4AdDataLoaded = false;
	
	this.myYui.get('#amp_top_ads_' + id).setStyle('backgroundColor', '#FFF8DD');
	this.myYui.get('#amp_right_ads_' + id).setStyle('backgroundColor', '#FFF8DD');
	
	webTab = this.myYui.get('#web_results_button_' + id);
	siteTab = this.myYui.get('#site_results_button_' + id);

	inputBox = this.myYui.get('#amp_form_searchpopup_input_' + id);
	if (inputBox) {
		inputBoxValue = inputBox.get('value');
		if (inputBoxValue && inputBoxValue !== '') {
			if (siteTab.get('className') === 'active_button') {
				this.loadFeedData('ampWidget_' + id + '.showData_4', inputBoxValue, 'site', true);
				this.loadFeedData('showTopRightData_4', inputBoxValue);
			} else if (webTab.get('className') === 'active_button') {
				this.loadFeedData('ampWidget_' + id + '.showData_4', inputBoxValue, 'web', true);
				this.loadFeedData('showTopRightData_4', inputBoxValue);
			}
		}
	}
});

AMP.Shadowbox.init({adapter: "YUI", skipSetup: true, players: ["html"], useSizzle: false, overlayOpacity: 0.45, animate: false, showMovieControls: false, modal: true, enableKeys: false});

