/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
(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.start":1,"io.success":1,"io.failure":1},G=Array.prototype.slice;if(typeof YUI==="undefined"||!YUI){YUI=function(K){var J=this;if(!(J instanceof YUI)){return new YUI(K);}else{J._init(K);J._setup();return J;}};}YUI.prototype={_init:function(L){L=L||{};var J="3.0.0b1",K=this;L.win=L.win||window||{};L.win=L.win.contentWindow||L.win;L.doc=L.win.document;L.debug=("debug" in L)?L.debug:true;L.useBrowserConsole=("useBrowserConsole" in L)?L.useBrowserConsole:true;L.throwFail=("throwFail" in L)?L.throwFail:true;K.config=L;K.Env={mods:{},_idx:0,_used:{},_attached:{},_yidx:0,_uidx:0,_loaded:{}};if(J.indexOf("@")>-1){J="test";}K.version=J;K.Env._loaded[J]={};if(YUI.Env){K.Env._yidx=(++YUI.Env._yidx);K.Env._guidp=("yui_"+this.version+"-"+K.Env._yidx+"-"+B).replace(/\./g,"_");K.id=K.stamp(K);I[K.id]=K;}K.constructor=YUI;},_setup:function(J){this.use("yui-base");this.config=this.merge(this.config);},applyTo:function(P,O,L){if(!(O in C)){this.error(O+": applyTo not allowed");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.error("applyTo not found: "+O);}}return J.apply(K,L);}return null;},add:function(L,N,K,M){var J={name:L,fn:N,version:K,details:M||{}};YUI.Env.mods[L]=J;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.add(G.call(arguments,0));return this;}var K=this,T=G.call(arguments,0),W=YUI.Env.mods,X=K.Env._used,U,O=T[0],M=false,V=T[T.length-1],P,R,N,Q=[],J=[],S=function(b){if(X[b]){return;}var Y=W[b],a,c,Z;if(Y){X[b]=true;c=Y.details.requires;Z=Y.details.use;}else{if(!YUI.Env._loaded[K.version][b]){Q.push(b);}else{X[b]=true;}}if(c){if(K.Lang.isString(c)){S(c);}else{for(a=0;a<c.length;a=a+1){S(c[a]);}}}J.push(b);},L=function(Z){Z=Z||{success:true,msg:"not dynamic"};if(K.Env._callback){var Y=K.Env._callback;K.Env._callback=null;Y(K,Z);}if(K.fire){K.fire("yui:load",K,Z);}this._loading=false;while(this._useQueue&&this._useQueue.size()&&!this._loading){K.use.apply(K,this._useQueue.next());}};if(typeof V==="function"){T.pop();K.Env._callback=V;}else{V=null;}if(O==="*"){T=[];for(P in W){if(W.hasOwnProperty(P)){T.push(P);}}return K.use.apply(K,T);}if(K.Loader){M=true;this._useQueue=this._useQueue||new K.Queue();U=new K.Loader(K.config);U.require(T);U.ignoreRegistered=true;U.allowRollup=false;U.calculate();T=U.sorted;}N=T.length;for(R=0;R<N;R=R+1){S(T[R]);}if(K.Loader&&Q.length){this._loading=true;U=new K.Loader(K.config);U.onSuccess=L;U.onFailure=L;U.onTimeout=L;U.attaching=T;U.require(Q);U.insert();}else{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){if(true){YUI[E]=A[E];}}YUI._init();H(window,"load",D);YUI.Env.add=H;YUI.Env.remove=F;})();YUI.add("yui-base",function(A){(function(){var B=A,D="yui:log",C;B.log=function(G,N,E,L){var F=B,M=F.config,J=false,O,I,H,K;if(M.debug){if(E){O=M.logExclude;I=M.logInclude;if(I&&!(E in I)){J=true;}else{if(O&&(E in O)){J=true;}}}if(!J){if(M.useBrowserConsole){H=(E)?E+": "+G:G;if(typeof console!="undefined"){K=(N&&console[N])?N:"log";console[K](H);}else{if(typeof opera!="undefined"){opera.postError(H);}}}if(F.fire&&!J&&!L){if(!C){F.publish(D,{broadcast:2,emitFacade:true});C=true;}F.fire(D,{msg:G,cat:N,src:E});}}}return F;};B.message=function(){return B.log.apply(B,arguments);};})();(function(){A.Lang=A.Lang||{};var Q=A.Lang,F="array",H="boolean",C="date",K="error",R="function",G="number",J="null",E="object",N="regexp",M="string",B=Object.prototype.toString,O="undefined",D={"undefined":O,"number":G,"boolean":H,"string":M,"[object Function]":R,"[object RegExp]":N,"[object Array]":F,"[object Date]":C,"[object Error]":K},I=/^\s+|\s+$/g,P="";Q.isArray=function(L){return Q.type(L)===F;};Q.isBoolean=function(L){return typeof L===H;};Q.isFunction=function(L){return Q.type(L)===R;};Q.isDate=function(L){return Q.type(L)===C;};Q.isNull=function(L){return L===null;};Q.isNumber=function(L){return typeof L===G&&isFinite(L);};Q.isObject=function(S,L){return(S&&(typeof S===E||(!L&&Q.isFunction(S))))||false;};Q.isString=function(L){return typeof L===M;};Q.isUndefined=function(L){return typeof L===O;};Q.trim=function(L){try{return L.replace(I,P);}catch(S){return L;}};Q.isValue=function(S){var L=Q.type(S);switch(L){case G:return isFinite(S);case J:case O:return false;default:return !!(L);}};Q.type=function(L){return D[typeof L]||D[B.call(L)]||(L?E:J);};})();(function(){var B=A.Lang,C=Array.prototype,D=function(L,I,K){var H=(K)?2:A.Array.test(L),G,F,E;if(H){try{return C.slice.call(L,I||0);}catch(J){E=[];for(G=0,F=L.length;G<F;G=G+1){E.push(L[G]);}return E;}}else{return[L];}};A.Array=D;D.test=function(G){var E=0;if(B.isObject(G)){if(B.isArray(G)){E=1;
}else{try{if("length" in G&&!("tagName" in G)&&!("alert" in G)&&(!A.Lang.isFunction(G.size)||G.size()>1)){E=2;}}catch(F){}}}return E;};D.each=(C.forEach)?function(E,F,G){C.forEach.call(E||[],F,G||A);return A;}:function(F,H,I){var E=(F&&F.length)||0,G;for(G=0;G<E;G=G+1){H.call(I||A,F[G],G,F);}return A;};D.hash=function(G,F){var J={},E=G.length,I=F&&F.length,H;for(H=0;H<E;H=H+1){J[G[H]]=(I&&I>H)?F[H]:true;}return J;};D.indexOf=(C.indexOf)?function(E,F){return E.indexOf(F);}:function(E,G){for(var F=0;F<E.length;F=F+1){if(E[F]===G){return F;}}return -1;};D.numericSort=function(F,E){return(F-E);};D.some=(C.some)?function(E,F,G){return C.some.call(E,F,G);}:function(F,H,I){var E=F.length,G;for(G=0;G<E;G=G+1){if(H.call(I,F[G],G,F)){return true;}}return false;};})();(function(){var C=A.Lang,B="__",D=function(G,F){var E=F.toString;if(C.isFunction(E)&&E!=Object.prototype.toString){G.toString=E;}};A.merge=function(){var F=arguments,H={},G,E=F.length;for(G=0;G<E;G=G+1){A.mix(H,F[G],true);}return H;};A.mix=function(E,N,G,M,K,L){if(!N||!E){return E||A;}if(K){switch(K){case 1:return A.mix(E.prototype,N.prototype);case 2:A.mix(E.prototype,N.prototype);break;case 3:return A.mix(E,N.prototype);case 4:return A.mix(E.prototype,N);default:}}var J=L&&C.isArray(E),I,H,F;if(M&&M.length){for(I=0,H=M.length;I<H;++I){F=M[I];if(F in N){if(L&&C.isObject(E[F],true)){A.mix(E[F],N[F]);}else{if(!J&&(G||!(F in E))){E[F]=N[F];}else{if(J){E.push(N[F]);}}}}}}else{for(I in N){if(L&&C.isObject(E[I],true)){A.mix(E[I],N[I]);}else{if(!J&&(G||!(I in E))){E[I]=N[I];}else{if(J){E.push(N[I]);}}}}if(A.UA.ie){D(E,N);}}return E;};A.cached=function(G,E){E=E||{};return function F(I,H){var J=(H)?Array.prototype.join.call(arguments,B):I;if(!(J in E)){E[J]=G.apply(G,arguments);}return E[J];};};})();(function(){A.Object=function(G){var E=function(){};E.prototype=G;return new E();};var D=A.Object,C=undefined,B=function(I,H){var G=(H===2),E=(G)?0:[],F;for(F in I){if(G){E++;}else{if(I.hasOwnProperty(F)){E.push((H)?I[F]:F);}}}return E;};D.keys=function(E){return B(E);};D.values=function(E){return B(E,1);};D.size=function(E){return B(E,2);};D.hasKey=function(F,E){return(E in F);};D.hasValue=function(F,E){return(A.Array.indexOf(D.values(F),E)>-1);};D.owns=function(F,E){return(F.hasOwnProperty(E));};D.each=function(I,H,J,G){var F=J||A,E;for(E in I){if(G||I.hasOwnProperty(E)){H.call(F,I[E],E,I);}}return A;};D.getValue=function(I,H){var G=A.Array(H),E=G.length,F;for(F=0;I!==C&&F<E;F=F+1){I=I[G[F]];}return I;};D.setValue=function(K,I,J){var H=A.Array(I),G=H.length-1,E,F=K;if(G>=0){for(E=0;F!==C&&E<G;E=E+1){F=F[H[E]];}if(F!==C){F[H[E]]=J;}else{return C;}}return K;};})();A.UA=function(){var G=navigator,F={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:G.cajaVersion,secure:false,os:null},D=G&&G.userAgent,E=A.config.win.location,C=E&&E.href,B;F.secure=C&&(C.toLowerCase().indexOf("https")===0);if(D){if((/windows|win32/).test(D)){F.os="windows";}else{if((/macintosh/).test(D)){F.os="macintosh";}}if((/KHTML/).test(D)){F.webkit=1;}B=D.match(/AppleWebKit\/([^\s]*)/);if(B&&B[1]){F.webkit=parseFloat(B[1]);if(/ Mobile\//.test(D)){F.mobile="Apple";}else{B=D.match(/NokiaN[^\/]*/);if(B){F.mobile=B[0];}}B=D.match(/AdobeAIR\/([^\s]*)/);if(B){F.air=B[0];}}if(!F.webkit){B=D.match(/Opera[\s\/]([^\s]*)/);if(B&&B[1]){F.opera=parseFloat(B[1]);B=D.match(/Opera Mini[^;]*/);if(B){F.mobile=B[0];}}else{B=D.match(/MSIE\s([^;]*)/);if(B&&B[1]){F.ie=parseFloat(B[1]);}else{B=D.match(/Gecko\/([^\s]*)/);if(B){F.gecko=1;B=D.match(/rv:([^\s\)]*)/);if(B&&B[1]){F.gecko=parseFloat(B[1]);}}}}}}return F;}();(function(){var B=A.Lang,C=function(K,E,L,G,H){K=K||0;E=E||{};var F=L,J=G,I,D;if(B.isString(L)){F=E[L];}if(!F){A.error("method undefined");}if(!B.isArray(J)){J=[G];}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;})();(function(){var D=["yui-base"],B,E=A.config;A.use.apply(A,D);if(E.core){B=E.core;}else{B=["queue-base","get","loader"];}A.use.apply(A,B);})();},"3.0.0b1");YUI.add("queue-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;},"3.0.0b1");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(f){var b=M[f],e,X,c,a,Z,Y;if(b){e=b.nodes;X=e.length;c=b.win.document;a=c.getElementsByTagName("head")[0];if(b.insertBefore){Z=L(b.insertBefore,f);if(Z){a=Z.parentNode;}}for(Y=0;Y<X;Y=Y+1){a.removeChild(e[Y]);}}b.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){X.timer.cancel();}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){X.timer.cancel();}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){Y.timer.cancel();}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=B.later(Y.timeout,Y,Q,Z);}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;}B.later(0,a,H,c);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){B.later(0,null,I,X);},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.0b1");YUI.add("loader",function(A){(function(){YUI.Env._loaderQueue=YUI.Env._loaderQueue||new A.Queue();var o=YUI.Env,v,h="base",S="css",u="js",J="cssreset",Q="cssfonts",w="cssgrids",B="cssbase",I=[J,Q,w,"cssreset-context","cssfonts-context","cssgrids-context"],U=["reset","fonts","grids",h],V=A.version,p=V+"/build/",Y="-context",d="anim-base",r="dd-drag",c="dom",D="dataschema-base",l="datasource-local",e="dom-base",K="dom-style",G="dump",T="get",E="event",j="event-custom",m="io-base",t="node",R="node-base",P="oop",F="selector-css2",g="substitute",O="widget",H="widget-position",n="yui-base",a="plugin",Z={version:V,root:p,base:"http://yui.yahooapis.com/"+p,comboBase:"http://yui.yahooapis.com/combo?",skin:{defaultSkin:"sam",base:"assets/skins/",path:"skin.css",after:I},modules:{dom:{requires:[P],submodules:{"dom-base":{requires:[P]},"dom-style":{requires:[e]},"dom-screen":{requires:[e,K]},"selector-native":{requires:[e]},"selector-css2":{requires:["selector-native"]},"selector":{requires:[e]}},plugins:{"selector-css3":{requires:[F]}}},node:{requires:[c,h],expound:E,submodules:{"node-base":{requires:[e,h,F]},"node-style":{requires:[K,R]},"node-screen":{requires:["dom-screen",R]}},plugins:{"node-event-simulate":{requires:[R,"event-simulate"]}}},anim:{requires:[h,t],submodules:{"anim-base":{requires:[h,"node-style"]},"anim-color":{requires:[d]},"anim-curve":{requires:["anim-xy"]},"anim-easing":{requires:[d]},"anim-scroll":{requires:[d]},"anim-xy":{requires:[d,"node-screen"]},"anim-node-plugin":{requires:[t,d]}}},attribute:{requires:[j]},base:{submodules:{"base-base":{requires:["attribute"]},"base-build":{requires:["base-base"]}}},cache:{requires:[a]},compat:{requires:[t,G,g]},classnamemanager:{requires:[n]},collection:{requires:[P]},console:{requires:[O,g],skinnable:true,plugins:{"console-filters":{requires:[a],skinnable:true}}},cookie:{requires:[n]},dataschema:{submodules:{"dataschema-base":{requires:[h]},"dataschema-array":{requires:[D]},"dataschema-json":{requires:[D,"json"]},"dataschema-text":{requires:[D]},"dataschema-xml":{requires:[D]}}},datasource:{submodules:{"datasource-local":{requires:[h]},"datasource-arrayschema":{requires:[l,a,"dataschema-array"]},"datasource-cache":{requires:[l,"cache"]},"datasource-function":{requires:[l]},"datasource-jsonschema":{requires:[l,a,"dataschema-json"]},"datasource-polling":{requires:[l]},"datasource-get":{requires:[l,T]},"datasource-textschema":{requires:[l,a,"dataschema-text"]},"datasource-io":{requires:[l,m]},"datasource-xmlschema":{requires:[l,a,"dataschema-xml"]}}},datatype:{submodules:{"datatype-date":{requires:[n]},"datatype-number":{requires:[n]},"datatype-xml":{requires:[n]}}},dd:{submodules:{"dd-ddm-base":{requires:[t,h]},"dd-ddm":{requires:["dd-ddm-base"]},"dd-ddm-drop":{requires:["dd-ddm"]},"dd-drag":{requires:["dd-ddm-base"]},"dd-drop":{requires:["dd-ddm-drop"]},"dd-proxy":{requires:[r]},"dd-constrain":{requires:[r]},"dd-scroll":{requires:[r]},"dd-plugin":{requires:[r],optional:["dd-constrain","dd-proxy"]},"dd-drop-plugin":{requires:["dd-drop"]}}},dump:{requires:[n]},event:{requires:[j,t]},"event-custom":{requires:[P]},"event-simulate":{requires:[E]},"node-focusmanager":{requires:[t,a]},get:{requires:[n]},history:{requires:[t]},imageloader:{requires:[t]},io:{submodules:{"io-base":{requires:[j]},"io-xdr":{requires:[m]},"io-form":{requires:[m,t]},"io-upload-iframe":{requires:[m,t]},"io-queue":{requires:[m,"queue-promote"]}}},json:{submodules:{"json-parse":{requires:[n]},"json-stringify":{requires:[n]}}},loader:{requires:[T]},"node-menunav":{requires:[t,"classnamemanager",a,"node-focusmanager"],skinnable:true},oop:{requires:[n]},overlay:{requires:[O,H,"widget-position-ext","widget-stack","widget-stdmod"],skinnable:true},plugin:{requires:[h]},profiler:{requires:[n]},queue:{submodules:{"queue-base":{requires:[n]},"queue-run":{requires:["queue-base",j]}},plugins:{"queue-promote":{}}},slider:{requires:[O,"dd-constrain"],skinnable:true},stylesheet:{requires:[n]},substitute:{optional:[G]},widget:{requires:[h,t,"classnamemanager"],plugins:{"widget-position":{},"widget-position-ext":{requires:[H]},"widget-stack":{skinnable:true},"widget-stdmod":{}},skinnable:true},yui:{supersedes:[n,T,"loader","queue-base"]},"yui-base":{},test:{requires:[g,t,"json","event-simulate"]}}},k=function(L,i,x){return L+"/"+i+"-min."+(x||S);
},N=YUI.Env._loaderQueue,C=Z.modules,q,X,W,s,M=A.Lang,f="_provides",b="_supersedes";for(q=0;q<U.length;q=q+1){X=U[q];W=S+X;C[W]={type:S,path:k(W,X)};s=W+Y;X=X+Y;C[s]={type:S,path:k(W,X)};if(W==w){C[W].requires=[Q];C[W].optional=[J];C[s].requires=[Q+Y];C[s].optional=[J+Y];}else{if(W==B){C[W].after=I;C[s].after=I;}}}A.Env.meta=Z;v=o._loaded;A.Loader=function(y){this._internalCallback=null;this._useYahooListener=false;this.onSuccess=null;this.onFailure=null;this.onCSS=null;this.onProgress=null;this.onTimeout=null;this.context=A;this.data=null;this.insertBefore=null;this.charset=null;this.cssAttributes=null;this.jsAttributes=null;this.base=A.Env.meta.base;this.comboBase=A.Env.meta.comboBase;this.combine=(!(h in y));this.ignoreRegistered=false;this.root=A.Env.meta.root;this.timeout=0;this.ignore=null;this.force=null;this.forceMap={};this.allowRollup=true;this.filter=null;this.filters={};this.required={};this.moduleInfo={};this.skin=A.merge(A.Env.meta.skin);var x=A.Env.meta.modules,L;for(L in x){if(x.hasOwnProperty(L)){this._internal=true;this.addModule(x[L],L);this._internal=false;}}this.rollups=null;this.loadOptional=false;this.sorted=[];this.loaded=v[V];this.attaching=null;this.dirty=true;this.inserted={};this.skipped={};this._config(y);};A.Loader.prototype={FILTER_DEFS:{RAW:{"searchExp":"-min\\.js","replaceStr":".js"},DEBUG:{"searchExp":"-min\\.js","replaceStr":"-debug.js"}},SKIN_PREFIX:"skin-",_config:function(AA){var x,L,z,y;if(AA){for(x in AA){if(AA.hasOwnProperty(x)){z=AA[x];if(x=="require"){this.require(z);}else{if(x=="modules"){for(L in z){if(z.hasOwnProperty(L)){this.addModule(z[L],L);}}}else{this[x]=z;}}}}}y=this.filter;if(M.isString(y)){y=y.toUpperCase();this.filterName=y;this.filter=this.FILTER_DEFS[y];}},formatSkin:function(x,L){var i=this.SKIN_PREFIX+x;if(L){i=i+"-"+L;}return i;},_addSkin:function(AD,AB,AC){var L=this.formatSkin(AD),y=this.moduleInfo,i=this.skin,x=y[AB]&&y[AB].ext,AA,z;if(AB){L=this.formatSkin(AD,AB);if(!y[L]){AA=y[AB];z=AA.pkg||AB;this.addModule({"name":L,"type":"css","after":i.after,"path":(AC||z)+"/"+i.base+AD+"/"+AB+".css","ext":x});}}return L;},addModule:function(y,x){x=x||y.name;y.name=x;if(!y||!y.name){return false;}if(!y.type){y.type=u;}if(!y.path&&!y.fullpath){y.path=k(x,x,y.type);}y.ext=("ext" in y)?y.ext:(this._internal)?false:true;y.requires=y.requires||[];this.moduleInfo[x]=y;var AB=y.submodules,AC,z,AD,AF,AE,AA,L;if(AB){AD=[];z=0;for(AC in AB){if(AB.hasOwnProperty(AC)){AF=AB[AC];AF.path=k(x,AC,y.type);this.addModule(AF,AC);AD.push(AC);if(y.skinnable){AE=this._addSkin(this.skin.defaultSkin,AC,x);AD.push(AE.name);}z++;}}y.supersedes=AD;y.rollup=Math.min(z-1,4);}AA=y.plugins;if(AA){for(AC in AA){if(AA.hasOwnProperty(AC)){L=AA[AC];L.path=k(x,AC,y.type);L.requires=L.requires||[];L.requires.push(x);this.addModule(L,AC);if(y.skinnable){this._addSkin(this.skin.defaultSkin,AC,x);}}}}this.dirty=true;return y;},require:function(i){var L=(typeof i==="string")?arguments:i;this.dirty=true;A.mix(this.required,A.Array.hash(L));},getRequires:function(AD){if(!AD){return[];}if(!this.dirty&&AD.expanded){return AD.expanded;}var AB,AC=[],L=AD.requires,x=AD.optional,y=this.moduleInfo,z,AA,AE;for(AB=0;AB<L.length;AB=AB+1){AC.push(L[AB]);z=this.getModule(L[AB]);AE=this.getRequires(z);for(AA=0;AA<AE.length;AA=AA+1){AC.push(AE[AA]);}}L=AD.supersedes;if(L){for(AB=0;AB<L.length;AB=AB+1){AC.push(L[AB]);z=this.getModule(L[AB]);AE=this.getRequires(z);for(AA=0;AA<AE.length;AA=AA+1){AC.push(AE[AA]);}}}if(x&&this.loadOptional){for(AB=0;AB<x.length;AB=AB+1){AC.push(x[AB]);AE=this.getRequires(y[x[AB]]);for(AA=0;AA<AE.length;AA=AA+1){AC.push(AE[AA]);}}}AD.expanded=A.Object.keys(A.Array.hash(AC));return AD.expanded;},getProvides:function(y,AD){var x=!(AD),L=(x)?f:b,AA=this.getModule(y),z={},AG,AB,AE,AC,AF=function(i){if(!AB[i]){AB[i]=true;A.mix(z,AE.getProvides(i));}};if(!AA){return z;}if(AA[L]){return AA[L];}AG=AA.supersedes;AB={};AE=this;if(AG){for(AC=0;AC<AG.length;AC=AC+1){AF(AG[AC]);}}AA[b]=z;AA[f]=A.merge(z);AA[f][y]=true;return AA[L];},calculate:function(L){if(L||this.dirty){this._config(L);this._setup();this._explode();if(this.allowRollup&&!this.combine){this._rollup();}this._reduce();this._sort();this.dirty=false;}},_setup:function(){var AC=this.moduleInfo,AA,AB,z,x,AD,y,L;for(AA in AC){if(AC.hasOwnProperty(AA)){x=AC[AA];if(x&&x.skinnable){AD=this.skin.overrides;if(AD&&AD[AA]){for(AB=0;AB<AD[AA].length;AB=AB+1){L=this._addSkin(AD[AA][AB],AA);}}else{L=this._addSkin(this.skin.defaultSkin,AA);}x.requires.push(L);}}}y=A.merge(this.inserted);if(!this.ignoreRegistered){A.mix(y,o.mods);}if(this.ignore){A.mix(y,A.Array.hash(this.ignore));}for(z in y){if(y.hasOwnProperty(z)){A.mix(y,this.getProvides(z));}}if(this.force){for(AB=0;AB<this.force.length;AB=AB+1){if(this.force[AB] in y){delete y[this.force[AB]];}}}A.mix(this.loaded,y);},_explode:function(){var AA=this.required,x,L,z,y=this,AB=function(i){L=y.getModule(i);var AC=L&&L.expound;if(L){if(AC){AA[AC]=y.getModule(AC);z=y.getRequires(AA[AC]);A.mix(AA,A.Array.hash(z));}z=y.getRequires(L);A.mix(AA,A.Array.hash(z));}};for(x in AA){if(AA.hasOwnProperty(x)){AB(x);}}},getModule:function(i){var L=this.moduleInfo[i];return L;},_rollup:function(){var AC,AB,AA,AF,AE={},L=this.required,y,z=this.moduleInfo,x,AD;if(this.dirty||!this.rollups){for(AC in z){if(z.hasOwnProperty(AC)){AA=this.getModule(AC);if(AA&&AA.rollup){AE[AC]=AA;}}}this.rollups=AE;this.forceMap=(this.force)?A.Array.hash(this.force):{};}for(;;){x=false;for(AC in AE){if(AE.hasOwnProperty(AC)){if(!L[AC]&&((!this.loaded[AC])||this.forceMap[AC])){AA=this.getModule(AC);AF=AA.supersedes||[];y=false;if(!AA.rollup){continue;}AD=0;for(AB=0;AB<AF.length;AB=AB+1){if(this.loaded[AF[AB]]&&!this.forceMap[AF[AB]]){y=false;break;}else{if(L[AF[AB]]){AD++;y=(AD>=AA.rollup);if(y){break;}}}}if(y){L[AC]=true;x=true;this.getRequires(AA);}}}}if(!x){break;}}},_reduce:function(){var y,x,z,L,AA=this.required;for(y in AA){if(AA.hasOwnProperty(y)){if(this.loaded[y]&&(!this.forceMap[y])&&!this.ignoreRegistered){delete AA[y];
}else{L=this.getModule(y);z=L&&L.supersedes;if(z){for(x=0;x<z.length;x=x+1){if(z[x] in AA){delete AA[z[x]];}}}}}}},_attach:function(){if(this.attaching){A._attach(this.attaching);}else{A._attach(this.sorted);}},_finish:function(){N.running=false;this._continue();},_onSuccess:function(){this._attach();var L=this.skipped,x,y;for(x in L){if(L.hasOwnProperty(x)){delete this.inserted[x];}}this.skipped={};y=this.onSuccess;if(y){y.call(this.context,{msg:"success",data:this.data,success:true});}this._finish();},_onFailure:function(i){this._attach();var L=this.onFailure;if(L){L.call(this.context,{msg:"failure: "+i.msg,data:this.data,success:false});}this._finish();},_onTimeout:function(){this._attach();var L=this.onTimeout;if(L){L.call(this.context,{msg:"timeout",data:this.data,success:false});}this._finish();},_sort:function(){var AF=A.Object.keys(this.required),i=this.moduleInfo,AA=this.loaded,L,x,AD,AC,z,y,AB,AE=function(AK,AN){var AM=i[AK],AJ,AH,AL,AG,AI;if(AA[AN]||!AM){return false;}AH=AM.expanded;AL=AM.after;AG=i[AN];if(AH&&A.Array.indexOf(AH,AN)>-1){return true;}if(AL&&A.Array.indexOf(AL,AN)>-1){return true;}AI=i[AN]&&i[AN].supersedes;if(AI){for(AJ=0;AJ<AI.length;AJ=AJ+1){if(AE(AK,AI[AJ])){return true;}}}if(AM.ext&&AM.type==S&&!AG.ext&&AG.type==S){return true;}return false;};L=0;for(;;){x=AF.length;AB=false;for(z=L;z<x;z=z+1){AD=AF[z];for(y=z+1;y<x;y=y+1){if(AE(AD,AF[y])){AC=AF.splice(y,1);AF.splice(z,0,AC[0]);AB=true;break;}}if(AB){break;}else{L=L+1;}}if(!AB){break;}}this.sorted=AF;},_insert:function(x,y,i){if(x){this._config(x);}this.calculate(y);if(!i){var L=this;this._internalCallback=function(){var z=L.onCSS;if(z){z.call(L.context,A);}L._internalCallback=null;L._insert(null,null,u);};this._insert(null,null,S);return;}this._loading=true;this._combineComplete={};this.loadType=i;this.loadNext();},_continue:function(){if(!(N.running)&&N.size()>0){N.running=true;N.next()();}},insert:function(x,i){var L=this,y;y=A.merge(this,true);delete y.require;delete y.dirty;N.add(function(){L._insert(y,x,i);});this._continue();},loadNext:function(AC){if(!this._loading){return;}var AI,AA,z,y,L,AH=this,AD=this.loadType,AE,x,AB,AF=function(AL){this._combineComplete[AD]=true;var AM=this._combining,AJ=AM.length,AK;for(AK=0;AK<AJ;AK=AK+1){this.inserted[AM[AK]]=true;}this.loadNext(AL.data);},AG=function(i){AH.loadNext(i.data);};if(this.combine&&(!this._combineComplete[AD])){this._combining=[];AI=this.sorted;AA=AI.length;L=this.comboBase;for(z=0;z<AA;z=z+1){y=this.getModule(AI[z]);if(y&&y.type===this.loadType&&!y.ext){L+=this.root+y.path;if(z<AA-1){L+="&";}this._combining.push(AI[z]);}}if(this._combining.length){if(this.loadType===S){AE=A.Get.css;AB=this.cssAttributes;}else{AE=A.Get.script;AB=this.jsAttributes;}AE(this._filter(L),{data:this._loading,onSuccess:AF,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,attributes:AB,timeout:this.timeout,autopurge:false,context:AH});return;}else{this._combineComplete[AD]=true;}}if(AC){if(AC!==this._loading){return;}this.inserted[AC]=true;this.loaded[AC]=true;if(this.onProgress){this.onProgress.call(this.context,{name:AC,data:this.data});}}AI=this.sorted;AA=AI.length;for(z=0;z<AA;z=z+1){if(AI[z] in this.inserted){continue;}if(AI[z]===this._loading){return;}y=this.getModule(AI[z]);if(!y){x="Undefined module "+AI[z]+" skipped";this.inserted[AI[z]]=true;this.skipped[AI[z]]=true;continue;}if(!AD||AD===y.type){this._loading=AI[z];if(y.type===S){AE=A.Get.css;AB=this.cssAttributes;}else{AE=A.Get.script;AB=this.jsAttributes;}L=(y.fullpath)?this._filter(y.fullpath,AI[z]):this._url(y.path,AI[z]);AE(L,{data:AI[z],onSuccess:AG,insertBefore:this.insertBefore,charset:this.charset,attributes:AB,onFailure:this._onFailure,onTimeout:this._onTimeout,timeout:this.timeout,autopurge:false,context:AH});return;}}this._loading=null;AE=this._internalCallback;if(AE){this._internalCallback=null;AE.call(this);}else{this._onSuccess();}},_filter:function(x,i){var z=this.filter,L=i&&(i in this.filters),y=L&&this.filters[i];if(x){if(L){z=(M.isString(y))?this.FILTER_DEFS[y.toUpperCase()]||null:y;}if(z){x=x.replace(new RegExp(z.searchExp,"g"),z.replaceStr);}}return x;},_url:function(i,L){return this._filter((this.base||"")+i,L);}};})();},"3.0.0b1",{requires:["queue-base"]});YUI.add("yui",function(A){},"3.0.0b1",{use:["yui-base","queue-base","get","loader"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("oop",function(E){var D=E.Lang,C=E.Array,B=Object.prototype;E.augment=function(A,S,H,Q,M){var K=S.prototype,O=null,R=S,N=(M)?E.Array(M):[],G=A.prototype,L=G||A,P=false,F,I,J;if(G&&R){F={};I={};O={};E.each(K,function(U,T){I[T]=function(){for(J in F){if(F.hasOwnProperty(J)&&(this[J]===I[J])){this[J]=F[J];}}R.apply(this,N);return F[T].apply(this,arguments);};if((!Q||(T in Q))&&(H||!(T in this))){if(D.isFunction(U)){F[T]=U;this[T]=I[T];}else{this[T]=U;}}},O,true);}else{P=true;}E.mix(L,O||K,H,Q);if(P){S.apply(L,N);}return A;};E.aggregate=function(G,F,A,H){return E.mix(G,F,A,H,0,true);};E.extend=function(H,G,A,J){if(!G||!H){E.error("extend failed, verify dependencies");}var I=G.prototype,F=E.Object(I);H.prototype=F;F.constructor=H;H.superclass=I;if(G!=Object&&I.constructor==B.constructor){I.constructor=G;}if(A){E.mix(F,A,true);}if(J){E.mix(H,J,true);}return H;};E.each=function(G,F,H,A){if(G.each&&G.item){return G.each.call(G,F,H);}else{switch(C.test(G)){case 1:return C.each(G,F,H);case 2:return C.each(E.Array(G,0,true),F,H);default:return E.Object.each(G,F,H,A);}}};E.clone=function(I,H,G,J,A){if(!D.isObject(I)){return I;}var F;switch(D.type(I)){case"date":return new Date(I);case"regexp":return new RegExp(I.source);case"function":F=E.bind(I,A);break;case"array":F=[];break;default:F=(H)?{}:E.Object(I);}E.each(I,function(L,K){if(!G||(G.call(J||this,L,K,this,I)!==false)){this[K]=E.clone(L,H,G,J,this);}},F);return F;};E.bind=function(A,G){var F=arguments.length>2?E.Array(arguments,2,true):null;return function(){var I=D.isString(A)?G[A]:A,H=(F)?F.concat(E.Array(arguments,0,true)):arguments;return I.apply(G||I,H);};};E.rbind=function(A,G){var F=arguments.length>2?E.Array(arguments,2,true):null;return function(){var I=D.isString(A)?G[A]:A,H=(F)?E.Array(arguments,0,true).concat(F):arguments;return I.apply(G||I,H);};};},"3.0.0b1");/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("event-custom",function(G){G.Env.evt={handles:{},plugins:{}};(function(){var H=0,I=1;G.Do={objs:{},before:function(K,M,N,O){var L=K,J;if(O){J=[K,O].concat(G.Array(arguments,4,true));L=G.rbind.apply(G,J);}return this._inject(H,L,M,N);},after:function(K,M,N,O){var L=K,J;if(O){J=[K,O].concat(G.Array(arguments,4,true));L=G.rbind.apply(G,J);}return this._inject(I,L,M,N);},_inject:function(J,L,M,O){var P=G.stamp(M),N,K;if(!this.objs[P]){this.objs[P]={};}N=this.objs[P];if(!N[O]){N[O]=new G.Do.Method(M,O);M[O]=function(){return N[O].exec.apply(N[O],arguments);};}K=P+G.stamp(L)+O;N[O].register(K,L,J);return new G.EventHandle(N[O],K);},detach:function(J){if(J.detach){J.detach();}},_unload:function(K,J){}};G.Do.Method=function(J,K){this.obj=J;this.methodName=K;this.method=J[K];this.before={};this.after={};};G.Do.Method.prototype.register=function(K,L,J){if(J){this.after[K]=L;}else{this.before[K]=L;}};G.Do.Method.prototype._delete=function(J){delete this.before[J];delete this.after[J];};G.Do.Method.prototype.exec=function(){var L=G.Array(arguments,0,true),M,K,P,N=this.before,J=this.after,O=false;for(M in N){if(N.hasOwnProperty(M)){K=N[M].apply(this.obj,L);if(K){switch(K.constructor){case G.Do.Halt:return K.retVal;case G.Do.AlterArgs:L=K.newArgs;break;case G.Do.Prevent:O=true;break;default:}}}}if(!O){K=this.method.apply(this.obj,L);}for(M in J){if(J.hasOwnProperty(M)){P=J[M].apply(this.obj,L);if(P&&P.constructor==G.Do.Halt){return P.retVal;}else{if(P&&P.constructor==G.Do.AlterReturn){K=P.newRetVal;}}}}return K;};G.Do.AlterArgs=function(K,J){this.msg=K;this.newArgs=J;};G.Do.AlterReturn=function(K,J){this.msg=K;this.newRetVal=J;};G.Do.Halt=function(K,J){this.msg=K;this.retVal=J;};G.Do.Prevent=function(J){this.msg=J;};G.Do.Error=G.Do.Halt;})();(function(){G.EventFacade=function(I,H){I=I||{};this.details=I.details;this.type=I.type;this.target=I.target;this.currentTarget=H;this.relatedTarget=I.relatedTarget;this.stopPropagation=function(){I.stopPropagation();};this.stopImmediatePropagation=function(){I.stopImmediatePropagation();};this.preventDefault=function(){I.preventDefault();};this.halt=function(J){I.halt(J);};};})();var F="after",C=["broadcast","bubbles","context","contextFn","configured","currentTarget","defaultFn","details","emitFacade","fireOnce","host","preventable","preventedFn","queuable","silent","stoppedFn","target","type"],A=new G.EventFacade(),D=G.Object.keys(A),E=9,B="yui:log";G.EventHandle=function(H,I){this.evt=H;this.sub=I;};G.EventHandle.prototype={detach:function(){if(this.evt){this.evt._delete(this.sub);}}};G.CustomEvent=function(H,I){I=I||{};this.id=G.stamp(this);this.type=H;this.context=G;this.logSystem=(H==B);this.silent=this.logSystem;this.subscribers={};this.afters={};this.preventable=true;this.bubbles=true;this.signature=E;this.applyConfig(I,true);};G.CustomEvent.prototype={_YUI_EVENT:true,applyConfig:function(I,H){if(I){G.mix(this,I,H,C);}},_on:function(L,J,I,H){if(!L){G.error("Invalid callback for CE: "+this.type);}var K=new G.Subscriber(L,J,I,H);if(this.fireOnce&&this.fired){G.later(0,this,this._notify,K);}if(H==F){this.afters[K.id]=K;this.hasAfters=true;}else{this.subscribers[K.id]=K;this.hasSubscribers=true;}return new G.EventHandle(this,K);},subscribe:function(J,I){var H=(arguments.length>2)?G.Array(arguments,2,true):null;return this._on(J,I,H,true);},on:function(J,I){var H=(arguments.length>2)?G.Array(arguments,2,true):null;return this._on(J,I,H,true);},after:function(J,I){var H=(arguments.length>2)?G.Array(arguments,2,true):null;return this._on(J,I,H,F);},detach:function(L,J){if(L&&L.detach){return L.detach();}if(!L){return this.unsubscribeAll();}var M=false,I=this.subscribers,H,K;for(H in I){if(I.hasOwnProperty(H)){K=I[H];if(K&&K.contains(L,J)){this._delete(K);M=true;}}}return M;},unsubscribe:function(){return this.detach.apply(this,arguments);},_getFacade:function(){var H=this._facade,K,I=this.details,J;if(!H){H=new G.EventFacade(this,this.currentTarget);}K=I&&I[0];if(G.Lang.isObject(K,true)){J={};G.mix(J,H,true,D);G.mix(H,K,true);G.mix(H,J,true,D);}H.details=this.details;H.target=this.target;H.currentTarget=this.currentTarget;H.stopped=0;H.prevented=0;this._facade=H;return this._facade;},_notify:function(K,J,H){this.log(this.type+"->"+": "+K);var I;if(this.emitFacade){if(!H){H=this._getFacade(J);if(G.Lang.isObject(J[0])){J[0]=H;}else{J.unshift(H);}}}I=K.notify(J,this);if(false===I||this.stopped>1){this.log(this.type+" cancelled by subscriber");return false;}return true;},log:function(I,H){if(!this.silent){}},fire:function(){var Q=G.Env._eventstack,J,S,P,K,L,H,M,I,N,O=true,R;if(Q){if(this.queuable&&this.type!=Q.next.type){this.log("queue "+this.type);Q.queue.push([this,arguments]);return true;}}else{G.Env._eventstack={id:this.id,next:this,silent:this.silent,logging:(this.type===B),stopped:0,prevented:0,queue:[]};Q=G.Env._eventstack;}if(this.fireOnce&&this.fired){this.log("fireOnce event: "+this.type+" already fired");}else{P=G.Array(arguments,0,true);this.stopped=0;this.prevented=0;this.target=this.target||this.host;R=new G.EventTarget({fireOnce:true,context:this.host});this.events=R;if(this.preventedFn){R.on("prevented",this.preventedFn);}if(this.stoppedFn){R.on("stopped",this.stoppedFn);}this.currentTarget=this.host||this.currentTarget;this.fired=true;this.details=P.slice();this.log("Firing "+this.type);N=false;Q.lastLogState=Q.logging;L=null;if(this.emitFacade){this._facade=null;L=this._getFacade(P);if(G.Lang.isObject(P[0])){P[0]=L;}else{P.unshift(L);}}if(this.hasSubscribers){J=G.merge(this.subscribers);for(K in J){if(J.hasOwnProperty(K)){if(!N){Q.logging=(Q.logging||(this.type===B));N=true;}if(this.stopped==2){break;}S=J[K];if(S&&S.fn){O=this._notify(S,P,L);if(false===O){this.stopped=2;}}}}}Q.logging=(Q.lastLogState);if(this.bubbles&&this.host&&!this.stopped){Q.stopped=0;Q.prevented=0;O=this.host.bubble(this);this.stopped=Math.max(this.stopped,Q.stopped);this.prevented=Math.max(this.prevented,Q.prevented);}if(this.defaultFn&&!this.prevented){this.defaultFn.apply(this.host||this,P);
}if(!this.stopped&&this.broadcast){if(this.host!==G){G.fire.apply(G,P);}if(this.broadcast==2){G.Global.fire.apply(G.Global,P);}}if(this.hasAfters&&!this.prevented&&this.stopped<2){J=G.merge(this.afters);for(K in J){if(J.hasOwnProperty(K)){if(!N){Q.logging=(Q.logging||(this.type===B));N=true;}if(this.stopped==2){break;}S=J[K];if(S&&S.fn){O=this._notify(S,P,L);if(false===O){this.stopped=2;}}}}}}if(Q.id===this.id){M=Q.queue;while(M.length){H=M.pop();I=H[0];Q.stopped=0;Q.prevented=0;Q.next=I;O=I.fire.apply(I,H[1]);}G.Env._eventstack=null;}return(O!==false);},unsubscribeAll:function(){return this.detachAll.apply(this,arguments);},detachAll:function(){var J=this.subscribers,I,H=0;for(I in J){if(J.hasOwnProperty(I)){this._delete(J[I]);H++;}}this.subscribers={};return H;},_delete:function(H){if(H){delete H.fn;delete H.context;delete this.subscribers[H.id];delete this.afters[H.id];}},toString:function(){return this.type;},stopPropagation:function(){this.stopped=1;G.Env._eventstack.stopped=1;this.events.fire("stopped",this);},stopImmediatePropagation:function(){this.stopped=2;G.Env._eventstack.stopped=2;this.events.fire("stopped",this);},preventDefault:function(){if(this.preventable){this.prevented=1;G.Env._eventstack.prevented=1;this.events.fire("prevented",this);}},halt:function(H){if(H){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();}};G.Subscriber=function(J,I,H){this.fn=J;this.context=I;this.id=G.stamp(this);this.args=H;this.events=null;};G.Subscriber.prototype={_notify:function(L,J,K){var H=this.args,I;switch(K.signature){case 0:I=this.fn.call(L,K.type,J,L);break;case 1:I=this.fn.call(L,J[0]||null,L);break;default:if(H||J){J=J||[];H=(H)?J.concat(H):J;I=this.fn.apply(L,H);}else{I=this.fn.call(L);}}return I;},notify:function(I,K){var L=this.context,H=true;if(!L){L=(K.contextFn)?K.contextFn():K.context;}if(G.config.throwFail){H=this._notify(L,I,K);}else{try{H=this._notify(L,I,K);}catch(J){G.error(this+" failed: "+J.message,J);}}return H;},contains:function(I,H){if(H){return((this.fn==I)&&this.context==H);}else{return(this.fn==I);}},toString:function(){return"Subscriber "+this.id;}};(function(){var H=G.Lang,J=":",K="|",M="~AFTER~",N=G.cached(function(L,P){if(!P||!H.isString(L)||L.indexOf(J)>-1){return L;}return P+J+L;}),I=G.cached(function(Q,T){var P=Q,R,U,L,S;if(!H.isString(P)){return P;}L=P.indexOf(M);if(L>-1){U=true;P=P.substr(M.length);}L=P.indexOf(K);if(L>-1){R=P.substr(0,(L));P=P.substr(L+1);if(P=="*"){P=null;}}S=N(P,T);return[R,S,U,P];}),O=function(L){var P=(H.isObject(L))?L:{};this._yuievt={id:G.guid(),events:{},targets:{},config:P,chain:("chain" in P)?P.chain:G.config.chain,defaults:{context:P.context||this,host:this,emitFacade:P.emitFacade,fireOnce:P.fireOnce,queuable:P.queuable,broadcast:P.broadcast,bubbles:("bubbles" in P)?P.bubbles:true}};};O.prototype={on:function(S,V,Q,W){var a=I(S,this._yuievt.config.prefix),b,d,P,h,Y,X,e,T=G.Env.evt.handles,R,L,U,g=G.Node,Z;if(H.isObject(S,true)){b=V;d=Q;P=G.Array(arguments,0,true);h={};R=S._after;delete S._after;G.each(S,function(f,c){if(f){b=f.fn||((G.Lang.isFunction(f))?f:b);d=f.context||d;}P[0]=(R)?M+c:c;P[1]=b;P[2]=d;h[c]=this.on.apply(this,P);},this);return(this._yuievt.chain)?this:h;}else{if(H.isFunction(S)){return G.Do.before.apply(G.Do,arguments);}}X=a[0];R=a[2];U=a[3];if(g&&(this instanceof g)&&(U in g.DOM_EVENTS)){P=G.Array(arguments,0,true);P.splice(2,0,g.getDOMNode(this));return G.on.apply(G,P);}S=a[1];if(this instanceof YUI){L=G.Env.evt.plugins[S];P=G.Array(arguments,0,true);P[0]=U;if(L&&L.on){Z=P[2];if(g&&Z&&(Z instanceof g)){P[2]=g.getDOMNode(Z);}e=L.on.apply(G,P);}else{if((!S)||(!L&&g&&(U in g.DOM_EVENTS))){e=G.Event._attach(P);}}}if(!e){Y=this._yuievt.events[S]||this.publish(S);e=Y._on(V,Q,(arguments.length>3)?G.Array(arguments,3,true):null,(R)?"after":true);}if(X){T[X]=T[X]||{};T[X][S]=T[X][S]||[];T[X][S].push(e);}return(this._yuievt.chain)?this:e;},subscribe:function(){return this.on.apply(this,arguments);},detach:function(Y,a,L){var R=I(Y,this._yuievt.config.prefix),X=H.isArray(R)?R[0]:null,d=(R)?R[3]:null,T,U,b=G.Env.evt.handles,Z,W,c=this._yuievt.events,Q,S,V=true,P=function(g,f){var e=g[f];if(e){while(e.length){T=e.pop();T.detach();}}};if(X){Z=b[X];Y=R[1];if(Z){if(Y){P(Z,Y);}else{for(S in Z){if(Z.hasOwnProperty(S)){P(Z,S);}}}return(this._yuievt.chain)?this:true;}}else{if(H.isObject(Y)&&Y.detach){V=Y.detach();return(this._yuievt.chain)?this:true;}else{if(G.Node&&(this instanceof G.Node)&&((!d)||(d in G.Node.DOM_EVENTS))){W=G.Array(arguments,0,true);W[2]=G.Node.getDOMNode(this);return G.detach.apply(G,W);}}}U=G.Env.evt.plugins[d];if(this instanceof YUI){W=G.Array(arguments,0,true);if(U&&U.detach){return U.detach.apply(G,W);}else{if(!Y||(!U&&Y.indexOf(":")==-1)){W[0]=Y;return G.Event.detach.apply(G.Event,W);}}}if(Y){Q=c[Y];if(Q){return Q.detach(a,L);}}else{for(S in c){if(c.hasOwnProperty(S)){V=V&&c[S].detach(a,L);}}return V;}return(this._yuievt.chain)?this:false;},unsubscribe:function(){return this.detach.apply(this,arguments);},detachAll:function(L){L=N(L,this._yuievt.config.prefix);return this.detach(L);},unsubscribeAll:function(){return this.detachAll.apply(this,arguments);},publish:function(Q,R){Q=N(Q,this._yuievt.config.prefix);var P,S,L,T;if(H.isObject(Q)){L={};G.each(Q,function(V,U){L[U]=this.publish(U,V||R);},this);return L;}P=this._yuievt.events;S=P[Q];if(S){if(R){S.applyConfig(R,true);}}else{T=(R)?G.mix(R,this._yuievt.defaults):this._yuievt.defaults;S=new G.CustomEvent(Q,T);P[Q]=S;}if(R instanceof G.CustomEvent){P[Q].broadcast=false;}return P[Q];},addTarget:function(L){this._yuievt.targets[G.stamp(L)]=L;this._yuievt.hasTargets=true;},removeTarget:function(L){delete this._yuievt.targets[G.stamp(L)];},fire:function(R){var T=H.isString(R),Q=(T)?R:(R&&R.type),S,L,P;Q=N(Q,this._yuievt.config.prefix);S=this.getEvent(Q);if(!S){if(this._yuievt.hasTargets){L=(T)?arguments:G.Array(arguments,0,true).unshift(Q);return this.bubble(null,L,this);}P=true;}else{L=G.Array(arguments,(T)?1:0,true);P=S.fire.apply(S,L);
S.target=null;}return(this._yuievt.chain)?this:P;},getEvent:function(L){L=N(L,this._yuievt.config.prefix);var P=this._yuievt.events;return(P&&L in P)?P[L]:null;},bubble:function(V,T,R){var Q=this._yuievt.targets,S=true,W,U,L,P;if(!V||((!V.stopped)&&Q)){for(P in Q){if(Q.hasOwnProperty(P)){W=Q[P];U=V&&V.type;L=W.getEvent(U);if(!L){if(W._yuievt.hasTargets){W.bubble.call(W,V,T,R);}}else{L.target=R||(V&&V.target)||this;L.currentTarget=W;S=S&&L.fire.apply(L,T||V.details);if(L.stopped){break;}}}}}return S;},after:function(Q,P){var L=G.Array(arguments,0,true);switch(H.type(Q)){case"function":return G.Do.after.apply(G.Do,arguments);case"object":L[0]._after=true;break;default:L[0]=M+Q;}return this.on.apply(this,L);},before:function(){return this.on.apply(this,arguments);}};G.EventTarget=O;G.mix(G,O.prototype,false,false,{bubbles:false});O.call(G);YUI.Env.globalEvents=YUI.Env.globalEvents||new O();G.Global=YUI.Env.globalEvents;})();},"3.0.0b1",{requires:["oop"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("attribute",function(C){C.State=function(){this.data={};};C.State.prototype={add:function(O,Y,b){var a=this.data;a[Y]=a[Y]||{};a[Y][O]=b;},addAll:function(O,a){var Y;for(Y in a){if(a.hasOwnProperty(Y)){this.add(O,Y,a[Y]);}}},remove:function(O,Y){var a=this.data;if(a[Y]&&(O in a[Y])){delete a[Y][O];}},removeAll:function(O,a){var Y=this.data;C.each(a||Y,function(c,b){if(C.Lang.isString(b)){this.remove(O,b);}else{this.remove(O,c);}},this);},get:function(O,Y){var a=this.data;return(a[Y]&&O in a[Y])?a[Y][O]:undefined;},getAll:function(O){var a=this.data,Y;C.each(a,function(c,b){if(O in a[b]){Y=Y||{};Y[b]=c[O];}},this);return Y;}};var I=C.Object,J=C.EventTarget,U=".",S="Change",L="getter",K="setter",M="readOnly",V="writeOnce",Z="validator",G="value",N="valueFn",E="broadcast",Q="lazyAdd",X="added",B="initializing",H="initValue",T="published",R="defaultValue",A="lazy",P="isLazyAdd",F,W={};W[M]=1;W[V]=1;W[L]=1;W[E]=1;function D(){this._ATTR_E_FACADE={};J.call(this,{emitFacade:true});this._conf=new C.State();}D.INVALID_VALUE={};F=D.INVALID_VALUE;D._ATTR_CFG=[K,L,Z,G,N,V,M,Q,E];D.prototype={addAttr:function(a,Y,c){var O=this._conf;c=(Q in Y)?Y[Q]:c;if(c&&!this.attrAdded(a)){O.add(a,A,Y||{});O.add(a,X,true);}else{if(!this.attrAdded(a)||O.get(a,P)){Y=Y||{};var d,b=(G in Y);if(b){d=Y.value;delete Y.value;}Y.added=true;Y.initializing=true;O.addAll(a,Y);if(b){this.set(a,d);}O.remove(a,B);}}return this;},attrAdded:function(O){return !!this._conf.get(O,X);},modifyAttr:function(a,Y){if(this.attrAdded(a)){if(this._isLazyAttr(a)){this._addLazyAttr(a);}var b,O=this._conf;for(b in Y){if(W[b]&&Y.hasOwnProperty(b)){O.add(a,b,Y[b]);if(b===E){O.remove(a,T);}}}}},removeAttr:function(O){this._conf.removeAll(O);},get:function(b){var e=b,a=this._conf,c,O,d;if(b.indexOf(U)!==-1){c=b.split(U);b=c.shift();}if(this._tCfgs&&this._tCfgs[b]){var Y={};Y[b]=this._tCfgs[b];delete this._tCfgs[b];this._addAttrs(Y,this._tVals);}if(this._isLazyAttr(b)){this._addLazyAttr(b);}d=a.get(b,G);O=a.get(b,L);d=(O)?O.call(this,d,e):d;d=(c)?I.getValue(d,c):d;return d;},_isLazyAttr:function(O){return this._conf.get(O,A);},_addLazyAttr:function(a){var Y=this._conf;var O=Y.get(a,A);Y.add(a,P,true);Y.remove(a,A);this.addAttr(a,O);},set:function(O,a,Y){return this._setAttr(O,a,Y);},reset:function(O){if(O){if(this._isLazyAttr(O)){this._addLazyAttr(O);}this.set(O,this._conf.get(O,H));}else{var Y=this._conf.data.added;C.each(Y,function(a,b){this.reset(b);},this);}return this;},_set:function(O,a,Y){return this._setAttr(O,a,Y,true);},_setAttr:function(Y,c,O,a){var e=true,h=this._conf,f=h.data,d,g,i,b;if(Y.indexOf(U)!==-1){g=Y;i=Y.split(U);Y=i.shift();}if(this._isLazyAttr(Y)){this._addLazyAttr(Y);}d=(!f.value||!(Y in f.value));if(!this.attrAdded(Y)){}else{if(!d&&!a){if(h.get(Y,V)){e=false;}if(h.get(Y,M)){e=false;}}if(e){b=this.get(Y);if(i){c=I.setValue(C.clone(b),i,c);if(c===undefined){e=false;}}if(e){if(h.get(Y,B)){this._setAttrVal(Y,g,b,c);}else{this._fireAttrChange(Y,g,b,c,O);}}}}return this;},_fireAttrChange:function(b,f,e,a,d){var O=b+S,Y=this._conf,c;if(!Y.get(b,T)){this.publish(O,{queuable:false,defaultFn:this._defAttrChangeFn,silent:true,broadcast:Y.get(b,E)});Y.add(b,T,true);}c=(d)?C.merge(d):this._ATTR_E_FACADE;c.type=O;c.attrName=b;c.subAttrName=f;c.prevVal=e;c.newVal=a;this.fire(c);},_defAttrChangeFn:function(O){if(!this._setAttrVal(O.attrName,O.subAttrName,O.prevVal,O.newVal)){O.stopImmediatePropagation();}else{O.newVal=this._conf.get(O.attrName,G);}},_setAttrVal:function(j,i,d,c){var f=true,h=this._conf,a=h.get(j,Z),e=h.get(j,K),g=h.get(j,B),Y=i||j,b;if(a){var O=a.call(this,c,Y);if(!O&&g){c=h.get(j,R);O=true;}}if(!a||O){if(e){b=e.call(this,c,Y);if(b===F){f=false;}else{if(b!==undefined){c=b;}}}if(f){if(!i&&c===d){f=false;}else{if(h.get(j,H)===undefined){h.add(j,H,c);}h.add(j,G,c);}}}else{f=false;}return f;},setAttrs:function(Y){for(var O in Y){if(Y.hasOwnProperty(O)){this.set(O,Y[O]);}}return this;},getAttrs:function(b){var e={},c,Y,O,d,a=(b===true);b=(b&&!a)?b:I.keys(this._conf.data.added);for(c=0,Y=b.length;c<Y;c++){O=b[c];d=this.get(O);if(!a||this._conf.get(O,G)!=this._conf.get(O,H)){e[O]=this.get(O);}}return e;},addAttrs:function(O,Y,a){if(O){this._tCfgs=O;this._tVals=this._splitAttrVals(Y);this._addAttrs(O,this._tVals,a);this._tCfgs=this._tVals=null;}return this;},_addAttrs:function(Y,a,b){var O,c,d;for(O in Y){if(Y.hasOwnProperty(O)){c=Y[O];c.defaultValue=c.value;d=this._getAttrInitVal(O,c,this._tVals);if(d!==undefined){c.value=d;}if(this._tCfgs[O]){delete this._tCfgs[O];}this.addAttr(O,c,b);}}},_splitAttrVals:function(b){var d={},c={},e,O,a,Y;if(b){for(Y in b){if(b.hasOwnProperty(Y)){if(Y.indexOf(U)!==-1){e=Y.split(U);O=e.shift();a=c[O]=c[O]||[];a[a.length]={path:e,value:b[Y]};}else{d[Y]=b[Y];}}}return{simple:d,complex:c};}else{return null;}},_getAttrInitVal:function(f,d,h){var Y=(d.valueFn)?d.valueFn.call(this):d.value,O,a,c,b,j,g,e;if(!d.readOnly&&h){O=h.simple;if(O&&O.hasOwnProperty(f)){Y=O[f];}a=h.complex;if(a&&a.hasOwnProperty(f)){e=a[f];for(c=0,b=e.length;c<b;++c){j=e[c].path;g=e[c].value;I.setValue(Y,j,g);}}}return Y;}};C.mix(D,J,false,null,1);C.Attribute=D;},"3.0.0b1",{requires:["event-custom"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("base-base",function(A){var K=A.Lang;function D(L){this._plugins={};}D.prototype={plug:function(T,L){if(T){if(K.isFunction(T)){this._plug(T,L);}else{if(K.isArray(T)){for(var O=0,S=T.length;O<S;O++){this.plug(T[O]);}}else{this._plug(T.fn,T.cfg);}}}return this;},unplug:function(O){if(O){this._unplug(O);}else{var L;for(L in this._plugins){if(this._plugins.hasOwnProperty(L)){this._unplug(L);}}}return this;},hasPlugin:function(L){return(this._plugins[L]&&this[L]);},_initPlugins:function(O){var T=this._getClasses(),L=[],U={},S,V,X,Y,W;for(V=T.length-1;V>=0;V--){S=T[V];Y=S._UNPLUG;if(Y){A.mix(U,Y,true);}X=S._PLUG;if(X){A.mix(L,X,true);}}for(W in L){if(L.hasOwnProperty(W)){if(!U[W]){this.plug(L[W]);}}}if(O&&O.plugins){this.plug(O.plugins);}},_destroyPlugins:function(){this._unplug();},_plug:function(S,L){if(S&&S.NS){var O=S.NS;L=L||{};L.host=this;if(this.hasPlugin(O)){this[O].setAttrs(L);}else{this[O]=new S(L);this._plugins[O]=S;}}},_unplug:function(S){var O=S,L=this._plugins;if(K.isFunction(S)){O=S.NS;if(O&&(!L[O]||L[O]!==S)){O=null;}}if(O){if(this[O]){this[O].destroy();delete this[O];}if(L[O]){delete L[O];}}}};D.plug=function(O,V,T){var W,U,L,S;if(O!==A.Base){O._PLUG=O._PLUG||{};if(!K.isArray(V)){if(T){V={fn:V,cfg:T};}V=[V];}for(U=0,L=V.length;U<L;U++){W=V[U];S=W.NAME||W.fn.NAME;O._PLUG[S]=W;}}};D.unplug=function(O,U){var V,T,L,S;if(O!==A.Base){O._UNPLUG=O._UNPLUG||{};if(!K.isArray(U)){U=[U];}for(T=0,L=U.length;T<L;T++){V=U[T];S=V.NAME;if(!O._PLUG[S]){O._UNPLUG[S]=V;}else{delete O._PLUG[S];}}}};A.namespace("Plugin").Host=D;var I=A.Object,J=".",F="destroy",Q="init",P="initialized",H="destroyed",C="initializer",B=Object.prototype.constructor,M="deep",R="shallow",G="value",N="destructor";function E(){A.Attribute.call(this);A.Plugin.Host.call(this);this._silentInit=this._silentInit||false;if(this._lazyAddAttrs!==false){this._lazyAddAttrs=true;}this.init.apply(this,arguments);}E._ATTR_CFG=A.Attribute._ATTR_CFG.concat("cloneDefaultValue");E.NAME="base";E.ATTRS={initialized:{readOnly:true,value:false},destroyed:{readOnly:true,value:false}};E.prototype={init:function(L){this._yuievt.config.prefix=this.name=this.constructor.NAME;if(!this._silentInit){this.publish(Q,{queuable:false,defaultFn:this._defInitFn});}if(L){if(L.on){this.on(L.on);}if(L.after){this.after(L.after);}}if(!this._silentInit){this.fire(Q,{cfg:L});}else{this._defInitFn({cfg:L});}return this;},destroy:function(){this.publish(F,{queuable:false,defaultFn:this._defDestroyFn});this.fire(F);return this;},_defInitFn:function(L){this._initHierarchy(L.cfg);this._initPlugins(L.cfg);if(!this._silentInit){this._set(P,true);}else{this._conf.add(P,G,true);}},_defDestroyFn:function(L){this._destroyHierarchy();this._destroyPlugins();this._set(H,true);},_getClasses:function(){if(!this._classes){this._initHierarchyData();}return this._classes;},_getAttrCfgs:function(){if(!this._attrs){this._initHierarchyData();}return this._attrs;},_filterAttrCfgs:function(U,O){var S=null,L,T=U.ATTRS;if(T){for(L in T){if(T.hasOwnProperty(L)&&O[L]){S=S||{};S[L]=O[L];delete O[L];}}}return S;},_initHierarchyData:function(){var S=this.constructor,O=[],L=[];while(S){O[O.length]=S;if(S.ATTRS){L[L.length]=S.ATTRS;}S=S.superclass?S.superclass.constructor:null;}this._classes=O;this._attrs=this._aggregateAttrs(L);},_aggregateAttrs:function(X){var U,Y,T,L,Z,O,W,S=E._ATTR_CFG,V={};if(X){for(O=X.length-1;O>=0;--O){Y=X[O];for(U in Y){if(Y.hasOwnProperty(U)){T=A.mix({},Y[U],true,S);L=T.value;W=T.cloneDefaultValue;if(L){if((W===undefined&&(B===L.constructor||K.isArray(L)))||W===M||W===true){T.value=A.clone(L);}else{if(W===R){T.value=A.merge(L);}}}Z=null;if(U.indexOf(J)!==-1){Z=U.split(J);U=Z.shift();}if(Z&&V[U]&&V[U].value){I.setValue(V[U].value,Z,L);}else{if(!Z){if(!V[U]){V[U]=T;}else{A.mix(V[U],T,true,S);}}}}}}}return V;},_initHierarchy:function(V){var S=this._lazyAddAttrs,W,X,Y,T,O,U=this._getClasses(),L=this._getAttrCfgs();for(Y=U.length-1;Y>=0;Y--){W=U[Y];X=W.prototype;if(W._yuibuild&&W._yuibuild.exts&&!W._yuibuild.dynamic){for(T=0,O=W._yuibuild.exts.length;T<O;T++){W._yuibuild.exts[T].apply(this,arguments);}}this.addAttrs(this._filterAttrCfgs(W,L),V,S);if(X.hasOwnProperty(C)){X.initializer.apply(this,arguments);}}},_destroyHierarchy:function(){var U,O,T,L,S=this._getClasses();for(T=0,L=S.length;T<L;T++){U=S[T];O=U.prototype;if(O.hasOwnProperty(N)){O.destructor.apply(this,arguments);}}},toString:function(){return this.constructor.NAME+"["+A.stamp(this)+"]";}};A.mix(E,A.Attribute,false,null,1);A.mix(E,D,false,null,1);E.plug=D.plug;E.unplug=D.unplug;E.prototype.constructor=E;A.Base=E;},"3.0.0b1",{requires:["attribute"]});YUI.add("base-build",function(C){var B=C.Base,A=C.Lang;B._buildCfg={aggregates:["ATTRS","_PLUG","_UNPLUG"]};B.build=function(D,I,M,L){var O=B.build,E=O._getClass(I,L),K=O._getAggregates(I,L),G=E._yuibuild.dynamic,J,H,F,N;if(G){if(K){for(J=0,H=K.length;J<H;++J){F=K[J];if(I.hasOwnProperty(F)){E[F]=A.isArray(I[F])?[]:{};}}C.aggregate(E,I,true,K);}}for(J=0,H=M.length;J<H;J++){N=M[J];if(K){C.aggregate(E,N,true,K);}C.mix(E,N,true,null,1);E._yuibuild.exts.push(N);}E.prototype.hasImpl=O._hasImpl;if(G){E.NAME=D;E.prototype.constructor=E;}return E;};C.mix(B.build,{_template:function(D){function E(){E.superclass.constructor.apply(this,arguments);var H=E._yuibuild.exts,F=H.length,G;for(G=0;G<F;G++){H[G].apply(this,arguments);}return this;}C.extend(E,D);return E;},_hasImpl:function(E){if(this.constructor._yuibuild){var G=this.constructor._yuibuild.exts,D=G.length,F;for(F=0;F<D;F++){if(G[F]===E){return true;}}}return false;},_getClass:function(D,E){var F=(E&&false===E.dynamic)?false:true,G=(F)?B.build._template(D):D;G._yuibuild={id:null,exts:[],dynamic:F};return G;},_getAggregates:function(D,E){var F=[],H=(E&&E.aggregates),I=D,G;while(I&&I.prototype){G=I._buildCfg&&I._buildCfg.aggregates;if(G){F=F.concat(G);}I=I.superclass?I.superclass.constructor:null;}if(H){F=F.concat(H);}return F;}});},"3.0.0b1",{requires:["base-base"]});YUI.add("base",function(A){},"3.0.0b1",{use:["base-base","base-build"]});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("dom-base",function(A){(function(F){var O="nodeType",D="ownerDocument",C="documentElement",B="defaultView",H="parentWindow",K="tagName",L="parentNode",N="firstChild",P="lastChild",J="previousSibling",M="nextSibling",I="contains",E="compareDocumentPosition",G=/<([a-z]+)/i;F.DOM={byId:function(R,Q){Q=Q||F.config.doc;return Q.getElementById(R);},getText:(document.documentElement.textContent!==undefined)?function(R){var Q="";if(R){Q=R.textContent;}return Q||"";}:function(R){var Q="";if(R){Q=R.innerText;}return Q||"";},setText:(document.documentElement.textContent!==undefined)?function(Q,R){if(Q){Q.textContent=R;}}:function(Q,R){if(Q){Q.innerText=R;}},firstChild:function(Q,R){return F.DOM._childBy(Q,null,R);},firstChildByTag:function(R,Q,S){return F.DOM._childBy(R,Q,S);},lastChild:function(Q,R){return F.DOM._childBy(Q,null,R,true);},lastChildByTag:function(R,Q,S){return F.DOM._childBy(R,Q,S,true);},_childrenByTag:function(){if(document[C].children){return function(T,R,U,S){R=(R&&R!=="*")?R.toUpperCase():null;var V=[],Q=U;if(T){if(R&&!F.UA.webkit){V=T.children.tags(R);}else{V=T.children;if(R){Q=function(W){return W[K].toUpperCase()===R&&(!U||U(W));};}}V=F.DOM.filterElementsBy(V,Q);}return V;};}else{return function(S,R,T){R=(R&&R!=="*")?R.toUpperCase():null;var U=[],Q=T;if(S){U=S.childNodes;if(R){Q=function(V){return V[K].toUpperCase()===R&&(!T||T(V));};}U=F.DOM.filterElementsBy(U,Q);}return U;};}}(),children:function(Q,R){return F.DOM._childrenByTag(Q,null,R);},previous:function(Q,S,R){return F.DOM.elementByAxis(Q,J,S,R);},next:function(Q,S,R){return F.DOM.elementByAxis(Q,M,S,R);},ancestor:function(Q,S,R){return F.DOM.elementByAxis(Q,L,S,R);},elementByAxis:function(Q,T,S,R){while(Q&&(Q=Q[T])){if((R||Q[K])&&(!S||S(Q))){return Q;}}return null;},byTag:function(R,S,V){S=S||F.config.doc;var W=S.getElementsByTagName(R),U=[],T,Q;for(T=0,Q=W.length;T<Q;++T){if(!V||V(W[T])){U[U.length]=W[T];}}return U;},firstByTag:function(R,S,V){S=S||F.config.doc;var W=S.getElementsByTagName(R),T=null,U,Q;for(U=0,Q=W.length;U<Q;++U){if(!V||V(W[U])){T=W[U];break;}}return T;},filterElementsBy:function(V,U,T){var R=(T)?null:[],S,Q;for(S=0,Q=V.length;S<Q;++S){if(V[S][K]&&(!U||U(V[S]))){if(T){R=V[S];break;}else{R[R.length]=V[S];}}}return R;},contains:function(R,S){var Q=false;if(!S||!R||!S[O]||!R[O]){Q=false;}else{if(R[I]){if(F.UA.opera||S[O]===1){Q=R[I](S);}else{Q=F.DOM._bruteContains(R,S);}}else{if(R[E]){if(R===S||!!(R[E](S)&16)){Q=true;}}}}return Q;},inDoc:function(Q,R){R=R||Q[D];var S=Q.id;if(!S){S=Q.id=F.guid();}return !!(R.getElementById(S));},insertBefore:function(S,Q){var R=null,T;if(S&&Q&&(T=Q.parentNode)){if(typeof S==="string"){S=F.DOM.create(S);}R=T.insertBefore(S,Q);}else{}return R;},insertAfter:function(R,Q){if(!R||!Q||!Q[L]){return null;}if(typeof R==="string"){R=F.DOM.create(R);}if(Q[M]){return Q[L].insertBefore(R,Q[M]);}else{return Q[L].appendChild(R);}},create:function(V,X){V=F.Lang.trim(V);if(!X&&F.DOM._cloneCache[V]){return F.DOM._cloneCache[V].cloneNode(true);}X=X||F.config.doc;var R=G.exec(V),U=F.DOM._create,W=F.DOM.creators,T=null,Q,S;if(R&&W[R[1]]){if(typeof W[R[1]]==="function"){U=W[R[1]];}else{Q=W[R[1]];}}S=U(V,X,Q).childNodes;if(S.length===1){T=S[0].parentNode.removeChild(S[0]);}else{T=X.createDocumentFragment();while(S.length){T.appendChild(S[0]);}}F.DOM._cloneCache[V]=T.cloneNode(true);return T;},CUSTOM_ATTRIBUTES:(!document.documentElement.hasAttribute)?{"for":"htmlFor","class":"className"}:{"htmlFor":"for","className":"class"},setAttribute:function(R,Q,S){if(R&&R.setAttribute){Q=F.DOM.CUSTOM_ATTRIBUTES[Q]||Q;R.setAttribute(Q,S);}},getAttribute:function(S,Q){var R="";if(S&&S.getAttribute){Q=F.DOM.CUSTOM_ATTRIBUTES[Q]||Q;R=S.getAttribute(Q,2);if(R===null){R="";}}return R;},srcIndex:(document.documentElement.sourceIndex)?function(Q){return(Q&&Q.sourceIndex)?Q.sourceIndex:null;}:function(Q){return(Q&&Q[D])?[].indexOf.call(Q[D].getElementsByTagName("*"),Q):null;},isWindow:function(Q){return Q.alert&&Q.document;},_fragClones:{div:document.createElement("div")},_create:function(R,S,Q){Q=Q||"div";var T=F.DOM._fragClones[Q];if(T){T=T.cloneNode(false);}else{T=F.DOM._fragClones[Q]=S.createElement(Q);}T.innerHTML=R;return T;},_removeChildNodes:function(Q){while(Q.firstChild){Q.removeChild(Q.firstChild);}},_cloneCache:{},addHTML:function(T,S,Q){if(typeof S==="string"){S=F.Lang.trim(S);}var R=F.DOM._cloneCache[S];if(R){R=R.cloneNode(true);}else{if(S.nodeType){R=S;}else{R=F.DOM.create(S);}}if(Q){if(Q.nodeType){Q.parentNode.insertBefore(R,Q);}else{switch(Q){case"replace":while(T.firstChild){T.removeChild(T.firstChild);}T.appendChild(R);break;case"before":T.parentNode.insertBefore(R,T);break;case"after":if(T.nextSibling){T.parentNode.insertBefore(R,T.nextSibling);}else{T.parentNode.appendChild(R);}break;default:T.appendChild(R);}}}else{T.appendChild(R);}return R;},VALUE_SETTERS:{},VALUE_GETTERS:{},getValue:function(S){var R="",Q;if(S&&S[K]){Q=F.DOM.VALUE_GETTERS[S[K].toLowerCase()];if(Q){R=Q(S);}else{R=S.value;}}return(typeof R==="string")?R:"";},setValue:function(Q,R){var S;if(Q&&Q[K]){S=F.DOM.VALUE_SETTERS[Q[K].toLowerCase()];if(S){S(Q,R);}else{Q.value=R;}}},_stripScripts:function(T){var Q=T.getElementsByTagName("script"),S,R;for(S=0,R;R=Q[S++];){R.parentNode.removeChild(R);}},_execScripts:function(Q,U){var S,T,R;U=U||0;for(T=U,R;R=Q[T++];){S=R.ownerDocument.createElement("script");R.parentNode.replaceChild(S,R);if(R.text){S.text=R.text;}else{if(R.src){S.src=R.src;if(typeof S.onreadystatechange!=="undefined"){S.onreadystatechange=function(){if(/loaded|complete/.test(R.readyState)){event.srcElement.onreadystatechange=null;setTimeout(function(){F.DOM._execScripts(Q,T++);},0);}};}else{S.onload=function(V){V.target.onload=null;F.DOM._execScripts(Q,T++);};}return;}}}},_bruteContains:function(Q,R){while(R){if(Q===R){return true;}R=R.parentNode;}return false;},_getRegExp:function(R,Q){Q=Q||"";F.DOM._regexCache=F.DOM._regexCache||{};if(!F.DOM._regexCache[R+Q]){F.DOM._regexCache[R+Q]=new RegExp(R,Q);}return F.DOM._regexCache[R+Q];
},_getDoc:function(Q){Q=Q||{};return(Q[O]===9)?Q:Q[D]||Q.document||F.config.doc;},_getWin:function(Q){var R=F.DOM._getDoc(Q);return R[B]||R[H]||F.config.win;},_childBy:function(U,Q,W,S){var T=null,R,V;if(U){if(S){R=U[P];V=J;}else{R=U[N];V=M;}if(F.DOM._testElement(R,Q,W)){T=R;}else{T=F.DOM.elementByAxis(R,V,W);}}return T;},_batch:function(T,X,W,S,R,V){X=(typeof name==="string")?F.DOM[X]:X;var Q,U=[];if(X&&T){F.each(T,function(Y){if((Q=X.call(F.DOM,Y,W,S,R,V))!==undefined){U[U.length]=Q;}});}return U.length?U:T;},_testElement:function(R,Q,S){Q=(Q&&Q!=="*")?Q.toUpperCase():null;return(R&&R[K]&&(!Q||R[K].toUpperCase()===Q)&&(!S||S(R)));},creators:{},_IESimpleCreate:function(Q,R){R=R||F.config.doc;return R.createElement(Q);}};(function(U){var V=U.DOM.creators,Q=U.DOM.create,T=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,S="<table>",R="</table>";if(U.UA.gecko||U.UA.ie){U.mix(V,{option:function(W,X){return Q("<select>"+W+"</select>",X);},tr:function(W,X){return Q("<tbody>"+W+"</tbody>",X);},td:function(W,X){return Q("<tr>"+W+"</tr>",X);},tbody:function(W,X){return Q(S+W+R,X);},legend:"fieldset"});V.col=V.tbody;}if(U.UA.ie){U.mix(V,{tbody:function(X,Y){var Z=Q(S+X+R,Y),W=Z.children.tags("tbody")[0];if(Z.children.length>1&&W&&!T.test(X)){W[L].removeChild(W);}return Z;},script:function(W,X){var Y=X.createElement("div");Y.innerHTML="-"+W;Y.removeChild(Y[N]);return Y;}},true);U.mix(U.DOM.VALUE_GETTERS,{button:function(W){return(W.attributes&&W.attributes.value)?W.attributes.value.value:"";}});U.mix(U.DOM.VALUE_SETTERS,{button:function(X,Y){var W=X.attributes.value;if(!W){W=X[D].createAttribute("value");X.setAttributeNode(W);}W.value=Y;}});}if(U.UA.gecko||U.UA.ie){U.mix(V,{th:V.td,thead:V.tbody,tfoot:V.tbody,caption:V.tbody,colgroup:V.tbody,col:V.tbody,optgroup:V.option});}U.mix(U.DOM.VALUE_GETTERS,{option:function(X){var W=X.attributes;return(W.value&&W.value.specified)?X.value:X.text;},select:function(X){var Y=X.value,W=X.options;if(W&&Y===""){if(X.multiple){}else{Y=U.DOM.getValue(W[X.selectedIndex],"value");}}return Y;}});})(F);})(A);A.mix(A.DOM,{hasClass:function(D,C){var B=A.DOM._getRegExp("(?:^|\\s+)"+C+"(?:\\s+|$)");return B.test(D.className);},addClass:function(C,B){if(!A.DOM.hasClass(C,B)){C.className=A.Lang.trim([C.className,B].join(" "));}},removeClass:function(C,B){if(B&&A.DOM.hasClass(C,B)){C.className=A.Lang.trim(C.className.replace(A.DOM._getRegExp("(?:^|\\s+)"+B+"(?:\\s+|$)")," "));if(A.DOM.hasClass(C,B)){A.DOM.removeClass(C,B);}}},replaceClass:function(C,B,D){A.DOM.addClass(C,D);A.DOM.removeClass(C,B);},toggleClass:function(C,B){if(A.DOM.hasClass(C,B)){A.DOM.removeClass(C,B);}else{A.DOM.addClass(C,B);}}});},"3.0.0b1",{requires:["event"],skinnable:false});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(E){var D="toString",B=parseInt,C=RegExp;E.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(F){if(!E.Color.re_RGB.test(F)){F=E.Color.toHex(F);}if(E.Color.re_hex.exec(F)){F="rgb("+[B(C.$1,16),B(C.$2,16),B(C.$3,16)].join(", ")+")";}return F;},toHex:function(I){I=E.Color.KEYWORDS[I]||I;if(E.Color.re_RGB.exec(I)){var H=(C.$1.length===1)?"0"+C.$1:Number(C.$1),G=(C.$2.length===1)?"0"+C.$2:Number(C.$2),F=(C.$3.length===1)?"0"+C.$3:Number(C.$3);I=[H[D](16),G[D](16),F[D](16)].join("");}if(I.length<6){I=I.replace(E.Color.re_hex3,"$1$1");}if(I!=="transparent"&&I.indexOf("#")<0){I="#"+I;}return I.toLowerCase();}};})(A);(function(E){var C="clientTop",J="clientLeft",Z="hasLayout",L="px",M="filter",B="filters",V="opacity",N="auto",K="borderTopWidth",R="borderRightWidth",X="borderBottomWidth",H="borderLeftWidth",I="width",P="height",S="transparent",U="visible",D="getComputedStyle",b=undefined,a=document.documentElement,T=/^width|height$/,Q=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,F=function(Y){return Y.currentStyle||Y.style;},O={CUSTOM_STYLES:{},get:function(Y,d){var c="",e;if(Y){e=F(Y)[d];if(d===V){c=E.DOM.CUSTOM_STYLES[V].get(Y);}else{if(!e||(e.indexOf&&e.indexOf(L)>-1)){c=e;}else{if(E.DOM.IE.COMPUTED[d]){c=E.DOM.IE.COMPUTED[d](Y,d);}else{if(Q.test(e)){c=O.getPixel(Y,d)+L;}else{c=e;}}}}}return c;},getOffset:function(d,i){var f=F(d)[i],Y=i.charAt(0).toUpperCase()+i.substr(1),g="offset"+Y,c="pixel"+Y,h,e="";if(f===N){h=d[g];if(h===b){e=0;}e=h;if(T.test(i)){d.style[i]=h;if(d[g]>h){e=h-(d[g]-h);}d.style[i]=N;}}else{if(f.indexOf("%")>-1){f=d.clientWidth-O.getPixel(d,"paddingRight")-O.getPixel(d,"paddingLeft");}if(!d.style[c]&&!d.style[i]){d.style[i]=f;}e=d.style[c];}return e+L;},getBorderWidth:function(Y,d){var c=null;
if(!Y.currentStyle||!Y.currentStyle[Z]){Y.style.zoom=1;}switch(d){case K:c=Y[C];break;case X:c=Y.offsetHeight-Y.clientHeight-Y[C];break;case H:c=Y[J];break;case R:c=Y.offsetWidth-Y.clientWidth-Y[J];break;}return c+L;},getPixel:function(d,Y){var f=null,c=F(d),g=c.right,e=c[Y];d.style.right=e;f=d.style.pixelRight;d.style.right=g;return f;},getMargin:function(d,Y){var e,c=F(d);if(c[Y]==N){e=0;}else{e=O.getPixel(d,Y);}return e+L;},getVisibility:function(c,Y){var d;while((d=c.currentStyle)&&d[Y]=="inherit"){c=c.parentNode;}return(d)?d[Y]:U;},getColor:function(c,Y){var d=F(c)[Y];if(!d||d===S){E.DOM.elementByAxis(c,"parentNode",null,function(e){d=F(e)[Y];if(d&&d!==S){c=e;return true;}});}return E.Color.toRGB(d);},getBorderColor:function(c,Y){var d=F(c),e=d[Y]||d.color;return E.Color.toRGB(E.Color.toHex(e));}},G={};if(a.style[V]===b&&a[B]){E.DOM.CUSTOM_STYLES[V]={get:function(c){var f=100;try{f=c[B]["DXImageTransform.Microsoft.Alpha"][V];}catch(d){try{f=c[B]("alpha")[V];}catch(Y){}}return f/100;},set:function(c,f,Y){var e,d;if(f===""){d=F(c);e=(V in d)?d[V]:1;f=e;}if(typeof Y[M]=="string"){Y[M]="alpha("+V+"="+f*100+")";if(!c.currentStyle||!c.currentStyle[Z]){Y.zoom=1;}}}};}try{document.createElement("div").style.height="-1px";}catch(W){E.DOM.CUSTOM_STYLES.height={set:function(c,d,Y){if(parseInt(d,10)>=0){Y.height=d;}else{}}};E.DOM.CUSTOM_STYLES.width={set:function(c,d,Y){if(parseInt(d,10)>=0){Y.width=d;}else{}}};}G[I]=G[P]=O.getOffset;G.color=G.backgroundColor=O.getColor;G[K]=G[R]=G[X]=G[H]=O.getBorderWidth;G.marginTop=G.marginRight=G.marginBottom=G.marginLeft=O.getMargin;G.visibility=O.getVisibility;G.borderColor=G.borderTopColor=G.borderRightColor=G.borderBottomColor=G.borderLeftColor=O.getBorderColor;if(!E.config.win[D]){E.DOM[D]=O.get;}E.namespace("DOM.IE");E.DOM.IE.COMPUTED=G;E.DOM.IE.ComputedStyle=O;})(A);},"3.0.0b1",{skinnable:false,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.0b1",{requires:["dom-base","dom-style"],skinnable:false});YUI.add("selector-native",function(A){(function(C){C.namespace("Selector");var B={_reLead:/^\s*([>+~]|:self)/,_reUnSupported:/!./,_foundCache:[],_supportsNative:function(){return((C.UA.ie>=8||C.UA.webkit>525)&&document.querySelectorAll);},_toArray:function(E){var F=E,G,D;if(!E.slice){try{F=Array.prototype.slice.call(E);}catch(H){F=[];for(G=0,D=E.length;G<D;++G){F[G]=E[G];}}}return F;},_clearFoundCache:function(){var G=B._foundCache,E,D;for(E=0,D=G.length;E<D;++E){try{delete G[E]._found;}catch(F){G[E].removeAttribute("_found");}}G=[];},_sort:function(D){if(D){D=B._toArray(D);if(D.sort){D.sort(function(F,E){return C.DOM.srcIndex(F)-C.DOM.srcIndex(E);});}}return D;},_deDupe:function(E){var F=[],D=B._foundCache,G,H;for(G=0,H;H=E[G++];){if(!H._found){F[F.length]=D[D.length]=H;H._found=true;}}B._clearFoundCache();return F;},_prepQuery:function(G,F){var E=F.split(","),H=[],J=(G&&G.nodeType===9),I,D;if(G){if(!J){G.id=G.id||C.guid();for(I=0,D=E.length;I<D;++I){F="#"+G.id+" "+E[I];H.push({root:G.ownerDocument,selector:F});}}else{H.push({root:G,selector:F});}}return H;},_query:function(D,K,L){if(B._reUnSupported.test(D)){return C.Selector._brute.query(D,K,L);}var H=L?null:[],I=L?"querySelector":"querySelectorAll",M,F,E,J;K=K||C.config.doc;if(D){F=B._prepQuery(K,D);H=[];for(E=0,J;J=F[E++];){try{M=J.root[I](J.selector);if(I==="querySelectorAll"){M=B._toArray(M);}H=H.concat(M);}catch(G){}}if(F.length>1){H=B._sort(B._deDupe(H));}H=(!L)?H:H[0]||null;}return H;},_filter:function(E,D){var F=[],G,H;if(E&&D){for(G=0,H;(H=E[G++]);){if(C.Selector._test(H,D)){F[F.length]=H;}}}else{}return F;},_test:function(I,E){var F=false,D=E.split(","),H,G,J;if(I&&I.tagName){I.id=I.id||C.guid();for(G=0,J;J=D[G++];){J+="#"+I.id;H=C.Selector.query(J,null,true);F=(H===I);if(F){break;}}}return F;}};if(C.UA.ie&&C.UA.ie<=8){B._reUnSupported=/:(?:nth|not|root|only|checked|first|last|empty)/;}C.mix(C.Selector,B,true);if(B._supportsNative()){C.Selector.query=B._query;}C.Selector.test=B._test;C.Selector.filter=B._filter;})(A);},"3.0.0b1",{requires:["dom-base"],skinnable:false});YUI.add("selector-css2",function(C){var J="parentNode",I="tagName",E="attributes",F="combinator",D="pseudos",G="previous",H="previousSibling",B=[],A=C.Selector,K={SORT_RESULTS:true,_children:function(N){var L=N.children,M,O;if(!L&&N[I]){L=[];for(M=0,O;O=N.childNodes[M++];){if(O.tagName){L[L.length]=O;}}B[B.length]=N;N.children=L;}return L||[];},_regexCache:{},_re:{attr:/(\[.*\])/g,urls:/^(?:href|src)/},shorthand:{"\\#(-?[_a-z]+[-\\w]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w]*)":"[className~=$1]"},operators:{"":function(M,L){return C.DOM.getAttribute(M,L[0])!=="";},"=":"^{val}$","~=":"(?:^|\\s+){val}(?:\\s+|$)","|=":"^{val}-?"},pseudos:{"first-child":function(L){return C.Selector._children(L[J])[0]===L;}},_brute:{query:function(L,M,O){var N=[];if(L){N=A._query(L,M,O);}A._cleanup();return(O)?(N[0]||null):N;}},_cleanup:function(){for(var L=0,M;M=B[L++];){delete M.children;}B=[];},_query:function(P,U,V,N){var S=[],M=P.split(","),L=[],T,O,Q,R;if(M.length>1){for(Q=0,R=M.length;Q<R;++Q){S=S.concat(arguments.callee(M[Q],U,V,true));}S=A.SORT_RESULTS?A._sort(S):S;A._clearFoundCache();}else{U=U||C.config.doc;if(U.nodeType!==9){if(!U.id){U.id=C.guid();}if(U.ownerDocument.getElementById(U.id)){P="#"+U.id+" "+P;U=U.ownerDocument;}}T=A._tokenize(P,U);O=T.pop();if(O){if(N){O.deDupe=true;}if(T[0]&&T[0].id&&U.nodeType===9&&U.getElementById(T[0].id)){U=U.getElementById(T[0].id);}if(U&&!L.length&&O.prefilter){L=O.prefilter(U,O);}if(L.length){if(V){C.Array.some(L,A._testToken,O);}else{C.Array.each(L,A._testToken,O);}}S=O.result;}}return S;},_testToken:function(M,Q,L,N){N=N||this;var U=N.tag,P=N[G],V=N.result,O=0,T=P&&P[F]?A.combinators[P[F]]:null,S,R;if((U==="*"||U===M[I])&&!(N.last&&M._found)){while((R=N.tests[O])){O++;S=R.test;if(S.test){if(!S.test(C.DOM.getAttribute(M,R.name))){return false;}}else{if(!S(M,R.match)){return false;}}}if(T&&!T(M,N)){return false;}if(N.root&&N.root.nodeType!==9&&!C.DOM.contains(N.root,M)){return false;}V[V.length]=M;if(N.deDupe&&N.last){M._found=true;A._foundCache.push(M);}return true;}return false;},_getRegExp:function(N,L){var M=A._regexCache;L=L||"";if(!M[N+L]){M[N+L]=new RegExp(N,L);}return M[N+L];},combinators:{" ":function(N,L){var O=A._testToken,M=L[G];while((N=N[J])){if(O(N,null,null,M)){return true;}}return false;},">":function(M,L){return A._testToken(M[J],null,null,L[G]);},"+":function(N,M){var L=N[H];while(L&&L.nodeType!==1){L=L[H];}if(L&&C.Selector._testToken(L,null,null,M[G])){return true;}return false;}},_parsers:[{name:I,re:/^((?:-?[_a-z]+[\w-]*)|\*)/i,fn:function(M,L){M.tag=L[1].toUpperCase();M.prefilter=function(N){return N.getElementsByTagName(M.tag);};return true;}},{name:E,re:/^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,fn:function(N,M){var O=M[3],L=!(M[2]&&O)?"":M[2],P=A.operators[L];if(typeof P==="string"){P=A._getRegExp(P.replace("{val}",O));}if(M[1]==="id"&&O){N.id=O;N.prefilter=function(Q){var S=Q.nodeType===9?Q:Q.ownerDocument,R=S.getElementById(O);return R?[R]:[];};}else{if(document.documentElement.getElementsByClassName&&M[1].indexOf("class")===0){if(!N.prefilter){N.prefilter=function(Q){return Q.getElementsByClassName(O);};P=true;}}}return P;}},{name:F,re:/^\s*([>+~]|\s)\s*/,fn:function(M,L){M[F]=L[1];return !!A.combinators[M[F]];}},{name:D,re:/^:([\-\w]+)(?:\(['"]?(.+)['"]?\))*/i,fn:function(M,L){return A[D][L[1]];}}],_getToken:function(L){return{previous:L,combinator:" ",tag:"*",prefilter:function(M){return M.getElementsByTagName("*");
},tests:[],result:[]};},_tokenize:function(N,T){N=N||"";N=A._replaceShorthand(C.Lang.trim(N));var M=A._getToken(),S=N,R=[],U=false,Q,P,O,L;outer:do{U=false;for(O=0,L;L=A._parsers[O++];){if((P=L.re.exec(N))){Q=L.fn(M,P);if(Q){if(Q!==true){M.tests.push({name:P[1],test:Q,match:P.slice(1)});}U=true;N=N.replace(P[0],"");if(!N.length||L.name===F){M.root=T;R.push(M);M=A._getToken(M);}}else{U=false;break outer;}}}}while(U&&N.length);if(!U||N.length){R=[];}else{if(R.length){R[R.length-1].last=true;}}return R;},_replaceShorthand:function(M){var N=A.shorthand,O=M.match(A._re.attr),Q,P,L;if(O){M=M.replace(A._re.attr,"REPLACED_ATTRIBUTE");}for(Q in N){if(N.hasOwnProperty(Q)){M=M.replace(A._getRegExp(Q,"gi"),N[Q]);}}if(O){for(P=0,L=O.length;P<L;++P){M=M.replace("REPLACED_ATTRIBUTE",O[P]);}}return M;}};C.mix(C.Selector,K,true);if(!C.Selector._supportsNative()){C.Selector.query=A._brute.query;}},"3.0.0b1",{requires:["dom-base","selector-native"],skinnable:false});YUI.add("dom",function(A){},"3.0.0b1",{skinnable:false,use:["dom-base","dom-style","dom-screen","selector-native","selector-css2"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("node-base",function(E){var P={},M={},H={},K=Array.prototype.slice,J=".",F="nodeName",N="nodeType",B="ownerDocument",L="tagName",D="_yuid",G=E.Base,C=E.Base.prototype,I=function(S,Q){var R=null;this[D]=E.stamp(S);if(!this[D]){this[D]=E.guid();}P[this[D]]=S;I._instances[this[D]]=this;if(Q){R={restricted:Q};H[this[D]]=true;}this._lazyAttrInit=true;this._silentInit=true;G.call(this,R);},O=function(R){var Q=null;if(R){Q=(typeof R==="string")?function(S){return E.Selector.test(S,R);}:function(S){return R(I.get(S));};}return Q;};I.NAME="Node";I.DOM_EVENTS={abort: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,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};E.mix(I.DOM_EVENTS,E.Env.evt.plugins);I._instances={};I.plug=function(){var Q=K.call(arguments,0);Q.unshift(I);E.Base.plug.apply(E.Base,Q);return I;};I.unplug=function(){var Q=K.call(arguments,0);Q.unshift(I);E.Base.unplug.apply(E.Base,Q);return I;};I.getDOMNode=function(Q){if(Q){if(Q instanceof I){Q=P[Q[D]];}else{if(!Q[F]||E.DOM.isWindow(Q)){Q=null;}}}return Q||null;};I.scrubVal=function(T,R,S){if(R&&T){if(typeof T==="object"||typeof T==="function"){if(N in T||E.DOM.isWindow(T)){if(H[R[D]]&&!R.contains(T)){T=null;}else{T=I.get(T);}}else{if(T.item||(T[0]&&T[0][N])){T=E.all(T);}else{S=(S===undefined)?4:S;if(S>0){for(var Q in T){if(T.hasOwnProperty&&T.hasOwnProperty(Q)){T[Q]=I.scrubVal(T[Q],R,--S);}}}}}}}else{if(T===undefined){T=R;}}return T;};I.addMethod=function(Q,S,R){if(Q&&S&&typeof S==="function"){I.prototype[Q]=function(){R=R||this;var U=K.call(arguments),T;if(U[0]&&U[0] instanceof I){U[0]=I.getDOMNode(U[0]);}if(U[1]&&U[1] instanceof I){U[1]=I.getDOMNode(U[1]);}U.unshift(P[this[D]]);T=I.scrubVal(S.apply(R,U),this);return T;};}else{}};I.importMethod=function(S,Q,R){if(typeof Q==="string"){R=R||Q;I.addMethod(R,S[Q],S);}else{E.each(Q,function(T){I.importMethod(S,T);});}};I.get=function(S,T,R){var Q=null;if(typeof S==="string"){if(S.indexOf("doc")===0){S=E.config.doc;}else{if(S.indexOf("win")===0){S=E.config.win;}else{S=E.Selector.query(S,T,true);}}}if(S){Q=I._instances[S[D]];if(!Q){Q=new I(S,R);}else{if(R){H[Q[D]]=true;Q._set("restricted",true);}}}return Q;};I.create=function(){return I.get(E.DOM.create.apply(E.DOM,arguments));};I.ATTRS={text:{getter:function(){return E.DOM.getText(P[this[D]]);},setter:function(Q){E.DOM.setText(P[this[D]],Q);return Q;}},"options":{getter:function(){return this.getElementsByTagName("option");}},"children":{getter:function(){var T=P[this[D]],S=T.children,U,R,Q;if(S===undefined){U=T.childNodes;S=[];for(R=0,Q=U.length;R<Q;++R){if(U[R][L]){S[S.length]=U[R];}}}return E.all(S);}},value:{getter:function(){return E.DOM.getValue(P[this[D]]);},setter:function(Q){E.DOM.setValue(P[this[D]],Q);return Q;}},restricted:{writeOnce:true,value:false}};I.DEFAULT_SETTER=function(Q,S){var R=P[this[D]],T;if(Q.indexOf(J)>-1){T=Q;Q=Q.split(J);E.Object.setValue(R,Q,S);}else{if(R[Q]!==undefined){R[Q]=S;}}return S;};I.DEFAULT_GETTER=function(Q){var R=P[this[D]],S;if(Q.indexOf&&Q.indexOf(J)>-1){S=E.Object.getValue(R,Q.split(J));}else{S=R[Q];}return S?E.Node.scrubVal(S,this):S;};E.extend(I,E.Base);E.mix(I.prototype,{toString:function(){var S="",R=this[D]+": not bound to a node",Q=P[this[D]];if(Q){S+=Q[F];if(Q.id){S+="#"+Q.id;}if(Q.className){S+="."+Q.className.replace(" ",".");}S+=" "+this[D];}return S||R;},_addDOMAttr:function(Q){var R=P[this[D]];if(R&&R[Q]!==undefined){this.addAttr(Q,{getter:function(){return I.DEFAULT_GETTER.call(this,Q);},setter:function(S){return I.DEFAULT_SETTER.call(this,Q,S);}});}else{}},get:function(Q){if(!this.attrAdded(Q)){if(I.re_aria&&I.re_aria.test(Q)){this._addAriaAttr(Q);}else{return I.DEFAULT_GETTER.apply(this,arguments);}}return C.get.apply(this,arguments);},set:function(Q,R){if(!this.attrAdded(Q)){if(I.re_aria&&I.re_aria.test(Q)){this._addAriaAttr(Q);}else{if(Q.indexOf(J)<0&&this._yuievt.events["Node:"+Q+"Change"]){this._addDOMAttr(Q);}else{I.DEFAULT_SETTER.call(this,Q,R);return this;}}}C.set.apply(this,arguments);return this;},create:I.create,compareTo:function(Q){var R=P[this[D]];if(Q instanceof E.Node){Q=E.Node.getDOMNode(Q);}return R===Q;},inDoc:function(R){var Q=P[this[D]];R=(R)?I.getDOMNode(R):Q[B];if(R.documentElement){return E.DOM.contains(R.documentElement,Q);}},getById:function(S){var R=P[this[D]],Q=E.DOM.byId(S,R[B]);if(Q&&E.DOM.contains(R,Q)){Q=E.get(Q);}else{Q=null;}return Q;},ancestor:function(Q){return I.get(E.DOM.elementByAxis(P[this[D]],"parentNode",O(Q)));},previous:function(R,Q){return I.get(E.DOM.elementByAxis(P[this[D]],"previousSibling",O(R),Q));},next:function(S,R,Q){return I.get(E.DOM.elementByAxis(P[this[D]],"nextSibling",O(R),Q));},query:function(Q){return E.get(E.Selector.query(Q,P[this[D]],true));},queryAll:function(Q){return E.all(E.Selector.query(Q,P[this[D]]));},test:function(Q){return E.Selector.test(P[this[D]],Q);},remove:function(){var Q=P[this[D]];Q.parentNode.removeChild(Q);return this;},invoke:function(X,R,Q,W,V,U){var T=P[this[D]],S;if(R&&R instanceof E.Node){R=I.getDOMNode(R);}if(Q&&Q instanceof E.Node){Q=I.getDOMNode(Q);}S=T[X](R,Q,W,V,U);return E.Node.scrubVal(S,this);},destructor:function(){},each:function(R,Q){Q=Q||this;return R.call(Q,this);},item:function(Q){return this;},size:function(){return P[this[D]]?1:0;},insert:function(R,Q){if(R){if(typeof Q==="number"){Q=P[this[D]].childNodes[Q];}if(typeof R!=="string"){R=E.Node.getDOMNode(R);}if(!Q||(!H[this[D]]||(typeof Q!=="string"&&this.contains(Q)))){E.DOM.addHTML(P[this[D]],R,Q);}}return this;},prepend:function(Q){return this.insert(Q,0);},append:function(Q){return this.insert(Q,null);},setContent:function(Q){E.DOM.addHTML(P[this[D]],Q,"replace");
return this;},hasMethod:function(R){var Q=P[this[D]];return(Q&&(typeof Q==="function"));}},true);E.Node=I;E.get=E.Node.get;E.Array._diff=function(R,Q){var V=[],X=false,T,S,W,U;outer:for(T=0,W=R.length;T<W;T++){X=false;for(S=0,U=Q.length;S<U;S++){if(R[T]===Q[S]){X=true;continue outer;}}if(!X){V[V.length]=R[T];}}return V;};E.Array.diff=function(R,Q){return{added:E.Array._diff(Q,R),removed:E.Array._diff(R,Q)};};var A=function(R){var S=R.doc||E.config.doc,Q=R.nodes||[];if(typeof Q==="string"){this._query=Q;Q=E.Selector.query(Q,S);}E.stamp(this);A._instances[this[D]]=this;M[this[D]]=Q;if(R.restricted){H=this[D];}};A.NAME="NodeList";A.getDOMNodes=function(Q){return M[Q[D]];};A._instances=[];A.each=function(Q,T,S){var R=M[Q[D]];if(R&&R.length){E.Array.each(R,T,S||Q);}else{}};A.addMethod=function(Q,T,S){var R=A._getTempNode();if(Q&&T){A.prototype[Q]=function(){var V=[],U=arguments;E.Array.each(M[this[D]],function(a){var Z="_yuid",X=E.Node._instances[a[Z]],Y,W;if(!X){P[R[Z]]=a;X=R;}Y=S||X;W=T.apply(Y,U);if(W!==undefined&&W!==X){V[V.length]=W;}});return V.length?V:this;};}else{}};A.importMethod=function(S,Q,R){if(typeof Q==="string"){R=R||Q;A.addMethod(Q,S[Q]);}else{E.each(Q,function(T){A.importMethod(S,T);});}};A._getTempNode=function(){var Q=A._tempNode;if(!Q){Q=E.Node.create("<div></div>");A._tempNode=Q;}return Q;};E.mix(A.prototype,{item:function(Q){return E.get((M[this[D]]||[])[Q]);},each:function(S,R){var Q=this;E.Array.each(M[this[D]],function(U,T){U=E.get(U);return S.call(R||U,U,T,Q);});return Q;},batch:function(S,R){var T=this,Q=A._getTempNode();E.Array.each(M[this[D]],function(W,V){var U=E.Node._instances[W[D]];if(!U){P[Q[D]]=W;U=Q;}return S.call(R||U,U,V,T);});return T;},some:function(S,R){var Q=this;return E.Array.some(M[this[D]],function(U,T){U=E.get(U);R=R||U;return S.call(R,U,T,Q);});},indexOf:function(Q){return E.Array.indexOf(M[this[D]],E.Node.getDOMNode(Q));},filter:function(Q){return E.all(E.Selector.filter(M[this[D]],Q));},modulus:function(S,R){R=R||0;var Q=[];A.each(this,function(U,T){if(T%S===R){Q.push(U);}});return E.all(Q);},odd:function(){return this.modulus(2,1);},even:function(){return this.modulus(2);},destructor:function(){delete A._instances[this[D]];},refresh:function(){var R,Q,S=M[this[D]];if(this._query){if(M[this[D]]&&M[this[D]][0]&&M[this[D]][0].ownerDocument){R=M[this[D]][0].ownerDocument;}M[this[D]]=E.Selector.query(this._query,R||E.config.doc);Q=E.Array.diff(S,M[this[D]]);Q.added=Q.added?E.all(Q.added):null;Q.removed=Q.removed?E.all(Q.removed):null;this.fire("refresh",Q);}return this;},on:function(S,R,Q){Q=Q||this;this.batch(function(T){T.on.call(T,S,R,Q);});},after:function(S,R,Q){Q=Q||this;this.batch(function(T){T.after.call(T,S,R,Q);});},size:function(){return M[this[D]].length;},get:function(R){var Q=[],S=A._getTempNode();A.each(this,function(U){var T=E.Node._instances[U[D]];if(!T){P[S[D]]=U;T=S;}Q[Q.length]=T.get(R);});return Q;},toString:function(){var T="",S=this[D]+": not bound to any nodes",Q=M[this[D]],R;if(Q&&Q[0]){R=Q[0];T+=R[F];if(R.id){T+="#"+R.id;}if(R.className){T+="."+R.className.replace(" ",".");}if(Q.length>1){T+="...["+Q.length+" items]";}}return T||S;}},true);A.importMethod(E.Node.prototype,["append","detach","detachAll","insert","plug","prepend","remove","set","setContent","unplug"]);E.NodeList=A;E.all=function(R,T,Q){var S=new A({nodes:R,doc:T,restricted:Q});return S;};E.Node.all=E.all;E.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(Q){E.Node.prototype[Q]=function(U,S,R){var T=this.invoke(Q,U,S,R);return T;};});I.importMethod(E.DOM,["contains","setAttribute","getAttribute"]);if(!document.documentElement.hasAttribute){E.Node.prototype.hasAttribute=function(Q){return E.DOM.getAttribute(E.Node.getDOMNode(this),Q)!=="";};}E.NodeList.importMethod(E.Node.prototype,["getAttribute","setAttribute"]);(function(){var R=document.createElement("div"),Q="_yuid";E.stamp(R);if(R[Q]===R.cloneNode(true)[Q]){E.Node.prototype.cloneNode=function(S){var T=E.Node.getDOMNode(this).cloneNode(S);T[Q]=E.guid();return E.get(T);};}})();(function(R){var Q=["hasClass","addClass","removeClass","replaceClass","toggleClass"];R.Node.importMethod(R.DOM,Q);R.NodeList.importMethod(R.Node.prototype,Q);})(E);E.Node.prototype.delegate=function(V,U,Q,T){T=T||this;var S=Array.prototype.slice.call(arguments,4),R=["delegate",U,E.Node.getDOMNode(this),V,Q,T];R=R.concat(S);return E.on.apply(E,R);};},"3.0.0b1",{requires:["dom-base","base","selector"]});YUI.add("node-style",function(A){(function(C){var B=["getStyle","getComputedStyle","setStyle","setStyles"];C.Node.importMethod(C.DOM,B);"getComputedStyle","setStyle","setStyles";C.NodeList.importMethod(C.Node.prototype,B);})(A);},"3.0.0b1",{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.0b1",{requires:["dom-screen"]});YUI.add("node-aria",function(A){A.Node.re_aria=/^(?:role$|aria-)/;A.Node.prototype._addAriaAttr=function(B){this.addAttr(B,{getter:function(){return A.Node.getDOMNode(this).getAttribute(B,2);},setter:function(C){A.Node.getDOMNode(this).setAttribute(B,C);return C;}});};},"3.0.0b1",{requires:["node-base"]});YUI.add("node",function(A){},"3.0.0b1",{skinnable:false,use:["node-base","node-style","node-screen","node-aria"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
(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/)){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",function(F){(function(){var I=YUI.Env,G=F.Env.evt.plugins,H=function(){F.fire("domready");};F.mix(G,{domready:{},"event:ready":{on:function(){var J=F.Array(arguments,0,true);J[0]="domready";return F.subscribe.apply(F,J);},detach:function(){var J=F.Array(arguments,0,true);J[0]="domready";return F.unsubscribe.apply(F,J);}}});F.publish("domready",{fireOnce:true});if(I.DOMReady){H();}else{F.before(H,I,"_ready");}})();(function(){var H=F.UA,G={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},I=function(K){if(!K){return null;}try{if(H.webkit&&3==K.nodeType){K=K.parentNode;}}catch(J){}return F.Node.get(K);};F.DOMEventFacade=function(Q,K,J){var M=Q,L=K,N=F.config.doc,R=N.body,S=M.pageX,P=M.pageY,O,T;this.altKey=M.altKey;this.ctrlKey=M.ctrlKey;this.metaKey=M.metaKey;this.shiftKey=M.shiftKey;this.type=M.type;if(!S&&0!==S){S=M.clientX||0;P=M.clientY||0;if(H.ie){S+=Math.max(N.documentElement.scrollLeft,R.scrollLeft);P+=Math.max(N.documentElement.scrollTop,R.scrollTop);}}this._yuifacade=true;this.pageX=S;this.pageY=P;O=M.keyCode||M.charCode||0;if(H.webkit&&(O in G)){O=G[O];}this.keyCode=O;this.charCode=O;this.button=M.which||M.button;this.which=this.button;this.target=I(M.target||M.srcElement);this.currentTarget=I(L);T=M.relatedTarget;if(!T){if(M.type=="mouseout"){T=M.toElement;}else{if(M.type=="mouseover"){T=M.fromElement;}}}this.relatedTarget=I(T);this.stopPropagation=function(){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}if(J){J.stopPropagation();}};this.stopImmediatePropagation=function(){if(M.stopImmediatePropagation){M.stopImmediatePropagation();}else{this.stopPropagation();}if(J){J.stopImmediatePropagation();}};this.preventDefault=function(){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}if(J){J.preventDefault();}};this.halt=function(U){if(U){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){var M=YUI.Env.add,G=YUI.Env.remove,K=function(){YUI.Env.windowLoaded=true;F.Event._load();G(window,"load",K);},J=function(){F.Event._unload();G(window,"unload",J);},N="domready",L="~yui|2|compat~",I=function(P){try{return(P&&typeof P!=="string"&&(P.length&&((!P.size)||(P.size()>1)))&&!P.tagName&&!P.alert&&(P.item||typeof P[0]!=="undefined"));}catch(O){return false;}},H=function(){var Q=false,R=0,P=[],S={},O=null,T={};return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var U=F.Event;if(!U._interval){U._interval=setInterval(F.bind(U._poll,U),U.POLL_INTERVAL);}},onAvailable:function(c,X,b,Z,Y,V){var U=F.Array(c),W;for(W=0;W<U.length;W=W+1){P.push({id:U[W],fn:X,obj:b,override:Z,checkReady:Y,compat:V});}R=this.POLL_RETRYS;setTimeout(F.bind(F.Event._poll,F.Event),0);return new F.EventHandle();},onContentReady:function(Y,V,X,W,U){return this.onAvailable(Y,V,X,W,true,U);},attach:function(W,V,U,X){return F.Event._attach(F.Array(arguments,0,true));},_createWrapper:function(a,Z,U,V,Y){var b=F.stamp(a),X="event:"+b+Z,W;if(false===Y){X+="native";}if(U){X+="capture";}W=S[X];if(!W){W=F.publish(X,{bubbles:false,contextFn:function(){W.nodeRef=W.nodeRef||F.get(W.el);return W.nodeRef;}});W.el=a;W.type=Z;W.fn=function(c){W.fire(F.Event.getEvent(c,a,(V||(false===Y))));};if(a==F.config.win&&Z=="load"){W.fireOnce=true;O=X;}S[X]=W;T[b]=T[b]||{};T[b][X]=W;M(a,Z,W.fn,U);}return W;},_attach:function(a,W){var d=a.slice(1),f,j=F.Event,h,Y,e,U,X=false,Z,b=a[0],c=a[1],V=a[2]||F.config.win,i=W&&W.facade,g=W&&W.capture;if(d[d.length-1]===L){f=true;d.pop();}if(!c||!c.call){return false;}if(I(V)){h=[];F.each(V,function(m,l){a[2]=m;h.push(j._attach(a,W));});return(h.length===1)?h[0]:h;}else{if(F.Lang.isString(V)){Y=(f)?F.DOM.byId(V):F.Selector.query(V);if(Y){if(F.Lang.isArray(Y)){if(Y.length==1){V=Y[0];}else{a[2]=Y;return j._attach(a,W);}}else{V=Y;}}else{return this.onAvailable(V,function(){j._attach(a,W);},j,true,false,f);}}}if(!V){return false;}if(F.Node&&V instanceof F.Node){return V.on.apply(V,a);}e=this._createWrapper(V,b,g,f,i);if(V==F.config.win&&b=="load"){if(YUI.Env.windowLoaded){X=true;}}U=d[2];d[1]=U;d.splice(2,1);Z=e.subscribe.apply(e,d);if(X){e.fire();}return Z;},detach:function(b,d,W,X){var a=F.Array(arguments,0,true),e,Y,Z,c,U,V;if(a[a.length-1]===L){e=true;}if(b&&b.detach){return b.detach();}if(typeof W=="string"){W=(e)?F.DOM.byId(W):F.Selector.query(W);return F.Event.detach.apply(F.Event,a);}else{if(I(W)){c=true;for(Y=0,Z=W.length;Y<Z;++Y){a[2]=W[Y];c=(F.Event.detach.apply(F.Event,a)&&c);}return c;}}if(!b||!d||!d.call){return this.purgeElement(W,false,b);}U="event:"+F.stamp(W)+b;V=S[U];if(V){return V.detach(d);}else{return false;}},getEvent:function(X,V,U){var W=X||window.event;return(U)?W:new F.DOMEventFacade(W,V,S["event:"+F.stamp(V)+X.type]);},generateId:function(U){var V=U.id;if(!V){V=F.stamp(U);U.id=V;}return V;},_isValidCollection:I,_load:function(U){if(!Q){Q=true;if(F.fire){F.fire(N);}F.Event._poll();}},_poll:function(){if(this.locked){return;}if(F.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var Z=!Q,Y,a,V,U,X,W;if(!Z){Z=(R>0);}Y=[];a=function(d,e){var c,b=e.override;if(e.compat){if(e.override){if(b===true){c=e.obj;}else{c=b;}}else{c=d;}e.fn.call(c,e.obj);}else{c=e.obj||F.get(d);e.fn.apply(c,(F.Lang.isArray(b))?b:[]);}};for(V=0,U=P.length;
V<U;++V){X=P[V];if(X&&!X.checkReady){W=(X.compat)?F.DOM.byId(X.id):F.Selector.query(X.id,null,true);if(W){a(W,X);P[V]=null;}else{Y.push(X);}}}for(V=0,U=P.length;V<U;++V){X=P[V];if(X&&X.checkReady){W=(X.compat)?F.DOM.byId(X.id):F.Selector.query(X.id,null,true);if(W){if(Q||(W.get&&W.get("nextSibling"))||W.nextSibling){a(W,X);P[V]=null;}}else{Y.push(X);}}}R=(Y.length===0)?0:R-1;if(Z){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;},purgeElement:function(Z,a,Y){var W=(F.Lang.isString(Z))?F.Selector.query(Z,null,true):Z,V=this.getListeners(W,Y),X,U;if(V){for(X=0,U=V.length;X<U;++X){V[X].detachAll();}}if(a&&W&&W.childNodes){for(X=0,U=W.childNodes.length;X<U;++X){this.purgeElement(W.childNodes[X],a,Y);}}},getListeners:function(Y,X){var Z=F.stamp(Y,true),U=T[Z],W=[],V=(X)?"event:"+Z+X:null;if(!U){return null;}if(V){if(U[V]){W.push(U[V]);}}else{F.each(U,function(b,a){W.push(b);});}return(W.length)?W:null;},_unload:function(V){var U=F.Event;F.each(S,function(X,W){X.detachAll();G(X.el,X.type,X.fn);delete S[W];});G(window,"load",U._load);G(window,"unload",U._unload);},nativeAdd:M,nativeRemove:G};}();F.Event=H;if(F.config.injected||YUI.Env.windowLoaded){K();}else{M(window,"load",K);}if(F.UA.ie){F.on(N,H._poll,H,true);}M(window,"unload",J);H.Custom=F.CustomEvent;H.Subscriber=F.Subscriber;H.Target=F.EventTarget;H.Handle=F.EventHandle;H.Facade=F.EventFacade;H._poll();})();F.Env.evt.plugins.available={on:function(I,H,K,J){var G=arguments.length>4?F.Array(arguments,4,true):[];return F.Event.onAvailable.call(F.Event,K,H,J,G);}};F.Env.evt.plugins.contentready={on:function(I,H,K,J){var G=arguments.length>4?F.Array(arguments,4,true):[];return F.Event.onContentReady.call(F.Event,K,H,J,G);}};(function(){var I=F.Env.evt.plugins,J={capture:true},H=function(){},G=function(L,N){var K=(F.Lang.isString(N))?F.Selector.query(N,null,true):N,M=K&&K.parentNode;if(M){F.Event._attach([L,H,M],J);}};I.focus={on:function(M,L,N){var K=F.Array(arguments,0,true);if(F.UA.opera){G(M,N);}return F.Event._attach(K,J);}};I.blur={on:function(M,L,N){var K=F.Array(arguments,0,true);if(F.UA.opera){G(M,N);}return F.Event._attach(K,J);}};})();F.Env.evt.plugins.key={on:function(J,L,G,P,H){var N=F.Array(arguments,0,true),K,O,M,I;if(!P||P.indexOf(":")==-1){N[0]="keypress";return F.on.apply(F,N);}K=P.split(":");O=K[0];M=(K[1])?K[1].split(/,|\+/):null;I=(F.Lang.isString(G)?G:F.stamp(G))+P;I=I.replace(/,/g,"_");if(!F.getEvent(I)){F.on(J+O,function(U){var V=false,R=false,S,Q,T;for(S=0;S<M.length;S=S+1){Q=M[S];T=parseInt(Q,10);if(F.Lang.isNumber(T)){if(U.charCode===T){V=true;}else{R=true;}}else{if(V||!R){V=(U[Q+"Key"]);R=!V;}}}if(V){F.fire(I,U);}},G);}N.splice(2,2);N[0]=I;return F.on.apply(F,N);}};(function(){var L=F.Lang,J={},I=function(N){try{if(N&&3==N.nodeType){return N.parentNode;}}catch(M){}return N;},H=function(O,U,P){var V=I((U.target||U.srcElement)),Q=J[O],X,R,M,T,N,W,S;for(X in Q){if(Q.hasOwnProperty(X)){R=Q[X];M=F.Selector.query(X,P);T=M.length;if(T>0){S=M.length-1;do{N=M[S];if(N===V||F.DOM.contains(N,V)){if(!W){W=new F.DOMEventFacade(U,P);W.container=W.currentTarget;}W.currentTarget=F.Node.get(N);F.fire(R,W);}}while(S--);}}}},G=function(O,N,M){F.Event._attach([O,function(P){H(N,(P||window.event),M);},M],{facade:false});},K=F.cached(function(M){return M.replace(/[|,:]/g,"~");});F.Env.evt.plugins.delegate={on:function(R,T,O,M,V){if(!V){return false;}var S=(L.isString(O)?O:F.stamp(O)),P="delegate:"+S+M+K(V),N=M+S,U=F.Array(arguments,0,true),Q;if(!(N in J)){if(L.isString(O)){Q=F.Selector.query(O);}else{Q=F.Node.getDOMNode(O);}if(L.isArray(Q)){F.Array.each(Q,function(W){G(M,N,W);});}else{G(M,N,Q);}J[N]={};}J[N][V]=P;U[0]=P;U.splice(2,3);return F.on.apply(F,U);}};})();(function(){var H,G,J="window:resize",I=function(K){if(F.UA.gecko){F.fire(J,K);}else{if(G){G.cancel();}G=F.later(F.config.windowResizeDelay||40,F,function(){F.fire(J,K);});}};F.Env.evt.plugins.windowresize={on:function(M,L){if(!H){H=F.Event._attach(["resize",I]);}var K=F.Array(arguments,0,true);K[0]=J;return F.on.apply(F,K);}};})();var A=F.Lang.isString,C=function(J,G,I,K,H){if(!J.compareTo(G)&&!J.contains(G)){K.container=K.currentTarget;K.currentTarget=J;F.fire(I,K);}},D=function(L,I,H){var G=L.relatedTarget,K=L.currentTarget,J=L.target;if(H){K.queryAll(H).some(function(M){var N;if(M.compareTo(J)||M.contains(J)){C(M,G,I,L,H);N=true;}return N;});}else{C(K,G,I,L);}},E=F.cached(function(G){return G.replace(/[|,:]/g,"~");}),B={on:function(L,K,J,H){var G=(L==="mouseenter")?"mouseover":"mouseout",M=L+":"+(A(J)?J:F.stamp(J))+G,I=F.Array(arguments,0,true),N;if(A(H)){N=H;M=M+E(N);}if(!F.getEvent(M)){F.on(G,function(O){D(O,M,N);},J);}I[0]=M;if(N){I.splice(2,2);}else{I.splice(2,1);}return F.on.apply(F,I);}};F.Env.evt.plugins.mouseenter=B;F.Env.evt.plugins.mouseleave=B;},"3.0.0b1",{requires:["event-custom"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("plugin",function(B){function A(C){A.superclass.constructor.apply(this,arguments);}A.ATTRS={host:{writeOnce:true}};A.NAME="plugin";A.NS="plugin";B.extend(A,B.Base,{_handles:null,initializer:function(C){this._handles=[];},destructor:function(){if(this._handles){for(var D=0,C=this._handles.length;D<C;D++){this._handles[D].detach();}}},doBefore:function(G,D,C){var E=this.get("host"),F;C=C||this;if(G in E){F=B.Do.before(D,E,G,C);}else{if(E.on){F=E.on(G,D,C);}}this._handles.push(F);return F;},doAfter:function(G,D,C){var E=this.get("host"),F;C=C||this;if(G in E){F=B.Do.after(D,E,G,C);}else{if(E.after){F=E.after(G,D,C);}}this._handles.push(F);return F;},toString:function(){return this.constructor.NAME+"["+this.constructor.NS+"]";}});B.namespace("Plugin").Base=A;},"3.0.0b1",{requires:["base"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("cache",function(C){var A=C.Lang,B=function(){B.superclass.constructor.apply(this,arguments);};C.mix(B,{NS:"cache",NAME:"cache",ATTRS:{max:{value:0,validator:function(D){return(A.isNumber(D));},setter:function(E){var D=this._entries;if(E>0){if(D){while(D.length>E){D.shift();}}}else{this._entries=[];}return E;}},size:{readOnly:true,getter:function(){return this._entries.length;}},entries:{readOnly:true,getter:function(){return this._entries;}}}});C.extend(B,C.Plugin.Base,{_entries:null,initializer:function(D){this.publish("add",{defaultFn:this._defAddFn});this.publish("flush",{defaultFn:this._defFlushFn});this._entries=[];},destructor:function(){this._entries=null;},_defAddFn:function(G){var E=this._entries,D=this.get("max"),F=G.entry;while(E.length>=D){E.shift();}E[E.length]=F;},_defFlushFn:function(D){this._entries=[];},_isMatch:function(E,D){return(E===D.request);},add:function(E,D,F){if(this.get("entries")&&(this.get("max")>0)&&(A.isValue(E)||A.isNull(E)||A.isUndefined(E))){this.fire("add",{entry:{request:E,response:D,payload:F}});}else{}},flush:function(){this.fire("flush");},retrieve:function(H){var D=this._entries,G=D.length,F=null,E=G-1;if((this.get("max")>0)&&(G>0)){this.fire("request",{request:H});for(;E>=0;E--){F=D[E];if(this._isMatch(H,F)){this.fire("retrieve",{entry:F});if(E<G-1){D.splice(E,1);D[D.length]=F;}return F;}}}return null;}});C.Cache=B;},"3.0.0b1",{requires:["plugin"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("cookie",function(C){var K=C.Lang,I=C.Object,G=null,D=K.isString,P=K.isObject,F=K.isUndefined,E=K.isFunction,H=encodeURIComponent,B=decodeURIComponent,N=C.config.doc;function J(L){throw new TypeError(L);}function M(L){if(!D(L)||L===""){J("Cookie name must be a non-empty string.");}}function A(L){if(!D(L)||L===""){J("Subcookie name must be a non-empty string.");}}C.Cookie={_createCookieString:function(Q,T,R,O){O=O||{};var V=H(Q)+"="+(R?H(T):T),L=O.expires,U=O.path,S=O.domain;if(P(O)){if(L instanceof Date){V+="; expires="+L.toUTCString();}if(D(U)&&U!==""){V+="; path="+U;}if(D(S)&&S!==""){V+="; domain="+S;}if(O.secure===true){V+="; secure";}}return V;},_createCookieHashString:function(L){if(!P(L)){J("Cookie._createCookieHashString(): Argument must be an object.");}var O=[];I.each(L,function(R,Q){if(!E(R)&&!F(R)){O.push(H(Q)+"="+H(String(R)));}});return O.join("&");},_parseCookieHash:function(S){var R=S.split("&"),T=G,Q={};if(S.length){for(var O=0,L=R.length;O<L;O++){T=R[O].split("=");Q[B(T[0])]=B(T[1]);}}return Q;},_parseCookieString:function(W,Y){var X={};if(D(W)&&W.length>0){var L=(Y===false?function(Z){return Z;}:B),U=W.split(/;\s/g),V=G,O=G,R=G;for(var Q=0,S=U.length;Q<S;Q++){R=U[Q].match(/([^=]+)=/i);if(R instanceof Array){try{V=B(R[1]);O=L(U[Q].substring(R[1].length+1));}catch(T){}}else{V=B(U[Q]);O="";}X[V]=O;}}return X;},exists:function(L){M(L);var O=this._parseCookieString(N.cookie,true);return O.hasOwnProperty(L);},get:function(O,L){M(O);var S,Q,R;if(E(L)){R=L;L={};}else{if(P(L)){R=L.converter;}else{L={};}}S=this._parseCookieString(N.cookie,!L.raw);Q=S[O];if(F(Q)){return G;}if(!E(R)){return Q;}else{return R(Q);}},getSub:function(L,Q,O){var R=this.getSubs(L);if(R!==G){A(Q);if(F(R[Q])){return G;}if(!E(O)){return R[Q];}else{return O(R[Q]);}}else{return G;}},getSubs:function(L){M(L);var O=this._parseCookieString(N.cookie,false);if(D(O[L])){return this._parseCookieHash(O[L]);}return G;},remove:function(O,L){M(O);L=C.merge(L||{},{expires:new Date(0)});return this.set(O,"",L);},removeSub:function(O,S,L){M(O);A(S);L=L||{};var R=this.getSubs(O);if(P(R)&&R.hasOwnProperty(S)){delete R[S];if(!L.removeIfEmpty){return this.setSubs(O,R,L);}else{for(var Q in R){if(R.hasOwnProperty(Q)&&!E(R[Q])&&!F(R[Q])){return this.setSubs(O,R,L);}}return this.remove(O,L);}}else{return"";}},set:function(O,Q,L){M(O);if(F(Q)){J("Cookie.set(): Value cannot be undefined.");}L=L||{};var R=this._createCookieString(O,Q,!L.raw,L);N.cookie=R;return R;},setSub:function(O,R,Q,L){M(O);A(R);if(F(Q)){J("Cookie.setSub(): Subcookie value cannot be undefined.");}var S=this.getSubs(O);if(!P(S)){S={};}S[R]=Q;return this.setSubs(O,S,L);},setSubs:function(O,Q,L){M(O);if(!P(Q)){J("Cookie.setSubs(): Cookie value must be an object.");}var R=this._createCookieString(O,this._createCookieHashString(Q),false,L);N.cookie=R;return R;}};},"3.0.0b1",{requires:["yui-base"]});/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("dump",function(G){var B=G.Lang,C="{...}",F="f(){...}",A=", ",D=" => ",E=function(M,L){var I,H,K=[],J=B.type(M);if(!B.isObject(M)){return M+"";}else{if(J=="date"||("nodeType" in M&&"tagName" in M)){return M;}else{if(J=="function"){return F;}}}L=(B.isNumber(L))?L:3;if(J=="array"){K.push("[");for(I=0,H=M.length;I<H;I=I+1){if(B.isObject(M[I])){K.push((L>0)?B.dump(M[I],L-1):C);}else{K.push(M[I]);}K.push(A);}if(K.length>1){K.pop();}K.push("]");}else{if(J=="regexp"){K.push(M.toString());}else{K.push("{");for(I in M){if(M.hasOwnProperty(I)){K.push(I+D);if(B.isObject(M[I])){K.push((L>0)?B.dump(M[I],L-1):C);}else{K.push(M[I]);}K.push(A);}}if(K.length>1){K.pop();}K.push("}");}}return K.join("");};G.dump=E;B.dump=E;},"3.0.0b1");/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("substitute",function(G){var B=G.Lang,D="dump",F=" ",C="{",E="}",A=function(U,I,P,K,H){var N,M,L,S,R,T,Q=[],J,O;K=K||C;H=H||E;for(;;){N=U.lastIndexOf(K);if(N<0){break;}M=U.indexOf(H,N);if(N+1>=M){break;}J=U.substring(N+1,M);S=J;T=null;L=S.indexOf(F);if(L>-1){T=S.substring(L+1);S=S.substring(0,L);}R=I[S];if(P){R=P(S,R,T);}if(B.isObject(R)){if(!G.dump){R=R.toString();}else{if(B.isArray(R)){R=G.dump(R,parseInt(T,10));}else{T=T||"";O=T.indexOf(D);if(O>-1){T=T.substring(4);}if(R.toString===Object.prototype.toString||O>-1){R=G.dump(R,parseInt(T,10));}else{R=R.toString();}}}}else{if(!B.isString(R)&&!B.isNumber(R)){R="~-"+Q.length+"-~";Q[Q.length]=J;}}U=U.substring(0,N)+R+U.substring(M+1);}for(N=Q.length-1;N>=0;N=N-1){U=U.replace(new RegExp("~-"+N+"-~"),K+Q[N]+H,"g");}return U;};G.substitute=A;B.substitute=A;},"3.0.0b1",{optional:["dump"]});/*
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
*/
YUI.add('history', function(Y) {

/*global YUI */


/**
 * The Browser History Utility provides the ability to use the back/forward
 * navigation buttons in a DHTML application. It also allows a DHTML
 * application to be bookmarked in a specific state.
 *
 * This utility requires the following static markup:
 *
 * &lt;iframe id="yui-history-iframe" src="path-to-real-asset-in-same-domain"&gt;&lt;/iframe&gt;
 * &lt;input id="yui-history-field" type="hidden"&gt;
 *
 * @module history
 */

/**
 * This class represents an instance of the browser history utility.
 * @class History
 * @constructor
 */

        // Shortcuts, etc.
    var win = Y.config.win,
        doc = Y.config.doc,

        encode = encodeURIComponent,
        decode = decodeURIComponent,

        H, G,

        // YUI Compressor helper...
        E_MISSING_OR_INVALID_ARG = 'Missing or invalid argument',

        // Regular expression used to parse query strings and such.
        REGEXP = /([^=&]+)=([^&]*)/g,

        // A few private variables...
        _useIFrame = false,
        _getHash,

        /**
         * @event history:ready
         * @description Fires when the browser history utility is ready
         * @type Event.Custom
         */
        EV_HISTORY_READY = 'history:ready',

        /**
         * @event history:globalStateChange
         * @description Fires when the global state of the page has changed (that is,
         *     when the state of at least one browser history module has changed)
         * @type Event.Custom
         */
        EV_HISTORY_GLOBAL_STATE_CHANGE = 'history:globalStateChange',

        /**
         * @event history:moduleStateChange
         * @description Fires when the state of a history module object has changed
         * @type Event.Custom
         */
        EV_HISTORY_MODULE_STATE_CHANGE = 'history:moduleStateChange';


    if (!YUI.Env.history) {

        YUI.Env.history = G = {

            // Flag used to tell whether the history utility is ready to be used.
            ready: false,

            // List of registered modules.
            _modules: [],

            // INPUT field (with type="hidden" or type="text") or TEXTAREA.
            // This field keeps the value of the initial state, current state
            // the list of all states across pages within a single browser session.
            _stateField: null,

            // Hidden IFrame used to store the browsing history on IE6/7.
            _historyIFrame: null
        };

    }

    /**
     * Returns the portion of the hash after the '#' symbol.
     * @method _getHash
     * @return {string} The hash portion of the document's location
     * @private
     */
    if (Y.UA.gecko) {
        // We branch at runtime for Gecko since window.location.hash in Gecko
        // returns a decoded string, and we want all encoding untouched.
        _getHash = function () {
            var m = /#(.*)$/.exec(win.location.href);
            var str = (m && m[1] ? m[1] : '');
            var i = str.indexOf('=');
            return str.substr(0,i + 1) +  encode(str.substr(i + 1));
        };
    } else {
        _getHash = function () {
            
            var str = win.location.hash.substr(1);
            var i = str.indexOf('=');
            return str.substr(0,i + 1) +  encode(str.substr(i + 1));
        };
    }

    /**
     * Stores the initial state and current state for all registered modules
     * in the (hidden) form field specified during initialization.
     * @method _storeStates
     * @private
     */
    function _storeStates() {
        var initialStates = [], currentStates = [];

        Y.Object.each(G._modules, function (module, moduleId) {
            initialStates.push(moduleId + '=' + module.initialState);
            currentStates.push(moduleId + '=' + module.currentState);
        });

        G._stateField.set('value', initialStates.join('&') + '|' + currentStates.join('&'));
    }

    /**
     * Sets the new currentState attribute of all modules depending on the new fully
     * qualified state. Also notifies the modules which current state has changed.
     * @method _handleFQStateChange
     * @param {string} fqstate fully qualified state
     * @private
     */
    function _handleFQStateChange(fqstate) {
        var m, states = [], globalStateChanged = false;

        if (fqstate) {

            REGEXP.lastIndex = 0;
            while ((m = REGEXP.exec(fqstate))) {
                states[m[1]] = m[2];
            }

            Y.Object.each(G._modules, function (module, moduleId) {
                var currentState = states[moduleId];

                if (!currentState || module.currentState !== currentState) {
                    module.currentState = currentState || module.initialState;
                    module.fire(EV_HISTORY_MODULE_STATE_CHANGE, decode(module.currentState));
                    globalStateChanged = true;
                }
            });

        } else {

            Y.Object.each(G._modules, function (module, moduleId) {
                if (module.currentState !== module.initialState) {
                    module.currentState = module.initialState;
                    module.fire(EV_HISTORY_MODULE_STATE_CHANGE, decode(module.currentState));
                    globalStateChanged = true;
                }
            });
        }

        if (globalStateChanged) {
            H.fire(EV_HISTORY_GLOBAL_STATE_CHANGE);
        }
    }

    /**
     * Update the IFrame with our new state.
     * @method _updateIFrame
     * @private
     * @return {boolean} true if successful. false otherwise.
     */
    function _updateIFrame(fqstate) {
        var html, doc;

        html = '<html><body>' + fqstate + '</body></html>';

        try {
            doc = G._historyIFrame.get('contentWindow.document');
            // TODO: The Node API should expose these methods in the very near future...
            doc.invoke('open');
            doc.invoke('write', html, '', '', '', ''); // see bug #2447937
            doc.invoke('close');
            return true;
        } catch (e) {
            return false;
        }
    }

    /**
     * Periodically checks whether our internal IFrame is ready to be used
     * @method _checkIframeLoaded
     * @private
     */
    function _checkIframeLoaded() {
        var elem, fqstate, hash;

        if (!G._historyIFrame.get('contentWindow.document')) {
            // Check again in 10 msec...
            setTimeout(_checkIframeLoaded, 10);
            return;
        }

        // Periodically check whether a navigate operation has been
        // requested on the main window. This will happen when
        // History.navigate has been called or after the user
        // has hit the back/forward button.
        elem = G._historyIFrame.get('contentWindow.document.body');
        // We must use innerText, and not innerHTML because our string contains
        // the "&" character (which would end up being escaped as "&amp;") and
        // the string comparison would fail...
        fqstate = elem ? elem.get('innerText') : null;

        hash = _getHash();

        setInterval(function () {
            var newfqstate, states, newHash;

            elem = G._historyIFrame.get('contentWindow.document.body');
            // See my comment above about using innerText instead of innerHTML...
            newfqstate = elem ? elem.get('innerText') : null;

            newHash = _getHash();

            if (newfqstate !== fqstate) {

                fqstate = newfqstate;
                _handleFQStateChange(fqstate);

                if (!fqstate) {
                    states = [];
                    Y.Object.each(G._modules, function (module, moduleId) {
                        states.push(moduleId + '=' + module.initialState);
                    });
                    newHash = states.join('&');
                } else {
                    newHash = fqstate;
                }

                // Allow the state to be bookmarked by setting the top window's
                // URL fragment identifier. Note that here, we are on IE < 8
                // which does not touch the browser history when changing the
                // hash (unlike all the other browsers).
                var i = newHash.indexOf('=');
                win.location.hash = hash = newHash.substr(0,i + 1) + decode(newHash.substr(i + 1));
                _storeStates();

            } else if (newHash !== hash) {

                // The hash hasURL changed. The user might have clicked on a link,
                // or modified the URL directly, or opened the same application
                // bookmarked in a specific state using a bookmark. However, we
                // know the hash change was not caused by a hit on the back or
                // forward buttons, or by a call to navigate() (because it would
                // have been handled above) We must handle these cases, which is
                // why we also need to keep track of hash changes on IE!

                // Note that IE6 has some major issues with this kind of user
                // interaction (the history stack gets completely messed up)
                // but it seems to work fine on IE7.

                hash = newHash;

                // Now, store a new history entry. The following will cause the
                // code above to execute, doing all the dirty work for us...
                _updateIFrame(newHash);
            }

        }, 200);

        G.ready = true;
        H.fire(EV_HISTORY_READY);
    }

    /**
     * Finish up the initialization of the browser utility library.
     * @method _initialize
     * @private
     */
    function _initialize() {
        var m, parts, moduleId, module, initialState, currentState, hash;

        // Decode the content of our storage field...
        parts = G._stateField.get('value').split('|');

        if (parts.length > 1) {

            REGEXP.lastIndex = 0;
            while ((m = REGEXP.exec(parts[0]))) {
                moduleId = m[1];
                initialState = m[2];
                module = G._modules[moduleId];
                if (module) {
                    module.initialState = initialState;
                }
            }

            REGEXP.lastIndex = 0;
            while ((m = REGEXP.exec(parts[1]))) {
                moduleId = m[1];
                currentState = m[2];
                module = G._modules[moduleId];
                if (module) {
                    module.currentState = currentState;
                }
            }
        }

        // IE8 in IE7 mode defines window.onhashchange, but never fires it...
        if (!Y.Lang.isUndefined(win.onhashchange) &&
            (Y.Lang.isUndefined(doc.documentMode) || doc.documentMode > 7)) {

            // The HTML5 way of handling DHTML history...
            win.onhashchange = function () {
                var hash = _getHash();
                _handleFQStateChange(hash);
                _storeStates();
            };

            G.ready = true;
            H.fire(EV_HISTORY_READY);

        } else if (_useIFrame) {

            // IE < 8 or IE8 in quirks mode or IE7 standards mode
            _checkIframeLoaded();

        } else {

            // Periodically check whether a navigate operation has been
            // requested on the main window. This will happen when
            // History.navigate has been called, or after the user
            // has hit the back/forward button.

            // On Gecko and Opera, we just need to watch the hash...
            hash = _getHash();

            setInterval(function () {
                var newHash = _getHash();
                if (newHash !== hash) {
                    hash = newHash;
                    _handleFQStateChange(hash);
                    _storeStates();
                }
            }, 50);

            G.ready = true;
            H.fire(EV_HISTORY_READY);
        }
    }


    H = {

        /**
         * Registers a new module.
         * @method register
         * @param {string} moduleId Non-empty string uniquely identifying the
         *     module you wish to register.
         * @param {string} initialState The initial state of the specified
         *     module corresponding to its earliest history entry.
         * @return {History.Module} The newly registered module
         */
        register: function (moduleId, initialState) {
            var module;

            if (!Y.Lang.isString(moduleId) || Y.Lang.trim(moduleId) === '' || !Y.Lang.isString(initialState)) {
                throw new Error(E_MISSING_OR_INVALID_ARG);
            }

            moduleId = encode(moduleId);
            initialState = encode(initialState);

            if (G._modules[moduleId]) {
                // The module seems to have already been registered.
                return;
            }

            // Note: A module CANNOT be registered once the browser history
            // utility has been initialized. This is related to reading and
            // writing state values from/to the input field. Relaxing this
            // rule would potentially create situations rather complicated
            // to deal with.
            if (G.ready) {
                return null;
            }

            module = new H.Module(moduleId, initialState);
            G._modules[moduleId] = module;
            return module;
        },

        /**
         * Initializes the Browser History Manager. Call this method
         * from a script block located right after the opening body tag.
         * @method initialize
         * @param {string|HTML Element} stateField <input type="hidden"> used
         *     to store application states. Must be in the static markup.
         * @param {string|HTML Element} historyIFrame IFrame used to store
         *     the history (only required for IE6/7)
         * @public
         */
        initialize: function (stateField, historyIFrame) {
            var tagName, type;

            if (G.ready) {
                // The browser history utility has already been initialized.
                return true;
            }

            stateField = Y.get(stateField);
            if (!stateField) {
                throw new Error(E_MISSING_OR_INVALID_ARG);
            }

            tagName = stateField.get('tagName').toUpperCase();
            type = stateField.get('type');

            if (tagName !== 'TEXTAREA' && (tagName !== 'INPUT' || type !== 'hidden' && type !== 'text')) {
                throw new Error(E_MISSING_OR_INVALID_ARG);
            }

            // IE < 8 or IE8 in quirks mode or IE7 standards mode
            if (Y.UA.ie && (Y.Lang.isUndefined(doc.documentMode) || doc.documentMode < 8)) {
                _useIFrame = true;
                historyIFrame = Y.get(historyIFrame);
                if (!historyIFrame || historyIFrame.get('tagName').toUpperCase() !== 'IFRAME') {
                    throw new Error(E_MISSING_OR_INVALID_ARG);
                }
            }

            if (Y.UA.opera && !Y.Lang.isUndefined(win.history.navigationMode)) {
                // Disable Opera's fast back/forward navigation mode and put
                // it in compatible mode. This makes anchor-based history
                // navigation work after the page has been navigated away
                // from and re-activated, at the cost of slowing down
                // back/forward navigation to and from that page.
                win.history.navigationMode = 'compatible';
            }

            G._stateField = stateField;
            G._historyIFrame = historyIFrame;

            Y.on('domready', _initialize);
            return true;
        },

        /**
         * Stores a new entry in the browser history by changing the state of a registered module.
         * @method navigate
         * @param {string} module Non-empty string representing your module.
         * @param {string} state String representing the new state of the specified module.
         * @return {boolean} Indicates whether the new state was successfully added to the history.
         * @public
         */
        navigate: function (moduleId, state) {
            var states;

            if (!Y.Lang.isString(moduleId) || !Y.Lang.isString(state)) {
                throw new Error(E_MISSING_OR_INVALID_ARG);
            }

            // The ncoding of module id and state takes place in mutiNavigate.
            states = {};
            states[moduleId] = state;

            return H.multiNavigate(states);
        },

        /**
         * Stores a new entry in the browser history by changing the state
         * of several registered modules in one atomic operation.
         * @method multiNavigate
         * @param {object} states Associative array of module-state pairs to set simultaneously.
         * @return {boolean} Indicates whether the new state was successfully added to the history.
         * @public
         */
        multiNavigate: function (states) {
            var newStates = [], fqstate, globalStateChanged = false;

            if (!G.ready) {
                return false;
            }

            Y.Object.each(G._modules, function (module, moduleId) {
                var state, decodedModuleId = decode(moduleId);

                if (!states.hasOwnProperty(decodedModuleId)) {
                    // The caller did not wish to modify the state of this
                    // module. We must however include it in fqstate!
                    state = module.currentState;
                } else {
                    state = encode(states[decodedModuleId]);
                    if (state !== module.upcomingState) {
                        module.upcomingState = state;
                        globalStateChanged = true;
                    }
                }

                newStates.push(moduleId + '=' + state);
            });

            if (!globalStateChanged) {
                // Nothing changed, so don't do anything.
                return false;
            }

            fqstate = newStates.join('&');

            if (_useIFrame) {
                return _updateIFrame(fqstate);
            } else {
                win.location.hash = decode(fqstate);
                return true;
            }
        },

        /**
         * Returns the current state of the specified module.
         * @method getCurrentState
         * @param {string} moduleId Non-empty string representing your module.
         * @return {string} The current state of the specified module.
         * @public
         */
        getCurrentState: function (moduleId) {
            var module;

            if (!Y.Lang.isString(moduleId)) {
                throw new Error(E_MISSING_OR_INVALID_ARG);
            }

            if (!G.ready) {
                return null;
            }

            moduleId = encode(moduleId);
            module = G._modules[moduleId];
            if (!module) {
                return null;
            }

            return decode(module.currentState);
        },

        /**
         * Returns the state of a module according to the URL fragment
         * identifier. This method is useful to initialize your modules
         * if your application was bookmarked from a particular state.
         * @method getBookmarkedState
         * @param {string} moduleId Non-empty string representing your module.
         * @return {string} The bookmarked state of the specified module.
         * @public
         */
        getBookmarkedState: function (moduleId) {
            var m, i, h;

            if (!Y.Lang.isString(moduleId)) {
                throw new Error(E_MISSING_OR_INVALID_ARG);
            }

            moduleId = encode(moduleId);

            // Use location.href instead of location.hash which is already
            // URL-decoded, which creates problems if the state value
            // contained special characters...
            h = win.location.href;
            i = h.indexOf('#');

            if (i >= 0) {
                h = h.substr(i + 1);
                REGEXP.lastIndex = 0;
                while ((m = REGEXP.exec(h))) {
                    if (m[1] === moduleId) {
                        return decode(m[2]);
                    }
                }
            }

            return null;
        },

        /**
         * Returns the value of the specified query string parameter.
         * This method is not used internally by the Browser History Manager.
         * However, it is provided here as a helper since many applications
         * using the Browser History Manager will want to read the value of
         * url parameters to initialize themselves.
         * @method getQueryStringParameter
         * @param {string} paramName Name of the parameter we want to look up.
         * @param {string} queryString Optional URL to look at. If not specified,
         *     this method uses the URL in the address bar.
         * @return {string} The value of the specified parameter, or null.
         * @public
         */
        getQueryStringParameter: function (paramName, url) {
            var m, q, i;

            url = url || win.location.href;

            i = url.indexOf('?');
            q = i >= 0 ? url.substr(i + 1) : url;

            // Remove the hash if any
            i = q.lastIndexOf('#');
            q = i >= 0 ? q.substr(0, i) : q;

            REGEXP.lastIndex = 0;
            while ((m = REGEXP.exec(q))) {
                if (m[1] === paramName) {
                    return decode(m[2]);
                }
            }

            return null;
        }
    };


    // Make Y.History an event target
    Y.mix(H, Y.Event.Target.prototype);
    Y.Event.Target.call(H);


    /**
     * This class represents a browser history module.
     * @class History.Module
     * @constructor
     * @param id {String} the module identifier
     * @param initialState {String} the module's initial state
     */
    H.Module = function (id, initialState) {

        Y.Event.Target.call(this);

        /**
         * The module identifier
         * @type String
         * @final
         */
        this.id = id;

        /**
         * The module's initial state
         * @type String
         * @final
         */
        this.initialState = initialState;

        /**
         * The module's current state
         * @type String
         * @final
         */
        this.currentState = initialState;

        /**
         * The module's upcoming state. There can be a slight delay between the
         * time a state is changed, and the time a state change is detected.
         * This property allows us to not fire the module state changed event
         * multiple times, making client code simpler.
         * @type String
         * @private
         * @final
         */
        this.upcomingState = initialState;
    };

    Y.mix(H.Module, Y.Event.Target, false, null, 1);

    Y.History = H;


}, '3.0.0' ,{skinnable:false, use:['event', 'node']});
/**
 * RUZEE.ShadedBorder 0.6.2
 * (c) 2006 Steffen Rusitschka
 *
 * RUZEE.ShadedBorder is freely distributable under the terms of an MIT-style license.
 * For details, see http://www.ruzee.com/
 */

var RUZEE = window.RUZEE || {};

RUZEE.ShadedBorder = {

create: function(opts) {
  var isie = /msie/i.test(navigator.userAgent) && !window.opera;
  var isie6 = isie && !window.XMLHttpRequest;
  function sty(el, h) {
    for(k in h) {
      if (/ie_/.test(k)) {
        if (isie) el.style[k.substr(3)]=h[k];
      } else el.style[k]=h[k];
    }
  }
  function crdiv(h) {
    var el=document.createElement("div");
    el.className = "sb-gen";
    sty(el, h);
    return el;
  }
  function op(v) {
    v = v<0 ? 0 : v;
    if (v>0.99999) return "";
    return isie ? " filter:alpha(opacity=" + (v*100) + ");" : " opacity:" + v + ';';
  }

  var sr = opts.shadow || 0;
  var r = opts.corner || 0;
  var bor = 0;
  var bow = opts.border || 0;
  var boo = opts.borderOpacity || 1;
  var shadow = sr != 0;
  var lw = r > sr ? r : sr;
  var rw = lw;
  var th = lw;
  var bh = lw;
  if (bow > 0) {
    bor = r;
    r = r - bow;
  }
  var cx = r != 0 && shadow ? Math.round(lw/3) : 0;
  var cy = cx;
  var cs = Math.round(cx/2);
  var iclass = r > 0 ? "sb-inner" : "sb-shadow";
  var sclass = "sb-shadow";
  var bclass = "sb-border";
  var edges = opts.edges || "trlb";
  if (!/t/i.test(edges)) th=0;
  if (!/b/i.test(edges)) bh=0;
  if (!/l/i.test(edges)) lw=0;
  if (!/r/i.test(edges)) rw=0;

  var p = { position:"absolute", left:"0", top:"0", width:lw + "px", height:th + "px", 
            ie_fontSize:"1px", overflow:"hidden", margin:"0", padding:"0" }; var tl = crdiv(p);
  delete p.left; p.right="0"; p.width=rw + "px"; var tr = crdiv(p);
  delete p.top; p.bottom="0"; p.height=bh + "px"; var br = crdiv(p);
  delete p.right; p.left="0"; p.width=lw + "px"; var bl = crdiv(p);

  var tw = crdiv({ position:"absolute", width:"100%", height:th + "px", ie_fontSize:"1px",
                   top:"0", left:"0", overflow:"hidden", margin:"0", padding:"0" });
  var t = crdiv({ position:"relative", height:th + "px", ie_fontSize:"1px",
                  margin:"0 "+ rw + "px 0 " + lw + "px", overflow:"hidden", padding:"0" });
  tw.appendChild(t);

  var bw = crdiv({ position:"absolute", left:"0", bottom:"0", width:"100%", height:bh + "px", 
                   ie_fontSize:"1px", overflow:"hidden", margin:"0", padding:"0" });
                   
  var b = crdiv({ position:"relative", height:bh + "px", ie_fontSize:"1px",
                  margin:"0 "+ rw + "px 0 " + lw + "px", overflow:"hidden", padding:"0" });
                  
  bw.appendChild(b);

  var mw = crdiv({ position:"absolute", top:(-bh)+"px", left:"0", width:"100%", height:"100%",
                   overflow:"hidden", ie_fontSize:"1px", padding:"0", margin:"0" });

  function corner(el,t,l) {
    var w = l ? lw : rw;
    var h = t ? th : bh;
    var s = t ? cs : -cs;
    var dsb = []; var dsi = []; var dss = [];
    
    var xp=0; var xd=1; if (l) { xp=w-1; xd=-1; }
    for (var x=0; x<w; ++x) {
      var yp=h-1; var yd=-1; if (t) { yp=0; yd=1; }
      var finished=false;
      for (var y=h-1; y>=0 && !finished; --y) {
        var div = '<div style="position:absolute; top:' + yp + 'px; left:' + xp + 'px; ' +
                  'width:1px; height:1px; overflow:hidden; margin:0; padding:0;';

        var xc = x - cx; var yc = y - cy - s;
        var d = Math.sqrt(xc*xc+yc*yc);
        var doShadow = false;

        if (r > 0) {
          // draw border
          if (xc < 0 && yc < bor && yc >= r || yc < 0 && xc < bor && xc >= r) {
            dsb.push(div + op(boo) + '" class="' + bclass + '"></div>');
          } else
          if (d<bor && d>=r-1 && xc>=0 && yc>=0) {
            var dd = div;
            if (d>=bor-1) {
              dd += op((bor-d)*boo);
              doShadow = true;
            } else dd += op(boo);
            dsb.push(dd + '" class="' + bclass + '"></div>');
          }
          
          // draw inner
          var dd = div + ' z-index:2;' + (t ? 'background-position:0 -' + (r-yc-1) + 'px;' : 'background-image:none;');
          var finish = function() {
            if (!t) dd = dd.replace(/top\:\d+px/, "top:0px");
            dd = dd.replace(/height\:1px/, "height:" + (y+1) + "px");
            dsi.push(dd + '" class="' + iclass + '"></div>');
            finished = true;
          };
          if (xc < 0 && yc < r || yc < 0 && xc < r) {
            finish();
          } else
          if (d<r && xc>=0 && yc>=0) {
            if (d>=r-1) {
              dd += op(r-d);
              doShadow = true;
              dsi.push(dd + '" class="' + iclass + '"></div>');
            } else {
              finish();
            }
          } else doShadow = true;
        } else doShadow = true;
        
        // draw shadow
        if (sr > 0 && doShadow) {
          d = Math.sqrt(x*x+y*y);
          if (d<sr) {
            dss.push(div + ' z-index:0; ' + op(1-(d/sr)) + '" class="' + sclass + '"></div>');
          }
        }
        yp += yd;
      }
      xp += xd;
    }
    el.innerHTML = dss.concat(dsb.concat(dsi)).join('');
  }
  
  function mid(mw) {
    var ds = [];

    ds.push('<div style="position:relative; top:' + (th+bh) + 'px; height:2048px; ' +
            ' margin:0 ' + (rw-r-cx) + 'px 0 ' + (lw-r-cx) + 'px; ' +
            ' padding:0; overflow:hidden;' +
            ' background-position:0 ' + (th > 0 ? -(r+cy+cs) : '0') + 'px;"' +
            ' class="' + iclass + '"></div>');

    var dd = '<div style="position:absolute; width:1px;' +
        ' top:' + (th+bh) + 'px; height:2048px; padding:0; margin:0;';
    if (sr>0) {
      for (var x=0; x<lw-r-cx; ++x) {
        ds.push(dd + ' left:' + x + 'px;' + op((x+1.0)/lw) + 
            '" class="' + sclass + '"></div>');
      }

      for (var x=0; x<rw-r-cx; ++x) {
        ds.push(dd + ' right:' + x + 'px;' + op((x+1.0)/rw) + 
            '" class="' + sclass + '"></div>');
      }
    }

    if (bow > 0) {
      var su = ' width:' + bow + 'px;' + op(boo) + '" class="' + bclass + '"></div>';
      ds.push(dd + ' left:' + (lw-bor-cx) + 'px;' + su);
      ds.push(dd + ' right:' + (rw-bor-cx) + 'px;' + su);
    }

    mw.innerHTML = ds.join('');
  }

  function tb(el, t) {
    var ds = [];
    var h = t ? th : bh;
    var dd = '<div style="height:1px; overflow:hidden; position:absolute; margin:0; padding:0;' +
        ' width:100%; left:0px; ';
    var s = t ? cs : -cs;
    for (var y=0; y<h-s-cy-r; ++y) {
      if (sr>0) ds.push(dd + (t ? 'top:' : 'bottom:') + y + 'px;' + op((y+1)*1.0/h) + 
          '" class="' + sclass + '"></div>');
    }
    if (y >= bow) {
      ds.push(dd + (t ? 'top:' : 'bottom:') + (y - bow) + 'px;' + op(boo) +
          ' height:' + bow + 'px;" class="' + bclass + '"></div>');
    }

    ds.push(dd + (t ? 'background-position-y:0; top:' : 
                      'background-image:none; bottom:') + y + 'px;' +
        ' height:' + (r+cy+s) + 'px;" class="' + iclass + '"></div>');

    el.innerHTML = ds.join('');
  }

  corner(tl, true, true); corner(tr, true, false);
  corner(bl, false, true); corner(br, false, false);
  mid(mw); tb(t, true); tb(b, false);
  needsCloning = false;

  return {
    render: function(el) {
      if (typeof el == 'string') el = document.getElementById(el);
      if (el.length != undefined) {
        for (var i=0; i<el.length; ++i) this.render(el[i]);
        return;
      }
      el.className += " sb";
      sty(el, { position:"relative", background:"transparent" });

      // remove generated children
      var node = el.firstChild;
      while (node) {
        var nextNode = node.nextSibling;
        if (node.nodeType == 1 && node.className == 'sb-gen')
          el.removeChild(node);
        node = nextNode;
      }

      var iel = el.firstChild;

      var twc = needsCloning ? tw.cloneNode(true) : tw;
      var mwc = needsCloning ? mw.cloneNode(true) : mw;
      var bwc = needsCloning ? bw.cloneNode(true) : bw;
      var tlc = needsCloning ? tl.cloneNode(true) : tl;
      var trc = needsCloning ? tr.cloneNode(true) : tr;
      var blc = needsCloning ? bl.cloneNode(true) : bl;
      var brc = needsCloning ? br.cloneNode(true) : br;
      
      el.insertBefore(tlc, iel); el.insertBefore(trc, iel);
      el.insertBefore(blc, iel); el.insertBefore(brc, iel);
      el.insertBefore(twc, iel); el.insertBefore(mwc, iel);
      el.insertBefore(bwc, iel);

      if (isie6) {
        el.onmouseover=function() { this.className += " hover"; }
        el.onmouseout=function() { this.className = this.className.replace(/ hover/,""); }
      }
      if (isie) {
        function resize() {
          twc.style.width = bwc.style.width = mwc.style.width = el.offsetWidth + "px";
          if (isie6) {
            mwc.firstChild.style.height = el.offsetHeight + "px";
          } else {
            for (var i=0; i<mwc.childNodes.length; ++i) {
              mwc.childNodes[i].style.height = (el.offsetHeight - bh - th)  + "px";
            }
          }
          trc.style.right = brc.style.right = null;
          trc.style.left  = brc.style.left  = (el.offsetWidth - rw) + "px";
        }
        el.onresize=resize;
        resize();
      }
      needsCloning = true;
    }
  };
}
}

// add our styles to the document
document.write('\
  <style type="text/css">\
  .sb, .sbi, .sb *, .sbi * { position:relative; z-index:1; }\
  * html .sb, * html .sbi { height:1%; }\
  .sbi { display:inline-block; }\
  .sb-inner { background:#ddd; }\
  .sb-shadow { background:#000; }\
  .sb-border { background:#bbb; }\
  </style>\
');
/* http://www.JSON.org/json2.js */

/*jslint evil: true */

/*global JSON */

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
    lastIndex, length, parse, prototype, push, replace, slice, stringify,
    test, toJSON, toString, valueOf
*/

// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.

if (!this.JSON) {
    JSON = {};
}
(function () {
    function f(n) {
        return n < 10 ? '0' + n : n;
    }

    if (typeof Date.prototype.toJSON !== 'function') {
        Date.prototype.toJSON = function (key) {
            return this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z';
        };
        String.prototype.toJSON =
        Number.prototype.toJSON =
        Boolean.prototype.toJSON = function (key) {
            return this.valueOf();
        };
    }

    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        gap,
        indent,
        meta = {    // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        rep;

    function quote(string) {
        escapable.lastIndex = 0;
        return escapable.test(string) ?
            '"' + string.replace(escapable, function (a) {
                var c = meta[a];
                return typeof c === 'string' ? c :
                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
            }) + '"' :
            '"' + string + '"';
    }

    function str(key, holder) {

        var i,          // The loop counter.
            k,          // The member key.
            v,          // The member value.
            length,
            mind = gap,
            partial,
            value = holder[key];

        if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }

        if (typeof rep === 'function') {
            value = rep.call(holder, key, value);
        }

        switch (typeof value) {
        case 'string':
            return quote(value);

        case 'number':
            return isFinite(value) ? String(value) : 'null';
        case 'boolean':
        case 'null':
            return String(value);
        case 'object':
            if (!value) {
                return 'null';
            }
            gap += indent;
            partial = [];
            if (Object.prototype.toString.apply(value) === '[object Array]') {
                length = value.length;
                for (i = 0; i < length; i += 1) {
                    partial[i] = str(i, value) || 'null';
                }
                v = partial.length === 0 ? '[]' :
                    gap ? '[\n' + gap +
                            partial.join(',\n' + gap) + '\n' +
                                mind + ']' :
                          '[' + partial.join(',') + ']';
                gap = mind;
                return v;
            }
            if (rep && typeof rep === 'object') {
                length = rep.length;
                for (i = 0; i < length; i += 1) {
                    k = rep[i];
                    if (typeof k === 'string') {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            } else {
                for (k in value) {
                    if (Object.hasOwnProperty.call(value, k)) {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            }
            v = partial.length === 0 ? '{}' :
                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
                        mind + '}' : '{' + partial.join(',') + '}';
            gap = mind;
            return v;
        }
    }
    if (typeof JSON.stringify !== 'function') {
        JSON.stringify = function (value, replacer, space) {
            var i;
            gap = '';
            indent = '';
            if (typeof space === 'number') {
                for (i = 0; i < space; i += 1) {
                    indent += ' ';
                }
            } else if (typeof space === 'string') {
                indent = space;
            }
            rep = replacer;
            if (replacer && typeof replacer !== 'function' &&
                    (typeof replacer !== 'object' ||
                     typeof replacer.length !== 'number')) {
                throw new Error('JSON.stringify');
            }
            return str('', {'': value});
        };
    }
    if (typeof JSON.parse !== 'function') {
        JSON.parse = function (text, reviver) {
            var j;
            function walk(holder, key) {
                var k, v, value = holder[key];
                if (value && typeof value === 'object') {
                    for (k in value) {
                        if (Object.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }
            cx.lastIndex = 0;
            if (cx.test(text)) {
                text = text.replace(cx, function (a) {
                    return '\\u' +
                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }
            if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
                j = eval('(' + text + ')');
                return typeof reviver === 'function' ?
                    walk({'': j}, '') : j;
            }
            throw new SyntaxError('JSON.parse');
        };
    }
}());
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();/**
 * A collection of global functions and values
 * @module global
 */

YAHOO = new YUI({
    base : '/js/yui/',
    loadOptional : false,
    timeout : 10000,
    filter: 'raw',
    modules:  { // one or more external modules that can be loaded along side of YUI
        json_org: {fullpath: "http://www.json.org/json.js"},
        json2_org: {fullpath: "http://www.json.org/json2.js"}
    }
});

GOOM = {blog: {}, user : {}, radio: {}, util : {}, site: {}, rotation : {}};

function getASSET() {
    return window.ASSET_STORE_ARRAY[parseInt(Math.random(window.ASSET_STORE_ARRAY.length - 1), 10)];
}

var _isIE = false;
/*@cc_on
   _isIE = true
@*/

function addOption(el, text, value) {
    var option = new Option(text, value);
    if(window._isIE) {
        el.add(option, el.options.length);
    } else {
        el.add(option, el.options[el.options.length]);
    }
}

function replace(str, map) {
    transform = function(n){return n;};
    return str.replace(/\%\{(\w+)\}/g, function(match, key) {
        return transform(map[key]);
    });
}

function defaultImg(img, src) {
    img.style.visibility='visible';
    img.onerror=null;
    img.removeAttribute('onerror');
    img.src=src;
}

/**
 *  Get element by a given id the same as document.getElementById
 *  @method byId
 *  @param {String} id
 *  @return {Element} Element or null
 */
function byId(id) {
    return document.getElementById(id);
}

var byClass = (function() {
    if(document.getElementsByClassName) {
        return function(el, className) {
            return el.getElementsByClassName(className);
        }
    } else {
        return function(el, className) {
            var els = el.getElementsByTagName('*');
            var results = [];
            for(var i = 0, len = els.length; i < len; i++) {
                if(els[i].className == className) {
                   results.push(els[i]); 
                }
            }
            return els;
        }
    }
})()

/**
 *  Set text in Elememt
 *  @method setText
 *  @param {Element} el
 *  @param {String} text
 */
function setText(el, text){
     el.innerText = el.textContent = text;
}

function hasClass(el, className) {
    if(el && className && el.className) {
        return (el.className.search(className) !== -1);
    }
    return false;
}

function removeClass(el, className) {
    if(el && el.tagName) {
        el = [el];
    }
    if(el){
        for(var i = 0, len = el.length; i < len; i++) {
            var classStr = el[i].className || '';
            el[i].className = classStr.replace(className, '').replace(/$\s*/gi, '');
        }
    }
}

function addClass(el, className) {
    if(el && el.tagName) {
        el = [el];
    }
    if(el) {
        for(var i = 0, len = el.length; i < len; i++) {
            var classStr = el[i].className || '';
            if(classStr.indexOf(className) != -1) {
                return;
            }
            el[i].className = classStr + ' ' + className;
        }
    }
}

function onEnter(event) {
    var event = e || window.event;
    var charCode = event.charCode || event.keyCode;
    if(charCode != 13) {
        return false;
    }
    return true;
}

function batchApply(el, fn, scope, args) {
    var scope = scope || window;
    if(el && el.tagName) {
        fn.call(scope, el, args);
    } else if(el) {
        for(var i = 0, len = el.length; i < len; i++) {
            fn.call(scope, el[i], args);
        }
    }
}

function containsNode(a, b){
  return a.contains ?
    (a != b) && a.contains(b) :
    !!(a.compareDocumentPosition(b) & 16);
}

function createScript(uri, callback) {
    var script = document.createElement("script")
    script.type = "text/javascript";
    script.src = uri;

    if(callback) {
        if (script.readyState){  //IE
            script.onreadystatechange = function(){
                if (script.readyState == "loaded" ||
                        script.readyState == "complete"){
                    script.onreadystatechange = null;
                    callback();
                }
            };
        } else {  //Others
            script.onload = function(){
                callback();
            };
        }
    }

    document.getElementsByTagName('head')[0].appendChild(script);
}

function removeScript(uri, callback) {
    var head = document.getElementsByTagName('head')[0],
        scripts = head.getElementsByTagName('script');

    for (var i = 0, len = scripts.length; i < len; ++i) {
        if (scripts[i].src == uri) {
            head.removeChild(scripts[i]);
            break;
        }
    }

    if (callback) {
        callback();
    }
}

/**
 *  A collection of values used for escaping
 *  @property _htmlEnt
 *  @private
 *  @see escapeHTML
 */
var _htmlEnt = {
    '"' : "&quot;",
    "'" : '&apos;',
    "<" : "&lt;",
    ">" : "&gt;",
    '&' : "&amp;"
}

var _xmlEnt = {
    '&apos;' : "'",
    '&quot;' : '"',
    '&amp;'  : '&',
    '&lt;'   : '<',
    '&gt;'   : '>'
}

/**
 *  Escapes a string from html
 *  @method escapeHTML
 *  @param {String} str
 *  @return {String} a string
 */
function escapeHTML(str) {
    return str ? (str+'').replace(/[<>\"&]/gm, function(str) {return _htmlEnt[str] || str;}) : "";
}

function shortener(str, length) {
    str = str ? (str+'').replace(/(&apos;|&quot;|&amp;|&lt;|&gt;)/gm, function(str) {return _xmlEnt[str] || str;}) : "";
    if(str.length > length) {
        str = str.substring(0, length - 3) + '...';
    }
    str = str ? (str+'').replace(/[<>\"&]/gm, function(str) {return _htmlEnt[str] || str;}) : "";
    return str;
}

function shortenerNoEscape(str, length) {
    str = str ? (str+'').replace(/(&apos;|&quot;|&amp;|&lt;|&gt;)/gm, function(str) {return _xmlEnt[str] || str;}) : "";
    if(str.length > length) {
        str = str.substring(0, length - 3) + '...';
    }
    return str;
}

/**
 * Creates namespace
 * @method createNS
 * @param {String} NameStr
 */
function createNS(nameStr) {
    var nameArr = nameStr.split('.');
    if(!window[nameArr[0]]) {
      window[nameArr[0]] = {};
    }
    var nameObj = window[nameArr[0]];
    for(var i = 1, len = nameArr.length; i < len; i++) {
        if(!nameObj[nameArr[i]]) {
           nameObj[nameArr[i]] = {};
        }
        nameObj = nameObj[nameArr[i]];
    }
}

function clearFormMsgs(formEl) {
    for(var i = 0, len = formEl.elements.length; i < len; i++) {
        var el = formEl.elements[i];
        if(el.getAttribute('gtype') == 'button') {
            el = el.parentNode.parentNode;
        }
        removeClass(el, 'invalidInput');
        if(el.parentNode) {
            span = el.parentNode.getElementsByTagName('span')[0];
            if(span) {
                span.style.display = 'none';
            }
        }
    }
}

function handleFormResults(formEl, result, newChecks) {
    clearFormMsgs(formEl);
    if(!result.success) {
        if(!result.errors) {
            return;
        }
        var err = result.errors;

        // temporarily added for testing purposes. 
        // I would like to switch on the newChecks part if possibile but 
        // I still have to investigate on that
        //XXX can we please avoid test code .....
        if(newChecks == true) {
            for(var i in err) {
                handleFormElement(formEl.elements[i], err[i]);				
            }
        } else {
            for(var i = 0, len = result.errors.length; i < len; i++) {
                var el = formEl.elements[result.errors[i][0]];
                if(el) {
                    if(el instanceof NodeList) {
                        el = el[0];
                    }

                    if(el.getAttribute('gtype') == 'button') {
                        el = el.parentNode.parentNode;
                    }

                    addClass(el, 'invalidInput');
                    var span = el.parentNode.getElementsByTagName('span')[0];
                    if(span) {
                        span.style.display = 'block';
                        span.className = 'unAvailable';
                        setText(span, result.errors[i][1]);						
                    }
                }
            }
        }
    }
}

function handleFormElement(el, err) {
    if(el) {
        if(el.getAttribute('gtype') == 'button') {
            el = el.parentNode.parentNode;
        }
        addClass(el, 'invalidInput');
        var span = el.parentNode.getElementsByTagName('span')[0];
        if(span) {
            span.style.display = 'block';
            span.className = 'unAvailable';
            setText(span, err);			
        }
    }
}

function updateYear(){ //12 years minimum age (TOS)
		
        var dayEl = byId('registerDay'),
            monthEl = byId('registerMonth'),
            yearEl = byId('registerYear'),
            curDate = new Date(),
            d = curDate.getDate(),
            m = curDate.getMonth()+1,
            y = curDate.getFullYear();
			
			yRem = y-12;

            if(monthEl.value>0){

                if((monthEl.value > m) || ((monthEl.value == m) && (dayEl.value>d))){
					//$('#registerYear option').each(function(i, option){ $(option).remove(); });
					$("#registerYear option[value='"+yRem+"']").remove();
                    for(i = y - 13; i > y - 100; --i) { //12 years minimum age (TOS)
                        addOption(yearEl, i, i);
                    }
                }
				else{
					$('#registerYear option:not(option:first)').each(function(i, option){ $(option).remove(); });
					for(i = y - 12; i > y - 100; --i) { //12 years minimum age (TOS)
                        addOption(yearEl, i, i);
                    }
				}
            }
}

function setFormMsg(el, msg, className) {
    var span = el.parentNode.getElementsByTagName('span')[0];
    if(span) {
        span.style.display = 'block';
        if(className) {
            span.className = className;
        } else {
            span.className = 'unAvailable';
        }
        setText(span, msg);
    }
}

function enableFields(elements) {
    for(var i = 0, len = elements.length; i < len; ++i) {
        if(elements[i]) {
            elements[i].disabled = false;
        }
    }
}

function disableFields(elements) {
  for(var i = 0, len = elements.length; i < len; i++) {
      elements[i].disabled = true;
  }
}

function createCookie(name,value,days) 
{
//	alert("createCookie("+ name +", "+ value +")");
//	// delete existing cookie for any sub domain of the current domain
//	// else, we may end up with the same cookie but for 2 different sub domains, which readCookie() below cannot handle
//	var date = new Date();
//    date.setTime(date.getTime() - 86400000); // yesterday - 86400000 = 24*60*60*1000
//    var expires = "; expires="+date.toGMTString();
//    document.cookie = name+"="+value+expires+"; path=/";
    
	// save new cookie
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + days*86400000);
        var expires = "; expires="+date.toGMTString();
    } else {
        var expires = "";
    }
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
//alert(document.cookie);
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
//alert(ca.length);
	for(var i = 0, caLength = ca.length; i < caLength; i++) {
        var c = ca[i];
//alert(i + '-' + c);
        while (c.charAt(0)==' '){c = c.substring(1,c.length);}
        if (c.indexOf(nameEQ) == 0) {
            return c.substring(nameEQ.length,c.length);
        }
    }
    return null;
}

function play(type, id, notActive) {
    if(GOOM.Audio) {
        if(type == 'radio') {
            GOOM.Audio.playRadio(id);
        } else {
            GOOM.Audio.playPodcast(id);
        }
    }
}

function playAndGo(type, id, href) {
    play(type, id);
    if(GOOM.Navigation) {
        GOOM.Navigation.load(href);
    }
}

function playRandomAndGo(type) {
    GOOM.util.Get('/radio/api/random?date=' + (new Date()).getTime(), function(r) {
        if(!r.success) {
            return;
        }
        if(GOOM.Audio && r.result) {
            GOOM.Audio.playRadio(r.result.id);
        }
    })
}

function purge(ids) {
    for(var i = 0, len = ids.length; i < len; i++) {
        el = byId(ids[i]);
        if(el) {
            el.src = el.src + '?nocache=' + (new Date()).getTime(); 
        }
    }
}

function block(ids) {
    if(typeof(ids) == 'string') {
        byId(ids).style.display = 'block';
        return;
    }
    for(var i = 0, len = ids.length; i < len; i++) {
        el = byId(ids[i]);
        if(el) {
            display = el.style.display = 'block';
        }
    }
}

function none(ids) {
    if(typeof(ids) == 'string') {
        byId(ids).style.display = 'none';
        return;
    }
    for(var i = 0, len = ids.length; i < len; i++) {
        el = byId(ids[i]);
        if(el) {
            display = el.style.display = 'none';
        }
    }
}

function toggle(hide, show) {
    none(hide);
    block(show);
} 

createNode = (function() {
    var nodeTmp = document.createElement('div'),
        nodeCache = {};
        
    return function(html) {
        var node = nodeCache[html], nodes, ret, doc = document;
        if(node) {
            return node;
        }
        
        nodeTmp.innerHTML = html;
        nodes = nodeTmp.childNodes;
        if (nodes.length === 1) { 
            ret = nodes[0].parentNode.removeChild(nodes[0]);
        } else { // return multiple nodes as a fragment
            ret = doc.createDocumentFragment();
            while (nodes.length) {
                ret.appendChild(nodes[0]); 
            }
        }
        nodeCache[html] = ret.cloneNode(true);
        return ret;
    }
})()

function setFocus(el) {
    el.blur();
    el.focus();
}

function handleUserStatus(r) {
    if(!r) {
        return false;
    }
    if(r.userNotAuth) {
        GOOM.Context.save(GOOM.Navigation.load, ['/home']);
        GOOM.user.Auth.show();
        return false;
    } else if(r.userNotConfirmed) {
        GOOM.user.Utils.showValidateEmail();
        return false;
    }
    return true;
}

function stopEvent(e) {
	e = e || window.event;
	if(e.stopPropagation) {
		e.stopPropagation();
	}
	e.cancelBubble = true;
}

function addEvent(element, type, handler) {
    if (element.addEventListener) {
        element.addEventListener(type, handler, false);
    } else {
        // assign each event handler a unique ID
        if (!handler.$$guid) handler.$$guid = addEvent.guid++;
        // create a hash table of event types for the element
        if (!element.events) element.events = {};
        // create a hash table of event handlers for each element/event pair
        var handlers = element.events[type];
        if (!handlers) {
            handlers = element.events[type] = {};
            // store the existing event handler (if there is one)
            if (element["on" + type]) {
                handlers[0] = element["on" + type];
            }
        }
        // store the event handler in the hash table
        handlers[handler.$$guid] = handler;
        // assign a global event handler to do all the work
        element["on" + type] = handleEvent;
    }
};

// a counter used to create unique IDs
addEvent.guid = 1;

function removeEvent(element, type, handler) {
    if (element.removeEventListener) {
        element.removeEventListener(type, handler, false);
    } else {
        // delete the event handler from the hash table
        if (element.events && element.events[type]) {
            delete element.events[type][handler.$$guid];
        }
    }
};

function handleEvent(event) {
    var returnValue = true;
    event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
    var handlers = this.events[event.type];
    for (var i in handlers) {
        this.$$handleEvent = handlers[i];
        if (this.$$handleEvent(event) === false) {
            returnValue = false;
        }
    }
    return returnValue;
};

function fixEvent(event) {
    event.preventDefault = fixEvent.preventDefault;
    event.stopPropagation = fixEvent.stopPropagation;
    return event;
};
fixEvent.preventDefault = function() {
    this.returnValue = false;
};
fixEvent.stopPropagation = function() {
    this.cancelBubble = true;
};

function handleEscKey(e, fn) {
    if(!e) e = window.event;
    var code = e.keyCode || e.charCode;
    if(code != 27) return;
    if(fn) fn();
}

function onActionClicked(actionName) {
    switch(actionName) {
        case 'menu-radios' :
            GOOM.Navigation.load('/radios');
            break;
        case 'menu-shows' :
            GOOM.Navigation.load('/shows');
            break;
        case 'action-share' :
            if (GOOM.Audio.currentRadioObj) {
                GOOM.user.Share.showDialog('radio', GOOM.Audio.currentRadioObj);
                break;
            }
            if (GOOM.Audio.currentPodcastObj) {
                GOOM.user.Share.showDialog('show', arguments[1]);
                break;
            }
            GOOM.user.Share.showDialog('error', {});
            break;
        case 'action-create' :
        	if (GOOM.Audio.currentRadioObj) {
        		GOOM.radio.Utils.showOverlay(false);
        	}
        	// else // radio preview - JIRA NRG-1797 - radio creation not allowed
            break;
        case 'action-shout' :
        break;
        default:
    }
   
};GOOM.util = {
    createHeadScript : function(src) {
        var el = document.createElement('script');
        el.type = 'text/javascript';
        el.src = src;
        document.getElementsByTagName('head')[0].appendChild(el);
    },

    addOption : function(el, text, value) {
        var option = new Option(text, value);
        if(YAHOO.UA && YAHOO.UA.ie) {
            el.add(option, 1);
        } else {
            el.add(option, el.options[el.options.length]);
        }
    },

    checkEmail : function(el, callback) {
        var tmpEl = el,
            innerCallback = function(r) {
                while (tmpEl.parentNode && !tmpEl.parentNode.getElementsByTagName('span')[0]) {
                    tmpEl = tmpEl.parentNode;
                }
                var span = tmpEl.parentNode.getElementsByTagName('span')[0];
                if (r.success) {
                    removeClass(tmpEl, 'invalidInput');
                    if(span) {
                        span.style.display = 'none';
                        span.className = '';
                        setText(span, '');
                    }
                    callback();
                } else {
                    addClass(tmpEl, 'invalidInput');
                    if(span) {
                        span.style.display = 'block';
                        span.className = 'unAvailable';
                        setText(span, r.message);
                    }
                }
            };
        GOOM.util.Get('/default/api/check-email?address=' + el.value, innerCallback);
    },

    stopPlayingClip : function(id) {
        if (id) 
        {
            if (GOOM.PlayItemMgr.currentEl) 
            {
                var attr = GOOM.PlayItemMgr.currentEl.attributes;
                var stopKey = 'gdata';
            	if (isNaN(id)) // id is a string telling wich kind of sound should be stopped
            	{
            		stopKey = 'kind';
            	}
            	else
            	{
	                for (var i = 0, len = attr.length; i < len; ++i) {
	                    if (attr[i].name == 'stopkey') {
	                    	stopKey = attr[i].value;
	                    	break;
	                    }
	                }
            	}
                for (i = 0, len = attr.length; i < len; ++i) {
                    if (attr[i].name == stopKey && attr[i].value == id) {
                        GOOM.PlayItemMgr.stop();
                        return;
                    }
                }
            }
        } else {
            var playClip = byId('playingPreview');

            if (playClip) {
                GOOM.PlayItemMgr.stop();
            }
        }
    },
    
    trimLeft : function(str) {
    	while(str.charAt(0) == ' ') {
    		str = str.length > 1 
				? str.substr(1) 
				: '';
    	}
    	return str;
    },
    
    trimRight : function(str) {
    	while(str.charAt(str.length - 1) == ' ') {
    		str = str.length > 1 
    			? str.substr(0, str.length - 1) 
				: '';
    	}
    	return str;
    },
    
    trim : function(str) {
    	return GOOM.util.trimLeft(GOOM.util.trimRight(str));
    },

    extend: function(objectToExtend, objectExtended) {
        var o = new objectToExtend();
        for (var p in objectExtended) {
            o[p] = objectExtended[p];
        }

        return o;
    }
}
GOOM.Event = function(type, context, signature) {
    this.type = type;
    this.scope = context || window;
    this.signature = signature || GOOM.Event.FLAT;
    this.subscribers = [];
     
    var onsubscribeType = "GOOM_ONSUBSCRIBE";
    if (type !== onsubscribeType) {
        this.subscribeEvent = 
                new GOOM.Event(onsubscribeType, this, true);

    } 
    this.lastError = null;
};
GOOM.Event.LIST = 0;
GOOM.Event.FLAT = 1;
GOOM.Event.ONCE = 'once';

GOOM.Event.prototype = {
    subscribe : function(fn, obj, type, overrideContext) {
        if (!fn) {
            throw new Error("Invalid callback for subscriber to '" + this.type + "'");
        }
        if (this.subscribeEvent) {
            this.subscribeEvent.fire(fn, obj, overrideContext);
        }
        this.subscribers.push( new GOOM.util.Subscriber(fn, obj, type, overrideContext));
    },
    
    unsubscribe : function(fn, obj) {
        var found = false;
        for (var i=0, len=this.subscribers.length; i<len; ++i) {
            var s = this.subscribers[i];
            if (s && s.contains(fn, obj)) {
                this._delete(i);
                found = true;
            }
        }
        return found;
    },
    fire : function() {
        this.lastError = null;
        var errors = [],
            len=this.subscribers.length;
        if (!len) {
            return true;
        }
        var args =[].slice.call(arguments, 0), ret=true, i, rebuild=false;
        var subs = this.subscribers.slice(), throwErrors = GOOM.Event.throwErrors;
        for (i=0; i<len; ++i) {
            var s = subs[i];
            if (!s) {
                rebuild=true;
            } else {
                var scope = s.getScope(this.scope);
                if (this.signature == GOOM.Event.FLAT) {
                    var param = null;
                    if (args.length > 0) {
                        param = args[0];
                    }
                    
                    try {
                        ret = s.fn.apply(scope, args);
                    } catch(e) {
                        this.lastError = e;
                        // errors.push(e);
                        if (throwErrors) {
                            throw e;
                        }
                    }
                    
                } else {
                    try {
                        ret = s.fn.call(scope, this.type, args, s.obj);
                    } catch(ex) {
                        this.lastError = ex;
                        if (throwErrors) {
                            throw ex;
                        }
                    }
                }
                
                if(s.type == GOOM.Event.ONCE) {
                    this._delete(i);
                }
            }
        }
        return (ret !== false);
    },
    unsubscribeAll : function() {
        var l = this.subscribers.length, i;
        for (i=l-1; i>-1; i--) {
            this._delete(i);
        }

        this.subscribers=[];

        return l;
    },

    /**
     * @method _delete
     * @private
     */
    _delete : function(index) {
        var s = this.subscribers[index];
        if (s) {
            delete s.fn;
            delete s.obj;
        }

        // this.subscribers[index]=null;
        this.subscribers.splice(index, 1);
    }
};

/////////////////////////////////////////////////////////////////////

GOOM.util.Subscriber = function(fn, obj, type , overrideContext) {
    this.type = type;
    this.fn = fn;
    this.obj = typeof(obj) === 'undefined' ? null : obj;
    this.overrideContext = overrideContext;
};

GOOM.util.Subscriber.prototype.getScope = function(defaultScope) {
    if (this.overrideContext) {
        if (this.overrideContext === true) {
            return this.obj;
        } else {
            return this.overrideContext;
        }
    }
    return defaultScope;
};

GOOM.util.Subscriber.prototype.contains = function(fn, obj) {
    if (obj) {
        return (this.fn == fn && this.obj == obj);
    } else {
        return (this.fn == fn);
    }
};
createNS('GOOM');

GOOM.Context = {
    pageObj: {},
    obj: null,
    func: null,
    args: [],

    save: function(func, args, obj) {
        this.pageObj = window.pageObj;
        this.func = func;
        this.args = args;
        if (!obj) {
            this.obj = window;
        } else {
            this.obj = obj;
        }
    },

    restore: function() {
        var pageObj = this.pageObj;
        var obj = this.obj;
        var func = this.func;
        var args = this.args;
        this.clear();

        window.pageObj = pageObj;
        if (func) func.apply(obj, args);
    },

    clear: function() {
        this.pageObj = {},
        this.obj = null;
        this.func = null;
        this.args = [];
    }
}

/* $Id: Navigation.js 26055 2011-02-14 12:31:59Z Bogdan Busuioc $ */
/**
 * Handles request that takes the user to another page on gooms website
 * @namespace GOOM
 * @module navigation
 * @requires global, list
 */

/** 
 * Handles request that takes the user to another page on gooms website
 * @class Navigation
 * @requires global
 * @requires GOOM.List
 */
GOOM.Navigation = {
    NavID : 'page',
    Events : {
        onPageReady : new GOOM.Event('G:Navigation:onPageReady'),
        onPageLeave : new GOOM.Event('G:Navigation:onPageLeave'),
        onPageChange : new GOOM.Event('G:Navigation:onPageChange')
    },
    prevHref : null,
    lockedHref : {},
    callback : false,
    curRequest : false,
    scrollSpan : 0,
    
    /**
     * Internal function used to request and pass a given page
     * @private
     * @method get
     * @param {String} url
     */    
    get : function(url) {
        var me = GOOM.Navigation;
        me.Events.onPageChange.fire(url);
        var setup = {
            success : function(data) {
                me.prevHref = url;
                if(!me.contentElement) {
                    try {
                        me.contentElement = byId(me.contentElementId);
                    } catch(e) {
                        throw "GOOM.Navigation.cotentElement not found";
                    }
                }
                me.contentElement.style.display = 'block';
                GOOM.Navigation.Events.onPageLeave.fire(url);
                try {
                    me.contentElement.innerHTML = data;
                } catch(e) {}
                //GA Helper
                if(window.pageTracker){
                    var pageStr = window.location.hash;
                    if(!pageStr.indexOf('#' + me.NavID +'=')) {
                        pageTracker._trackPageview(pageStr.replace('#' + me.NavID + '=', ''));
                    }
                }
                var scripts = me.contentElement.getElementsByTagName('script');
                var jsCode = [];
                for ( var i = 0; i < scripts.length; i++ ) {
                    jsCode.push(scripts[i].innerHTML);
                }
                var sGetter = document.createElement("script");
                sGetter.type = "text/javascript";
                if (sGetter.canHaveChildren) { 
                    sGetter.innerHTML = jsCode.join('');
                } else {
                    //IE doesnt allow nodes inside script tags
                    sGetter.text = jsCode.join('');
                }
                document.body.appendChild(sGetter);
                document.body.style.cursor = "default";
                GOOM.Navigation.Events.onPageReady.fire({});
                
                if(me.callback) {
                    me.callback();
                    me.callback = false;
                }
                //scrolling to the top
                window.scroll(0, GOOM.Navigation.scrollSpan);
                GOOM.Navigation.scrollSpan = 0;
            },
            failure: function (code, event) {
                if(document.body) {
                    document.body.style.cursor = "default";
                }
                if(code == 302) {
                    byId(me.contentElementId).style.display = 'block';
                    return;
                }
                
                if(GOOM.site && GOOM.site.Note) {
                    GOOM.site.Note.show('error', _('NAVIGATION_FAILED_LOADING_PAGE'), true);
                }
            },
            rawText : true
        };
        //makes the change seems more like a page reload, than a dynamic switch, or well that is my hope
        if(document.body) {
            document.body.style.cursor = "progress";
        }
        
        if(me.curRequest) {
            me.curRequest.abort();
        }
        requestURL = url + ((url.indexOf('?') >= 0) ? '&d=1' : '?d=1');
        // remove ajax caching if user logged IE 7/8
        try{
            if (navigator.userAgent.indexOf('MSIE') !=-1){
                requestURL= requestURL + (GOOM.User.isLoggedIn!=false?'&ref='+parseInt(100000*Math.random()):'');
            }
        }catch(e){}
        if(me.curURI == url) {
            me.curRequest.abort();
        }
        me.curRequest = new GOOM.util.Request("GET", requestURL , setup);
        me.curURI = requestURL;
    },
    /**
     * Load a a given url
     * @method load
     * @param {String} href
     */
    load : function(href, callback) {
        GOOM.util.DialogMgr.close();

        var me = GOOM.Navigation;
        if(callback) {
            me.callback = callback;
        }

        var loc = window.location;
        href = href.replace(loc.href.replace(loc.pathname + loc.hash, ''), '').replace('http://'+ loc.host, '');
        if(me.lockedHref[me.prevHref]) {
            me.lockedHref[me.prevHref](href);
            return;
        }
        
        if (!YAHOO.History.navigate(me.NavID, href)) {
            me.get(href);
        }
    },

    lock : function(href, callback) {
        GOOM.Navigation.lockedHref[href] = callback;
    },

    unlock : function(href) {
        delete GOOM.Navigation.lockedHref[href];
    },

    refresh : function(callback) {
        var hashURL = YAHOO.History.getCurrentState(GOOM.Navigation.NavID);
        if(callback) {
            GOOM.Navigation.callback = callback;
        }
        GOOM.Navigation.get(hashURL == '' ? window.location.href : hashURL);
    },
    
    setContentElementId : function(id) {
        var me = GOOM.Navigation;
        me.contentElementId = id;
    },

    scrollTo : function(id) {
        var commentArea = byId(id);
        if(commentArea) {
            GOOM.Navigation.scrollSpan = commentArea.offsetTop;
        }
    },
    
    goToElem : function(anchor){
    	window.scroll(0,$('#'+anchor).offset().top-105);
    }
};

YAHOO.use('history', function(Y) {
    NavID = GOOM.Navigation.NavID;
    var initState;
    if(window.location.hash.indexOf(NavID) == 1) {
        initState = window.location.hash.replace('#' + NavID + '=', '');
    } else {
        initState = window.location.pathname + window.location.search;
    }
    GOOM.Navigation.prevHref = initState;
    
    Y.History.register(NavID, initState).subscribe('history:moduleStateChange', function(uri) {
        GOOM.Navigation.get(uri);
    });
    
    Y.History.subscribe('history:ready', function () {
        var me = GOOM.Navigation;
        var href = Y.History.getCurrentState(me.NavID);
        if(!href || !href.length || window.location.pathname == href ) {
            return;
        }
        me.get(href);
    });
});

/* $Id: UI.js 24666 2010-12-07 11:28:24Z Adrian Tanasa $ */ 
createNS('GOOM');

GOOM.UI = {
    update : function (el, options) {
        var elements = [],
            container = el || document,
            me = GOOM.UI,
            element,
            type;
       
        var scan = function(elements) {
            // NOTE: don't optimize "i < elements.length"
            for (var i = 0; i < elements.length; ++i) {
                element = elements[i];

                type = element.getAttribute('gtype');
                if (!type || element.getAttribute('guiloaded')) {
                    continue;
                }
                element.setAttribute('guiloaded', true);
                
                //NOTE to self after the switch, the element doesnt exist anymore in its orginal state
                switch(type) {
                    case 'button' : {
                        me.btnTemplate(element);
                        element.guiloaded = true;
                        break;
                    }
                    case 'default:text' : {
                        break;
                    }
                }
            }
        };
        
        if (window.pageObj && 'RADIO' != window.pageObj.type) {
        	document.body.style.backgroundImage = "url(/img/gradient_body_bg.png)";
        }
        scan(container.getElementsByTagName('input'));
        scan(container.getElementsByTagName('select'));
        scan(container.getElementsByTagName('textarea'));
    },
    
    btnTemplate : function(el) {
        var clone = el.cloneNode(true);
        if(el.value) {
            clone.value = el.value;
        }

        var div = document.createElement('div');
        div.className = el.className;
        if(el.id) {
            div.id = el.id + 'Wrap';
        }
        if(el.type == 'file') {
            div.innerHTML = '<div class="fileUpload"><button></button><div class="fileUploadMask"><input id="' + el.id + 'HiddenInput" value=""/><div class="button primary" ><div class="bl" ><p>' + _('INPUT_BROWSER_LABEL') +'</p></div><div class="br"></div></div></div></div>'
        } else {
            div.innerHTML ='<div class="bl"><button></button></div><div class="br"></div>';
        }
        
        var btn = div.getElementsByTagName('button')[0];

        if((el.type == 'textarea' || el.type == 'text' || el.type == 'password')) {
            // Fixes Mac Firefox field input bug (when swf behind).
            if (-1 != navigator.platform.indexOf('Mac') && -1 != navigator.userAgent.indexOf('Firefox')) {
                addEvent(clone, 'mouseup', function() {
                    this.blur();
                    this.focus();
                });
            }

            if (el.title) {
                if(clone.value.length == 0) {
                    addClass(clone, 'inputTxtGrey');
                    clone.value = el.title;
                }

                var form = GOOM.util.Form;

                addEvent(clone, 'focus', function() {
                    form.fieldFocus(clone);
                });

                addEvent(clone, 'blur', function() {
                    form.fieldBlur(clone);
                });
            }
        }

        btn.parentNode.replaceChild(clone, btn);

        if (('submit' == clone.type || 'button' == clone.type) && clone.click) {
            addClass(div, 'cursorPointer');
            addEvent(div, 'click', function (e) {
                var target = e.scrElement || e.target;
                if (target && (!target.type || 'submit' != target.type && 'button' != target.type)){
                    clone.click();
                }
            });
        }
        el.parentNode.replaceChild(div, el);
    },
    
        
    thumbnailRadio : function(id, name, size) {
         return ['<a href="/radio/', id ,'" onclick="GOOM.Navigation.load(this.href); return false;" title="', name ,'"><img class="', size ,'" onload="this.style.visibility=\'visible\'" onerror="defaultImg(this, \'/img/radio_', size ,'.jpg\')" src="', window.getASSET() , '/radio/' , id , '/' , size , '"/></a>'].join('');
    },

    thumbnailDOM : function(el, type, obj, size) {
        el.alt = obj.name;
        el.src = (type == 'radio' ? '/radio/image/logo?uid=' : '/show/image/logo?id=') + obj.id  + '&converter=' + size;
        el.style.visibility = 'hidden';
        el.onload = function(){this.style.visibility='visible'}
        if(type == 'radio') {
            el.onerror = function(){defaultImg(this, '/img/radio_' + size + '.jpg')}
        } else if(type == 'show'){
            el.onerror = function(){defaultImg(this, '/img/show_' + size + '.jpg')}
        }
    },
    
    inputDefaultText : function(el) {
        batchApply(el, function bind(el) {
            if(!el) {
                return;
            }
            if(el.value == '') {
                el.value = el.getAttribute('gtext');
            }
            el.onblur = function() { if(this.value == '') this.value = el.getAttribute('gtext'); this.style.color = '#999999';};
            el.onfocus = function(){ if(this.value == el.getAttribute('gtext')) this.value =''; this.style.color = '#000000';};
        });
    }
}


GOOM.Navigation.Events.onPageReady.subscribe(function() {
    GOOM.UI.update();
});
/**
 * Provides access to goom's flex player events and functions
 * @module audio
 * @namespace GOOM
 * @title Audio Controller
 */

createNS('GOOM');

/**
 * Provides access to goom's flex player events and functions
 * @class Audio
 */
GOOM.Audio = {
    Events : {
         onReady : new GOOM.Event("G:Audio:onReady"),
         onNextSong : new GOOM.Event("G:Audio:onAudioNextSong"),
         onPodcastChange : new GOOM.Event("G:Audio:onPodcastChange"),
         onRadioChange : new GOOM.Event("G:Audio:onAudioRadioChange"),
         onPlaybackStart : new GOOM.Event("G:Audio:onPlaybackStart"),
         onPlaybackStop : new GOOM.Event("G:Audio:onPlaybackStop"),
         onDetailPage : new GOOM.Event("G:Audio:onDetailPage"),
         onLogoClick : new GOOM.Event("G:Audio:onLogoClick"),
         onBrowseMoreClick : new GOOM.Event("G:Audio:onBrowseMoreClick"),
         onShuffleItemClick : new GOOM.Event("G:Audio:onShuffleItemClick"),
         onShuffleButtonClick : new GOOM.Event("G:Audio:onShuffleButtonClick"),
         onInfoBtnClick : new GOOM.Event("G:Audio:onInfoBtnClick")
    },

    ready : false,
    bufferedEvents : [],
    flashObj : false,
    isMuted : false,
    isPlaying : false,
    playHistory : [], 
    flashAudioObj : false,
    volume : false,
    currentRadioObj : null,
    currentPodcastObj : null,
    playFilter : ["SONG","SONGPRO","UGCUSER","UGCPRO","PRIVATEUGC"],

    /** 
     * Control which flex player to use, should be called onReady
     * @method setFlashObj
     * @param {Element} flashAudioObj
     */
    setFlashObj : function(flashAudioObj) {
        this.flashAudioObj = flashAudioObj;
    },

    /** 
     * Change the radio playing to the given id
     * @method changeRadio
     * @param {String} radioId
     */
    playRadio : function(radioId){
        if(this.flashAudioObj) {
            this.flashAudioObj.playRadio(radioId);
        }
        this.currentRadioId = radioId;
    },

    playPodcast : function(podcastId, showObj) {
        if(this.flashAudioObj) {
            this.flashAudioObj.playAsset(podcastId, showObj);
        }
    },

    playSample : function(sampleId) {
        if(this.flashAudioObj ) {
            try {
                this.flashAudioObj.playAssetSample(sampleId);
            } catch(e) {} //issues with switching fast between songs. suppress bugs
        }
    },
    
    stop : function() {
        if(this.flashAudioObj) {
            this.flashAudioObj.pb_stop();
        }
    },
    
    getMediaObj : function () {
        if(this.flashAudioObj) {
            return this.flashAudioObj.getMediaObj();
        }
        return null;
    },
    
    getSongs : function() {
        if(!this.currentSongObj || !this.nextSongObj) {
            return false;
        }
        return { 
            currentSongObj : this.currentSongObj, 
             nextSongObj : this.nextSongObj 
        }
    },

    /**
     * Mute the player.
     */
    mute: function() {
        if(this.flashAudioObj) {
            this.flashAudioObj.mute(1);
        }
    },

    /**
     * Unmute the player.
     */
    unMute: function() {
        if(this.flashAudioObj) {
            this.flashAudioObj.mute(0);
        }
    },
    
    /** 
     * Internal function used to trigger a the onNextSong event
     * @private
     * @method onNextSong
     * @param {SongObject} currentSongObj
     * @param {SongObject} nextSongObj
     */
    onNextSong : function(currentSongObj, nextSongObj) {
        if(!currentSongObj || !nextSongObj){
            return;
        }
        var me = GOOM.Audio;
        me.currentSongObj = currentSongObj;
        me.nextSongObj = nextSongObj;
        
        me.playHistory.unshift(currentSongObj);
        me.Events.onNextSong.fire({currentSongObj : currentSongObj, 
                                      nextSongObj : nextSongObj});
    },
       
    /** 
     * Internal function used to trigger onPlaybackStart
     * @private
     * @method onPlaybackStart
     */
    onPlaybackStart : function() {
        this.isPlaying = true;
        this.Events.onPlaybackStart.fire({});
    },
    
    /** 
     * Internal function used to trigger onPlaybackEnd
     * @private
     * @method onPlaybackEnd
     */
    onPlaybackStop : function() {
        this.isPlaying = false;
        this.Events.onPlaybackStop.fire({});
    },
    
    /** 
     * Internal function used to trigger onReady
     * @private
     * @method onReady
     */
    onReady : function(){ 
        if(this.ready) {
            return;
        }
        this.ready = true;
        this.Events.onReady.fire({});
    },
    
    /** 
     * Internal function used to trigger onRadioChange
     * @private
     * @method onRadioChange
     * @param {RadioObject} radioObj
     */
    onRadioChange : function(radioObj) {
        if(window.GATrack) {
           window.GATrack('GOOM.Audio','onRadioChange', radioObj.id, radioObj.name);
        }
    	createCookie('lastPlayedRadioId', radioObj.id, 14);
        this.currentSongObj = null;
        this.currentRadioObj = radioObj;
        this.Events.onRadioChange.fire(radioObj);
        this.currentPodcastObj = null;
    },
    
    onPodcastChange : function(podcastObj) {
        this.currentPodcastObj = podcastObj;
        this.Events.onPodcastChange.fire();
        this.currentRadioObj = null;
    },

    onDetailPage : function(type, slug, siteId) {
        if (siteId == SITE_ID) {
            GOOM.Navigation.load('/' + type + '/' + slug);
        } else {
            GOOM.site.Navigation.switchSite(DOMAIN_PREFIX + SITES_ARRAY[SITE_ID].domain,
                                            DOMAIN_PREFIX + SITES_ARRAY[siteId].domain + '/' + type + '/' + slug);
        }
    },

    onLogoClick : function() {
        GOOM.Navigation.load('/');
    },

    onBrowseMoreClick : function() {
        GOOM.Navigation.load('/radios');
    },

    onShuffleItemClick : function(slug, id) {
        this.playRadio(id);
        GOOM.Navigation.load('/radio/' + slug);
    },

    onShuffleButtonClick : function() {
        playRandomAndGo();
    },

    onInfoBtnClick : function() {
        GOOM.Navigation.load('/about/gsound/');
    },

    /** 
     * Internal function pass on the events that it gets from the flex player
     * @private
     * @method handleEvents
     */
    handleEvents : function() {
        var eventId = arguments[0];

        try {
            switch(eventId) {
                case "onNextSong" :
                    this.onNextSong(arguments[1], arguments[2]);
                break;
                case "onPlaybackStart" :
                    this.onPlaybackStart();
                break;
                case "onPodcastChange" :
                    this.onPodcastChange(arguments[1]); 
                break;
                case "onPlaybackStop" :
                    this.onPlaybackStop();
                break;
                case "onRadioChange" :
                    this.onRadioChange(arguments[1]);
                break;
                case "onReady" :
                    this.onReady();
                break;
                case "onDetailPage" :
        			this.onDetailPage(arguments[1], arguments[2], arguments[3]);
       			break;
       			case "onLogoClick" :
                    this.onLogoClick();
                break;
                case 'onBrowseMoreClick':
                    this.onBrowseMoreClick();
                break;
                case 'onShuffleItemClick':
                    this.onShuffleItemClick(arguments[1], arguments[2]);
                break;
                case 'onShuffleButtonClick':
                    this.onShuffleButtonClick();
                break;
                case 'onInfoBtnClick':
                    this.onInfoBtnClick();
                break;
            }
        } catch(e) {
            //alert(e.message);
        }
    }
};

createNS('GOOM');

GOOM.Paginator = {
    
    template : {
        frontShowDual : {
            update : function(containerEl, r) {
                var img = containerEl.getElementsByTagName('img');
                if(r.success) {
                    for(var i = 0; i < r.shows.length; i++) {
                        if(img[i]) {
                            GOOM.UI.thumbnailDOM(img[i], 'show', r.shows[i], 't7');
                        }
                        if(img[i].parentNode && img[i].parentNode.tagName.toLowerCase() == 'a') {
                            img[i].parentNode.title = r.shows[i].name;
                            img[i].parentNode.href = '/show/' + r.shows[i].slug;
                        }
                    }
                }
            },
            limit : 2,
            api : '/show/list/promoted?limit=2&offset=%{offset}'
        }
    },
    
    left : function(el, templateId, containerId, total) {
        var el = byId(containerId);
        var curPos = parseInt(el.getAttribute('curPos') || total, 10);
        var template = this.template[templateId];
        var newPos = curPos - template.limit;
        if(newPos < 0) {
            newPos = total;
        }
        el.setAttribute('curPos', newPos);
        GOOM.util.Get(replace(this.template[templateId].api, { offset : newPos, 
                                                               limit : template.limit }), 
                      function(r) { GOOM.Paginator.template[templateId].update(byId(containerId), r)});
    },
    
    right : function(el, templateId, containerId, total) {
        var el = byId(containerId);
        var template = this.template[templateId];
        var curPos = parseInt(el.getAttribute('curPos') || 0, 10);
        var newPos = curPos + template.limit;
        if(newPos > total) {
            newPos = 0;
        }
        el.setAttribute('curPos', newPos);
        GOOM.util.Get(replace(this.template[templateId].api, { offset : newPos, 
                                                               limit : template.limit }), 
                      function(r) { GOOM.Paginator.template[templateId].update(byId(containerId), r)});
    }
}

createNS('GOOM');

GOOM.User = {
    Events : {
        onChange : new GOOM.Event('G:User:onChange'),
        onRegistered : new GOOM.Event('G:User:onRegistered')
    },

    userDetails : false,
    iframeUpdaterUrl : false,
    username : false,
    isLoggedIn : false,
    isValidated : false,

    updateDetails : function(result) {
        var me = GOOM.User,
            details = false;

        me.isValidated = me.isLoggedIn = false;
        if(result.userDetails) {
            details = result.userDetails;
            me.username = details.username;
            me.isLoggedIn = true;
            me.isValidated = (details.status == 'A');
        }

        if(result.iframeUrl) {
            me.removeLoginFrame();
            var iframe = document.createElement('iframe');
            iframe.id = 'loginIframe';
            iframe.src = result.iframeUrl;
            document.body.appendChild(iframe);
            setTimeout(me.removeLoginFrame, 10000);
        }
        me.userDetails = details;
        me.Events.onChange.fire(details);
    },

    removeLoginFrame : function() {
        if(byId('loginIframe')) {
            document.body.removeChild(byId('loginIframe'));
        }
    },

    getDetails: function() {
        return GOOM.User.userDetails;
    },

    checkStatus : function(fn) {
        var me = GOOM.User;
        if(!me.isLoggedIn) {
            GOOM.Context.save(GOOM.Navigation.load, ['/home']);
            GOOM.user.Auth.show();
            return false;
        } else if(!me.isValidated) {
            GOOM.util.Get('/user/api/user-status', function(r) { 
                if(!handleUserStatus(r)) {
                    return
                }
                me.isValidated = true;
                if(fn) {
                    fn();
                }
            });
            return false;
        }
        return true;
    }
};

/* $Id: Follow.js 27653 2011-05-03 13:18:22Z Sergio Simone $ */

GOOM.UserRadios = {
    followed : [],
    created : [],
    isUpdated : false,
    
    Events : {
        onReady : new GOOM.Event('G:Follow:onReady'),
        onChange : new GOOM.Event('G:Follow:onReady')
    },
    
    addFollow : function(radioUid, callback) {
        GOOM.util.Get('/user/api/follow?radioUid=' + radioUid, function(r) {
            if(!r.success) {
                if(!handleUserStatus(r)) {
                    return;
                }
                return;
            }
            var index = GOOM.UserRadios.followed.length;
            GOOM.UserRadios.followed[index] = r.radio;
            r.radio._index = index;
            GOOM.UserRadios.followed['_' + r.radio.uid] = r.radio;
            GOOM.UserRadios.Events.onChange.fire(r.radio, true);
        });
    },
    
    removeFollow : function(radioUid, callback) {
        var me = GOOM.UserRadios;
        var radio = me.followed['_' + radioUid];
        delete me.followed['_' + radioUid];
        me.followed.splice(radio._index, 1);
        GOOM.util.Get('/user/api/unfollow?radioUid=' + radioUid, function(r) {
            if(!r.success) {
                if(!handleUserStatus(r)) {
                    return;
                }
                return;
            }
            
            GOOM.UserRadios.Events.onChange.fire(r.radio, false);
        });
    },
    
    getFollow : function(radioUid) {
        return GOOM.UserRadios.followed['_' + radioUid];
    },
    
    handleUpdate : function(result) {
        var me = GOOM.UserRadios, radio;
        me.followed = [], me.created = [];
        if(result.success) {
            for(var i = 0, len = result.followed.length; i < len; i++) {
                radio = result.followed[i];
                if(!radio) {
                    continue;
                }
                radio._index = i;
                me.followed.push(radio);
                me.followed['_' + radio.uid] = radio;
            }

            for(i = 0, len = result.created.length; i < len; i++) {
                radio = result.created[i];
                if(!radio) {
                    continue;
                }
                radio._index = i;
                me.created.push(radio);
                me.created['_' + radio.uid] = radio;
            }
        }

        me.isUpdated = true;
        GOOM.UserRadios.Events.onReady.fire();
    },
    
    update : function() {
        GOOM.util.Get('/user/api/radios', GOOM.UserRadios.handleUpdate);
    }
}

GOOM.Navigation.Events.onPageReady.subscribe(function() {
    if(GOOM.UserRadios.isUpdated) {
        GOOM.UserRadios.Events.onReady.fire();
    }
});

GOOM.User.Events.onChange.subscribe(function(userObj) {
    if(userObj) {
        GOOM.UserRadios.update();
    } else {
        GOOM.UserRadios.isUpdated = true;
        GOOM.UserRadios.Events.onReady.fire();
    }
});

createNS('GOOM.Translate');

GOOM.Translate = {
    Events : { onChange : new GOOM.Event('G:Translate:onChange') },
    
    data : {},
    lang : false,
    update : function(data) {
        var me = GOOM.Translate;
        me.data = data;
        me.Events.onChange.fire();
    },
    
    changeLang : function(LangId) {
        
        //var script = document.createElement('Script')
        //script.src = "/"
        //script.type= "text/javascript";
        //document.head.appendChild('script')
    }
}

if(window.__text && __text.strings) {
    GOOM.Translate.data = __text.strings;
    GOOM.Translate.lang = __text.lang;
}

function _(id, args) {
    var str = GOOM.Translate.data[id];
    if(args && str) {
        str = replace(r, args);
    }
    if(!str) {
        str = id;
    }
    return str;
}


function jssocket_init() {
    GOOM.Talkback.init(document.getElementById("jsSocket"));
}

GOOM.Talkback = {
    msgTemplate  : {internal : '<span class="sayName clear"></span><span class="clear sayInit">%{body}</span>',
                    normal : '<span class="sayName clear">%{from}</span><span class="sayMsg">%{body}</span>'},

    nick : false,
    xmpp : {},

    lastMsgSend : false,
    prevRadio : false,
    connectRetry : 0,

    blacklistWords : [],
    isDisabled : false,

    init : function(flashObj) {
        var me = GOOM.Talkback;
        GOOM.Audio.Events.onRadioChange.subscribe(me.handleRadioChange);
        GOOM.User.Events.onChange.subscribe(function() {
            me.updateNick();
            me.xmpp.changeNick(me.nick);
        });
        
        me.updateNick();

        me.xmpp = GOOM.util.XMPP;
        me.xmpp.init({
            flashObj :  flashObj,
            config : window.XMPP,
            nick : me.nick
        });

        me.xmpp.addHandlers({
            onDisconnect : function() {
                byId('talkbackSayIpt').disabled = true;
                me.updateNick(true);
                me.xmpp.changeNick(me.nick);

                if(me.connectRetry < 3) {
                  ++me.connectRetry;
                  setTimeout(function() {me.xmpp.connect();}, 1500);
                }
            },
            onError   : me.handleError,
            onMessage : me.handleMessage,
            onLog     : me.handleLog,
            onConnect : me.handleStart
        });
                     
        me.xmpp.connect();
    },

    handleLog : function() {},

    updateNick : function(isTaken) {
        var me = GOOM.Talkback;
           
        if(GOOM.User.isLoggedIn) {
            if(isTaken) {
                var number = parseInt(me.nick.replace(GOOM.User.username, ''), 10);
                me.nick = GOOM.User.username + (isNaN(number) ? 1 : (number + 1));
            } else {
                me.nick = GOOM.User.username;
            }
        } else {
            me.nick = 'guest_' + parseInt(Math.random() * Math.random() * 10000, 10);
        }
    },

    handleError : function(code, msg) {
        var me = GOOM.Talkback;
        if(code == 403) {
            me.updateNick(true);
            me.xmpp.changeNick(me.nick);
        }
    },

    handleRadioChange : function() {
        var me = GOOM.Talkback,
            curRadio = GOOM.Audio.currentRadioObj,
            hideTalkback = function() {
                byId('Talkback').style.display = 'none';
                byId('Talkback-alternate').style.display = 'block';
            },
            showTalkback = function() {
                byId('Talkback').style.display = 'block';
                byId('Talkback-alternate').style.display = 'none';
            };
        if(!curRadio || !curRadio.uid || (me.xmpp &&  !me.xmpp.isConnected()) ||
           (me.prevRadio && curRadio.uid == me.prevRadio.uid)) {
            return;
        }
        me.checkDisabled(curRadio.id, function() {
            if(!GOOM.Talkback.isDisabled) {
                showTalkback();
                byId('talkbackMsgList').innerHTML = '';
                me.prevRadio = curRadio;
                me.handleMessage(null, _('TALK_MSG_JOINING') + ' ' + curRadio.name);
                me.xmpp.joinRoom(window.ENV + '_' + curRadio.uid + '@conference.' + window.XMPP.servername);
                me.blacklistInit('/user/api/talkback-blacklist');
            } else {
                byId('Talkback-alternate').innerHTML = '<img src="' + window.getASSET() + '/radio/' + curRadio.id + '_talkback" />';
                hideTalkback();
            }
        });
    },
    
    handleStart : function(status) {
        if(!status) {
            //write out failed to connect
            return;
        }
        GOOM.Talkback.handleRadioChange();
        byId('talkbackSayIpt').disabled = false;
        byId('talkbackMsgList').innerHTML = '';
    },

    sendMessage : function(ipt) {
        var me = GOOM.Talkback,
            msg = ipt.value;

        if(!msg || !me.xmpp.isConnected()) {
            return;
        }
        msg = msg.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
        if(msg == '') {
           return;
        }
        if(me.lastMsgSend) {
            var curTime = new Date().getTime();
            if(curTime - me.lastMsgSend < 2000) {
                me.handleMessage(null ,_('TALKBACK_PLEASE_NOSPAM'));
                return;
            }
        }

        if(me.blacklist(msg) == true) {
                me.handleMessage(null ,_('TALKBACK_PLEASE_BLACKLIST'));
                return;
        }

        me.lastMsgSend = new Date().getTime();
        ipt.value =  '';
        me.xmpp.message(msg);
    },

    sendMood : function(type) {
        var me = GOOM.Talkback,
            songObj = GOOM.Audio.currentSongObj;

        if(!songObj || !songObj.title ||  songObj.type !== 'SONG' || !me.xmpp.isConnected()) {
            return;
        }

        if(me.lastMsgSend) {
            var curTime = new Date().getTime();
            if(curTime - me.lastMsgSend < 2000) {
                me.handleMessage(null ,_('TALKBACK_PLEASE_NOSPAM'));
                return;
            }
        }
        me.lastMsgSend = new Date().getTime();
        if(songObj.assetMediaId) {
            GOOM.util.Get('/playlist/api/' + ((type == 'like') ? 'like' : 'dislike') +
                           '-media?mediaId=' + songObj.assetMediaId, function(r){});
        }

        var msg = songObj.artist + ' - ' + songObj.title;
        msg = ((type == 'like') ? ':like: ' : ':dislike: ') + msg;
        me.xmpp.message(msg);
    },

    handleMessage : function(from, msg) {
        var me = GOOM.Talkback;
        var htmlList = byId('talkbackMsgList');
        var curMsgLen = htmlList.getElementsByTagName('li').length;

        if(msg.length > 99) {
            msg = msg.substring(0, 97) + '...';
        }
        msg = escapeHTML(msg);
        msg = msg.replace(':like:', '<span class="sayIcon Like"></span>')
                 .replace(':dislike:', '<span class="sayIcon Dislike"></span>');

        if(from && from == me.nick){
            from = _('TALKBACK_YOU');
        }

        var li = document.createElement('li');
        li.innerHTML = replace(!from ? me.msgTemplate.internal
                                     : me.msgTemplate.normal, 
                               {from : from, body : msg});
        if(curMsgLen > 11) {
            htmlList.removeChild(htmlList.lastChild);
        }
        htmlList.insertBefore(li, htmlList.firstChild);
        curMsgLen++;
    },

    blacklistInit : function(url) {
        GOOM.util.Request('GET', url, {
            success : function(obj) {
                GOOM.Talkback.blacklistWords = obj.words;
            }
        }, 2000);
    },

    blacklist : function(msg) {
      for(var i = 0, len = GOOM.Talkback.blacklistWords.length; i < len; ++i) {
          if(msg.indexOf(GOOM.Talkback.blacklistWords[i]) != -1) {
              return true;
          }
      }

      return false;
    },

    checkDisabled : function(radioId, callback) {
        var id = (GOOM.Audio.currentRadioObj) ? GOOM.Audio.currentRadioObj.id : radioId;
        if(id) {
            GOOM.util.Request('GET', '/radio/api/talkback-disabled?id=' + id, {
                success : function(r) {
                    if(r.success) {
                        GOOM.Talkback.isDisabled = r.disabled;
                        if(callback) {
                            callback();
                        }
                    }
                }
            });
        }
    }
}
/* $Rev: 19578 $ */
GOOM.Haction = {
    //actions : ['playRadio', 'playShow', 'showNote'],
    
    execute : function() {
        var hashObj = window.location.hash.replace('#', '').split('&');
        if(!hashObj.length) {
            return;
        }
        var haction = hashObj[0];
        if(haction.indexOf(GOOM.Navigation.NavID) == 0) {
            if(!hashObj[1]) {
                return;
            }
            haction = hashObj[1];
        }
        hashObj = haction.split('=');
        var value = hashObj[1];
        switch(hashObj[0]) {
            case 'showNote' :
                this.showNote(value);
                break;
            default :
                return;
        }
    },
    
    showNote : function(action) {
        if(action == 'validate-user') {
            GOOM.site.Note.show('normal', _('VALIDATE_USER_SUCCESS'), true);
        } else if(action == 'reg-user' && GOOM.User.isLoggedIn) {
            GOOM.site.Note.show('normal', _('REGISTER_USER_SUCCESS').replace('%s', GOOM.User.username), true);
        }
    }
}

GOOM.Navigation.Events.onPageReady.subscribe(function() {
    setTimeout(function() { GOOM.Haction.execute();}, 0);
})
GOOM.PlayItemMgr = {
					   currentEl : false,
    					   newEl : false,
    				   loadingEl : false,
    			 counterInterval : false,
    			ignoreNextUiStop : false,
    didSubscribeToOnPlaybackStop : false,
     didSubscribeToOnRadioChange : false,
    
    stop : function() {
        if(GOOM.PlayItemMgr.currentEl) {
            GOOM.PlayItem(GOOM.PlayItemMgr.currentEl);
            GOOM.PlayItemMgr.currentEl = false;
        }
    },
    
	uiStart : function() 
	{
    	GOOM.PlayItemMgr.ignoreNextUiStop = false;
    	GOOM.Audio.Events.onPlaybackStart.unsubscribe(this.uiStart);
    	
    	if (!GOOM.PlayItemMgr.loadingEl) return;
    	
    	try {
	        var newEl = GOOM.PlayItemMgr.loadingEl;
	        var span = newEl.getElementsByTagName('span')[0];
            if (!span) {
                return;
            }
	        span.innerHTML = '30';
	        GOOM.PlayItemMgr.counterInterval = setInterval(function() {
	           var count = parseInt(span.innerHTML, 10);
	           if(count <= 1) {
	               GOOM.PlayItemMgr.clearUp();
	               return;
	           }
	           span.innerHTML = count - 1;
	        }, 1000);
	        GOOM.PlayItemMgr.currentEl = newEl;
	        GOOM.PlayItemMgr.loadingEl = false;
    	} catch(e) {alert(e.message);}
    },
    
	uiLoading : function() 
	{
    	if (!GOOM.PlayItemMgr.newEl) return;

    	try {
	        var newEl = GOOM.PlayItemMgr.newEl;
	        GOOM.PlayItemMgr.loadingEl = newEl;
	        GOOM.PlayItemMgr.newEl = false;
	        
	    	newEl.style.width = '50px';
	
	        var span = document.createElement('span');
	        span.id = 'playingPreview';
	        span.className = 'slider';
	        span.style.display = 'none';
	        span.innerHTML = '...';
	        newEl.appendChild(span);
	        
    	} catch(e) {alert(e.message);}
    },
    
	uiStop : function() 
	{
    	if (GOOM.PlayItemMgr.ignoreNextUiStop) {
    		return;
    	}
        GOOM.PlayItemMgr.clearUp();
	},
	
	clearUp : function()
	{
		var node = GOOM.PlayItemMgr.currentEl || GOOM.PlayItemMgr.loadingEl;
		jQuery(node).parent().attr('style',' ');
		var imga = jQuery(node).children('img').attr('id');
		try {
			if (GOOM.PlayItemMgr.counterInterval) {
				clearInterval(GOOM.PlayItemMgr.counterInterval);
				GOOM.PlayItemMgr.counterInterval = false;
			}
            if (!node) {
                return;
            }
            var span = node.getElementsByTagName('span')[0];
            if (!span) {
                return;
            }
            node.removeChild(span);
            jQuery('#'+imga).spStop(true);
            node.style.width = '';
            node.isPlaying = false;
            GOOM.PlayItemMgr.currentEl = false;
            GOOM.PlayItemMgr.loadingEl = false;
        } catch(e) {}
	}
};

GOOM.PlayItem = (function() {

    function restoreFlashNode(obj) {
    	obj.innerHTML = '<img src="/img/countdown_hover_item.png"/>';
    	
    }
    
    if (!GOOM.PlayItemMgr.didSubscribeToOnPlaybackStop) {// one subscription is enough for the same event !
    	GOOM.Audio.Events.onPlaybackStop.subscribe(GOOM.PlayItemMgr.uiStop);
    	GOOM.PlayItemMgr.didSubscribeToOnPlaybackStop = true;
    }
    
    if (!GOOM.PlayItemMgr.didSubscribeToOnRadioChange) { // only one subscription for the same event
	    GOOM.Audio.Events.onRadioChange.subscribe(function() {
	    	GOOM.PlayItemMgr.clearUp();
	    });
    	GOOM.PlayItemMgr.didSubscribeToOnRadioChange = true;
    }


    function updateUI(newEl) {
  	
    	var image = '/img/transparent.png';
        var isPlaying = newEl.isPlaying;
        imga = jQuery(newEl).children('img').attr('id');
        
        if(!GOOM.Audio.ready) {
            return;
        }
        
        try {
            if(!isPlaying) {
            	
            	var randomnumber=Math.floor(Math.random()*100);
                var imgb = randomnumber;
                jQuery('#'+imga).attr('id',imgb);
                var imga = imgb;
            	jQuery('#'+imga).sprite({fps: 4, no_of_frames: 120});
            	image = '/img/transparent.png';
                GOOM.PlayItemMgr.newEl = newEl;	// GOOM.PlayItemMgr.uiStart() will need this
            	GOOM.PlayItemMgr.clearUp();		// clear display of any loading or playing item
                GOOM.PlayItemMgr.uiLoading();	// display '...' where the countdown counter will appear
                GOOM.Audio.Events.onPlaybackStart.subscribe(GOOM.PlayItemMgr.uiStart);
                // onPlaybackStop and onPlaybackStart events will be fired by the flash player after playSample() has been called bellow
                GOOM.PlayItemMgr.ignoreNextUiStop = true; // Warning : onPlaybackStop will be fired two times !!
                GOOM.Audio.playSample(newEl.getAttribute('gdata') || newEl.gdata); 

                newEl.isPlaying = true;
                
            } else {

            	GOOM.PlayItemMgr.ignoreNextUiStop = false;
                newEl.isPlaying = false;
                var mediaObj = GOOM.Audio.getMediaObj();
                //this should be fixed better as the type on show is 'radio' ...
                if(mediaObj && (mediaObj.type == 'asset' || (mediaObj.media && mediaObj.media.asset && mediaObj.media.asset.duration <= 30000))) {
                	GOOM.Audio.stop();			// an onPlaybackStop event will be triggered
                }
                image = '/img/transparent.png';
                jQuery('#'+imga).spStop(true);
            }
        } catch(e) {alert(e.message);}
    }

    return function(target, e) {
        if(e) {
            stopEvent(e);
        }
        jQuery(target).parent().css('visibility', 'visible');
        updateUI(target);
    }
}())
createNS('GOOM.Components');

GOOM.Components = {
    
}/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: Carousel.js 21622 2010-09-01 15:27:05Z Stefen ALPER $
 */

createNS('GOOM.components');

/**
 * A simple carousel object.
 * Base on jQuery.
 */
GOOM.components.Carousel = function(element, items, options) {

    /**
     * The carousel container.
     * @var jQuery
     */
    this.element = element;

    /**
     * The carousel options.
     * @var {Object}
     */
    this.options = {
        // If 0, no auto slide, else delay in seconds.
        delay: 0,
        // Number of visible items.
        size: 3,
        // Item width
        width: 0,
        // Item height
        height: 0,
        // A callback fired when the carousel is built
        onBuilt: null,
        // A callback fired when a thumb is clicked
        onClick: null,
        // A callback fired when the slide ends.
        onSlide: null,
        // If false, no buttons, slide on click.
        // If true, next and prev buttons added.
        buttons: false,
        // If buttons are added, they will both have class buttonsClassPrefix plus
        // buttonsClassPrefix[Prev|Next]
        buttonsClassPrefix: ''
    };

    /**
     * The carousel items collection.
     * Must be an array of object like [{ thumb: string, data {... } }, ...]
     * Where thumb is the carousel thumb and data is passed in th onSlide callback.
     * @var Array
     */
    this.items = items;

    /**
     * The carousel HTML clipboard.
     * @var jQuery
     */
    this.clip = null;

    /**
     * The carousel HTML list.
     * @var jQuery
     */
    this.list = null;

    /**
     * A flag to avoid sliding concurrencies.
     * @var Boolean
     */
    this.isSliding =  false;

    jQuery.extend(true, this.options, options);
    var me = this;
}

/**
 * Resets the carousel element.
 * @return {Self}
 */
GOOM.components.Carousel.prototype.reset = function() {
    if (this.timer) {
        clearTimeout(this.timer);
    }
    jQuery('div, li', this.element).unbind('click mouseenter mouseleave');
    this.element.empty();
    return this;
};

/**
 * Builds the carousel inside the element.
 * @return {Self}
 */
GOOM.components.Carousel.prototype.build = function() {
    // Cleaning parent element and timer.
    var me = this;
    this.reset();
    this.element.css('display', 'none').empty();
    if (this.timer) {
        clearTimeout(this.timer);
        this.timer = null;
    }

    // Out if no items provided or number of items lesser than the carousel size.
    if (this.items.length < 1 || this.items.length < this.options.size) {
        return this;
    }

    // Building carousel clip.
    this.clip = jQuery('<div/>')
        .css({
            width: this.options.size * this.options.width + 'px',
            height: this.options.height + 'px',
            margin: 0,
            padding: 0,
            overflow: 'hidden'
        });
    this.element.append(this.clip);

    // If not buttons, sliding on clip click.
    if (!this.options.buttons) {
        this.clip.click(function(e) {
            me.slideLeft.apply(me, arguments);
        });
    }
    // Building buttons.
    else if (this.options.size < this.items.length) {
        this.element
            .prepend(jQuery('<div/>')
                .addClass(this.options.buttonsClassPrefix + ' ' + this.options.buttonsClassPrefix + 'Prev')
                .click(function(e) { me.slideRight.apply(me, arguments); }))
            .append(jQuery('<div/>')
                .addClass(this.options.buttonsClassPrefix + ' ' + this.options.buttonsClassPrefix + 'Next')
                .click(function(e) { me.slideLeft.apply(me, arguments); }));
    }

    // Building the thumbs list.
    this.list = jQuery('<ul/>').css({
        listStyleType: 'none',
        width: this.items.length * this.options.width + 'px',
        margin: 0,
        padding: 0
    });
    this.clip.append(this.list);

    // Feeding the thumbs list.
    jQuery.each(this.items, function(index, item) {
        me.list.append(me.setThumbEvents(
            jQuery('<li><img src="' + item.thumb + '"/></li>')
                .children().css('opacity', 0.5)
                .parent().css('display', 'inline')
                .attr('cIndex', index)
        ));
    });

    // Setting the timer if needed.
    if (this.options.delay > 0 && this.options.size < this.items.length) {
        this.timer = setTimeout(function() {me.slideLeft.apply(me, arguments);}, this.options.delay * 1000);
    }

    // Dispatching the initial slide.
    this.options.onBuilt && this.options.onBuilt(this.items[this.items.length - 1].data);
    this.element.css('display', 'block');
    return this;
};

/**
 * Centralizes the thumb events handlers.
 * @method setThumbEvents
 * @param {jQuery} element
 */
GOOM.components.Carousel.prototype.setThumbEvents = function(element) {
    element.unbind('click mouseenter mouseleave');

    var me = this;
    if (this.options.onClick && this.options.size < this.items.length) {
        element.bind('click', function(e) {
            me.options.onClick(me.items[jQuery(this).attr('cIndex')].data);
        });
    }

    return element
        .bind('mouseenter', function() {
            jQuery(this).children().css('opacity', 1);
            if (me.timer) {
                clearTimeout(me.timer);
                me.timer = null;
            }
        })
        .bind('mouseleave', function() {
            jQuery(this).children().css('opacity', 0.5);
            if (!me.timer) {
                me.timer = setTimeout(function() {me.slideLeft.apply(me, arguments);}, me.options.delay * 1000);
            }
        });
};

/**
 * Slides the carousel to the left, and fire the onSlide callback.
 */
GOOM.components.Carousel.prototype.slideLeft = function() {
    if (this.options.size == this.items.length) {
        return;
    }

    if (!this.isSliding) {
        this.isSliding = true;
        if (this.timer) {
            clearTimeout(this.timer);
            this.timer = null;
        }
        var me = this, el = jQuery('li', me.list).first();
        el.animate(
            {marginLeft: '-=' + me.options.width},
            500, 'swing',
            function() {
                me.list.append(me.setThumbEvents(el.first().remove().css('marginLeft', 0)));
                me.isSliding = false;
                if (me.options.delay > 0) {
                    me.timer = setTimeout(function() {me.slideLeft.apply(me, arguments);}, me.options.delay * 1000);
                }

                var index = parseInt(me.list.children().last().attr('cIndex'), 10);
                me.options.onSlide && me.options.onSlide(me.items[index].data);
            }
        );
    }
};

/**
 * Slides the carousel to the left, and fire the onSlide callback.
 */
GOOM.components.Carousel.prototype.slideRight = function() {
    if (this.options.size == this.items.length) {
        return;
    }

    if (!this.isSliding) {
        this.isSliding = true;
        if (this.timer) {
            clearTimeout(this.timer);
            this.timer = null;
        }
        var me = this,
            el = jQuery('li', me.list).last().css('marginLeft', -this.options.width).remove();
        me.list.prepend(this.setThumbEvents(el));
        el.animate(
            {marginLeft: '+=' + me.options.width},
            500, 'swing',
            function() {
                me.isSliding = false;
                if (me.options.delay > 0) {
                    me.timer = setTimeout(function() {me.slideLeft.apply(me, arguments);}, me.options.delay * 1000);
                }

                var index = parseInt(me.list.children().first().attr('cIndex'), 10);
                me.options.onSlide && me.options.onSlide(me.items[index].data);
            }
        );
    }
};
/**
 * Provides a interface to the xmlHttpRequest object
 * Depend on having JSON_2.js either native or in script
 * @module Request
 * @namespace GOOM
 */

createNS('GOOM.util');

/**
 * Provides a interface to the xmlHttpRequest object
 * Depend on having JSON_2.js either native or in script
 * Example :
 *  var request = new GOOM.util.Request('GET',
 *                                    'http://goomradio.com/api/login',
 *                                     { success : function(data) {...},
 *                                       failure : function(code, event) {...}  },
 *                                     10000);
 *                                     request.abort();
 *
 * @class Request
 * @namespace GOOM.util.Request
 * @param {String} method GET or POST
 * @param {String} url
 * @param {Object} callbackObj
 * @param {int} timeout
 * @constructor
 */

GOOM.util.Request = function(method, url, callbackObj, timeout) {
  callbackObj = callbackObj || {};
  if(!method || !url) {
    return false;
  }
  var xmlHttpObj = null;
  try {
    if(window.XMLHttpRequest) {
      xmlHttpObj = new XMLHttpRequest();
    } else {
    	// see http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
    	var progIDs = ['Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP'];
        
        for (var i = 0; i < progIDs.length; i++) {
            try {
            	xmlHttpObj = new ActiveXObject(progIDs[i]);
                break;
            }
            catch (e) {
            	xmlHttpObj = null;
            }
        }

      //xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
    }
  } catch(e) {
      return false;
    //throw e;
  }

  xmlHttpObj.open(method.toUpperCase(), url, true);
  if(method.toUpperCase() == 'POST') {
    xmlHttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  }
  xmlHttpObj.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  xmlHttpObj.onreadystatechange = function() {
    if((xmlHttpObj.readyState == 4) && callbackObj.success) {
      if(xmlHttpObj.status == 200) {
        try {
            var result = callbackObj.rawText === true ? xmlHttpObj.responseText : JSON.parse(xmlHttpObj.responseText);
            callbackObj.success(result);
        } catch(e) {
          if(e.type == 'unexpected_token') {
              return;
          }
          if(callbackObj.failure) {
            callbackObj.failure(200, e);
          }
        }
      } else if(callbackObj.failure){
        callbackObj.failure(xmlHttpObj.status, null)
      }
    }
  }

  xmlHttpObj.send(callbackObj.postData || '');
  if(timeout) {
    setTimeout(function() {
        try {
            if(xmlHttpObj.readyState != 4) {
                xmlHttpObj.abort();
            }
        } catch(e) {}
    }, timeout);
  }
  /**
   * Aborts the request, and trigger on failure if its set in callbackObj
   * @method abort
   */
  this.abort = function() {
     xmlHttpObj.onreadystatechange = function() {};
     xmlHttpObj.abort();
  };
  /**
   * Gets the used xmlHttpRequest object
   * @method getXmlHttpRequest
   * @return {Native Object} xmlHttpRequest
   */
  this.getXmlHttpRequest = function() {
     return xmlHttpObj;
  }
}/* $Rev: 15926 $ */
createNS('GOOM.util');

GOOM.util.FormRequest = function(formEl, callbackObj) {
    var data = [], item = 0;
    
    for(var i = 0, len = formEl.elements.length; i < len; ++i) {
        var el = formEl.elements[i], param;
        
        if(el.disabled && !el.name) {
            continue;
        }
        param = encodeURIComponent(el.name) + '=' + encodeURIComponent(el.value);
        switch(el.type) {
            case 'radio':
            case 'checkbox':
                if(el.checked) {
                    data[item++] = param;
                }
                break;
            case 'file':
            case 'reset':
            case 'button':
            case 'submit':
            case undefined:
                // stub case for input type button elements.
                break;
            default:
                if(el.getAttribute('gtext') != el.value) {
                    data[item++] = param;
                }
        }
    }
    if(!callbackObj.postData) {
        callbackObj.postData = '';
    }
    if(callbackObj.postData.indexOf('&') != 0) {
        callbackObj.postData += '&';
    }
    callbackObj.postData += data.join('&');
    return new GOOM.util.Request('POST', formEl.action, callbackObj);
}
GOOM.util.Get = function(url, success, timeout) {
   new GOOM.util.Request('GET', url, {success: success}, timeout);
}/* $Rev: 16404 $ */

createNS('GOOM.util');

GOOM.util.DialogMgr = {
    dialogId : 0,
    curDialog : false,
    lastTriggerElement : {},
    handleEscKey : function(e) {
        handleEscKey(e, function() { GOOM.util.DialogMgr.close(); });
        removeEvent(document, 'keydown', GOOM.util.DialogMgr.handleEscKey);
    },
    handleMouseMove : function(e) {
        e = e || window.event;
        var dialogObj = GOOM.util.DialogMgr.curDialog,
            triggerEl = GOOM.util.DialogMgr.lastTriggerElement,
            related = (e.target) ? e.target : e.srcElement;

        try {
            if(triggerEl == related || containsNode(triggerEl, related)) {
                return;
            }
            if(containsNode(dialogObj.containerEl, related)) {
                return;
            }
        } catch(e) {
            return;
        }
        
        GOOM.util.DialogMgr.close();
        removeEvent(document, 'mousemove', GOOM.util.DialogMgr.handleMouseMove);
    },
    close : function(dialogObj) {
        var me = GOOM.util.DialogMgr,
            dialog = dialogObj || me.curDialog,
            select = document.getElementsByTagName('select');

        for(var i = 0, len = select.length; i < len; i++) {
            select[i].style.visibility = 'visible';
        }
        if(!dialog || !dialog.containerEl) {
            return;
        }

        window.onresize = null;

        if(byId('dialogMask')) { 
            byId('dialogMask').style.display = 'none';
        }
        var parentNode = dialog.containerEl.parentNode;
        if(parentNode) {
            parentNode.removeChild(dialog.containerEl);
        }
        if (dialog.closeFn) {
            dialog.closeFn();
        }
    },
    setCurDialog : function(dialogObj) {
        var me = GOOM.util.DialogMgr;
        me.close();
        me.curDialog = dialogObj;
    },
    getCurDialog : function(){
        return GOOM.util.DialogMgr.curDialog;
    }
};

GOOM.util.Dialog = function(options) {
    var dialogObj = {},
        loading = '<div style="height: 250px; background:url(/img/loading_big.gif) 190px 100px no-repeat" /></div>',
        template = '<div class="modalWrapper"><div class="topModal"><div class="closeContainer"><a href="#" onclick="GOOM.util.DialogMgr.close(); return false;" class="closeModal">close window</a></div></div><div class="mainModal clearfix"><div class="mainGradient clearfix"></div></div><div class="bottomModal"></div></div>',
        template_error = '<div class="modalWrapper errorWrapper"><div class="topModal"><div class="closeContainer"><a href="#" onclick="GOOM.util.DialogMgr.close(); return false;" class="closeModal">close window</a></div></div><div class="mainModal clearfix"><div class="mainGradient clearfix"></div></div><div class="bottomModal"></div></div>',
        overlay = '<div class="dropDown clearfix"><div class="dropDownArrow"></div><div class="dropDownContainer clearfix"></div></div>',
        menu = '<div class="dropDown clearfix"><div class="dropDownContainer clearfix"></div></div>';

        
    var containerEl = document.createElement('div');
    containerEl.style.position = 'absolute';
    if(options.width) {
        containerEl.style.width = options.width + 'px';
    }
    containerEl.className = "overlay";
    if(options.isModal && options.isError) {
        containerEl.innerHTML = template_error;
    } else if(options.isModal) {
        containerEl.innerHTML = template;
    } else if(options.isMenu) {
        containerEl.innerHTML = menu;
    } else {
        containerEl.innerHTML = overlay;
    }
    
    if(options.isNarrow) {
      addClass(containerEl, "overlayNarrow");
    }
    
    if(options.isModal) {
        dialogObj.contentEl = containerEl.getElementsByTagName('div')[4];
    } else if(options.isError) {
        dialogObj.contentEl = containerEl.getElementsByTagName('div')[4];
    } else if(options.isMenu) {
        dialogObj.contentEl = containerEl.getElementsByTagName('div')[0];
    } else {
        dialogObj.contentEl = containerEl.getElementsByTagName('div')[2];
        dialogObj.arrowEl = containerEl.getElementsByTagName('div')[1];
    }

    if(options.closeFn) {
        dialogObj.closeFn = options.closeFn;
    }
    
    dialogObj.id = GOOM.util.DialogMgr.dialogId++;
    
    dialogObj.containerEl = containerEl;
    
    function updatePositionModale() {
        var maskEl = byId('dialogMask');
        if(maskEl) {
            maskEl.style.height = (getPageHeight() + 'px');
            maskEl.style.width =  (getPageWidth() + 'px');
            maskEl.style.display = 'block';
        }
        
        var addtop = 0;
        if(dialogObj.containerEl.offsetHeight > document.documentElement.clientHeight) {
            addtop = 100;
        }
        
        var scrollTop = document.documentElement.scrollTop;
        if(!scrollTop) {
            scrollTop = document.body.scrollTop;
        }
        
        dialogObj.containerEl.style.top = addtop + (scrollTop + document.documentElement.clientHeight/2 - (dialogObj.containerEl.offsetHeight/ 2))  + 'px';
        dialogObj.containerEl.style.left = (document.body.clientWidth/2 - (dialogObj.containerEl.offsetWidth/ 2)) + 'px';

    }
   
    function updatePositionOverlay(triggerEl, alignEl) {
       if(!triggerEl) {
           return;
       }
       YAHOO.use('node', function(Y) {
           var tPos = Y.get(triggerEl).getXY();
           if(alignEl) {
               var aPos =  Y.get(alignEl).getXY();
               dialogObj.containerEl.style.left = aPos[0] + 'px';
               if(dialogObj.arrowEl) {
                   dialogObj.arrowEl.style.width = '19px';
                   dialogObj.arrowEl.style.marginLeft = tPos[0] - aPos[0] + (triggerEl.offsetWidth / 2) - dialogObj.arrowEl.offsetWidth/2 + 'px';
               }
               dialogObj.containerEl.style.top = (tPos[1] + triggerEl.offsetHeight) + 'px';
               if(YAHOO && YAHOO.UA.ie && YAHOO.UA.ie < 8) {
                    if(dialogObj.arrowEl) {
                        dialogObj.arrowEl.style.marginRight = (dialogObj.containerEl.offsetWidth - 19 - (triggerEl.offsetWidth/ 2) - (dialogObj.arrowEl.offsetWidth/2)) + 'px';
                    }
                    dialogObj.containerEl.style.marginLeft = (-dialogObj.containerEl.offsetWidth/2) + 'px';
               }
           } else { 
               dialogObj.containerEl.style.left = (pos[0] + triggerEl.offsetWidth/2 - dialogObj.containerEl.offsetWidth/2)  + 'px';
               dialogObj.containerEl.style.top = (pos[1] + triggerEl.offsetWidth) + 'px';
           }
       });
   }
   
    function getPageHeight(){
        var height;
        if(document.body.scrollHeight > document.body.offsetHeight) {
            height = document.body.scrollHeight;
        } else {
            height = document.body.offsetHeight > 0 ? document.body.offsetHeight : 
                                                     (window.innerHeight + window.scrollMaxY);
        }
        var container = byId('container');
        if(container && container.scrollHeight > height) {
            height=container.scrollHeight;
        }
        
        if(height < screen.height) {
            height = screen.height;
        }
        return height;
    }
    
    function getPageWidth() {
        var width;
        if(document.body.scrollWidth > document.body.offsetWidth) {
            width = document.body.scrollWidth;
        } else {
            width = document.body.offsetWidth > 0 ? document.body.offsetWidth : 
                                                     (window.innerWidth + window.scrollMaxX);
        }
        var container = byId('container');
        if (container && container.scrollWidth > width) {
            width=container.scrollWidth;
        }
        return width;
    }
  
    this.open = function(triggerEl, alignEl) {

        GOOM.util.DialogMgr.lastTriggerElement = triggerEl;

        addEvent(document, 'keydown', GOOM.util.DialogMgr.handleEscKey);
        
        GOOM.util.DialogMgr.setCurDialog(dialogObj);
        document.body.appendChild(dialogObj.containerEl);

        addEvent(document, 'mousemove', GOOM.util.DialogMgr.handleMouseMove);
        
        if(options.isModal) {
            var select = document.getElementsByTagName('select');
            for(var i = 0, len = select.length; i < len; i++) {
                select[i].style.visibility = 'hidden';
            }
            select = dialogObj.containerEl.getElementsByTagName('select');
            for(i = 0, len = select.length; i < len; i++) {
                select[i].style.visibility = 'visible';
            }
            var maskEl = byId('dialogMask');
            if(!maskEl) { 
                maskEl = document.createElement('div');
                maskEl.className = 'mask';
                maskEl.id = 'dialogMask';
                maskEl.onclick = function(){GOOM.util.DialogMgr.close()};
                document.body.appendChild(maskEl); 
            } else {
                maskEl.style.display = 'block';
            }
            window.onresize = updatePositionModale;
            updatePositionModale();
        } else {
            updatePositionOverlay(triggerEl, alignEl);
            window.onresize = function() {updatePositionOverlay(triggerEl, alignEl);};
        }
        var inputs = dialogObj.contentEl.getElementsByTagName('input');
        for(i = 0, len = inputs.length; i < len; ++i) {
            var input = inputs[i];
            if(input.type == 'text') {
                input.focus();
                break;
            }
        }
    };
    
    this.setHTML = function(html, noRender) {
        dialogObj.contentEl.innerHTML = html;
        if(!noRender) {
            GOOM.UI.update(dialogObj.contentEl);
        }
    };
    
    this.loading = function() {
        dialogObj.contentEl.innerHTML = loading;
    },
    
    this.close = function(){ 
        GOOM.util.DialogMgr.close(dialogObj);
    };
    
    this.getContainer = function() {
        return dialogObj.contentEl;
    };
    
    this.isOpen = function() {
        return dialogObj.id === GOOM.util.DialogMgr.getCurDialog().id;
    };
}

/* $Rev$ */

GOOM.util.MenuMgr = {
    Events : {},
    menuId : 0,
    curMenu : false,
    lastTriggerElement : {},
    handleEscKey : function(e) {
        handleEscKey(e, function() { GOOM.util.MenuMgr.close(); });
        removeEvent(document, 'keydown', GOOM.util.MenuMgr.handleEscKey);
    },
    handleMouseMove : function(e) {
        e = e || window.event;

        var me = GOOM.util.MenuMgr,
            menuObj = me.curMenu,
            triggerEl = me.lastTriggerElement,
            related = (e.target) ? e.target : e.srcElement;

        try {
            if(triggerEl == related || containsNode(triggerEl, related)) {
                return;
            }
            if(containsNode(menuObj.containerEl, related)) {
                return;
            }
        } catch(e) {
            return;
        }

        me.close();
        removeEvent(document, 'mousemove', me.handleMouseMove);
    },
    close : function(menuObj) {
        var me = GOOM.util.MenuMgr,
            menu = menuObj || me.curMenu,
            select = document.getElementsByTagName('select');

        for(var i = 0, len = select.length; i < len; ++i) {
            select[i].style.visibility = 'visible';
        }

        if(!menu || !menu.containerEl) {
            return;
        }

        window.onresize = null;

        var parentNode = menu.containerEl.parentNode;

        if(parentNode) {
            parentNode.removeChild(menu.containerEl);
        }
        if(menu.closeFns) {
            for (i = 0, len = menu.closeFns.length; i < len; ++i) {
                menu.closeFns[i]();
            }
        }
    },
    setCurMenu : function(menuObj) {
        var me = GOOM.util.MenuMgr;
        me.close();
        me.curMenu = menuObj;
    },

    getCurMenu : function(){
        return GOOM.util.MenuMgr.curMenu;
    },

    onEntryOver : function(el) {
        addClass(el, 'selected');
    },

    onEntryOut : function(el) {
        removeClass(el, 'selected');
    },

    onSubentryOver : function(el) {
        addClass(el.children[0], 'selected');
        el.children[1].style.display='block';
    },

    onSubentryOut : function(el) {
        el.children[1].style.display='none';
        removeClass(el.children[0], 'selected');
    }

};

GOOM.util.Menu = function(options) {
    var menuObj = {},
        template = {
            container : '<div class="span-2 searchOverlay">' +
                            '<ul class="navSection">' +
                                '%{entries}' +
                            '</ul>' +
                        '</div>',
            menuEntry : '<li class="%{className}">' +
                            '<a id="%{id}" href="%{href}" role="menuitem" aria-haspopup="true" tabindex="-1" onclick="%{onclick}" onmouseover="GOOM.util.MenuMgr.onEntryOver(this);" onmouseout="GOOM.util.MenuMgr.onEntryOut(this);">' +
                                '%{image}' +
                                '%{label}' +
                            '</a>' +
                        '</li>',
            submenuEntry : '<li id="navUserRadiosCreated" class="%{className}" onmouseover="GOOM.util.MenuMgr.onSubentryOver(this);" onmouseout="GOOM.util.MenuMgr.onSubentryOut(this);">' +
                               '<a href="#" onclick="%{onclick}">' +
                                   '<em>' +
                                       '%{label}' +
                                   '</em>' +
                               '</a>' +
                               '<div id="submenu" style="display:none;">' +
                                   '<div>' +
                                       '<ul class="navDashboard">' +
                                           '%{content}' +
                                       '</ul>' +
                                   '</div>' +
                               '</div>' +
                           '</li>',
            submenuEntryContent : '<li id="navUserRadiosCreated">' +
                                      '<a href="%{href}" onclick="%{onclick}" onmouseover="GOOM.util.MenuMgr.onEntryOver(this);" onmouseout="GOOM.util.MenuMgr.onEntryOut(this);">%{label}</a>' +
                                  '</li>'
        },
        containerEl = document.createElement('div');
    if (options) {
        var openFns = options.openFns,
            closeFns = options.closeFns;
    }

    containerEl.style.position = 'absolute';
    if(options && options.width) {
        containerEl.style.width = options.width + 'px';
    }
    containerEl.className = "overlay";

    function updatePositionOverlay(triggerEl, alignEl) {
       if(!triggerEl) {
           return;
       }
       YAHOO.use('node', function(Y) {
           var tPos = Y.get(triggerEl).getXY();
           if(alignEl) {
               var aPos =  Y.get(alignEl).getXY();
               menuObj.containerEl.style.left = aPos[0] + 'px';
               if(menuObj.arrowEl) {
                   menuObj.arrowEl.style.width = '19px';
                   menuObj.arrowEl.style.marginLeft = tPos[0] - aPos[0] + (triggerEl.offsetWidth / 2) - menuObj.arrowEl.offsetWidth/2 + 'px';
               }
               menuObj.containerEl.style.top = (tPos[1] + triggerEl.offsetHeight) + 'px';
               if(YAHOO && YAHOO.UA.ie && YAHOO.UA.ie < 8) {
                    if(menuObj.arrowEl) {
                        menuObj.arrowEl.style.marginRight = (menuObj.containerEl.offsetWidth - 19 - (triggerEl.offsetWidth/ 2) - (menuObj.arrowEl.offsetWidth/2)) + 'px';
                    }
                    menuObj.containerEl.style.marginLeft = (-menuObj.containerEl.offsetWidth/2) + 'px';
               }
           } else {
               menuObj.containerEl.style.left = (triggerEl.offsetWidth/2 - menuObj.containerEl.offsetWidth/2)  + 'px';
               menuObj.containerEl.style.top = (triggerEl.offsetWidth) + 'px';
           }
       });
    }

    this.setContents = function(contents) {
        var entries = '';
        for(var i = 0, entry = '', c = contents, len = c.length; i < len; ++i, entry = '') {
            if(c[i].content) {
                for(var j = 0, len2 = c[i].content.length; j < len2; ++j) {
                    entry += replace(template.submenuEntryContent,
                                     {href  : c[i].content[j].href,
                                      label : c[i].content[j].label,
                                      onclick : (!c[i].content[j].siteId || c[i].content[j].siteId == SITE_ID) ?
                                                 'GOOM.Navigation.load(this.href); return false;' :
                                                 'GOOM.site.Navigation.switchSite(\'' + DOMAIN_PREFIX + SITES_ARRAY[c[i].content[j].siteId].domain + '\', \'' + c[i].content[j].href + '\', GOOM.Audio.currentRadioObj.id); return false;'});
                }
                entries += replace(template.submenuEntry,
                                   {label     : c[i].label,
                                    className : (c[i].className) ? c[i].className : '',
                                    onclick   : (c[i].onclick) ? c[i].onclick : 'return false;',
                                    content : entry});
            } else {
                entries += replace(template.menuEntry,
                                   {image     : (c[i].image) ? '<img src="' + c[i].image + '"/>' : '',
                                    label     : c[i].label,
                                    href      : c[i].href,
                                    onclick   : (c[i].onclick) ? c[i].onclick : 'return false;',
                                    className : (c[i].className) ? c[i].className : ''});
            }
        }
        menuObj.id = GOOM.util.MenuMgr.menuId++;
        menuObj.containerEl = containerEl;
        menuObj.containerEl.innerHTML = replace(template.container, {entries : entries});
        menuObj.contentEl = containerEl.getElementsByTagName('div')[0];
        menuObj.closeFns = closeFns;
    };

    this.open = function(triggerEl, alignEl) {
        var me = GOOM.util.MenuMgr;
        me.lastTriggerElement = triggerEl;

        addEvent(document, 'keydown', me.handleEscKey);
        addEvent(document, 'mousemove', me.handleMouseMove);

        me.setCurMenu(menuObj);
        document.body.appendChild(menuObj.containerEl);

        updatePositionOverlay(triggerEl, alignEl);
        window.onresize = function() {updatePositionOverlay(triggerEl, alignEl);};
        if(openFns) {
            for(var i = 0, len = openFns.length; i < len; ++i) {
                openFns[i]();
            }
        }
    };

    this.close = function() {
        GOOM.util.MenuMgr.close(menuObj);
    };

    this.isOpen = function() {
        return menuObj.id === GOOM.util.MenuMgr.getCurMenu().id;
    };
}/* $Rev: 16006 $ */

createNS('GOOM.util');

/**
 *  Container for holder callback function 
 *  for the uploadFile method
 *  @private
 *  @property _uploadFileCall
 *  @see uploadFile
 */
GOOM.util.FileUploadStore = {};

/**
 *  File upload function
 */
GOOM.util.FileUpload = function(el, url, fn, queryArray, method) {
    
        var formEl = el;
        while(formEl) {
            if(formEl && formEl.tagName.toLowerCase() == 'form') {
                break;
            }
            formEl = formEl.parentNode;
        }
        
        el.parentNode.getElementsByTagName('input')[1].value = el.value;
        
        var count = GOOM.util.FileUpload.count;
        var inputTemplate = '<input type="hidden" name="%{name}" value="%{value}"/>'; 
        var queryHTML = [];
        if(queryArray) {
            for(var i = 0, len = queryArray.length; i < len; ++i) {
                queryHTML.push(replace(inputTemplate, { name : queryArray[i].name,
                                                        value : queryArray[i].value }));
            }
        }
        
        queryHTML.push(replace(inputTemplate, { name : 'json_function',
                                                value : 'GOOM.util.FileUploadStore.fn_' + count}));
    
        var queryEl = document.createElement('div');
        queryEl.innerHTML = queryHTML.join('');
    
        var clone = formEl.cloneNode(true);
        
        var txt = formEl.getElementsByTagName('textarea'),
            clonetxt = clone.getElementsByTagName('textarea');
        
        for(i = 0, len = txt.length; i < len; ++i) {
            clonetxt[i].value = txt[i].value;
        }
        
        var select = formEl.getElementsByTagName('select'),
            cloneSelect = clone.getElementsByTagName('select');
        
        for(i = 0, len = select.length; i < len; ++i) {
            cloneSelect[i].value = select[i].value; 
        }
        
        var elements = [];
        for(i = 0, len = formEl.elements.length; i < len; ++i) {
            if(formEl.elements[i] !== el) {
                if(formEl.elements[i].tagName.toLowerCase() == 'fieldset') {
                    continue;
                }
                formEl.elements[i].disabled = true;
                elements.push(formEl.elements[i]);
            } else {
                formEl.elements[i].disabled = false;
            }
            
        }
        
        var container = document.createElement('div');
        container.style.display = "none";
        container.id = "uploadFile_container_" + count;
      
        document.body.appendChild(container);
      
        var iframeName = 'uploadIframe_' + count;
        try {
            var iframe = document.createElement('<iframe name="' + iframeName+ '>');
        } catch (e) {
            iframe = document.createElement('iframe');
        }
        iframe.setAttribute('name', iframeName);
        container.appendChild(iframe);
       
        formEl.target = iframeName;
        formEl.setAttribute((_isIE && !document.documentMode) ? 'encoding' : 'enctype', 'multipart/form-data');
        
        formEl.method = (method || 'POST');
        formEl.action = url;
        formEl.appendChild(queryEl);
        
        //doing a bit of house cleaning
        GOOM.util.FileUploadStore['fn_' + count] = function(data) {
            enableFields(formEl.elements);
            container.parentNode.removeChild(container);
            GOOM.util.FileUploadStore['fn_' + count] = null;
            fn(data);
        }
        formEl.submit();
        
        formEl.parentNode.replaceChild(clone, formEl);
        GOOM.util.FileUpload.count++;
}

GOOM.util.FileUpload.count = 1;

GOOM.util.FatalMsg = function(options) {
    options.title = options.title || _('FATAL_MSG_TITLE');
    var template = '<div><h2 class="titleFatal">%{title}</h2><p>%{description}</p><form class="modalForm"><fieldset><legend></legend><div class="containerSubmit"><input onclick="GOOM.util.DialogMgr.close(); return false;" gtype="button" class="clear button standard" value="%{ok}" type="submit"></div></fieldset></form></div>';
    var html = replace(template,{ description : options.message, title : options.title, ok : _('OKAY')});
    var dialog = new GOOM.util.Dialog({isError: true, isModal : true, isNarrow : true});
    
    dialog.setHTML(html);
    dialog.open();
}
GOOM.util.Paginator = function(total, limit, offset, range){
    total = parseInt(total, 10);
    limit = parseInt(limit, 10);
    offset = parseInt(offset, 10);
    range = parseInt(range, 10);

    var totalPages = Math.ceil(total/limit);
    if (totalPages <= 0){
        return;
    }

    var curPage = Math.ceil(offset / limit);

    var hasNext = (offset + limit < total) ? Math.min(offset + limit, total) : false;
    var hasPrev = (curPage > 0) ? Math.max(offset - limit + 1, 0) : false;

    var startPage;
    if (curPage <= range) {
        startPage = 0;
    } else if (curPage + range < totalPages){
        startPage = curPage - range;
    } else {
        startPage = ( totalPages - range - range - 1 > 0 ) ? totalPages - range - range - 1 : 0;
    }

    var totalRange = (range + range + 1) < totalPages ? (range + range + 1) : totalPages;

    var pageList = [];
    for (var i = 0; i < totalRange; i++) {
        pageList.push({ 'pageNumber' : i + startPage + 1,
                        'selected'   : i + startPage == curPage,
                        'offset'     : Math.max((i + startPage) * limit, 0) });
    }
    
    var writeFn = function(elTarget, callFn) {
        var q, i, pagerHTML = [];
        
        if(hasPrev) {
            pagerHTML.push('<a class="smalllinkpager leftSlide" offset="' + (hasPrev - 1) +'" href="#"><img src="/img/left.png" alt="previous page"></a>&nbsp;')
        }
        for(q = 0; q < pageList.length; q++) {
            curPage = pageList[q];
            if(curPage.selected) {
                pagerHTML.push('<strong class="active">' + curPage.pageNumber + '</strong>');
            } else {
                pagerHTML.push(replace('<a offset="%{offset}" href="#">%{page}</a>', { page : curPage.pageNumber, offset : curPage.offset}));
            }
        }
        if(hasNext) {
            pagerHTML.push('<a class="smalllinkpager rightSlide" offset="' + hasNext + '" href="#"><img src="/img/rightexplorer.png" alt="next page"></a>&nbsp;')
        }
        
        elTarget.innerHTML = pagerHTML.join('');
        var ahrefs = elTarget.getElementsByTagName('a');
        for(i = 0; i < ahrefs.length; i++) {
            ahrefs[i].onclick= function(){ callFn(this.getAttribute('offset')); return false;} 
        }
    }
    
    return {
        hasNext : hasNext,
        hasPrev : hasPrev,
        list : pageList,
        write : writeFn
    }
}/* $Id$ */
createNS('GOOM.util');

GOOM.util.Form = {
    oldValue : '',
    userHasLogo : false,
    userHasProfile : false,
    previewImagesRequestDone : false,

    defaultFields : function(formEl) {
        if(!formEl) {
            return;
        }
        var elements = formEl.elements;
        for(var i = 0, len = elements.length; i < len; ++i) {
            var el = elements[i];
            el.onblur = this.fieldBlur(el);
            el.onfocus = this.fieldFocus(el, el.title);
        }
    },

    fieldFocus : function(el) {
        if(el.value == el.title) {
            el.value = '';
            removeClass(el, 'inputTxtGrey');
            addClass(el, 'inputTxtBlack');
        }
    },

    fieldBlur : function(el) {
        if(el.value == '') {
            removeClass(el, 'inputTxtBlack');
            addClass(el, 'inputTxtGrey');
            el.value = el.title;
        }
    },

    changePreviewImages : function(logoEl, profileEl, sourceEl, radioUid) {
        var logoPath = window.getASSET() + '/theme/' + sourceEl.value + '_%{type}/t8';
        if (!this.previewImagesRequestDone) {
            if (radioUid) {
                GOOM.util.Request('GET', '/radio/api/has-logo-profile?uid=' + radioUid,
                    { success : function callback(result) {
                                    GOOM.util.Form.userHasLogo    = result.hasLogo;
                                    GOOM.util.Form.userHasProfile = result.hasProfile;
                                    if (!result.hasLogo) {
                                        logoEl.src = replace(logoPath, {type : 'logo'});
                                    }
                                    if (!result.hasProfile) {
                                        profileEl.src = replace(logoPath, {type : 'profile'});
                                    }
                                    GOOM.util.Form.previewImagesRequestDone = true;
                                }
                    });
            } else {
                if (!this.userHasLogo) {
                    logoEl.src = replace(logoPath, {type : 'logo'});
                }
                if (!this.userHasProfile) {
                    profileEl.src = replace(logoPath, {type : 'profile'});
                }
            }
        } else {
            if (!this.userHasLogo) {
                logoEl.src = replace(logoPath, {type : 'logo'});
            }
            if (!this.userHasProfile) {
                profileEl.src = replace(logoPath, {type : 'profile'});
            }
        }
    }

}
GOOM.util.Base64 = {
	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 
	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = GOOM.util.Base64._utf8_encode(input);
 
		while (i < input.length) {
 
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
 
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
 
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
 
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
		}
 
		return output;
	},
 
	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
		while (i < input.length) {
 
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
 
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
 
			output = output + String.fromCharCode(chr1);
 
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
 
		}
 
		output = GOOM.util.Base64._utf8_decode(output);
 
		return output;
 
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}
function getMousePos(ev) {
    ev = ev || window.event;
    if (!ev) {
        return null;
    }

    if (ev.pageX || ev.pageY) {
        mousex = ev.pageX;
        mousey = ev.pageY;
    } else if (ev.clientX || ev.clientY) {
        mousex = ev.clientX + document.documentElement.scrollLeft;
        mousey = ev.clientY + document.documentElement.scrollTop;
    }
    return {x: mousex, y: mousey};
}

GOOM.util.DD = {
    mousePos : false,
    dragCallback : false,

    startDrag : function(callback){
        GOOM.util.DD.dragCallback = callback;
        document.onmousemove = GOOM.util.DD.onMouseMove;
        document.onmouseup = function() {
            if(GOOM.util.DD.dragCallback) {
                GOOM.util.DD.dragCallback();
            }
            GOOM.util.DD.stopDrag();
        }
    },

    stopDrag : function() {
        document.onmousemove = null;
        document.onmouseup = null;
        GOOM.util.DD.dragCallback = GOOM.util.DD.mousePos = null;
    },

    onMouseMove : function(e) {
        var pos = getMousePos(e || window.event);
        if(!pos) {
            return;
        }
        pos.pre = GOOM.util.DD.mousePos;
        GOOM.util.DD.mousePos = pos;
    }
};

GOOM.util.DD.Container = function(el, wrapEl, options) {
    options = options || {};
    options.updateDragNode = options.updateDragNode || function(){};
    
    var me = this,
        scrollTimer,

        DD = GOOM.util.DD,

        ddCurDragEl,
        ddHoverNode,
        ddNodeHeight = 0,
        ddNodeCenter = 0,

        wEl = wrapEl,

        cEl = el,
        cPos = {h : 0, w: 0, t: 0, l : 0},
        cSrollBuffer  = options.buffer || 30,
        scrollArea = {top : {y1 : 0, y2 : 0},
                           bottom : {y1 : 0, y2 : 0}};

    function onMouseDown(e) {
        //inject position into DD
        GOOM.util.DD.onMouseMove(e);
        
        e = e || window.event;
        if(!(e.which && e.button == 0 || e.button == 1)) {
            return false;
        }
        var pos = getMousePos(e);
        if(!pos) {
            return false;
        }
        
        ddCurDragEl = this;
        var nodePos  = YAHOO.get(this).get('region');
        ddNodeHeight = nodePos.height;
        ddNodeCenter = nodePos.height/2;
        
        ddHoverNode = document.createElement('div');
        ddHoverNode.position = "absolute";
        
        var posY = (Math.max(pos.y - scrollArea.top.y1, 0)  + wEl.scrollTop);

        options.dragMouseDown(ddHoverNode, ddCurDragEl, posY);

        ddHoverNode.style.position = "absolute";
        ddHoverNode.style.top  =  posY - ddNodeCenter + 'px';
        ddHoverNode.style.left = cPos.x + 'px';
        ddHoverNode.style.width = nodePos.width + 'px';
        ddHoverNode.style.zIndex = 500;
        ddHoverNode.onselectstart = function() { return false; }
        document.body.appendChild(ddHoverNode);

        ddHoverNode.onmousedown  = null;

        if(scrollTimer) {
            clearInterval(updateScrolling);
        }

        DD.startDrag(onMouseUp);

        scrollTimer = setInterval(updateScrolling, 50);
        return false;
    }

    function onMouseUp() {
        clearInterval(scrollTimer);
        var posY = false;
        if(DD.mousePos) {
            posY = (Math.max(DD.mousePos.y - scrollArea.top.y1, 0)  + wEl.scrollTop);
        }
        options.dragMouseUp(ddCurDragEl, ddHoverNode, posY, ddNodeHeight);
        DD.stopDrag();
        
        if(ddCurDragEl) {
            ddCurDragEl.onmousedown = onMouseDown;
            ddCurDragEl = null;
        }
    }

    function updateScrolling() {
        var pos = DD.mousePos;
        if(!pos) {
            return;
        }
        var ydiff = pos.y - ddNodeCenter;
        if(ydiff < scrollArea.top.y1) {
            ydiff = scrollArea.top.y1;
        }
        if(ydiff > scrollArea.bottom.y2) {
            ydiff = scrollArea.bottom.y2;
        }

        if(ddHoverNode) {
            ddHoverNode.style.top  = ydiff + 'px';
        }

        ydiff += parseInt(wEl.scrollTop, 10);

        options.updateDragNode(ddHoverNode, parseInt((ydiff - cPos.y), 10), ddNodeHeight);

        if(pos.y <= scrollArea.top.y2) {
            wEl.scrollTop = parseInt(wEl.scrollTop) - cSrollBuffer;
            return;
        }

        if(pos.y >= scrollArea.bottom.y1) {
            wEl.scrollTop = wEl.scrollTop + cSrollBuffer;
            return;
        }
    }

    this._initialize = function() {
        cEl.onselectstart = function() { return false; }
        cPos  = YAHOO.get(wEl).get('region');
        cPos.h = cPos.height;
        var tmpPos  = YAHOO.get(cEl).get('region');
        cPos.realHeight = tmpPos.height;
        
        cPos.y = tmpPos.top + wEl.scrollTop, cPos.x = tmpPos.left;

        scrollArea.top.y1    = cPos.y;
        scrollArea.top.y2    = cPos.y + cSrollBuffer;
        scrollArea.bottom.y1 = cPos.y + cPos.h - cSrollBuffer;
        scrollArea.bottom.y2 = cPos.y + cPos.h - ddNodeCenter;
        flagInit = true;
    };

    this.setupNode = function(node) {
        node.onmousedown = onMouseDown;
    };

    this.dragInNode = function(node, e) {
        onMouseDown.call(node, e);
    };

    this.getScrollArea = function() {
        return scrollArea;
    };

    window.onresize = function() {
        var metoo = me;
        if(me.timeoutResize) {
           clearTimeout(me.timeoutResize);
        }

        me.timeoutResize = setTimeout(function() { metoo._initialize(); }, 500);
    }

    this._initialize();
};
/* $Rev$ */
GOOM.util.Charts = {

    chartItems : [],
    total : 0,
    rowNum : 1,
    titleRequest : null,
    titleRequests : {},
    chartItemsPlayingNowRequest : null,
    playingOn : {uri : 'http://meta.goomradio.com/_item?target=web&partner=GOOM&',
                 args : '',
                 jsonp : 'format=jsonp&jsonp=GOOM.util.Charts.parseMeta'},

    scheduledOn : function(radioId) {
        var me = GOOM.util.Charts,
            now = new Date(),
            uri = '/radio/list/whatson?radioId=' + radioId +
                  '&nocache=' + now.getTime() +
                  '&timezone=' + -now.getTimezoneOffset(),
            req = function() {
                GOOM.util.Get(uri, function(r) {
                    if (!r.success) {
                        return;
                    }
                    if(r.results[0] && r.results[0][0]) {
                        var m = r.results[0][0];
                        if(m) {
                            byId('chartItemRadioLiveNowArtist').innerHTML = m.artist;
                            byId('chartItemRadioLiveNowTitle').innerHTML = m.title;
                        }
                    }
                }, 5000);
            };

        if(me.titleRequest) {
            clearInterval(me.titleRequest);
        }
        req();
        me.titleRequest = setInterval(function() {req();}, 5000);
    },

    playingNow : function () {
        var me = GOOM.util.Charts,
            req = function() {createScript(me.playingOn.uri + me.playingOn.args + me.playingOn.jsonp);};
        req();
        me.chartItemsPlayingNowRequest = setInterval(function() {req();}, 10000);
    },

    parseMeta : function () {
        var me = GOOM.util.Charts,
            els = [],
            setDisplayedTitle = function(moId, displayFlag) {
                var songTitle = byId('chartItemSongTitle-' + moId),
                    radioTitle = byId('chartItemRadioTitle-' + moId);

                if(!songTitle || !radioTitle) {
                    return;
                }

                switch(displayFlag) {
                    case 'radio':
                        songTitle.style.display = 'none';
                        radioTitle.style.display = 'block';
                        break;
                    case 'song':
                        radioTitle.style.display = 'none';
                        songTitle.style.display = 'block';
                        break;
                    default:
                        if(songTitle.style.display == 'none') {
                            radioTitle.style.display = 'none';
                            songTitle.style.display = 'block';
                        } else {
                            songTitle.style.display = 'none';
                            radioTitle.style.display = 'block';
                        }
                }
            };

        // create an array with chartItems present in the page
        for(var i = 0, len = me.chartItems.length - 1; i < len; ++i) {
            var moId = me.chartItems[i].id.replace('chartItem-', ''),
                el = byId('chartItemTitlePlayingOn-' + moId);

            if(el) {
                els.push(el);
            }
        }

        // foreach song I get from meta
        for(i = 0, len = arguments[0].length; i < len; ++i) {
            var arg = arguments[0][i];

            if(arg && arg.whatson) {
                moId = arg.whatson[0].objectId + '-' + arg.whatson[0].mediaId;
                el   = byId('chartItemTitlePlayingOn-' + moId);

                if(!el) {
                    continue;
                }

                var chartItem = byId('chartItem-' + moId),
                    streamArr = arg.streamId.split(':'),
                    radioId = streamArr[2] * 256 + streamArr[3] * 16 + 1,
                    intervalFn = function(moId) {
                        return function() {
                            setDisplayedTitle(moId);
                        }
                    };

                el.innerHTML = '<img src="/img/musical_note.png">&nbsp;' +
                               '<a href="/radio/' + arg.streamSlug + 
                               '" onclick="playAndGo(\'radio\', ' + radioId +
                               ', this.href); stopEvent(e); return false;">' + arg.stream + '</a>';


                chartItem.onmouseover = (function(moId) {
                    return function(e) {
                        setDisplayedTitle(moId, 'radio');
                        clearInterval(me.titleRequests[moId]);
                        stopEvent(e);
                    }
                })(moId);

                chartItem.onmouseout = (function(moId) {
                    return function(e) {
                        me.titleRequests[moId] = setInterval(intervalFn(moId), 1250);
                        stopEvent(e);
                    }
                })(moId);

                for(var j = 0, len2 = els.length; j < len2; ++j) {
                    if(els[j].id == el.id) {
                        els.splice(j, 1);
                        --len2;
                    }
                }

                if(!me.titleRequests[moId]) {
                    setDisplayedTitle(moId);
                    me.titleRequests[moId] = setInterval(intervalFn(moId), 1250);
                }
            }
        }

        // restoring song name for elements not in results of meta
        for(i = 0, len = els.length; i < len; ++i) {
            moId = els[i].id.replace('chartItemTitlePlayingOn-', '');

            clearInterval(me.titleRequests[moId]);
            delete me.titleRequests[moId];
            setDisplayedTitle(moId, 'song');
        }

        removeScript(me.playingOn.uri + me.playingOn.args + me.playingOn.jsonp);
    },

    init : function() {
        var me = GOOM.util.Charts;

        me.chartItems = byId('chartItems').children;
        me.total = parseInt(byId('chartItemsTotal').innerHTML);
        me.rowNum = Math.floor((me.total + 1) / 3);

        clearInterval(me.chartItemsPlayingNowRequest);

        me.playingOn.args = '';
        for (var i = 0, len = me.chartItems.length - 1; i < len; ++i) {
            me.playingOn.args += 'id=' + me.chartItems[i].getAttribute('gdata') + '&';
        }
        me.playingNow();
    },

    showOverlay : function(overlay, id, num, objectId, mediaId) {
        var callback = function(response) {
            var r = response.radio || {uid : 0, name : ' ', slug : ' ', slogan : ' ', followers : 0},
                t = parseInt(response.radioTotal, 10),
                m = response.mediaAsset || {id : 0, title : ' ', artists : ' ', siteId : SITE_ID, coverObjectId : 0, coverMediaId : 0},
                me = GOOM.util.Charts,
                curRow = Math.floor(num / 3),
                minRow = Math.min(me.rowNum - 2, curRow),
                topPos = ((minRow > 0) ? minRow : 0) * 3,
                leftPos = (num % 3) ? 1 : 0,
                playClip = byId('chartItemPlayClip'),
                buyOnItunes = byId('buyOnItunes');

            // replace content in the overlay
            byId('chartItemImg').src = getASSET() + '/mediaAsset/' + m.siteId +
                                       '_' + m.coverObjectId + '_' + m.coverMediaId + '/t10';
            byId('chartItemTitle').innerHTML = m.title;
            playClip.gdata = m.id;

            GOOM.util.stopPlayingClip();

            byId('chartItemSubtitle').innerHTML = m.artists;

            if(buyOnItunes) {
                buyOnItunes.onclick = function() {
                    GOOM.ITunes.buySong(m.title, m.artists);
                    return false;
                }
            }

            var left_arrow = byId('chartItemExpandedDetailsArrowLeft'),
                right_arrow = byId('chartItemExpandedDetailsArrowRight'),
                radioImg = byId('chartItemRadioImg'),
                radioTitle = byId('chartItemRadioTitle');

            if(t <= 0 || !r.uid) {
                if(!GOOM.User.isLoggedIn) {
                    if(me.titleRequest) {
                        clearInterval(me.titleRequest);
                    }
                    
                    radioImg.parentNode.onclick = function() {return false;};
                    radioImg.parentNode.style.cursor = 'default';

                    radioImg.src = getASSET() + '/radio/0_logo/t4';
                    
                    radioTitle.innerHTML = '';
                    byId('chartItemRadioSlogan').innerHTML = _('GOOM_CHARTS_ADD_IT_TO_YOUR_RADIOS');

                    if(!GOOM.User.isLoggedIn) {
                        byId('chartItemFurtherInfoEmpty').style.display = 'block';
                    } else {
                        byId('chartItemFurtherInfoEmpty').style.display = 'none';
                    }

                    byId('chartItemFurtherInfoFull').style.display = 'none';
                    byId('chartItemExpandedDetails').style.display = 'block';
                } else {
                    byId('chartItemExpandedDetails').style.display = 'none';
                }
            }

            if(t > 1) {
                left_arrow.onclick = function() {
                    GOOM.util.Charts.overlayChangeRadio(id, (t - 1));
                    return false;
                };
                right_arrow.onclick = function() {
                    GOOM.util.Charts.overlayChangeRadio(id, 1);
                    return false;
                };

                left_arrow.style.visibility = 'visible';
                right_arrow.style.visibility = 'visible';
            } else {
                left_arrow.onclick = function() {return false;};
                right_arrow.onclick = function() {return false;};

                left_arrow.style.visibility = 'hidden';
                right_arrow.style.visibility = 'hidden';
            }

            if(t >= 1) {
                byId('chartItemExpandedDetails').style.display = 'block';
                radioImg.parentNode.style.cursor = 'pointer';
            }

            if(r.uid) {
                var gotoRadioFn = function() {
                    GOOM.Navigation.load('/radio/' + r.slug);
                    return false;
                };

                radioImg.src = getASSET() + '/radio/' + r.uid + '_logo/t4';
                radioImg.parentNode.onclick = gotoRadioFn;
                radioTitle.innerHTML = r.name;
                radioTitle.onclick = gotoRadioFn;
                byId('chartItemRadioSlogan').innerHTML = r.slogan;
                byId('chartItemFollowers').innerHTML = r.followers;

                me.scheduledOn(r.id);

                byId('chartItemFurtherInfoEmpty').style.display = 'none';
                byId('chartItemFurtherInfoFull').style.display = 'block';
            }

            byId('chartItemNr').innerHTML = ++num;

            var el = byId('chartItemTitlePlayingOn-' + objectId + '-' + mediaId);
            if (el) {
                byId('chartItemOverlayTitlePlayingOn').innerHTML = el.innerHTML;
            }

            var elLabel = byId('chartItemTitlePlayingOnLabel-' + objectId + '-' + mediaId);
            if (elLabel) {
                byId('chartItemOverlayTitlePlayingOnLabel').innerHTML = elLabel.innerHTML;
            }

            // move the overlay to the correct position
            overlay.style.top = me.chartItems.item(topPos).offsetTop + 'px';
            overlay.style.left = me.chartItems.item(leftPos).offsetLeft + 'px';

            // finally show the overlay
            overlay.style.display = 'block';
        };

        GOOM.util.Get('/default/list/charts-item?id=' + id, callback);
    },

    hideOverlay : function() {
        var me = GOOM.util.Charts;

        GOOM.util.stopPlayingClip();
        byId('chartItemExpanded').style.display = 'none';
        if(me.titleRequest) {
            clearInterval(me.titleRequest);
        }
    },

    overlayChangeRadio : function(mediaAssetId, start) {
        var callback = function(response) {
            var me = GOOM.util.Charts,
                r = response.radio,
                t = parseInt(response.radioTotal),
                radioTitle = byId('chartItemRadioTitle'),
                radioImg = byId('chartItemRadioImg'),
                gotoRadioFn = function() {
                    GOOM.Navigation.load('/radio/' + r.slug);
                    return false;
                };

            if(t > 1) {
                byId('chartItemExpandedDetailsArrowLeft').onclick = function() {
                    GOOM.util.Charts.overlayChangeRadio(mediaAssetId, (start - 1) < 0 ? (t - 1) : (start - 1));
                    return false;
                };
                byId('chartItemExpandedDetailsArrowRight').onclick = function() {
                    GOOM.util.Charts.overlayChangeRadio(mediaAssetId, (start + 1 > (t - 1)) ? 0 : (start + 1));
                    return false;
                };
                radioImg.src = getASSET() + '/radio/' + r.uid + '_logo/t4';
                radioImg.parentNode.onclick = gotoRadioFn;
                radioTitle.innerHTML = r.name;
                radioTitle.onclick = gotoRadioFn;
                byId('chartItemRadioSlogan').innerHTML = r.slogan;
                byId('chartItemFollowers').innerHTML = r.followers;

                me.scheduledOn(r.id);
            }
        }

        GOOM.util.Get('/default/list/charts-item-overlay-radio?id=' + mediaAssetId + '&start=' + start, callback);
    }

}

GOOM.ITunes = {
    searchURL : 'http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=%{term}&attribute=songTerm&country=%{country}&media=music&entity=musicTrack&callback=%{callback}&limit=%{limit}',

    affiliateUrl : null,

    partnerId : null,

    lastArtistTerm : null,

    defaultCountry : 'US',

    noSongsFn : null,

    isActive : function() {
        return (GOOM.ITunes.affiliateUrl !== null && null !== GOOM.ITunes.partnerId);
    },

    removeParenthesis : function(term) {
        return term.replace(/\(.{1,}\)(?:\ {0,}$)?/g, '');
    },
    encodeParam : function(term) {
        return encodeURIComponent(term).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
    },

    buySong : function(term, artistTerm, country, limit) {
        
        var me  = GOOM.ITunes,
            url = replace(me.searchURL, {
                term : me.encodeParam(me.removeParenthesis(term)),
                country : country || SITES_ARRAY[SITE_ID].countryCode || me.defaultCountry,
                callback : 'GOOM.ITunes.handleSearchCB',
                limit : limit || 10
            });
        me.lastArtistTerm = (artistTerm) ? me.removeParenthesis(artistTerm).toLowerCase() : null;
        createScript(url);
    },

    handleSearchCB : function(data) {
        var me = GOOM.ITunes;

        if(!data.results || !data.results[0]) {
            if(me.noSongsFn) {
                me.noSongsFn();
            }
        }
        if(me.lastArtistTerm) {
            for(var i = 0, len = data.resultCount; i < len; ++i) {
                if(me.removeParenthesis(data.results[i].artistName).toLowerCase() == me.lastArtistTerm) {
                    break;
                }
            }
        }

        var song   = data.results[((i >= len) ? 0 : i)];
        // Handling Tradedoubler.
        if (/tradedoubler/i.test(this.affiliateUrl)) {
            window.open(replace(this.affiliateUrl, {
                ITUNES_URL : song.trackViewUrl +
                    ((song.trackViewUrl.search('/\?/') === -1) ? '?' : '&') + 'partnerId=' + this.partnerId }));
        }
        // Handling LinkShare.
        else if (/linksynergy/i.test(this.affiliateUrl)) {
            window.open(replace(this.affiliateUrl, {
                ITUNES_URL : encodeURIComponent(encodeURIComponent(song.trackViewUrl +
                    ((song.trackViewUrl.search('/\?/') === -1) ? '?' : '&') + 'partnerId=' + this.partnerId)) }));
        }

    }
}
/* $Rev: 15926 $ */
createNS('GOOM.site');

GOOM.site.Navigation = (function() {
    var _navRadiosDialog = new GOOM.util.Dialog({isModal : false, width: 250}),
        _navShowsDialog = new GOOM.util.Dialog({isModal : false, width: 250}),
        _navPremiumRadiosDialog = new GOOM.util.Dialog({isModal : false, width: 310}),
        _template = {
            radios : '<form action="/radio/search" class="modalForm loginform" method="post"><fieldset><legend></legend><div class="clearfix findButtons"><label for="findRadios">%{find}</label><div class="findRadiosContainer"><input type="text"  name="findRadios" class="formElement inputText findRadios formStackMargin" gType="button" value="" /></div><div class="findRadiosContainer"><input gtype="button" class="button primary" submit="" type="submit" value="%{submit}" /></div></div><label for="radiosCreated">%{your}</label><select name="radiosCreated" class="formElement select clear" gtype="button" onchange="GOOM.Navigation.load(this.value); return false;"><option selected="selected">%{your}</option></select><label for="radiosFollow">%{follow}</label><select name="radiosFollow" class="formElement select clear" gtype="button" onchange="GOOM.Navigation.load(this.value); return false;"><option selected="selected">%{follow}</option></select></div></fieldset></form><ul>%{links}</ul>'
        };
    
    return {
        showRadios : function(triggerEl) {
            if(GOOM.User.isLoggedIn) {
                var template = replace(_template.radios, { find : _('NAV_FIND_RADIOS'), submit : _('NAV_FIND'), 
                                                           your : _('NAV_YOUR_RADIOS'), links : byId('navOverlayRadiosLinks').innerHTML,
                                                           follow : _('NAV_FOLLOW_RADIOS')});
                _navRadiosDialog.setHTML(template);
                _navRadiosDialog.open(triggerEl, byId('playerNavigation'));
                var formEl = _navRadiosDialog.getContainer().getElementsByTagName('form')[0];
                
                
                var radios = GOOM.UserRadios.followed;
                formEl.radiosFollow.innerHTML = '';
                addOption(formEl.radiosFollow, _('NAV_FOLLOW_RADIOS'));
                for(var i = 0; len = radios.length, i < len; i++) {
                    addOption(formEl.radiosFollow, radios[i].name, '/radio/' + radios[i].slug);
                }
                
                formEl.radiosCreated.innerHTML = '';
                radios = GOOM.UserRadios.created;
                addOption(formEl.radiosCreated, _('NAV_YOUR_RADIOS'));
                for(var i = 0; len = radios.length, i < len; i++) {
                    addOption(formEl.radiosCreated, radios[i].name, '/radio/' + radios[i].slug);
                }
            } else {
                template = byId('navOverlayRadios').innerHTML;
                _navRadiosDialog.setHTML(template, true);
                _navRadiosDialog.open(triggerEl, byId('playerNavigation'));
                formEl = _navRadiosDialog.getContainer().getElementsByTagName('form')[0];
            }

            var searchEl = _navRadiosDialog.getContainer().getElementsByTagName('input')[0];

            formEl.onsubmit = function() {
                if (searchEl.value != '' && searchEl.value != searchEl.getAttribute('gtext')) {
                    GOOM.Navigation.load('/radio/search?name=' + searchEl.value);
                }
                return false;
            }
        },
        
        showShows : function(triggerEl){
            var template = byId('navOverlayShows').innerHTML;
            _navShowsDialog.setHTML(template, true);
            _navShowsDialog.open(triggerEl, byId('playerNavigation'));
            var formEl = _navShowsDialog.getContainer().getElementsByTagName('form')[0];
            var searchEl = _navShowsDialog.getContainer().getElementsByTagName('input')[0];
            
            formEl.onsubmit = function() {
                if (searchEl.value != '' && searchEl.value != searchEl.getAttribute('gtext')) {
                    GOOM.Navigation.load('/show/search?name=' + searchEl.value);
                }
                return false;
            }
        },

        switchSite : function (domain, path, radioId) {
            var href = 'http://' + domain.replace('http://', ''),
                _dialogHTML = '<div><h2>%{title}</h2><p>%{confirm}</p><form class="modalForm" onsubmit="setTimeout(function() { window.location = \'%{href}\'}, 0);"><fieldset><legend></legend><div class="containerSubmit"><input onclick="GOOM.util.DialogMgr.close(); return false;" gtype="button" class="clear button standard" value="%{cancel}" type="button"> <input gtype="button" class="clear button primary" value="%{okay}" type="submit"></div></fieldset></form></div>',
                _dialog = new GOOM.util.Dialog({isModal : true, isNarrow : true});

            try {
              radioId = radioId || GOOM.Audio.currentRadioObj.id;
            } catch(e) { }
            
            if(radioId || path) {
                href += '/play-n-go';
                if(radioId) {
                    href += '?radioId=' + radioId;
                }
                if(path) {
                    href += ((radioId) ? '&' : '?')  + 'page=' + path;
                }
            }
            _dialog.setHTML(replace(_dialogHTML, {confirm : _('NAV_SWITCHSITE_CONFIRM'),
                                                  href    : href,
                                                  title   : _('NAV_SWITCHSITE_TITLE'),
                                                  cancel  : _('CANCEL'),
                                                  okay    : _('OKAY') }));
            _dialog.open();
        },
        
        search : function(type, formEl) {
            var uri, term;
            
            switch(type) {
                case 'radio':
                    uri = '/radio/search';
                    term = formEl.elements.findRadios.value;
                    break;
                case 'show':
                    uri = '/show/search';
                    term = formEl.elements.findShows.value;
                    break;
                default:
                    return;
            }
            
            GOOM.Navigation.load(uri + '?term=' + term);
            _navRadiosDialog.close();
        },
        
        showPremiumRadios : function(triggerEl) {
            var template = byId('premiumRadios').innerHTML;
            _navPremiumRadiosDialog.setHTML(template);
            _navPremiumRadiosDialog.open(triggerEl, byId('buttonData'));
        }
    }
})();
/* $Rev: 15926 $ */
createNS('GOOM.site.Note');

GOOM.site.Note = { 
    autoCloseCounter : false,
    template : { normal : '<span style="float:left;" class="noteText">%{msg}</span> <a href="#" onclick="GOOM.site.Note.close(); return false;" class="close" title="">%{close}</a>'},

    show : function(type, message, noTimeout, links) {
        var noteEl = byId('noteContainer');
        if(!noteEl) {
            return;
        }
        noteEl.innerHTML = replace(this.template.normal,{ msg : message, close : _('NOTE_CLOSE')});
        if(links && links.length) {
            var a = noteEl.getElementsByTagName('a');
            for(var i = 0; i < a.length; i++) {
                if(links[i]) {
                    a[i].onclick = links[i];
                }
            }
        }
        noteEl.style.display = 'block';
        
        if(!noTimeout) {
            setTimeout(GOOM.site.Note.close, 5000);
        }
    },
    
    close : function() {
        byId('noteContainer').style.display = 'none';
    }
}

GOOM.Navigation.Events.onPageReady.subscribe(function(){
    GOOM.site.Note.close();
})
/* $Rev: 25342 $ */
createNS('GOOM.site');

GOOM.site.CoverFlow = {
    onShowClick : function(slug) {
        GOOM.Navigation.load('/show/' + slug);
    },
    
    onRadioClick : function(radioId) {
    	GOOM.Audio.playRadio(radioId);
        //load radio page on coverflow selection
    	var i=setInterval(
        		function(){
        			var cradioId = GOOM.Audio.currentRadioObj.id;
                    if(cradioId == radioId){
                    	GOOM.Navigation.load('/radio/' + GOOM.Audio.currentRadioObj.slug);
                    	clearInterval(i);
                    };
    	        },500);
    },
    
    onShowPlay : function(id) {
        play('show', id);    
    },
    
    onRadioPlay : function(id) {
        play('radio', id);
    }
}

GOOM.Navigation.Events.onPageReady.subscribe(function() {

	if (window.pageObj && 'RADIO' == window.pageObj.type) {
    	if(!GOOM.Navigation.curRequest) {
    		var timeOut = 5000;
    	}else{
    		var timeOut = 1000;
    	}
        // play the radio if object loaded
        var i1=setInterval(
    	        function(){
                    if(GOOM.Audio.ready){
                        play('radio', window.pageObj.id);
                        clearInterval(i1);
                    };
    	        },timeOut);
        // change cover if object loaded
        var i2=setInterval(
    	        function(){
                    var el = byId('cowerflowHome');
    	            if (el && typeof(el.selectCover)=='function') {
    	                el.selectCover(window.pageObj.id);
                        clearInterval(i2);
    	            }
    	},timeOut);
    }
});
/* $Rev: 26268 $ */
createNS('GOOM.site');

GOOM.site.SimpleTab = {
    tabs : {
        topHits : {
            playingNowRequest : null,

            updateFn : function(id) {
                var top20Btn = byId('topHitsTop20'),
                    emptySong = {id : null,
                                 siteId : null,
                                 coverObjectId : null,
                                 coverMediaId :null,
                                 artists : [],
                                 title : null};

                if (top20Btn) {
                    top20Btn.onclick = function() {
                        GOOM.Navigation.load('/charts?genreId=' + id);
                        return false;
                    }
                }

                GOOM.util.Get('/default/list/tophits?genre=' + id + '&limit=5&nocache=' + (new Date().getTime()), function(r) {
                    if(!r.success) {
                        return;
                    }

                    var createRadioLink = function() {
                            var radioLink = '';
                            if(r.playingNow[i] && r.playingNow[i].name && r.playingNow[i].name.toLowerCase() != 'error') {
                                if(r.playingNow[i].slug) {
                                    radioLink = musicalNote +
                                                '<a href="/radio/' + r.playingNow[i].slug + '" onclick="playAndGo(\'radio\', ' + r.playingNow[i].id + ', this.href); return false;">' +
                                                    r.playingNow[i].name +
                                                '</a>';
                                } else {
                                    radioLink = musicalNote + r.playingNow[i].name;
                                }
                            }

                            return radioLink;
                        },

                        replaceElement = function() {
                            var artists = [],
                                topHitEl = songs[i];

                            if(topHitEl) {
                                var ch = topHitEl.children;

                                topHitEl.id = topHitElId;
                                for(var j = 0, len2 = ch.length; j < len2; ++j) {
                                    switch(ch[j].className) {
                                        case 'tophitsButtonsWrapper':
                                            var playBtn = ch[j].getElementsByTagName('a')[0];
                                            if (playBtn) {
                                                if(song.id) {
                                                    playBtn.setAttribute('gdata', song.id);
                                                    playBtn.style.display = 'block';
                                                } else {
                                                    playBtn.style.display = 'none';
                                                }
                                            }
                                            break;
                                        case 'thumb t2':
                                            if(song.siteId && song.coverObjectId && song.coverMediaId) {
                                                ch[j].src = window.getASSET() +
                                                            '/mediaAsset/' +
                                                            song.siteId + '_' +
                                                            song.coverObjectId + '_' +
                                                            song.coverMediaId + '/t2';
                                                ch[j].style.display = 'block';
                                            } else {
                                                ch[j].style.display = 'none';
                                            }
                                            break;
                                        case 'topHitsWrapper':
                                            var ch2 = ch[j].children;
                                            if(ch2) {
                                                for(var k = 0, len3 = song.artists.length; k < len3; ++k) {
                                                    artists.push(song.artists[k].name);
                                                }
                                                for(k = 0, len3 = ch2.length; k < len3; ++k) {
                                                    if(song.id && song.artists) {
                                                        switch(ch2[k].className) {
                                                            case 'topHitsTitle':
                                                                ch2[k].innerHTML = song.title;
                                                                break;
                                                            case 'topHitsSubtitle':
                                                                ch2[k].innerHTML = artists.join(', ');
                                                                break;
                                                            case 'topHitsRadio':
                                                                ch2[k].id = topHitsRadioId;
                                                                ch2[k].innerHTML = createRadioLink();
                                                                ch2[k].setAttribute('gdata', song.id);
                                                                break;
                                                            default:
                                                        }
                                                        ch2[k].style.display = 'block';
                                                    } else {
                                                        ch2[k].style.display = 'none';
                                                    }
                                                }
                                                setItunesLink(j, song.title, artists.join(','));
                                            }
                                            break;
                                        default:
                                    }
                                }
                            }
                        },
                        setItunesLink = function(i, title, artists) {
                            var buyOnItunes = byId('buyOnItunes-' + i);
                            if (buyOnItunes) {
                                buyOnItunes.onclick = function() {
                                    GOOM.ITunes.buySong(title, artists);
                                    return false;
                                }
                            }
                        },
                        thcDivs = byId('topHitsContainer').getElementsByTagName('div'),
                        songs = [];

                    for(var i = 0, len = thcDivs.length; i < len; ++i) {
                        if(thcDivs[i].getAttribute('gdata') == 'song') {
                            songs.push(thcDivs[i]);
                        }
                    }

                    var musicalNote = '<img src="/img/musical_note.png">&nbsp;',
                        playingPreview = byId('playingPreview');

                    for(i = 0, len = r.mediaAssets.length; i < len; ++i) {
                        var song = r.mediaAssets[i],
                            topHitsRadioId = 'topHitsRadio-' + song.objectId + '-' + song.mediaId,
                            topHitElId = 'topHit-' + song.id;

                        if(playingPreview && playingPreview.parentNode) {
                            var previewMediaAssetId = playingPreview.parentNode.getAttribute('gdata');

                            if(previewMediaAssetId == songs[i].id.replace('topHit-', '') ||
                               previewMediaAssetId == song.id) {
                                continue;
                            }
                        }

                        if(songs[i].id != topHitElId) {
                            replaceElement();
                        } else {
                            var radioLink = createRadioLink(),
                                topHitsRadioEl = byId(topHitsRadioId);

                            if(topHitsRadioEl.innerHTML != radioLink) {
                                topHitsRadioEl.innerHTML = radioLink;
                            }
                            setItunesLink(i, song.title, song.artists.join(','));
                        }
                    }
                    song = emptySong;
                    for(len = songs.length; i < len; ++i) {
                        replaceElement();
                    }
                })
            },
            
            selectTab : function(el, id) {
                var me = GOOM.site.SimpleTab.tabs.topHits,
                    tabs = byId('topHitsGenres').getElementsByTagName('a');

                removeClass(tabs, 'active');
                addClass(el, 'active');

                GOOM.util.stopPlayingClip();

                clearInterval(me.playingNowRequest);
                me.updateFn(id);
                me.playingNowRequest = setInterval(function() {me.updateFn(id);}, 10000);
            }
        },
        downloads :{
            selectTab : function(el, id) {
	            var me = GOOM.site.SimpleTab.tabs.topHits,
	                tabs = byId('downloadNavHeader').getElementsByTagName('a');
	            removeClass(tabs, 'selected');
	            addClass(el, 'selected');
	        	for(var i=1;i<4;i++){
	        		byId('tcontent'+i).style.display = 'none';
	        	}
	            byId('t'+id).style.display = 'block';
        	}
        }
    },
    
    select : function(el, typeId, id) {
    	var me = GOOM.site.SimpleTab,
             tabObj = me.tabs[typeId];

         tabObj.selectTab(el, id);
    }
}
/* $Rev: 15926 $ */
GOOM.site.Promo = {
    handleClick : function(url, type) {
        if(type === 'internal') {
            GOOM.Navigation.load(url);
        } else {
            window.open(url);
        }
    }
};
/* $Rev$ */
GOOM.site.Util = {
    SNADialog : new GOOM.util.Dialog({isModal : true, isNarrow : true, isError : true}),
    SNA : false,

    showSNA : function() {
        var content = '<h2>' + _('SERVICE_NOT_AVAILABLE_TITLE') + '</h2>' +
                      _('SERVICE_NOT_AVAILABLE') + '<br/><br/>' +
                      _('SERVICE_NOT_AVAILABLE_COME_BACK_SOON') + '<br/>' + 
                      '<form action="" onsubmit="return false;">' +
                        '<input gtype="button" type="button" value="OK" onclick="GOOM.util.DialogMgr.close(); return false;" class="button secondary">' +
                      '</form>';

        this.SNADialog.setHTML(content);
        this.SNADialog.open();
    },

    isServiceAvailable : function(fn) {
        GOOM.util.Request('GET', '/default/api/service-not-available',
                          {success : function callback(r) {
                                var me = GOOM.site.Util;
                                me.SNA = r.notAvailable;
                                fn();
                          }});
    }
}
/**
 * @package Goom
 * @category GoomJS
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: AppMenu.js 28302 2011-07-04 08:28:40Z Alexis Gruet $
 */

createNS('GOOM.site');

/**
 *
 */
GOOM.site.AppMenu = {

    last_update: 0,
    timeout: 20000,
		
    init: function() {
	
        jQuery('.containerMenu > ul > li > ul').click(function(){
            jQuery(this).css('visibility','hidden');
            jQuery(this).find('ul').css('visibility','hidden');
            jQuery(this).find('.menu_play_img').css('visibility','hidden');
            var clickedEl = jQuery(this).parent('.menu_list');
            GOOM.site.AppMenu.clicked(clickedEl);
        });
    },
    
    focusNews: function(){
        window.focusNews = 1;
    },
     
    reset: function(){
        GOOM.user.MyGoom.init(jQuery('#myGoomContainer'));
        GOOM.site.AppMenu.init();
        jQuery("ul.dropdown li").dropdown();
        jQuery(".menu_playli").playimg();
    },

    load: function(id,MGoom){
        var nowT=(new Date()).getTime();
        var myGoomRadio='myG'; // myGoom id
		if((nowT-this.last_update)>this.timeout){
            this.last_update = nowT;
            if(jQuery('#art_'+id).html()=='&nbsp;') jQuery('#songinf_'+id).hide();
            if(jQuery('#'+myGoomRadio+'art_'+id)!=null) {
                jQuery('#'+myGoomRadio+'songinf_'+id).hide();               
            }
            
            $.ajax({
                url: '/radio/list/nowplaying/',
                dataType: 'json',
                data: 'radioId=' + radioMenuList + '&cachebox=1',
                type: 'POST',
                cache: false,
                success: function(json) {
                    var fullList=radioMenuList.split(",");
                    // hide the rest
                    for(var i=0;i<fullList.length;i++){
                        jQuery('#songinf_'+fullList[i]).css('display','none');
                        if(jQuery('#'+myGoomRadio+'songinf_'+fullList[i])) jQuery('#'+myGoomRadio+'songinf_'+fullList[i]).css('display','none');
                    }

                    if(json && json.results.length>0){
                        for(var k=0;k<json.results.length;k++){
                            if(json.results[k] && json.results[k].artist && json.results[k].song && jQuery.inArray(json.results[k].type, GOOM.Audio.playFilter)>-1){
                                var id_radio=json.results[k].id;
                                jQuery('#songinf_'+id_radio).css('display','block');
                                jQuery('#art_'+id_radio).html('' + json.results[k].artist + '');
                                jQuery('#song_'+id_radio).html('' + json.results[k].song + '');

                                //update also myGoom if it is available
                                if(jQuery('#'+myGoomRadio+'songinf_'+id_radio)){
                                    jQuery('#'+myGoomRadio+'songinf_'+id_radio).css('display','block');
                                    jQuery('#'+myGoomRadio+'art_'+id_radio).html('' + json.results[k].artist + '');
                                    jQuery('#'+myGoomRadio+'song_'+id_radio).html('' + json.results[k].song + '');
                                }
                                 
                            }
                        }
                    }
                }
            });
        }
    },
    
    removeSel :function(men){
        jQuery.each(men, function(index, value) {
            jQuery('#'+value).removeClass('selected');
        });
    },
    
    clicked: function(clickedEl){
        var menuItem = clickedEl.attr('id');
		var me = GOOM.site.AppMenu;
        switch(menuItem){
            case 'm2':
                clickedEl.addClass('selected');
                var menuell = new Array('m3','m4');
                me.removeSel(menuell);
                break;
            case 'm3':
                clickedEl.addClass('selected');
                var menuell = new Array('m2','m4');
                me.removeSel(menuell);
                break;
            case 'm4':
                clickedEl.addClass('selected');
                var menuell = new Array('m2','m3');
                me.removeSel(menuell);
                break;
        }
    }
};/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: BigPromoAd.js 23908 2010-11-11 12:10:25Z Bogdan Busuioc $
 */

createNS('GOOM.site');

/**
 * Big promo ad site component.
 */
GOOM.site.BigPromoAd = {
    /**
     * The DOM element contains.
     * @var {jQuery} Element
     */
    element: null,

    /**
     * The comonent options.
     * Contains the carousel options.
     * @var {Object}
     */
    options: {
        carousel: {
            items: [],
            options: {
            }
        }
    },

    /**
     * The carousel component.
     * @var GOOM.components.Carousel
     */
    carousel: null,

    /**
     * Holds the radio HTML template (build on init).
     * @var jQuery collection.
     */
    radioTemplate: null,

    /**
     * Initializes the component.
     * @method init
     * @param {jQuery} element
     * @param {Object} options
     * @return GOOM.site.BigPromoAd
     */
    init: function(element, options) {
        this.element = element;
        var me = this;
        this.options.carousel.options.onBuilt = function() { me.update.apply(me, arguments) };
        this.options.carousel.options.onClick = function() { me.update.apply(me, arguments) };
        this.options.carousel.options.onSlide = function() { me.update.apply(me, arguments) };
        jQuery.extend(true, this.options, options);
        // preload images
        var images = [];
        for (var i = 0; i < this.options.carousel.items.length; i++) {
            images[i] = new Image();
            images[i].src = this.options.carousel.items[i].data.imgBig;
        }

        this.radioTemplate = jQuery('.radio', this.element).children();
        return this;
    },

    /**
     * Resets the components.
     * @return GOOM.site.BigPromoAd
     */
    reset: function() {
        if (this.carousel) {
            this.carousel.reset();
        }

        this.element.unbind('click');
        return this;
    },

    /**
     * Displays the element in the DOM.
     */
    display: function() {
        this.reset().element.css('display', 'block');
        this.carousel = new GOOM.components.Carousel(
            jQuery('.carousel', this.element), this.options.carousel.items, this.options.carousel.options);
        this.carousel.build();
    },

    /**
     * Updates the DOM component.
     * @param {Object} data The carousel data.
     */
    update: function(data) {
        var me = this;
        me.element.animate({opacity: 0.2}, 200, 'swing', function() {
            me.element.css('background-image', 'url(' + data.imgBig + ')').animate({
                opacity: 1
            }, 200, 'swing');
            jQuery('.header', me.element).html(data.header);
            maxFontSize=450/(data.title.length>0?data.title.length:1);
            maxFontSize=Math.ceil(maxFontSize+0.4*maxFontSize);
            if(maxFontSize<32){
            	 jQuery('.title', me.element).css('font-size', maxFontSize);
            }else{
            	jQuery('.title', me.element).css('font-size', 32);
            }
            
            jQuery('.title', me.element).html(data.title);
            jQuery('.desc', me.element).html(data.description);
            jQuery('.radio', me.element).empty();
            if (me.radioTemplate && data.radioName && data.radioName.length > 0 ) {
                jQuery('.radio', me.element).append(me.radioTemplate);
                jQuery('.radio .image', me.element)
                    .attr('src', data.radioCover);

               jQuery('.radio .name', me.element).text(data.radioName)
                    .attr('href', data.url);
                jQuery('.radio .imgl', me.element)
                        .attr('href',  data.url);
                if(data.urlType=='external'){
                    jQuery('.radio .imgl', me.element)
                        .attr('target','_blank')
                        .attr('onClick', '');
                   jQuery('.radio .name', me.element).text(data.radioName)
                        .attr('target','_blank')
                        .attr('onClick', '');
                }else{
                     jQuery('.radio .imgl', me.element)
                        .attr('onClick', 'GOOM.Navigation.load(this.href); return false;');
                     jQuery('.radio .name', me.element).text(data.radioName)
                        .attr('onClick', 'GOOM.Navigation.load(this.href); return false;');
                }
            }else{
                jQuery('.radio', me.element).append('<p style="margin: 29px 0px 0px 5px; height: 39px;">&nbsp;<br />&nbsp;</p>');
            }

            me.element.unbind('click');
            if (data.url) {
                me.element.bind('click', { type: data.urlType, url: data.url, el: me.element }, me.onClick);
            }

        });
    },

    /**
     * Called when the container element is directly clicked.
     * @param {Event}
     */
    onClick: function(e) {
        if (e.target == e.data.el[0]) {
            switch (e.data.type) {
                case 'external':
                    window.open(-1 == e.data.url.indexOf('http://') ? ('http://' + e.data.url) : e.data.url);
                    break;

                case 'internal':
                    GOOM.Navigation.load(e.data.url);
                    break;
            }
        };
    }
};

// PAGE CHANGE
GOOM.Navigation.Events.onPageLeave.subscribe(GOOM.site.BigPromoAd.reset, GOOM.site.BigPromoAd, null, true);/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: RegistrationTour.js 22317 2010-09-30 14:46:53Z Daniele Testa $
 */

createNS('GOOM.site');

/**
 * The registration tour site component.
 */
GOOM.site.RegistrationTour = {
    /**
     * The DOM jQuery element.
     * @var {jQuery}
     */
    element: null,

    /**
     * The component options.
     * @var {Object}
     */
    options: {
        width: 0, // Width of the screen.
        height: 0, // Height of the screen.
        images: [] // Images of the screen.
    },

    /**
     * The previous button DOM element.
     * @var {Jquery}
     */
    prevButton: null,

    /**
     * The next button DOM element.
     * @var {jQuery}
     */
    nextButton: null,

    /**
     * The screen DOM element.
     * @var {jQuery}
     */
    screen: null,

    /**
     * The current screen index.
     * @var {Number}
     */
    index: 1,

    /**
     * Initializes the component.
     * @method init
     * @param {jQuery} element
     * @param {Object} options
     * @return {Self}
     */
    init: function(element, options) {
        this.element = element.css('display', 'none');
        jQuery.extend(true, this.options, options);
        this.reset();

        // Preloading images.
        if (this.options.images.length > 0) {
            var images = [];
            for (var i = 0; i < this.options.images; i++) {
                images[i] = new Image();
                images[i].src = this.options.images;
            }
        }

        return this;
    },

    /**
     * Resets the component.
     * @method reset
     */
    reset: function() {
      this.prevButton && this.prevButton.unbind('click');
      this.nextButton && this.nextButton.unbind('click');
      this.element.empty();
      this.nextButton = this.prevButton = this.screen = null;
      this.index = 1;
    },

    /**
     * Display the component in the DOM.
     * @method display
     * @return {Self}
     */
    display: function() {
        this.element.css('display', 'none');
        var me = this;

        // Building clip.
        this.screen = jQuery('<img/>').css({
            width: this.options.width,
            height: this.options.height
        });
        this.element.append(this.screen);

        // Building buttons
        if (this.options.images.length > 1) {
            var me = this;
            this.prevButton = jQuery('<div class="prevButton"></div>')
                .bind('click', function() { me.onClick.apply(me, arguments) });
            this.nextButton = jQuery('<div class="nextButton"></div>')
                .bind('click', function() { me.onClick.apply(me, arguments) });

            this.element
                .prepend(this.prevButton)
                .append(this.nextButton);
        }

        // Updating screen.
        this.screen.animate({ opacity: 0.2 }, 'swing', function() {
            me.screen.attr('src', me.options.images[me.index - 1]).animate({ opacity: 1 });
        });

        GOOM.Navigation.Events.onPageReady.unsubscribe(GOOM.site.RegistrationTour.onRegistered, GOOM.site.RegistrationTour);
        return this;
    },

    /**
     * Happens when a button is clicked.
     * @method onClick
     * @param {Events} e
     */
    onClick: function(e) {
        var target = jQuery(e.target);
        if (target.hasClass('prevButton')) {
            if (this.index == 1) {
                return;
            }
            this.index--;
        } else {
            if (this.index == this.options.images.length) {
                return;
            }
            this.index++;
        }
        this.display();
    },

    /**
     * Happens when a user is registered.
     * @method onRegistered
     */
    onRegistered: function() {
        this.display();
    }
};

GOOM.Navigation.Events.onPageChange.subscribe(GOOM.site.RegistrationTour.reset, GOOM.site.RegistrationTour, null, true);
GOOM.User.Events.onRegistered.subscribe(function() {
    GOOM.Navigation.Events.onPageReady.subscribe(GOOM.site.RegistrationTour.onRegistered, GOOM.site.RegistrationTour, null, true);
});/**
 * @package Goom
 * @category GoomJS
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: TopStations.js 27050 2011-03-30 15:27:06Z Carlo Pescetelli $
 */

createNS('GOOM.site');

/**
 * Site top stations component.
 * Base on jQueryUI tabs.
 */
GOOM.site.TopStations = {
    /**
     * The DOM container.
     * @var {jQuery}
     */
    element: null,

    /**
     * The element options.
     * @var {Object}
     */
    options: {
        // The data items.
        items: []
    },

    /**
     * The parsed radio IDs provided by the options.items.
     * @var {Array}
     */
    radios: [],

    /**
     * Initializes the component.
     * @method init
     * @param {jQuery} element
     * @param {Object} options
     * @return {Self}
     */
    init: function(element, options) {
        this.element = element;//.css('display', 'none');
        jQuery.extend(true, this.options, options);
        for (var i = 0; i < this.options.items.length; i++) {
            for (var j = 0; j < this.options.items[i].radios.length; j++) {
                if (-1 == jQuery.inArray(this.options.items[i].radios[j].id, this.radios)) {
                    this.radios.push(this.options.items[i].radios[j].id);
                    GOOM.radio.Stack.push(this.options.items[i].radios[j].id);
                }
            }
        }
        GOOM.radio.Stack.register(this.updateRadios, this);

        return this;
    },

    /**
     * Build the DOM and displays it.
     * @method display
     * @return {Self}
     */
    display: function() {
        if (this.options.items.length < 1) {
            return this;
        }

        var tabsContainer = jQuery('<div id="radios_home_header"/>');
        var itemsContainer = jQuery('<div id="radios_charts"/>');
        var tabs = jQuery('<ul/>');
        var label = '';
        for (var i = 0; i < this.options.items.length; i++) {
            label = this.options.items[i].label.replace(/[^a-zA-Z0-9]+/g, '_');
            // not show empty category - .us
            tabs.append(jQuery('<li><a href="#topStations-tab-' + label + '" '+ (label=='_'?'style="display:none;"':'')+'>' +
                this.options.items[i].label + '</a></li>'));
            itemsContainer.append(jQuery('<div id="topStations-tab-' + label + '"/>'));
        }
        this.element.append(tabsContainer.append(tabs)).append(itemsContainer);

        var me = this;
        this.element.tabs({
            show: function(e, ui) { me.showPanel.apply(me, arguments) }
        }).tabs('select', 0);

        return this;
    },

    /**
     * Callback called before the panel is shown.
     * @method showPanel
     * @param {Event} e
     * @param {jQueryUI} ui
     */
    showPanel: function(e, ui) {
        var item = this.options.items[ui.index],
            panel = jQuery(ui.panel);

        if (panel.children().length < 1) {
            this.buildPanel(panel, item);
        }
    },

    /**
     * Build a panel DOM.
     * @method buildPanel
     * @param {jQuery} panel
     * @param {Object} item
     */
    buildPanel: function(panel, item) {
        if (item.radios.length < 1) {
            return;
        }

        var split = Math.round(item.radios.length / 2),
            leftColumn = jQuery('<ul class="radio_left"/>'),
            rightColumn = jQuery('<ul class="radio_right">'),
            radio = null;
        for (var i = 0; i < split; i++) {
            radio = item.radios[i];
            leftColumn.append(jQuery('<li class="topStationsRadio' + radio.id + '"/>')
                .append(this.buildRadioItem(radio, i))
                .bind('mouseenter', function() {
                    var el = jQuery('.chart_number', this);
                    el.attr('src', el.attr('src').replace(/\.png$/, '_hover.png'));
                })
                .bind('mouseleave',  function() {
                    var el = jQuery('.chart_number', this);
                    el.attr('src', el.attr('src').replace(/_hover\.png$/, '.png'));
                }));
        }
        panel.append(leftColumn);

        for (i; i < item.radios.length; i++) {
            radio = item.radios[i];
            rightColumn.append(jQuery('<li class="topStationsRadio' + radio.id + '"/>')
                .append(this.buildRadioItem(radio, i))
                .bind('mouseenter', function() {
                    var el = jQuery('.chart_number', this);
                    el.attr('src', el.attr('src').replace(/\.png$/, '_hover.png'));
                })
                .bind('mouseleave',  function() {
                    var el = jQuery('.chart_number', this);
                    el.attr('src', el.attr('src').replace(/_hover\.png$/, '.png'));
                }));
        }
        panel.append(rightColumn);

        this.updateRadios();
      
    },

    /**
     * Update registered radios.
     * Callback for the GOOM.radio.Stack
     * @method updateRadios
     */
    updateRadios: function() {
        var radio;
        for (var i = 0; i < this.radios.length; i++) {
            radio = GOOM.radio.Stack.get(this.radios[i]);
            if (radio && jQuery.inArray(radio.type, GOOM.Audio.playFilter)>-1) {
                this.updateRadio(radio);
            }else if(radio && (-1==jQuery.inArray(radio.type, GOOM.Audio.playFilter))){
            	radio.artist = 'filtered';
            	this.updateRadio(radio);
            }
        }
        //this.element.css('display', 'block');
    },

    /**
     * Updates a registered radio.
     * @method updateRadio
     * @param {Object} radio
     */
    updateRadio: function(radio) {
        var me = this;
        jQuery('.topStationsRadio' + radio.id, this.element).each(function() {
            var el = jQuery(this);
            if(radio.artist){
            	if(jQuery('.radio_infos  .radio_artist', el)){
            		jQuery('.radio_infos  .radio_artist', el).remove();
            		jQuery('.radio_infos  .radio_song', el).remove();
            	}
	            if(radio.artist != 'filtered'){
	            	jQuery('.radio_infos  .radio_slogan', el).after('<span class="radio_artist"></span><span class="radio_song"></span>');
		            var artist = shortenerNoEscape(radio.artist, 35);
		            var song = shortenerNoEscape(radio.song, 35);
		            jQuery('.radio_infos  .radio_artist', el).text(artist);
		            jQuery('.radio_infos  .radio_song', el).text(song);
	            }
            }
        });
    },

 
    /**
     * Builds a radio item DOM.
     * @method buildRadioItem
     * @param {Object} item
     * @param {Number} index The list index.
     * @return {jQuery}
     */
    buildRadioItem: function(item, index) {
        return jQuery('<img src="/img/radio_charts_n' + index + '.png" class="chart_number" alt="#' + index + '"/>\
            <div class="radio_icon" onClick="GOOM.Audio.playRadio(' + item.id + ');"> <img src="' + item.cover + '" alt="' + item.name + '" />  <img src="/img/nowplaying_hover_radios.png" alt="" class="radio_hover" /> </div>\
            <div class="radio_infos"><span class="radio_name"><a href="/radio/' + item.url + '" onClick="GOOM.Navigation.load(this.href); return false;">' + item.name + '</a></span>\
            <span class="radio_slogan">' + item.slogan + '</span>\
            </div>');
    },

    /**
     * Destroys the component.
     * @method destroy
     */
    destroy: function() {
        jQuery('li', this.element).unbind('click mouseenter mouseleave');
        //this.element.tabs('destroy'); // comented to resolve issue #281

    }
}

GOOM.Navigation.Events.onPageChange.subscribe(GOOM.site.TopStations.destroy, GOOM.site.TopStations, null, true);/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: Share.js 24832 2010-12-13 13:29:18Z Daniele Testa $
 */

createNS('GOOM.site');

/**
 * Provides social networks radio share.
 * jQuery based.
 */
GOOM.site.Share = {
    /**
     * The DOM container.
     * @var {jQuery}
     */
    element: null,

    /**
     * The element options.
     * @var {Object}
     */
    options: {
        /**
         * The social networks to provide.
         * @var {Array} [{ label: String, icon: String, url: String }, ...]
         */
        networks: [],
        /**
         * The default message to display in the textarea.
         * @var {String}
         */
        msgTemplate: ''
    },

    /**
     * The selected network index.
     * @var {Integer}
     */
    currentIndex: 0,

    /**
     * The radio to share.
     * Provided by the GOOM.Audio component.
     * @var {Object}
     */
    currentRadio: null,

    /**
     * Initializes the component.
     * @method init
     * @param {jQuery} element
     * @param {Object} options
     * @return {Self}
     */
    init: function(element, options) {
        this.element = element.css('display', 'none');
        jQuery.extend(true, this.options, options);
        return this;
    },

    /**
     * Build the DOM.
     * @method build
     * @return {Self}
     */
    build: function() {
        // If no networks given...
        if (this.options.networks.length < 1) {
            return this;
        }
        jQuery('.formContainer', this.element).css({
           overflow: 'hidden',
           height: 0
        });

        // Configuring the form.
        var me = this;
        jQuery('form', this.element).bind('submit', function() {
            me.onSubmit.apply(me, arguments);
            return false;
        });

        // Building the icons.
        var iconElement = jQuery('.icons', this.element);
        for (var i = 0; i < this.options.networks.length; i++) {
            iconElement.append(
                jQuery('<img/>').attr('src', this.options.networks[i].icon+'_f.png')
                    .attr('alt', this.options.networks[i].label)
                    .attr('title', this.options.networks[i].label)
                    .attr('id', 'share_'+i)
                    .bind('click', { index: i }, function() { me.onClick.apply(me, arguments); })
                    .bind('mouseenter', { index: i }, function() { me.onMouseenter.apply(me, arguments); })
                    .bind('mouseleave', { index: i }, function() { me.onMouseleave.apply(me, arguments); })
            );
        }

        return this;
    },

    /**
     * Resets the textarea.
     * @method reset
     * @return {Self}
     */
    reset: function() {
        jQuery('textarea', this.element).empty();
        jQuery('.formContainer', this.element).animate({ height: '1px' }, 300, 'swing');
        return this;
    },

    /**
     * Display the DOM.
     * @method display
     * @return {Self}
     */
    display: function() {
        if (this.element) {
            this.element.css('display', 'block');
            return this.reset();
        }
        
        return this;
    },

    /**
     * Build the radio link to share.
     * @method buildRadioLink
     * @return {String}
     */
    buildRadioLink: function() {
        return window.location.protocol + '//' + window.location.host + '/radio/' + this.currentRadio.slug;
    },


    /**
     * Revert the state and bind events for the uclicked icons 
     * @method releaseIcon
     * @param {Event} e
     * @param (icon id) cIcon
     */
    releaseIcon: function(cIcon,e){
        var me = this;
        for (var i = 0; i < this.options.networks.length; i++) {
            if(cIcon != i){
                jQuery('#share_'+i).attr('src',this.options.networks[i].icon+'_f.png');
                jQuery('#share_'+i).bind('mouseleave', { index: i }, function() { me.onMouseleave.apply(me, arguments); })
            }else{
                jQuery('#share_'+e.data.index).unbind('mouseleave');
            }
        }
    },

    /**
     * Callback called when and icon is clicked.
     * @method onClick
     * @param {Event} e
     */
    onClick: function(e) {
        this.currentIndex = e.data.index;
        this.currentRadio = GOOM.Audio.currentRadioObj;
        this.reset();
        jQuery('#share_'+e.data.index).attr('src',this.options.networks[e.data.index].icon+'.png');
        this.releaseIcon(e.data.index,e);
        jQuery('textarea', this.element).empty().text(
            replace(this.options.msgTemplate, { title: this.currentRadio.name, link: this.buildRadioLink() })
        );
        jQuery('.formContainer', this.element).animate({ height: '100px' }, 300, 'swing');
    },

    /**
     * Callback called when and icon looses focus
     * @method onMouseenter
     * @param {Event} e
     */
    onMouseenter: function(e) {
        jQuery('#share_'+e.data.index).attr('src',this.options.networks[e.data.index].icon+'.png');
    },

    /**
     * Callback called when and icon is hovered
     * @method onMouseleave
     * @param {Event} e
     */
    onMouseleave: function(e) {
        jQuery('#share_'+e.data.index).attr('src',this.options.networks[e.data.index].icon+'_f.png');
    },

    /**
     * Callback called when the form is submitted.
     * @method onSubmit
     * @param {Event} e
     */
    onSubmit: function(e) {
        if(this.options.networks[this.currentIndex].label=='Twitter') { //prevent url repeat in the tweet 
        	rLink = '';
        }else{
        	rLink = this.buildRadioLink();
        }
    	var radioLink = rLink,
            title = jQuery('textarea', this.element).val(),
            link = replace(this.options.networks[this.currentIndex].url, {
            	link: encodeURIComponent(radioLink),
                title: encodeURIComponent(title)
            });
        window.open(link, 'popup', 'width=800,height=600,scrollbars=1');
        jQuery('.formContainer', this.element).animate({ height: 0 }, 300, 'swing');
    }
};

// The component is reset and displayed when a the radio is changed.
GOOM.Audio.Events.onRadioChange.subscribe(GOOM.site.Share.display, GOOM.site.Share, null, true);/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: CoverflowShuffle.js 21617 2010-09-01 14:31:16Z Stefen ALPER $
 */

createNS('GOOM.site');

/**
 * Shuffle coverflow component
 * Uses jQuery.
 */
GOOM.site.CoverflowShuffle = {
    /**
     * The component options.
     * @var {Object}
     */
    options: {
        // The radio IDs to shuffle.
        radioIds: []
    },

    /**
     * The current index.
     * @var {Integer}
     */
    currentIndex: 0,

    /**
     * Initializes the component.
     * @method init
     * @param {Object} The options to overwrite.
     * @return {Self}
     */
    init: function(options) {
        jQuery.extend(true, this.options, options);

        // Shuffling the radioIds.
        for (var i = this.options.radioIds.length - 1; i > 0 ; i--) {
            var j = Math.round(i * Math.random()),
                tmp = null;
            tmp = this.options.radioIds[j];
            this.options.radioIds[j] = this.options.radioIds[i];
            this.options.radioIds[i] = tmp;
        }

        return this;
    },

    /**
     * Display the current indexed radioIDs
     * and updates the internal pointer.
     * @method shuffle
     */
    shuffle: function() {
        var coverFlow = jQuery('#cowerflowHome');
        if (coverFlow) {
            var radioId = this.options.radioIds[this.currentIndex];
            this.currentIndex = (++this.currentIndex) % this.options.radioIds.length;
            if (coverFlow[0].getSelectedCoverId && radioId == coverFlow[0].getSelectedCoverId()
                && this.options.radioIds.length > 1) {
                return this.shuffle();
            }
            
            coverFlow[0].selectCover(radioId);
        }
    }
};
createNS('GOOM.user');

GOOM.user.Follow = {
    btnList : [],
    
    btnClick : function() {
        var radioUid = this.getAttribute('radioUid');
        if(!GOOM.User.isLoggedIn) {
            GOOM.Context.save(GOOM.user.Follow.btnClick, [], this);
            GOOM.user.Auth.show();
            return false;
        }
        if(this.disabled || !radioUid) {
            return false;
        }
        var radioObj = GOOM.UserRadios.getFollow(radioUid);
        if(radioObj) {
            GOOM.UserRadios.removeFollow(radioUid, function(){});
        } else {
            GOOM.UserRadios.addFollow(radioUid, function(){});
        }
        return false;
    },
    
    createFollowBtn : function(el, radioUid, callback) {
        var me = GOOM.user.Follow,
            btn = el.getElementsByTagName('a')[0],
            countEl = el.parentNode.getElementsByTagName('strong');

        countEl = countEl.length ? countEl[0] : false;

        if(GOOM.UserRadios.isUpdated) {
            var radioObj = GOOM.UserRadios.getFollow(radioUid),
                text = radioObj ? _('FOLLOW_STOP') : _('FOLLOW_START'),
                titleTxt = radioObj ? _('FOLLOW_STOP_TITLE') : _('FOLLOW_START_TITLE');
                bClass = radioObj ? 'green' : '';
            btn.innerHTML = text;
            btn.title = titleTxt;
            btn.className =  bClass;
        }
        btn.onclick = GOOM.user.Follow.btnClick;
        btn.setAttribute('radioUid', radioUid);
        
        return me.btnList.push({el : btn,
                                countEl : countEl, 
                                radioUid : radioUid,
                                callback : callback});
    },
    
    removeFollowBtn : function(btnIndex) {
        var me = GOOM.user.Follow;
        btnIndex = btnIndex - 1; 
        if(!me.btnList[btnIndex]) {
            return false;
        }
        return me.btnList.splice(btnIndex, 1);
    },
    
    handleOnReady : function() {
        var me = GOOM.user.Follow;
        for(var i = 0; i < me.btnList.length; i++) {
            var btn = me.btnList[i];
            var radioObj = GOOM.UserRadios.getFollow(btn.radioUid);
            var text = radioObj ? _('FOLLOW_STOP') : _('FOLLOW_START');
            var titleTxt = radioObj ? _('FOLLOW_STOP_TITLE') : _('FOLLOW_START_TITLE');
            var bClass = radioObj ? 'green' : '';
            btn.el.innerHTML = text;
            btn.el.title = titleTxt;
            btn.el.className =  bClass;
        }
    },
    
    handleOnChange : function(radioObj, isAdd) {
        var me = GOOM.user.Follow;
        for(var i = 0, len =  me.btnList.length; i < len; i++) {
            var btn = me.btnList[i];
            if(btn.radioUid != radioObj.uid) {
                continue;
            }
            setText(btn.countEl, radioObj.followers);
            var text = isAdd ? _('FOLLOW_STOP') : _('FOLLOW_START');
            var titleTxt = isAdd ? _('FOLLOW_STOP_TITLE') : _('FOLLOW_START_TITLE');
            var bClass = isAdd ? 'green' : '';
            btn.el.innerHTML = text;
            btn.el.title = titleTxt;
            btn.el.className =  bClass;
            if(btn.callback) {
                btn.callback(radioObj, isAdd);
            }
        }
    }
}

GOOM.UserRadios.Events.onReady.subscribe(GOOM.user.Follow.handleOnReady);
GOOM.UserRadios.Events.onChange.subscribe(GOOM.user.Follow.handleOnChange);

/* $Rev: 26452 $ */
createNS('GOOM.user');

GOOM.user.Share = {
    html 		: false,
    loading 	: '<div style="height: 450px; background:url(/img/loading_big.gif) 190px 100px no-repeat" /></div>',
    url 		: '/user/api/getoverlay?name=share',
    dialog		: new GOOM.util.Dialog({isModal:true, isNarrow : true}),
    shareObj 	: false,
    emails 		: [],

    /* When a radio has been just created, its status is "pending".
     * At this time, the value its id is actually its uid. 
     * Share links require the final radio id.
     * So, while the radio is pending, the Share dialog box, if displayed, does not show the share links of that radio.
     * This is the aim of testing the value of shareObj.hasActiveStatus in showDialog().
     * However, its value is set when the current page is rendered.
     * If the status of the radio changes from pending to active while the page is still displayed, then the callback
     * called at that time calls itself notifyRadioIsActive() defined below, for informing us about the final id of the radio. 
     */
    showDialog : function(type, shareObj) {
        if(!shareObj || !shareObj.id){
            return;
        }
        
        // Display loading wheel if there is no html content yet
        if (!this.html) {
            this.dialog.setHTML(this.loading);
            this.dialog.open();
            // The callback will call us again after having set our template html content
            GOOM.util.Request('GET', this.url + '&type=' + type,
                              {success : function callback(result) {
                                    var me = GOOM.user.Share;
                                    me.html = result;
                                    if(me.dialog.isOpen()) {
                                        me.showDialog(type, shareObj);
                                    }
                              },
                              rawText : true});
            return;
        }

        //
        // Update and display content
        //
        
        var link = shareObj.link;

        if(type == 'radio' || type == 'show') {
            if(!shareObj.link) {
                link = '/' + type + '/' + shareObj.slug;
            }
        }

        this.shareObj = {id           	 : shareObj.id,
                         title        	 : shareObj.name,
                         professional 	 : shareObj.professional,
                         linkBase        : 'http://' + window.location.host + link,
                         link            : 'http://' + window.location.host + link,
                         type         	 : type.toLowerCase(),
                         hasActiveStatus : ('hasActiveStatus' in shareObj)
				                        	   ? shareObj.hasActiveStatus
				        					   : true,
			        	 shareEmbedCodeTemplate : '<script type="text/javascript">goomPartnerId="{partnerId}";goomAutoPlay="1";goomDefaultRadio="{radioId}";goomBuySong="1";</script><script type="text/javascript" src="http://slam.goomradio.com/include.js"></script>'
			        	 };
                     
        switch (type) {
            case 'radio':
            case 'show':
                this.emails = [];
                    this.dialog.setHTML(this.html);
                    if (!this.dialog.isOpen()) {
                    	this.dialog.open();
                    }
                    GOOM.UI.inputDefaultText([byId('shareToEmail'),byId('shareFromEmail')]);
                    byId('shareToEmail').value = '';
                    byId('shareToEmail').onkeydown = function(e) {
                        setTimeout(function() {
                            var keyCode = 0;
                            if (window && window.event && window.event.keyCode) {
                                keyCode = window.event.keyCode;
                            } else if (e && e.which) {
                                keyCode = e.which;
                            }
                            if (keyCode == 13) {
                                GOOM.user.Share.addEmail(byId('shareToEmail'));
                                return false;
                            } else {
                                return true;
                            }
                        }, 0);
                    };
                    setText(byId('shareTitle'), this.shareObj.title);
                    
                    if (this.shareObj.hasActiveStatus) 
                    {
                    	var domElt = byId('shareDirectLink');
	                    if (domElt) {
	                        domElt.value = this.shareObj.link;
	                    }
	                    if(domElt = byId('shareEmbedCode')) {
	                        if(this.shareObj.type == 'radio') {
	                            domElt.parentNode.parentNode.style.display = 'inline';
	                            var partnerId = this.shareObj.professional ? 'GOOMRADIO' : 'MYGOOM';
	                            domElt.value = this.shareObj.shareEmbedCodeTemplate.replace('{partnerId}', partnerId);
	                            domElt.value = domElt.value.replace('{radioId}', this.shareObj.id);
	                        } else {
	                            byId('embedCode').parentNode.style.display = 'none';
	                            domElt.parentNode.parentNode.style.display = 'none';
	                        }
	                    }
	                    if(window.GATrack) {
	                        window.GATrack('GOOM.user.Share','onShowDialog', this.shareObj.link);
	                    }
	                    this.displayShareLinks(true);
                    } 
                    else // radio is not active, for instance still pending 
                    {
	                    this.displayShareLinks(false);
                    }
                    this.html = false;
                    return;
                break;
            case 'blogpost':
                    this.dialog.setHTML(this.html);

                    this.dialog.open();
                    if(window.GATrack) {
                        window.GATrack('GOOM.user.Share','onShowDialog', this.shareObj.link);
                    }
                    this.html = false;
                    return;
                break;
            default:
                this.dialog.setHTML(_('DIALOG_SHARE_ERROR'));
                this.dialog.open();
                this.html = false;
                break;
        }

    },
    
    updateDialog : function(radioId) 
    {
    	if (this.shareObj.type != 'radio') {
    		return;
    	}
    	
    	// Update links
    	//
    	var link = this.shareObj.linkBase + radioId;
    	
    	var domElt = byId('shareDirectLink');
        if (domElt) {
            domElt.value = link;
        }
        
        if (domElt = byId('shareEmbedCode')) {
        	var partnerId = this.shareObj.professional ? 'GOOMRADIO' : 'MYGOOM';
        	domElt.value = this.shareObj.shareEmbedCodeTemplate.replace('{partnerId}', partnerId);
            domElt.value = domElt.value.replace('{radioId}', radioId);
        }
        
        if (window.GATrack) {
            window.GATrack('GOOM.user.Share','onShowDialog', link);
        }
    	
    	// Update visibility
    	this.displayShareLinks(true);
    },
    
    /**
     * @param boolean bDisplay
     * @return void
     */
    displayShareLinks : function(bDisplay) 
    {
        var domElt = byId('shareEmbedNA');
        if (domElt) {
        	domElt.style.display = bDisplay ? 'none' : 'block';
        }
        if (domElt = byId('directLinkDiv')) {
        	domElt.style.display = bDisplay ? 'block' : 'none';
        }
        if (domElt = byId('embedCodeDiv')) {
        	domElt.style.display = bDisplay ? 'block' : 'none';
        }
    },
    
    /*
     * When called, this informs us about of the final radio id
     * and the fact that the radio can now be shared
     */
    notifyRadioIsActive : function(slug, radioId) {
    	
    	// Update the global share radio object used by the Share html button
    	if (window.sharePostObj
            && window.sharePostObj.slug == slug	) 
    	{ 
    		this.updateShareObject(window.sharePostObj, radioId);
    	}
    	
    	// The global object GOOM.Audio.currentRadioObj used byt the Share object of the flahs player
    	// corresponds to the radio currently being played.
    	// Since it can only be an active radio, there will be never a need to update it.
    	
    	if (this.dialog.isOpen()) {
    		this.updateDialog(radioId);
    	} 
    },
    
    updateShareObject : function(shareObj, radioId)
    {
    	shareObj.id = radioId;
		shareObj.hasActiveStatus = true;
    },
    
    closeDialog : function() {
        this.dialog.close();
    },
    
    shareLink : function(provider) { 
        var networks = {
            friendfeed : 'http://friendfeed.com/?url=%{link}&title=%{title}',
            twitter    : 'http://twitter.com/home?status=%{title} %{link}',
            digg       : 'http://digg.com/submit?url=%{link}&title=%{title}',
            myspace    : 'http://www.myspace.com/index.cfm?fuseaction=postto&t=%{title}&u=%{link}',
            delicious  : 'http://delicious.com/save?v=5&noui=1&partner=goom&jump=doclose&url=%{link}',
            facebook   : 'http://www.facebook.com/sharer.php?u=%{link}&t=%{title}'
        };
        if(!this.shareObj || !networks[provider]) {
            return;
        }
        if(window.GATrack) {
           window.GATrack('GOOM.user.Share','onShareLink', provider, this.shareObj.link);
        }
        //this sets the opener of the first opened window to the new window you just opened
        // add radio track
        var title_content=this.shareObj.title;
        // @todo: change text!
        var domNowPlaying = byId('radio_nowplaying')
        if (typeof(domNowPlaying)!='undefined' && domNowPlaying!=null && domNowPlaying.innerHTML!='') {
                var song_title=domNowPlaying.innerHTML;
        	title_content = encodeURIComponent((SITE_ID==1? 'Check out ' : 'J\'ai découvert ')) + song_title + ((SITE_ID==1)? ' on ' : ' sur ') + title_content;
        }
        else {
            title_content = encodeURIComponent((SITE_ID==1? 'Check out ' : 'J\'ai découvert ')) + title_content + (SITE_ID==1? ' on ' : ' sur ') + 'Goom Radio' ;
        }
        window.open(replace(networks[provider], {link : this.shareObj.link, title : title_content}), 'popup', 'width=800,height=600,scrollbars=1');
    },
    
    addEmail : function(el){
        var val = el.value,
            callback = function () {
                byId('shareToEmail').value = '';
                GOOM.user.Share.emails.push(val);

                var li = document.createElement('li');
                li.innerHTML = '<a href="#" onclick="GOOM.user.Share.removeEmail(this); return false;">' + val + '</a>';
                byId('shareEmailList').appendChild(li);
            };
        GOOM.util.checkEmail(el, callback);
    },
    
    removeEmail : function(el) {
        for(var i = 0; len = this.emails.length, i < len; i++) {
            if(this.emails[i] == el.innerHTML) {
                this.emails.splice(i, 1);
            }
        }
        byId('shareEmailList').removeChild(el.parentNode);
    },

    send : function(formEl) {
        formEl.elements.shareEmails.value = this.emails.join(',');
        formEl.elements.shareType.value = this.shareObj.type;
        formEl.elements.shareId.value = this.shareObj.id;
        if (domNowPlaying = byId('radio_nowplaying')) {
            formEl.elements.shareTrack.value=domNowPlaying.innerHTML;
        }
      
        disableFields(formEl.elements);
        GOOM.util.FormRequest(formEl, {success : function(result){
            enableFields(formEl.elements);
            
            var li = byId('shareEmailList').getElementsByTagName('li');
            removeClass(li, 'invalid');
            
            if(result.success) {
                GOOM.site.Note.show('NORMAL', result.message);
                GOOM.user.Share.closeDialog();
                return;
            }
            var me = GOOM.user.Share;
            setText(byId('shareErrorMessage'), result.message);
            
            if(result.badEmails) {
                for(var i = 0, len = result.badEmails.length; i < len; i++) {
                    var email = result.badEmails[i];
                    if(me.emails.indexOf(email) != -1) {
                        if(li[i]) {
                            addClass(li[i], 'invalid');
                        }
                    }
                }
                delete result.errors.badEmails;
                handleFormResults(formEl, result);
            }
        }});
        
    }
}
createNS('GOOM.user');

GOOM.user.StatusBar = {
//    UserMenu : new GOOM.util.Menu({openFns  : [function() {byId('profileStatusBar').children[1].className = 'userSelected'}],
//                                   closeFns : [function() {byId('profileStatusBar').children[1].className = 'userDetails'}]}),
//    Flags : new GOOM.util.Menu({openFns  : [function() {byId('countryFlags').className = 'countryFlags flagSelected'}],
//                                closeFns : [function() {byId('countryFlags').className = 'countryFlags'}]}),
    NavChangeSearch : new GOOM.util.Menu(),
    navSearchObjType : 'radio',

    template : { 
        loggedOutStatus : '<div class="reg_bt_left"></div>' +
                            '<div class="reg_bt_right">' +
                            '<a id="statusBarLoginBtn" href="#" onclick="GOOM.Context.save(GOOM.Navigation.load, [\'/home\']); GOOM.user.Auth.show(); return false;">' +
                            '%{login}' +
                          '</a>' +
                          '</div>' +
                          '<div class="reg_bt_left"></div>' +
                            '<div class="reg_bt_right">' +
                          '<a href="#" onclick="GOOM.user.Registration.show(); pageTracker._trackPageview(\'reg_link_header\');return false;">' +
                            '%{register}' +
                          '</a>' +
                      '</div>' ,
        loggedInStatus : '<img alt="small avatar" class="smallAvatar" src="%{avatar}" onerror="defaultImg(this, \'/img/goomer_t1.jpg\')"/>' +
                         '<p>'+'%{username}</p>' +
                         '<div class="reg_bt_left"></div>' +
                         '<div class="reg_bt_right">' +
                            '<a href="/user/settings" onclick="GOOM.Navigation.load(this.href); return false;">'+'%{settings}'+'</a>' +
                         '</div>'+
                         '<div class="reg_bt_left"></div>' +
                         '<div class="reg_bt_right">' +
                            '<a href="undefined" onclick="GOOM.util.MenuMgr.close(); GOOM.user.Auth.logout(); return false;">'+'%{logout}'+'</a>' +
                         '</div>'
    },

    init: function() {
//        var contents = [],
//            flagLabels = {1 : _('USA'), 2 : _('FRANCE'), 3 : _('GERMANY')},
//            searchEl = $("#nav-search-value");
//
//        for (var i in SITES_ARRAY) {
//            var isSite   = (i == SITE_ID),
//                onclickFn = (isSite) ?
//                            'return false;' :
//                            'GOOM.site.Navigation.switchSite(\'' +
//                            DOMAIN_PREFIX + SITES_ARRAY[SITE_ID].domain + '\', ' +
//                            '\'' + DOMAIN_PREFIX + SITES_ARRAY[i].domain + '/\'); ' +
//                            'return false;',
//                flagIcon  = (isSite) ?
//                            '/img/flag_' + SITES_ARRAY[i].countryCode + '_off.jpg' :
//                            '/img/flag_' + SITES_ARRAY[i].countryCode + '.jpg';
//
//
//            contents.push({image   : flagIcon,
//                           label   : flagLabels[i],
//                           href    : '#',
//                           onclick : onclickFn});
//        }
//
//        this.Flags.setContents(contents);
//
        this.NavChangeSearch.setContents([{label : _('NAV_FIND_RADIOS'),
                                           href : '#',
                                           onclick : 'GOOM.user.StatusBar.setNavSearchObj(\'radio\'); return false;'},
                                          {label : _('NAV_FIND_SHOWS'),
                                           href : '#',
                                           onclick : 'GOOM.user.StatusBar.setNavSearchObj(\'show\'); return false;'}]);
/*
        searchEl.autocomplete('/' + this.navSearchObjType + '/list/autocomplete', {scroll: false});
        searchEl.result(function(event, data, formatted) {
            if(data && searchEl.attr('title') !== formatted) {
                byId('userSearch').onsubmit();
            }
        });
*/
        
        GOOM.User.Events.onChange.subscribe(GOOM.user.StatusBar.update);

//        GOOM.UserRadios.Events.onChange.subscribe(function() {
//            GOOM.user.StatusBar.updateUserRadios();
//        });
//
//        GOOM.UserRadios.Events.onReady.subscribe(function() {
//            GOOM.user.StatusBar.updateUserRadios();
//        });
//
//        GOOM.Navigation.Events.onPageLeave.subscribe(function() {
//            GOOM.util.MenuMgr.close();
//        });
//
//        GOOM.Navigation.Events.onPageChange.subscribe(function() {
//            GOOM.util.MenuMgr.close();
//        });

        GOOM.user.StatusBar.update();
    },
    
    update : function(purgeImage) {
        var me = GOOM.user.StatusBar,
            userDetails = GOOM.User.getDetails(),
            html = replace(me.template.loggedOutStatus, {
                register : _('NAV_REGISTER'),
                login : _('NAV_LOGIN')
            });

        if(userDetails) {
            html = replace(me.template.loggedInStatus,
                           {avatar : window.getASSET() + 
                                      '/goomer/' + userDetails.id +
                                      '_avatar/t1' +
                                      (purgeImage
                                          ? '?nocache=' + (new Date()).getTime()
                                          : ''),
                             more : _('NAV_MORE_ACTION'),
                             username : userDetails.username,
                             settings : _('NAV_SETTINGS'),
                             logout : _('NAV_LOGOUT')
                         }
                 );
//            GOOM.user.StatusBar.updateUserRadios();
        }

        byId('profileStatusBar').innerHTML = html;
    },

//    updateUserRadios : function() {
//        var created = GOOM.UserRadios.created,
//            followed = GOOM.UserRadios.followed,
//            createdRadios = [],
//            followedRadios = [];
//
//        if(created) {
//            for(var i = 0, len = (created.length < 5) ? created.length : 5; i < len; ++i) {
//                createdRadios[i] = {href : '/radio/' + created[i].slug,
//                                    label : created[i].name,
//                                    siteId : created[i].siteId};
//            }
//            if(created.length > 5) {
//                createdRadios[i] = {href : '/radios/created',
//                                    label : _('NAV_SEE_MORE'),
//                                    siteId : SITE_ID}
//            }
//        }
//        if(followed) {
//            for(i = 0, len = (followed.length < 5) ? followed.length : 5; i < len; ++i) {
//                followedRadios[i] = {href : '/radio/' + followed[i].slug,
//                                     label : followed[i].name,
//                                     siteId : followed[i].siteId};
//            }
//            if(followed.length > 5) {
//                followedRadios[i] = {href : '/radios/following',
//                                     label : _('NAV_SEE_MORE'),
//                                     siteId : SITE_ID}
//            }
//        }
//
//        var menuContent = [];
//        if (created && created.length > 0) {
//            menuContent.push({
//                label : _('NAV_RADIOS_CREATED'),
//                className : 'groupLi',
//                content : createdRadios,
//                onclick : 'GOOM.Navigation.load(\'/radios/created\'); return false;'});
//        }
//
//        menuContent.push({
//            label : _('NAV_RADIOS_FOLLOWING'),
//            content : followedRadios,
//            onclick : 'GOOM.Navigation.load(\'/radios/following\'); return false;'});
//        menuContent.push({
//            label : _('NAV_SETTINGS'),
//            className : 'groupLi',
//            href : '/user/settings',
//            onclick : 'GOOM.Navigation.load(this.href); return false;'});
//        menuContent.push({
//            label : _('NAV_LOGOUT'),
//            onclick : 'GOOM.util.MenuMgr.close(); GOOM.user.Auth.logout(); return false;'});
//
//        GOOM.user.StatusBar.UserMenu.setContents(menuContent);
//    },

    showUser : function(triggerEl) {
        var details = GOOM.User.getDetails();
        if(!details) {
            return;
        }
        this.UserMenu.open(triggerEl, byId('profileStatusBar'));
    }
//
//    setNavSearchObj : function(type) {
//        var val = (type == 'show') ? _('NAV_FIND_SHOWS') : _('NAV_FIND_RADIOS'),
//            searchEl = $("#nav-search-value");
//
//        searchEl.attr('value', val);
//        searchEl.attr('title', val);
//        this.navSearchObjType = type;
//        GOOM.util.MenuMgr.close();
//
//        /*searchEl.unautocomplete();
//        searchEl.autocomplete('/' + this.navSearchObjType + '/list/autocomplete');
//        searchEl.result(function(event, data, formatted) {
//            if(data && $("#nav-search-value").attr('title') !== formatted) {
//                byId('userSearch').onsubmit();
//            }
//        });*/
//    }
}
/**
 * @package Goom
 * @category GoomJS
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: MyGoom.js 26409 2011-03-01 13:25:01Z Bogdan Busuioc $
 */

createNS('GOOM.user');

/**
 * @see JQuery
 */
GOOM.user.MyGoom = {
    element: null,

    init: function(element) {
        this.element = element;
        GOOM.User.Events.onChange.subscribe(GOOM.user.MyGoom.update, GOOM.user.MyGoom, null, true);
        GOOM.UserRadios.Events.onReady.subscribe(GOOM.user.MyGoom.updateRadios, GOOM.user.MyGoom, null, true);
        GOOM.UserRadios.Events.onChange.subscribe(GOOM.user.MyGoom.updateRadios, GOOM.user.MyGoom, null, true);
        this.update();
        this.updateRadios();
    },

    update: function() {
        this.element.unbind('click mouseenter mouseleave');
        jQuery('div > ul', this.element).unbind('click');
        this.element.empty();

        var userDetails = GOOM.User.getDetails();
        if (userDetails) {
            // Signed in state
            this.element.bind('mouseenter mouseleave', function(e) {
                switch (e.type) {
                    case 'mouseenter':
                     //   GOOM.site.AppMenu.mouseEnter.apply(this, arguments);
                        break;

                    case 'mouseleave':
                    //    GOOM.site.AppMenu.mouseLeave.apply(this, arguments);
                    break;
                }
            });
        } else {
            // Signed out state
            this.element.append(jQuery((SITE_ID=='1')?'<ul>\n\
<li class="unloggedIn"><strong><span>Register today</span> to:</strong><br/>- save favorite stations<br/>\n\
            - listen on your phone<br/>\n\
            - share with your friends<br/></li>\n\
</ul>':'<ul>\n\
<li class="unloggedIn"><strong><span>Enregistre-toi d&egrave;s aujourd\'hui</span> pour:</strong><br/> \n\
                    - sauvegarder tes radios pr&eacute;f&eacute;r&eacute;es<br/> \n\
                    - &eacute;couter sur ton iPhone<br/> \n\
                    - partager avec tes amis<br/></li></ul>'));

            this.element.bind('click', function() {
                GOOM.Context.save(GOOM.Navigation.load, ['/home']);
                GOOM.user.Auth.show();
            });
        }
    },

    updateRadios: function() {
        if (!GOOM.User.getDetails()) {
            return;
        }

        var created = GOOM.UserRadios.created,
            followed = GOOM.UserRadios.followed,
            list = jQuery('ul', this.element);

        // Cleaning.
        if (0 == list.length) {
            this.element.append(jQuery('<ul></ul>'));
            list = jQuery('ul', this.element);
        } else {
            list.empty();
        }
        
        // Adding followed...
        if(followed.length>0) {
         	var followedRadios = '<li class="dir" ><span onclick="GOOM.Navigation.load(\'/radios/following\'); return false;">' + _('NAV_RADIOS_FOLLOWING') + '</span><ul>';
            for(var i = 0, len = (followed.length < 5) ? followed.length : 5; i < len; ++i) {
	          	if(window.SITE_ID == followed[i].siteId){
	            		var onAction = 'GOOM.Navigation.load(\'/radio/'+followed[i].slug+'\')';
	            }else{
	            		var onAction = 'GOOM.site.Navigation.switchSite(\''+window.DOMAIN_PREFIX +window.SITES_ARRAY[followed[i].siteId]['domain']+'\',\'/radio/'+followed[i].slug+'\')';
	            }
            		followedRadios += '<li class="dir" onmouseover="GOOM.site.AppMenu.load(\''+followed[i].id+'\',\'myG\');" onclick="'+onAction+'; return false;">' + followed[i].name + '\
					            	<ul>\
            							<li class="dir">\
					            			<div class="menu_play" onclick="'+onAction+'; return false;">\
					            				<a href="" ><img  src="http://store.test.goomradio.com/radio/'+followed[i].id+'_logo" /></a>\
					            				<img class="menu_play_img" src="../img/nowplaying_hover_menu.png" />\
					            			</div>\
					            			<span class="menu_desc">'+ followed[i].slogan + '</span>\
							            	<div id="myGsonginf_'+followed[i].id+'" class="songinfo">\
								            	<span id="myGart_'+followed[i].id+'" class="menu_art">&nbsp;</span>\
								            	<span id="myGsong_'+followed[i].id+'" class="menu_song">&nbsp;</span>\
							            	</div></li></ul></li>';
            }
            if(followed.length > 5) {
            	followedRadios +='<li class="more last" onclick="GOOM.Navigation.load(\'/radios/following\'); return false;">' + _('NAV_SEE_MORE') + '</li>';
            }
            followedRadios += '</ul></li>';
            list.append(followedRadios);
        }

        // Adding created...
        if(created.length>0) {
            var createdRadios = '<li class="dir"><span onclick="GOOM.Navigation.load(\'/radios/created\'); return false;">' + _('NAV_RADIOS_CREATED') + '</span><ul>';
            for(var i = 0, len = (created.length < 5) ? created.length : 5; i < len; ++i) {
	          	if(window.SITE_ID == created[i].siteId){
            		var onAction = 'GOOM.Navigation.load(\'/radio/'+created[i].slug+'\')';
            }else{
            		var onAction = 'GOOM.site.Navigation.switchSite(\''+window.DOMAIN_PREFIX +window.SITES_ARRAY[created[i].siteId]['domain']+'\',\'/radio/'+created[i].slug+'\')';
            }
            	
            	createdRadios += '<li class="dir" onmouseover="GOOM.site.AppMenu.load(\''+created[i].id+'\');" onclick="'+onAction+'; return false;">' + created[i].name + '\
					            	<ul>\
            							<li class="dir">\
            								<div class="menu_play" onclick="GOOM.Navigation.load(\'radio/'+created[i].slug+'\'); return false;">\
            									<a href="" ><img  src="http://store.test.goomradio.com/radio/'+created[i].id+'_logo" /></a>\
            									<img class="menu_play_img" src="../img/nowplaying_hover_menu.png" />\
            								</div>\
            								<span class="menu_desc">' + created[i].slogan + '</span>\
            								<div id="songinf_'+created[i].id+'" class="songinfo">\
            									<span id="art_'+created[i].id+'" class="menu_art">&nbsp;</span>\
            									<span id="song_'+created[i].id+'" class="menu_song">&nbsp;</span>\
            								</div></li></ul></li>';
            }
            if(created.length > 5) {
            	createdRadios +='<li class="more last" onclick="GOOM.Navigation.load(\'/radios/created\'); return false;">' + _('NAV_SEE_MORE') + '</li>';
            }
            createdRadios += '</ul></li>';
            list.append(createdRadios);
        }

        // Adding settings item
        list.append(jQuery('<li class="title cursorPointer" onclick="GOOM.Navigation.load(\'/user/settings\');return false">' + _('NAV_SETTINGS') + '</li>'));

        // Adding sign out item
        list.append(jQuery('<li class="title cursorPointer " onclick="GOOM.user.Auth.logout();">' + _('NAV_LOGOUT') + '</li>'));
    }
};
/* $Rev: 26544 $ */
createNS('GOOM.user');

GOOM.user.Auth = (function() {
    LoginDialog = new GOOM.util.Dialog({
        isModal : true,
        isNarrow : true
    });
        
    //need to fix this should get the base uri from somwhere
    var _api = {
        logout : '/user/session/logout?multidomain_cb=GOOM.User.removeLoginFrame',
        login : '/user/session/login'
    };

    var _templateHome = '<fieldset><h3 class="getStartedHeader">%{message}</h3><input gtype="button" type="submit" class="button primary" value="%{ok}"/></fieldset>';
    
    function getLoginHTMLStr(attr) {
        attr = attr || {};
        var str = '';
        if(!attr.noHeader) {
            str += replace('<div class="loginform"><h2 class="registrationTitle">%{title}</h2><p class="registrationTxt">%{description} <a href="#" onclick="GOOM.user.Registration.show(); return false;" title="%{register}">%{register}</a></p>', 
            {
                title : _('AUTH_LOGIN_TITLE') ,
                description : _('AUTH_DESCRIPTION'),
                register : _('AUTH_REGISTER')
            });
        }
        str += replace('<form id="userLoginForm" class="modalForm" method="post" onsubmit="GOOM.user.Auth.login(this); return false;"><fieldset><legend></legend><div class="username"><label for="loginUsername">%{username}</label><input type="text" class="formElement inputText clear" gtype="button" name="login" id="loginUsername" autocomplete="off" value="" /></div><div class="username"><label for="loginPassword" class="clear">%{password}</label><input id="loginPassword" class="formElement inputPassword" gtype="button" name="password" autocomplete="off" value="" type="password" /></div><div id="loginMessage" class="clear invalid"></div><div class="clear forgotPwd"><a href="/password/forgot" onclick="GOOM.util.DialogMgr.close(); GOOM.Navigation.load(this.href); return false;">%{forgot}</a></div>',
        {
            title : _('AUTH_LOGIN_TITLE'),
            description : _('AUTH_DESCRIPTION'),
            username : _('AUTH_USERNAME'),
            password : _('AUTH_PASSWORD'),
            forgot : _('AUTH_FORGOT')
            });
        if(!attr.noBtn) {
            str += replace('<div class="containerSubmit"><input gtype="button" class="clear button primary" value="%{enter}" type="submit"></div>',
            {
                enter : _('AUTH_ENTER')
            });
        }
        str += '</fieldset></form></div>';
        return str;
    }
    
    function handleResponse(formEl, result, cb) {
        enableFields(formEl.elements);
        formEl.getElementsByTagName('input')[0].focus();
        if(!cb && result.success) {
            LoginDialog.close();
            GOOM.User.updateDetails(result);
            GOOM.user.Auth.Events.onLogin.fire();

            var loc = window.location;    
            if(loc.hash!=''){
                reference=loc.hash.replace('#page=','');
                GOOM.Navigation.refresh();
                return;
            }else{
                 reference=loc.pathname;
            }
            GOOM.Navigation.load(reference, function() {});
            return;
        }
        
        if(formEl.name == 'homeLogin') {
            formEl.style.display = 'none';
            var msgForm = document.createElement('form');
            msgForm.className = 'formScreen';
            msgForm.onsubmit = function() {
                this.parentNode.removeChild(this);
                formEl.style.display = "block";
            }
            msgForm.innerHTML = replace(_templateHome, {
                message :result.message,
                ok : _('LABEL_TRY_AGAIN')
                });
            byId('homeLoginContainer').appendChild(msgForm);
            GOOM.UI.update(byId('homeLoginContainer'));
        } else {
            var el = byId('loginMessage');
            if(el) {
                setText(el, result.message);
            }
        }
        
        if(cb) {
            cb(result.success);
        }
    }
    
    return {
        Events: {
            onLogin: new GOOM.Event('G:Auth:onLogin')
        },

        show : function() {
            LoginDialog.setHTML(getLoginHTMLStr());
            LoginDialog.open();
        },
        
        append : function(el, callback) {
            el.innerHTML = getLoginHTMLStr({
                noHeader : true,
                noBtn : true
            });
            var form = el.getElementsByTagName('form');
            form[0].onsubmit = function(){
                GOOM.user.Auth.login(this, callback);
                return false;
            }
        },
        
        logout : function() {
            GOOM.Navigation.load('/', function() {
                GOOM.util.Get(_api.logout, function(result) {
                    GOOM.User.updateDetails(result);
                })
            });
        },
        
        login : function(formEl, cb) {
            clearFormMsgs(formEl);
            disableFields(formEl.elements);
            formEl.action = _api.login;
            GOOM.util.FormRequest(formEl, {
                success : function(r) {
                    handleResponse(formEl, r, cb);
                },
                postData : 'multidomain_cb=GOOM.User.removeLoginFrame'
            });
        }
    }
})();

GOOM.user.Auth.Events.onLogin.subscribe(function() { 
    //  GOOM.Context.restore(); // redirects to home page and cleans info - removed since 4.2
    });/* $Rev: 28293 $ */
createNS('GOOM.user');
createNS('GOOM.user.Registration');

GOOM.user.Registration = (function() {
    var _api = '/user/api/create',
        _dialog = new GOOM.util.Dialog({isModal:true});

    function handleResponse(formEl, result, cb) {
        if(!cb && result.success) {
            GOOM.User.updateDetails(result);
            GOOM.User.Events.onRegistered.fire();
            GOOM.Navigation.load('/home');
            _dialog.close();
            return;
        }
        enableFields(formEl);
        handleFormResults(formEl, result);
        if(cb) {
            cb(result.success);
        }
        var el = _dialog.getContainer();
        el.className = el.className;
    }

    function getRegisterHTMLStr(setting) {
        setting = setting || {};
        var str = '';
        if(!setting.noHeader) {
            str = replace('<h2 class="registrationTitle">%{title}</h2><p class="registrationTxt">%{description}<br /><a href="#" onclick="GOOM.user.Auth.show(byId(\'statusBarLoginBtn\'))" title="%{login}">%{login}</a></p>',
                          { title : _('REG_TITLE'), description : _('REG_DESCRIPTION') , login : _('REG_LOGIN') });
        }
        
        str += replace('<form autocomplete="off" id="userRegisterForm" onsubmit="GOOM.user.Registration.register(this); return false;" class="modalForm"><fieldset><legend></legend><div class="username"><label for="registerUsername">%{username}</label><input id="registerUsername" name="registerUsername" class="formElement inputText clear" gtype="button" type="text" /><span class="unAvailable"></span></div><div class="email"><label for="registerEmail">%{email}</label><input id="registerEmail" name="registerEmail" class="formElement inputText clear" gtype="button" type="text" /><span class="clear invalid"></span><div id="registerDisclaim" class="disclaimer clear">%{privacy}</div></div><div class="clear"></div><div class="password"><label for="registerPassword" class="clear">%{password}</label><input id="registerPassword" name="registerPassword" type="password" class="formElement inputPassword" gtype="button" /><span class="clear invalid"></span><div id="registerDisclaim" class="disclaimer clear">%{passwordWarning}</div></div><div class="password"><label for="registerConfirmPassword" class="clear">%{confirm}</label><input id="registerConfirmPassword" name="registerConfirmPassword" type="password" class="formElement inputPassword" gtype="button" /><span class="clear invalid"></span></div><div class="clear gender"><label for="male">%{male}</label><input id="male" type="radio" name="registerGender" value="male" /><label for="female">%{female}</label><input type="radio" id="female" name="registerGender" value="female" /><span class="clear invalid"></span></div><div class="birthdate"><label for="registerDay">%{birth}</label><div><select name="registerDay" id="registerDay" class="formElement select settingsDay" gtype="button" onChange="updateYear();"><option selected="selected">%{day}</option></select><select id="registerMonth" name="registerMonth" class="formElement select settingsMonth" gtype="button" onChange="updateYear();"><option selected="selected">%{month}</option></select><select id="registerYear" name="registerYear" class="formElement select settingsYear" gtype="button"><option selected="selected">%{year}</option></select></div><span class="clear invalid"></span></div><div class="clear acceptTos"><input id="registerTerms" value="true" type="checkbox" name="registerTerms" /><label for="registerTerms">%{terms}</label><span class="clear invalid"></span></div>\
        		<div class="clear acceptTos"><input id="thirdPartyOffers" value="true" type="checkbox" name="thirdPartyOffers" /><label for="thirdPartyOffers">%{offers}</label><span class="clear invalid"></span></div>\
        		<div class="containerSubmit">',
                       { privacy : _('REG_DISCLAIM_EMAIL'), confirm : _('REG_CONFIRM_PASS'), birth : _('REG_BIRTH'), year : _('REG_YEAR'), month : _('REG_MONTH'), day : _('REG_DAY'), terms : _('REG_TERMS'), offers : _('THIRD_PARTY_OFFERS_DESCRIPTION'), username : _('REG_USERNAME'), password : _('REG_PASS'), email : _('REG_EMAIL'), male : _('REG_MALE'), female : _('REG_FEMALE'), passwordWarning : _('REG_PASSWORD_WARNING')});
        
        if(!setting.noBtn) {
            str += replace('<input gtype="button" class="clear button primary" value="%{submit}" type="submit">',
                           { submit : _('REG_SUBMIT') });
        }
        str += '</div></fieldset></form>';
        return str;
    }

    function updateDate() {
        var dayEl = byId('registerDay'),
            monthEl = byId('registerMonth'),
            yearEl = byId('registerYear'),
            curDate = new Date(),
            y = curDate.getFullYear();

        for(var i = 1; i < 32; ++i) {
            addOption(dayEl, i , i);
        }

        for(i = 1; i < 13; ++i) {
            addOption(monthEl, i , i);
        }
        
        for(i = y - 12; i > y - 100; --i) { //12 years minimum age (TOS)
            addOption(yearEl, i, i);
        }
    }

    return {
        show : function(triggerEl) {
            _dialog.setHTML(getRegisterHTMLStr());
            _dialog.open();
            updateDate();
        },

        append : function(el, callback) {
            el.innerHTML = getRegisterHTMLStr({ noHeader : true, noBtn : true });
            var form = el.getElementsByTagName('form');
            form[0].onsubmit = function(){  GOOM.user.Registration.register(this, callback); return false;}
            updateDate();
        },

        register : function(formEl, cb) {
            clearFormMsgs(formEl);
            disableFields(formEl.elements);
            formEl.action = _api;
            GOOM.util.FormRequest(formEl, { success : function(r) { 
                handleResponse(formEl, r, cb); 
            }});
        }
    }
})();
/* $Id: Utils.js 21694 2010-09-03 13:08:14Z Carlo Pescetelli $ */

createNS('GOOM.user.Utils');

GOOM.user.Utils = {
    checkUsername : function(el, excludeUsername) {
        var str = el.value;

        if(str == excludeUsername) {
            return;
        }
        if(el.getAttribute('gtype') == 'button') {
            el = el.parentNode.parentNode;
        }
        removeClass(el, 'invalidInput');

        addClass(el, 'loadingResult');
        GOOM.util.Request('GET', '/user/api/check?username=' + str, { success : function(r) {
            removeClass(el, 'loadingResult');
            if(!r.success){
                return;
            }
            if(r.available) {
                removeClass(el, 'invalidInput');
                setFormMsg(el, _('USERNAME_AVAILABLE'), 'available');
            } else {
                addClass(el, 'invalidInput');
                setFormMsg(el, _('USERNAME_UNAVAILABLE'));
            }
        }});
    },
        
    saveProfile : function(formEl) {
        GOOM.util.FormRequest(formEl, {success : function(result) {
            enableFields(formEl.elements);
            if(result.success) {
                if(result.invalidateUser) {
                   GOOM.User.isValidated = false;
                }
                if(result.reloadNeeded) {
                    window.location = '/home';
                } else {
                    GOOM.Navigation.load('/home');
                }
                GOOM.site.Note.show('normal', result.message);
            } else {
                if(result.errors) {
                    handleFormResults(formEl, result, true);
                } else {
                    GOOM.util.FatalMsg({message : result.message});
                }
            }
        }});
        disableFields(formEl.elements);
        clearFormMsgs(formEl);
    },

    saveAvatar : function(triggerEl) {
        GOOM.util.FileUpload(triggerEl, '/user/settings/avatar', function(r) {
            if(!r.success) {
                GOOM.util.FatalMsg({message : r.message});
                return;
            }
            GOOM.user.StatusBar.update(true);
            if(GOOM.User.isLoggedIn) {
                byId('settingsAvatarImg').src = window.getASSET() + '/goomer/' + GOOM.User.userDetails.id + '_avatar/t3?nocache=' + (new Date()).getTime();
            }
        });
    },

    showComingSoon : function(triggerEl, alignEl) {
        var body = replace("<h2 class='comingSoonTitle'>%{title}</h2><p class='comingSoonTxt'>%{body}</p>",
                {title : _('SHOUT_COMING_SOON') , body : _('SHOUT_COMING_SOON_BODY')});
        GOOM.radio.Utils.comingSoonDialog.setHTML(body);
        GOOM.radio.Utils.comingSoonDialog.open(triggerEl, alignEl);
    },

    report : function(el, type, reportId) {
        if(el.getAttribute('loaded')) {
            return;
        }
        el.setAttribute('loaded', true);

        var label = el.innerHTML,
            reportUri  = '/user/api/flag?type=' + type + '&reportId=' + reportId;

        setText(el,_('LABEL_SENDING'));
        if(GOOM.User && GOOM.User.isLoggedIn) {
            reportUri += '&userId=' + GOOM.User.userDetails.id;
        }
        GOOM.util.Get(reportUri, function(r) {
              if(!r.success) {
                  return;
              }
              setText(el, r.message);
              setTimeout(function() {setText(el, label)}, 3000);
        });
    },

    contact : function(formEl) {
    	// Verify that fields are not empty
    	var contactEmail = GOOM.util.trim(formEl.elements['contactEmail'].value); 
    	if (contactEmail == '') {
        	var dlg = new GOOM.util.Dialog({isModal : true, isNarrow : true, isError : true});
        	dlg.setHTML('<h2>' + _('CONTACT_US_ERR_TITLE') + '</h2>' + _('CONTACT_US_ERR_EMAIL_MISSING'));
        	dlg.open();
    		return;
    	}
    	var mailBody = GOOM.util.trim(formEl.elements['contactBody'].value); 
    	if (mailBody == '') 
    	{
        	var dlg = new GOOM.util.Dialog({isModal : true, isNarrow : true, isError : true});
        	dlg.setHTML('<h2>' + _('CONTACT_US_ERR_TITLE') + '</h2>' + _('CONTACT_US_ERR_MSG_MISSING'));
        	dlg.open();
    		return;
    	}
    	
    	// Sendmail callback
    	var tmpFormEl = formEl;
    	var sendmailCallback = function(response) 
    	{
    		if (response.success) {
		        disableFields(tmpFormEl.elements);
		        GOOM.util.FormRequest(tmpFormEl, {
		        	success : function(r) {
			            enableFields(tmpFormEl.elements);
			            if(r.success) {
			                tmpFormEl.reset();
			                //GOOM.Navigation.load('/'); // if we go to the site home page, then the note only flashes and is barely visible 
			            }
			            if(r.message) {
			                GOOM.site.Note.show('normal', r.message);
			            }
		        	},
	        		failure : function(status, e) {
			            enableFields(tmpFormEl.elements);
	        			var dlg = new GOOM.util.Dialog({isModal : true, isNarrow : true, isError : true});
	        			var msg = e.message ? e.message : 'Unknown error';
	        			if (e.name) {
	        				msg += '<br/>' + e.name;
	        			}
	        			dlg.setHTML('<h2>' + _('CONTACT_US_ERR_TITLE') + '</h2>' + msg + '<br/>(' + status + ')');
	                	dlg.open();
		        	}
        		});
    		} else {
    			var dlg = new GOOM.util.Dialog({isModal : true, isNarrow : true, isError : true});
    			dlg.setHTML('<h2>' + _('CONTACT_US_ERR_TITLE') + '</h2>' + response.message);
            	dlg.open();
    		}
    	};

    	// Validate email and send msg if valid
        GOOM.util.Get('/default/api/check-email?address=' + contactEmail, sendmailCallback);
    },

///////////////////////////////////////////////////////////////////////////////////////////////////

    forgotDialog : new GOOM.util.Dialog(true),
    forgotDialogCache : false,

    showForgotPassword : function() {
        var me = GOOM.user.Utils;
        if(me.forgotDialogCache) {
            me.forgotDialog.setHTML(me.forgotDialogCache);
            GOOM.UI.inputDefaultText(byId('passwordEmail'));
        } else {
            me.forgotDialog.loading();
            GOOM.util.Request('GET','/user/overlay/password-reset', {
                success : function(r) {
                    me.forgotDialogCache = r;
                    me.forgotDialog.setHTML(r);
                    GOOM.UI.inputDefaultText(byId('passwordEmail'));
                },
                rawText : true});
        }
        me.forgotDialog.open();
    },

    forgotPassword : function(formEl) {
        disableFields(formEl.elements);
        GOOM.util.FormRequest(formEl, {success : function(r) {
            enableFields(formEl.elements);
            if(r.success) {
                GOOM.Navigation.load('/', function(){GOOM.site.Note.show('normal', r.message);});
                return;
            } else {
                setText(byId('passwordResetMessage'), r.message);
            }
        }});
    },

    showValidateEmail : function() {
        var dialog = new GOOM.util.Dialog({isModal : true, isNarrow : true});
        dialog.loading();
        dialog.open();
        
        GOOM.util.Request('GET','/user/overlay/validate-email', {success : function(r) {
            dialog.setHTML(r);
            var form = byId('validateEmailForm');
            if(form) {
                var inputs = form.getElementsByTagName('input');
                if(inputs[0]) {
                    inputs[0].focus();
                }
            }
        }, rawText : true});
    },

    resendValidateEmail : function(triggerEl) {
        if(!GOOM.User.isLoggedIn) {
            GOOM.Context.save(GOOM.Navigation.load, ['/home']);
            GOOM.user.Auth.show();
            return;
        }
        GOOM.util.Get('/user/api/resend-confirmation-mail', function(r) {
            if(r.success) {
                GOOM.site.Note.show('normal', r.message);
                return;
            }
            GOOM.util.FatalMsg({message : r.message});
        })
        GOOM.util.DialogMgr.close();
    }
};
/* $Id$ */

createNS('GOOM.user.Dashboard');

GOOM.user.Dashboard = function() {
    var curObjId = false,
        curObjHTML = false,
        titleTimeout = null,
        loadingSuccessful = false,
        titleRequest = null,
        buildTemplate = function (m) {
            var t = {radioImg     : '<img src="%{radioImgSrc}" onerror="defaultImg(this, \'/img/radio_t2.jpg\')" alt="icon" class="thumb t2" />',
                     radioWrapper : '<div class="radioCreatedWrapper">%{nowPlaying} %{songName} %{artistName}</div>',
                     nowPlaying   : '<h5 class="radioCreatedName">%{nowPlayingLabel}</h5>',
                     songName     : '<h5 class="radioCreatedSlogan">%{songName}</h5>',
                     artistName   : '<div class="followers"><span>%{artistName}</span></div>'};

                var nowPlaying   = replace(t.nowPlaying, {'nowPlayingLabel' : _('NOW_PLAYING')}),
                    songName     = replace(t.songName, {'songName' : m.songTitle.slice(0,30)}),
                    artistName   = replace(t.artistName, {'artistName' : m.artist.slice(0,30)}),
                    radioImg     = replace(t.radioImg, {'radioImgSrc' : getASSET() + '/mediaAsset/' + m.siteId + '_' + m.coverObjectId + '_' + m.coverMediaId + '/t2'}),
                    radioWrapper = replace(t.radioWrapper, {'nowPlaying' : nowPlaying,
                                                            'songName'   : songName,
                                                            'artistName' : artistName});
            return radioImg + radioWrapper;
        },
        update = function (result) {
            byId('rowsContainer').innerHTML = result;
        };

    return {
        selectTab : function(id) {
            var Get   = GOOM.util.Request,
                _tabs = byId('radioCreatedFollowingTabs').getElementsByTagName('li');

            for (var i = 0, len = _tabs.length; i < len; ++i) {
                if (_tabs[i].id == id) {
                    _tabs[i].className = 'active';
                    Get('GET', '/user/list/' + id, { success : update, rawText : true });
                } else {
                    _tabs[i].className = '';
                }
            }
        },

        changePage : function(id, offset) {
            GOOM.util.Request('GET', '/user/list/' + id + '?offset=' + offset, { success : update, rawText : true });
        },

        loadTitle : function(el, radioId, siteId, e) {
            stopEvent(e);
            clearTimeout(titleTimeout);
            if(curObjId != el.id) {

                if(curObjId && curObjHTML) {
                    var curObj = byId(curObjId);
                    if (curObj) {
                        removeClass(curObj, 'radioCreatedHover');
                        if(loadingSuccessful) {
                            curObj.innerHTML = curObjHTML;
                        }
                    }
                }

                curObjId = el.id;
                curObjHTML = el.innerHTML;
                addClass(el, 'radioCreatedHover');

                var now = new Date(),
                    uri = '/radio/list/whatson?radioId=' + radioId + '&nocache=' + now.getTime() + '&timezone=' + -now.getTimezoneOffset();

                if(titleRequest) {
                    titleRequest.abort();
                }
                titleRequest = new GOOM.util.Request('GET', uri, {success : function(r) {
                    if (!r.success) {
                        return;
                    }

                    if(r.results[0] && r.results[0][0]) {
                        var m = r.results[0][0];
                        if(m) {
                            el.innerHTML = buildTemplate({songTitle     : m.title,
                                                          artist        : m.artist,
                                                          mediaId       : m.mediaId,
                                                          objectId      : m.objectId,
                                                          coverMediaId  : m.coverMediaId,
                                                          coverObjectId : m.coverObjectId,
                                                          siteId        : siteId});
                            loadingSuccessful = true;
                        }
                    } else {
                        loadingSuccessful = false;
                    }
                }}, 2500);
            }
        },

        unloadTitle : function(e) {
            stopEvent(e);
            titleTimeout = setTimeout(function() {
                if(curObjId && curObjHTML) {
                    var curObj = byId(curObjId);
                    if(curObj) {
                        removeClass(curObj, 'radioCreatedHover');
                        if(loadingSuccessful) {
                            curObj.innerHTML = curObjHTML;
                        }
                    }
                }
                curObjId = null;
                curObjHTML = '';
            }, 250);
        }
    }
}()
createNS('GOOM.radio.Utils');

GOOM.radio.WhatsOn = {
    url : '/radio/list/whatson?radioId=%{radioId}',
    template :{ 
        radio    : ['<div class="nowPlayinDesc">%{description}</div><div class="span-3 nowTitle"><p class="nowPlayingFirstArtist">%{artist}</p><a href="javascript:void(0);" onclick="GOOM.ITunes.buySong(\'%{title_s}\',\'%{artist}\'); return false;" style="%{buy_style}"><img src="/img/itunesbadge.gif" border="0"></img></a><span id="radio_nowplaying">%{title}</span></div>',
                    '<div class="span-3 nextTitle"><p class="nowPlayingSecondArtist">%{artist}</p></div>',
                    '<div class="span-3 nextTitle"><p class="nowPlayingThirdArtist">%{artist}</p></div>',
                    '<div class="span-3 nextTitle"><p class="nowPlayingFourthArtist">%{artist}</p></div>']
    },
    templateRequest :{ 
        radio    : ['<div class="nowPlayinDesc">%{description}<a href="%{reqUrl}"  target="_blank"></a></div><div class="span-3 nowTitle"><p class="nowPlayingFirstArtist">%{artist}</p><a href="javascript:void(0);" onclick="GOOM.ITunes.buySong(\'%{title_s}\',\'%{artist}\'); return false;" style="%{buy_style}"><img src="/img/itunesbadge.gif" border="0"></img></a><span id="radio_nowplaying">%{title}</span></div>',
                    '<div class="span-3 nextTitle"><p class="nowPlayingSecondArtist">%{artist}</p></div>',
                    '<div class="span-3 nextTitle"><p class="nowPlayingThirdArtist">%{artist}</p></div>',
                    '<div class="span-3 nextTitle"><p class="nowPlayingFourthArtist">%{artist}</p></div>']
    },
    
    start : function(type, radioIds, elementsIds) {
        this.elements = elementsIds;
        this.radioIds = radioIds;
        this.type = type;
        clearTimeout(this.count);
        this.count=setTimeout(function() { GOOM.radio.WhatsOn.run() }, 500);
    },
    
    run : function(){
        var me  = GOOM.radio.WhatsOn,
            now = new Date(),
            tz  = -now.getTimezoneOffset();
        //GOOM.util.Request('GET' , replace(me.url, {radioId : me.radioIds.join(',')}) + '&nocache=' + now.getTime() + '&timezone=' + encodeURIComponent(tz), { success : me.update}, 10000);
        me.update();
    },

   forcerun : function() {
        var me  = GOOM.radio.WhatsOn;
        clearTimeout(me.count);
        me.count=setTimeout(function() { me.run() }, 500);
    },

    stop : function() {
        clearTimeout(this.count);
    },
    
    update : function(r) {
    	var newInfo = [];
    	if(GOOM.Audio.isPlaying && GOOM.Audio.currentRadioObj.id==window.pageObj.id){
    		var newInfo = GOOM.Audio.flashAudioObj.comingUp(6);
    	}
    	
    	var me = GOOM.radio.WhatsOn, i, q, el, html, divs;
        
        if(me.type == 'radio') {
        	var meta_radio=newInfo[0]; 
        	for(i = 0; i < me.elements.length; i++) {
                 el = byId(me.elements[i]);
                 if(!el) {
                     continue;
                 }
                 html = [];
                 k=0;
                 for(q = 0; q < newInfo.length; q++) {
                	 if(!newInfo[q] || (newInfo[q].type != 'SONG' && newInfo[q].type != 'PRIVATEUGC')) {
                		 continue;
                     }
                	 if(newInfo[q].artist.length>0 && k<me.template.radio.length){
 	                    if(k == 0) {
                       	  var song_title=shortenerNoEscape(newInfo[q].title, 100);                              
 	                      var song_title_iTunes=song_title.replace(/'/,'\\\'');
 	                      if(window.pageObj.songRequest == '1'){
 	                    	 html.push(replace(me.templateRequest.radio[k], {description : ((meta_radio.artist!=newInfo[q].artist) ?  _('WHATSON_COMINGUP') : _('NOW_PLAYING') ), reqUrl : window.pageObj.songRequestUrl , artist : shortenerNoEscape(newInfo[q].artist, 40), title:  song_title, title_s:  song_title_iTunes, buy_style: (GOOM.ITunes.isActive()?'':'display:none')}));
 	                      }else{
 	                    	 html.push(replace(me.template.radio[k], {description : ((meta_radio.artist!=newInfo[q].artist) ?  _('WHATSON_COMINGUP') : _('NOW_PLAYING') ), artist : shortenerNoEscape(newInfo[q].artist, 40), title:  song_title, title_s:  song_title_iTunes, buy_style: (GOOM.ITunes.isActive()?'':'display:none')}));
 	                      }
 	                      
 	                    } else {
 	                      html.push(replace(me.template.radio[k], {artist : shortenerNoEscape(newInfo[q].artist, 40), title:  shortenerNoEscape(newInfo[q].title, 100)}));
 	                    }
 	                    k++;
                     }
                 }
                 if(html.length) {
                     el.innerHTML = html.join('');
                 }
            }
        } else if(me.type == 'radiocase') {
            for(i = 0; i < me.elements.length; i++) {
                el = byId(me.elements[i]);
                if(!el) {
                    continue;
                }
                if(!r.results[i]) {
                    continue;
                }
                divs = el.getElementsByTagName('div');
                if(divs[0]) {
                    setText(divs[0], shortenerNoEscape(r.results[i][0].title, 20));
                }
                if(divs[1]) {
                    setText(divs[1], shortenerNoEscape(r.results[i][0].artist, 20));
                }
            }
        }
        clearTimeout(me.count);
        me.count = setTimeout(GOOM.radio.WhatsOn.run, 15000);
    }
};

GOOM.Navigation.Events.onPageLeave.subscribe(function() {
        GOOM.radio.WhatsOn.stop();
})

GOOM.Audio.Events.onNextSong.subscribe(function() {
    if(typeof(GOOM.radio.WhatsOn)!='undefined' && GOOM.radio.WhatsOn.radioIds.length>0) {
        GOOM.radio.WhatsOn.forcerun();
    }
});/* $Id: TinyBrowser.js 6940 2009-08-06 16:52:57Z Claudio Beatrice $ */

createNS('GOOM.radio');

GOOM.radio.TinyBrowser = function() {
    var Get = GOOM.util.Get,
        _store = { 'latest' : [], 'similar' : [], 'popular' : []},
        _page = { 'latest' : 0, 'similar' : 0, 'popular' : 0},
        _selected = { 'latest' : 0, 'similar' : 0, 'popular' : 0},
        _selectedTab = 'latest',
        _followIndex = false,
        _uri = '/radio/list/%{list}?limit=4&offset=%{offset}&radioId=%{radioId}';
    
    var displayRadio = function(radioObj, tabId) {
        byId('tinyBrowserContent').style.visibility = 'visible';
        if(!radioObj) {
            byId('tinyBrowserContent').style.visibility = 'hidden';
            return;
        }
        
        var img = byId('tinyBrowserThumbnail').getElementsByTagName('img')[0];
        if(img) {
            GOOM.UI.thumbnailDOM(img, 'radio', radioObj, 't7');
        }
        var imgLnk = byId('tinyBrowserThumbnail').getElementsByTagName('a')[0];
        if(imgLnk) {
            imgLnk.title = radioObj.name;
            imgLnk.href = '/radio/' + radioObj.id;
        }
        
        var titleEl = byId('tinyBrowserName');
        titleEl.href = '/radio/' + radioObj.id;
        titleEl.title = radioObj.name;
        setText(titleEl, shortener(radioObj.name, 20));
        setText(byId('tinyBrowserSlogan'), radioObj.slogan);
        setText(byId('tinyBrowserFollowers'), radioObj.followers);
        
        if(_followIndex) {
            GOOM.user.Follow.removeFollowBtn(_followIndex);
        }
        
        _followIndex = GOOM.user.Follow.createFollowBtn(byId('tinyBrowserFollowBtn'), radioObj.slug, function(radioObj, isAdd){
            var names = ['latest', 'similar', 'popular'];
            for(var i = 0; i < names.length; i++) {
                var list = _store[names[i]];
                for(var q = 0; len = list.length, q < len; q++) {
                    if(list[q].slug !=  radioObj.slug) {
                        continue;
                    }
                    _store[names[i]][q].followers = radioObj.followers;
                }
            }
        });
    };
    
    var displaySliderEntries = function(radioList) {
        var entriesHTML = [];
        var template = '<li class="thumbnail" ><a title="%{name}" onclick="GOOM.radio.TinyBrowser.select(this, %{index}); return false;" href="/radio/%{id}"><img class="t3" alt="%{name}" onload="this.style.visibility=\'visible\'" onerror="defaultImg(this, \'/img/radio_t3.jpg\')" src="%{thumbnail}" alt="%{name}" /></a></li>';
        for(var i = 0; i < radioList.length; i++) {
            radioList[i].thumbnail = window.getASSET() + '/radio/' + radioList[i].id + '/t3';
            radioList[i].index = i;
            entriesHTML.push(replace(template, radioList[i]));
        }
        byId('tinyBrowserSliderList').innerHTML = entriesHTML.join(' ');
    };
    
    var update = function(result, tabId) {
        if(!result.success) {
            return;
        }
        _store[tabId] = _store[tabId].concat(result.radios);
        if(_selectedTab == tabId) {
            displaySliderEntries(_store[tabId].slice(_page[tabId], 4));
            displayRadio(_store[tabId][_selected[tabId]], tabId);
        }
    };
    
    return {
        selectTab : function(el, id) {
            var me = GOOM.radio.TinyBrowser;
            tabs = byId('tinyBrowserTabs').getElementsByTagName('div');
            for(var i = 0, len = tabs.length; i < len; i++) {
                tabs[i].className = "";
            }
            el.parentNode.className = 'active';
            _selectedTab = id;
            if(_store[id].length) {
                displaySliderEntries(_store[id].slice(_page[id], 4));
                displayRadio(_store[id][_selected[id]]);
                return;
            }
            var radioId = 1;
            if(window.pageObj && window.pageObj.type == "RADIO") {
               radioId = window.pageObj.radioId;
            }    
            var uri = replace(_uri, {list : _selectedTab, offset: _page[_selectedTab], radioId: radioId });
            Get(uri, function(result){ 
                update(result, id)
            });
        },
        
        select : function(el, index) {
            var me = GOOM.radio.TinyBrowser;
            var radioObj = _store[_selectedTab][index];
            _selected[_selectedTab] = parseInt(index, 10);
            if(!radioObj) { 
                var uri = replace(_uri, {list : _selectedTab, offset: _page[_selectedTab] });
                Get(uri, function(result){ 
                    update(result, _selectedTab)
                });
                return;
            }
            displayRadio(radioObj);
        },
        
        slideLeft : function() {
            
        },
        
        sliderRight : function() {
            
        }
    }
}()

createNS('GOOM.radio.Utils');

GOOM.radio.Utils = {
    uri : {image : '/radio/api/image-upload', overlayRadio : '/radio/overlay/form'},
    dialogCreate : new GOOM.util.Dialog({isModal : true}),
    comingSoonDialog : new GOOM.util.Dialog({isModal : false, width: 250}),
    defaultRadioId : 0,
    isStatusSubscribe : {},
    checkingRadioName : false,
    dialogPending : false,
    
    resetMostPlayed: function(){
        (function($) {
        	$._spritely = {
        		// shared methods and variables used by spritely plugin
        		animate: function(options) {
        			var el = $(options.el);
        			var el_id = el.attr('id');
        			options = $.extend(options, $._spritely.instances[el_id] || {});
        			if (options.play_frames && !$._spritely.instances[el_id]['remaining_frames']) {
        				$._spritely.instances[el_id]['remaining_frames'] = options.play_frames + 1;
        			}
        			if (options.type == 'sprite' && options.fps) {
        				var frames;
        				var animate = function(el) {
        					var w = options.width, h = options.height;
        					if (!frames) {
        						frames = [];
        						total = 0
        						for (var i = 0; i < options.no_of_frames; i ++) {
        							frames[frames.length] = (0 - total);
        							total += w;
        						}
        					}
        					if ($._spritely.instances[el_id]['current_frame'] >= frames.length - 1) {
        						$._spritely.instances[el_id]['current_frame'] = 0;
        					} else {
        						$._spritely.instances[el_id]['current_frame'] = $._spritely.instances[el_id]['current_frame'] + 1;
        					}
        					var yPos = $._spritely.getBgY(el);
        					el.css('background-position', frames[$._spritely.instances[el_id]['current_frame']] + 'px ' + yPos);
        					if (options.bounce && options.bounce[0] > 0 && options.bounce[1] > 0) {
        						var ud = options.bounce[0]; // up-down
        						var lr = options.bounce[1]; // left-right
        						var ms = options.bounce[2]; // milliseconds
        						el
        							.animate({top: '+=' + ud + 'px', left: '-=' + lr + 'px'}, ms)
        							.animate({top: '-=' + ud + 'px', left: '+=' + lr + 'px'}, ms);
        					}
        				}
        				if ($._spritely.instances[el_id]['remaining_frames'] && $._spritely.instances[el_id]['remaining_frames'] > 0) {
        					$._spritely.instances[el_id]['remaining_frames'] --;
        					if ($._spritely.instances[el_id]['remaining_frames'] == 0) {
        						$._spritely.instances[el_id]['remaining_frames'] = -1;
        						delete $._spritely.instances[el_id]['remaining_frames'];
        						return;
        					} else {
        						animate(el);
        					}
        				} else if ($._spritely.instances[el_id]['remaining_frames'] != -1) {
        					animate(el);
        				}
        			} else if (options.type == 'pan') {
        				if (!$._spritely.instances[el_id]['_stopped']) {
        					if (options.dir == 'left') { 
        						$._spritely.instances[el_id]['l'] = ($._spritely.instances[el_id]['l'] - (options.speed || 1)) || 0;
        					} else {
        						$._spritely.instances[el_id]['l'] = ($._spritely.instances[el_id]['l'] + (options.speed || 1)) || 0;
        					}
        					var bp_top = $._spritely.getBgY(el);
        					$(el).css('background-position', $._spritely.instances[el_id]['l'] + 'px ' + bp_top);
        				}
        			}
        			$._spritely.instances[el_id]['options'] = options;
        			window.setTimeout(function() {
        				$._spritely.animate(options);
        			}, parseInt(1000 / options.fps));
        		},
        		randomIntBetween: function(lower, higher) {
        			return parseInt(rand_no = Math.floor((higher - (lower - 1)) * Math.random()) + lower);
        		},
        		getBgY: function(el) {
        			if ($.browser.msie) {
        				// fixme - the background-position property does not work
        				// correctly in IE so we have to hack it here... Not ideal
        				// especially as $.browser is depricated
        				var bgY = $(el).css('background-position-y') || '0';
        			} else {
        				var bgY = ($(el).css('background-position') || ' ').split(' ')[1];
        			}
        			return bgY;
        		},
        		getBgX: function(el) {
        			if ($.browser.msie) {
        				// see note, above
        				var bgX = $(el).css('background-position-x') || '0';
        			} else {
        				var bgX = ($(el).css('background-position') || ' ').split(' ')[0];
        			}
        			return bgX;
        		},
        		get_rel_pos: function(pos, w) {
        			// return the position of an item relative to a background 
        			// image of width given by w
        			var r = pos;
        			if (pos < 0) {
        				while (r < 0) {
        					r += w;
        				}
        			} else {
        				while (r > w) {
        					r -= w;
        				}
        			}
        			return r;
        		}
        	};
        	$.fn.extend({
        		spritely: function(options) {
        			var options = $.extend({
        				type: 'sprite',
        				do_once: false,
        				width: null,
        				height: null,
        				fps: 12,
        				no_of_frames: 2,
        				stop_after: null
        			}, options || {});
        			var el_id = $(this).attr('id');
        			if (!$._spritely.instances) {
        				$._spritely.instances = {};
        			}
        			if (!$._spritely.instances[el_id]) {
        				$._spritely.instances[el_id] = {current_frame: -1};
        			}
        			$._spritely.instances[el_id]['type'] = options.type;
        			$._spritely.instances[el_id]['depth'] = options.depth;
        			options.el = this;
        			options.width = options.width || $(this).width() || 100;
        			options.height = options.height || $(this).height() || 100;
        			var get_rate = function() {
                        return parseInt(1000 / options.fps);
                    }
                    if (!options.do_once) {
        				window.setTimeout(function() {
        					$._spritely.animate(options);
        				}, get_rate(options.fps));
        			} else {
        				$._spritely.animate(options);
        			}
        			return this; // so we can chain events
        		},
        		sprite: function(options) {
        			var options = $.extend({
        				type: 'sprite',
        				bounce: [0, 0, 1000] // up-down, left-right, milliseconds
        			}, options || {});
        			return $(this).spritely(options);
        		},
        		pan: function(options) {
        			var options = $.extend({
        				type: 'pan',
        				dir: 'left',
        				continuous: true,
        				speed: 1 // 1 pixel per frame
        			}, options || {});
        			return $(this).spritely(options);
        		},
        		flyToTap: function(options) {
        			var options = $.extend({
        				el_to_move: null,
        				type: 'moveToTap',
        				ms: 1000, // milliseconds
        				do_once: true
        			}, options || {});
        			if (options.el_to_move) {
        				$(options.el_to_move).active();
        			}
        			if ($._spritely.activeSprite) {
        				if (window.Touch) { // iphone method see http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone/9 or http://www.nimblekit.com/tutorials.html for clues...
        					$(this)[0].ontouchstart = function(e) {
        						var el_to_move = $._spritely.activeSprite;
        						var touch = e.touches[0];
        						var t = touch.pageY - (el_to_move.height() / 2);
        						var l = touch.pageX - (el_to_move.width() / 2);
        						el_to_move.animate({
        							top: t + 'px',
        							left: l + 'px'
        						}, 1000);
        					};
        				} else {
        					$(this).click(function(e) {
        						var el_to_move = $._spritely.activeSprite;
        						$(el_to_move).stop(true);
        						var w = el_to_move.width();
        						var h = el_to_move.height();
        						var l = e.pageX - (w / 2);
        						var t = e.pageY - (h / 2);
        						el_to_move.animate({
        							top: t + 'px',
        							left: l + 'px'
        						}, 1000);
        					});
        				}
        			}
        			return this;
        		},
        		isDraggable: function(options) {
        			if (!$(this).draggable) {
        				alert('To use the isDraggable method you need to load jquery-ui.js');
        				return this;
        			}
        			var options = $.extend({
        				type: 'isDraggable',
        				start: null,
        				stop: null,
        				drag: null
        			}, options || {});
        			var el_id = $(this).attr('id');
        			$._spritely.instances[el_id].isDraggableOptions = options;
        			$(this).draggable({
        				start: function() {
        					var el_id = $(this).attr('id');
        					$._spritely.instances[el_id].stop_random = true;
        					$(this).stop(true);
        					if ($._spritely.instances[el_id].isDraggableOptions.start) {
        						$._spritely.instances[el_id].isDraggableOptions.start(this);
        					}
        				},
        				drag: options.drag,
        				stop: function() {
        					var el_id = $(this).attr('id');
        					$._spritely.instances[el_id].stop_random = false;
        					if ($._spritely.instances[el_id].isDraggableOptions.stop) {
        						$._spritely.instances[el_id].isDraggableOptions.stop(this);
        					}
        				}
        			});
        			return this;
        		},
        		active: function() {
        			// the active sprite
        			$._spritely.activeSprite = this;
        			return this;
        		},
        		activeOnClick: function() {
        			// make this the active script if clicked...
        			var el = $(this);
        			if (window.Touch) { // iphone method see http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone/9 or http://www.nimblekit.com/tutorials.html for clues...
        				el[0].ontouchstart = function(e) {
        					$._spritely.activeSprite = el;
        				};
        			} else {
        				el.click(function(e) {
        					$._spritely.activeSprite = el;
        				});
        			}
        			return this;
        		},
        		spRandom: function(options) {
        			var options = $.extend({
        				top: 50,
        				left: 50,
        				right: 290,
        				bottom: 320,
        				speed: 4000,
        				pause: 0
        			}, options || {});
        			var el_id = $(this).attr('id');
        			if (!$._spritely.instances[el_id].stop_random) {
        				var r = $._spritely.randomIntBetween;
        				var t = r(options.top, options.bottom);
        				var l = r(options.left, options.right);
        				$('#' + el_id).animate({
        					top: t + 'px', 
        					left: l + 'px'
        				}, options.speed)
        			}
        			window.setTimeout(function() {
        				$('#' + el_id).spRandom(options);
        			}, options.speed + options.pause)
        			return this;
        		},
        		makeAbsolute: function() {
        			// remove an element from its current position in the DOM and
        			// position it absolutely, appended to the body tag.
        			return this.each(function() {
        				var el = $(this);
        				var pos = el.position();
        				el.css({position: "absolute", marginLeft: 0, marginTop: 0, top: pos.top, left: pos.left })
        					.remove()
        					.appendTo("body");
        			});
        		
        		},
        		spSet: function(prop_name, prop_value) {
        			var el_id = $(this).attr('id');
        			$._spritely.instances[el_id][prop_name] = prop_value;
        			return this;
        		},
        		spGet: function(prop_name, prop_value) {
        			var el_id = $(this).attr('id');
        			return $._spritely.instances[el_id][prop_name];
        		},
        		spStop: function(bool) {
        			$(this).each(function() {
        				var el_id = $(this).attr('id');
        				$._spritely.instances[el_id]['_last_fps'] = $(this).spGet('fps');
        				$._spritely.instances[el_id]['_stopped'] = true;
        				$._spritely.instances[el_id]['_stopped_f1'] = bool;
        				if ($._spritely.instances[el_id]['type'] == 'sprite') {
        					$(this).spSet('fps', 0);
        				}
        				if (bool) {
        					// set background image position to 0
        					var bp_top = $._spritely.getBgY($(this));
        					$(this).css('background-position', '0 ' + bp_top);
        				}
        			});
        			return this;		
        		},
        		spStart: function() {
        			$(this).each(function() {
        				var el_id = $(this).attr('id');
        				var fps = $._spritely.instances[el_id]['_last_fps'] || 12;
        				$._spritely.instances[el_id]['_stopped'] = false;
        				if ($._spritely.instances[el_id]['type'] == 'sprite') {
        					$(this).spSet('fps', fps);
        				}
        			});
        			return this;		
        		},
        		spToggle: function() {
        			var el_id = $(this).attr('id');
        			var stopped = $._spritely.instances[el_id]['_stopped'] || false;
        			var stopped_f1 = $._spritely.instances[el_id]['_stopped_f1'] || false;
        			if (stopped) {
        				$(this).spStart();
        			} else {
        				$(this).spStop(stopped_f1);
        			}
        			return this;		
        		},
        		fps: function(fps) {
        			$(this).each(function() {
        				$(this).spSet('fps', fps);
        			});
        			return this;
        		},
        		spSpeed: function(speed) {
        			$(this).each(function() {
        				$(this).spSet('speed', speed);
        			});
        			return this;
        		},
        		spRelSpeed: function(speed) {
        			$(this).each(function() {
        				var rel_depth = $(this).spGet('depth') / 100;
        				$(this).spSet('speed', speed * rel_depth);
        			});
        			return this;
        		},
        		spChangeDir: function(dir) {
        			$(this).each(function() {
        				$(this).spSet('dir', dir);
        			});
        			return this;
        		},
        		spState: function(n) {
        			$(this).each(function() {
        				// change state of a sprite, where state is the vertical
        				// position of the background image (e.g. frames row)
        				var yPos = ((n - 1) * $(this).height()) + 'px';
        				var xPos = $._spritely.getBgX($(this));
        				var bp = xPos + ' -' + yPos;
        				$(this).css('background-position', bp);
        			});
        			return this;
        		},
        		lockTo: function(el, options) {
        			$(this).each(function() {
        				var el_id = $(this).attr('id');
        				$._spritely.instances[el_id]['locked_el'] = $(this);
        				$._spritely.instances[el_id]['lock_to'] = $(el);
        				$._spritely.instances[el_id]['lock_to_options'] = options;
        				window.setInterval(function() {
        					if ($._spritely.instances[el_id]['lock_to']) {
        						var locked_el = $._spritely.instances[el_id]['locked_el'];
        						var locked_to_el = $._spritely.instances[el_id]['lock_to'];
        						var locked_to_options = $._spritely.instances[el_id]['lock_to_options'];
        						var locked_to_el_w = locked_to_options.bg_img_width;
        						var locked_to_el_h = locked_to_el.height();
        						var locked_to_el_y = $._spritely.getBgY(locked_to_el);
        						var locked_to_el_x = $._spritely.getBgX(locked_to_el);
        						var el_l = (parseInt(locked_to_el_x) + parseInt(locked_to_options['left']));
        						var el_t = (parseInt(locked_to_el_y) + parseInt(locked_to_options['top']));
        						el_l = $._spritely.get_rel_pos(el_l, locked_to_el_w);
        						$(locked_el).css({
        							'top': el_t + 'px',
        							'left': el_l + 'px'
        						});
        					}
        				}, options.interval || 20);
        			});
        			return this;
        		}
        	})
        })(jQuery);
        // Stop IE6 re-loading background images continuously
        try {
          document.execCommand("BackgroundImageCache", false, true);
        } catch(err) {} 
    },

    showOverlay : function(uid, cloneRadioId, genreId){
        if(!GOOM.User.checkStatus(function() {GOOM.radio.Utils.showOverlay(uid, cloneRadioId);})) {
            return;
        }

        var displayDialog = function() {
            var args = '?';
                if(uid) {
                    if(args != '?') {
                        args += '&';
                    }
                    args += 'uid=' + uid;
                }
                if(cloneRadioId) {
                    if(args != '?') {
                        args += '&';
                    }
                    args += 'cloneRadioId=' + cloneRadioId;
                }
                if(genreId) {
                    if(args != '?') {
                        args += '&';
                    }
                    args += 'genreId=' + genreId;
                }

                GOOM.util.Form.userHasLogo    = false;
                GOOM.util.Form.userHasProfile = false;
                GOOM.util.Form.previewImagesRequestDone = false;

                GOOM.util.Request('GET', GOOM.radio.Utils.uri.overlayRadio + args,
                        {success : function callback(result) {
                                        GOOM.radio.Utils.dialogCreate.setHTML(result);
                                        GOOM.radio.Utils.dialogCreate.open();
                        },
                        rawText : true});

                GOOM.radio.Utils.dialogCreate.loading();
                GOOM.radio.Utils.dialogCreate.open();
        };

        if(!uid || cloneRadioId) {
            GOOM.site.Util.isServiceAvailable(function() {
                if (GOOM.site.Util.SNA) {
                    GOOM.site.Util.showSNA();
                } else {
                    displayDialog();
                }
            });
        } else {
            displayDialog();
        }
    },

    showShoutOverlay : function(triggerEl, alignEl){
        var body = replace('<h2 class="comingSoonTitle">%{soon}</h2><p class="comingSoonTxt">%{text}</p>', {
            soon : _('COMINGSOON_COMINGSOON'), text : _('COMINGSOON_TEXT'), title : _('COMINGSOON_TITLE')} );
        GOOM.radio.Utils.comingSoonDialog.setHTML(body);
        GOOM.radio.Utils.comingSoonDialog.open(triggerEl, alignEl);
    },

    showAddShowOverlay : function(triggerEl, alignEl){
        var body = replace('<h2 class="comingSoonTitle">%{soon}</h2><p class="comingSoonTxt">%{text}</p>', {
            soon : _('COMINGSOON_COMINGSOON'), text : _('COMINGSOON_ADDSHOW_TEXT'), title : _('COMINGSOON_TITLE')} );
        GOOM.radio.Utils.comingSoonDialog.setHTML(body);
        GOOM.radio.Utils.comingSoonDialog.open(triggerEl, alignEl);
    },

    checkRadioName : function(submitEl, el, radioUid) {
       var str = el.value,
           tmpEl = el,
           uri = '/radio/api/check?name=' + str,
           callback = function(r) {
               if(!r.success) {
                   return;
               }
               while (tmpEl.parentNode && !tmpEl.parentNode.getElementsByTagName('span')[0]) {
                   tmpEl = tmpEl.parentNode;
               }
               setFormMsg(tmpEl, '');
               removeClass(tmpEl, 'loadingResult');
               var span = tmpEl.parentNode.getElementsByTagName('span')[0];
               if (r.exists) {
                   addClass(tmpEl, 'invalidInput');
                   if(span) {
                       span.style.display = 'block';
                       span.className = 'unAvailable';
                       setText(span, _('API_RADIO_ALREADY_EXISTING'));
                   }
                   disableFields([submitEl]);
               } else {
                   removeClass(tmpEl, 'invalidInput');
                   if(span) {
                       span.style.display = 'none';
                       span.className = '';
                       setText(span, '');
                   }
                   enableFields([submitEl]);
               }
           },
           checkFn  = function() {
               if(str.length < 3) {
                   while (tmpEl.parentNode && !tmpEl.parentNode.getElementsByTagName('span')[0]) {
                       tmpEl = tmpEl.parentNode;
                   }
                   var span = tmpEl.parentNode.getElementsByTagName('span')[0];
                   addClass(tmpEl, 'invalidInput');
                   if(span) {
                       span.style.display = 'block';
                       span.className = 'unAvailable';
                       setText(span, _('API_RADIO_NAME_NOT_VALID'));
                       disableFields([submitEl]);
                   }
                   return;
               }
               enableFields([submitEl]);
               addClass(el, 'loadingResult');
               if(radioUid) {
                   uri += '&uid=' + radioUid;
               }
               GOOM.util.Request('GET', uri, {success : callback});
           };

       if(GOOM.radio.Utils.checkingRadioName) {
           clearTimeout(GOOM.radio.Utils.checkingRadioName);
       }

       GOOM.radio.Utils.checkingRadioName = setTimeout(function() {checkFn()}, 500);
    },

    submitRadio : function(formEl) {
        if(!GOOM.User.checkStatus(function() {GOOM.radio.Utils.submitRadio(formEl);})) {
            return;
        }

        disableFields(formEl.elements);
        if(formEl.editCreateRadioUserTZOffset) {
            formEl.editCreateRadioUserTZOffset.value = -(new Date()).getTimezoneOffset();
        }

        var tagEl = formEl.elements.editCreateRadioTags;
        if(tagEl.title == tagEl.value) {
            tagEl.value = '';
        }
        GOOM.util.FormRequest(formEl, {
            success : function(r) {
                if(!handleUserStatus(r)) {
                    return;
                }
                enableFields(formEl.elements);
                if(r.success) {
                    GOOM.UserRadios.update();
                    GOOM.util.DialogMgr.close();
                    GOOM.Navigation.load('/radio/' + r.radioSlug);
                } else {
                    if(r.errors) {
                        handleFormResults(formEl, r, true);
                    } else {
                        GOOM.util.FatalMsg({message : r.message});
                    }
                }
            }
        });
    },

    updateImage : function(el, previewElId, previewElFilter, type , radioId) {
        var msgField = byId(previewElId == 'profilePreview' ? 'profileGuidance' : 'logoGuidance'),
            form = byId('editCreateRadioForm'),
            options = [{name : 'type', value : type}],
            previewElStyle = getASSET() + '/tmp/%{filename}/%{filter}',
            callback = function(result) {
                var inputEl = byId(el.id + 'HiddenInput');
                byId(previewElId + 'Loading').style.display = 'none';
                if(!result.success) {
                   var msgField = byId(previewElId == 'profilePreview' ? 'profileGuidance' : 'logoGuidance');
                   if(inputEl) {
                       addClass(inputEl, 'imageFail');
                   }
                   if(msgField) {
                       msgField.innerHTML = result.message;
                   }
                   return;
                }
                if(previewElId) {
                    var previewEl = byId(previewElId);
                    if(previewEl) {
                        previewEl.src = replace(previewElStyle, {filename : result.filename, filter : previewElFilter});
                    }
                    if(inputEl) {
                        removeClass(inputEl, 'imageFail');
                    }
                    byId(el.id + 'Uid').value = result.filename; //makes sure that we store the tmp key in form, when pre create
                    if (previewElId == 'profilePreview') {
                        GOOM.util.Form.userHasProfile = true;
                    } else if (previewElId == 'logoPreview') {
                        GOOM.util.Form.userHasLogo = true;
                    }
                }
            };

        if(!el.value || !form) {
            return;
        }
        byId(previewElId).style.visibility = 'hidden';
        byId(previewElId + 'Loading').style.display = 'inline';

        options.push({name : 'filename', value : el.value});
        if(radioId) {
            options.push({name : 'radioId', value : radioId});
        }

        GOOM.util.FileUpload(el, this.uri.image, callback, options, 'POST');
    },

    toggleForm : function(enableId, disableId) {
        GOOM.site.Util.isServiceAvailable(function() {
            if (GOOM.site.Util.SNA) {
                GOOM.site.Util.showSNA();
            } else {
                byId(enableId).style.display = 'inline';
                byId(disableId).style.display = 'none';
            }
        });
    },

    leave : function(uid, isLast) {
        var uri = '/radio/api/delete?uid=' + uid;
        GOOM.util.Request('POST', uri, {success : function(result) {
            if(!result.success) {
                GOOM.util.FatalMsg({message : result.message});
                return;
            }
            GOOM.Navigation.load('/home');
            GOOM.UserRadios.update();
        }});
    },

    checkStatus : function(uid, fromBtn) {
        if(GOOM.radio.Pending.isActive(uid)) {
            return true;
        } else {
            if(fromBtn) {
                var template = replace('<div class="waitPending"><h2>%{title}</h2><p>%{text}</p><form class="modalForm" method="" onsubmit="GOOM.util.DialogMgr.close(); return false;"><div class="containerSubmit"><input gtype="button" class="clear button primary" value="%{button}" type="submit"></div></form></div>', {
                    title : _('RADIO_STATUS_PENDING_TITLE_SHORT'), button : _('RADIO_STATUS_PENDING_OK'), text : _('RADIO_STATUS_PENDING_BODY_SHORT')});
            } else {
                template = replace('<div class="waitPending"><h2>%{title}</h2><p class="noworries">%{meantime}</p><p><a href="#" title="%{link1}" onclick="GOOM.blog.Editor.showPost(\'formContainer\', [\'writePost\', \'sortPager\'], [\'formContainer\']); GOOM.util.DialogMgr.close(); return false;">%{link1title}</a><br />%{link1txt}</p><p><a href="#" title="%{link3}" onclick="GOOM.util.DialogMgr.close(); GOOM.user.Share.showDialog(\'radio\', window.pageObj); return false;">%{link3title}</a><br />%{link3txt}</p><p>%{dashboard}</p><p><div class="progressBar"><div id="progress"></div></div></p><form class="modalForm" method="" onsubmit="GOOM.util.DialogMgr.close(); return false;"><fieldset><legend></legend><div class="containerSubmit"><input gtype="button" class="clear button primary" value="%{button}" type="submit"></div></fieldset></form></div>', {
                    cancelBtn : _('LABEL_CLOSE'), text : _('DIALOG_RADIO_PENDING_TEXT'), title : _('RADIO_STATUS_TEMPLATE_TITLE'), meantime : _('RADIO_STATUS_TEMPLATE_MEANTIME'), link1 : _('RADIO_STATUS_TEMPLATE_LINK1'), link1title : _('RADIO_STATUS_TEMPLATE_LINK1TITLE'), link1txt : _('RADIO_STATUS_TEMPLATE_LINK1TXT'), link3 : _('RADIO_STATUS_TEMPLATE_LINK3'), link3title : _('RADIO_STATUS_TEMPLATE_LINK3TITLE'), link3txt : _('RADIO_STATUS_TEMPLATE_LINK3TXT'), dashboard : _('RADIO_STATUS_TEMPLATE_DASHBOARD'), button : _('RADIO_STATUS_TEMPLATE_BUTTON')});
            }

            this.dialogPending = new GOOM.util.Dialog({
                isModal : true,
                isNarrow : true,
                closeFn : function() {
                    clearInterval(GOOM.Components.progressBar.barInt);
                    $('#progress').progressbar('destroy');
                }});
            this.dialogPending.setHTML(template);
            this.dialogPending.open();

            if(!GOOM.Components.progressBar) {
                GOOM.Components.progressBar = {
                    barInt : null
                }
            }

            $('#progress').progressbar({value: 0});

            GOOM.Components.progressBar.barInt = setInterval(function() {
                var val = $('#progress').progressbar('option', 'value');
                if(val > 100) val = 0;
                $('#progress').progressbar('option', 'value', val + 1 - Math.min(0.9, val/100));
            }, 25);
        }
        var radioName = window.pageObj.name,
            slug = window.pageObj.slug;

        if (this.pendingEventSub != uid) {
            GOOM.radio.Pending.Events.onChange.subscribe(function(uid, radioId) {
                var me = GOOM.radio.Utils;

                // Close peding dialog
                if (me.dialogPending && me.dialogPending.isOpen()) {
                    me.dialogPending.close();
                    me.dialogPending = false;
                }
                // Populate Most Played list
                me.loadMostPlayed(radioId);
                
                // Notify others
                GOOM.user.Share.notifyRadioIsActive(slug, radioId);
                
                // Display UI note
                GOOM.site.Note.show('normal', replace(_('RADIO_CREATE_SUCCESS'), 
                                    {radioName :  radioName}), true,
                                    [function() {play('radio', radioId);return false;},
                                     function() {GOOM.Navigation.load('/radio/' + slug + '/rotation/songs');
                                                  return false;}]);
            });
            this.pendingEventSub = uid;
        }
        return false;
    },

    loadMostPlayed : function(radioId) 
    {	
    	if (window.pageObj.id != radioId) {
    		return; // The user did navigate away => do nothing
    	}
        GOOM.util.Request('GET', '/components/mostplayedrows/?radioId=' + radioId, 
							{success : function(content) {
									var rowsContainer = byId('rowsContainer');
									if (rowsContainer) {
										rowsContainer.innerHTML = content;
									}
									// else // the user may have navigate away
								},
							failure : function(code, event) {
									var rowsContainer = byId('rowsContainer');
									if (rowsContainer) {
										rowsContainer.innerHTML = "<span style='color:white;font-size:16px;'>"+ _('RADIO_CREATE_MOSTPLAYED_NA') +"</span>";
									}
									// else // the user may have navigate away
								},
							rawText : true // the content received in success case is not json encoded
							});
    },

// BUGGY - see NRG-1801 
//    loadMostPlayed_deprecated : function(uid) {
//        
//        var template = {'odd'   : '<div class="oddRow">%{entryContent}</div>',
//                        'even'  : '<div class="evenRow">%{entryContent}</div>',
//                        'entry' : '<a href="#" onclick="GOOM.PlayItem(this); return false" class="miniPlay" gdata="%{mediaId}"><img src="/img/asset_play.png"/></a><img class="thumb t2" alt="icon" onerror="defaultImg(this, \'/img/radio_t2.jpg\')" src="%{src}" /><div class="mostPlayedWrapper"><h5 class="mostPlayedTitle">%{title}</h5><div class="mostPlayedAlbum"></div><div class="mostPlayedArtist">%{artist}</div></div><div class="clear"></div>'};
//        
//            GOOM.util.Request('GET', '/playlist/list/playlist?radioId=' + window.pageObj.id + '&radioUid=' + window.pageObj.uid + '&limit=5', {success : function(r) {
//                if (!r.success) {
//                    return;
//                }
//                var content = '', entryContent = '', entries = r.results;
//                for (var i = 0, len = entries.length; i < len; i++) {
//                    var e = entries[i],
//                        src = getASSET() + '/mediaAsset/'+ e.siteId + '_' + e.objectId + '_' + e.mediaId +'/t2',
//                        artists = '';
//
//                    for (var j = 0, len2 = e.artists.length; j < len2; j++) {
//                        artists += e.artists[j].name + ', ';
//                    }
//                    entryContent = replace(template.entry, {src : src, mediaId : e.id, title : e.title, artist : artists.substr(0, artists.length - 2)});
//                    if (i % 2) {
//                        content += replace(template.even, {entryContent : entryContent});
//                    } else {
//                        content += replace(template.odd, {entryContent : entryContent});
//                    }
//                }
//                byId('rowsContainer').innerHTML = content;
//            }
//        });
//    },

    //XXX should be submit form NRG-985
    showPreview : function() {
        var themeId = byId('editCreateRadioTheme').value,
            profileUid = byId('editCreateRadioProfileUid').value,
            logoUid = byId('editCreateRadioLogoUid').value,
            title = byId('editCreateRadioName').value,
            slogan = byId('editCreateRadioSlogan').value,
            description = byId('editCreateRadioDescription').value,
            tags = byId('editCreateRadioTags').value,
            radioUid = byId('radioUid'),
            genreId = byId('editCreateRadioGenre'),
            uri = '/radio/theme/preview/' + themeId,
            options = [];

        genreId = (genreId) ? genreId.value : '';

        if(title) {
            options.push('name=' + title);
        }
        if(profileUid) {
            options.push('profileUid=' + profileUid);
        }
        if(logoUid) {
            options.push('logoUid=' + logoUid);
        }
        if(slogan) {
            options.push('slogan=' + slogan);
        }
        if(description) {
            options.push('description=' + description);
        }
        if(tags) {
            options.push('tags=' + tags);
        }
        if(genreId) {
            options.push('genreId=' + genreId);
        }
        if(radioUid && radioUid.value) {
            options.push('uid=' + radioUid.value);
        }

        options.push('hasLogoImage=' + GOOM.util.Form.userHasLogo);
        options.push('hasProfileImage=' + GOOM.util.Form.userHasProfile);

        for(var i = 0, len = options.length; i < len; ++i) {
            if(i == 0) {
                uri += '?' + options[i];
            } else {
                uri += '&' + options[i];
            }
        }
        window.open(uri);
    }

};
/**
 * @package Goom
 * @category GoOmJS
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: Stack.js 27050 2011-03-30 15:27:06Z Carlo Pescetelli $
 */

createNS('GOOM.radio');

/**
 * Holds radios media data.
 * Centralizes data updates and dispatch.
 */
GOOM.radio.Stack = {
    /**
     * The stack options.
     * @var {Object}
     */
    options: {
        serviceUri: '/radio/list/nowplaying', // The service to query for update.
        delay: 15 // The timer delay in seconds
    },

    /**
     * The timer referece
     * @var {Number}
     */
    timer: null,

    /**
     * The request state flag.
     * @var {Bool}
     */
    isRequesting: false,

    /**
     * The registered radio IDs
     * @var {Array}
     */
    radioIds: [],

    /**
     * The radios data map.
     * @var {Object}
     */
    radiosMap: {},

    /**
     * The registered callbacks.
     * @var {Array}
     */
    callbacks: [],

    /**
     * Initializes and run the stack.
     * @method init
     * @param {Object} options Options to override
     * @return {self}
     */
    init: function(options) {
        jQuery.extend(true, this.options, options);
        if (this.timer) {
            clearInterval(this.timer);
        }
        this.timer = setInterval(function() { GOOM.radio.Stack.update(); }, this.options.delay * 1000);
        this.update();
        
        return this;
    },

    /**
     * Add a radioId to update.
     * @method push
     * @param {Number} radioId
     * @return {self}
     */
    push: function(radioId) {
        if (-1 == jQuery.inArray(radioId, this.radioIds)) {
            this.radioIds.push(radioId);
        }
        
        return this;
    },

    /**
     * Returns some radio data.
     * @method get
     * @param {Number} radioId
     * @return {Object} The data
     */
    get: function(radioId) {
        return this.radiosMap[radioId];
    },

    /**
     * Registers a callback to call on update.
     * @method register
     * @param {Function} callback
     * @param {Object} context The callback this object
     * @return {self}
     */
    register: function(callback, context) {
        for (var i = 0; i < this.callbacks.length; i++) {
            if (this.callbacks[i][0] == callback && this.callbacks[i][1] == (context || this)) {
                return this;
            }
        }
        this.callbacks.push([ callback, context || this ]);
        return this;
    },

    /**
     * Notify the callbacks (internal use).
     * @method notify
     * @return {self}
     */
    notify: function() {
        jQuery.each(this.callbacks, function() {
            this[0].apply(this[1], arguments);
        });
    },

    /**
     * Data updater (internal use)
     * @method update
     */
    update: function() {
        if (!this.isRequesting && this.radioIds.length>0) {
            this.isRequesting = true;
            var me = this;
            	 jQuery.ajax({
                     cache: false,
                     success: this.updateSuccess,
                     complete: this.updateComplete,
                     context: GOOM.radio.Stack,
                     data: { radioId: this.radioIds.join(',') },
                     dataType: 'json',
                     type: 'POST',
                     url: this.options.serviceUri
                 });
        }
    },

    /**
     * Update callback on success (internal use).
     * @method updateSuccess
     * @param {Object} data JSON data
     * @param {String} textStatus The request status
     * @param {XmlHttpRequest} xhr
     */
    updateSuccess: function(data, textStatus, xhr) {
        var me = this;
        jQuery.each(data['results'], function(index, item) {
            me.radiosMap[item.id] = item;
        });
        this.notify();
    },

    /**
     * Update callback on complete (internal use)
     * @method updateComplete
     * @param {XmlHttpRequest} xhr
     * @param {String} textStatus
     */
    updateComplete: function(xhr, textStatus) {
        this.isRequesting = false;
    }
};/**
 * @package Goom
 * @category Goom-JS
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: NowPlaying.js 27050 2011-03-30 15:27:06Z Carlo Pescetelli $
 */

createNS('GOOM.radio.Utils');

/**
 * Maintain a list of radios current playing songs.
 * JQuery component.
 */
GOOM.radio.NowPlaying = {
    /**
     * The object options.
     * @var {Object}
     */
    options: {
        // The HTML item template.
        template: '<div class="nowPlayingItemContainer">\n\
                   <img src="/img/nowplaying_hover.png" style="display:none;" alt="" title=""/>\n\
                   <img class="nowPlayingCover"/>\n\
                    <div>\n\
                        <span class="nowPlayingArtist"></span>\n\
                        <span class="nowPlayingSong"></span>\n\
                        <span class="nowPlayingRadio"></span>\n\
                    </div>\n\
                  </div>'
    },

    /**
     * The DOM container.
     * @var JQueryElement
     */
    element: null,

    /**
     * The radio IDs list to query.
     * @var Array
     */
    radios: [],
    radios_info: {},

    /**
     * Initializes the object.
     * @method init
     * @param {JQueryElement} element The DOM container
     * @param {Array} radios The radio IDs to watch
     * @todo Remove the 3425297 filter (It breaks on dev)
     */
    init: function(element, radios, radios_info) {
        //this.reset();
        this.element = jQuery(element);
        this.radios = radios;
        this.radios_info = radios_info;
        jQuery.each(this.radios, function(index, item) {
            GOOM.radio.Stack.push(item);
        });
        GOOM.radio.Stack.register(this.display, this);
        return this.display(1);
    },

    /**
     * Happens when the user clicks on an item container.
     * @method onClick
     * @param {JQueryEvent} e
     */
    onClick: function(e) {
    	GOOM.Audio.playRadio(e.data.radioId);
    },

    /**
     * Happens when the user hovers cursor on an item container.
     * @method onMouseenter
     * @param {JQueryEvent} e
     */
    onMouseenter: function(e) {
    	jQuery('#pcover'+e.data.radioId).show();
    },
    
    /**
     * Happens when the user hovers cursor out of an item container.
     * @method onMouseleave
     * @param {JQueryEvent} e
     */
    onMouseleave: function(e) {
    	jQuery('#pcover'+e.data.radioId).hide();
    },
    
   /**
     * Happens when the user clicks on the radio name
     * @method onSelect
     * @param {JQueryEvent} e
     */
    onSelect: function(e) {
        GOOM.Navigation.load('/radio/'+e.data.radioUrl);
    },


    /**
     * Cleans the object and the registered handlers.
     * @method reset
     */
    reset: function() {
        if (this.element) {
            jQuery('nowPlayingItemContainer', this.element).unbind('click', GOOM.radio.NowPlaying.onClick);
            this.element.empty();
        }
        
        return this;
    },
    
    /**
     * Shows banner when there is no radio 'now playing' info available
     */
    showReplacement: function(){
    	jQuery('.nowPlayingHome').hide();
   		jQuery('#bannerRepl').show();
        
    },
    
    /**
     * Hide banner when there is radio 'now playing' info available
     */
    hideReplacement: function(){
    	jQuery('.nowPlayingHome').show();
    	jQuery('#bannerRepl').hide();
    },

    /**
     * Process the requested data.
     * @method display
     * @return {self}
     */
    display: function(firstLoad) {
        this.reset();
        var me = this;
        var info = null;
        if(firstLoad != 0){
        	info = 1;
        }
        jQuery.each(this.radios, function(index, item) {
            var content = jQuery(me.options.template);
            var data = GOOM.radio.Stack.get(item);
            if (!data) {
                return;
            }
            jQuery('.playbuttoncover', content).attr("id", 'pcover' + index);
            jQuery('.nowPlayingCover', content).attr("src", data.cover + '/t3');
            jQuery('.nowPlayingCover', content).attr("id", 'cover' + index);
            jQuery('#pcover' + index).live('click', {radioId: data.id}, me.onClick);
            jQuery('#cover' + index).bind('mouseenter', {radioId: index}, me.onMouseenter);
            jQuery('#cover' + index).bind('mouseleave', {radioId:index}, me.onMouseleave);
            jQuery('.nowPlayingArtist', content).text(data.artist);
            jQuery('.nowPlayingSong', content).text(data.song);
            jQuery('.nowPlayingRadio', content).text(me.radios_info[data.id].radioName);
            jQuery('.nowPlayingRadio', content).attr("id", 'radioname' + index);
            jQuery('#radioname' + index).live('click', {radioUrl: me.radios_info[data.id].radioUrl}, me.onSelect);
            me.element.append(content);
            info = 1;
        });
        if(info == null){
        	me.showReplacement();
        }else{
        	me.hideReplacement();
        }
        return this;
    }
};

createNS('GOOM.radio');

GOOM.radio.Shows = {
	    /**
	     * The DOM container.
	     * @var {jQuery}
	     */
	    element: null,
	    
	    /**
	     * 
	     */
	    currentShow: 0,
	    
	    /**
	     * delay between shows display 
	     */
	    timeOut: 10000, 

	    /**
	     * The element options.
	     * @var {Object}
	     */
	    options: {
	        // The data items.
	        items: []
	    },

	    /**
	     * Initializes the component.
	     * @method init
	     * @param {jQuery} element
	     * @param {Object} options
	     * @return {Self}
	     */
	    init: function(element, options) {
	    	this.element = element;
	        this.options = options;
	    	return this;
	    },

	    /**
	     * Build the DOM and displays it.
	     * @method display
	     * @return {Self}
	     */
	    display: function() {
	        if (this.options.items.length < 1) {
	            return this;
	        }
	        this.element.show();
	        var me = this;
	        var showsUl = jQuery('<ul id="showsList">');
	        for (var i = 0; i < this.options.items.length; i++) {
	            if (i == 0){
		            showsUl.append(jQuery('<li id="sh'+i+'">'+
		            		'<a href="'+this.options.items[i].showUrl+'" onclick="GOOM.Navigation.load(this.href); return false;"><img width="100" height="100" src="'+this.options.items[i].logo+'"></a>'+
		            		'<span class="sname"><a href="'+this.options.items[i].showUrl+'" onclick="GOOM.Navigation.load(this.href); return false;">'+ 
			                this.options.items[i].name + '</a></span>' +
			                '<br><span class="stime">'+this.options.items[i].description+'</span>'+
			                '<br><span class="sslogan">'+this.options.items[i].slogan+'</span>'+
			                '</li>'));
	            }else{
	            	showsUl.append(jQuery('<li style="display:none;" id="sh'+i+'">'+
		            		'<a href="'+this.options.items[i].showUrl+'" onclick="GOOM.Navigation.load(this.href); return false;"><img width="100" height="100" src="'+this.options.items[i].logo+'"></a>'+
		            		'<span class="sname"><a href="'+this.options.items[i].showUrl+'" onclick="GOOM.Navigation.load(this.href); return false;">'+ 
			                this.options.items[i].name + '</a></span>' +
			                '<br><span class="stime">'+this.options.items[i].description+'</span>'+
			                '<br><span class="sslogan">'+this.options.items[i].slogan+'</span>'+
			                '</li>'));
	            }
	        }
	        //next show arrow
	        if (this.options.items.length > 1) {
	        	showsUl.append(jQuery('<img id="nextS" src="../img/commandright2.png"/>'));
	        }
	        //prev show arrow
	        //showsUl.prepend(jQuery('<img id="prevS" style="display:none;" src="img/commandleft.png"/>'));
	        //header
	        //showsUl.prepend(jQuery('<div id="radioShowsHeader">Station Shows</div>'));
	        jQuery('#nextS').live('click', function() {
	        	me.next();
	        });
	        jQuery('#prevS').live('click', function() {
	        	me.prev();
	        });
	        this.element.append(showsUl);
	        this.currentShow = 0;
	        clearTimeout(this.count);
	        this.count = setTimeout(function() {
	            me.next();
	        },me.timeOut);
	        //return this;
	    },
	    
	    next: function() {
	    	var me = this;
	    	var nextss = this.currentShow+1;
	    	var prev = nextss-1;
	    	if(this.options.items.length > nextss){
	    		jQuery('#sh'+prev).hide();
		    	jQuery('#sh'+nextss).fadeIn(600);
		    	this.currentShow = nextss;
	    	}

	    	if(prev > -1){
	    		jQuery('#prevS').show();
	    	}
            if(this.options.items.length == nextss){
            	jQuery('#prevS').die('click');
            	jQuery('#nextS').die('click');
            	jQuery('#showsList').remove();
            	this.display();
            	return;
            }
            clearTimeout(this.count);
            this.count = setTimeout(function() {
	            me.next();
	        },me.timeOut);
	    },
	    
	    
	    prev: function() {
	    	var prevs = this.currentShow-1;
	    	var next = prevs+1;
	    	if(-1 < prevs){
	    		jQuery('#sh'+next).hide();
		    	jQuery('#sh'+prevs).fadeIn(600);
		    	this.currentShow = prevs;
	    	}
	    	if(prevs == 0){
	    		jQuery('#prevS').hide();
	    	}
	    	if(next < this.options.items.length){
	    		jQuery('#nextS').show();
	    	}
	    }

	   	}
GOOM.radio.Pending = {
    timeout : 5000,
    counter : null,
    interval : {},
    active : {},
    Events : {
        onChange : new GOOM.Event("G:Pending:onReady")
    },

    start : function(uid) {
        if(this.interval[uid]) {
            return;
        }

        this.interval[uid] = this.checkActive(uid, this.timeout);
    },

    isActive : function(uid) {
        if(this.active[uid]) {
            return true;
        }
        return false;
    },

    checkActive : function (uid) {
        GOOM.util.Get('/playlist/api/active?uid=' + uid + '&nocache=' + (new Date().getTime()), function(r) {
            var me = GOOM.radio.Pending;

            if(!r.success) {
                return;
            }

            if(r.active) {
                me.active[uid] = r.radioId;
                var pageObj = window.pageObj;
                if(pageObj.type == 'RADIO' && pageObj.uid == uid) {
                    pageObj.id = r.radioId;
                    pageObj.radioId = r.radioId;
                    pageObj.active = true;
                }
                clearTimeout(GOOM.radio.Pending.counter);
                me.Events.onChange.fire(uid, r.radioId);
                GOOM.UserRadios.update();
            } else {
                me.counter = setTimeout(function() {GOOM.radio.Pending.checkActive(uid)}, me.timeout);
            }
        }, this.timeout);
    }
}

GOOM.Navigation.Events.onPageLeave.subscribe(function() {
    clearTimeout(GOOM.radio.Pending.counter);
    GOOM.radio.Pending.timeout = 5000;
});

createNS('GOOM.blog.Editor');

GOOM.blog.Editor = function() {

    var Get = GOOM.util.Request,
        _pageStatus = { containerId : null,
                        containerHTML : '',
                        disableIds : ['formContainer'],
                        enableIds : ['postContainer'] },
        _statusStack = [_pageStatus];

    var _show = function(containerId, uri, richEditor) {
            Get('GET', uri, { success : function(result) {
                var container = byId(containerId);
                container.innerHTML = result;
                var textarea = container.getElementsByTagName('textarea');
                if(richEditor && textarea && textarea.length) {
                    textarea = textarea[0];
                    var iframe = document.createElement('iframe');
                    iframe.src = '/blogpost/overlay/rich-editor';
                    iframe.style.width = '410px';
                    iframe.style.height = textarea.offsetHeight + 'px';
                    textarea.style.display = 'none';
                    textarea.parentNode.insertBefore(iframe, textarea);
                }
                GOOM.UI.update(byId(containerId));
                if(container.parentNode) {
                    container.parentNode.className = container.parentNode.className; //FORCE IE TO REDRAW
                }
            }, rawText : true });
        },

        _disable = function(el) {
            if(el) {
                el.style.display = 'none';
            }
        },

        _enable = function(el, showMode) {
            if(el) {
                el.style.display = 'block';
            }
        },

        _pagePushConfig = function(disableElements, enableElements, containerId) {
            _pageStatus.disableElements = disableElements;
            _pageStatus.enableElements = enableElements;
            _pageStatus.containerId = containerId;
            _pageStatus.containerHTML = byId(containerId).innerHTML;
            _statusStack.push(_pageStatus);
        },

        _pagePopConfig = function() {
            _pageStatus = _statusStack.pop();
        },

        _pageSetup = function(mode) {
            var containerId = _pageStatus.containerId,
                containerHTML = _pageStatus.containerHTML;

            if(mode == true) {
                var disableElements = _pageStatus.disableElements,
                    enableElements = _pageStatus.enableElements;
            } else {
                disableElements = _pageStatus.enableElements;
                enableElements = _pageStatus.disableElements;
            }

            for(var i = 0, len = disableElements.length; i < len; i++) {
                _disable(disableElements[i]);
            }

            for(i = 0, len = enableElements.length; i < len; i++) {
                _enable(enableElements[i]);
            }
            byId(containerId).innerHTML = containerHTML;
        },

        _getElements = function(idList) {
            var elList = [];
            if (idList) {
                for(var i = 0, len = idList.length; i < len; i++) {
                    elList.push(byId(idList[i]));
                }
            }
            return elList;
        };

    return {
        showPost : function(containerId, disableIds, enableIds, postId) {
            var pageObj = window.pageObj;

            if(pageObj && (pageObj.type == "RADIO")) {
                var uri = '/blogpost/overlay/form?radioUid=' + pageObj.uid,
                    disableElements = _getElements(disableIds),
                    enableElements = _getElements(enableIds),
                    editDeleteButtons = byId('postContainer').getElementsByTagName('div');

                if(postId) {
                    var previewContainer = byId('previewContainer'),
                        shit = previewContainer.getElementsByTagName('div');
                    uri = '/blogpost/overlay/form?radioUid=' + pageObj.uid + '&postId=' + postId;
                    previewContainer.innerHTML = byId('post-' + postId).innerHTML;
                    for (var i = 0, len = shit.length; i < len; i++) {
                        if (shit[i].id == 'editDeletePost') {
                            disableElements.push(shit[i]);
                            break;
                        }
                    }
                }

                for(i = 0, len = editDeleteButtons.length; i < len; i++) {
                    if(editDeleteButtons[i].id == 'editDeletePost') {
                        disableElements.push(editDeleteButtons[i]);
                    }
                }

                _pagePushConfig(disableElements, enableElements, containerId);
                _pageSetup(true);
                _show(containerId, uri, true);
            }
        },

        showComment : function(containerId, disableIds, enableIds, commentId) {
            var uri = '/comment/overlay/form?commentId=' + commentId,
                disableElements = _getElements(disableIds),
                enableElements = _getElements(enableIds);

            _pagePushConfig(disableElements, enableElements, containerId);
            _pageSetup(true);
            _show(containerId, uri, false);
        },

        showDeletePost : function(containerId, disableIds, enableIds) {
            var enableElements = _getElements([enableIds]);

            _pagePushConfig([], enableElements, containerId);
            _pageSetup(true);
        },

        submitDeletePost : function(postId) {
            var uri = '/blogpost/api/delete?postId=' + postId,
                callback = function(r) {
                    if(!r.success) {
                        if(!handleUserStatus(r)) {
                            return;
                        }
                        GOOM.util.FatalMsg({ message :  r.message});
                        return;
                    }
                    if(window.pageObj && (window.pageObj.type == 'RADIO') && window.pageObj.slug) {
                        GOOM.Navigation.load('/radio/' + window.pageObj.slug);
                    } else {
                        GOOM.Navigation.refresh();
                    }
                };

            GOOM.util.Request('POST', uri, {success : callback});
        },

        showDeleteComment : function(containerId, disableIds, enableIds) {
            var enableElements = _getElements([enableIds]);
            _pagePushConfig([], enableElements, containerId);
            _pageSetup(true);
        },

        submitDeleteComment : function(commentId) {
            var uri = '/comment/api/delete?commentId=' + commentId,
                callback = function(r) {
                    if(!r.success) {
                        if(!handleUserStatus(r)) {
                            return;
                        }
                        GOOM.util.FatalMsg({ message :  r.message});
                        return;
                    }
                    GOOM.Navigation.refresh();
                    GOOM.Navigation.scrollTo('commentsTop');
                };

            GOOM.util.Request('POST', uri, {success : callback});
        },

        cancel : function() {
            _pagePopConfig();
            _pageSetup(false);
        },

        submit : function(form, richEditor, callback) {
            disableFields(form.elements);

            if(richEditor) {
                var iframe = form.getElementsByTagName('iframe')[0],
                    tinyMCE = iframe.contentWindow.window.tinyMCE,
                    textarea = form.getElementsByTagName('textarea')[0];

                if(tinyMCE) {
                    textarea.value = tinyMCE.editors.mce_0.save();
                }
            }

            GOOM.util.FormRequest(form, {
                success : function(r) {
                    enableFields(form.elements);
                    if(!r.success) {
                        if(!handleUserStatus(r)) {
                            return;
                        }
                        if(r.errors) {
                            handleFormResults(form, r, true);
                        } else {
                            GOOM.util.FatalMsg({ message : r.message });
                        }
                    } else {
                        setTimeout(function() {
                            GOOM.Navigation.refresh();
                            if(callback) {
                                callback();
                            }
                        }, 1000);
                    }
                }
            });
        }
    };
}();
GOOM.rotation.Song = {
    confirmDialog : new GOOM.util.Dialog({isModal : true, isNarrow: true}),

    interval : {},

    currentPlaylist : [],
    rotation : {length : 0},

    curMediaHash : {},
    curMediaElHash : {},
    
    isLoadedFlag : false,

    isDragging : false,
    
    hotSongsIds : [],
    searchIds : [],
    
    searchData : [],
    hotSongsData : [],

    DragContainer : null,
    DragContainerNodes : null, //tb pointer to nodes after load of playlist

    lastSearch : false,
    currentSongPos : 0,

    songsMaxNum : 150,

    lastItemId : 0, // unique id for each song instance

    templates : {
       item : '<tr class="%{classStr}" gdata="%{gdata}" itemid="%{itemid}" kind="plannedsongs" >' +
                  '<td class="playClip"><a class="miniPlay" gdata="%{gdata}" onmousedown="GOOM.PlayItem(this, event); return false;" onclick="return false;" href="#"><img style="border:0px;height:17px;width:17px;" src="/img/asset_play.png"/></a></td>' +
                  '<td class="trackTitle"><span>%{title}</span></td>' +
                  '<td class="artistName">%{artist}</td>' +
                  '<td class="removeTrack"><a stopkey="itemid" onmousedown="GOOM.rotation.Song.removeItem(this, event); return false;" href="#" onclick="return false;" title=""></a></td>' +
              '</tr>',
        
       hoverItem : '<div class="itemDrag"><ul><li class="itemDragNumber">%{number}</li><li class="itemDragTitle">%{title}</li><li class="itemDragArtist">%{artist}</li></ul><div>',
        
       searchItem : '<tr id="%{id}" class="%{className}" gData="%{gdata}">' +
                        '<td class="playClip">' +
                            '<a class="miniPlay" gdata="%{gdata}" kind="availablesongs" onclick="return false;" onmouseup="stopEvent(event); return false;" onmousedown="GOOM.PlayItem(this, event); return false;" href="#"><img style="border:0px;height:17px;width:17px;" src="/img/asset_play.png"/></a>' +
                        '</td>' +
                        '<td>' +
                            '<h3>%{title}</h3>' +
                            '<h4>%{artist}</h4>' +
                        '</td>' +
                    '</tr>'
    },

    getColor : function(i) {
        if(i < 10) {
            return 'mostPlayed';
        } else if(i < 30) {
            return 'secondMostPlayed';
        } else if(i < 60) {
            return 'thirdMostPlayed';
        } else if(i < 90) {
            return 'fourthMostPlayed';
        } else if(i < 130) {
            return 'fifthMostPlayed';
        } else {
            return 'sixthMostPlayed';
        }
    },
    
    heightLightEl : function(enable, el, color) {
        if(enable) {
            el.className = color + ' highlight';
            el.style.cursor = 'pointer';
            el.onclick = GOOM.rotation.Song.gotoItem;
        } else {
            el.onclick = null;
            el.className = color;
            el.style.cursor = 'move';
        }
    },
    
    gotoItem : function() {
        var me = GOOM.rotation.Song,
            el = me.curMediaElHash[this.getAttribute('gdata')],
            color = me.curMediaHash[this.getAttribute('gdata')],
            count = 1;

        if(me.gotoLastEl) {
            removeClass(me.gotoLastEl, 'highlight');
        }

        me.gotoLastEl = el;
        byId('rotationScrollContainer').scrollTop = el.offsetTop - 240;
        
        clearInterval(me.gotoInterval);

        me.gotoInterval = setInterval(function() {
            el.className = (count % 2) ? color : 'highlight';
            if(count === 5) {
                clearInterval(me.gotoInterval);
            }
            count++;
        }, 250);
    },

    createExternalDragNode : function(node, data) {
        var me = GOOM.rotation.Song;

        node.onselectstart = function() { return false; };

        node.onmousedown = function(e) {
            var ref = this;
            if(!e) { e = window.event; }
            if(!(e.which && e.button == 0 || e.button == 1) ||
                me.curMediaElHash[ref.getAttribute('gdata')]) {
                return false;
            }

            me.selectedElement = ref;

            me.selectedElementTO = setTimeout(function() {
                if(me.DragContainer) {
                    var x = me.createHTMLItem(ref.data);
                    x.data = data;
                    x.gindex = me.songsMaxNum + 1;
                    byId('rotationList').appendChild(x);
                    me.DragContainer.dragInNode(x, e);
                    me.reindex();
                    me.isDragging = true;
                }
            }, 200);

            return false;
        }
        node.onmouseup = function(e) {
            if(!e) { e = window.event; }
            if(me.selectedElementTO) { clearTimeout(me.selectedElementTO); }
            if(!(e.which && e.button == 0 || e.button == 1) ||
                me.curMediaElHash[this.getAttribute('gdata')]) {
                return false;
            }

            if(me.selectedElement != this || me.isDragging) {
                me.isDragging = false;
                return false;
            }
            me.selectedElement = null;

            var x = me.createHTMLItem(this.data),
                listEl = byId('rotationList');

            x.data = data;
            me.DragContainer.setupNode(x, data);
            listEl.insertBefore(x, listEl.children[0]);
            me.reindex();

            me.isDragging = false;

            return false;
        }
        node.data = data;
    },

    createHTMLItem : function(mediaObj) {
        var me = GOOM.rotation.Song;
        var str = replace(this.templates.item, {
                title :  shortener(mediaObj.title, 40),
                artist : shortener(mediaObj.artists.join(', '), 30),
                gdata : mediaObj.id,
                playClipText : _('ROTATION_CLIP_PLAY'),
                itemid : me.lastItemId++
            }),
            node = YAHOO.Node.getDOMNode(YAHOO.Node.create(str));

        node.data = mediaObj;
        return node;
    },
    
    dragMouseDown : function(dragContainer, node) {
        var data = node.data;

        dragContainer.innerHTML = replace(GOOM.rotation.Song.templates.hoverItem, {
            title  :  shortener(data.title, 40),
            artist : shortener(data.artists.join(', '), 30),
            number : ' '
        });
        YAHOO.Node.get(dragContainer).addClass('moving');
    },

    updateDragNode : function(drag, position, nodeHeight) {
        var me = GOOM.rotation.Song;

        me.currentSongPos = Math.min(GOOM.rotation.Song.rotation.length,
                                     parseInt(position/nodeHeight, 10) + 1);
        drag.firstChild.firstChild.firstChild.innerHTML = me.currentSongPos;
    },

    dragMouseUp : function(ddCurDragEl, ddHoverNode) {
        var me = GOOM.rotation.Song;

        if(ddHoverNode) {
            ddHoverNode.parentNode.removeChild(ddHoverNode);
            ddHoverNode = null;
        }

        var nodeIndex = Math.max(0, me.currentSongPos - 1),
            goingUp = nodeIndex < ddCurDragEl.gindex,
            target = me.DragContainerNodes[nodeIndex];

        if(!target) {
            return;
        }

        if(!ddCurDragEl) {
            node.parentNode.appendChild(ddCurDragEl);
            return;
        }

        if(!goingUp) {
            target = target.nextSibling;
            if(!target && ddCurDragEl.parentNode) {
                ddCurDragEl.parentNode.appendChild(ddCurDragEl);
                GOOM.rotation.Song.reindex();
                return;
            }
        }

        if(target && target.parentNode) {
            target.parentNode.insertBefore(ddCurDragEl, target);
        }

        me.reindex();
    },
    
    reindex : function() {
        if(this.reindexTimeout) {
            return;
        }
        this.reindexTimeout = true;

        var trs = byId('rotationList').getElementsByTagName('tr'),
            me = GOOM.rotation.Song,
            id, color,
            item;

        me.curMediaElHash = {};
        me.curMediaHash = {};
        for(var i = 0, len = trs.length; i < len; ++i) {
            item = trs[i];
            if(!item) {
                continue;
            }
            if(i >= me.songsMaxNum) {
                item.parentNode.removeChild(item);
                continue;
            }
            color = me.getColor(i);
            item.className = color;
            item.gindex = i;
            id = item.getAttribute('gdata');
            me.curMediaHash[id] = color;
            me.curMediaElHash[id] = item;
        }
        me.rotation.length = trs.length;
        trs = byId('rotationSearchList').getElementsByTagName('tr');
        for(i = 0, len = trs.length; i < len; ++i) {
            var tr = trs[i];
            color = me.curMediaHash[tr.getAttribute('gdata')];
            if(color) {
                me.heightLightEl(true, tr, color);
            } else {
                me.heightLightEl(false, tr, (i % 2) ? '' : 'odd');
            }
        }
        for(i = 0, len = me.hotSongsIds.length; i < len; ++i) {
            id = me.hotSongsIds[i];
            color = me.curMediaHash[me.hotSongsIds[i]];
            if(color) {
                me.heightLightEl(true, byId(id + '_hot'), color);
            } else {
                me.heightLightEl(false, byId(id + '_hot'), (i % 2) ? '' : 'odd');
            }
        }

        this.reindexTimeout = false;

    },

    update : function() {
        var me = GOOM.rotation.Song, Pending = GOOM.radio.Pending;
        me.curMediaHash = {};
        me.curMediaElHash = {};
        me.hotSongsIds = [];
        me.searchIds = [];
        me.hotSongsLoaded = false;
        me.currentPlaylist = [];
        me.isLoadedFlag = false;

        if(!window.pageObj) {
            return;
        }

        if(!window.pageObj.active && !me.pendingSubscribed) {
            Pending.start(window.pageObj.uid);
            me.pendingSubscribed = true;
            GOOM.radio.Pending.Events.onChange.subscribe(function(uid) {
                if((uid + '') == window.pageObj.uid) {
                    GOOM.rotation.Song.update();
                }
            })
            return;
        }
        GOOM.util.Get('/playlist/list/playlist?radioUid=' + window.pageObj.uid + '&limit=' + me.songsMaxNum, this.handleUpdate)
    },

    handleUpdate : function(r) {
        if(!r.success || !r.ready || (r.ready && !r.results.length)) {
            toggle(['rotationSongListLoading'], ['rotationSongListFailed']);
            return;
        }

        var i = 0, q,
        me = GOOM.rotation.Song,
        len = r.results.length,
        artists, artistLen, node,
        rotationList = YAHOO.Node.get(byId('rotationList'));

        me.isLoadedFlag = true;

        toggle(['rotationMsgContainer'], ['rotationScrollContainer']);

        me.DragContainerNodes = byId('rotationList').getElementsByTagName('tr'),
        me.DragContainer = new GOOM.util.DD.Container(byId('rotationList'), byId('rotationScrollContainer'), {
                dragMouseDown  : me.dragMouseDown,
                updateDragNode : me.updateDragNode,
                dragMouseUp    : me.dragMouseUp
        });

        for(i; i < len; ++i) {
            var data = r.results[i];
            me.currentPlaylist.push(data.id);
            artists = [];
            for(q = 0; artistLen = data.artists.length, q < artistLen; q++) {
                artists.push(data.artists[q].name);
            }
            data.artists = artists;
            node = me.createHTMLItem(data);
            rotationList.appendChild(node);
            me.DragContainer.setupNode(node, data);
        }
        me.reindex();
    },

    search : function(formEl, offset) {
        var searchEl = byId('rotationSearchList');

        offset = offset || 0;
        this.lastSearchFormEl = formEl;

        // Stop playing by kind : 
        // We do not want to stop a show instance from playing if it belongs to the songs list 
        GOOM.util.stopPlayingClip('availablesongs');

        while(searchEl.hasChildNodes()) {
            searchEl.removeChild(searchEl.childNodes[0]);
        }
        formEl.action = '/playlist/list/search';
        this.searchData = [];
        this.searchIds = [];
        if(formEl.terms.getAttribute('guiloaded')){
            addClass(formEl.terms.parentNode.parentNode, 'loadingResult');
        }
        if(this.searchRequest) {
            this.searchRequest.abort();
        }
        this.searchRequest = GOOM.util.FormRequest(formEl, {success  : this.handleSearchResult,
                                                            failure  : function() {enableFields(formEl.elements)},
                                                            postData : 'offset=' + offset + '&limit=11'});

        none(['rotationSearchAddContainer', 'rotationSearchNoResult']);
        byId('rotationSearchPager').innerHTML = '';
    },

    handleSearchResult : function(r) {
        if(!r || !r.success) {
            return;
        }

        var item, paginator, i,
            me = GOOM.rotation.Song,
            formEl = me.lastSearchFormEl,
            len = r.results.length,
            color, node, artist,
            listEl = byId('rotationSearchList');

        me.searchIds = [];
        while(listEl.hasChildNodes()) {
            listEl.removeChild(listEl.childNodes[0]);
        }
        if(formEl.terms.getAttribute('guiloaded')){
            removeClass(formEl.terms.parentNode.parentNode, 'loadingResult');
        }
        formEl.terms.getAttribute('guiloaded');

        (len) ? block('rotationSearchAddContainer') :
                block('rotationSearchNoResult');

        me.searchData = [];
        for(i = 0; i < len; i++) {
            item = r.results[i];
            item.artists = artist = item.name || [];

            node = YAHOO.Node.create(replace(me.templates.searchItem, {
                id : item.id + '_search',
                title : item.title,
                artist : shortener(artist.join(', '), 50),
                gdata : item.id,
                itemid : me.lastItemId++
            }));

            color = me.curMediaHash[item.id];
            node = YAHOO.Node.getDOMNode(node);
            node.index = i;
            if(color) {
                me.heightLightEl(true, node, color);
            } else {
                me.heightLightEl(false, node, (i % 2) ? '' : 'odd');
            }
            listEl.appendChild(node);
            me.createExternalDragNode(node, item);

            me.searchIds.push(item.id);
            me.searchData.push(item);
        }

        if(r.total > r.limit) {
            paginator = new GOOM.util.Paginator(r.total, r.limit, r.offset || 0, 2);
            paginator.write(byId('rotationSearchPager'), function(offset){
                var me = GOOM.rotation.Song;
                me.search(me.lastSearchFormEl, offset);
            });
        }
    },

    loadHotSongs : function() {
        var updateHotSongs = function(r) {
            var item, node,
                me = GOOM.rotation.Song,
                listEl = byId('rotationHotList');

            me.hotSongsIds = [];
            me.hotSongsData = [];
            if(!r.success) {
                me.hotSongsLoaded = false;
                return;
            }
            me.hotSongsResults = true;
            for(var i = 0, len = r.results.length; i < len; ++i) {
                item = r.results[i];
                var artists = [];
                for(var q = 0, artistLen = item.artists.length; q < artistLen; ++q) {
                    artists.push(item.artists[q].name);
                }
                item.artists = artists;

                node = YAHOO.Node.create(replace(me.templates.searchItem, {
                    id : item.id + '_hot',
                    title : item.title,
                    artist : shortener(artists.join(', '), 50),
                    gdata : item.id,
                    itemid : me.lastItemId++
                }));

                var color = me.curMediaHash[item.id],
                    nodeHTML = YAHOO.Node.getDOMNode(node);
                nodeHTML.index = i;
                if(color) {
                    me.heightLightEl(true, nodeHTML, color);
                } else {
                    me.heightLightEl(false, nodeHTML, (i % 2) ? '' : 'odd');
                }
                listEl.appendChild(nodeHTML);
                me.createExternalDragNode(nodeHTML, item);
                me.hotSongsData.push(item);
                me.hotSongsIds.push(item.id);
            }
        }
        if(GOOM.rotation.Song.hotSongsLoaded) {
            return;
        }
        GOOM.rotation.Song.hotSongsLoaded = true;
        GOOM.util.Get('/playlist/list/hot-songs', updateHotSongs);
    },

    showTab : function(id) {
        var searchTab = byId('rotationTabSearch'),
            searchContainer = byId('rotationSearchContainer'),
            hotTab = byId('rotationTabHot'),
            hotContainer = byId('rotationHotContainer');

        GOOM.util.stopPlayingClip('availablesongs');

        if(id == 'hot') {
            removeClass(searchTab, 'active');
            addClass(hotTab, 'active');
            searchContainer.style.display = 'none';
            hotContainer.style.display = 'block';
            this.loadHotSongs();
        } else {
            removeClass(hotTab, 'active');
            addClass(searchTab, 'active');
            searchContainer.style.display = 'block';
            hotContainer.style.display = 'none';
        }
    },

    clear : function() {
        var rotationList = byId('rotationList');
        while(rotationList.hasChildNodes()) {
            rotationList.removeChild(rotationList.childNodes[0]);
        }
        GOOM.rotation.Song.reindex();
    },

    addAll : function() {
        var searchContainer = byId('rotationSearchContainer').getElementsByTagName('tr'),
            listEl = byId('rotationList'),
            me = GOOM.rotation.Song;

        for(var i = 0, len = me.searchData.length; i < len; ++i) {
            var id = searchContainer[i].getAttribute('gdata');
            if(me.curMediaHash[id] || me.searchData[i].id != id) {
               continue;
            }
            var node = this.createHTMLItem(me.searchData[i]);
            me.DragContainer.setupNode(node);
            listEl.insertBefore(node, listEl.children[i]);
            me.reindex();
        }
    },

    // el : <a> elt
    // e  : event
    removeItem : function(el, e) {
        stopEvent(e);
        var parent = el.parentNode; // <td>
        if(parent) {
            parent = parent.parentNode; // <tr>
            if(parent) {
                // if we use the value of 'gdata', and if the song which is about to be removed is played in the
            	// list of available songs, then that one is stopped.
            	// Using 'itemid' ensures that only the song beeing removed will be stopped (if it was playing)
                var id = parent.getAttribute('itemid'),
                    hotEl = byId(id + '_hot');

                GOOM.util.stopPlayingClip(id);

                id = parent.getAttribute('gdata');
                delete this.curMediaElHash[id];
                delete this.curMediaHash[id];
                parent.parentNode.removeChild(parent);

                if(hotEl) {
                    hotEl.className = (hotEl.index % 2) ? '' : 'odd';
                }
                var searchEl = byId(id + '_search');
                if(searchEl) {
                    searchEl.className = (searchEl.index % 2) ? '' : 'odd';
                }
            }
        }
        this.reindex();
    },

    save : function() {
        if(!this.isLoadedFlag) {
            return;
        }

        var ids = [],
            slug = window.pageObj.slug,
            trs = byId('rotationList').getElementsByTagName('tr');

        for(var i = 0, len = trs.length; i < len; ++i) {
            ids.push(trs[i].getAttribute('gdata'));
        }

        var postData = replace('radioId=%{radioId}&ids=%{ids}&date=%{date}', {
                radioId : window.pageObj.radioId,
                ids : ids.join(','),
                date : -(new Date()).getTimezoneOffset()
            });

        GOOM.util.Request('POST', '/playlist/api/update', {
            success : function (r) {
                if(!r.success) {
                    GOOM.util.FatalMsg({message : r.message});
                    return;
                }
                GOOM.rotation.Song.isLoadedFlag = false;
                GOOM.Navigation.unlock('/radio/' + slug + '/rotation/songs');
                GOOM.Navigation.load('/radio/' + slug);
            },
            postData : postData});
    }

};

GOOM.rotation.Show = {
    hotShowsOrder : 'title',

    plannedShows : [],
    lastPlannedId : 0, // used to identify uniquely planned shows (one show may be added two or more times)

    showColors : {},

    createdShow : false,
    dragging: false,

    defaultColors : ['#FF4000','#FFBF00', '#00A33D', '#55E7FF', '#2210D2', '#D111AD', '#D59758', '#CCFF00', '#29ABE2', '#FF7900', '#FF00FF', '#047391', '#5A3D1C', '#FFFF00','#662D91', '#FF8888', '#72A126', '#BF0000', '#004F72', '#C9C900'],

    template : {
        planItem : '<div class="show" itemid="%{itemid}" gdata="%{gdata}" >' +
                       '<a gdata="%{gdata}" itemid="%{itemid}" stopkey="itemid" kind="plannedshows" onclick="return false;" class="playShowClip miniPlay" onmousedown="GOOM.PlayItem(this, event); return false;" href="#">' +
                           '<img src="/img/asset_play.png"/>' +
                       '</a>' +
                       '<img class="showImage" src="/img/" alt="" />' +
                       '<div class="description">' +
                           '<h1>%{name}</h1>' +
                           '<h2>%{slogan}</h2>' +
                       '</div>' +
                       '<div class="showHoverArrows"></div>' +
                       '<a onmousedown="GOOM.rotation.Show.removePlanItem(this.parentNode, event); return false;" title="" class="close" href="#"></a>' +
                   '</div>',
        
        planItemTiny : '<div class="show oneSlot" itemid="%{itemid}" gdata="%{gdata}" >' +
                           '<a gdata="%{gdata}" itemid="%{itemid}" stopkey="itemid" kind="plannedshows" class="playShowClip miniPlay" onclick="return false;" onmousedown="GOOM.PlayItem(this, event); return false;" href="#">' +
                               '<img src="/img/asset_play.png"/>' +
                           '</a>' +
                           '<div class="description">' +
                               '<h1>%{name}</h1>' +
                           '</div>' +
                           '<div class="showHoverArrows"></div>' + 
                           '<a onmousedown="GOOM.rotation.Show.removePlanItem(this.parentNode, event); return false;" title="" class="close" href="#"></a>' +
                       '</div>',

        sideBarItem : '<li id="%{id}" class="%{className} clearfix" gData="%{id}">' +
                          '<div class="t5"><img onerror="defaultImg(this, \'/img/show_t5.jpg\')" src="%{imagePath}" /></div>' +
                          '<div class="showContentSide clearfix">' +
                              '<h3>%{name}</h3>' +
                              '<span>%{slogan}</span>' +
                              '<p>%{shortDescription}</p>' +
                              '<div>' +
                                  '<a gdata="%{gdata}" kind="availableshows" onclick="return false;" class="playShowClip miniPlay" onmousedown="GOOM.PlayItem(this, event); return false;" href="#">' +
                                      '<img src="/img/asset_play.png" />' +
                                  '</a>' +
                                  '<div class="showLength"><strong>%{lengthText}</strong>%{duration}\'</div>' +
                              '</div>' +
                          '</div>' +
                      '</li>'
    },

    requestPlan : function() {
        var me = GOOM.rotation.Show;
        if(!window.pageObj) {
            return;
        }
        
        if(!window.pageObj.active) {
            GOOM.radio.Pending.start(window.pageObj.uid);
            me.pendingSubscribed = true;
            GOOM.radio.Pending.Events.onChange.subscribe(function(uid) {
                if((uid + '') == window.pageObj.uid) {
                    GOOM.rotation.Show.requestPlan();
                }
            })
            return;
        }
        //reset stuff
        me.savedData = {ids : [] , startTimes : []};
        me.showColors = {};
        me.colors = me.defaultColors.slice(0);
        me.plannedShows = [];
        me.planLoaded = false;
        
        GOOM.util.Get('/radio/list/plan?radioUid=' + window.pageObj.uid +
                      '&timezone=' + -(new Date()).getTimezoneOffset()/60, me.handlePlan)
    },
    
    handlePlan : function(r) {
        if(!r.success) {
            toggle(['rotationShowListLoading'], ['rotationShowListFailed']);
            return;
        }

        toggle(['rotationShowMsgContainer'], ['rotationShowScrollContainer']);

        var me = GOOM.rotation.Show, 
            containerList = byId('rotationShowList'),
            show, initDate, startTime, endTime, node;

        me.DragContainer = new GOOM.util.DD.Container(containerList, byId('rotationShowScrollContainer'), {
                dragMouseDown : me.dragMouseDown,
                updateDragNode : function() {byId('rotationShowHoverItem').style.display = 'none'},
                dragMouseUp : me.dragMouseUp
        });

        initDate = new Date(0);
        initDate.setHours(0);

        for(var i = 0, len = r.results.length; i < len; ++i) {
            show = r.results[i];

            startTime = new Date(initDate);
            startTime.setMinutes(show.startTime);
            endTime = new Date(initDate);
            endTime.setMinutes(show.startTime + show.maxDuration/60, -1);

            me.savedData.ids.push(show.id);
            me.savedData.startTimes.push(startTime.getTime());

            show.startTime = startTime;
            show.endTime = endTime;

            show.index = i;

            node = me.createPlanItem(show, true);
            me.DragContainer.setupNode(node, show);
            containerList.appendChild(node);
        }
        me.plannedShows = r.results;

        me.planLoaded = true;
    },

    hasPlanChanged : function() {
        var me = GOOM.rotation.Show;

        if(!me.planLoaded){
           return false;
        }

        var ids = [], startTimes = [];
        for(var i = 0; i < me.plannedShows.length; i++) {
            var show =  me.plannedShows[i];
            ids.push(show.id);
            startTimes.push(show.startTime.getTime());
        }

        return ids.join(',') != me.savedData.ids.join(',') ||
               startTimes.join(',') != me.savedData.startTimes.join(',');
    },

    savePlan : function() {
        var me = GOOM.rotation.Show,
            ids = [], startTimes = [];

        for(var i = 0; i < me.plannedShows.length; i++) {
            var show =  me.plannedShows[i];
            ids.push(show.id);
            startTimes.push(show.startTime.getHours() + ':' + show.startTime.getMinutes());
        }

        var postData = 'radioId=%{id}&timezone=%{zone}&starttimes=%{times}&showids=%{ids}';
        postData = replace(postData, {id : window.pageObj.radioId,
                                      ids : ids.join(','),
                                      times : startTimes.join(','),
                                      zone : -(new Date()).getTimezoneOffset()/60});

        GOOM.util.Request('POST', '/radio/api/update-plan', {
            success : function (r) {
                if(!r.success) {
                    GOOM.util.FatalMsg({message : r.message});
                    return;
                }
                me.planLoaded = false; //little hack to make the leave dialog not appear;
                GOOM.Navigation.load('/radio/' + window.pageObj.slug);
            }, postData : postData});
    },

    requestCurrentShows : function(genreId, offset) {
        var me = GOOM.rotation.Show;

        me.hotShowsOrder = genreId;
        offset = offset || 0;

        // Stop playing by kind : 
        // We do not want to stop a show instance from playing if it belongs to the planned shows list 
        GOOM.util.stopPlayingClip('availableshows');

        if(me.hotSongsRequest) {
            me.hotSongsRequest.abort();
        }
        var uri = '/show/list/shows?limit=5&genreId=' + genreId + '&offset=' + offset + '&mediaAssetStatusList=C';
        me.hotSongsRequest = GOOM.util.Request('GET', uri, {success : me.handleHotSongs});
    },

    handleHotSongs : function(r) {
        if(!r || !r.success) {
            return;
        }

        var paginator, node, showObj,
            me = GOOM.rotation.Show,
            listEl = byId('rotationShowHotList');

        while(listEl.hasChildNodes()) {
            listEl.removeChild(listEl.childNodes[0]);
        }

        for(var i = 0; i < r.results.length; i++) {
            showObj = r.results[i];
            node = me.createSideBarItem(showObj, (i % 2) ? '' : 'odd')
            listEl.appendChild(node);
            me.createExternalDragNode(node, showObj);
        }

        
        if(parseInt(r.total, 10) > parseInt(r.limit, 10)) {
            paginator = new GOOM.util.Paginator(r.total, r.limit, r.offset || 0, 2);
            paginator.write(byId('rotationShowSearchPager'), function(offset){
                var me = GOOM.rotation.Show;
                me.requestCurrentShows(me.hotShowsOrder, offset);
            });
        } else {
            byId('rotationShowSearchPager').innerHTML = '';
        }
    },

    dateToPos : function(date) {
        var pos = date.getHours() * 60 + date.getMinutes() - 360; //starts in 06:00
        if(pos < 0) {
            pos += 1440; //made sure if its goes into after 24:00
        }
        return pos *= (2 + 1/60); //adjusting to fit ui
    },

    posToDate : function(posY) {
         var pos  = Math.round(posY / (10 * (2 + (1 / 60)))) * 10,
             date = new Date(0);
         if(pos > 1070) {
             pos -= 1080;
             date.setHours(0);
         } else {
             date.setHours(6)
         }
          //start in 06:00
         date.setMinutes(pos, 0); //round to closes 10
         return date;
    },
    
    durationToHeight : function(duration) {
        return duration/60 * 2;
    },

    addShowToLocation : function(startTime, endTime) {
        var me = GOOM.rotation.Show,
            low = 0, high = me.plannedShows.length - 1, i = 0, cur;

        while (low <= high) {
            i = parseInt((low + high) / 2, 10);
            cur = me.plannedShows[i];
            if(cur.startTime.getTime() > endTime.getTime()) {
                 high = i - 1;
            } else if(cur.endTime.getTime() < startTime.getTime()){
                low = i + 1;
            } else {
                return false;
            }
        }

        if(me.plannedShows[i] && me.plannedShows[i].startTime < startTime) {
           ++i;
        }
        return i;
    },

    createSideBarItem : function(data, className) {
        data.className = className;
        data.lengthText = _('LENGHT');
        data.duration = parseInt(data.maxDuration/60, 10);
        data.gdata = data.mediaSampleId;
        data.shortDescription = shortener(data.description, 40);

        var me = GOOM.rotation.Show,
            li = document.createElement('div');

        li.innerHTML = replace(me.template.sideBarItem, data);
        li.getElementsByTagName('p')[0].title = data.description;
        GOOM.UI.thumbnailDOM(li.getElementsByTagName('img')[0], 'show', data, 't5');
        return li.firstChild;
    },

    dragMouseUp : function(ddCurDragEl, ddHoverNode, posY, ddNodeHeight) {
        var me = GOOM.rotation.Show,
            show = ddCurDragEl.data,
            startTime = me.posToDate(Math.max(posY - ddNodeHeight/2, 0)),
            endTime = new Date(startTime);

        me.dragging = false;

         //-1 to make sure that we dont got problems with shows that is next to each other
        endTime.setMinutes(startTime.getMinutes() + show.maxDuration/60, -1);

        var create = false,
            newIndex = me.addShowToLocation(startTime, endTime);

        if(newIndex !== false) {
            //update array with new position
            me.plannedShows.splice(newIndex, 0, show);
            me.reindex();
            //update time
            show.startTime = startTime;
            show.endTime = endTime;
            create = true;
        } else if(me.createdShow == false) {
            me.plannedShows.splice(show.index, 0, show);
            me.reindex();
            create = true;
        }

        if(create == true) {
            var node = me.createPlanItem(show, true);
            me.DragContainer.setupNode(node);
            byId('rotationShowList').appendChild(node);
        }

        if(ddHoverNode) {
            ddHoverNode.parentNode.removeChild(ddHoverNode);
            ddHoverNode = null;
        }

        me.createdShow = false;
    },

    dragMouseDown : function(dragContainer, node, posY) {
        var me = GOOM.rotation.Show;
        me.dragging = true;
        
        node.parentNode.removeChild(node);
        if(me.createdShow == false) {
            me.plannedShows.splice(node.data.index, 1);
        }

        me.reindex();
       
        node = me.createPlanItem(node.data);
        node.style.position = "static";
        dragContainer.appendChild(node);
    },

    createPlanItem : function(data, hover) {
        var me = GOOM.rotation.Show,
            pos = me.dateToPos(data.startTime),
            div = document.createElement('div'),
            height = me.durationToHeight(data.maxDuration),
            dataTemplate = {
                gdata : data.mediaSampleId,
                name :  shortener(data.name, 25),
                slogan : shortener(data.slogan, 25),
                itemid : me.lastPlannedId++ // unique id for each show instance
            };

            if(height > 30) {
                div.innerHTML = replace(me.template.planItem, dataTemplate);
                GOOM.UI.thumbnailDOM(div.getElementsByTagName('img')[1], 'show', data, 't5');
            } else {
                div.innerHTML = replace(me.template.planItemTiny, dataTemplate);
            }

            var node = div.firstChild, color;
            color = me.showColors[data.id];
            if(!color) {
                color = me.colors.shift();
                if(!color) {
                    do {
                        color = ('#0' + Math.round(0xffffff * Math.random()).toString(16)).replace(/^#0([0-9a-f]{6})$/i, '#$1')
                    } while(me.showColors[color])
                }
            }
            me.showColors[data.id] = color;
            data.color = color;

            node.style.position = "absolute";
            node.style.display = 'block';
            node.style.top = pos + 'px';
            node.style.backgroundColor = data.color;
            node.style.height = (height > 30 ? height : 20) + 'px';
            
            node.data = data;
            if(hover) {
                YAHOO.on('mouseenter', function() {
                    node.hoverTimer = setTimeout(function() {
                        if(GOOM.rotation.Show.dragging == false) {
                            GOOM.rotation.Show.updateHoverItem(data, node);
                            me.updateHoverStatus(node, false);
                        }
                    }, 1000)
                }, node);

                YAHOO.on('mouseleave', function() {
                    if(node.hoverTimer) {
                        clearTimeout(node.hoverTimer);
                        me.updateHoverStatus(node, true);
                    }
                }, node);
            } else {
                node.style.zIndex = 501;
            }
            clearTimeout(node.hoverTimer);
            me.updateHoverStatus(node, true);
        return node;
    },

    updateHoverStatus : function(node, hide) {
       var pointer = node.getElementsByTagName('div')[1];
       if(node.data.color) {
            pointer.className = 'showHoverArrows ' + node.data.color.replace('#', 'c');
       }
       pointer.style.display = hide ? 'none' : 'block';
       byId('rotationShowHoverItem').style.display =  hide ? 'none' : 'block';
    },

    updateHoverItem : function(data, relatedNode) {
        var node = byId('rotationShowHoverItem');
        node.style.border = '2px solid ' + data.color;
        
        setText(node.getElementsByTagName('h1')[0], data.name);
        setText(node.getElementsByTagName('h2')[0], data.slogan);
        setText(node.getElementsByTagName('p')[0], shortenerNoEscape(data.description, 150));
        
        GOOM.UI.thumbnailDOM(node.getElementsByTagName('img')[0], 'show', data, 't7');

        var scrollArea = GOOM.rotation.Show.DragContainer.getScrollArea(),
            top = parseInt(relatedNode.style.top, 10),
            height = parseInt(relatedNode.style.height, 10);
        
        top = top - byId('rotationShowScrollContainer').scrollTop - height/2;

        height = scrollArea.bottom.y2 - scrollArea.top.y1;
        
        if(0 > top - 90) {
            top = 0;
        } else if(height < top + 90) {
            top = height - 180;
        } else {
            top = top - 180/2;
        }
        node.style.top = (scrollArea.top.y1 + top)  + 'px';
        relatedNode.getElementsByTagName('div')[1].style.display = 'block';
    },

    removePlanItem : function(node, event) {
        var me = GOOM.rotation.Show, 
            index = node.data.index,
            attr = node.attributes;

        for(var i = 0, len = attr.length; i < len; ++i) {
        	// Use itemid instead of gdata. gdata uniquely identify one show agains another one,
        	// but one show may be added many times to the list. itemid uniquely identifies added show instances.
            if (attr[i].name == 'itemid') {
                GOOM.util.stopPlayingClip(attr[i].value);
                break;
            }
        }

        stopEvent(event); //just to be sure
        if(node.hoverTimer) {
            clearTimeout(node.hoverTimer);
        }
        me.updateHoverStatus(node, true); //hides the arrow and hover overlay
        me.plannedShows.splice(index, 1);
        node.parentNode.removeChild(node);
        me.reindex();
    },

    createExternalDragNode : function(node, data) {
        node.onselectstart = function() {return false;};
        node.onmousedown = function(e) {
            e = e || window.event;
            if(!(e.which && e.button == 0 || e.button == 1)) {
                return false;
            }

            this.data.maxDuration =  this.data.maxDuration || 60;

            var startDate = new Date(0);
                startDate.setHours(0);
            
            var endDate = new Date(startDate);
                endDate.setMinutes(this.data.maxDuration/60);

            this.data.startTime = startDate;
            this.data.endTime = endDate

            var me = GOOM.rotation.Show;
            me.createdShow = true;

            if(me.DragContainer) {
                var clone = me.cloneObject(this.data);
                var x = GOOM.rotation.Show.createPlanItem(clone, false);
                x.data = clone;
                me.DragContainer.dragInNode(x, e);
            }
            return false;
        }
        node.data = data;
    },
    
    reindex : function() {
        var me = GOOM.rotation.Show;
        for(var i = 0; i < me.plannedShows.length; i++) {
            me.plannedShows[i].index = i; //update the index
        }
    },

    cloneObject : function (obj) {
        var newObj = (obj instanceof Array) ? [] : {};
        for (var i in obj) {
            if (i == 'startTime' || i == 'endTime') {
                newObj[i] = new Date(obj[i]);
            }
            
            else newObj[i] = obj[i]
        }
        return newObj;
    }
}
createNS('GOOM.downloads');
GOOM.downloads.dialogs = function(type) {
    var dialog = new GOOM.util.Dialog({isModal:true, isNarrow : true});
    if(type == 'change'){
    	var url = '/radio/overlay/premiumradiosswitch';
    }else{
    	var url = '/radio/overlay/downloadinstructions';
    }
    GOOM.util.Request('GET', url,
            {success : function callback(result) {
                  dialog.setHTML(result)
            },
            rawText : true});
    dialog.setHTML(GOOM.user.Share.loading);
    dialog.open();
}

GOOM.downloads.Update = {
		
		apiPlaylistUrl : '/radio/api/radioplaylist?radioid=%{radioId}',
		apiMountUrl : '/radio/api/radiomountbyid?radioid=%{radioId}',
		apiHeaderUrl : '/radio/api/hasheaderimage?radioid=%{radioId}',
		facebook   : 'http://www.facebook.com/sharer.php?u=%{link}&t=%{title}',
		twitter    : 'http://twitter.com/home?status=%{title} %{link}',
		playerPop : '/radio/api/radiopop?radioId=%{radioId}',
        embedURLUs : '<script type="text/javascript">goomDefaultRadio=\'%{radioId}\';goomPartnerId=\'GOOMRADIO\';goomAutoPlay=\'1\';goomGeoLocation=\'0\';goomPopUpMode=\'1\';goomAutoPopup=\'0\';goomCustomUI=\'baby\';goomOneStreamMode=\'1\';goomSyncMetadata=\'1\';goomJsUI=\'0\';goomBgColor=\'0\';goomWidth=\'473\';goomHeight=\'65\';goomPopWidth=\'473\';goomPopHeight=\'65\';goomFbLanguage=\'us_US\';goomFbCountFlag=\'standard\';goomFbOn=\'0\';goomTwtOn=\'0\';</script><script type="text/javascript" src="http://sunbear.goomradio.com/include.js"></script><p>Enjoy <a href="http://www.goomradio.us">Free Music</a> with Goom Radio</p>',
		embedURLFr : '<script type="text/javascript">goomDefaultRadio=\'%{radioId}\';goomPartnerId=\'GOOMRADIO\';goomAutoPlay=\'1\';goomGeoLocation=\'0\';goomPopUpMode=\'1\';goomAutoPopup=\'0\';goomCustomUI=\'baby\';goomOneStreamMode=\'1\';goomSyncMetadata=\'1\';goomJsUI=\'0\';goomBgColor=\'0\';goomWidth=\'473\';goomHeight=\'65\';goomPopWidth=\'473\';goomPopHeight=\'65\';goomFbLanguage=\'fr_FR\';goomFbCountFlag=\'standard\';goomFbOn=\'0\';goomTwtOn=\'0\';</script><script type="text/javascript" src="http://sunbear.goomradio.com/include.js"></script><p>Le Meilleur de la  <a href="http://www.goomradio.fr">Musique</a> sur Goom Radio</p>',
		radioId    : null,
		radioUid : null,
		radioSlug : null,
		radioDomainId : null,
		
		updateRadioInfo: function(radioInf){
			var me = GOOM.downloads.Update;
			me.radioId = radioInf.id;
			me.radioUid = radioInf.uid;
			me.radioSlug = radioInf.slug;
			me.radioDomainId = radioInf.domainId;
			var title_content = encodeURIComponent((SITE_ID==1? 'Check out ' : 'J\'ai découvert ')) + radioInf.name + (SITE_ID==1? ' on ' : ' sur ') + 'Goom Radio' ;
			var share_url = window.location.protocol + '//' + window.location.host + '/radio/' + radioInf.slug;
			var fbLink = replace(me.facebook, {link : share_url, title : title_content});
			var twitterLink = replace(me.twitter, {link : share_url, title : title_content});
			$('#fbShare').attr('href',fbLink);
			$('#fbShare').removeAttr('onclick');
			$('#twitterShare').attr('href',twitterLink);
			$('#twitterShare').removeAttr('onclick');
			$('#stationName').html(radioInf.name);
			$('#stationURL').html(share_url);
			$('#urlLabel').html('URL '+(SITE_ID==1? 'for ' : 'pour ')+radioInf.name+(SITE_ID==1? ':' : ' :'));
			$('#playList').html((SITE_ID==1? 'Click the icon of your music player and a small file will download to your computer. Double-click the file to listen to '+radioInf.name+' in your music player.' : 'Clique sur l\'ic&ocirc;ne de ton player externe et un petit fichier sera t&eacute;l&eacute;charg&eacute; sur ton ordinateur. Double clique sur le fichier pour &eacute;couter '+radioInf.name+' sur ton player externe. '));
			$('#streamUrl').html((SITE_ID==1? 'Streaming URL for ' : 'URL du flux pour ')+radioInf.name+(SITE_ID==1? ':' : ' :'));
			$('#popText').html((SITE_ID==1? 'Click the Flash icon to open the '+radioInf.name+' pop-up player' : 'Clique sur l\'ic&ocirc;ne Flash pour &eacute;couter '+radioInf.name+' avec le player en pop-up.'));
			$('#embedLabel').html((SITE_ID==1? 'Embed code for ' : 'Code &agrave; ins&eacute;rer pour &eacute;couter ')+radioInf.name+(SITE_ID==1? ':' : ' :'));
			var popPlayer = byId('playerPop');
			removeClass(popPlayer, 'popUpGray');
            addClass(popPlayer, 'allFlash');
			var store = window.getASSET();
			if(SITE_ID==1){
				$('#embedURL').val(replace(me.embedURLUs, {radioId : radioInf.id}));
			}else{
				$('#embedURL').val(replace(me.embedURLFr, {radioId : radioInf.id}));
			}
			
			if(radioInf.professional){
				GOOM.util.Request('GET' , replace(me.apiHeaderUrl, {radioId : radioInf.id}), { success : me.updateHeaderImage}, 10000);
			}else{
				$('#bgImageDownload').attr('style', 'background-image: url("../img/bg_download.png")');
			}
			GOOM.util.Request('GET' , replace(me.apiMountUrl, {radioId : radioInf.id}), { success : me.updateMountPoint}, 10000);
			
		},
		
		pLinkClassSw: function(from, to){
			var playerLinks = byId('playersCont').getElementsByTagName('a');
			removeClass(playerLinks, from);
            addClass(playerLinks, to);
		},
		
		updateHeaderImage: function(r){
			if(r.success){
				if(r.hasHeader){
					var store = window.getASSET();
					$('#bgImageDownload').attr('style', 'background-image: url("'+store+'/radio/'+GOOM.downloads.Update.radioUid+'_header")');
				}else{
					$('#bgImageDownload').attr('style', 'background-image: url("../img/bg_download.png")');
				}
			}else{
				$('#bgImageDownload').attr('style', 'background-image: url("../img/bg_download.png")');
			}	
		},
		
		updateMountPoint: function(r){
			var me = GOOM.downloads.Update;
			if(r.success){
				if(me.radioDomainId == 1){
					$('#stationURL2').html('http://us.goom.fm/'+me.radioSlug+'.mp3');
				}else{
					$('#stationURL2').html('http://fr.goom.fm/'+me.radioSlug+'.mp3');
				}
				var playlst = replace(GOOM.downloads.Update.apiPlaylistUrl, {radioId : me.radioId});
				me.pLinkClassSw('allPlayerGray','allPlayer');
				$('.allPlayer').attr('href',playlst);
				$('.allPlayer').unbind('click');
			}else{
				$('#stationURL2').html(_('SOON_AVAILABLE'));
				me.pLinkClassSw('allPlayer','allPlayerGray');
				$('.allPlayerGray').bind('click',function(){return false});
			}
		},
		
		fetchFromPLayer: function(radio){
			var i=setInterval(function(){
				if(GOOM.Audio.currentRadioObj != null){
		    	var radioInf = GOOM.Audio.currentRadioObj;
		    	if (!radio || (radio && radio == radioInf.id )){
			    	clearInterval(i);
			    	GOOM.downloads.Update.updateRadioInfo(radioInf);
				}
		    };},500);
		},
		
		initShareLinks: function(){
			var me = GOOM.downloads.Update;
			var share_url = window.location.protocol + '//' + window.location.host + '/radio/just-hits';
			var title_content=(SITE_ID==1? 'Check out ' : 'J\'ai découvert ') + 'just-hits' + (SITE_ID==1? ' on ' : ' sur ') + 'Goom Radio' ;
			$('.allPlayerGray').bind('click',function(){return false});
		},
		
		newPopUp: function(){
			var me = GOOM.downloads.Update;
			var popUrl = replace(me.playerPop, {radioId : me.radioId})
			if(me.radioId != null){
				popupWindow = window.open(
						popUrl,'popUpWindow','height=100,width=480,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes');
			}
		}

}/* $Id$ */

createNS('GOOM.showcase');

GOOM.showcase.FindByGenre = {
    displayResults : function(triggerEl, itemType, genreSlug) {
        GOOM.util.Get(triggerEl.href, function(result){
            var entriesHTML = [];
            if(itemType == 'show') {
                var itemList = result.shows;
            } else {
                itemList = result.radios;
            }
            byId('findByContainer').style.visibility = 'visible';
            if(!itemList) {
                byId('findByContainer').style.visibility = 'hidden';
                return;
            }

            var template = '<tr>' +
                               '<td class="' + itemType + 'Genre"><div>' +
                                   '<a class="radioIcon" title="play this ' + itemType + '" onclick="GOOM.Audio.playPodcast(\'%{id}\'); return false;" href="#">' +
                                       '<img src="' + getASSET() + '/' + itemType + '/%{uid}_logo/t2" onerror="defaultImg(this, \'/img/' + itemType + '_t2.jpg\')"/>' +
                                   '</a>' +
                                   '<a title="go to this show" onclick="GOOM.Navigation.load(this.href); return false;" href="/' + itemType + '/%{slug}">%{name}</a>' +
                               '</div></td>' +
                               '<td><div>%{slogan}</div></td>' +
                           '</tr>';
            for(var i = 0, len = itemList.length; i < len; i++) {
                entriesHTML.push(replace(template, itemList[i]));
            }

            var li = triggerEl.parentNode;

            removeClass(byId('findByMenu').getElementsByTagName("li"), 'active');

            li.className = 'active';
            byId('findByContainer').innerHTML =
                '<table>' +
                    '<tbody>' +
                        entriesHTML.join(' ') +
                    '</tbody>' +
                '</table>' +
                '<a href="/' + itemType + '/search?genreSlug=' + genreSlug + '&hot=true" onclick="GOOM.Navigation.load(this.href); return false;" class="allGenres">' +
                    _('SEE_ALL') +
                '</a>';
        });
    }
}
createNS('GOOM.show');

GOOM.show.Util = {
    initEpisodes : function() {
        var assetId = (GOOM.Audio.currentPodcastObj) ? GOOM.Audio.currentPodcastObj.assetMediaId : null;

        if(assetId) {
            var el = byId('showEpisode-' + assetId);
            if(el && !hasClass(el, 'nowPlaying')) {
                addClass(el, 'nowPlaying');
            }
        }        
    },

    playStopEpisode : function(assetId) {
        var el = byId('showEpisode-' + assetId);
        if(GOOM.Audio.currentPodcastObj && assetId == GOOM.Audio.currentPodcastObj.assetMediaId) {
            if(el && hasClass(el, 'nowPlaying')) {
                removeClass(el, 'nowPlaying');
                GOOM.Audio.stop();
            }
        } else {
            if(el && !hasClass(el, 'nowPlaying')) {
                this.disableAllButtons();
                addClass(el, 'nowPlaying');

                GOOM.Audio.playPodcast(assetId, window.showObj || window.featuredShowObj);
            }
        }
    },

    disableAllButtons : function() {
        var links = byId("archivedShows").getElementsByTagName('a');

        for(var i = 0, len = links.length; i < len; ++i) {
            if (hasClass(links[i], 'nowPlaying')) {
                removeClass(links[i], 'nowPlaying');
            }
        }
    }
};
(function() {
    GOOM.Navigation.Events.onPageReady.subscribe(function() 
	{
		// autoplayRadioId is taken into account only if after a #
		var hashIndex = window.location.href.indexOf('#');
		if (hashIndex != -1
			&& hashIndex < window.location.href.indexOf('autoplayRadioId'))
		{
	        var param = window.location.href.match(/autoplayRadioId=\d{1,}/);
	        if (param && param[0]) {
	    		var radioId = param[0].split("=").pop();
	            if (radioId && radioId != GOOM.Audio.currentRadioObj.id) {
	                GOOM.Audio.playRadio(radioId);
	            }
	    	}
	    }
    });
})();
/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version jQueryId: LikeBox.js 21378 2010-08-20 16:11:24Z Stefen ALPER jQuery
 */

createNS('GOOM.facebook');

/**
 * Generates a facebook likebox and inject it in the DOM.
 */
GOOM.facebook.LikeBox = {
    /**
     * The object default options.
     * @var {Object}
     */
    options: {
        width: 292, // The box width
        height: 255, // The box height
        id: '', // The box facebook page Id
        connections: 10, // The number of connecitons to display
        stream: 'false',
        header: 'false',
        country: 'us'
    },

    /**
     * Displays the facebook like box.
     * @method display
     * @param {JQuery} The DOM Container
     * @param {Object} The object options
     */
    display: function(container, options) {
        var mergedOptions = {};
        jQuery.extend(true, mergedOptions, this.options, options);

        container.css({
            width: mergedOptions.width + 'px',
            height: mergedOptions.height + 'px'
        }).append(
            jQuery('<iframe/>')
                .attr('src',
                    replace('http://www.facebook.%{country}/plugins/likebox.php', { country: mergedOptions.country })
                    + '?' + jQuery.param(mergedOptions))
                .attr('allowTransparency', 'true')
                .attr('scrolling', 'no')
                .attr('frameborder', '0')
                .css({
                    backgroundColor: '#FFF',
                    border: 'none',
                    overflow: 'hidden',
                    width: mergedOptions.width + 'px',
                    height: mergedOptions.height + 'px'
                })
        );
    }
};/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: Instance.js 21694 2010-09-03 13:08:14Z Carlo Pescetelli $
 */

createNS('GOOM.externalplayer');

/**
 * Provides a generic interface for the GOOM.externalplayer.Manager.
 * @param the player DOM element element
 * @param GOOM.externalplayer.Adapter The payer API implementation
 */
GOOM.externalplayer.Instance = function(element, adapter) {
    /**
     * Returns the player DOM element.
     * @method getElement
     * @return HTMLDOMElement
     */
    this.getElement = function() {
        return element;
    };

    /**
     * Convenient function to compare two players.
     * @method equals
     * @param GOOM.externalplayer.Instance instance
     * @return bool
     */
    this.equals = function(instance) {
        return instance && instance.getElement && instance.getElement().id == element.id;
    };

    /**
     * Checks if the player is currently playing.
     * @method isPlaying
     * @return bool
     */
    this.isPlaying = function() {
        return adapter.isPlaying(this);
    }

    /**
     * Stops the player.
     * @method stop
     */
    this.stop = function() {
        adapter.stop(this);
    }
}
/**
 * @package Goom
 * @category Goom
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: Manager.js 25965 2011-02-08 13:55:58Z Bogdan Busuioc $
 */

createNS('GOOM.externalplayer');

/**
 * Manages external players streams concurrencies.
 */
GOOM.externalplayer.Manager = {
    /**
     * The current player instance.
     */
    currentPlayer: null,

    /**
     * Resets the manager.
     * @method reset
     */
    reset: function() {
        this.stopCurrentPlayer();
        this.currentPlayer = null;
    },

    /**
     * Stop the current player if any.
     * @method stopCurrentPlayer
     */
    stopCurrentPlayer: function() {
        if (this.currentPlayer && this.currentPlayer.isPlaying()) {
            this.currentPlayer.stop();
        }
    },

    /**
     * Event listener for player changes.
     * @method onStateChange
     * @param GOOM.externalplayer.Instance player
     */
    onStateChange: function(player,state,daily) {
    	if (state==1 || (state==5 && daily)) { 
            if (this.currentPlayer && !player.equals(this.currentPlayer)) {
                this.currentPlayer.stop();
            }
            this.currentPlayer = player;
            GOOM.Audio.mute();
        } else if (player.equals(this.currentPlayer)) {
        	GOOM.Audio.unMute();
        }
    }
}

GOOM.Navigation.Events.onPageChange.subscribe(function(e) {
    GOOM.externalplayer.Manager.reset();
});

GOOM.Audio.Events.onRadioChange.subscribe(function(e) {
    GOOM.externalplayer.Manager.stopCurrentPlayer();
});

GOOM.Audio.Events.onPodcastChange.subscribe(function(e) {
    GOOM.externalplayer.Manager.stopCurrentPlayer();
});

GOOM.Audio.Events.onPlaybackStart.subscribe(function(e) {
    GOOM.externalplayer.Manager.stopCurrentPlayer();
});

GOOM.Audio.Events.onNextSong.subscribe(function(e) {
    if(this.currentPlayer && !this.currentPlayer.isPlaying()) GOOM.externalplayer.Manager.stopCurrentPlayer();
});/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: Adapter.js 21694 2010-09-03 13:08:14Z Carlo Pescetelli $
 */

createNS('GOOM.externalplayer');

/**
 *
 */
GOOM.externalplayer.Adapter = function() {
    /**
     * Checks if the player is currently playing.
     * @method isPlaying
     * @param GOOM.externalplayer.Instance
     * @return bool
     */
    this.isPlaying = function(player) {
        throw "Must be implemented";
    };

    /**
     * Stops the player.
     * @method stop
     * @param GOOM.externalplayer.Instance
     */
    this.stop = function(player) {
        throw "Must be implemented";
    }
}/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: YoutubeAdapter.js 25965 2011-02-08 13:55:58Z Bogdan Busuioc $
 */

createNS('GOOM.externalplayer');

/**
 * The Youtube API adapter.
 */
GOOM.externalplayer.YoutubeAdapter = GOOM.util.extend(GOOM.externalplayer.Adapter, {
    /**
     * Defines player states.
     */
    STATE_UNSTARTED: -1,
    STATE_ENDED: 0,
    STATE_PLAYING: 1,
    STATE_PAUSED: 2,
    STATE_BUFFERING: 3,
    STATE_CUED: 5,

    /**
     * Holds the player listeners (to hold a player reference).
     * @var Object
     */
    playerEventListeners: {},

    /**
     * Implements GOOM.externalplayer.Adapter
     * @method isPlaying
     * @param GOOM.externalplayer.Instance
     */
    isPlaying: function(player) {
        return this.STATE_PLAYING == player.getElement().getPlayerState();
    },

    /**
     * Implements GOOM.externalplayer.Adapter
     * @method stop
     * @param GOOM.externalplayer.Instance
     */
    stop: function(player) {
        player.getElement().pauseVideo();
    },

    /**
     * Called when a player is loaded.
     * @method onPlayerReady
     * @param string the player ID
     */
    onPlayerReady: function(playerId) {
        playerId = decodeURI(playerId);
        var player = new GOOM.externalplayer.Instance(byId(playerId), this);
        var escapedPlayerId = playerId.replace(/[^a-zA-Z0-9_]+/g, "_");

        this.playerEventListeners[escapedPlayerId] = function(state) {
            GOOM.externalplayer.Manager.onStateChange(player,state,false);
        }
        player.getElement().addEventListener("onStateChange",
            'GOOM.externalplayer.YoutubeAdapter.playerEventListeners.' + escapedPlayerId);
    }
});

/**
 * Entry point of the Youtube API.
 */
function onYouTubePlayerReady(playerId) {
    GOOM.externalplayer.YoutubeAdapter.onPlayerReady(playerId);
}
/**
 * @package Goom
 * @category
 * @author salper <salper@goomradio.com>
 * @copyright Copyright (c) 2010 Goomradio
 * @version $Id: DailymotionAdapter.js 25965 2011-02-08 13:55:58Z Bogdan Busuioc $
 */

createNS('GOOM.externalplayer');

/**
 * The Dailymotion API adapter.
 */
GOOM.externalplayer.DailymotionAdapter = GOOM.util.extend(GOOM.externalplayer.Adapter, {
    /**
     * Defines player states.
     */
    STATE_UNSTARTED: -1,
    STATE_ENDED: 0,
    STATE_PLAYING: 1,
    STATE_PAUSED: 2,
    STATE_CUED: 5,

    /**
     * Holds the player listeners (to hold a player reference).
     * @var Object
     */
    playerEventListeners: {},

    /**
     * Implements GOOM.externalplayer.Adapter
     * @method isPlaying
     * @param GOOM.externalplayer.Instance
     */
    isPlaying: function(player) {
    	return this.STATE_PLAYING == player.getElement().getPlayerState();
    },

    /**
     * Implements GOOM.externalplayer.Adapter
     * @method stop
     * @param GOOM.externalplayer.Instance
     */
    stop: function(player) {
        player.getElement().pauseVideo();
    },

    /**
     * Called when a player is loaded.
     * @method onPlayerReady
     * @param string the player ID
     */
    onPlayerReady: function(playerId) {
        playerId = decodeURI(playerId);
        var player = new GOOM.externalplayer.Instance(byId(playerId), this);
        var escapedPlayerId = playerId.replace(/[^a-zA-Z0-9_]+/g, "_");
        this.playerEventListeners[escapedPlayerId] = function(state) {
            GOOM.externalplayer.Manager.onStateChange(player,state,true);
        }
        player.getElement().addEventListener("onStateChange",
            'GOOM.externalplayer.DailymotionAdapter.playerEventListeners.' + escapedPlayerId);
    }
});

/**
 * Entry point of the Dailymotion API.
 */
function onDailymotionPlayerReady(playerId) {
    GOOM.externalplayer.DailymotionAdapter.onPlayerReady(playerId);
}/*!
 * jQuery JavaScript Library v1.4.1
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Mon Jan 25 19:43:33 2010 -0500
 */
(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n<j;n++)e(a[n],b,f?d.call(a[n],n,e(a[n],b)):d,i);return a}return j?
e(a[0],b):null}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function ma(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function na(a){var b,d=[],f=[],e=arguments,i,j,n,o,m,s,x=c.extend({},c.data(this,"events").live);if(!(a.button&&a.type==="click")){for(o in x){j=x[o];if(j.live===a.type||j.altLive&&c.inArray(a.type,j.altLive)>-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f,
a.currentTarget);m=0;for(s=i.length;m<s;m++)for(o in x){j=x[o];n=i[m].elem;f=null;if(i[m].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==n)d.push({elem:n,fn:j})}}m=0;for(s=d.length;m<s;m++){i=d[m];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}}function oa(a,b){return"live."+(a?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function pa(a){return!a||!a.parentNode||a.parentNode.nodeType===
11}function qa(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ra(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0&&(c.support.checkClone||!sa.test(a[0]))){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r;f=b.createDocumentFragment();
c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=i?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(ta.concat.apply([],ta.slice(0,b)),function(){d[this]=a});return d}function ua(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Na=z.jQuery,Oa=z.$,r=z.document,S,Pa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent,
va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]],
[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a,
this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this,
a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};
c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(i in e){j=a[i];n=e[i];if(a!==n)if(f&&n&&(c.isPlainObject(n)||c.isArray(n))){j=j&&(c.isPlainObject(j)||c.isArray(j))?j:c.isArray(n)?[]:{};a[i]=c.extend(f,j,n)}else if(n!==v)a[i]=n}return a};c.extend({noConflict:function(a){z.$=
Oa;if(a)z.jQuery=Na;return c},isReady:false,ready:function(){if(!c.isReady){if(!r.body)return setTimeout(c.ready,13);c.isReady=true;if(P){for(var a,b=0;a=P[b++];)a.call(r,c);P=null}c.fn.triggerHandler&&c(r).triggerHandler("ready")}},bindReady:function(){if(!va){va=true;if(r.readyState==="complete")return c.ready();if(r.addEventListener){r.addEventListener("DOMContentLoaded",L,false);z.addEventListener("load",c.ready,false)}else if(r.attachEvent){r.attachEvent("onreadystatechange",L);z.attachEvent("onload",
c.ready);var a=false;try{a=z.frameElement==null}catch(b){}r.documentElement.doScroll&&a&&la()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,"isPrototypeOf"))return false;var b;for(b in a);return b===v||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;
return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
r.documentElement,d=r.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(r.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,i=a.length,j=i===v||c.isFunction(a);if(d)if(j)for(f in a){if(b.apply(a[f],d)===false)break}else for(;e<i;){if(b.apply(a[e++],d)===false)break}else if(j)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=
a[0];e<i&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Sa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==
v;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,i=a.length;e<i;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,i=0,j=a.length;i<j;i++){e=b(a[i],i,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=v}else if(b&&!c.isFunction(b)){d=b;b=v}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},
uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});O=c.uaMatch(O);if(O.browser){c.browser[O.browser]=true;c.browser.version=O.version}if(c.browser.webkit)c.browser.safari=true;if(wa)c.inArray=function(a,b){return wa.call(b,a)};S=c(r);if(r.addEventListener)L=function(){r.removeEventListener("DOMContentLoaded",
L,false);c.ready()};else if(r.attachEvent)L=function(){if(r.readyState==="complete"){r.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=r.documentElement,b=r.createElement("script"),d=r.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support=
{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};
b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=r.createDocumentFragment();a.appendChild(d.firstChild);
c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props=
{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true,
{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,
a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);
return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||
a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=
c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className)for(var i=" "+e.className+" ",j=0,n=b.length;j<n;j++){if(i.indexOf(" "+b[j]+" ")<0)e.className+=" "+b[j]}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var m=c(this);m.removeClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(ca),
d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var i=(" "+e.className+" ").replace(ya," "),j=0,n=b.length;j<n;j++)i=i.replace(" "+b[j]+" "," ");e.className=i.substring(1,i.length-1)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var i=c(this);i.toggleClass(a.call(this,e,i.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,i=0,j=c(this),n=b,o=
a.split(ca);e=o[i++];){n=f?n:!j.hasClass(e);j[n?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(ya," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||
{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i<d;i++){var j=e[i];if(j.selected){a=c(j).val();if(b)return a;f.push(a)}}return f}if(za.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Wa,"")}return v}var n=c.isFunction(a);return this.each(function(o){var m=c(this),s=a;if(this.nodeType===1){if(n)s=a.call(this,o,m.val());
if(typeof s==="number")s+="";if(c.isArray(s)&&za.test(this.type))this.checked=c.inArray(m.val(),s)>=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d);
f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=
""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j=
function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a,
d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+
s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a,
"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,
b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b,
d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b=
0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};
c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b=
a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this,
"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"||
d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a=
a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,
f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a,
b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+
a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e){var i,j=0;if(c.isFunction(f)){e=f;f=v}for(d=(d||"").split(/\s+/);(i=d[j++])!=null;){i=i==="focus"?"focusin":i==="blur"?"focusout":i==="hover"?d.push("mouseleave")&&"mouseenter":i;b==="live"?c(this.context).bind(oa(i,this.selector),{data:f,selector:this.selector,
live:i},e):c(this.context).unbind(oa(i,this.selector),e?{guid:e.guid+this.selector+i}:null)}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});z.attachEvent&&!z.addEventListener&&z.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g){for(var h="",k,l=0;g[l];l++){k=g[l];if(k.nodeType===3||k.nodeType===4)h+=k.nodeValue;else if(k.nodeType!==8)h+=a(k.childNodes)}return h}function b(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===k){y=l[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=k;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}l[q]=y}}}function d(g,h,k,l,q,p){q=0;for(var u=l.length;q<u;q++){var t=l[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===
k){y=l[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=k;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(o.filter(h,[t]).length>0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||
typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u=
l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&
y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};o.matches=function(g,h){return o(g,null,null,h)};o.find=function(g,h,k){var l,q;if(!g)return[];for(var p=0,u=m.order.length;p<u;p++){var t=m.order[p];if(q=m.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");l=m.find[t](q,
h,k);if(l!=null){g=g.replace(m.match[t],"");break}}}}l||(l=h.getElementsByTagName("*"));return{set:l,expr:g}};o.filter=function(g,h,k,l){for(var q=g,p=[],u=h,t,y,R=h&&h[0]&&w(h[0]);g&&h.length;){for(var H in m.filter)if((t=m.leftMatch[H].exec(g))!=null&&t[2]){var M=m.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(u===p)p=[];if(m.preFilter[H])if(t=m.preFilter[H](t,u,k,p,l,R)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=u[U])!=null;U++)if(D){I=M(D,t,U,u);var Da=
l^!!I;if(k&&I!=null)if(Da)y=true;else u[U]=false;else if(Da){p.push(D);y=true}}if(I!==v){k||(u=p);g=g.replace(m.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)o.error(g);else break;q=g}return u};o.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var m=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,h){var k=typeof h==="string",l=k&&!/\W/.test(h);k=k&&!l;if(l)h=h.toLowerCase();l=0;for(var q=g.length,
p;l<q;l++)if(p=g[l]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[l]=k||p&&p.nodeName.toLowerCase()===h?p||false:p===h}k&&o.filter(h,g,true)},">":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l<q;l++){var p=g[l];if(p){k=p.parentNode;g[l]=k.nodeName.toLowerCase()===h?k:false}}}else{l=0;for(q=g.length;l<q;l++)if(p=g[l])g[l]=k?p.parentNode:p.parentNode===h;k&&o.filter(h,g,true)}},"":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=
h=h.toLowerCase();q=b}q("parentNode",h,l,g,p,k)},"~":function(g,h,k){var l=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,l,g,p,k)}},find:{ID:function(g,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var k=[];h=h.getElementsByName(g[1]);for(var l=0,q=h.length;l<q;l++)h[l].getAttribute("name")===g[1]&&k.push(h[l]);return k.length===0?null:k}},
TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,k,l,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var u;(u=h[p])!=null;p++)if(u)if(q^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&
"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);
return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===
g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2===
0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return h<k[3]-0},gt:function(g,h,k){return h>k[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k<l;k++)if(h[k]===g)return false;return true}else o.error("Syntax error, unrecognized expression: "+
q)},CHILD:function(g,h){var k=h[1],l=g;switch(k){case "only":case "first":for(;l=l.previousSibling;)if(l.nodeType===1)return false;if(k==="first")return true;l=g;case "last":for(;l=l.nextSibling;)if(l.nodeType===1)return false;return true;case "nth":k=h[2];var q=h[3];if(k===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var u=0;for(l=p.firstChild;l;l=l.nextSibling)if(l.nodeType===1)l.nodeIndex=++u;p.sizcache=h}g=g.nodeIndex-q;return k===0?g===0:g%k===0&&g/k>=
0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="?
k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};
try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k<l;k++)h.push(g[k]);else for(k=0;g[k];k++)h.push(g[k]);return h}}var C;if(r.documentElement.compareDocumentPosition)C=function(g,h){if(!g.compareDocumentPosition||!h.compareDocumentPosition){if(g==h)j=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===
h?0:1;if(g===0)j=true;return g};else if("sourceIndex"in r.documentElement)C=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)j=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)j=true;return g};else if(r.createRange)C=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)j=true;return g.ownerDocument?-1:1}var k=g.ownerDocument.createRange(),l=h.ownerDocument.createRange();k.setStart(g,0);k.setEnd(g,0);l.setStart(h,0);l.setEnd(h,0);g=k.compareBoundaryPoints(Range.START_TO_END,
l);if(g===0)j=true;return g};(function(){var g=r.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id");
return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href",
2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[],
l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)o(g,h[q],k);return o.filter(l,k)};c.find=o;c.expr=o.selectors;c.expr[":"]=c.expr.filters;c.unique=o.uniqueSort;c.getText=a;c.isXMLDoc=w;c.contains=E})();var bb=/Until$/,cb=/^(?:parents|prevUntil|prevAll)/,db=/,/;Q=Array.prototype.slice;var Ea=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,i){return!!b.call(e,i,e)===d});else if(b.nodeType)return c.grep(a,
function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Qa.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;c.find(a,this[f],b);if(f>0)for(var i=d;i<b.length;i++)for(var j=0;j<d;j++)if(b[j]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=
0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ea(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ea(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e<n;e++){j=a[e];i[j]||(i[j]=c.expr.match.POS.test(j)?c(j,b||this.context):j)}for(;f&&f.ownerDocument&&f!==b;){for(j in i){e=i[j];if(e.jquery?e.index(f)>
-1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),
a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},
nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):
e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==
b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&\w+;/,sa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ia=function(a,b,d){return eb.test(d)?a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],
col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)},
wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?
d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,
false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&
!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/<script/i.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(Ha.exec(a)||
["",""])[1].toLowerCase()]){a=a.replace(Ga,Ia);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var i=c(this),j=i.html();i.empty().append(function(){return a.call(this,e,j)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,
b,f))});else a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(s){return c.nodeName(s,"table")?s.getElementsByTagName("tbody")[0]||s.appendChild(s.ownerDocument.createElement("tbody")):s}var e,i,j=a[0],n=[];if(!c.support.checkClone&&arguments.length===3&&typeof j===
"string"&&sa.test(j))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(j))return this.each(function(s){var x=c(this);a[0]=j.call(this,s,b?x.html():v);x.domManip(a,b,d)});if(this[0]){e=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:ra(a,this,n);if(i=e.fragment.firstChild){b=b&&c.nodeName(i,"tr");for(var o=0,m=this.length;o<m;o++)d.call(b?f(this[o],i):this[o],e.cacheable||this.length>1||o>0?e.fragment.cloneNode(true):e.fragment)}n&&c.each(n,
Ma)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);for(var e=0,i=d.length;e<i;e++){var j=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),j);f=f.concat(j)}return this.pushStack(f,a,d.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a,[this]).length){if(!b&&this.nodeType===1){c.cleanData(this.getElementsByTagName("*"));c.cleanData([this])}this.parentNode&&
this.parentNode.removeChild(this)}},empty:function(){for(this.nodeType===1&&c.cleanData(this.getElementsByTagName("*"));this.firstChild;)this.removeChild(this.firstChild)}},function(a,b){c.fn[a]=function(){return this.each(b,arguments)}});c.extend({clean:function(a,b,d,f){b=b||r;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||r;var e=[];c.each(a,function(i,j){if(typeof j==="number")j+="";if(j){if(typeof j==="string"&&!gb.test(j))j=b.createTextNode(j);else if(typeof j===
"string"){j=j.replace(Ga,Ia);var n=(Ha.exec(j)||["",""])[1].toLowerCase(),o=F[n]||F._default,m=o[0];i=b.createElement("div");for(i.innerHTML=o[1]+j+o[2];m--;)i=i.lastChild;if(!c.support.tbody){m=fb.test(j);n=n==="table"&&!m?i.firstChild&&i.firstChild.childNodes:o[1]==="<table>"&&!m?i.childNodes:[];for(o=n.length-1;o>=0;--o)c.nodeName(n[o],"tbody")&&!n[o].childNodes.length&&n[o].parentNode.removeChild(n[o])}!c.support.leadingWhitespace&&V.test(j)&&i.insertBefore(b.createTextNode(V.exec(j)[0]),i.firstChild);
j=c.makeArray(i.childNodes)}if(j.nodeType)e.push(j);else e=c.merge(e,j)}});if(d)for(a=0;e[a];a++)if(f&&c.nodeName(e[a],"script")&&(!e[a].type||e[a].type.toLowerCase()==="text/javascript"))f.push(e[a].parentNode?e[a].parentNode.removeChild(e[a]):e[a]);else{e[a].nodeType===1&&e.splice.apply(e,[a+1,0].concat(c.makeArray(e[a].getElementsByTagName("script"))));d.appendChild(e[a])}return e},cleanData:function(a){for(var b=0,d;(d=a[b])!=null;b++){c.event.remove(d);c.removeData(d)}}});var hb=/z-?index|font-?weight|opacity|zoom|line-?height/i,
Ja=/alpha\([^)]*\)/,Ka=/opacity=([^)]*)/,ga=/float/i,ha=/-([a-z])/ig,ib=/([A-Z])/g,jb=/^-?\d+(?:px)?$/i,kb=/^-?\d/,lb={position:"absolute",visibility:"hidden",display:"block"},mb=["Left","Right"],nb=["Top","Bottom"],ob=r.defaultView&&r.defaultView.getComputedStyle,La=c.support.cssFloat?"cssFloat":"styleFloat",ia=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===v)return c.curCSS(d,f);if(typeof e==="number"&&!hb.test(f))e+="px";c.style(d,f,e)})};
c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(d)<0)d=v;var f=a.style||a,e=d!==v;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Ja.test(a)?a.replace(Ja,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Ka.exec(f.filter)[1])/100+"":""}if(ga.test(b))b=La;b=b.replace(ha,ia);if(e)f[b]=d;return f[b]},css:function(a,
b,d,f){if(b==="width"||b==="height"){var e,i=b==="width"?mb:nb;function j(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(i,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==0?j():c.swap(a,lb,j);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&
a.currentStyle){f=Ka.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ga.test(b))b=La;if(!d&&e&&e[b])f=e[b];else if(ob){if(ga.test(b))b="float";b=b.replace(ib,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ha,ia);f=a.currentStyle[b]||a.currentStyle[d];if(!jb.test(f)&&kb.test(f)){b=e.left;var i=a.runtimeStyle.left;a.runtimeStyle.left=
a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=i}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var pb=
J(),qb=/<script(.|\s)*?\/script>/gi,rb=/select|textarea/i,sb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ja=/\?/,tb=/(\?|&)_=.*?(&|$)/,ub=/^(\w+:)?\/\/([^\/?#]+)/,vb=/%20/g;c.fn.extend({_load:c.fn.load,load:function(a,b,d){if(typeof a!=="string")return this._load(a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=
c.param(b,c.ajaxSettings.traditional);f="POST"}var i=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(j,n){if(n==="success"||n==="notmodified")i.html(e?c("<div />").append(j.responseText.replace(qb,"")).find(e):j.responseText);d&&i.each(d,[j.responseText,n,j])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&
(this.checked||rb.test(this.nodeName)||sb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,
b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:z.XMLHttpRequest&&(z.location.protocol!=="file:"||!z.ActiveXObject)?function(){return new z.XMLHttpRequest}:
function(){try{return new z.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&e.success.call(o,n,j,w);e.global&&f("ajaxSuccess",[w,e])}function d(){e.complete&&e.complete.call(o,w,j);e.global&&f("ajaxComplete",[w,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}
function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),i,j,n,o=a&&a.context||e,m=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(m==="GET")N.test(e.url)||(e.url+=(ja.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||
N.test(e.url))){i=e.jsonpCallback||"jsonp"+pb++;if(e.data)e.data=(e.data+"").replace(N,"="+i+"$1");e.url=e.url.replace(N,"="+i+"$1");e.dataType="script";z[i]=z[i]||function(q){n=q;b();d();z[i]=v;try{delete z[i]}catch(p){}A&&A.removeChild(B)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===false&&m==="GET"){var s=J(),x=e.url.replace(tb,"$1_="+s+"$2");e.url=x+(x===e.url?(ja.test(e.url)?"&":"?")+"_="+s:"")}if(e.data&&m==="GET")e.url+=(ja.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&
c.event.trigger("ajaxStart");s=(s=ub.exec(e.url))&&(s[1]&&s[1]!==location.protocol||s[2]!==location.host);if(e.dataType==="script"&&m==="GET"&&s){var A=r.getElementsByTagName("head")[0]||r.documentElement,B=r.createElement("script");B.src=e.url;if(e.scriptCharset)B.charset=e.scriptCharset;if(!i){var C=false;B.onload=B.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;b();d();B.onload=B.onreadystatechange=null;A&&B.parentNode&&
A.removeChild(B)}}}A.insertBefore(B,A.firstChild);return v}var E=false,w=e.xhr();if(w){e.username?w.open(m,e.url,e.async,e.username,e.password):w.open(m,e.url,e.async);try{if(e.data||a&&a.contentType)w.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[e.url]);c.etag[e.url]&&w.setRequestHeader("If-None-Match",c.etag[e.url])}s||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",
e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(fa){}if(e.beforeSend&&e.beforeSend.call(o,w,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");w.abort();return false}e.global&&f("ajaxSend",[w,e]);var g=w.onreadystatechange=function(q){if(!w||w.readyState===0||q==="abort"){E||d();E=true;if(w)w.onreadystatechange=c.noop}else if(!E&&w&&(w.readyState===4||q==="timeout")){E=true;w.onreadystatechange=c.noop;j=q==="timeout"?"timeout":!c.httpSuccess(w)?
"error":e.ifModified&&c.httpNotModified(w,e.url)?"notmodified":"success";var p;if(j==="success")try{n=c.httpData(w,e.dataType,e)}catch(u){j="parsererror";p=u}if(j==="success"||j==="notmodified")i||b();else c.handleError(e,w,j,p);d();q==="timeout"&&w.abort();if(e.async)w=null}};try{var h=w.abort;w.abort=function(){w&&h.call(w);g("abort")}}catch(k){}e.async&&e.timeout>0&&setTimeout(function(){w&&!E&&g("timeout")},e.timeout);try{w.send(m==="POST"||m==="PUT"||m==="DELETE"?e.data:null)}catch(l){c.handleError(e,
w,null,l);d()}e.async||g();return w}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=
f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(j,n){if(c.isArray(n))c.each(n,
function(o,m){b?f(j,m):d(j+"["+(typeof m==="object"||c.isArray(m)?o:"")+"]",m)});else!b&&n!=null&&typeof n==="object"?c.each(n,function(o,m){d(j+"["+o+"]",m)}):f(j,n)}function f(j,n){n=c.isFunction(n)?n():n;e[e.length]=encodeURIComponent(j)+"="+encodeURIComponent(n)}var e=[];if(b===v)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var i in a)d(i,a[i]);return e.join("&").replace(vb,"+")}});var ka={},wb=/toggle|show|hide/,xb=/^([+-]=)?([\d+-.]+)(.*)$/,
W,ta=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(ka[d])f=ka[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();
ka[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&
c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var i=c.extend({},e),j,n=this.nodeType===1&&c(this).is(":hidden"),
o=this;for(j in a){var m=j.replace(ha,ia);if(j!==m){a[m]=a[j];delete a[j];j=m}if(a[j]==="hide"&&n||a[j]==="show"&&!n)return i.complete.call(this);if((j==="height"||j==="width")&&this.style){i.display=c.css(this,"display");i.overflow=this.style.overflow}if(c.isArray(a[j])){(i.specialEasing=i.specialEasing||{})[j]=a[j][1];a[j]=a[j][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=c.extend({},a);c.each(a,function(s,x){var A=new c.fx(o,i,s);if(wb.test(x))A[x==="toggle"?n?"show":"hide":x](a);
else{var B=xb.exec(x),C=A.cur(true)||0;if(B){x=parseFloat(B[2]);var E=B[3]||"px";if(E!=="px"){o.style[s]=(x||1)+E;C=(x||1)/A.cur(true)*C;o.style[s]=C+E}if(B[1])x=(B[1]==="-="?-1:1)*x+C;A.custom(C,x,E)}else A.custom(C,x,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",
1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,
b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==
null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(i){return e.step(i)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop===
"width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=
this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=
c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=
null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in r.documentElement?function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),
f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=
b,e=b.ownerDocument,i,j=e.documentElement,n=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var o=b.offsetTop,m=b.offsetLeft;(b=b.parentNode)&&b!==n&&b!==j;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;i=e?e.getComputedStyle(b,null):b.currentStyle;o-=b.scrollTop;m-=b.scrollLeft;if(b===d){o+=b.offsetTop;m+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){o+=parseFloat(i.borderTopWidth)||
0;m+=parseFloat(i.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){o+=parseFloat(i.borderTopWidth)||0;m+=parseFloat(i.borderLeftWidth)||0}f=i}if(f.position==="relative"||f.position==="static"){o+=n.offsetTop;m+=n.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){o+=Math.max(j.scrollTop,n.scrollTop);m+=Math.max(j.scrollLeft,n.scrollLeft)}return{top:o,left:m}};c.offset={initialize:function(){var a=r.body,b=r.createElement("div"),
d,f,e,i=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);
d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);c.offset.initialize=c.noop},
bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),i=parseInt(c.curCSS(a,"top",true),10)||0,j=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,d,e);d={top:b.top-e.top+i,left:b.left-
e.left+j};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=
this.offsetParent||r.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],i;if(!e)return null;if(f!==v)return this.each(function(){if(i=ua(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[d]=f});else return(i=ua(e))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[d]||i.document.body[d]:e[d]}});
c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(i){var j=c(this);j[d](f.call(this,i,j[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||
e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===v?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});z.jQuery=z.$=c})(window);
/*!
 * jQuery UI 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.4",plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,
b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,
CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable",
"off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none")},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=
parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c.style(this,h,d(this,f)+"px")})};c.fn["outer"+
b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c.style(this,h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==
b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){var k=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return k.call(b(this),a,c)})};b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);
b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):
this.each(function(){var g=b.data(this,a);if(g){d&&g.option(d);g._init()}else b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});
this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}b.each(d,function(f,
h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=
b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*
 * jQuery UI Tabs 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(a,e){if(a=="selected")this.options.collapsible&&
e==this.options.selected||this.select(e);else{this.options[a]=e;this._tabify()}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var a=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[a].concat(d.makeArray(arguments)))},_ui:function(a,e){return{tab:a,panel:e,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var a=
d(this);a.html(a.data("label.tabs")).removeData("label.tabs")})},_tabify:function(a){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var b=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var j=d(f).attr("href"),l=j.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
(q=d("base")[0])&&l===q.href)){j=f.hash;f.href=j}if(h.test(j))b.panels=b.panels.add(b._sanitizeSelector(j));else if(j!=="#"){d.data(f,"href.tabs",j);d.data(f,"load.tabs",j.replace(/#.*$/,""));j=b._tabId(f);f.href="#"+j;f=d("#"+j);if(!f.length){f=d(c.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(b.panels[g-1]||b.list);f.data("destroy.tabs",true)}b.panels=b.panels.add(f)}else c.disabled.push(g)});if(a){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(b._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return b.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
if(c.selected>=0&&this.anchors.length){this.panels.eq(c.selected).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");b.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[c.selected],b.panels[c.selected]))});this.load(c.selected)}d(window).bind("unload",function(){b.lis.add(b.anchors).unbind(".tabs");b.lis=b.anchors=b.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));this.element[c.collapsible?"addClass":
"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);a=0;for(var i;i=this.lis[a];a++)d(i)[d.inArray(a,c.disabled)!=-1&&!d(i).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+g)};this.lis.bind("mouseover.tabs",
function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",function(){e(f,o);b._trigger("show",
null,b._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");b._trigger("show",null,b._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){b.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);b.element.dequeue("tabs")})}:function(g,f){b.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");b.element.dequeue("tabs")};this.anchors.bind(c.event+".tabs",
function(){var g=this,f=d(g).closest("li"),j=b.panels.filter(":not(.ui-tabs-hide)"),l=d(b._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||b._trigger("select",null,b._ui(this,l[0]))===false){this.blur();return false}c.selected=b.anchors.index(this);b.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=-1;c.cookie&&b._cookie(c.selected,c.cookie);b.element.queue("tabs",function(){s(g,
j)}).dequeue("tabs");this.blur();return false}else if(!j.length){c.cookie&&b._cookie(c.selected,c.cookie);b.element.queue("tabs",function(){r(g,l)});b.load(b.anchors.index(this));this.blur();return false}c.cookie&&b._cookie(c.selected,c.cookie);if(l.length){j.length&&b.element.queue("tabs",function(){s(g,j)});b.element.queue("tabs",function(){r(g,l)});b.load(b.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",
function(){return false})},_getIndex:function(a){if(typeof a=="string")a=this.anchors.index(this.anchors.filter("[href$="+a+"]"));return a},destroy:function(){var a=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=d.data(this,"href.tabs");if(e)this.href=
e;var b=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){b.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});a.cookie&&this._cookie(null,a.cookie);return this},add:function(a,e,b){if(b===p)b=this.anchors.length;
var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,a).replace(/#\{label\}/g,e));a=!a.indexOf("#")?a.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var i=d("#"+a);i.length||(i=d(h.panelTemplate).attr("id",a).data("destroy.tabs",true));i.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(b>=this.lis.length){e.appendTo(this.list);i.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[b]);
i.insertBefore(this.panels[b])}h.disabled=d.map(h.disabled,function(k){return k>=b?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");i.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[b],this.panels[b]));return this},remove:function(a){a=this._getIndex(a);var e=this.options,b=this.lis.eq(a).remove(),c=this.panels.eq(a).remove();
if(b.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(a+(a+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=a}),function(h){return h>=a?--h:h});this._tabify();this._trigger("remove",null,this._ui(b.find("a")[0],c[0]));return this},enable:function(a){a=this._getIndex(a);var e=this.options;if(d.inArray(a,e.disabled)!=-1){this.lis.eq(a).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(b){return b!=a});this._trigger("enable",null,
this._ui(this.anchors[a],this.panels[a]));return this}},disable:function(a){a=this._getIndex(a);var e=this.options;if(a!=e.selected){this.lis.eq(a).addClass("ui-state-disabled");e.disabled.push(a);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))}return this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+".tabs");return this},
load:function(a){a=this._getIndex(a);var e=this,b=this.options,c=this.anchors.eq(a)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(a).addClass("ui-state-processing");if(b.spinner){var i=d("span",c);i.data("label.tabs",i.html()).html(b.spinner)}this.xhr=d.ajax(d.extend({},b.ajaxOptions,{url:h,success:function(k,n){d(e._sanitizeSelector(c.hash)).html(k);e._cleanup();b.cache&&d.data(c,"cache.tabs",
true);e._trigger("load",null,e._ui(e.anchors[a],e.panels[a]));try{b.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[a],e.panels[a]));try{b.ajaxOptions.error(k,n,a,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(a,
e){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.4"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(a,e){var b=this,c=this.options,h=b._rotate||(b._rotate=function(i){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var k=c.selected;b.select(++k<b.anchors.length?k:0)},a);i&&i.stopPropagation()});e=b._unrotate||(b._unrotate=!e?function(i){i.clientX&&b.rotate(null)}:
function(){t=c.selected;h()});if(a){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
;/*
 * jQuery UI Progressbar 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Progressbar
 *
 * Depends:
 *   jquery.ui.core.js
 *   jquery.ui.widget.js
 */
(function(b,c){b.widget("ui.progressbar",{options:{value:0},min:0,max:100,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===c)return this._value();this._setOption("value",a);return this},_setOption:function(a,d){if(a==="value"){this.options.value=d;this._refreshValue();this._trigger("change")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.max,Math.max(this.min,a))},_refreshValue:function(){var a=this.value();this.valueDiv.toggleClass("ui-corner-right",
a===this.max).width(a+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.4"})})(jQuery);
;eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';(5($){$.1j.1Q({1f:5(2c,3){6 29=Y 2c=="26";3=$.1Q({},$.P.2t,{18:29?2c:V,7:29?V:2c,1J:29?$.P.2t.1J:10,M:3&&!3.23?10:4b},3);3.1Y=3.1Y||5(e){a e};3.1S=3.1S||3.2L;3.2o=3.2o||\'q\';a m.I(5(){2A $.P(m,3)})},u:5(24){a m.1d("u",24)},1E:5(24){a m.1b("1E",[24])},2O:5(){a m.1b("2O")},2N:5(3){a m.1b("2N",[3])},2I:5(){a m.1b("2I")}});$.P=5(g,3){6 G={2U:38,32:40,3u:46,3O:9,3Q:13,3N:27,3G:4C,3s:33,3E:34,3n:8};6 $g=$(g).4A("1f","3Z").W(3.3g);6 1h;6 Z="";6 1A=$.P.2X(3);6 1i=0;6 1X;6 1m={22:r};6 h=$.P.3x(3,g,2K,1m);6 28;$.2g.2R&&$(g.2V).1d("4M.1f",5(){4(28){28=r;a r}});$g.1d(($.2g.2R?"43":"3S")+".1f",5(w){1i=1;1X=w.3I;3V(w.3I){T G.2U:w.1n();4(h.N()){h.3y()}j{1a(0,B)}S;T G.32:w.1n();4(h.N()){h.3v()}j{1a(0,B)}S;T G.3s:w.1n();4(h.N()){h.3z()}j{1a(0,B)}S;T G.3E:w.1n();4(h.N()){h.3B()}j{1a(0,B)}S;T 3.1l&&$.1C(3.R)==","&&G.3G:T G.3O:T G.3Q:4(2K()){w.1n();28=B;a r}S;T G.3N:h.15();S;3Y:2w(1h);1h=2e(1a,3.1J);S}}).3C(5(){1i++}).3X(5(){1i=0;4(!1m.22){3J()}}).3p(5(){4(1i++>1&&!h.N()){1a(0,B)}}).1d("1E",5(){6 1j=(1M.f>1)?1M[1]:V;5 2G(q,7){6 u;4(7&&7.f){1g(6 i=0;i<7.f;i++){4(7[i].u.J()==q.J()){u=7[i];S}}}4(Y 1j=="5")1j(u);j $g.1b("u",u&&[u.7,u.e])}$.I(19($g.L()),5(i,e){2j(e,2G,2G)})}).1d("2O",5(){1A.1x()}).1d("2N",5(){$.1Q(3,1M[1]);4("7"3m 1M[1])1A.1z()}).1d("2I",5(){h.2d();$g.2d();$(g.2V).2d(".1f")});5 2K(){6 C=h.C();4(!C)a r;6 v=C.u;Z=v;4(3.1l){6 y=19($g.L());4(y.f>1){6 3P=3.R.f;6 1v=$(g).1k().D;6 2F,1Z=0;$.I(y,5(i,1y){1Z+=1y.f;4(1v<=1Z){2F=i;a r}1Z+=3P});y[2F]=v;v=y.3j(3.R)}v+=3.R}$g.L(v);1s();$g.1b("u",[C.7,C.e]);a B}5 1a(42,3A){4(1X==G.3u){h.15();a}6 O=$g.L();4(!3A&&O==Z)a;Z=O;O=1o(O);4(O.f>=3.2m){$g.W(3.2r);4(!3.20)O=O.J();2j(O,3c,1s)}j{1L();h.15()}};5 19(e){4(!e)a[""];4(!3.1l)a[$.1C(e)];a $.3W(e.2v(3.R),5(1y){a $.1C(e).f?$.1C(1y):V})}5 1o(e){4(!3.1l)a e;6 y=19(e);4(y.f==1)a y[0];6 1v=$(g).1k().D;4(1v==e.f){y=19(e)}j{y=19(e.2z(e.3q(1v),""))}a y[y.f-1]}5 21(q,2q){4(3.21&&(1o($g.L()).J()==q.J())&&1X!=G.3n){$g.L($g.L()+2q.3q(1o(Z).f));$(g).1k(Z.f,Z.f+2q.f)}};5 3J(){2w(1h);1h=2e(1s,3U)};5 1s(){6 41=h.N();h.15();2w(1h);1L();4(3.2S){$g.1E(5(u){4(!u){4(3.1l){6 y=19($g.L()).1t(0,-1);$g.L(y.3j(3.R)+(y.f?3.R:""))}j{$g.L("");$g.1b("u",V)}}})}};5 3c(q,7){4(7&&7.f&&1i){1L();h.3i(7,q);21(q,7[0].e);h.2D()}j{1s()}};5 2j(z,1I,3b){4(!3.20)z=z.J();6 7=1A.3o(z);4(7&&7.f){1I(z,7)}j 4((Y 3.18=="26")&&(3.18.f>0)){6 1T={},1B={3T:+2A 44()};1T[\'4y\']=3.M;1T[3.2o]=1o(z);$.I(3.1B,5(30,1K){1B[30]=Y 1K=="5"?1K():1K});$.4R({4T:"4S",4L:"1f"+g.4D,35:3.35,18:3.18,7:$.1Q(1T,1B),1I:5(7){6 1c=3.1N&&3.1N(7)||1N(7);1A.1G(z,1c);1I(z,1c)}})}j{h.3f();3b(z)}};5 1N(7){6 1c=[];6 2C=7.2v("\\n");1g(6 i=0;i<2C.f;i++){6 A=$.1C(2C[i]);4(A){A=A.2v("|");1c[1c.f]={7:A,e:A[0],u:3.1V&&3.1V(A,A[0])||A[0]}}}a 1c};5 1L(){$g.1D(3.2r)}};$.P.2t={3g:"4I",2W:"4W",2r:"4G",2m:1,1J:4H,20:r,1u:B,1R:r,1q:10,M:4J,2S:r,1B:{},2i:B,2L:5(A){a A[0]},1S:V,21:r,H:0,1l:r,R:", ",1Y:5(e,z){a e.2z(2A 4F("(?![^&;]+;)(?!<[^<>]*)("+z.2z(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2Y,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2Y"),"<3k>$1</3k>")},23:B,2b:4E};$.P.2X=5(3){6 7={};6 f=0;5 1u(s,2p){4(!3.20)s=s.J();6 i=s.3r(2p);4(3.1R=="1y"){i=s.J().1E("\\\\b"+2p.J())}4(i==-1)a r;a i==0||3.1R};5 1G(q,e){4(f>3.1q){1x()}4(!7[q]){f++}7[q]=e}5 1z(){4(!3.7)a r;6 17={},3R=0;4(!3.18)3.1q=1;17[""]=[];1g(6 i=0,3H=3.7.f;i<3H;i++){6 X=3.7[i];X=(Y X=="26")?[X]:X;6 e=3.1S(X,i+1,3.7.f);4(e===r)2P;6 1W=e.4K(0).J();4(!17[1W])17[1W]=[];6 A={e:e,7:X,u:3.1V&&3.1V(X)||e};17[1W].2n(A);4(3R++<3.M){17[""].2n(A)}};$.I(17,5(i,e){3.1q++;1G(i,e)})}2e(1z,25);5 1x(){7={};f=0}a{1x:1x,1G:1G,1z:1z,3o:5(q){4(!3.1q||!f)a V;4(!3.18&&3.1R){6 11=[];1g(6 k 3m 7){4(k.f>0){6 c=7[k];$.I(c,5(i,x){4(1u(x.e,q)){11.2n(x)}})}}a 11}j 4(7[q]){a 7[q]}j 4(3.1u){1g(6 i=q.f-1;i>=3.2m;i--){6 c=7[q.4U(0,i)];4(c){6 11=[];$.I(c,5(i,x){4(1u(x.e,q)){11[11.f]=x}});a 11}}}a V}}};$.P.3x=5(3,g,h,1m){6 F={E:"4Q"};6 l,o=-1,7,z="",2J=B,t,p;5 3L(){4(!2J)a;t=$("<45/>").15().W(3.2W).1e("4N","4O").2M(2u.3M);p=$("<4P/>").2M(t).4B(5(w){4(12(w).3l&&12(w).3l.4z()==\'2Q\'){o=$("1p",p).1D(F.E).4g(12(w));$(12(w)).W(F.E)}}).3p(5(w){$(12(w)).W(F.E);h();g.3C();a r}).4f(5(){1m.22=B}).4h(5(){1m.22=r});4(3.H>0)t.1e("H",3.H);2J=r}5 12(w){6 t=w.12;4i(t&&t.4j!="2Q")t=t.4e;4(!t)a[];a t}5 14(1O){l.1t(o,o+1).1D(F.E);3h(1O);6 2H=l.1t(o,o+1).W(F.E);4(3.23){6 K=0;l.1t(0,o).I(5(){K+=m.1F});4((K+2H[0].1F-p.1H())>p[0].4d){p.1H(K+2H[0].1F-p.48())}j 4(K<p.1H()){p.1H(K)}}};5 3h(1O){o+=1O;4(o<0){o=l.1w()-1}j 4(o>=l.1w()){o=0}}5 36(2E){a 3.M&&3.M<2E?3.M:2E}5 3w(){p.37();6 M=36(7.f);1g(6 i=0;i<M;i++){4(!7[i])2P;6 2f=3.2L(7[i].7,i+1,M,7[i].e,z);4(2f===r)2P;6 1p=$("<1p/>").47(3.1Y(2f,z)).W(i%2==0?"49":"4a").2M(p)[0];$.7(1p,"3a",7[i])}l=p.4c("1p");4(3.2i){l.1t(0,1).W(F.E);o=0}4($.1j.2Z)p.2Z()}a{3i:5(d,q){3L();7=d;z=q;3w()},3v:5(){14(1)},3y:5(){14(-1)},3z:5(){4(o!=0&&o-8<0){14(-o)}j{14(-8)}},3B:5(){4(o!=l.1w()-1&&o+8>l.1w()){14(l.1w()-1-o)}j{14(8)}},15:5(){t&&t.15();l&&l.1D(F.E);o=-1},N:5(){a t&&t.4k(":N")},4l:5(){a m.N()&&(l.3d("."+F.E)[0]||3.2i&&l[0])},2D:5(){6 K=$(g).K();t.1e({H:Y 3.H=="26"||3.H>0?3.H:$(g).H(),3D:K.3D+g.1F,2s:K.2s}).2D();4(3.23){p.1H(0);p.1e({3K:3.2b,4u:\'4t\'});4($.2g.4v&&Y 2u.3M.4w.3K==="1P"){6 2a=0;l.I(5(){2a+=m.1F});6 2x=2a>3.2b;p.1e(\'4x\',2x?3.2b:2a);4(!2x){l.H(p.H()-2T(l.1e("31-2s"))-2T(l.1e("31-4s")))}}}},C:5(){6 C=l&&l.3d("."+F.E).1D(F.E);a C&&C.f&&$.7(C[0],"3a")},3f:5(){p&&p.37()},2d:5(){t&&t.4r()}}};$.1j.1k=5(D,Q){4(D!==1P){a m.I(5(){4(m.2B){6 16=m.2B();4(Q===1P||D==Q){16.4n("2h",D);16.h()}j{16.4m(B);16.4o("2h",D);16.4p("2h",Q);16.h()}}j 4(m.39){m.39(D,Q)}j 4(m.1U){m.1U=D;m.3e=Q}})}6 U=m[0];4(U.2B){6 2y=2u.1k.4q(),3t=U.e,2l="<->",2k=2y.3F.f;2y.3F=2l;6 1r=U.e.3r(2l);U.e=3t;m.1k(1r,1r+2k);a{D:1r,Q:1r+2k}}j 4(U.1U!==1P){a{D:U.1U,Q:U.3e}}}})(4V);',62,307,'|||options|if|function|var|data|||return||||value|length|input|select||else||listItems|this||active|list||false||element|result||event||words|term|row|true|selected|start|ACTIVE|CLASSES|KEY|width|each|toLowerCase|offset|val|max|visible|currentValue|Autocompleter|end|multipleSeparator|break|case|field|null|addClass|rawValue|typeof|previousValue||csub|target||moveSelect|hide|selRange|stMatchSets|url|trimWords|onChange|trigger|parsed|bind|css|autocomplete|for|timeout|hasFocus|fn|selection|multiple|config|preventDefault|lastWord|li|cacheLength|caretAt|hideResultsNow|slice|matchSubset|cursorAt|size|flush|word|populate|cache|extraParams|trim|removeClass|search|offsetHeight|add|scrollTop|success|delay|param|stopLoading|arguments|parse|step|undefined|extend|matchContains|formatMatch|queryParams|selectionStart|formatResult|firstChar|lastKeyPressCode|highlight|progress|matchCase|autoFill|mouseDownOnSelect|scroll|handler||string||blockSubmit|isUrl|listHeight|scrollHeight|urlOrData|unbind|setTimeout|formatted|browser|character|selectFirst|request|textLength|teststring|minChars|push|termName|sub|sValue|loadingClass|left|defaults|document|split|clearTimeout|scrollbarsVisible|range|replace|new|createTextRange|rows|show|available|wordAt|findValueCallback|activeItem|unautocomplete|needsInit|selectCurrent|formatItem|appendTo|setOptions|flushCache|continue|LI|opera|mustMatch|parseInt|UP|form|resultsClass|Cache|gi|bgiframe|key|padding|DOWN|||dataType|limitNumberOfItems|empty||setSelectionRange|ac_data|failure|receiveData|filter|selectionEnd|emptyList|inputClass|movePosition|display|join|strong|nodeName|in|BACKSPACE|load|click|substring|indexOf|PAGEUP|orig|DEL|next|fillList|Select|prev|pageUp|skipPrevCheck|pageDown|focus|top|PAGEDOWN|text|COMMA|ol|keyCode|hideResults|maxHeight|init|body|ESC|TAB|seperator|RETURN|nullData|keydown|timestamp|200|switch|map|blur|default|off||wasVisible|crap|keypress|Date|div||html|innerHeight|ac_even|ac_odd|150|find|clientHeight|parentNode|mousedown|index|mouseup|while|tagName|is|current|collapse|move|moveStart|moveEnd|createRange|remove|right|auto|overflow|msie|style|height|limit|toUpperCase|attr|mouseover|188|name|180|RegExp|ac_loading|400|ac_input|100|charAt|port|submit|position|absolute|ul|ac_over|ajax|abort|mode|substr|jQuery|ac_results'.split('|'),0,{}))
/**
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(9($){$.1s.A=9(o){z 4.14(9(){2H r(4,o)})};8 q={W:F,23:1,1G:1,u:7,15:3,16:7,1H:\'2I\',24:\'2J\',1i:0,B:7,1j:7,1I:7,25:7,26:7,27:7,28:7,29:7,2a:7,2b:7,1J:\'<N></N>\',1K:\'<N></N>\',2c:\'2d\',2e:\'2d\',1L:7,1M:7};$.A=9(e,o){4.5=$.17({},q,o||{});4.Q=F;4.D=7;4.H=7;4.t=7;4.R=7;4.S=7;4.O=!4.5.W?\'1N\':\'2f\';4.E=!4.5.W?\'2g\':\'2h\';8 a=\'\',1d=e.J.1d(\' \');1k(8 i=0;i<1d.K;i++){6(1d[i].2i(\'A-2j\')!=-1){$(e).1t(1d[i]);8 a=1d[i];1l}}6(e.2k==\'2K\'||e.2k==\'2L\'){4.t=$(e);4.D=4.t.18();6(4.D.1m(\'A-H\')){6(!4.D.18().1m(\'A-D\'))4.D=4.D.B(\'<N></N>\');4.D=4.D.18()}X 6(!4.D.1m(\'A-D\'))4.D=4.t.B(\'<N></N>\').18()}X{4.D=$(e);4.t=$(e).2M(\'>2l,>2m,N>2l,N>2m\')}6(a!=\'\'&&4.D.18()[0].J.2i(\'A-2j\')==-1)4.D.B(\'<N 2N=" \'+a+\'"></N>\');4.H=4.t.18();6(!4.H.K||!4.H.1m(\'A-H\'))4.H=4.t.B(\'<N></N>\').18();4.S=$(\'.A-11\',4.D);6(4.S.u()==0&&4.5.1K!=7)4.S=4.H.1u(4.5.1K).11();4.S.V(4.J(\'A-11\'));4.R=$(\'.A-19\',4.D);6(4.R.u()==0&&4.5.1J!=7)4.R=4.H.1u(4.5.1J).11();4.R.V(4.J(\'A-19\'));4.H.V(4.J(\'A-H\'));4.t.V(4.J(\'A-t\'));4.D.V(4.J(\'A-D\'));8 b=4.5.16!=7?1n.1O(4.1o()/4.5.16):7;8 c=4.t.2O(\'1v\');8 d=4;6(c.u()>0){8 f=0,i=4.5.1G;c.14(9(){d.1P(4,i++);f+=d.T(4,b)});4.t.y(4.O,f+\'U\');6(!o||o.u===L)4.5.u=c.u()}4.D.y(\'1w\',\'1x\');4.R.y(\'1w\',\'1x\');4.S.y(\'1w\',\'1x\');4.2n=9(){d.19()};4.2o=9(){d.11()};4.1Q=9(){d.2p()};6(4.5.1j!=7)4.5.1j(4,\'2q\');6($.2r.2s){4.1e(F,F);$(2t).1y(\'2P\',9(){d.1z()})}X 4.1z()};8 r=$.A;r.1s=r.2Q={A:\'0.2.3\'};r.1s.17=r.17=$.17;r.1s.17({1z:9(){4.C=7;4.G=7;4.Y=7;4.12=7;4.1a=F;4.1f=7;4.P=7;4.Z=F;6(4.Q)z;4.t.y(4.E,4.1A(4.5.1G)+\'U\');8 p=4.1A(4.5.23);4.Y=4.12=7;4.1p(p,F);$(2t).1R(\'2u\',4.1Q).1y(\'2u\',4.1Q)},2v:9(){4.t.2w();4.t.y(4.E,\'2R\');4.t.y(4.O,\'2S\');6(4.5.1j!=7)4.5.1j(4,\'2v\');4.1z()},2p:9(){6(4.P!=7&&4.Z)4.t.y(4.E,r.I(4.t.y(4.E))+4.P);4.P=7;4.Z=F;6(4.5.1I!=7)4.5.1I(4);6(4.5.16!=7){8 a=4;8 b=1n.1O(4.1o()/4.5.16),O=0,E=0;$(\'1v\',4.t).14(9(i){O+=a.T(4,b);6(i+1<a.C)E=O});4.t.y(4.O,O+\'U\');4.t.y(4.E,-E+\'U\')}4.15(4.C,F)},2T:9(){4.Q=1g;4.1e()},2U:9(){4.Q=F;4.1e()},u:9(s){6(s!=L){4.5.u=s;6(!4.Q)4.1e()}z 4.5.u},2V:9(i,a){6(a==L||!a)a=i;6(4.5.u!==7&&a>4.5.u)a=4.5.u;1k(8 j=i;j<=a;j++){8 e=4.M(j);6(!e.K||e.1m(\'A-1b-1B\'))z F}z 1g},M:9(i){z $(\'.A-1b-\'+i,4.t)},2x:9(i,s){8 e=4.M(i),1S=0,2x=0;6(e.K==0){8 c,e=4.1C(i),j=r.I(i);1q(c=4.M(--j)){6(j<=0||c.K){j<=0?4.t.2y(e):c.1T(e);1l}}}X 1S=4.T(e);e.1t(4.J(\'A-1b-1B\'));1U s==\'2W\'?e.2X(s):e.2w().2Y(s);8 a=4.5.16!=7?1n.1O(4.1o()/4.5.16):7;8 b=4.T(e,a)-1S;6(i>0&&i<4.C)4.t.y(4.E,r.I(4.t.y(4.E))-b+\'U\');4.t.y(4.O,r.I(4.t.y(4.O))+b+\'U\');z e},1V:9(i){8 e=4.M(i);6(!e.K||(i>=4.C&&i<=4.G))z;8 d=4.T(e);6(i<4.C)4.t.y(4.E,r.I(4.t.y(4.E))+d+\'U\');e.1V();4.t.y(4.O,r.I(4.t.y(4.O))-d+\'U\')},19:9(){4.1D();6(4.P!=7&&!4.Z)4.1W(F);X 4.15(((4.5.B==\'1X\'||4.5.B==\'G\')&&4.5.u!=7&&4.G==4.5.u)?1:4.C+4.5.15)},11:9(){4.1D();6(4.P!=7&&4.Z)4.1W(1g);X 4.15(((4.5.B==\'1X\'||4.5.B==\'C\')&&4.5.u!=7&&4.C==1)?4.5.u:4.C-4.5.15)},1W:9(b){6(4.Q||4.1a||!4.P)z;8 a=r.I(4.t.y(4.E));!b?a-=4.P:a+=4.P;4.Z=!b;4.Y=4.C;4.12=4.G;4.1p(a)},15:9(i,a){6(4.Q||4.1a)z;4.1p(4.1A(i),a)},1A:9(i){6(4.Q||4.1a)z;i=r.I(i);6(4.5.B!=\'1c\')i=i<1?1:(4.5.u&&i>4.5.u?4.5.u:i);8 a=4.C>i;8 b=r.I(4.t.y(4.E));8 f=4.5.B!=\'1c\'&&4.C<=1?1:4.C;8 c=a?4.M(f):4.M(4.G);8 j=a?f:f-1;8 e=7,l=0,p=F,d=0;1q(a?--j>=i:++j<i){e=4.M(j);p=!e.K;6(e.K==0){e=4.1C(j).V(4.J(\'A-1b-1B\'));c[a?\'1u\':\'1T\'](e)}c=e;d=4.T(e);6(p)l+=d;6(4.C!=7&&(4.5.B==\'1c\'||(j>=1&&(4.5.u==7||j<=4.5.u))))b=a?b+d:b-d}8 g=4.1o();8 h=[];8 k=0,j=i,v=0;8 c=4.M(i-1);1q(++k){e=4.M(j);p=!e.K;6(e.K==0){e=4.1C(j).V(4.J(\'A-1b-1B\'));c.K==0?4.t.2y(e):c[a?\'1u\':\'1T\'](e)}c=e;8 d=4.T(e);6(d==0){2Z(\'30: 31 1N/2f 32 1k 33. 34 35 36 37 38 39. 3a...\');z 0}6(4.5.B!=\'1c\'&&4.5.u!==7&&j>4.5.u)h.3b(e);X 6(p)l+=d;v+=d;6(v>=g)1l;j++}1k(8 x=0;x<h.K;x++)h[x].1V();6(l>0){4.t.y(4.O,4.T(4.t)+l+\'U\');6(a){b-=l;4.t.y(4.E,r.I(4.t.y(4.E))-l+\'U\')}}8 n=i+k-1;6(4.5.B!=\'1c\'&&4.5.u&&n>4.5.u)n=4.5.u;6(j>n){k=0,j=n,v=0;1q(++k){8 e=4.M(j--);6(!e.K)1l;v+=4.T(e);6(v>=g)1l}}8 o=n-k+1;6(4.5.B!=\'1c\'&&o<1)o=1;6(4.Z&&a){b+=4.P;4.Z=F}4.P=7;6(4.5.B!=\'1c\'&&n==4.5.u&&(n-k+1)>=1){8 m=r.10(4.M(n),!4.5.W?\'1r\':\'1Y\');6((v-m)>g)4.P=v-g-m}1q(i-->o)b+=4.T(4.M(i));4.Y=4.C;4.12=4.G;4.C=o;4.G=n;z b},1p:9(p,a){6(4.Q||4.1a)z;4.1a=1g;8 b=4;8 c=9(){b.1a=F;6(p==0)b.t.y(b.E,0);6(b.5.B==\'1X\'||b.5.B==\'G\'||b.5.u==7||b.G<b.5.u)b.2z();b.1e();b.1Z(\'2A\')};4.1Z(\'3c\');6(!4.5.1H||a==F){4.t.y(4.E,p+\'U\');c()}X{8 o=!4.5.W?{\'2g\':p}:{\'2h\':p};4.t.1p(o,4.5.1H,4.5.24,c)}},2z:9(s){6(s!=L)4.5.1i=s;6(4.5.1i==0)z 4.1D();6(4.1f!=7)z;8 a=4;4.1f=3d(9(){a.19()},4.5.1i*3e)},1D:9(){6(4.1f==7)z;3f(4.1f);4.1f=7},1e:9(n,p){6(n==L||n==7){8 n=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'C\')||4.5.u==7||4.G<4.5.u);6(!4.Q&&(!4.5.B||4.5.B==\'C\')&&4.5.u!=7&&4.G>=4.5.u)n=4.P!=7&&!4.Z}6(p==L||p==7){8 p=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'G\')||4.C>1);6(!4.Q&&(!4.5.B||4.5.B==\'G\')&&4.5.u!=7&&4.C==1)p=4.P!=7&&4.Z}8 a=4;4.R[n?\'1y\':\'1R\'](4.5.2c,4.2n)[n?\'1t\':\'V\'](4.J(\'A-19-1E\')).20(\'1E\',n?F:1g);4.S[p?\'1y\':\'1R\'](4.5.2e,4.2o)[p?\'1t\':\'V\'](4.J(\'A-11-1E\')).20(\'1E\',p?F:1g);6(4.R.K>0&&(4.R[0].1h==L||4.R[0].1h!=n)&&4.5.1L!=7){4.R.14(9(){a.5.1L(a,4,n)});4.R[0].1h=n}6(4.S.K>0&&(4.S[0].1h==L||4.S[0].1h!=p)&&4.5.1M!=7){4.S.14(9(){a.5.1M(a,4,p)});4.S[0].1h=p}},1Z:9(a){8 b=4.Y==7?\'2q\':(4.Y<4.C?\'19\':\'11\');4.13(\'25\',a,b);6(4.Y!==4.C){4.13(\'26\',a,b,4.C);4.13(\'27\',a,b,4.Y)}6(4.12!==4.G){4.13(\'28\',a,b,4.G);4.13(\'29\',a,b,4.12)}4.13(\'2a\',a,b,4.C,4.G,4.Y,4.12);4.13(\'2b\',a,b,4.Y,4.12,4.C,4.G)},13:9(a,b,c,d,e,f,g){6(4.5[a]==L||(1U 4.5[a]!=\'2B\'&&b!=\'2A\'))z;8 h=1U 4.5[a]==\'2B\'?4.5[a][b]:4.5[a];6(!$.3g(h))z;8 j=4;6(d===L)h(j,c,b);X 6(e===L)4.M(d).14(9(){h(j,4,d,c,b)});X{1k(8 i=d;i<=e;i++)6(i!==7&&!(i>=f&&i<=g))4.M(i).14(9(){h(j,4,i,c,b)})}},1C:9(i){z 4.1P(\'<1v></1v>\',i)},1P:9(e,i){8 a=$(e).V(4.J(\'A-1b\')).V(4.J(\'A-1b-\'+i));a.20(\'3h\',i);z a},J:9(c){z c+\' \'+c+(!4.5.W?\'-3i\':\'-W\')},T:9(e,d){8 a=e.2C!=L?e[0]:e;8 b=!4.5.W?a.1F+r.10(a,\'2D\')+r.10(a,\'1r\'):a.2E+r.10(a,\'2F\')+r.10(a,\'1Y\');6(d==L||b==d)z b;8 w=!4.5.W?d-r.10(a,\'2D\')-r.10(a,\'1r\'):d-r.10(a,\'2F\')-r.10(a,\'1Y\');$(a).y(4.O,w+\'U\');z 4.T(a)},1o:9(){z!4.5.W?4.H[0].1F-r.I(4.H.y(\'3j\'))-r.I(4.H.y(\'3k\')):4.H[0].2E-r.I(4.H.y(\'3l\'))-r.I(4.H.y(\'3m\'))},3n:9(i,s){6(s==L)s=4.5.u;z 1n.3o((((i-1)/s)-1n.3p((i-1)/s))*s)+1}});r.17({3q:9(d){z $.17(q,d||{})},10:9(e,p){6(!e)z 0;8 a=e.2C!=L?e[0]:e;6(p==\'1r\'&&$.2r.2s){8 b={\'1w\':\'1x\',\'3r\':\'3s\',\'1N\':\'1i\'},21,22;$.2G(a,b,9(){21=a.1F});b[\'1r\']=0;$.2G(a,b,9(){22=a.1F});z 22-21}z r.I($.y(a,p))},I:9(v){v=3t(v);z 3u(v)?0:v}})})(3v);',62,218,'||||this|options|if|null|var|function||||||||||||||||||||list|size||||css|return|jcarousel|wrap|first|container|lt|false|last|clip|intval|className|length|undefined|get|div|wh|tail|locked|buttonNext|buttonPrev|dimension|px|addClass|vertical|else|prevFirst|inTail|margin|prev|prevLast|callback|each|scroll|visible|extend|parent|next|animating|item|circular|split|buttons|timer|true|jcarouselstate|auto|initCallback|for|break|hasClass|Math|clipping|animate|while|marginRight|fn|removeClass|before|li|display|block|bind|setup|pos|placeholder|create|stopAuto|disabled|offsetWidth|offset|animation|reloadCallback|buttonNextHTML|buttonPrevHTML|buttonNextCallback|buttonPrevCallback|width|ceil|format|funcResize|unbind|old|after|typeof|remove|scrollTail|both|marginBottom|notify|attr|oWidth|oWidth2|start|easing|itemLoadCallback|itemFirstInCallback|itemFirstOutCallback|itemLastInCallback|itemLastOutCallback|itemVisibleInCallback|itemVisibleOutCallback|buttonNextEvent|click|buttonPrevEvent|height|left|top|indexOf|skin|nodeName|ul|ol|funcNext|funcPrev|reload|init|browser|safari|window|resize|reset|empty|add|prepend|startAuto|onAfterAnimation|object|jquery|marginLeft|offsetHeight|marginTop|swap|new|normal|swing|UL|OL|find|class|children|load|prototype|0px|10px|lock|unlock|has|string|html|append|isNaN|jCarousel|No|set|items|This|will|cause|an|infinite|loop|Aborting|push|onBeforeAnimation|setTimeout|1000|clearTimeout|isFunction|jcarouselindex|horizontal|borderLeftWidth|borderRightWidth|borderTopWidth|borderBottomWidth|index|round|floor|defaults|float|none|parseInt|isNaN|jQuery'.split('|'),0,{}))

