/* cache=false;pkg=true;cachewrite=true */


/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var A=YAHOO.lang,C=["toString","valueOf"],B={isArray:function(D){if(D){return A.isNumber(D.length)&&A.isFunction(D.splice);}return false;},isBoolean:function(D){return typeof D==="boolean";},isFunction:function(D){return typeof D==="function";},isNull:function(D){return D===null;},isNumber:function(D){return typeof D==="number"&&isFinite(D);},isObject:function(D){return(D&&(typeof D==="object"||A.isFunction(D)))||false;},isString:function(D){return typeof D==="string";},isUndefined:function(D){return typeof D==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(F,E){for(var D=0;D<C.length;D=D+1){var H=C[D],G=E[H];if(A.isFunction(G)&&G!=Object.prototype[H]){F[H]=G;}}}:function(){},extend:function(H,I,G){if(!I||!H){throw new Error("extend failed, please check that "+"all dependencies are included.");}var E=function(){};E.prototype=I.prototype;H.prototype=new E();H.prototype.constructor=H;H.superclass=I.prototype;if(I.prototype.constructor==Object.prototype.constructor){I.prototype.constructor=I;}if(G){for(var D in G){if(A.hasOwnProperty(G,D)){H.prototype[D]=G[D];}}A._IEEnumFix(H.prototype,G);}},augmentObject:function(H,G){if(!G||!H){throw new Error("Absorb failed, verify dependencies.");}var D=arguments,F,I,E=D[2];if(E&&E!==true){for(F=2;F<D.length;F=F+1){H[D[F]]=G[D[F]];}}else{for(I in G){if(E||!(I in H)){H[I]=G[I];}}A._IEEnumFix(H,G);}},augmentProto:function(G,F){if(!F||!G){throw new Error("Augment failed, verify dependencies.");}var D=[G.prototype,F.prototype];for(var E=2;E<arguments.length;E=E+1){D.push(arguments[E]);}A.augmentObject.apply(this,D);},dump:function(D,I){var F,H,K=[],L="{...}",E="f(){...}",J=", ",G=" => ";if(!A.isObject(D)){return D+"";}else{if(D instanceof Date||("nodeType" in D&&"tagName" in D)){return D;}else{if(A.isFunction(D)){return E;}}}I=(A.isNumber(I))?I:3;if(A.isArray(D)){K.push("[");for(F=0,H=D.length;F<H;F=F+1){if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F<D;F=F+1){A.augmentObject(G,E[F],true);}return G;},later:function(K,E,L,G,H){K=K||0;E=E||{};var F=L,J=G,I,D;if(A.isString(L)){F=E[L];}if(!F){throw new TypeError("method undefined");}if(!A.isArray(J)){J=[G];}I=function(){F.apply(E,J);};D=(H)?setInterval(I,K):setTimeout(I,K);return{interval:H,cancel:function(){if(this.interval){clearInterval(D);}else{clearTimeout(D);}}};},isValue:function(D){return(A.isObject(D)||A.isString(D)||A.isNumber(D)||A.isBoolean(D));}};A.hasOwnProperty=(Object.prototype.hasOwnProperty)?function(D,E){return D&&D.hasOwnProperty(E);}:function(D,E){return !A.isUndefined(D[E])&&D.constructor.prototype[E]!==D[E];};B.augmentObject(A,B,true);YAHOO.util.Lang=A;A.augment=A.augmentProto;YAHOO.augment=A.augmentProto;YAHOO.extend=A.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.6.0",build:"1321"});YAHOO.util.Get=function(){var M={},L=0,R=0,E=false,N=YAHOO.env.ua,S=YAHOO.lang;var J=function(W,T,X){var U=X||window,Y=U.document,Z=Y.createElement(W);for(var V in T){if(T[V]&&YAHOO.lang.hasOwnProperty(T,V)){Z.setAttribute(V,T[V]);}}return Z;};var I=function(T,U,W){var V=W||"utf-8";return J("link",{"id":"yui__dyn_"+(R++),"type":"text/css","charset":V,"rel":"stylesheet","href":T},U);
};var P=function(T,U,W){var V=W||"utf-8";return J("script",{"id":"yui__dyn_"+(R++),"type":"text/javascript","charset":V,"src":T},U);};var A=function(T,U){return{tId:T.tId,win:T.win,data:T.data,nodes:T.nodes,msg:U,purge:function(){D(this.tId);}};};var B=function(T,W){var U=M[W],V=(S.isString(T))?U.win.document.getElementById(T):T;if(!V){Q(W,"target node not found: "+T);}return V;};var Q=function(W,V){var T=M[W];if(T.onFailure){var U=T.scope||T.win;T.onFailure.call(U,A(T,V));}};var C=function(W){var T=M[W];T.finished=true;if(T.aborted){var V="transaction "+W+" was aborted";Q(W,V);return ;}if(T.onSuccess){var U=T.scope||T.win;T.onSuccess.call(U,A(T));}};var O=function(V){var T=M[V];if(T.onTimeout){var U=T.context||T;T.onTimeout.call(U,A(T));}};var G=function(V,Z){var U=M[V];if(U.timer){U.timer.cancel();}if(U.aborted){var X="transaction "+V+" was aborted";Q(V,X);return ;}if(Z){U.url.shift();if(U.varName){U.varName.shift();}}else{U.url=(S.isString(U.url))?[U.url]:U.url;if(U.varName){U.varName=(S.isString(U.varName))?[U.varName]:U.varName;}}var c=U.win,b=c.document,a=b.getElementsByTagName("head")[0],W;if(U.url.length===0){if(U.type==="script"&&N.webkit&&N.webkit<420&&!U.finalpass&&!U.varName){var Y=P(null,U.win,U.charset);Y.innerHTML='YAHOO.util.Get._finalize("'+V+'");';U.nodes.push(Y);a.appendChild(Y);}else{C(V);}return ;}var T=U.url[0];if(!T){U.url.shift();return G(V);}if(U.timeout){U.timer=S.later(U.timeout,U,O,V);}if(U.type==="script"){W=P(T,c,U.charset);}else{W=I(T,c,U.charset);}F(U.type,W,V,T,c,U.url.length);U.nodes.push(W);if(U.insertBefore){var e=B(U.insertBefore,V);if(e){e.parentNode.insertBefore(W,e);}}else{a.appendChild(W);}if((N.webkit||N.gecko)&&U.type==="css"){G(V,T);}};var K=function(){if(E){return ;}E=true;for(var T in M){var U=M[T];if(U.autopurge&&U.finished){D(U.tId);delete M[T];}}E=false;};var D=function(a){var X=M[a];if(X){var Z=X.nodes,T=Z.length,Y=X.win.document,W=Y.getElementsByTagName("head")[0];if(X.insertBefore){var V=B(X.insertBefore,a);if(V){W=V.parentNode;}}for(var U=0;U<T;U=U+1){W.removeChild(Z[U]);}X.nodes=[];}};var H=function(U,T,V){var X="q"+(L++);V=V||{};if(L%YAHOO.util.Get.PURGE_THRESH===0){K();}M[X]=S.merge(V,{tId:X,type:U,url:T,finished:false,aborted:false,nodes:[]});var W=M[X];W.win=W.win||window;W.scope=W.scope||W.win;W.autopurge=("autopurge" in W)?W.autopurge:(U==="script")?true:false;S.later(0,W,G,X);return{tId:X};};var F=function(c,X,W,U,Y,Z,b){var a=b||G;if(N.ie){X.onreadystatechange=function(){var d=this.readyState;if("loaded"===d||"complete"===d){X.onreadystatechange=null;a(W,U);}};}else{if(N.webkit){if(c==="script"){if(N.webkit>=420){X.addEventListener("load",function(){a(W,U);});}else{var T=M[W];if(T.varName){var V=YAHOO.util.Get.POLL_FREQ;T.maxattempts=YAHOO.util.Get.TIMEOUT/V;T.attempts=0;T._cache=T.varName[0].split(".");T.timer=S.later(V,T,function(j){var f=this._cache,e=f.length,d=this.win,g;for(g=0;g<e;g=g+1){d=d[f[g]];if(!d){this.attempts++;if(this.attempts++>this.maxattempts){var h="Over retry limit, giving up";T.timer.cancel();Q(W,h);}else{}return ;}}T.timer.cancel();a(W,U);},null,true);}else{S.later(YAHOO.util.Get.POLL_FREQ,null,a,[W,U]);}}}}else{X.onload=function(){a(W,U);};}}};return{POLL_FREQ:10,PURGE_THRESH:20,TIMEOUT:2000,_finalize:function(T){S.later(0,null,C,T);},abort:function(U){var V=(S.isString(U))?U:U.tId;var T=M[V];if(T){T.aborted=true;}},script:function(T,U){return H("script",T,U);},css:function(T,U){return H("css",T,U);}};}();YAHOO.register("get",YAHOO.util.Get,{version:"2.6.0",build:"1321"});(function(){var Y=YAHOO,util=Y.util,lang=Y.lang,env=Y.env,PROV="_provides",SUPER="_supersedes",REQ="expanded",AFTER="_after";var YUI={dupsAllowed:{"yahoo":true,"get":true},info:{"root":"2.6.0/build/","base":"http://yui.yahooapis.com/2.6.0/build/","comboBase":"http://yui.yahooapis.com/combo?","skin":{"defaultSkin":"sam","base":"assets/skins/","path":"skin.css","after":["reset","fonts","grids","base"],"rollup":3},dupsAllowed:["yahoo","get"],"moduleInfo":{"animation":{"type":"js","path":"animation/animation-min.js","requires":["dom","event"]},"autocomplete":{"type":"js","path":"autocomplete/autocomplete-min.js","requires":["dom","event","datasource"],"optional":["connection","animation"],"skinnable":true},"base":{"type":"css","path":"base/base-min.css","after":["reset","fonts","grids"]},"button":{"type":"js","path":"button/button-min.js","requires":["element"],"optional":["menu"],"skinnable":true},"calendar":{"type":"js","path":"calendar/calendar-min.js","requires":["event","dom"],"skinnable":true},"carousel":{"type":"js","path":"carousel/carousel-beta-min.js","requires":["element"],"optional":["animation"],"skinnable":true},"charts":{"type":"js","path":"charts/charts-experimental-min.js","requires":["element","json","datasource"]},"colorpicker":{"type":"js","path":"colorpicker/colorpicker-min.js","requires":["slider","element"],"optional":["animation"],"skinnable":true},"connection":{"type":"js","path":"connection/connection-min.js","requires":["event"]},"container":{"type":"js","path":"container/container-min.js","requires":["dom","event"],"optional":["dragdrop","animation","connection"],"supersedes":["containercore"],"skinnable":true},"containercore":{"type":"js","path":"container/container_core-min.js","requires":["dom","event"],"pkg":"container"},"cookie":{"type":"js","path":"cookie/cookie-min.js","requires":["yahoo"]},"datasource":{"type":"js","path":"datasource/datasource-min.js","requires":["event"],"optional":["connection"]},"datatable":{"type":"js","path":"datatable/datatable-min.js","requires":["element","datasource"],"optional":["calendar","dragdrop","paginator"],"skinnable":true},"dom":{"type":"js","path":"dom/dom-min.js","requires":["yahoo"]},"dragdrop":{"type":"js","path":"dragdrop/dragdrop-min.js","requires":["dom","event"]},"editor":{"type":"js","path":"editor/editor-min.js","requires":["menu","element","button"],"optional":["animation","dragdrop"],"supersedes":["simpleeditor"],"skinnable":true},"element":{"type":"js","path":"element/element-beta-min.js","requires":["dom","event"]},"event":{"type":"js","path":"event/event-min.js","requires":["yahoo"]},"fonts":{"type":"css","path":"fonts/fonts-min.css"},"get":{"type":"js","path":"get/get-min.js","requires":["yahoo"]},"grids":{"type":"css","path":"grids/grids-min.css","requires":["fonts"],"optional":["reset"]},"history":{"type":"js","path":"history/history-min.js","requires":["event"]},"imagecropper":{"type":"js","path":"imagecropper/imagecropper-beta-min.js","requires":["dom","event","dragdrop","element","resize"],"skinnable":true},"imageloader":{"type":"js","path":"imageloader/imageloader-min.js","requires":["event","dom"]},"json":{"type":"js","path":"json/json-min.js","requires":["yahoo"]},"layout":{"type":"js","path":"layout/layout-min.js","requires":["dom","event","element"],"optional":["animation","dragdrop","resize","selector"],"skinnable":true},"logger":{"type":"js","path":"logger/logger-min.js","requires":["event","dom"],"optional":["dragdrop"],"skinnable":true},"menu":{"type":"js","path":"menu/menu-min.js","requires":["containercore"],"skinnable":true},"paginator":{"type":"js","path":"paginator/paginator-min.js","requires":["element"],"skinnable":true},"profiler":{"type":"js","path":"profiler/profiler-min.js","requires":["yahoo"]},"profilerviewer":{"type":"js","path":"profilerviewer/profilerviewer-beta-min.js","requires":["profiler","yuiloader","element"],"skinnable":true},"reset":{"type":"css","path":"reset/reset-min.css"},"reset-fonts-grids":{"type":"css","path":"reset-fonts-grids/reset-fonts-grids.css","supersedes":["reset","fonts","grids","reset-fonts"],"rollup":4},"reset-fonts":{"type":"css","path":"reset-fonts/reset-fonts.css","supersedes":["reset","fonts"],"rollup":2},"resize":{"type":"js","path":"resize/resize-min.js","requires":["dom","event","dragdrop","element"],"optional":["animation"],"skinnable":true},"selector":{"type":"js","path":"selector/selector-beta-min.js","requires":["yahoo","dom"]},"simpleeditor":{"type":"js","path":"editor/simpleeditor-min.js","requires":["element"],"optional":["containercore","menu","button","animation","dragdrop"],"skinnable":true,"pkg":"editor"},"slider":{"type":"js","path":"slider/slider-min.js","requires":["dragdrop"],"optional":["animation"],"skinnable":true},"tabview":{"type":"js","path":"tabview/tabview-min.js","requires":["element"],"optional":["connection"],"skinnable":true},"treeview":{"type":"js","path":"treeview/treeview-min.js","requires":["event","dom"],"skinnable":true},"uploader":{"type":"js","path":"uploader/uploader-experimental.js","requires":["element"]},"utilities":{"type":"js","path":"utilities/utilities.js","supersedes":["yahoo","event","dragdrop","animation","dom","connection","element","yahoo-dom-event","get","yuiloader","yuiloader-dom-event"],"rollup":8},"yahoo":{"type":"js","path":"yahoo/yahoo-min.js"},"yahoo-dom-event":{"type":"js","path":"yahoo-dom-event/yahoo-dom-event.js","supersedes":["yahoo","event","dom"],"rollup":3},"yuiloader":{"type":"js","path":"yuiloader/yuiloader-min.js","supersedes":["yahoo","get"]},"yuiloader-dom-event":{"type":"js","path":"yuiloader-dom-event/yuiloader-dom-event.js","supersedes":["yahoo","dom","event","get","yuiloader","yahoo-dom-event"],"rollup":5},"yuitest":{"type":"js","path":"yuitest/yuitest-min.js","requires":["logger"],"skinnable":true}}},ObjectUtil:{appendArray:function(o,a){if(a){for(var i=0;
i<a.length;i=i+1){o[a[i]]=true;}}},keys:function(o,ordered){var a=[],i;for(i in o){if(lang.hasOwnProperty(o,i)){a.push(i);}}return a;}},ArrayUtil:{appendArray:function(a1,a2){Array.prototype.push.apply(a1,a2);},indexOf:function(a,val){for(var i=0;i<a.length;i=i+1){if(a[i]===val){return i;}}return -1;},toObject:function(a){var o={};for(var i=0;i<a.length;i=i+1){o[a[i]]=true;}return o;},uniq:function(a){return YUI.ObjectUtil.keys(YUI.ArrayUtil.toObject(a));}}};YAHOO.util.YUILoader=function(o){this._internalCallback=null;this._useYahooListener=false;this.onSuccess=null;this.onFailure=Y.log;this.onProgress=null;this.onTimeout=null;this.scope=this;this.data=null;this.insertBefore=null;this.charset=null;this.varName=null;this.base=YUI.info.base;this.comboBase=YUI.info.comboBase;this.combine=false;this.root=YUI.info.root;this.timeout=0;this.ignore=null;this.force=null;this.allowRollup=true;this.filter=null;this.required={};this.moduleInfo=lang.merge(YUI.info.moduleInfo);this.rollups=null;this.loadOptional=false;this.sorted=[];this.loaded={};this.dirty=true;this.inserted={};var self=this;env.listeners.push(function(m){if(self._useYahooListener){self.loadNext(m.name);}});this.skin=lang.merge(YUI.info.skin);this._config(o);};Y.util.YUILoader.prototype={FILTERS:{RAW:{"searchExp":"-min\\.js","replaceStr":".js"},DEBUG:{"searchExp":"-min\\.js","replaceStr":"-debug.js"}},SKIN_PREFIX:"skin-",_config:function(o){if(o){for(var i in o){if(lang.hasOwnProperty(o,i)){if(i=="require"){this.require(o[i]);}else{this[i]=o[i];}}}}var f=this.filter;if(lang.isString(f)){f=f.toUpperCase();if(f==="DEBUG"){this.require("logger");}if(!Y.widget.LogWriter){Y.widget.LogWriter=function(){return Y;};}this.filter=this.FILTERS[f];}},addModule:function(o){if(!o||!o.name||!o.type||(!o.path&&!o.fullpath)){return false;}o.ext=("ext" in o)?o.ext:true;o.requires=o.requires||[];this.moduleInfo[o.name]=o;this.dirty=true;return true;},require:function(what){var a=(typeof what==="string")?arguments:what;this.dirty=true;YUI.ObjectUtil.appendArray(this.required,a);},_addSkin:function(skin,mod){var name=this.formatSkin(skin),info=this.moduleInfo,sinf=this.skin,ext=info[mod]&&info[mod].ext;if(!info[name]){this.addModule({"name":name,"type":"css","path":sinf.base+skin+"/"+sinf.path,"after":sinf.after,"rollup":sinf.rollup,"ext":ext});}if(mod){name=this.formatSkin(skin,mod);if(!info[name]){var mdef=info[mod],pkg=mdef.pkg||mod;this.addModule({"name":name,"type":"css","after":sinf.after,"path":pkg+"/"+sinf.base+skin+"/"+mod+".css","ext":ext});}}return name;},getRequires:function(mod){if(!mod){return[];}if(!this.dirty&&mod.expanded){return mod.expanded;}mod.requires=mod.requires||[];var i,d=[],r=mod.requires,o=mod.optional,info=this.moduleInfo,m;for(i=0;i<r.length;i=i+1){d.push(r[i]);m=info[r[i]];YUI.ArrayUtil.appendArray(d,this.getRequires(m));}if(o&&this.loadOptional){for(i=0;i<o.length;i=i+1){d.push(o[i]);YUI.ArrayUtil.appendArray(d,this.getRequires(info[o[i]]));}}mod.expanded=YUI.ArrayUtil.uniq(d);return mod.expanded;},getProvides:function(name,notMe){var addMe=!(notMe),ckey=(addMe)?PROV:SUPER,m=this.moduleInfo[name],o={};if(!m){return o;}if(m[ckey]){return m[ckey];}var s=m.supersedes,done={},me=this;var add=function(mm){if(!done[mm]){done[mm]=true;lang.augmentObject(o,me.getProvides(mm));}};if(s){for(var i=0;i<s.length;i=i+1){add(s[i]);}}m[SUPER]=o;m[PROV]=lang.merge(o);m[PROV][name]=true;return m[ckey];},calculate:function(o){if(o||this.dirty){this._config(o);this._setup();this._explode();if(this.allowRollup){this._rollup();}this._reduce();this._sort();this.dirty=false;}},_setup:function(){var info=this.moduleInfo,name,i,j;for(name in info){if(lang.hasOwnProperty(info,name)){var m=info[name];if(m&&m.skinnable){var o=this.skin.overrides,smod;if(o&&o[name]){for(i=0;i<o[name].length;i=i+1){smod=this._addSkin(o[name][i],name);}}else{smod=this._addSkin(this.skin.defaultSkin,name);}m.requires.push(smod);}}}var l=lang.merge(this.inserted);if(!this._sandbox){l=lang.merge(l,env.modules);}if(this.ignore){YUI.ObjectUtil.appendArray(l,this.ignore);}if(this.force){for(i=0;i<this.force.length;i=i+1){if(this.force[i] in l){delete l[this.force[i]];}}}for(j in l){if(lang.hasOwnProperty(l,j)){lang.augmentObject(l,this.getProvides(j));}}this.loaded=l;},_explode:function(){var r=this.required,i,mod;for(i in r){if(lang.hasOwnProperty(r,i)){mod=this.moduleInfo[i];if(mod){var req=this.getRequires(mod);if(req){YUI.ObjectUtil.appendArray(r,req);}}}}},_skin:function(){},formatSkin:function(skin,mod){var s=this.SKIN_PREFIX+skin;if(mod){s=s+"-"+mod;}return s;},parseSkin:function(mod){if(mod.indexOf(this.SKIN_PREFIX)===0){var a=mod.split("-");return{skin:a[1],module:a[2]};}return null;},_rollup:function(){var i,j,m,s,rollups={},r=this.required,roll,info=this.moduleInfo;if(this.dirty||!this.rollups){for(i in info){if(lang.hasOwnProperty(info,i)){m=info[i];if(m&&m.rollup){rollups[i]=m;}}}this.rollups=rollups;}for(;;){var rolled=false;for(i in rollups){if(!r[i]&&!this.loaded[i]){m=info[i];s=m.supersedes;roll=false;if(!m.rollup){continue;}var skin=(m.ext)?false:this.parseSkin(i),c=0;if(skin){for(j in r){if(lang.hasOwnProperty(r,j)){if(i!==j&&this.parseSkin(j)){c++;roll=(c>=m.rollup);if(roll){break;}}}}}else{for(j=0;j<s.length;j=j+1){if(this.loaded[s[j]]&&(!YUI.dupsAllowed[s[j]])){roll=false;break;}else{if(r[s[j]]){c++;roll=(c>=m.rollup);if(roll){break;}}}}}if(roll){r[i]=true;rolled=true;this.getRequires(m);}}}if(!rolled){break;}}},_reduce:function(){var i,j,s,m,r=this.required;for(i in r){if(i in this.loaded){delete r[i];}else{var skinDef=this.parseSkin(i);if(skinDef){if(!skinDef.module){var skin_pre=this.SKIN_PREFIX+skinDef.skin;for(j in r){if(lang.hasOwnProperty(r,j)){m=this.moduleInfo[j];var ext=m&&m.ext;if(!ext&&j!==i&&j.indexOf(skin_pre)>-1){delete r[j];}}}}}else{m=this.moduleInfo[i];s=m&&m.supersedes;if(s){for(j=0;j<s.length;j=j+1){if(s[j] in r){delete r[s[j]];}}}}}}},_onFailure:function(msg){YAHOO.log("Failure","info","loader");var f=this.onFailure;if(f){f.call(this.scope,{msg:"failure: "+msg,data:this.data,success:false});
}},_onTimeout:function(){YAHOO.log("Timeout","info","loader");var f=this.onTimeout;if(f){f.call(this.scope,{msg:"timeout",data:this.data,success:false});}},_sort:function(){var s=[],info=this.moduleInfo,loaded=this.loaded,checkOptional=!this.loadOptional,me=this;var requires=function(aa,bb){var mm=info[aa];if(loaded[bb]||!mm){return false;}var ii,rr=mm.expanded,after=mm.after,other=info[bb],optional=mm.optional;if(rr&&YUI.ArrayUtil.indexOf(rr,bb)>-1){return true;}if(after&&YUI.ArrayUtil.indexOf(after,bb)>-1){return true;}if(checkOptional&&optional&&YUI.ArrayUtil.indexOf(optional,bb)>-1){return true;}var ss=info[bb]&&info[bb].supersedes;if(ss){for(ii=0;ii<ss.length;ii=ii+1){if(requires(aa,ss[ii])){return true;}}}if(mm.ext&&mm.type=="css"&&!other.ext&&other.type=="css"){return true;}return false;};for(var i in this.required){if(lang.hasOwnProperty(this.required,i)){s.push(i);}}var p=0;for(;;){var l=s.length,a,b,j,k,moved=false;for(j=p;j<l;j=j+1){a=s[j];for(k=j+1;k<l;k=k+1){if(requires(a,s[k])){b=s.splice(k,1);s.splice(j,0,b[0]);moved=true;break;}}if(moved){break;}else{p=p+1;}}if(!moved){break;}}this.sorted=s;},toString:function(){var o={type:"YUILoader",base:this.base,filter:this.filter,required:this.required,loaded:this.loaded,inserted:this.inserted};lang.dump(o,1);},_combine:function(){this._combining=[];var self=this,s=this.sorted,len=s.length,js=this.comboBase,css=this.comboBase,target,startLen=js.length,i,m,type=this.loadType;YAHOO.log("type "+type);for(i=0;i<len;i=i+1){m=this.moduleInfo[s[i]];if(m&&!m.ext&&(!type||type===m.type)){target=this.root+m.path;target+="&";if(m.type=="js"){js+=target;}else{css+=target;}this._combining.push(s[i]);}}if(this._combining.length){YAHOO.log("Attempting to combine: "+this._combining,"info","loader");var callback=function(o){var c=this._combining,len=c.length,i,m;for(i=0;i<len;i=i+1){this.inserted[c[i]]=true;}this.loadNext(o.data);},loadScript=function(){if(js.length>startLen){YAHOO.util.Get.script(self._filter(js),{data:self._loading,onSuccess:callback,onFailure:self._onFailure,onTimeout:self._onTimeout,insertBefore:self.insertBefore,charset:self.charset,timeout:self.timeout,scope:self});}};if(css.length>startLen){YAHOO.util.Get.css(this._filter(css),{data:this._loading,onSuccess:loadScript,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,timeout:this.timeout,scope:self});}else{loadScript();}return ;}else{this.loadNext(this._loading);}},insert:function(o,type){this.calculate(o);this._loading=true;this.loadType=type;if(this.combine){return this._combine();}if(!type){var self=this;this._internalCallback=function(){self._internalCallback=null;self.insert(null,"js");};this.insert(null,"css");return ;}this.loadNext();},sandbox:function(o,type){this._config(o);if(!this.onSuccess){throw new Error("You must supply an onSuccess handler for your sandbox");}this._sandbox=true;var self=this;if(!type||type!=="js"){this._internalCallback=function(){self._internalCallback=null;self.sandbox(null,"js");};this.insert(null,"css");return ;}if(!util.Connect){var ld=new YAHOO.util.YUILoader();ld.insert({base:this.base,filter:this.filter,require:"connection",insertBefore:this.insertBefore,charset:this.charset,onSuccess:function(){this.sandbox(null,"js");},scope:this},"js");return ;}this._scriptText=[];this._loadCount=0;this._stopCount=this.sorted.length;this._xhr=[];this.calculate();var s=this.sorted,l=s.length,i,m,url;for(i=0;i<l;i=i+1){m=this.moduleInfo[s[i]];if(!m){this._onFailure("undefined module "+m);for(var j=0;j<this._xhr.length;j=j+1){this._xhr[j].abort();}return ;}if(m.type!=="js"){this._loadCount++;continue;}url=m.fullpath;url=(url)?this._filter(url):this._url(m.path);var xhrData={success:function(o){var idx=o.argument[0],name=o.argument[2];this._scriptText[idx]=o.responseText;if(this.onProgress){this.onProgress.call(this.scope,{name:name,scriptText:o.responseText,xhrResponse:o,data:this.data});}this._loadCount++;if(this._loadCount>=this._stopCount){var v=this.varName||"YAHOO";var t="(function() {\n";var b="\nreturn "+v+";\n})();";var ref=eval(t+this._scriptText.join("\n")+b);this._pushEvents(ref);if(ref){this.onSuccess.call(this.scope,{reference:ref,data:this.data});}else{this._onFailure.call(this.varName+" reference failure");}}},failure:function(o){this.onFailure.call(this.scope,{msg:"XHR failure",xhrResponse:o,data:this.data});},scope:this,argument:[i,url,s[i]]};this._xhr.push(util.Connect.asyncRequest("GET",url,xhrData));}},loadNext:function(mname){if(!this._loading){return ;}if(mname){if(mname!==this._loading){return ;}this.inserted[mname]=true;if(this.onProgress){this.onProgress.call(this.scope,{name:mname,data:this.data});}}var s=this.sorted,len=s.length,i,m;for(i=0;i<len;i=i+1){if(s[i] in this.inserted){continue;}if(s[i]===this._loading){return ;}m=this.moduleInfo[s[i]];if(!m){this.onFailure.call(this.scope,{msg:"undefined module "+m,data:this.data});return ;}if(!this.loadType||this.loadType===m.type){this._loading=s[i];var fn=(m.type==="css")?util.Get.css:util.Get.script,url=m.fullpath,self=this,c=function(o){self.loadNext(o.data);};url=(url)?this._filter(url):this._url(m.path);if(env.ua.webkit&&env.ua.webkit<420&&m.type==="js"&&!m.varName){c=null;this._useYahooListener=true;}fn(url,{data:s[i],onSuccess:c,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,timeout:this.timeout,varName:m.varName,scope:self});return ;}}this._loading=null;if(this._internalCallback){var f=this._internalCallback;this._internalCallback=null;f.call(this);}else{if(this.onSuccess){this._pushEvents();this.onSuccess.call(this.scope,{data:this.data});}}},_pushEvents:function(ref){var r=ref||YAHOO;if(r.util&&r.util.Event){r.util.Event._load();}},_filter:function(str){var f=this.filter;return(f)?str.replace(new RegExp(f.searchExp),f.replaceStr):str;},_url:function(path){var u=this.base||"",f=this.filter;u=u+path;return this._filter(u);}};})();(function(){var B=YAHOO.util,F=YAHOO.lang,L,J,K={},G={},N=window.document;YAHOO.env._id_counter=YAHOO.env._id_counter||0;var C=YAHOO.env.ua.opera,M=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,H=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};var O=function(Q){if(!E.HYPHEN.test(Q)){return Q;}if(K[Q]){return K[Q];}var R=Q;while(E.HYPHEN.exec(R)){R=R.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}K[Q]=R;return R;};var P=function(R){var Q=G[R];if(!Q){Q=new RegExp("(?:^|\\s+)"+R+"(?:\\s+|$)");G[R]=Q;}return Q;};if(N.defaultView&&N.defaultView.getComputedStyle){L=function(Q,T){var S=null;if(T=="float"){T="cssFloat";}var R=Q.ownerDocument.defaultView.getComputedStyle(Q,"");if(R){S=R[O(T)];}return Q.style[T]||S;};}else{if(N.documentElement.currentStyle&&H){L=function(Q,S){switch(O(S)){case"opacity":var U=100;try{U=Q.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(T){try{U=Q.filters("alpha").opacity;}catch(T){}}return U/100;case"float":S="styleFloat";default:var R=Q.currentStyle?Q.currentStyle[S]:null;return(Q.style[S]||R);}};}else{L=function(Q,R){return Q.style[R];};}}if(H){J=function(Q,R,S){switch(R){case"opacity":if(F.isString(Q.style.filter)){Q.style.filter="alpha(opacity="+S*100+")";if(!Q.currentStyle||!Q.currentStyle.hasLayout){Q.style.zoom=1;}}break;case"float":R="styleFloat";default:Q.style[R]=S;}};}else{J=function(Q,R,S){if(R=="float"){R="cssFloat";}Q.style[R]=S;};}var D=function(Q,R){return Q&&Q.nodeType==1&&(!R||R(Q));};YAHOO.util.Dom={get:function(S){if(S){if(S.nodeType||S.item){return S;}if(typeof S==="string"){return N.getElementById(S);}if("length" in S){var T=[];for(var R=0,Q=S.length;R<Q;++R){T[T.length]=B.Dom.get(S[R]);}return T;}return S;}return null;},getStyle:function(Q,S){S=O(S);var R=function(T){return L(T,S);};return B.Dom.batch(Q,R,B.Dom,true);},setStyle:function(Q,S,T){S=O(S);var R=function(U){J(U,S,T);};B.Dom.batch(Q,R,B.Dom,true);},getXY:function(Q){var R=function(S){if((S.parentNode===null||S.offsetParent===null||this.getStyle(S,"display")=="none")&&S!=S.ownerDocument.body){return false;}return I(S);};return B.Dom.batch(Q,R,B.Dom,true);},getX:function(Q){var R=function(S){return B.Dom.getXY(S)[0];};return B.Dom.batch(Q,R,B.Dom,true);},getY:function(Q){var R=function(S){return B.Dom.getXY(S)[1];};return B.Dom.batch(Q,R,B.Dom,true);},setXY:function(Q,T,S){var R=function(W){var V=this.getStyle(W,"position");if(V=="static"){this.setStyle(W,"position","relative");V="relative";}var Y=this.getXY(W);if(Y===false){return false;}var X=[parseInt(this.getStyle(W,"left"),10),parseInt(this.getStyle(W,"top"),10)];if(isNaN(X[0])){X[0]=(V=="relative")?0:W.offsetLeft;}if(isNaN(X[1])){X[1]=(V=="relative")?0:W.offsetTop;}if(T[0]!==null){W.style.left=T[0]-Y[0]+X[0]+"px";}if(T[1]!==null){W.style.top=T[1]-Y[1]+X[1]+"px";}if(!S){var U=this.getXY(W);if((T[0]!==null&&U[0]!=T[0])||(T[1]!==null&&U[1]!=T[1])){this.setXY(W,T,true);}}};B.Dom.batch(Q,R,B.Dom,true);},setX:function(R,Q){B.Dom.setXY(R,[Q,null]);},setY:function(Q,R){B.Dom.setXY(Q,[null,R]);},getRegion:function(Q){var R=function(S){if((S.parentNode===null||S.offsetParent===null||this.getStyle(S,"display")=="none")&&S!=S.ownerDocument.body){return false;}var T=B.Region.getRegion(S);return T;};return B.Dom.batch(Q,R,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(U,Y,V,W){U=F.trim(U);Y=Y||"*";V=(V)?B.Dom.get(V):null||N;if(!V){return[];}var R=[],Q=V.getElementsByTagName(Y),X=P(U);for(var S=0,T=Q.length;S<T;++S){if(X.test(Q[S].className)){R[R.length]=Q[S];if(W){W.call(Q[S],Q[S]);}}}return R;},hasClass:function(S,R){var Q=P(R);var T=function(U){return Q.test(U.className);};return B.Dom.batch(S,T,B.Dom,true);},addClass:function(R,Q){var S=function(T){if(this.hasClass(T,Q)){return false;}T.className=F.trim([T.className,Q].join(" "));return true;};return B.Dom.batch(R,S,B.Dom,true);},removeClass:function(S,R){var Q=P(R);var T=function(W){var V=false,X=W.className;if(R&&X&&this.hasClass(W,R)){W.className=X.replace(Q," ");if(this.hasClass(W,R)){this.removeClass(W,R);}W.className=F.trim(W.className);if(W.className===""){var U=(W.hasAttribute)?"class":"className";W.removeAttribute(U);}V=true;}return V;};return B.Dom.batch(S,T,B.Dom,true);},replaceClass:function(T,R,Q){if(!Q||R===Q){return false;}var S=P(R);var U=function(V){if(!this.hasClass(V,R)){this.addClass(V,Q);return true;}V.className=V.className.replace(S," "+Q+" ");if(this.hasClass(V,R)){this.removeClass(V,R);}V.className=F.trim(V.className);return true;};return B.Dom.batch(T,U,B.Dom,true);},generateId:function(Q,S){S=S||"yui-gen";var R=function(T){if(T&&T.id){return T.id;}var U=S+YAHOO.env._id_counter++;if(T){T.id=U;}return U;};return B.Dom.batch(Q,R,B.Dom,true)||R.apply(B.Dom,arguments);},isAncestor:function(R,S){R=B.Dom.get(R);S=B.Dom.get(S);var Q=false;if((R&&S)&&(R.nodeType&&S.nodeType)){if(R.contains&&R!==S){Q=R.contains(S);}else{if(R.compareDocumentPosition){Q=!!(R.compareDocumentPosition(S)&16);}}}else{}return Q;},inDocument:function(Q){return this.isAncestor(N.documentElement,Q);},getElementsBy:function(X,R,S,U){R=R||"*";S=(S)?B.Dom.get(S):null||N;if(!S){return[];}var T=[],W=S.getElementsByTagName(R);for(var V=0,Q=W.length;V<Q;++V){if(X(W[V])){T[T.length]=W[V];if(U){U(W[V]);}}}return T;},batch:function(U,X,W,S){U=(U&&(U.tagName||U.item))?U:B.Dom.get(U);if(!U||!X){return false;}var T=(S)?W:window;if(U.tagName||U.length===undefined){return X.call(T,U,W);}var V=[];for(var R=0,Q=U.length;R<Q;++R){V[V.length]=X.call(T,U[R],W);}return V;},getDocumentHeight:function(){var R=(N.compatMode!="CSS1Compat")?N.body.scrollHeight:N.documentElement.scrollHeight;var Q=Math.max(R,B.Dom.getViewportHeight());return Q;},getDocumentWidth:function(){var R=(N.compatMode!="CSS1Compat")?N.body.scrollWidth:N.documentElement.scrollWidth;var Q=Math.max(R,B.Dom.getViewportWidth());return Q;},getViewportHeight:function(){var Q=self.innerHeight;
var R=N.compatMode;if((R||H)&&!C){Q=(R=="CSS1Compat")?N.documentElement.clientHeight:N.body.clientHeight;}return Q;},getViewportWidth:function(){var Q=self.innerWidth;var R=N.compatMode;if(R||H){Q=(R=="CSS1Compat")?N.documentElement.clientWidth:N.body.clientWidth;}return Q;},getAncestorBy:function(Q,R){while((Q=Q.parentNode)){if(D(Q,R)){return Q;}}return null;},getAncestorByClassName:function(R,Q){R=B.Dom.get(R);if(!R){return null;}var S=function(T){return B.Dom.hasClass(T,Q);};return B.Dom.getAncestorBy(R,S);},getAncestorByTagName:function(R,Q){R=B.Dom.get(R);if(!R){return null;}var S=function(T){return T.tagName&&T.tagName.toUpperCase()==Q.toUpperCase();};return B.Dom.getAncestorBy(R,S);},getPreviousSiblingBy:function(Q,R){while(Q){Q=Q.previousSibling;if(D(Q,R)){return Q;}}return null;},getPreviousSibling:function(Q){Q=B.Dom.get(Q);if(!Q){return null;}return B.Dom.getPreviousSiblingBy(Q);},getNextSiblingBy:function(Q,R){while(Q){Q=Q.nextSibling;if(D(Q,R)){return Q;}}return null;},getNextSibling:function(Q){Q=B.Dom.get(Q);if(!Q){return null;}return B.Dom.getNextSiblingBy(Q);},getFirstChildBy:function(Q,S){var R=(D(Q.firstChild,S))?Q.firstChild:null;return R||B.Dom.getNextSiblingBy(Q.firstChild,S);},getFirstChild:function(Q,R){Q=B.Dom.get(Q);if(!Q){return null;}return B.Dom.getFirstChildBy(Q);},getLastChildBy:function(Q,S){if(!Q){return null;}var R=(D(Q.lastChild,S))?Q.lastChild:null;return R||B.Dom.getPreviousSiblingBy(Q.lastChild,S);},getLastChild:function(Q){Q=B.Dom.get(Q);return B.Dom.getLastChildBy(Q);},getChildrenBy:function(R,T){var S=B.Dom.getFirstChildBy(R,T);var Q=S?[S]:[];B.Dom.getNextSiblingBy(S,function(U){if(!T||T(U)){Q[Q.length]=U;}return false;});return Q;},getChildren:function(Q){Q=B.Dom.get(Q);if(!Q){}return B.Dom.getChildrenBy(Q);},getDocumentScrollLeft:function(Q){Q=Q||N;return Math.max(Q.documentElement.scrollLeft,Q.body.scrollLeft);},getDocumentScrollTop:function(Q){Q=Q||N;return Math.max(Q.documentElement.scrollTop,Q.body.scrollTop);},insertBefore:function(R,Q){R=B.Dom.get(R);Q=B.Dom.get(Q);if(!R||!Q||!Q.parentNode){return null;}return Q.parentNode.insertBefore(R,Q);},insertAfter:function(R,Q){R=B.Dom.get(R);Q=B.Dom.get(Q);if(!R||!Q||!Q.parentNode){return null;}if(Q.nextSibling){return Q.parentNode.insertBefore(R,Q.nextSibling);}else{return Q.parentNode.appendChild(R);}},getClientRegion:function(){var S=B.Dom.getDocumentScrollTop(),R=B.Dom.getDocumentScrollLeft(),T=B.Dom.getViewportWidth()+R,Q=B.Dom.getViewportHeight()+S;return new B.Region(S,T,Q,R);}};var I=function(){if(N.documentElement.getBoundingClientRect){return function(S){var T=S.getBoundingClientRect(),R=Math.round;var Q=S.ownerDocument;return[R(T.left+B.Dom.getDocumentScrollLeft(Q)),R(T.top+B.Dom.getDocumentScrollTop(Q))];};}else{return function(S){var T=[S.offsetLeft,S.offsetTop];var R=S.offsetParent;var Q=(M&&B.Dom.getStyle(S,"position")=="absolute"&&S.offsetParent==S.ownerDocument.body);if(R!=S){while(R){T[0]+=R.offsetLeft;T[1]+=R.offsetTop;if(!Q&&M&&B.Dom.getStyle(R,"position")=="absolute"){Q=true;}R=R.offsetParent;}}if(Q){T[0]-=S.ownerDocument.body.offsetLeft;T[1]-=S.ownerDocument.body.offsetTop;}R=S.parentNode;while(R.tagName&&!E.ROOT_TAG.test(R.tagName)){if(R.scrollTop||R.scrollLeft){T[0]-=R.scrollLeft;T[1]-=R.scrollTop;}R=R.parentNode;}return T;};}}();})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.6.0",build:"1321"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){this.lastError=null;var K=[],E=this.subscribers.length;if(!E&&this.silent){return true;}var I=[].slice.call(arguments,0),G=true,D,J=false;if(!this.silent){}var C=this.subscribers.slice(),A=YAHOO.util.Event.throwErrors;for(D=0;D<E;++D){var M=C[D];if(!M){J=true;}else{if(!this.silent){}var L=M.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(I.length>0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var K=YAHOO.env.ua.ie?"focusin":"focus";var L=YAHOO.env.ua.ie?"focusout":"blur";return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var M=this;var N=function(){M._tryPreloadAttach();};this._interval=setInterval(N,this.POLL_INTERVAL);}},onAvailable:function(R,O,S,Q,P){var M=(YAHOO.lang.isString(R))?[R]:R;for(var N=0;N<M.length;N=N+1){F.push({id:M[N],fn:O,obj:S,override:Q,checkReady:P});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(O,M,P,N){this.onAvailable(O,M,P,N,true);},onDOMReady:function(M,O,N){if(this.DOMReady){setTimeout(function(){var P=window;if(N){if(N===true){P=O;}else{P=N;}}M.call(P,"DOMReady",[],O);},0);}else{this.DOMReadyEvent.subscribe(M,O,N);}},_addListener:function(O,M,X,S,N,a){if(!X||!X.call){return false;}if(this._isValidCollection(O)){var Y=true;for(var T=0,V=O.length;T<V;++T){Y=this._addListener(O[T],M,X,S,N,a)&&Y;}return Y;}else{if(YAHOO.lang.isString(O)){var R=this.getEl(O);if(R){O=R;}else{this.onAvailable(O,function(){YAHOO.util.Event._addListener(O,M,X,S,N,a);});return true;}}}if(!O){return false;}if("unload"==M&&S!==this){J[J.length]=[O,M,X,S,N,a];return true;}var b=O;if(N){if(N===true){b=S;}else{b=N;}}var P=function(c){return X.call(b,YAHOO.util.Event.getEvent(c,O),S);};var Z=[O,M,X,P,b,S,N,a];var U=I.length;I[U]=Z;if(this.useLegacyEvent(O,M)){var Q=this.getLegacyIndex(O,M);if(Q==-1||O!=G[Q][0]){Q=G.length;B[O.id+M]=Q;G[Q]=[O,M,O["on"+M]];E[Q]=[];O["on"+M]=function(c){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(c),Q);};}E[Q].push(Z);}else{try{this._simpleAdd(O,M,P,a);}catch(W){this.lastError=W;this._removeListener(O,M,X,a);return false;}}return true;},addListener:function(O,Q,N,P,M){return this._addListener(O,Q,N,P,M,false);},addFocusListener:function(O,N,P,M){return this._addListener(O,K,N,P,M,true);},removeFocusListener:function(N,M){return this._removeListener(N,K,M,true);},addBlurListener:function(O,N,P,M){return this._addListener(O,L,N,P,M,true);},removeBlurListener:function(N,M){return this._removeListener(N,L,M,true);},fireLegacyEvent:function(Q,O){var S=true,M,U,T,V,R;U=E[O].slice();for(var N=0,P=U.length;N<P;++N){T=U[N];if(T&&T[this.WFN]){V=T[this.ADJ_SCOPE];R=T[this.WFN].call(V,Q);S=(S&&R);}}M=G[O];if(M&&M[2]){M[2](Q);}return S;},getLegacyIndex:function(N,O){var M=this.generateId(N)+O;if(typeof B[M]=="undefined"){return -1;}else{return B[M];}},useLegacyEvent:function(M,N){return(this.webkit&&this.webkit<419&&("click"==N||"dblclick"==N));},_removeListener:function(N,M,V,Y){var Q,T,X;if(typeof N=="string"){N=this.getEl(N);}else{if(this._isValidCollection(N)){var W=true;for(Q=N.length-1;Q>-1;Q--){W=(this._removeListener(N[Q],M,V,Y)&&W);}return W;}}if(!V||!V.call){return this.purgeElement(N,false,M);}if("unload"==M){for(Q=J.length-1;Q>-1;Q--){X=J[Q];if(X&&X[0]==N&&X[1]==M&&X[2]==V){J.splice(Q,1);return true;}}return false;}var R=null;var S=arguments[4];if("undefined"===typeof S){S=this._getCacheIndex(N,M,V);}if(S>=0){R=I[S];}if(!N||!R){return false;}if(this.useLegacyEvent(N,M)){var P=this.getLegacyIndex(N,M);var O=E[P];if(O){for(Q=0,T=O.length;Q<T;++Q){X=O[Q];if(X&&X[this.EL]==N&&X[this.TYPE]==M&&X[this.FN]==V){O.splice(Q,1);break;}}}}else{try{this._simpleRemove(N,M,R[this.WFN],Y);}catch(U){this.lastError=U;return false;}}delete I[S][this.WFN];delete I[S][this.FN];
I.splice(S,1);return true;},removeListener:function(N,O,M){return this._removeListener(N,O,M,false);},getTarget:function(O,N){var M=O.target||O.srcElement;return this.resolveTextNode(M);},resolveTextNode:function(N){try{if(N&&3==N.nodeType){return N.parentNode;}}catch(M){}return N;},getPageX:function(N){var M=N.pageX;if(!M&&0!==M){M=N.clientX||0;if(this.isIE){M+=this._getScrollLeft();}}return M;},getPageY:function(M){var N=M.pageY;if(!N&&0!==N){N=M.clientY||0;if(this.isIE){N+=this._getScrollTop();}}return N;},getXY:function(M){return[this.getPageX(M),this.getPageY(M)];},getRelatedTarget:function(N){var M=N.relatedTarget;if(!M){if(N.type=="mouseout"){M=N.toElement;}else{if(N.type=="mouseover"){M=N.fromElement;}}}return this.resolveTextNode(M);},getTime:function(O){if(!O.time){var N=new Date().getTime();try{O.time=N;}catch(M){this.lastError=M;return N;}}return O.time;},stopEvent:function(M){this.stopPropagation(M);this.preventDefault(M);},stopPropagation:function(M){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}},preventDefault:function(M){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}},getEvent:function(O,M){var N=O||window.event;if(!N){var P=this.getEvent.caller;while(P){N=P.arguments[0];if(N&&Event==N.constructor){break;}P=P.caller;}}return N;},getCharCode:function(N){var M=N.keyCode||N.charCode||0;if(YAHOO.env.ua.webkit&&(M in D)){M=D[M];}return M;},_getCacheIndex:function(Q,R,P){for(var O=0,N=I.length;O<N;O=O+1){var M=I[O];if(M&&M[this.FN]==P&&M[this.EL]==Q&&M[this.TYPE]==R){return O;}}return -1;},generateId:function(M){var N=M.id;if(!N){N="yuievtautoid-"+A;++A;M.id=N;}return N;},_isValidCollection:function(N){try{return(N&&typeof N!=="string"&&N.length&&!N.tagName&&!N.alert&&typeof N[0]!=="undefined");}catch(M){return false;}},elCache:{},getEl:function(M){return(typeof M==="string")?document.getElementById(M):M;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(N){if(!H){H=true;var M=YAHOO.util.Event;M._ready();M._tryPreloadAttach();}},_ready:function(N){var M=YAHOO.util.Event;if(!M.DOMReady){M.DOMReady=true;M.DOMReadyEvent.fire();M._simpleRemove(document,"DOMContentLoaded",M._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;clearInterval(this._interval);this._interval=null;return ;}if(this.locked){return ;}if(this.isIE){if(!this.DOMReady){this.startInterval();return ;}}this.locked=true;var S=!H;if(!S){S=(C>0&&F.length>0);}var R=[];var T=function(V,W){var U=V;if(W.override){if(W.override===true){U=W.obj;}else{U=W.override;}}W.fn.call(U,W.obj);};var N,M,Q,P,O=[];for(N=0,M=F.length;N<M;N=N+1){Q=F[N];if(Q){P=this.getEl(Q.id);if(P){if(Q.checkReady){if(H||P.nextSibling||!S){O.push(Q);F[N]=null;}}else{T(P,Q);F[N]=null;}}else{R.push(Q);}}}for(N=0,M=O.length;N<M;N=N+1){Q=O[N];T(this.getEl(Q.id),Q);}C--;if(S){for(N=F.length-1;N>-1;N--){Q=F[N];if(!Q||!Q.id){F.splice(N,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(Q,R,T){var O=(YAHOO.lang.isString(Q))?this.getEl(Q):Q;var S=this.getListeners(O,T),P,M;if(S){for(P=S.length-1;P>-1;P--){var N=S[P];this._removeListener(O,N.type,N.fn,N.capture);}}if(R&&O&&O.childNodes){for(P=0,M=O.childNodes.length;P<M;++P){this.purgeElement(O.childNodes[P],R,T);}}},getListeners:function(O,M){var R=[],N;if(!M){N=[I,J];}else{if(M==="unload"){N=[J];}else{N=[I];}}var T=(YAHOO.lang.isString(O))?this.getEl(O):O;for(var Q=0;Q<N.length;Q=Q+1){var V=N[Q];if(V){for(var S=0,U=V.length;S<U;++S){var P=V[S];if(P&&P[this.EL]===T&&(!M||M===P[this.TYPE])){R.push({type:P[this.TYPE],fn:P[this.FN],obj:P[this.OBJ],adjust:P[this.OVERRIDE],scope:P[this.ADJ_SCOPE],capture:P[this.CAPTURE],index:S});}}}}return(R.length)?R:null;},_unload:function(S){var M=YAHOO.util.Event,P,O,N,R,Q,T=J.slice();for(P=0,R=J.length;P<R;++P){N=T[P];if(N){var U=window;if(N[M.ADJ_SCOPE]){if(N[M.ADJ_SCOPE]===true){U=N[M.UNLOAD_OBJ];}else{U=N[M.ADJ_SCOPE];}}N[M.FN].call(U,M.getEvent(S,N[M.EL]),N[M.UNLOAD_OBJ]);T[P]=null;N=null;U=null;}}J=null;if(I){for(O=I.length-1;O>-1;O--){N=I[O];if(N){M._removeListener(N[M.EL],N[M.TYPE],N[M.FN],N[M.CAPTURE],O);}}N=null;}G=null;M._simpleRemove(window,"unload",M._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var M=document.documentElement,N=document.body;if(M&&(M.scrollTop||M.scrollLeft)){return[M.scrollTop,M.scrollLeft];}else{if(N){return[N.scrollTop,N.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(O,P,N,M){O.addEventListener(P,N,(M));};}else{if(window.attachEvent){return function(O,P,N,M){O.attachEvent("on"+P,N);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(O,P,N,M){O.removeEventListener(P,N,(M));};}else{if(window.detachEvent){return function(N,O,M){N.detachEvent("on"+O,M);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener;
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};
var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(J,I){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(J.shiftKey==F.shift&&J.altKey==F.alt&&J.ctrlKey==F.ctrl){var G;if(F.keys instanceof Array){for(var H=0;H<F.keys.length;H++){G=F.keys[H];if(G==J.charCode){D.fire(J.charCode,J);break;}else{if(G==J.keyCode){D.fire(J.keyCode,J);break;}}}}else{G=F.keys;if(G==J.charCode){D.fire(J.charCode,J);}else{if(G==J.keyCode){D.fire(J.keyCode,J);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};YAHOO.register("event",YAHOO.util.Event,{version:"2.6.0",build:"1321"});YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:true,_default_xhr_header:"XMLHttpRequest",_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function(){if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,"click",function(B){var A=YAHOO.util.Event.getTarget(B);if(A.nodeName.toLowerCase()=="input"&&(A.type&&A.type.toLowerCase()=="submit")){YAHOO.util.Connect._submitElementValue=encodeURIComponent(A.name)+"="+encodeURIComponent(A.value);}});return true;}return false;})(),startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),uploadEvent:new YAHOO.util.CustomEvent("upload"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(A){this._msxml_progid.unshift(A);},setDefaultPostHeader:function(A){if(typeof A=="string"){this._default_post_header=A;}else{if(typeof A=="boolean"){this._use_default_post_header=A;}}},setDefaultXhrHeader:function(A){if(typeof A=="string"){this._default_xhr_header=A;}else{this._use_default_xhr_header=A;}},setPollingInterval:function(A){if(typeof A=="number"&&isFinite(A)){this._polling_interval=A;}},createXhrObject:function(F){var E,A;try{A=new XMLHttpRequest();E={conn:A,tId:F};}catch(D){for(var B=0;B<this._msxml_progid.length;++B){try{A=new ActiveXObject(this._msxml_progid[B]);E={conn:A,tId:F};break;}catch(C){}}}finally{return E;}},getConnectionObject:function(A){var C;var D=this._transaction_id;try{if(!A){C=this.createXhrObject(D);}else{C={};C.tId=D;C.isUpload=true;}if(C){this._transaction_id++;}}catch(B){}finally{return C;}},asyncRequest:function(F,C,E,A){var D=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();var B=(E&&E.argument)?E.argument:null;if(!D){return null;}else{if(E&&E.customevents){this.initCustomEvents(D,E);}if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(D,E,C,A);return D;}if(F.toUpperCase()=="GET"){if(this._sFormData.length!==0){C+=((C.indexOf("?")==-1)?"?":"&")+this._sFormData;}}else{if(F.toUpperCase()=="POST"){A=A?this._sFormData+"&"+A:this._sFormData;}}}if(F.toUpperCase()=="GET"&&(E&&E.cache===false)){C+=((C.indexOf("?")==-1)?"?":"&")+"rnd="+new Date().valueOf().toString();}D.conn.open(F,C,true);if(this._use_default_xhr_header){if(!this._default_headers["X-Requested-With"]){this.initHeader("X-Requested-With",this._default_xhr_header,true);}}if((F.toUpperCase()==="POST"&&this._use_default_post_header)&&this._isFormSubmit===false){this.initHeader("Content-Type",this._default_post_header);}if(this._has_default_headers||this._has_http_headers){this.setHeader(D);}this.handleReadyState(D,E);D.conn.send(A||"");if(this._isFormSubmit===true){this.resetFormState();}this.startEvent.fire(D,B);if(D.startEvent){D.startEvent.fire(D,B);}return D;}},initCustomEvents:function(A,C){var B;for(B in C.customevents){if(this._customEvents[B][0]){A[this._customEvents[B][0]]=new YAHOO.util.CustomEvent(this._customEvents[B][1],(C.scope)?C.scope:null);A[this._customEvents[B][0]].subscribe(C.customevents[B]);}}},handleReadyState:function(C,D){var B=this;var A=(D&&D.argument)?D.argument:null;if(D&&D.timeout){this._timeOut[C.tId]=window.setTimeout(function(){B.abort(C,D,true);},D.timeout);}this._poll[C.tId]=window.setInterval(function(){if(C.conn&&C.conn.readyState===4){window.clearInterval(B._poll[C.tId]);delete B._poll[C.tId];if(D&&D.timeout){window.clearTimeout(B._timeOut[C.tId]);delete B._timeOut[C.tId];}B.completeEvent.fire(C,A);if(C.completeEvent){C.completeEvent.fire(C,A);}B.handleTransactionResponse(C,D);}},this._polling_interval);},handleTransactionResponse:function(F,G,A){var D,C;var B=(G&&G.argument)?G.argument:null;try{if(F.conn.status!==undefined&&F.conn.status!==0){D=F.conn.status;}else{D=13030;}}catch(E){D=13030;}if(D>=200&&D<300||D===1223){C=this.createResponseObject(F,B);if(G&&G.success){if(!G.scope){G.success(C);}else{G.success.apply(G.scope,[C]);}}this.successEvent.fire(C);if(F.successEvent){F.successEvent.fire(C);}}else{switch(D){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:C=this.createExceptionObject(F.tId,B,(A?A:false));if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}break;default:C=this.createResponseObject(F,B);if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}}this.failureEvent.fire(C);if(F.failureEvent){F.failureEvent.fire(C);}}this.releaseObject(F);C=null;},createResponseObject:function(A,G){var D={};var I={};try{var C=A.conn.getAllResponseHeaders();var F=C.split("\n");for(var E=0;E<F.length;E++){var B=F[E].indexOf(":");if(B!=-1){I[F[E].substring(0,B)]=F[E].substring(B+2);}}}catch(H){}D.tId=A.tId;D.status=(A.conn.status==1223)?204:A.conn.status;D.statusText=(A.conn.status==1223)?"No Content":A.conn.statusText;D.getResponseHeader=I;D.getAllResponseHeaders=C;D.responseText=A.conn.responseText;D.responseXML=A.conn.responseXML;if(G){D.argument=G;}return D;},createExceptionObject:function(H,D,A){var F=0;var G="communication failure";var C=-1;var B="transaction aborted";var E={};E.tId=H;if(A){E.status=C;E.statusText=B;}else{E.status=F;E.statusText=G;}if(D){E.argument=D;}return E;},initHeader:function(A,D,C){var B=(C)?this._default_headers:this._http_headers;B[A]=D;if(C){this._has_default_headers=true;}else{this._has_http_headers=true;
}},setHeader:function(A){var B;if(this._has_default_headers){for(B in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,B)){A.conn.setRequestHeader(B,this._default_headers[B]);}}}if(this._has_http_headers){for(B in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,B)){A.conn.setRequestHeader(B,this._http_headers[B]);}}delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(M,H,C){var L,B,K,I,P,J=false,F=[],O=0,E,G,D,N,A;this.resetFormState();if(typeof M=="string"){L=(document.getElementById(M)||document.forms[M]);}else{if(typeof M=="object"){L=M;}else{return ;}}if(H){this.createFrame(C?C:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=L;return ;}for(E=0,G=L.elements.length;E<G;++E){B=L.elements[E];P=B.disabled;K=B.name;if(!P&&K){K=encodeURIComponent(K)+"=";I=encodeURIComponent(B.value);switch(B.type){case"select-one":if(B.selectedIndex>-1){A=B.options[B.selectedIndex];F[O++]=K+encodeURIComponent((A.attributes.value&&A.attributes.value.specified)?A.value:A.text);}break;case"select-multiple":if(B.selectedIndex>-1){for(D=B.selectedIndex,N=B.options.length;D<N;++D){A=B.options[D];if(A.selected){F[O++]=K+encodeURIComponent((A.attributes.value&&A.attributes.value.specified)?A.value:A.text);}}}break;case"radio":case"checkbox":if(B.checked){F[O++]=K+I;}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(J===false){if(this._hasSubmitListener&&this._submitElementValue){F[O++]=this._submitElementValue;}else{F[O++]=K+I;}J=true;}break;default:F[O++]=K+I;}}}this._isFormSubmit=true;this._sFormData=F.join("&");this.initHeader("Content-Type",this._default_form_header);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(A){var B="yuiIO"+this._transaction_id;var C;if(YAHOO.env.ua.ie){C=document.createElement('<iframe id="'+B+'" name="'+B+'" />');if(typeof A=="boolean"){C.src="javascript:false";}}else{C=document.createElement("iframe");C.id=B;C.name=B;}C.style.position="absolute";C.style.top="-1000px";C.style.left="-1000px";document.body.appendChild(C);},appendPostData:function(A){var D=[],B=A.split("&"),C,E;for(C=0;C<B.length;C++){E=B[C].indexOf("=");if(E!=-1){D[C]=document.createElement("input");D[C].type="hidden";D[C].name=decodeURIComponent(B[C].substring(0,E));D[C].value=decodeURIComponent(B[C].substring(E+1));this._formNode.appendChild(D[C]);}}return D;},uploadFile:function(D,N,E,C){var I="yuiIO"+D.tId,J="multipart/form-data",L=document.getElementById(I),O=this,K=(N&&N.argument)?N.argument:null,M,H,B,G;var A={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};this._formNode.setAttribute("action",E);this._formNode.setAttribute("method","POST");this._formNode.setAttribute("target",I);if(YAHOO.env.ua.ie){this._formNode.setAttribute("encoding",J);}else{this._formNode.setAttribute("enctype",J);}if(C){M=this.appendPostData(C);}this._formNode.submit();this.startEvent.fire(D,K);if(D.startEvent){D.startEvent.fire(D,K);}if(N&&N.timeout){this._timeOut[D.tId]=window.setTimeout(function(){O.abort(D,N,true);},N.timeout);}if(M&&M.length>0){for(H=0;H<M.length;H++){this._formNode.removeChild(M[H]);}}for(B in A){if(YAHOO.lang.hasOwnProperty(A,B)){if(A[B]){this._formNode.setAttribute(B,A[B]);}else{this._formNode.removeAttribute(B);}}}this.resetFormState();var F=function(){if(N&&N.timeout){window.clearTimeout(O._timeOut[D.tId]);delete O._timeOut[D.tId];}O.completeEvent.fire(D,K);if(D.completeEvent){D.completeEvent.fire(D,K);}G={tId:D.tId,argument:N.argument};try{G.responseText=L.contentWindow.document.body?L.contentWindow.document.body.innerHTML:L.contentWindow.document.documentElement.textContent;G.responseXML=L.contentWindow.document.XMLDocument?L.contentWindow.document.XMLDocument:L.contentWindow.document;}catch(P){}if(N&&N.upload){if(!N.scope){N.upload(G);}else{N.upload.apply(N.scope,[G]);}}O.uploadEvent.fire(G);if(D.uploadEvent){D.uploadEvent.fire(G);}YAHOO.util.Event.removeListener(L,"load",F);setTimeout(function(){document.body.removeChild(L);O.releaseObject(D);},100);};YAHOO.util.Event.addListener(L,"load",F);},abort:function(E,G,A){var D;var B=(G&&G.argument)?G.argument:null;if(E&&E.conn){if(this.isCallInProgress(E)){E.conn.abort();window.clearInterval(this._poll[E.tId]);delete this._poll[E.tId];if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{if(E&&E.isUpload===true){var C="yuiIO"+E.tId;var F=document.getElementById(C);if(F){YAHOO.util.Event.removeListener(F,"load");document.body.removeChild(F);if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{D=false;}}if(D===true){this.abortEvent.fire(E,B);if(E.abortEvent){E.abortEvent.fire(E,B);}this.handleTransactionResponse(E,G,true);}return D;},isCallInProgress:function(B){if(B&&B.conn){return B.conn.readyState!==4&&B.conn.readyState!==0;}else{if(B&&B.isUpload===true){var A="yuiIO"+B.tId;return document.getElementById(A)?true:false;}else{return false;}}},releaseObject:function(A){if(A&&A.conn){A.conn=null;A=null;}}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.6.0",build:"1321"});(function(){var B=YAHOO.util;var A=function(D,C,E,F){if(!D){}this.init(D,C,E,F);};A.NAME="Anim";A.prototype={toString:function(){var C=this.getEl()||{};var D=C.id||C.tagName;return(this.constructor.NAME+": "+D);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(C,E,D){return this.method(this.currentFrame,E,D-E,this.totalFrames);},setAttribute:function(C,E,D){if(this.patterns.noNegatives.test(C)){E=(E>0)?E:0;}B.Dom.setStyle(this.getEl(),C,E+D);},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G<C;++G){E[G]=I[G]+F[D]["by"][G]*1;}}else{E=I+F[D]["by"]*1;}}}this.runtimeAttributes[D].start=I;this.runtimeAttributes[D].end=E;this.runtimeAttributes[D].unit=(H(F[D].unit))?F[D]["unit"]:this.getDefaultUnit(D);return true;},init:function(E,J,I,C){var D=false;var F=null;var H=0;E=B.Dom.get(E);this.attributes=J||{};this.duration=!YAHOO.lang.isUndefined(I)?I:1;this.method=C||B.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=B.AnimMgr.fps;this.setEl=function(M){E=B.Dom.get(M);};this.getEl=function(){return E;};this.isAnimated=function(){return D;};this.getStartTime=function(){return F;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(B.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}B.AnimMgr.registerElement(this);return true;};this.stop=function(M){if(!this.isAnimated()){return false;}if(M){this.currentFrame=this.totalFrames;this._onTween.fire();}B.AnimMgr.stop(this);};var L=function(){this.onStart.fire();this.runtimeAttributes={};for(var M in this.attributes){this.setRuntimeAttribute(M);}D=true;H=0;F=new Date();};var K=function(){var O={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};O.toString=function(){return("duration: "+O.duration+", currentFrame: "+O.currentFrame);};this.onTween.fire(O);var N=this.runtimeAttributes;for(var M in N){this.setAttribute(M,this.doMethod(M,N[M].start,N[M].end),N[M].unit);}H+=1;};var G=function(){var M=(new Date()-F)/1000;var N={duration:M,frames:H,fps:H/M};N.toString=function(){return("duration: "+N.duration+", frames: "+N.frames+", fps: "+N.fps);};D=false;H=0;this.onComplete.fire(N);};this._onStart=new B.CustomEvent("_start",this,true);this.onStart=new B.CustomEvent("start",this);this.onTween=new B.CustomEvent("tween",this);this._onTween=new B.CustomEvent("_tween",this,true);this.onComplete=new B.CustomEvent("complete",this);this._onComplete=new B.CustomEvent("_complete",this,true);this._onStart.subscribe(L);this._onTween.subscribe(K);this._onComplete.subscribe(G);}};B.Anim=A;})();YAHOO.util.AnimMgr=new function(){var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};this.unRegister=function(G,F){F=F||E(G);if(!G.isAnimated()||F==-1){return false;}G._onComplete.fire();B.splice(F,1);A-=1;if(A<=0){this.stop();}return true;};this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};this.stop=function(H){if(!H){clearInterval(C);for(var G=0,F=B.length;G<F;++G){this.unRegister(B[0],0);}B=[];C=null;A=0;}else{this.unRegister(H);}};this.run=function(){for(var H=0,F=B.length;H<F;++H){var G=B[H];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){D(G);}G._onTween.fire();}else{YAHOO.util.AnimMgr.stop(G,H);}}};var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]==H){return G;}}return -1;};var D=function(G){var J=G.totalFrames;var I=G.currentFrame;var H=(G.currentFrame*G.duration*1000/G.totalFrames);var F=(new Date()-G.getStartTime());var K=0;if(F<G.duration*1000){K=Math.round((F/H-1)*G.currentFrame);}else{K=J-(I+1);}if(K>0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B<F;++B){C[B]=[E[B][0],E[B][1]];}for(var A=1;A<F;++A){for(B=0;B<F-A;++B){C[B][0]=(1-D)*C[B][0]+D*C[parseInt(B+1,10)][0];C[B][1]=(1-D)*C[B][1]+D*C[parseInt(B+1,10)][1];}}return[C[0][0],C[0][1]];};};(function(){var A=function(F,E,G,H){A.superclass.constructor.call(this,F,E,G,H);};A.NAME="ColorAnim";A.DEFAULT_BGCOLOR="#fff";var C=YAHOO.util;YAHOO.extend(A,C.Anim);var D=A.superclass;var B=A.prototype;B.patterns.color=/color$/i;B.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;B.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;B.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;B.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;B.parseColor=function(E){if(E.length==3){return E;}var F=this.patterns.hex.exec(E);if(F&&F.length==4){return[parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16)];}F=this.patterns.rgb.exec(E);if(F&&F.length==4){return[parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10)];}F=this.patterns.hex3.exec(E);if(F&&F.length==4){return[parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16)];}return null;};B.getAttribute=function(E){var G=this.getEl();
if(this.patterns.color.test(E)){var I=YAHOO.util.Dom.getStyle(G,E);var H=this;if(this.patterns.transparent.test(I)){var F=YAHOO.util.Dom.getAncestorBy(G,function(J){return !H.patterns.transparent.test(I);});if(F){I=C.Dom.getStyle(F,E);}else{I=A.DEFAULT_BGCOLOR;}}}else{I=D.getAttribute.call(this,E);}return I;};B.doMethod=function(F,J,G){var I;if(this.patterns.color.test(F)){I=[];for(var H=0,E=J.length;H<E;++H){I[H]=D.doMethod.call(this,F,J[H],G[H]);}I="rgb("+Math.floor(I[0])+","+Math.floor(I[1])+","+Math.floor(I[2])+")";}else{I=D.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(F){D.setRuntimeAttribute.call(this,F);if(this.patterns.color.test(F)){var H=this.attributes;var J=this.parseColor(this.runtimeAttributes[F].start);var G=this.parseColor(this.runtimeAttributes[F].end);if(typeof H[F]["to"]==="undefined"&&typeof H[F]["by"]!=="undefined"){G=this.parseColor(H[F].by);for(var I=0,E=J.length;I<E;++I){G[I]=J[I]+G[I];}}this.runtimeAttributes[F].start=J;this.runtimeAttributes[F].end=G;}};C.ColorAnim=A;})();
/*
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright 2001 Robert Penner All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
YAHOO.util.Easing={easeNone:function(B,A,D,C){return D*B/C+A;},easeIn:function(B,A,D,C){return D*(B/=C)*B+A;},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A;},easeBoth:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A;}return -D/2*((--B)*(B-2)-1)+A;},easeInStrong:function(B,A,D,C){return D*(B/=C)*B*B*B+A;},easeOutStrong:function(B,A,D,C){return -D*((B=B/C-1)*B*B*B-1)+A;},easeBothStrong:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B*B*B+A;}return -D/2*((B-=2)*B*B*B-2)+A;},elasticIn:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return -(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;},elasticOut:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return B*Math.pow(2,-10*C)*Math.sin((C*F-D)*(2*Math.PI)/E)+G+A;},elasticBoth:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F/2)==2){return A+G;}if(!E){E=F*(0.3*1.5);}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}if(C<1){return -0.5*(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;}return B*Math.pow(2,-10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E)*0.5+G+A;},backIn:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*(B/=D)*B*((C+1)*B-C)+A;},backOut:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*((B=B/D-1)*B*((C+1)*B+C)+1)+A;},backBoth:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}if((B/=D/2)<1){return E/2*(B*B*(((C*=(1.525))+1)*B-C))+A;}return E/2*((B-=2)*B*(((C*=(1.525))+1)*B+C)+2)+A;},bounceIn:function(B,A,D,C){return D-YAHOO.util.Easing.bounceOut(C-B,0,D,C)+A;},bounceOut:function(B,A,D,C){if((B/=C)<(1/2.75)){return D*(7.5625*B*B)+A;}else{if(B<(2/2.75)){return D*(7.5625*(B-=(1.5/2.75))*B+0.75)+A;}else{if(B<(2.5/2.75)){return D*(7.5625*(B-=(2.25/2.75))*B+0.9375)+A;}}}return D*(7.5625*(B-=(2.625/2.75))*B+0.984375)+A;},bounceBoth:function(B,A,D,C){if(B<C/2){return YAHOO.util.Easing.bounceIn(B*2,0,D,C)*0.5+A;}return YAHOO.util.Easing.bounceOut(B*2-C,0,D,C)*0.5+D*0.5+A;}};(function(){var A=function(H,G,I,J){if(H){A.superclass.constructor.call(this,H,G,I,J);}};A.NAME="Motion";var E=YAHOO.util;YAHOO.extend(A,E.ColorAnim);var F=A.superclass;var C=A.prototype;C.patterns.points=/^points$/i;C.setAttribute=function(G,I,H){if(this.patterns.points.test(G)){H=H||"px";F.setAttribute.call(this,"left",I[0],H);F.setAttribute.call(this,"top",I[1],H);}else{F.setAttribute.call(this,G,I,H);}};C.getAttribute=function(G){if(this.patterns.points.test(G)){var H=[F.getAttribute.call(this,"left"),F.getAttribute.call(this,"top")];}else{H=F.getAttribute.call(this,G);}return H;};C.doMethod=function(G,K,H){var J=null;if(this.patterns.points.test(G)){var I=this.method(this.currentFrame,0,100,this.totalFrames)/100;J=E.Bezier.getPosition(this.runtimeAttributes[G],I);}else{J=F.doMethod.call(this,G,K,H);}return J;};C.setRuntimeAttribute=function(P){if(this.patterns.points.test(P)){var H=this.getEl();var J=this.attributes;var G;var L=J["points"]["control"]||[];var I;var M,O;if(L.length>0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M<O;++M){K[M]=L[M];}L=K;}if(E.Dom.getStyle(H,"position")=="static"){E.Dom.setStyle(H,"position","relative");}if(D(J["points"]["from"])){E.Dom.setXY(H,J["points"]["from"]);}else{E.Dom.setXY(H,E.Dom.getXY(H));
}G=this.getAttribute("points");if(D(J["points"]["to"])){I=B.call(this,J["points"]["to"],G);var N=E.Dom.getXY(this.getEl());for(M=0,O=L.length;M<O;++M){L[M]=B.call(this,L[M],G);}}else{if(D(J["points"]["by"])){I=[G[0]+J["points"]["by"][0],G[1]+J["points"]["by"][1]];for(M=0,O=L.length;M<O;++M){L[M]=[G[0]+L[M][0],G[1]+L[M][1]];}}}this.runtimeAttributes[P]=[G];if(L.length>0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.6.0",build:"1321"});if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var A=YAHOO.util.Event,B=YAHOO.util.Dom;return{useShim:false,_shimActive:false,_shimState:false,_debugShim:false,_createShim:function(){var C=document.createElement("div");C.id="yui-ddm-shim";if(document.body.firstChild){document.body.insertBefore(C,document.body.firstChild);}else{document.body.appendChild(C);}C.style.display="none";C.style.backgroundColor="red";C.style.position="absolute";C.style.zIndex="99999";B.setStyle(C,"opacity","0");this._shim=C;A.on(C,"mouseup",this.handleMouseUp,this,true);A.on(C,"mousemove",this.handleMouseMove,this,true);A.on(window,"scroll",this._sizeShim,this,true);},_sizeShim:function(){if(this._shimActive){var C=this._shim;C.style.height=B.getDocumentHeight()+"px";C.style.width=B.getDocumentWidth()+"px";C.style.top="0";C.style.left="0";}},_activateShim:function(){if(this.useShim){if(!this._shim){this._createShim();}this._shimActive=true;var C=this._shim,D="0";if(this._debugShim){D=".5";}B.setStyle(C,"opacity",D);this._sizeShim();C.style.display="block";}},_deactivateShim:function(){this._shim.style.display="none";this._shimActive=false;},_shim:null,ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(E,D){for(var F in this.ids){for(var C in this.ids[F]){var G=this.ids[F][C];if(!this.isTypeOfDD(G)){continue;}G[E].apply(G,D);}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);},_onResize:function(C){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,fromTimeout:false,regDragDrop:function(D,C){if(!this.initialized){this.init();}if(!this.ids[C]){this.ids[C]={};}this.ids[C][D.id]=D;},removeDDFromGroup:function(E,C){if(!this.ids[C]){this.ids[C]={};}var D=this.ids[C];if(D&&D[E.id]){delete D[E.id];}},_remove:function(E){for(var D in E.groups){if(D){var C=this.ids[D];if(C&&C[E.id]){delete C[E.id];}}}delete this.handleIds[E.id];},regHandle:function(D,C){if(!this.handleIds[D]){this.handleIds[D]={};}this.handleIds[D][C]=C;},isDragDrop:function(C){return(this.getDDById(C))?true:false;},getRelated:function(H,D){var G=[];for(var F in H.groups){for(var E in this.ids[F]){var C=this.ids[F][E];if(!this.isTypeOfDD(C)){continue;}if(!D||C.isTarget){G[G.length]=C;}}}return G;},isLegalTarget:function(G,F){var D=this.getRelated(G,true);for(var E=0,C=D.length;E<C;++E){if(D[E].id==F.id){return true;}}return false;},isTypeOfDD:function(C){return(C&&C.__ygDragDrop);},isHandle:function(D,C){return(this.handleIds[D]&&this.handleIds[D][C]);},getDDById:function(D){for(var C in this.ids){if(this.ids[C][D]){return this.ids[C][D];}}return null;},handleMouseDown:function(E,D){this.currentTarget=YAHOO.util.Event.getTarget(E);this.dragCurrent=D;var C=D.getEl();this.startX=YAHOO.util.Event.getPageX(E);this.startY=YAHOO.util.Event.getPageY(E);this.deltaX=this.startX-C.offsetLeft;this.deltaY=this.startY-C.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var F=YAHOO.util.DDM;F.startDrag(F.startX,F.startY);F.fromTimeout=true;},this.clickTimeThresh);},startDrag:function(C,E){if(this.dragCurrent&&this.dragCurrent.useShim){this._shimState=this.useShim;this.useShim=true;}this._activateShim();clearTimeout(this.clickTimeout);var D=this.dragCurrent;if(D&&D.events.b4StartDrag){D.b4StartDrag(C,E);D.fireEvent("b4StartDragEvent",{x:C,y:E});}if(D&&D.events.startDrag){D.startDrag(C,E);D.fireEvent("startDragEvent",{x:C,y:E});}this.dragThreshMet=true;},handleMouseUp:function(C){if(this.dragCurrent){clearTimeout(this.clickTimeout);if(this.dragThreshMet){if(this.fromTimeout){this.fromTimeout=false;this.handleMouseMove(C);}this.fromTimeout=false;this.fireEvents(C,true);}else{}this.stopDrag(C);this.stopEvent(C);}},stopEvent:function(C){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(C);}if(this.preventDefault){YAHOO.util.Event.preventDefault(C);}},stopDrag:function(E,D){var C=this.dragCurrent;if(C&&!D){if(this.dragThreshMet){if(C.events.b4EndDrag){C.b4EndDrag(E);C.fireEvent("b4EndDragEvent",{e:E});}if(C.events.endDrag){C.endDrag(E);C.fireEvent("endDragEvent",{e:E});}}if(C.events.mouseUp){C.onMouseUp(E);C.fireEvent("mouseUpEvent",{e:E});}}if(this._shimActive){this._deactivateShim();if(this.dragCurrent&&this.dragCurrent.useShim){this.useShim=this._shimState;this._shimState=false;}}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(F){var C=this.dragCurrent;if(C){if(YAHOO.util.Event.isIE&&!F.button){this.stopEvent(F);return this.handleMouseUp(F);}else{if(F.clientX<0||F.clientY<0){}}if(!this.dragThreshMet){var E=Math.abs(this.startX-YAHOO.util.Event.getPageX(F));var D=Math.abs(this.startY-YAHOO.util.Event.getPageY(F));if(E>this.clickPixelThresh||D>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){if(C&&C.events.b4Drag){C.b4Drag(F);C.fireEvent("b4DragEvent",{e:F});}if(C&&C.events.drag){C.onDrag(F);C.fireEvent("dragEvent",{e:F});}if(C){this.fireEvents(F,false);}}this.stopEvent(F);}},fireEvents:function(V,L){var a=this.dragCurrent;if(!a||a.isLocked()||a.dragOnly){return ;}var N=YAHOO.util.Event.getPageX(V),M=YAHOO.util.Event.getPageY(V),P=new YAHOO.util.Point(N,M),K=a.getTargetCoord(P.x,P.y),F=a.getDragEl(),E=["out","over","drop","enter"],U=new YAHOO.util.Region(K.y,K.x+F.offsetWidth,K.y+F.offsetHeight,K.x),I=[],D={},Q=[],c={outEvts:[],overEvts:[],dropEvts:[],enterEvts:[]};for(var S in this.dragOvers){var d=this.dragOvers[S];if(!this.isTypeOfDD(d)){continue;
}if(!this.isOverTarget(P,d,this.mode,U)){c.outEvts.push(d);}I[S]=true;delete this.dragOvers[S];}for(var R in a.groups){if("string"!=typeof R){continue;}for(S in this.ids[R]){var G=this.ids[R][S];if(!this.isTypeOfDD(G)){continue;}if(G.isTarget&&!G.isLocked()&&G!=a){if(this.isOverTarget(P,G,this.mode,U)){D[R]=true;if(L){c.dropEvts.push(G);}else{if(!I[G.id]){c.enterEvts.push(G);}else{c.overEvts.push(G);}this.dragOvers[G.id]=G;}}}}}this.interactionInfo={out:c.outEvts,enter:c.enterEvts,over:c.overEvts,drop:c.dropEvts,point:P,draggedRegion:U,sourceRegion:this.locationCache[a.id],validDrop:L};for(var C in D){Q.push(C);}if(L&&!c.dropEvts.length){this.interactionInfo.validDrop=false;if(a.events.invalidDrop){a.onInvalidDrop(V);a.fireEvent("invalidDropEvent",{e:V});}}for(S=0;S<E.length;S++){var Y=null;if(c[E[S]+"Evts"]){Y=c[E[S]+"Evts"];}if(Y&&Y.length){var H=E[S].charAt(0).toUpperCase()+E[S].substr(1),X="onDrag"+H,J="b4Drag"+H,O="drag"+H+"Event",W="drag"+H;if(this.mode){if(a.events[J]){a[J](V,Y,Q);a.fireEvent(J+"Event",{event:V,info:Y,group:Q});}if(a.events[W]){a[X](V,Y,Q);a.fireEvent(O,{event:V,info:Y,group:Q});}}else{for(var Z=0,T=Y.length;Z<T;++Z){if(a.events[J]){a[J](V,Y[Z].id,Q[0]);a.fireEvent(J+"Event",{event:V,info:Y[Z].id,group:Q[0]});}if(a.events[W]){a[X](V,Y[Z].id,Q[0]);a.fireEvent(O,{event:V,info:Y[Z].id,group:Q[0]});}}}}}},getBestMatch:function(E){var G=null;var D=E.length;if(D==1){G=E[0];}else{for(var F=0;F<D;++F){var C=E[F];if(this.mode==this.INTERSECT&&C.cursorIsOver){G=C;break;}else{if(!G||!G.overlap||(C.overlap&&G.overlap.getArea()<C.overlap.getArea())){G=C;}}}}return G;},refreshCache:function(D){var F=D||this.ids;for(var C in F){if("string"!=typeof C){continue;}for(var E in this.ids[C]){var G=this.ids[C][E];if(this.isTypeOfDD(G)){var H=this.getLocation(G);if(H){this.locationCache[G.id]=H;}else{delete this.locationCache[G.id];}}}}},verifyEl:function(D){try{if(D){var C=D.offsetParent;if(C){return true;}}}catch(E){}return false;},getLocation:function(H){if(!this.isTypeOfDD(H)){return null;}var F=H.getEl(),K,E,D,M,L,N,C,J,G;try{K=YAHOO.util.Dom.getXY(F);}catch(I){}if(!K){return null;}E=K[0];D=E+F.offsetWidth;M=K[1];L=M+F.offsetHeight;N=M-H.padding[0];C=D+H.padding[1];J=L+H.padding[2];G=E-H.padding[3];return new YAHOO.util.Region(N,C,J,G);},isOverTarget:function(K,C,E,F){var G=this.locationCache[C.id];if(!G||!this.useCache){G=this.getLocation(C);this.locationCache[C.id]=G;}if(!G){return false;}C.cursorIsOver=G.contains(K);var J=this.dragCurrent;if(!J||(!E&&!J.constrainX&&!J.constrainY)){return C.cursorIsOver;}C.overlap=null;if(!F){var H=J.getTargetCoord(K.x,K.y);var D=J.getDragEl();F=new YAHOO.util.Region(H.y,H.x+D.offsetWidth,H.y+D.offsetHeight,H.x);}var I=F.intersect(G);if(I){C.overlap=I;return(E)?true:C.cursorIsOver;}else{return false;}},_onUnload:function(D,C){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);this.ids={};},elementCache:{},getElWrapper:function(D){var C=this.elementCache[D];if(!C||!C.el){C=this.elementCache[D]=new this.ElementWrapper(YAHOO.util.Dom.get(D));}return C;},getElement:function(C){return YAHOO.util.Dom.get(C);},getCss:function(D){var C=YAHOO.util.Dom.get(D);return(C)?C.style:null;},ElementWrapper:function(C){this.el=C||null;this.id=this.el&&C.id;this.css=this.el&&C.style;},getPosX:function(C){return YAHOO.util.Dom.getX(C);},getPosY:function(C){return YAHOO.util.Dom.getY(C);},swapNode:function(E,C){if(E.swapNode){E.swapNode(C);}else{var F=C.parentNode;var D=C.nextSibling;if(D==E){F.insertBefore(E,C);}else{if(C==E.nextSibling){F.insertBefore(C,E);}else{E.parentNode.replaceChild(C,E);F.insertBefore(E,D);}}}},getScroll:function(){var E,C,F=document.documentElement,D=document.body;if(F&&(F.scrollTop||F.scrollLeft)){E=F.scrollTop;C=F.scrollLeft;}else{if(D){E=D.scrollTop;C=D.scrollLeft;}else{}}return{top:E,left:C};},getStyle:function(D,C){return YAHOO.util.Dom.getStyle(D,C);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(C,E){var D=YAHOO.util.Dom.getXY(E);YAHOO.util.Dom.setXY(C,D);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(D,C){return(D-C);},_timeoutCount:0,_addListeners:function(){var C=YAHOO.util.DDM;if(YAHOO.util.Event&&document){C._onLoad();}else{if(C._timeoutCount>2000){}else{setTimeout(C._addListeners,10);if(document&&document.body){C._timeoutCount+=1;}}}},handleWasClicked:function(C,E){if(this.isHandle(E,C.id)){return true;}else{var D=C.parentNode;while(D){if(this.isHandle(E,D.id)){return true;}else{D=D.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}(function(){var A=YAHOO.util.Event;var B=YAHOO.util.Dom;YAHOO.util.DragDrop=function(E,C,D){if(E){this.init(E,C,D);}};YAHOO.util.DragDrop.prototype={events:null,on:function(){this.subscribe.apply(this,arguments);},id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,dragOnly:false,useShim:false,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,cursorIsOver:false,overlap:null,b4StartDrag:function(C,D){},startDrag:function(C,D){},b4Drag:function(C){},onDrag:function(C){},onDragEnter:function(C,D){},b4DragOver:function(C){},onDragOver:function(C,D){},b4DragOut:function(C){},onDragOut:function(C,D){},b4DragDrop:function(C){},onDragDrop:function(C,D){},onInvalidDrop:function(C){},b4EndDrag:function(C){},endDrag:function(C){},b4MouseDown:function(C){},onMouseDown:function(C){},onMouseUp:function(C){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=B.get(this.id);
}return this._domRef;},getDragEl:function(){return B.get(this.dragElId);},init:function(F,C,D){this.initTarget(F,C,D);A.on(this._domRef||this.id,"mousedown",this.handleMouseDown,this,true);for(var E in this.events){this.createEvent(E+"Event");}},initTarget:function(E,C,D){this.config=D||{};this.events={};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof E!=="string"){this._domRef=E;E=B.generateId(E);}this.id=E;this.addToGroup((C)?C:"default");this.handleElId=E;A.onAvailable(E,this.handleOnAvailable,this,true);this.setDragElId(E);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.events={mouseDown:true,b4MouseDown:true,mouseUp:true,b4StartDrag:true,startDrag:true,b4EndDrag:true,endDrag:true,drag:true,b4Drag:true,invalidDrop:true,b4DragOut:true,dragOut:true,dragEnter:true,b4DragOver:true,dragOver:true,b4DragDrop:true,dragDrop:true};if(this.config.events){for(var C in this.config.events){if(this.config.events[C]===false){this.events[C]=false;}}}this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);this.dragOnly=((this.config.dragOnly===true)?true:false);this.useShim=((this.config.useShim===true)?true:false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(E,C,F,D){if(!C&&0!==C){this.padding=[E,E,E,E];}else{if(!F&&0!==F){this.padding=[E,C,E,C];}else{this.padding=[E,C,F,D];}}},setInitPosition:function(F,E){var G=this.getEl();if(!this.DDM.verifyEl(G)){if(G&&G.style&&(G.style.display=="none")){}else{}return ;}var D=F||0;var C=E||0;var H=B.getXY(G);this.initPageX=H[0]-D;this.initPageY=H[1]-C;this.lastPageX=H[0];this.lastPageY=H[1];this.setStartPosition(H);},setStartPosition:function(D){var C=D||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=C[0];this.startPageY=C[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}this.DDM.removeDDFromGroup(this,C);},setDragElId:function(C){this.dragElId=C;},setHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.handleElId=C;this.DDM.regHandle(this.id,C);},setOuterHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}A.on(C,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(C);this.hasOuterHandles=true;},unreg:function(){A.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(J,I){var D=J.which||J.button;if(this.primaryButtonOnly&&D>1){return ;}if(this.isLocked()){return ;}var C=this.b4MouseDown(J),F=true;if(this.events.b4MouseDown){F=this.fireEvent("b4MouseDownEvent",J);}var E=this.onMouseDown(J),H=true;if(this.events.mouseDown){H=this.fireEvent("mouseDownEvent",J);}if((C===false)||(E===false)||(F===false)||(H===false)){return ;}this.DDM.refreshCache(this.groups);var G=new YAHOO.util.Point(A.getPageX(J),A.getPageY(J));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(G,this)){}else{if(this.clickValidator(J)){this.setStartPosition();this.DDM.handleMouseDown(J,this);this.DDM.stopEvent(J);}else{}}},clickValidator:function(D){var C=YAHOO.util.Event.getTarget(D);return(this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)));},getTargetCoord:function(E,D){var C=E-this.deltaX;var F=D-this.deltaY;if(this.constrainX){if(C<this.minX){C=this.minX;}if(C>this.maxX){C=this.maxX;}}if(this.constrainY){if(F<this.minY){F=this.minY;}if(F>this.maxY){F=this.maxY;}}C=this.getTick(C,this.xTicks);F=this.getTick(F,this.yTicks);return{x:C,y:F};},addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D;},addInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.invalidHandleIds[C]=C;},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C);},removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D];},removeInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}delete this.invalidHandleIds[C];},removeInvalidHandleClass:function(D){for(var E=0,C=this.invalidHandleClasses.length;E<C;++E){if(this.invalidHandleClasses[E]==D){delete this.invalidHandleClasses[E];}}},isValidHandleChild:function(F){var E=true;var H;try{H=F.nodeName.toUpperCase();}catch(G){H=F.nodeName;}E=E&&!this.invalidHandleTypes[H];E=E&&!this.invalidHandleIds[F.id];for(var D=0,C=this.invalidHandleClasses.length;E&&D<C;++D){E=!B.hasClass(F,this.invalidHandleClasses[D]);}return E;},setXTicks:function(F,C){this.xTicks=[];this.xTickSize=C;var E={};for(var D=this.initPageX;D>=this.minX;D=D-C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}for(D=this.initPageX;D<=this.maxX;D=D+C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(F,C){this.yTicks=[];this.yTickSize=C;var E={};for(var D=this.initPageY;D>=this.minY;D=D-C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}for(D=this.initPageY;D<=this.maxY;D=D+C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(E,D,C){this.leftConstraint=parseInt(E,10);this.rightConstraint=parseInt(D,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(C){this.setXTicks(this.initPageX,C);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(C,E,D){this.topConstraint=parseInt(C,10);this.bottomConstraint=parseInt(E,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(D){this.setYTicks(this.initPageY,D);
}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var D=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var C=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(D,C);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(I,F){if(!F){return I;}else{if(F[0]>=I){return F[0];}else{for(var D=0,C=F.length;D<C;++D){var E=D+1;if(F[E]&&F[E]>=I){var H=I-F[D];var G=F[E]-I;return(G>H)?F[D]:F[E];}}return F[F.length-1];}}},toString:function(){return("DragDrop "+this.id);}};YAHOO.augment(YAHOO.util.DragDrop,YAHOO.util.EventProvider);})();YAHOO.util.DD=function(C,A,B){if(C){this.init(C,A,B);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(C,B){var A=C-this.startPageX;var D=B-this.startPageY;this.setDelta(A,D);},setDelta:function(B,A){this.deltaX=B;this.deltaY=A;},setDragElPos:function(C,B){var A=this.getDragEl();this.alignElWithMouse(A,C,B);},alignElWithMouse:function(C,G,F){var E=this.getTargetCoord(G,F);if(!this.deltaSetXY){var H=[E.x,E.y];YAHOO.util.Dom.setXY(C,H);var D=parseInt(YAHOO.util.Dom.getStyle(C,"left"),10);var B=parseInt(YAHOO.util.Dom.getStyle(C,"top"),10);this.deltaSetXY=[D-E.x,B-E.y];}else{YAHOO.util.Dom.setStyle(C,"left",(E.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(C,"top",(E.y+this.deltaSetXY[1])+"px");}this.cachePosition(E.x,E.y);var A=this;setTimeout(function(){A.autoScroll.call(A,E.x,E.y,C.offsetHeight,C.offsetWidth);},0);},cachePosition:function(B,A){if(B){this.lastPageX=B;this.lastPageY=A;}else{var C=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(J,I,E,K){if(this.scroll){var L=this.DDM.getClientHeight();var B=this.DDM.getClientWidth();var N=this.DDM.getScrollTop();var D=this.DDM.getScrollLeft();var H=E+I;var M=K+J;var G=(L+N-I-this.deltaY);var F=(B+D-J-this.deltaX);var C=40;var A=(document.all)?80:30;if(H>L&&G<C){window.scrollTo(D,N+A);}if(I<N&&N>0&&I-N<C){window.scrollTo(D,N-A);}if(M>B&&F<C){window.scrollTo(D+A,N);}if(J<D&&D>0&&J-D<C){window.scrollTo(D-A,N);}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(A){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A));},b4Drag:function(A){this.setDragElPos(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(C,A,B){if(C){this.init(C,A,B);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var B=this,A=document.body;if(!A||!A.firstChild){setTimeout(function(){B.createFrame();},50);return ;}var G=this.getDragEl(),E=YAHOO.util.Dom;if(!G){G=document.createElement("div");G.id=this.dragElId;var D=G.style;D.position="absolute";D.visibility="hidden";D.cursor="move";D.border="2px solid #aaa";D.zIndex=999;D.height="25px";D.width="25px";var C=document.createElement("div");E.setStyle(C,"height","100%");E.setStyle(C,"width","100%");E.setStyle(C,"background-color","#ccc");E.setStyle(C,"opacity","0");G.appendChild(C);if(YAHOO.env.ua.ie){var F=document.createElement("iframe");F.setAttribute("src","javascript: false;");F.setAttribute("scrolling","no");F.setAttribute("frameborder","0");G.insertBefore(F,G.firstChild);E.setStyle(F,"height","100%");E.setStyle(F,"width","100%");E.setStyle(F,"position","absolute");E.setStyle(F,"top","0");E.setStyle(F,"left","0");E.setStyle(F,"opacity","0");E.setStyle(F,"zIndex","-1");E.setStyle(F.nextSibling,"zIndex","2");}A.insertBefore(G,A.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(E,D){var C=this.getEl();var A=this.getDragEl();var B=A.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(B.width,10)/2),Math.round(parseInt(B.height,10)/2));}this.setDragElPos(E,D);YAHOO.util.Dom.setStyle(A,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var H=YAHOO.util.Dom;var B=this.getEl();var C=this.getDragEl();var G=parseInt(H.getStyle(C,"borderTopWidth"),10);var I=parseInt(H.getStyle(C,"borderRightWidth"),10);var F=parseInt(H.getStyle(C,"borderBottomWidth"),10);var D=parseInt(H.getStyle(C,"borderLeftWidth"),10);if(isNaN(G)){G=0;}if(isNaN(I)){I=0;}if(isNaN(F)){F=0;}if(isNaN(D)){D=0;}var E=Math.max(0,B.offsetWidth-I-D);var A=Math.max(0,B.offsetHeight-G-F);H.setStyle(C,"width",E+"px");H.setStyle(C,"height",A+"px");}},b4MouseDown:function(B){this.setStartPosition();var A=YAHOO.util.Event.getPageX(B);var C=YAHOO.util.Event.getPageY(B);this.autoOffset(A,C);},b4StartDrag:function(A,B){this.showFrame(A,B);},b4EndDrag:function(A){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(D){var C=YAHOO.util.Dom;var B=this.getEl();var A=this.getDragEl();C.setStyle(A,"visibility","");C.setStyle(B,"visibility","hidden");YAHOO.util.DDM.moveToEl(B,A);C.setStyle(A,"visibility","hidden");C.setStyle(B,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(C,A,B){if(C){this.initTarget(C,A,B);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.6.0",build:"1321"});YAHOO.util.Attribute=function(B,A){if(A){this.owner=A;this.configure(B,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(F,B){var E;var A=this.owner;var C=this.name;var D={type:C,prevValue:this.getValue(),newValue:F};if(this.readOnly||(this.writeOnce&&this._written)){return false;}if(this.validator&&!this.validator.call(A,F)){return false;}if(!B){E=A.fireBeforeChangeEvent(D);if(E===false){return false;}}if(this.method){this.method.call(A,F);}this.value=F;this._written=true;D.type=C;if(!B){this.owner.fireChangeEvent(D);}return true;},configure:function(B,C){B=B||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var A in B){if(B.hasOwnProperty(A)){this[A]=B[A];if(C){this._initialConfig[A]=B[A];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(A){this.setValue(this.value,A);}};(function(){var A=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(C){this._configs=this._configs||{};var B=this._configs[C];if(!B||!this._configs.hasOwnProperty(C)){return undefined;}return B.value;},set:function(D,E,B){this._configs=this._configs||{};var C=this._configs[D];if(!C){return false;}return C.setValue(E,B);},getAttributeKeys:function(){this._configs=this._configs;var D=[];var B;for(var C in this._configs){B=this._configs[C];if(A.hasOwnProperty(this._configs,C)&&!A.isUndefined(B)){D[D.length]=C;}}return D;},setAttributes:function(D,B){for(var C in D){if(A.hasOwnProperty(D,C)){this.set(C,D[C],B);}}},resetValue:function(C,B){this._configs=this._configs||{};if(this._configs[C]){this.set(C,this._configs[C]._initialConfig.value,B);return true;}return false;},refresh:function(E,C){this._configs=this._configs||{};var F=this._configs;E=((A.isString(E))?[E]:E)||this.getAttributeKeys();for(var D=0,B=E.length;D<B;++D){if(F.hasOwnProperty(E[D])){this._configs[E[D]].refresh(C);}}},register:function(B,C){this.setAttributeConfig(B,C);},getAttributeConfig:function(C){this._configs=this._configs||{};var B=this._configs[C]||{};var D={};for(C in B){if(A.hasOwnProperty(B,C)){D[C]=B[C];}}return D;},setAttributeConfig:function(B,C,D){this._configs=this._configs||{};C=C||{};if(!this._configs[B]){C.name=B;this._configs[B]=this.createAttribute(C);}else{this._configs[B].configure(C,D);}},configureAttribute:function(B,C,D){this.setAttributeConfig(B,C,D);},resetAttributeConfig:function(B){this._configs=this._configs||{};this._configs[B].resetConfig();},subscribe:function(B,C){this._events=this._events||{};if(!(B in this._events)){this._events[B]=this.createEvent(B);}YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){this.subscribe.apply(this,arguments);},addListener:function(){this.subscribe.apply(this,arguments);},fireBeforeChangeEvent:function(C){var B="before";B+=C.type.charAt(0).toUpperCase()+C.type.substr(1)+"Change";C.type=B;return this.fireEvent(C.type,C);},fireChangeEvent:function(B){B.type+="Change";return this.fireEvent(B.type,B);},createAttribute:function(B){return new YAHOO.util.Attribute(B,this);}};YAHOO.augment(YAHOO.util.AttributeProvider,YAHOO.util.EventProvider);})();(function(){var D=YAHOO.util.Dom,F=YAHOO.util.AttributeProvider;YAHOO.util.Element=function(G,H){if(arguments.length){this.init(G,H);}};YAHOO.util.Element.prototype={DOM_EVENTS:null,appendChild:function(G){G=G.get?G.get("element"):G;return this.get("element").appendChild(G);},getElementsByTagName:function(G){return this.get("element").getElementsByTagName(G);},hasChildNodes:function(){return this.get("element").hasChildNodes();},insertBefore:function(G,H){G=G.get?G.get("element"):G;H=(H&&H.get)?H.get("element"):H;return this.get("element").insertBefore(G,H);},removeChild:function(G){G=G.get?G.get("element"):G;return this.get("element").removeChild(G);},replaceChild:function(G,H){G=G.get?G.get("element"):G;H=H.get?H.get("element"):H;return this.get("element").replaceChild(G,H);},initAttributes:function(G){},addListener:function(K,J,L,I){var H=this.get("element")||this.get("id");I=I||this;var G=this;if(!this._events[K]){if(H&&this.DOM_EVENTS[K]){YAHOO.util.Event.addListener(H,K,function(M){if(M.srcElement&&!M.target){M.target=M.srcElement;}G.fireEvent(K,M);},L,I);}this.createEvent(K,this);}return YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){return this.addListener.apply(this,arguments);},subscribe:function(){return this.addListener.apply(this,arguments);},removeListener:function(H,G){return this.unsubscribe.apply(this,arguments);},addClass:function(G){D.addClass(this.get("element"),G);},getElementsByClassName:function(H,G){return D.getElementsByClassName(H,G,this.get("element"));},hasClass:function(G){return D.hasClass(this.get("element"),G);},removeClass:function(G){return D.removeClass(this.get("element"),G);},replaceClass:function(H,G){return D.replaceClass(this.get("element"),H,G);},setStyle:function(I,H){var G=this.get("element");if(!G){return this._queue[this._queue.length]=["setStyle",arguments];}return D.setStyle(G,I,H);},getStyle:function(G){return D.getStyle(this.get("element"),G);},fireQueue:function(){var H=this._queue;for(var I=0,G=H.length;I<G;++I){this[H[I][0]].apply(this,H[I][1]);}},appendTo:function(H,I){H=(H.get)?H.get("element"):D.get(H);this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:H});I=(I&&I.get)?I.get("element"):D.get(I);var G=this.get("element");if(!G){return false;}if(!H){return false;}if(G.parent!=H){if(I){H.insertBefore(G,I);}else{H.appendChild(G);}}this.fireEvent("appendTo",{type:"appendTo",target:H});return G;},get:function(G){var I=this._configs||{};var H=I.element;if(H&&!I[G]&&!YAHOO.lang.isUndefined(H.value[G])){return H.value[G];}return F.prototype.get.call(this,G);},setAttributes:function(L,H){var K=this.get("element");
for(var J in L){if(!this._configs[J]&&!YAHOO.lang.isUndefined(K[J])){this.setAttributeConfig(J);}}for(var I=0,G=this._configOrder.length;I<G;++I){if(L[this._configOrder[I]]!==undefined){this.set(this._configOrder[I],L[this._configOrder[I]],H);}}},set:function(H,J,G){var I=this.get("element");if(!I){this._queue[this._queue.length]=["set",arguments];if(this._configs[H]){this._configs[H].value=J;}return ;}if(!this._configs[H]&&!YAHOO.lang.isUndefined(I[H])){C.call(this,H);}return F.prototype.set.apply(this,arguments);},setAttributeConfig:function(G,I,J){var H=this.get("element");if(H&&!this._configs[G]&&!YAHOO.lang.isUndefined(H[G])){C.call(this,G,I);}else{F.prototype.setAttributeConfig.apply(this,arguments);}this._configOrder.push(G);},getAttributeKeys:function(){var H=this.get("element");var I=F.prototype.getAttributeKeys.call(this);for(var G in H){if(!this._configs[G]){I[G]=I[G]||H[G];}}return I;},createEvent:function(H,G){this._events[H]=true;F.prototype.createEvent.apply(this,arguments);},init:function(H,G){A.apply(this,arguments);}};var A=function(H,G){this._queue=this._queue||[];this._events=this._events||{};this._configs=this._configs||{};this._configOrder=[];G=G||{};G.element=G.element||H||null;this.DOM_EVENTS={"click":true,"dblclick":true,"keydown":true,"keypress":true,"keyup":true,"mousedown":true,"mousemove":true,"mouseout":true,"mouseover":true,"mouseup":true,"focus":true,"blur":true,"submit":true};var I=false;if(typeof G.element==="string"){C.call(this,"id",{value:G.element});}if(D.get(G.element)){I=true;E.call(this,G);B.call(this,G);}YAHOO.util.Event.onAvailable(G.element,function(){if(!I){E.call(this,G);}this.fireEvent("available",{type:"available",target:D.get(G.element)});},this,true);YAHOO.util.Event.onContentReady(G.element,function(){if(!I){B.call(this,G);}this.fireEvent("contentReady",{type:"contentReady",target:D.get(G.element)});},this,true);};var E=function(G){this.setAttributeConfig("element",{value:D.get(G.element),readOnly:true});};var B=function(G){this.initAttributes(G);this.setAttributes(G,true);this.fireQueue();};var C=function(G,I){var H=this.get("element");I=I||{};I.name=G;I.method=I.method||function(J){if(H){H[G]=J;}};I.value=I.value||H[G];this._configs[G]=new YAHOO.util.Attribute(I,this);};YAHOO.augment(YAHOO.util.Element,F);})();YAHOO.register("element",YAHOO.util.Element,{version:"2.6.0",build:"1321"});YAHOO.register("utilities", YAHOO, {version: "2.6.0", build: "1321"});


/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F=this.config,G,E;for(G in F){if(B.hasOwnProperty(F,G)){E=F[G];if(E&&E.event){D[G]=E.value;}}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(D,G){var F,E;if(G){E={};for(F in D){if(B.hasOwnProperty(D,F)){E[F.toLowerCase()]=D[F];}}this.initialConfig=E;}for(F in D){if(B.hasOwnProperty(D,F)){this.queueProperty(F,D[F]);}}},refresh:function(){var D;for(D in this.config){if(B.hasOwnProperty(this.config,D)){this.refireEvent(D);}}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.eventQueue[E]=null;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(E,F,H,D){var G=this.config[E.toLowerCase()];if(G&&G.event){if(!A.alreadySubscribed(G.event,F,H)){G.event.subscribe(F,H,D);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(Q,P){if(Q){this.init(Q,P);}else{}};var F=YAHOO.util.Dom,D=YAHOO.util.Config,M=YAHOO.util.Event,L=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,H,O,N,E,A={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},I={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};G.IMG_ROOT=null;G.IMG_ROOT_SSL=null;G.CSS_MODULE="yui-module";G.CSS_HEADER="hd";G.CSS_BODY="bd";G.CSS_FOOTER="ft";G.RESIZE_MONITOR_SECURE_URL="javascript:false;";G.textResizeEvent=new L("textResize");function K(){if(!H){H=document.createElement("div");H.innerHTML=('<div class="'+G.CSS_HEADER+'"></div>'+'<div class="'+G.CSS_BODY+'"></div><div class="'+G.CSS_FOOTER+'"></div>');O=H.firstChild;N=O.nextSibling;E=N.nextSibling;}return H;}function J(){if(!O){K();}return(O.cloneNode(false));}function B(){if(!N){K();}return(N.cloneNode(false));}function C(){if(!E){K();}return(E.cloneNode(false));}G.prototype={constructor:G,element:null,header:null,body:null,footer:null,id:null,imageRoot:G.IMG_ROOT,initEvents:function(){var P=L.LIST;this.beforeInitEvent=this.createEvent(A.BEFORE_INIT);this.beforeInitEvent.signature=P;this.initEvent=this.createEvent(A.INIT);
this.initEvent.signature=P;this.appendEvent=this.createEvent(A.APPEND);this.appendEvent.signature=P;this.beforeRenderEvent=this.createEvent(A.BEFORE_RENDER);this.beforeRenderEvent.signature=P;this.renderEvent=this.createEvent(A.RENDER);this.renderEvent.signature=P;this.changeHeaderEvent=this.createEvent(A.CHANGE_HEADER);this.changeHeaderEvent.signature=P;this.changeBodyEvent=this.createEvent(A.CHANGE_BODY);this.changeBodyEvent.signature=P;this.changeFooterEvent=this.createEvent(A.CHANGE_FOOTER);this.changeFooterEvent.signature=P;this.changeContentEvent=this.createEvent(A.CHANGE_CONTENT);this.changeContentEvent.signature=P;this.destroyEvent=this.createEvent(A.DESTORY);this.destroyEvent.signature=P;this.beforeShowEvent=this.createEvent(A.BEFORE_SHOW);this.beforeShowEvent.signature=P;this.showEvent=this.createEvent(A.SHOW);this.showEvent.signature=P;this.beforeHideEvent=this.createEvent(A.BEFORE_HIDE);this.beforeHideEvent.signature=P;this.hideEvent=this.createEvent(A.HIDE);this.hideEvent.signature=P;},platform:function(){var P=navigator.userAgent.toLowerCase();if(P.indexOf("windows")!=-1||P.indexOf("win32")!=-1){return"windows";}else{if(P.indexOf("macintosh")!=-1){return"mac";}else{return false;}}}(),browser:function(){var P=navigator.userAgent.toLowerCase();if(P.indexOf("opera")!=-1){return"opera";}else{if(P.indexOf("msie 7")!=-1){return"ie7";}else{if(P.indexOf("msie")!=-1){return"ie";}else{if(P.indexOf("safari")!=-1){return"safari";}else{if(P.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(I.VISIBLE.key,{handler:this.configVisible,value:I.VISIBLE.value,validator:I.VISIBLE.validator});this.cfg.addProperty(I.EFFECT.key,{suppressEvent:I.EFFECT.suppressEvent,supercedes:I.EFFECT.supercedes});this.cfg.addProperty(I.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:I.MONITOR_RESIZE.value});this.cfg.addProperty(I.APPEND_TO_DOCUMENT_BODY.key,{value:I.APPEND_TO_DOCUMENT_BODY.value});},init:function(U,T){var R,V;this.initEvents();this.beforeInitEvent.fire(G);this.cfg=new D(this);if(this.isSecure){this.imageRoot=G.IMG_ROOT_SSL;}if(typeof U=="string"){R=U;U=document.getElementById(U);if(!U){U=(K()).cloneNode(false);U.id=R;}}this.element=U;if(U.id){this.id=U.id;}V=this.element.firstChild;if(V){var Q=false,P=false,S=false;do{if(1==V.nodeType){if(!Q&&F.hasClass(V,G.CSS_HEADER)){this.header=V;Q=true;}else{if(!P&&F.hasClass(V,G.CSS_BODY)){this.body=V;P=true;}else{if(!S&&F.hasClass(V,G.CSS_FOOTER)){this.footer=V;S=true;}}}}}while((V=V.nextSibling));}this.initDefaultConfig();F.addClass(this.element,G.CSS_MODULE);if(T){this.cfg.applyConfig(T,true);}if(!D.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(G);},initResizeMonitor:function(){var Q=(YAHOO.env.ua.gecko&&this.platform=="windows");if(Q){var P=this;setTimeout(function(){P._initResizeMonitor();},0);}else{this._initResizeMonitor();}},_initResizeMonitor:function(){var P,R,T;function V(){G.textResizeEvent.fire();}if(!YAHOO.env.ua.opera){R=F.get("_yuiResizeMonitor");var U=this._supportsCWResize();if(!R){R=document.createElement("iframe");if(this.isSecure&&G.RESIZE_MONITOR_SECURE_URL&&YAHOO.env.ua.ie){R.src=G.RESIZE_MONITOR_SECURE_URL;}if(!U){T=["<html><head><script ",'type="text/javascript">',"window.onresize=function(){window.parent.","YAHOO.widget.Module.textResizeEvent.","fire();};<","/script></head>","<body></body></html>"].join("");R.src="data:text/html;charset=utf-8,"+encodeURIComponent(T);}R.id="_yuiResizeMonitor";R.title="Text Resize Monitor";R.style.position="absolute";R.style.visibility="hidden";var Q=document.body,S=Q.firstChild;if(S){Q.insertBefore(R,S);}else{Q.appendChild(R);}R.style.width="10em";R.style.height="10em";R.style.top=(-1*R.offsetHeight)+"px";R.style.left=(-1*R.offsetWidth)+"px";R.style.borderWidth="0";R.style.visibility="visible";if(YAHOO.env.ua.webkit){P=R.contentWindow.document;P.open();P.close();}}if(R&&R.contentWindow){G.textResizeEvent.subscribe(this.onDomResize,this,true);if(!G.textResizeInitialized){if(U){if(!M.on(R.contentWindow,"resize",V)){M.on(R,"resize",V);}}G.textResizeInitialized=true;}this.resizeMonitor=R;}}},_supportsCWResize:function(){var P=true;if(YAHOO.env.ua.gecko&&YAHOO.env.ua.gecko<=1.8){P=false;}return P;},onDomResize:function(S,R){var Q=-1*this.resizeMonitor.offsetWidth,P=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=P+"px";this.resizeMonitor.style.left=Q+"px";},setHeader:function(Q){var P=this.header||(this.header=J());if(Q.nodeName){P.innerHTML="";P.appendChild(Q);}else{P.innerHTML=Q;}this.changeHeaderEvent.fire(Q);this.changeContentEvent.fire();},appendToHeader:function(Q){var P=this.header||(this.header=J());P.appendChild(Q);this.changeHeaderEvent.fire(Q);this.changeContentEvent.fire();},setBody:function(Q){var P=this.body||(this.body=B());if(Q.nodeName){P.innerHTML="";P.appendChild(Q);}else{P.innerHTML=Q;}this.changeBodyEvent.fire(Q);this.changeContentEvent.fire();},appendToBody:function(Q){var P=this.body||(this.body=B());P.appendChild(Q);this.changeBodyEvent.fire(Q);this.changeContentEvent.fire();},setFooter:function(Q){var P=this.footer||(this.footer=C());if(Q.nodeName){P.innerHTML="";P.appendChild(Q);}else{P.innerHTML=Q;}this.changeFooterEvent.fire(Q);this.changeContentEvent.fire();},appendToFooter:function(Q){var P=this.footer||(this.footer=C());P.appendChild(Q);this.changeFooterEvent.fire(Q);this.changeContentEvent.fire();},render:function(R,P){var S=this,T;function Q(U){if(typeof U=="string"){U=document.getElementById(U);}if(U){S._addToParent(U,S.element);S.appendEvent.fire();}}this.beforeRenderEvent.fire();if(!P){P=this.element;}if(R){Q(R);}else{if(!F.inDocument(this.element)){return false;}}if(this.header&&!F.inDocument(this.header)){T=P.firstChild;if(T){P.insertBefore(this.header,T);}else{P.appendChild(this.header);
}}if(this.body&&!F.inDocument(this.body)){if(this.footer&&F.isAncestor(this.moduleElement,this.footer)){P.insertBefore(this.body,this.footer);}else{P.appendChild(this.body);}}if(this.footer&&!F.inDocument(this.footer)){P.appendChild(this.footer);}this.renderEvent.fire();return true;},destroy:function(){var P,Q;if(this.element){M.purgeElement(this.element,true);P=this.element.parentNode;}if(P){P.removeChild(this.element);}this.element=null;this.header=null;this.body=null;this.footer=null;G.textResizeEvent.unsubscribe(this.onDomResize,this);this.cfg.destroy();this.cfg=null;this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(Q,P,R){var S=P[0];if(S){this.beforeShowEvent.fire();F.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();F.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(R,Q,S){var P=Q[0];if(P){this.initResizeMonitor();}else{G.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}},_addToParent:function(P,Q){if(!this.cfg.getProperty("appendtodocumentbody")&&P===document.body&&P.firstChild){P.insertBefore(Q,P.firstChild);}else{P.appendChild(Q);}},toString:function(){return"Module "+this.id;}};YAHOO.lang.augmentProto(G,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Overlay=function(O,N){YAHOO.widget.Overlay.superclass.constructor.call(this,O,N);};var H=YAHOO.lang,L=YAHOO.util.CustomEvent,F=YAHOO.widget.Module,M=YAHOO.util.Event,E=YAHOO.util.Dom,C=YAHOO.util.Config,J=YAHOO.env.ua,B=YAHOO.widget.Overlay,G="subscribe",D="unsubscribe",I,A={"BEFORE_MOVE":"beforeMove","MOVE":"move"},K={"X":{key:"x",validator:H.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:H.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:H.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"AUTO_FILL_HEIGHT":{key:"autofillheight",supressEvent:true,supercedes:["height"],value:"body"},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:H.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(J.ie==6?true:false),validator:H.isBoolean,supercedes:["zindex"]},"PREVENT_CONTEXT_OVERLAP":{key:"preventcontextoverlap",value:false,validator:H.isBoolean,supercedes:["constraintoviewport"]}};B.IFRAME_SRC="javascript:false;";B.IFRAME_OFFSET=3;B.VIEWPORT_OFFSET=10;B.TOP_LEFT="tl";B.TOP_RIGHT="tr";B.BOTTOM_LEFT="bl";B.BOTTOM_RIGHT="br";B.CSS_OVERLAY="yui-overlay";B.STD_MOD_RE=/^\s*?(body|footer|header)\s*?$/i;B.windowScrollEvent=new L("windowScroll");B.windowResizeEvent=new L("windowResize");B.windowScrollHandler=function(O){var N=M.getTarget(O);if(!N||N===window||N===window.document){if(J.ie){if(!window.scrollEnd){window.scrollEnd=-1;}clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){B.windowScrollEvent.fire();},1);}else{B.windowScrollEvent.fire();}}};B.windowResizeHandler=function(N){if(J.ie){if(!window.resizeEnd){window.resizeEnd=-1;}clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){B.windowResizeEvent.fire();},100);}else{B.windowResizeEvent.fire();}};B._initialized=null;if(B._initialized===null){M.on(window,"scroll",B.windowScrollHandler);M.on(window,"resize",B.windowResizeHandler);B._initialized=true;}B._TRIGGER_MAP={"windowScroll":B.windowScrollEvent,"windowResize":B.windowResizeEvent,"textResize":F.textResizeEvent};YAHOO.extend(B,F,{CONTEXT_TRIGGERS:[],init:function(O,N){B.superclass.init.call(this,O);this.beforeInitEvent.fire(B);E.addClass(this.element,B.CSS_OVERLAY);if(N){this.cfg.applyConfig(N,true);}if(this.platform=="mac"&&J.gecko){if(!C.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}if(!C.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}this.initEvent.fire(B);},initEvents:function(){B.superclass.initEvents.call(this);var N=L.LIST;this.beforeMoveEvent=this.createEvent(A.BEFORE_MOVE);this.beforeMoveEvent.signature=N;this.moveEvent=this.createEvent(A.MOVE);this.moveEvent.signature=N;},initDefaultConfig:function(){B.superclass.initDefaultConfig.call(this);var N=this.cfg;N.addProperty(K.X.key,{handler:this.configX,validator:K.X.validator,suppressEvent:K.X.suppressEvent,supercedes:K.X.supercedes});N.addProperty(K.Y.key,{handler:this.configY,validator:K.Y.validator,suppressEvent:K.Y.suppressEvent,supercedes:K.Y.supercedes});N.addProperty(K.XY.key,{handler:this.configXY,suppressEvent:K.XY.suppressEvent,supercedes:K.XY.supercedes});N.addProperty(K.CONTEXT.key,{handler:this.configContext,suppressEvent:K.CONTEXT.suppressEvent,supercedes:K.CONTEXT.supercedes});N.addProperty(K.FIXED_CENTER.key,{handler:this.configFixedCenter,value:K.FIXED_CENTER.value,validator:K.FIXED_CENTER.validator,supercedes:K.FIXED_CENTER.supercedes});N.addProperty(K.WIDTH.key,{handler:this.configWidth,suppressEvent:K.WIDTH.suppressEvent,supercedes:K.WIDTH.supercedes});N.addProperty(K.HEIGHT.key,{handler:this.configHeight,suppressEvent:K.HEIGHT.suppressEvent,supercedes:K.HEIGHT.supercedes});N.addProperty(K.AUTO_FILL_HEIGHT.key,{handler:this.configAutoFillHeight,value:K.AUTO_FILL_HEIGHT.value,validator:this._validateAutoFill,suppressEvent:K.AUTO_FILL_HEIGHT.suppressEvent,supercedes:K.AUTO_FILL_HEIGHT.supercedes});N.addProperty(K.ZINDEX.key,{handler:this.configzIndex,value:K.ZINDEX.value});N.addProperty(K.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:K.CONSTRAIN_TO_VIEWPORT.value,validator:K.CONSTRAIN_TO_VIEWPORT.validator,supercedes:K.CONSTRAIN_TO_VIEWPORT.supercedes});
N.addProperty(K.IFRAME.key,{handler:this.configIframe,value:K.IFRAME.value,validator:K.IFRAME.validator,supercedes:K.IFRAME.supercedes});N.addProperty(K.PREVENT_CONTEXT_OVERLAP.key,{value:K.PREVENT_CONTEXT_OVERLAP.value,validator:K.PREVENT_CONTEXT_OVERLAP.validator,supercedes:K.PREVENT_CONTEXT_OVERLAP.supercedes});},moveTo:function(N,O){this.cfg.setProperty("xy",[N,O]);},hideMacGeckoScrollbars:function(){E.replaceClass(this.element,"show-scrollbars","hide-scrollbars");},showMacGeckoScrollbars:function(){E.replaceClass(this.element,"hide-scrollbars","show-scrollbars");},configVisible:function(Q,N,W){var P=N[0],R=E.getStyle(this.element,"visibility"),X=this.cfg.getProperty("effect"),U=[],T=(this.platform=="mac"&&J.gecko),f=C.alreadySubscribed,V,O,d,b,a,Z,c,Y,S;if(R=="inherit"){d=this.element.parentNode;while(d.nodeType!=9&&d.nodeType!=11){R=E.getStyle(d,"visibility");if(R!="inherit"){break;}d=d.parentNode;}if(R=="inherit"){R="visible";}}if(X){if(X instanceof Array){Y=X.length;for(b=0;b<Y;b++){V=X[b];U[U.length]=V.effect(this,V.duration);}}else{U[U.length]=X.effect(this,X.duration);}}if(P){if(T){this.showMacGeckoScrollbars();}if(X){if(P){if(R!="visible"||R===""){this.beforeShowEvent.fire();S=U.length;for(a=0;a<S;a++){O=U[a];if(a===0&&!f(O.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){O.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}O.animateIn();}}}}else{if(R!="visible"||R===""){this.beforeShowEvent.fire();E.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(T){this.hideMacGeckoScrollbars();}if(X){if(R=="visible"){this.beforeHideEvent.fire();S=U.length;for(Z=0;Z<S;Z++){c=U[Z];if(Z===0&&!f(c.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){c.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}c.animateOut();}}else{if(R===""){E.setStyle(this.element,"visibility","hidden");}}}else{if(R=="visible"||R===""){this.beforeHideEvent.fire();E.setStyle(this.element,"visibility","hidden");this.hideEvent.fire();}}}},doCenterOnDOMEvent:function(){if(this.cfg.getProperty("visible")){this.center();}},configFixedCenter:function(R,P,S){var T=P[0],O=C.alreadySubscribed,Q=B.windowResizeEvent,N=B.windowScrollEvent;if(T){this.center();if(!O(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center);}if(!O(Q,this.doCenterOnDOMEvent,this)){Q.subscribe(this.doCenterOnDOMEvent,this,true);}if(!O(N,this.doCenterOnDOMEvent,this)){N.subscribe(this.doCenterOnDOMEvent,this,true);}}else{this.beforeShowEvent.unsubscribe(this.center);Q.unsubscribe(this.doCenterOnDOMEvent,this);N.unsubscribe(this.doCenterOnDOMEvent,this);}},configHeight:function(Q,O,R){var N=O[0],P=this.element;E.setStyle(P,"height",N);this.cfg.refireEvent("iframe");},configAutoFillHeight:function(Q,P,R){var O=P[0],N=this.cfg.getProperty("autofillheight");this.cfg.unsubscribeFromConfigEvent("height",this._autoFillOnHeightChange);F.textResizeEvent.unsubscribe("height",this._autoFillOnHeightChange);if(N&&O!==N&&this[N]){E.setStyle(this[N],"height","");}if(O){O=H.trim(O.toLowerCase());this.cfg.subscribeToConfigEvent("height",this._autoFillOnHeightChange,this[O],this);F.textResizeEvent.subscribe(this._autoFillOnHeightChange,this[O],this);this.cfg.setProperty("autofillheight",O,true);}},configWidth:function(Q,N,R){var P=N[0],O=this.element;E.setStyle(O,"width",P);this.cfg.refireEvent("iframe");},configzIndex:function(P,N,Q){var R=N[0],O=this.element;if(!R){R=E.getStyle(O,"zIndex");if(!R||isNaN(R)){R=0;}}if(this.iframe||this.cfg.getProperty("iframe")===true){if(R<=0){R=1;}}E.setStyle(O,"zIndex",R);this.cfg.setProperty("zIndex",R,true);if(this.iframe){this.stackIframe();}},configXY:function(P,O,Q){var S=O[0],N=S[0],R=S[1];this.cfg.setProperty("x",N);this.cfg.setProperty("y",R);this.beforeMoveEvent.fire([N,R]);N=this.cfg.getProperty("x");R=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([N,R]);},configX:function(P,O,Q){var N=O[0],R=this.cfg.getProperty("y");this.cfg.setProperty("x",N,true);this.cfg.setProperty("y",R,true);this.beforeMoveEvent.fire([N,R]);N=this.cfg.getProperty("x");R=this.cfg.getProperty("y");E.setX(this.element,N,true);this.cfg.setProperty("xy",[N,R],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([N,R]);},configY:function(P,O,Q){var N=this.cfg.getProperty("x"),R=O[0];this.cfg.setProperty("x",N,true);this.cfg.setProperty("y",R,true);this.beforeMoveEvent.fire([N,R]);N=this.cfg.getProperty("x");R=this.cfg.getProperty("y");E.setY(this.element,R,true);this.cfg.setProperty("xy",[N,R],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([N,R]);},showIframe:function(){var O=this.iframe,N;if(O){N=this.element.parentNode;if(N!=O.parentNode){this._addToParent(N,O);}O.style.display="block";}},hideIframe:function(){if(this.iframe){this.iframe.style.display="none";}},syncIframe:function(){var N=this.iframe,P=this.element,R=B.IFRAME_OFFSET,O=(R*2),Q;if(N){N.style.width=(P.offsetWidth+O+"px");N.style.height=(P.offsetHeight+O+"px");Q=this.cfg.getProperty("xy");if(!H.isArray(Q)||(isNaN(Q[0])||isNaN(Q[1]))){this.syncPosition();Q=this.cfg.getProperty("xy");}E.setXY(N,[(Q[0]-R),(Q[1]-R)]);}},stackIframe:function(){if(this.iframe){var N=E.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(N)&&!isNaN(N)){E.setStyle(this.iframe,"zIndex",(N-1));}}},configIframe:function(Q,P,R){var N=P[0];function S(){var U=this.iframe,V=this.element,W;if(!U){if(!I){I=document.createElement("iframe");if(this.isSecure){I.src=B.IFRAME_SRC;}if(J.ie){I.style.filter="alpha(opacity=0)";I.frameBorder=0;}else{I.style.opacity="0";}I.style.position="absolute";I.style.border="none";I.style.margin="0";I.style.padding="0";I.style.display="none";}U=I.cloneNode(false);W=V.parentNode;var T=W||document.body;this._addToParent(T,U);this.iframe=U;}this.showIframe();this.syncIframe();this.stackIframe();if(!this._hasIframeEventListeners){this.showEvent.subscribe(this.showIframe);this.hideEvent.subscribe(this.hideIframe);
this.changeContentEvent.subscribe(this.syncIframe);this._hasIframeEventListeners=true;}}function O(){S.call(this);this.beforeShowEvent.unsubscribe(O);this._iframeDeferred=false;}if(N){if(this.cfg.getProperty("visible")){S.call(this);}else{if(!this._iframeDeferred){this.beforeShowEvent.subscribe(O);this._iframeDeferred=true;}}}else{this.hideIframe();if(this._hasIframeEventListeners){this.showEvent.unsubscribe(this.showIframe);this.hideEvent.unsubscribe(this.hideIframe);this.changeContentEvent.unsubscribe(this.syncIframe);this._hasIframeEventListeners=false;}}},_primeXYFromDOM:function(){if(YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))){this.syncPosition();this.cfg.refireEvent("xy");this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);}},configConstrainToViewport:function(O,N,P){var Q=N[0];if(Q){if(!C.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}if(!C.alreadySubscribed(this.beforeShowEvent,this._primeXYFromDOM)){this.beforeShowEvent.subscribe(this._primeXYFromDOM);}}else{this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}},configContext:function(S,R,O){var V=R[0],P,N,T,Q,U=this.CONTEXT_TRIGGERS;if(V){P=V[0];N=V[1];T=V[2];Q=V[3];if(U&&U.length>0){Q=(Q||[]).concat(U);}if(P){if(typeof P=="string"){this.cfg.setProperty("context",[document.getElementById(P),N,T,Q],true);}if(N&&T){this.align(N,T);}if(this._contextTriggers){this._processTriggers(this._contextTriggers,D,this._alignOnTrigger);}if(Q){this._processTriggers(Q,G,this._alignOnTrigger);this._contextTriggers=Q;}}}},_alignOnTrigger:function(O,N){this.align();},_findTriggerCE:function(N){var O=null;if(N instanceof L){O=N;}else{if(B._TRIGGER_MAP[N]){O=B._TRIGGER_MAP[N];}}return O;},_processTriggers:function(R,T,Q){var P,S;for(var O=0,N=R.length;O<N;++O){P=R[O];S=this._findTriggerCE(P);if(S){S[T](Q,this,true);}else{this[T](P,Q);}}},align:function(O,N){var T=this.cfg.getProperty("context"),S=this,R,Q,U;function P(V,W){switch(O){case B.TOP_LEFT:S.moveTo(W,V);break;case B.TOP_RIGHT:S.moveTo((W-Q.offsetWidth),V);break;case B.BOTTOM_LEFT:S.moveTo(W,(V-Q.offsetHeight));break;case B.BOTTOM_RIGHT:S.moveTo((W-Q.offsetWidth),(V-Q.offsetHeight));break;}}if(T){R=T[0];Q=this.element;S=this;if(!O){O=T[1];}if(!N){N=T[2];}if(Q&&R){U=E.getRegion(R);switch(N){case B.TOP_LEFT:P(U.top,U.left);break;case B.TOP_RIGHT:P(U.top,U.right);break;case B.BOTTOM_LEFT:P(U.bottom,U.left);break;case B.BOTTOM_RIGHT:P(U.bottom,U.right);break;}}}},enforceConstraints:function(O,N,P){var R=N[0];var Q=this.getConstrainedXY(R[0],R[1]);this.cfg.setProperty("x",Q[0],true);this.cfg.setProperty("y",Q[1],true);this.cfg.setProperty("xy",Q,true);},getConstrainedX:function(U){var R=this,N=R.element,d=N.offsetWidth,b=B.VIEWPORT_OFFSET,g=E.getViewportWidth(),c=E.getDocumentScrollLeft(),X=(d+b<g),a=this.cfg.getProperty("context"),P,W,i,S=false,e,V,f,O,h=U,T={"tltr":true,"blbr":true,"brbl":true,"trtl":true};var Y=function(){var j;if((R.cfg.getProperty("x")-c)>W){j=(W-d);}else{j=(W+i);}R.cfg.setProperty("x",(j+c),true);return j;};var Q=function(){if((R.cfg.getProperty("x")-c)>W){return(V-b);}else{return(e-b);}};var Z=function(){var j=Q(),k;if(d>j){if(S){Y();}else{Y();S=true;k=Z();}}return k;};if(this.cfg.getProperty("preventcontextoverlap")&&a&&T[(a[1]+a[2])]){if(X){P=a[0];W=E.getX(P)-c;i=P.offsetWidth;e=W;V=(g-(W+i));Z();}h=this.cfg.getProperty("x");}else{if(X){f=c+b;O=c+g-d-b;if(U<f){h=f;}else{if(U>O){h=O;}}}else{h=b+c;}}return h;},getConstrainedY:function(Y){var V=this,O=V.element,h=O.offsetHeight,g=B.VIEWPORT_OFFSET,c=E.getViewportHeight(),f=E.getDocumentScrollTop(),d=(h+g<c),e=this.cfg.getProperty("context"),T,Z,a,W=false,U,P,b,R,N=Y,X={"trbr":true,"tlbl":true,"bltl":true,"brtr":true};var S=function(){var j;if((V.cfg.getProperty("y")-f)>Z){j=(Z-h);}else{j=(Z+a);}V.cfg.setProperty("y",(j+f),true);return j;};var Q=function(){if((V.cfg.getProperty("y")-f)>Z){return(P-g);}else{return(U-g);}};var i=function(){var k=Q(),j;if(h>k){if(W){S();}else{S();W=true;j=i();}}return j;};if(this.cfg.getProperty("preventcontextoverlap")&&e&&X[(e[1]+e[2])]){if(d){T=e[0];a=T.offsetHeight;Z=(E.getY(T)-f);U=Z;P=(c-(Z+a));i();}N=V.cfg.getProperty("y");}else{if(d){b=f+g;R=f+c-h-g;if(Y<b){N=b;}else{if(Y>R){N=R;}}}else{N=g+f;}}return N;},getConstrainedXY:function(N,O){return[this.getConstrainedX(N),this.getConstrainedY(O)];},center:function(){var Q=B.VIEWPORT_OFFSET,R=this.element.offsetWidth,P=this.element.offsetHeight,O=E.getViewportWidth(),S=E.getViewportHeight(),N,T;if(R<O){N=(O/2)-(R/2)+E.getDocumentScrollLeft();}else{N=Q+E.getDocumentScrollLeft();}if(P<S){T=(S/2)-(P/2)+E.getDocumentScrollTop();}else{T=Q+E.getDocumentScrollTop();}this.cfg.setProperty("xy",[parseInt(N,10),parseInt(T,10)]);this.cfg.refireEvent("iframe");},syncPosition:function(){var N=E.getXY(this.element);this.cfg.setProperty("x",N[0],true);this.cfg.setProperty("y",N[1],true);this.cfg.setProperty("xy",N,true);},onDomResize:function(P,O){var N=this;B.superclass.onDomResize.call(this,P,O);setTimeout(function(){N.syncPosition();N.cfg.refireEvent("iframe");N.cfg.refireEvent("context");},0);},_getComputedHeight:(function(){if(document.defaultView&&document.defaultView.getComputedStyle){return function(O){var N=null;if(O.ownerDocument&&O.ownerDocument.defaultView){var P=O.ownerDocument.defaultView.getComputedStyle(O,"");if(P){N=parseInt(P.height,10);}}return(H.isNumber(N))?N:null;};}else{return function(O){var N=null;if(O.style.pixelHeight){N=O.style.pixelHeight;}return(H.isNumber(N))?N:null;};}})(),_validateAutoFillHeight:function(N){return(!N)||(H.isString(N)&&B.STD_MOD_RE.test(N));},_autoFillOnHeightChange:function(P,N,O){this.fillHeight(O);},_getPreciseHeight:function(O){var N=O.offsetHeight;if(O.getBoundingClientRect){var P=O.getBoundingClientRect();N=P.bottom-P.top;}return N;},fillHeight:function(Q){if(Q){var O=this.innerElement||this.element,N=[this.header,this.body,this.footer],U,V=0,W=0,S=0,P=false;
for(var T=0,R=N.length;T<R;T++){U=N[T];if(U){if(Q!==U){W+=this._getPreciseHeight(U);}else{P=true;}}}if(P){if(J.ie||J.opera){E.setStyle(Q,"height",0+"px");}V=this._getComputedHeight(O);if(V===null){E.addClass(O,"yui-override-padding");V=O.clientHeight;E.removeClass(O,"yui-override-padding");}S=V-W;E.setStyle(Q,"height",S+"px");if(Q.offsetHeight!=S){S=S-(Q.offsetHeight-S);}E.setStyle(Q,"height",S+"px");}}},bringToTop:function(){var R=[],Q=this.element;function U(Y,X){var a=E.getStyle(Y,"zIndex"),Z=E.getStyle(X,"zIndex"),W=(!a||isNaN(a))?0:parseInt(a,10),V=(!Z||isNaN(Z))?0:parseInt(Z,10);if(W>V){return -1;}else{if(W<V){return 1;}else{return 0;}}}function P(X){var W=E.hasClass(X,B.CSS_OVERLAY),V=YAHOO.widget.Panel;if(W&&!E.isAncestor(Q,X)){if(V&&E.hasClass(X,V.CSS_PANEL)){R[R.length]=X.parentNode;}else{R[R.length]=X;}}}E.getElementsBy(P,"DIV",document.body);R.sort(U);var N=R[0],T;if(N){T=E.getStyle(N,"zIndex");if(!isNaN(T)){var S=false;if(N!=Q){S=true;}else{if(R.length>1){var O=E.getStyle(R[1],"zIndex");if(!isNaN(O)&&(T==O)){S=true;}}}if(S){this.cfg.setProperty("zindex",(parseInt(T,10)+2));}}}},destroy:function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;B.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);B.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);F.textResizeEvent.unsubscribe(this._autoFillOnHeightChange);B.superclass.destroy.call(this);},toString:function(){return"Overlay "+this.id;}});}());(function(){YAHOO.widget.OverlayManager=function(G){this.init(G);};var D=YAHOO.widget.Overlay,C=YAHOO.util.Event,E=YAHOO.util.Dom,B=YAHOO.util.Config,F=YAHOO.util.CustomEvent,A=YAHOO.widget.OverlayManager;A.CSS_FOCUSED="focused";A.prototype={constructor:A,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(I){this.cfg=new B(this);this.initDefaultConfig();if(I){this.cfg.applyConfig(I,true);}this.cfg.fireQueue();var H=null;this.getActive=function(){return H;};this.focus=function(J){var K=this.find(J);if(K){K.focus();}};this.remove=function(K){var M=this.find(K),J;if(M){if(H==M){H=null;}var L=(M.element===null&&M.cfg===null)?true:false;if(!L){J=E.getStyle(M.element,"zIndex");M.cfg.setProperty("zIndex",-1000,true);}this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,(this.overlays.length-1));M.hideEvent.unsubscribe(M.blur);M.destroyEvent.unsubscribe(this._onOverlayDestroy,M);M.focusEvent.unsubscribe(this._onOverlayFocusHandler,M);M.blurEvent.unsubscribe(this._onOverlayBlurHandler,M);if(!L){C.removeListener(M.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);M.cfg.setProperty("zIndex",J,true);M.cfg.setProperty("manager",null);}if(M.focusEvent._managed){M.focusEvent=null;}if(M.blurEvent._managed){M.blurEvent=null;}if(M.focus._managed){M.focus=null;}if(M.blur._managed){M.blur=null;}}};this.blurAll=function(){var K=this.overlays.length,J;if(K>0){J=K-1;do{this.overlays[J].blur();}while(J--);}};this._manageBlur=function(J){var K=false;if(H==J){E.removeClass(H.element,A.CSS_FOCUSED);H=null;K=true;}return K;};this._manageFocus=function(J){var K=false;if(H!=J){if(H){H.blur();}H=J;this.bringToTop(H);E.addClass(H.element,A.CSS_FOCUSED);K=true;}return K;};var G=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}if(G){this.register(G);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(I){var G=C.getTarget(I),H=this.close;if(H&&(G==H||E.isAncestor(H,G))){this.blur();}else{this.focus();}},_onOverlayDestroy:function(H,G,I){this.remove(I);},_onOverlayFocusHandler:function(H,G,I){this._manageFocus(I);},_onOverlayBlurHandler:function(H,G,I){this._manageBlur(I);},_bindFocus:function(G){var H=this;if(!G.focusEvent){G.focusEvent=G.createEvent("focus");G.focusEvent.signature=F.LIST;G.focusEvent._managed=true;}else{G.focusEvent.subscribe(H._onOverlayFocusHandler,G,H);}if(!G.focus){C.on(G.element,H.cfg.getProperty("focusevent"),H._onOverlayElementFocus,null,G);G.focus=function(){if(H._manageFocus(this)){if(this.cfg.getProperty("visible")&&this.focusFirst){this.focusFirst();}this.focusEvent.fire();}};G.focus._managed=true;}},_bindBlur:function(G){var H=this;if(!G.blurEvent){G.blurEvent=G.createEvent("blur");G.blurEvent.signature=F.LIST;G.focusEvent._managed=true;}else{G.blurEvent.subscribe(H._onOverlayBlurHandler,G,H);}if(!G.blur){G.blur=function(){if(H._manageBlur(this)){this.blurEvent.fire();}};G.blur._managed=true;}G.hideEvent.subscribe(G.blur);},_bindDestroy:function(G){var H=this;G.destroyEvent.subscribe(H._onOverlayDestroy,G,H);},_syncZIndex:function(G){var H=E.getStyle(G.element,"zIndex");if(!isNaN(H)){G.cfg.setProperty("zIndex",parseInt(H,10));}else{G.cfg.setProperty("zIndex",0);}},register:function(G){var K,J=false,H,I;if(G instanceof D){G.cfg.addProperty("manager",{value:this});this._bindFocus(G);this._bindBlur(G);this._bindDestroy(G);this._syncZIndex(G);this.overlays.push(G);this.bringToTop(G);J=true;}else{if(G instanceof Array){for(H=0,I=G.length;H<I;H++){J=this.register(G[H])||J;}}}return J;},bringToTop:function(M){var I=this.find(M),L,G,J;if(I){J=this.overlays;J.sort(this.compareZIndexDesc);G=J[0];if(G){L=E.getStyle(G.element,"zIndex");if(!isNaN(L)){var K=false;if(G!==I){K=true;}else{if(J.length>1){var H=E.getStyle(J[1].element,"zIndex");if(!isNaN(H)&&(L==H)){K=true;}}}if(K){I.cfg.setProperty("zindex",(parseInt(L,10)+2));}}J.sort(this.compareZIndexDesc);}}},find:function(G){var K=G instanceof D,I=this.overlays,M=I.length,J=null,L,H;if(K||typeof G=="string"){for(H=M-1;H>=0;H--){L=I[H];if((K&&(L===G))||(L.id==G)){J=L;break;}}}return J;},compareZIndexDesc:function(J,I){var H=(J.cfg)?J.cfg.getProperty("zIndex"):null,G=(I.cfg)?I.cfg.getProperty("zIndex"):null;if(H===null&&G===null){return 0;}else{if(H===null){return 1;}else{if(G===null){return -1;}else{if(H>G){return -1;}else{if(H<G){return 1;}else{return 0;}}}}}},showAll:function(){var H=this.overlays,I=H.length,G;
for(G=I-1;G>=0;G--){H[G].show();}},hideAll:function(){var H=this.overlays,I=H.length,G;for(G=I-1;G>=0;G--){H[G].hide();}},toString:function(){return"OverlayManager";}};}());(function(){YAHOO.widget.Tooltip=function(N,M){YAHOO.widget.Tooltip.superclass.constructor.call(this,N,M);};var E=YAHOO.lang,L=YAHOO.util.Event,K=YAHOO.util.CustomEvent,C=YAHOO.util.Dom,G=YAHOO.widget.Tooltip,F,H={"PREVENT_OVERLAP":{key:"preventoverlap",value:true,validator:E.isBoolean,supercedes:["x","y","xy"]},"SHOW_DELAY":{key:"showdelay",value:200,validator:E.isNumber},"AUTO_DISMISS_DELAY":{key:"autodismissdelay",value:5000,validator:E.isNumber},"HIDE_DELAY":{key:"hidedelay",value:250,validator:E.isNumber},"TEXT":{key:"text",suppressEvent:true},"CONTAINER":{key:"container"},"DISABLED":{key:"disabled",value:false,suppressEvent:true}},A={"CONTEXT_MOUSE_OVER":"contextMouseOver","CONTEXT_MOUSE_OUT":"contextMouseOut","CONTEXT_TRIGGER":"contextTrigger"};G.CSS_TOOLTIP="yui-tt";function I(N,M,O){var R=O[0],P=O[1],Q=this.cfg,S=Q.getProperty("width");if(S==P){Q.setProperty("width",R);}}function D(N,M){var O=document.body,S=this.cfg,R=S.getProperty("width"),P,Q;if((!R||R=="auto")&&(S.getProperty("container")!=O||S.getProperty("x")>=C.getViewportWidth()||S.getProperty("y")>=C.getViewportHeight())){Q=this.element.cloneNode(true);Q.style.visibility="hidden";Q.style.top="0px";Q.style.left="0px";O.appendChild(Q);P=(Q.offsetWidth+"px");O.removeChild(Q);Q=null;S.setProperty("width",P);S.refireEvent("xy");this.subscribe("hide",I,[(R||""),P]);}}function B(N,M,O){this.render(O);}function J(){L.onDOMReady(B,this.cfg.getProperty("container"),this);}YAHOO.extend(G,YAHOO.widget.Overlay,{init:function(N,M){G.superclass.init.call(this,N);this.beforeInitEvent.fire(G);C.addClass(this.element,G.CSS_TOOLTIP);if(M){this.cfg.applyConfig(M,true);}this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.subscribe("beforeShow",D);this.subscribe("init",J);this.subscribe("render",this.onRender);this.initEvent.fire(G);},initEvents:function(){G.superclass.initEvents.call(this);var M=K.LIST;this.contextMouseOverEvent=this.createEvent(A.CONTEXT_MOUSE_OVER);this.contextMouseOverEvent.signature=M;this.contextMouseOutEvent=this.createEvent(A.CONTEXT_MOUSE_OUT);this.contextMouseOutEvent.signature=M;this.contextTriggerEvent=this.createEvent(A.CONTEXT_TRIGGER);this.contextTriggerEvent.signature=M;},initDefaultConfig:function(){G.superclass.initDefaultConfig.call(this);this.cfg.addProperty(H.PREVENT_OVERLAP.key,{value:H.PREVENT_OVERLAP.value,validator:H.PREVENT_OVERLAP.validator,supercedes:H.PREVENT_OVERLAP.supercedes});this.cfg.addProperty(H.SHOW_DELAY.key,{handler:this.configShowDelay,value:200,validator:H.SHOW_DELAY.validator});this.cfg.addProperty(H.AUTO_DISMISS_DELAY.key,{handler:this.configAutoDismissDelay,value:H.AUTO_DISMISS_DELAY.value,validator:H.AUTO_DISMISS_DELAY.validator});this.cfg.addProperty(H.HIDE_DELAY.key,{handler:this.configHideDelay,value:H.HIDE_DELAY.value,validator:H.HIDE_DELAY.validator});this.cfg.addProperty(H.TEXT.key,{handler:this.configText,suppressEvent:H.TEXT.suppressEvent});this.cfg.addProperty(H.CONTAINER.key,{handler:this.configContainer,value:document.body});this.cfg.addProperty(H.DISABLED.key,{handler:this.configContainer,value:H.DISABLED.value,supressEvent:H.DISABLED.suppressEvent});},configText:function(N,M,O){var P=M[0];if(P){this.setBody(P);}},configContainer:function(O,N,P){var M=N[0];if(typeof M=="string"){this.cfg.setProperty("container",document.getElementById(M),true);}},_removeEventListeners:function(){var P=this._context,M,O,N;if(P){M=P.length;if(M>0){N=M-1;do{O=P[N];L.removeListener(O,"mouseover",this.onContextMouseOver);L.removeListener(O,"mousemove",this.onContextMouseMove);L.removeListener(O,"mouseout",this.onContextMouseOut);}while(N--);}}},configContext:function(R,N,S){var Q=N[0],T,M,P,O;if(Q){if(!(Q instanceof Array)){if(typeof Q=="string"){this.cfg.setProperty("context",[document.getElementById(Q)],true);}else{this.cfg.setProperty("context",[Q],true);}Q=this.cfg.getProperty("context");}this._removeEventListeners();this._context=Q;T=this._context;if(T){M=T.length;if(M>0){O=M-1;do{P=T[O];L.on(P,"mouseover",this.onContextMouseOver,this);L.on(P,"mousemove",this.onContextMouseMove,this);L.on(P,"mouseout",this.onContextMouseOut,this);}while(O--);}}}},onContextMouseMove:function(N,M){M.pageX=L.getPageX(N);M.pageY=L.getPageY(N);},onContextMouseOver:function(O,N){var M=this;if(M.title){N._tempTitle=M.title;M.title="";}if(N.fireEvent("contextMouseOver",M,O)!==false&&!N.cfg.getProperty("disabled")){if(N.hideProcId){clearTimeout(N.hideProcId);N.hideProcId=null;}L.on(M,"mousemove",N.onContextMouseMove,N);N.showProcId=N.doShow(O,M);}},onContextMouseOut:function(O,N){var M=this;if(N._tempTitle){M.title=N._tempTitle;N._tempTitle=null;}if(N.showProcId){clearTimeout(N.showProcId);N.showProcId=null;}if(N.hideProcId){clearTimeout(N.hideProcId);N.hideProcId=null;}N.fireEvent("contextMouseOut",M,O);N.hideProcId=setTimeout(function(){N.hide();},N.cfg.getProperty("hidedelay"));},doShow:function(O,M){var P=25,N=this;if(YAHOO.env.ua.opera&&M.tagName&&M.tagName.toUpperCase()=="A"){P+=12;}return setTimeout(function(){var Q=N.cfg.getProperty("text");if(N._tempTitle&&(Q===""||YAHOO.lang.isUndefined(Q)||YAHOO.lang.isNull(Q))){N.setBody(N._tempTitle);}else{N.cfg.refireEvent("text");}N.moveTo(N.pageX,N.pageY+P);if(N.cfg.getProperty("preventoverlap")){N.preventOverlap(N.pageX,N.pageY);}L.removeListener(M,"mousemove",N.onContextMouseMove);N.contextTriggerEvent.fire(M);N.show();N.hideProcId=N.doHide();},this.cfg.getProperty("showdelay"));},doHide:function(){var M=this;return setTimeout(function(){M.hide();},this.cfg.getProperty("autodismissdelay"));},preventOverlap:function(Q,P){var M=this.element.offsetHeight,O=new YAHOO.util.Point(Q,P),N=C.getRegion(this.element);N.top-=5;N.left-=5;N.right+=5;N.bottom+=5;if(N.contains(O)){this.cfg.setProperty("y",(P-M-5));}},onRender:function(Q,P){function R(){var U=this.element,T=this._shadow;
if(T){T.style.width=(U.offsetWidth+6)+"px";T.style.height=(U.offsetHeight+1)+"px";}}function N(){C.addClass(this._shadow,"yui-tt-shadow-visible");}function M(){C.removeClass(this._shadow,"yui-tt-shadow-visible");}function S(){var V=this._shadow,U,T,X,W;if(!V){U=this.element;T=YAHOO.widget.Module;X=YAHOO.env.ua.ie;W=this;if(!F){F=document.createElement("div");F.className="yui-tt-shadow";}V=F.cloneNode(false);U.appendChild(V);this._shadow=V;N.call(this);this.subscribe("beforeShow",N);this.subscribe("beforeHide",M);if(X==6||(X==7&&document.compatMode=="BackCompat")){window.setTimeout(function(){R.call(W);},0);this.cfg.subscribeToConfigEvent("width",R);this.cfg.subscribeToConfigEvent("height",R);this.subscribe("changeContent",R);T.textResizeEvent.subscribe(R,this,true);this.subscribe("destroy",function(){T.textResizeEvent.unsubscribe(R,this);});}}}function O(){S.call(this);this.unsubscribe("beforeShow",O);}if(this.cfg.getProperty("visible")){S.call(this);}else{this.subscribe("beforeShow",O);}},destroy:function(){this._removeEventListeners();G.superclass.destroy.call(this);},toString:function(){return"Tooltip "+this.id;}});}());(function(){YAHOO.widget.Panel=function(V,U){YAHOO.widget.Panel.superclass.constructor.call(this,V,U);};var S=null;var E=YAHOO.lang,F=YAHOO.util,A=F.Dom,T=F.Event,M=F.CustomEvent,K=YAHOO.util.KeyListener,I=F.Config,H=YAHOO.widget.Overlay,O=YAHOO.widget.Panel,L=YAHOO.env.ua,P=(L.ie==6||(L.ie==7&&document.compatMode=="BackCompat")),G,Q,C,D={"SHOW_MASK":"showMask","HIDE_MASK":"hideMask","DRAG":"drag"},N={"CLOSE":{key:"close",value:true,validator:E.isBoolean,supercedes:["visible"]},"DRAGGABLE":{key:"draggable",value:(F.DD?true:false),validator:E.isBoolean,supercedes:["visible"]},"DRAG_ONLY":{key:"dragonly",value:false,validator:E.isBoolean,supercedes:["draggable"]},"UNDERLAY":{key:"underlay",value:"shadow",supercedes:["visible"]},"MODAL":{key:"modal",value:false,validator:E.isBoolean,supercedes:["visible","zindex"]},"KEY_LISTENERS":{key:"keylisteners",suppressEvent:true,supercedes:["visible"]},"STRINGS":{key:"strings",supercedes:["close"],validator:E.isObject,value:{close:"Close"}}};O.CSS_PANEL="yui-panel";O.CSS_PANEL_CONTAINER="yui-panel-container";O.FOCUSABLE=["a","button","select","textarea","input","iframe"];function J(V,U){if(!this.header&&this.cfg.getProperty("draggable")){this.setHeader("&#160;");}}function R(V,U,W){var Z=W[0],X=W[1],Y=this.cfg,a=Y.getProperty("width");if(a==X){Y.setProperty("width",Z);}this.unsubscribe("hide",R,W);}function B(V,U){var Z=YAHOO.env.ua.ie,Y,X,W;if(Z==6||(Z==7&&document.compatMode=="BackCompat")){Y=this.cfg;X=Y.getProperty("width");if(!X||X=="auto"){W=(this.element.offsetWidth+"px");Y.setProperty("width",W);this.subscribe("hide",R,[(X||""),W]);}}}YAHOO.extend(O,H,{init:function(V,U){O.superclass.init.call(this,V);this.beforeInitEvent.fire(O);A.addClass(this.element,O.CSS_PANEL);this.buildWrapper();if(U){this.cfg.applyConfig(U,true);}this.subscribe("showMask",this._addFocusHandlers);this.subscribe("hideMask",this._removeFocusHandlers);this.subscribe("beforeRender",J);this.subscribe("render",function(){this.setFirstLastFocusable();this.subscribe("changeContent",this.setFirstLastFocusable);});this.subscribe("show",this.focusFirst);this.initEvent.fire(O);},_onElementFocus:function(X){var W=T.getTarget(X);if(W!==this.element&&!A.isAncestor(this.element,W)&&S==this){try{if(this.firstElement){this.firstElement.focus();}else{if(this._modalFocus){this._modalFocus.focus();}else{this.innerElement.focus();}}}catch(V){try{if(W!==document&&W!==document.body&&W!==window){W.blur();}}catch(U){}}}},_addFocusHandlers:function(V,U){if(!this.firstElement){if(L.webkit||L.opera){if(!this._modalFocus){this._createHiddenFocusElement();}}else{this.innerElement.tabIndex=0;}}this.setTabLoop(this.firstElement,this.lastElement);T.onFocus(document.documentElement,this._onElementFocus,this,true);S=this;},_createHiddenFocusElement:function(){var U=document.createElement("button");U.style.height="1px";U.style.width="1px";U.style.position="absolute";U.style.left="-10000em";U.style.opacity=0;U.tabIndex="-1";this.innerElement.appendChild(U);this._modalFocus=U;},_removeFocusHandlers:function(V,U){T.removeFocusListener(document.documentElement,this._onElementFocus,this);if(S==this){S=null;}},focusFirst:function(W,U,Y){var V=this.firstElement;if(U&&U[1]){T.stopEvent(U[1]);}if(V){try{V.focus();}catch(X){}}},focusLast:function(W,U,Y){var V=this.lastElement;if(U&&U[1]){T.stopEvent(U[1]);}if(V){try{V.focus();}catch(X){}}},setTabLoop:function(X,Z){var V=this.preventBackTab,W=this.preventTabOut,U=this.showEvent,Y=this.hideEvent;if(V){V.disable();U.unsubscribe(V.enable,V);Y.unsubscribe(V.disable,V);V=this.preventBackTab=null;}if(W){W.disable();U.unsubscribe(W.enable,W);Y.unsubscribe(W.disable,W);W=this.preventTabOut=null;}if(X){this.preventBackTab=new K(X,{shift:true,keys:9},{fn:this.focusLast,scope:this,correctScope:true});V=this.preventBackTab;U.subscribe(V.enable,V,true);Y.subscribe(V.disable,V,true);}if(Z){this.preventTabOut=new K(Z,{shift:false,keys:9},{fn:this.focusFirst,scope:this,correctScope:true});W=this.preventTabOut;U.subscribe(W.enable,W,true);Y.subscribe(W.disable,W,true);}},getFocusableElements:function(U){U=U||this.innerElement;var X={};for(var W=0;W<O.FOCUSABLE.length;W++){X[O.FOCUSABLE[W]]=true;}function V(Y){if(Y.focus&&Y.type!=="hidden"&&!Y.disabled&&X[Y.tagName.toLowerCase()]){return true;}return false;}return A.getElementsBy(V,null,U);},setFirstLastFocusable:function(){this.firstElement=null;this.lastElement=null;var U=this.getFocusableElements();this.focusableElements=U;if(U.length>0){this.firstElement=U[0];this.lastElement=U[U.length-1];}if(this.cfg.getProperty("modal")){this.setTabLoop(this.firstElement,this.lastElement);}},initEvents:function(){O.superclass.initEvents.call(this);var U=M.LIST;this.showMaskEvent=this.createEvent(D.SHOW_MASK);this.showMaskEvent.signature=U;this.hideMaskEvent=this.createEvent(D.HIDE_MASK);this.hideMaskEvent.signature=U;this.dragEvent=this.createEvent(D.DRAG);
this.dragEvent.signature=U;},initDefaultConfig:function(){O.superclass.initDefaultConfig.call(this);this.cfg.addProperty(N.CLOSE.key,{handler:this.configClose,value:N.CLOSE.value,validator:N.CLOSE.validator,supercedes:N.CLOSE.supercedes});this.cfg.addProperty(N.DRAGGABLE.key,{handler:this.configDraggable,value:(F.DD)?true:false,validator:N.DRAGGABLE.validator,supercedes:N.DRAGGABLE.supercedes});this.cfg.addProperty(N.DRAG_ONLY.key,{value:N.DRAG_ONLY.value,validator:N.DRAG_ONLY.validator,supercedes:N.DRAG_ONLY.supercedes});this.cfg.addProperty(N.UNDERLAY.key,{handler:this.configUnderlay,value:N.UNDERLAY.value,supercedes:N.UNDERLAY.supercedes});this.cfg.addProperty(N.MODAL.key,{handler:this.configModal,value:N.MODAL.value,validator:N.MODAL.validator,supercedes:N.MODAL.supercedes});this.cfg.addProperty(N.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:N.KEY_LISTENERS.suppressEvent,supercedes:N.KEY_LISTENERS.supercedes});this.cfg.addProperty(N.STRINGS.key,{value:N.STRINGS.value,handler:this.configStrings,validator:N.STRINGS.validator,supercedes:N.STRINGS.supercedes});},configClose:function(X,V,Y){var Z=V[0],W=this.close,U=this.cfg.getProperty("strings");if(Z){if(!W){if(!C){C=document.createElement("a");C.className="container-close";C.href="#";}W=C.cloneNode(true);this.innerElement.appendChild(W);W.innerHTML=(U&&U.close)?U.close:"&#160;";T.on(W,"click",this._doClose,this,true);this.close=W;}else{W.style.display="block";}}else{if(W){W.style.display="none";}}},_doClose:function(U){T.preventDefault(U);this.hide();},configDraggable:function(V,U,W){var X=U[0];if(X){if(!F.DD){this.cfg.setProperty("draggable",false);return ;}if(this.header){A.setStyle(this.header,"cursor","move");this.registerDragDrop();}this.subscribe("beforeShow",B);}else{if(this.dd){this.dd.unreg();}if(this.header){A.setStyle(this.header,"cursor","auto");}this.unsubscribe("beforeShow",B);}},configUnderlay:function(d,c,Z){var b=(this.platform=="mac"&&L.gecko),e=c[0].toLowerCase(),V=this.underlay,W=this.element;function f(){var g=this.underlay;A.addClass(g,"yui-force-redraw");window.setTimeout(function(){A.removeClass(g,"yui-force-redraw");},0);}function X(){var g=false;if(!V){if(!Q){Q=document.createElement("div");Q.className="underlay";}V=Q.cloneNode(false);this.element.appendChild(V);this.underlay=V;if(P){this.sizeUnderlay();this.cfg.subscribeToConfigEvent("width",this.sizeUnderlay);this.cfg.subscribeToConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.subscribe(this.sizeUnderlay);YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay,this,true);}if(L.webkit&&L.webkit<420){this.changeContentEvent.subscribe(f);}g=true;}}function a(){var g=X.call(this);if(!g&&P){this.sizeUnderlay();}this._underlayDeferred=false;this.beforeShowEvent.unsubscribe(a);}function Y(){if(this._underlayDeferred){this.beforeShowEvent.unsubscribe(a);this._underlayDeferred=false;}if(V){this.cfg.unsubscribeFromConfigEvent("width",this.sizeUnderlay);this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.unsubscribe(this.sizeUnderlay);this.changeContentEvent.unsubscribe(f);YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay,this,true);this.element.removeChild(V);this.underlay=null;}}switch(e){case"shadow":A.removeClass(W,"matte");A.addClass(W,"shadow");break;case"matte":if(!b){Y.call(this);}A.removeClass(W,"shadow");A.addClass(W,"matte");break;default:if(!b){Y.call(this);}A.removeClass(W,"shadow");A.removeClass(W,"matte");break;}if((e=="shadow")||(b&&!V)){if(this.cfg.getProperty("visible")){var U=X.call(this);if(!U&&P){this.sizeUnderlay();}}else{if(!this._underlayDeferred){this.beforeShowEvent.subscribe(a);this._underlayDeferred=true;}}}},configModal:function(V,U,X){var W=U[0];if(W){if(!this._hasModalityEventListeners){this.subscribe("beforeShow",this.buildMask);this.subscribe("beforeShow",this.bringToTop);this.subscribe("beforeShow",this.showMask);this.subscribe("hide",this.hideMask);H.windowResizeEvent.subscribe(this.sizeMask,this,true);this._hasModalityEventListeners=true;}}else{if(this._hasModalityEventListeners){if(this.cfg.getProperty("visible")){this.hideMask();this.removeMask();}this.unsubscribe("beforeShow",this.buildMask);this.unsubscribe("beforeShow",this.bringToTop);this.unsubscribe("beforeShow",this.showMask);this.unsubscribe("hide",this.hideMask);H.windowResizeEvent.unsubscribe(this.sizeMask,this);this._hasModalityEventListeners=false;}}},removeMask:function(){var V=this.mask,U;if(V){this.hideMask();U=V.parentNode;if(U){U.removeChild(V);}this.mask=null;}},configKeyListeners:function(X,U,a){var W=U[0],Z,Y,V;if(W){if(W instanceof Array){Y=W.length;for(V=0;V<Y;V++){Z=W[V];if(!I.alreadySubscribed(this.showEvent,Z.enable,Z)){this.showEvent.subscribe(Z.enable,Z,true);}if(!I.alreadySubscribed(this.hideEvent,Z.disable,Z)){this.hideEvent.subscribe(Z.disable,Z,true);this.destroyEvent.subscribe(Z.disable,Z,true);}}}else{if(!I.alreadySubscribed(this.showEvent,W.enable,W)){this.showEvent.subscribe(W.enable,W,true);}if(!I.alreadySubscribed(this.hideEvent,W.disable,W)){this.hideEvent.subscribe(W.disable,W,true);this.destroyEvent.subscribe(W.disable,W,true);}}}},configStrings:function(V,U,W){var X=E.merge(N.STRINGS.value,U[0]);this.cfg.setProperty(N.STRINGS.key,X,true);},configHeight:function(X,V,Y){var U=V[0],W=this.innerElement;A.setStyle(W,"height",U);this.cfg.refireEvent("iframe");},_autoFillOnHeightChange:function(W,U,V){O.superclass._autoFillOnHeightChange.apply(this,arguments);if(P){this.sizeUnderlay();}},configWidth:function(X,U,Y){var W=U[0],V=this.innerElement;A.setStyle(V,"width",W);this.cfg.refireEvent("iframe");},configzIndex:function(V,U,X){O.superclass.configzIndex.call(this,V,U,X);if(this.mask||this.cfg.getProperty("modal")===true){var W=A.getStyle(this.element,"zIndex");if(!W||isNaN(W)){W=0;}if(W===0){this.cfg.setProperty("zIndex",1);}else{this.stackMask();}}},buildWrapper:function(){var W=this.element.parentNode,U=this.element,V=document.createElement("div");V.className=O.CSS_PANEL_CONTAINER;
V.id=U.id+"_c";if(W){W.insertBefore(V,U);}V.appendChild(U);this.element=V;this.innerElement=U;A.setStyle(this.innerElement,"visibility","inherit");},sizeUnderlay:function(){var V=this.underlay,U;if(V){U=this.element;V.style.width=U.offsetWidth+"px";V.style.height=U.offsetHeight+"px";}},registerDragDrop:function(){var V=this;if(this.header){if(!F.DD){return ;}var U=(this.cfg.getProperty("dragonly")===true);this.dd=new F.DD(this.element.id,this.id,{dragOnly:U});if(!this.header.id){this.header.id=this.id+"_h";}this.dd.startDrag=function(){var X,Z,W,c,b,a;if(YAHOO.env.ua.ie==6){A.addClass(V.element,"drag");}if(V.cfg.getProperty("constraintoviewport")){var Y=H.VIEWPORT_OFFSET;X=V.element.offsetHeight;Z=V.element.offsetWidth;W=A.getViewportWidth();c=A.getViewportHeight();b=A.getDocumentScrollLeft();a=A.getDocumentScrollTop();if(X+Y<c){this.minY=a+Y;this.maxY=a+c-X-Y;}else{this.minY=a+Y;this.maxY=a+Y;}if(Z+Y<W){this.minX=b+Y;this.maxX=b+W-Z-Y;}else{this.minX=b+Y;this.maxX=b+Y;}this.constrainX=true;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}V.dragEvent.fire("startDrag",arguments);};this.dd.onDrag=function(){V.syncPosition();V.cfg.refireEvent("iframe");if(this.platform=="mac"&&YAHOO.env.ua.gecko){this.showMacGeckoScrollbars();}V.dragEvent.fire("onDrag",arguments);};this.dd.endDrag=function(){if(YAHOO.env.ua.ie==6){A.removeClass(V.element,"drag");}V.dragEvent.fire("endDrag",arguments);V.moveEvent.fire(V.cfg.getProperty("xy"));};this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}},buildMask:function(){var U=this.mask;if(!U){if(!G){G=document.createElement("div");G.className="mask";G.innerHTML="&#160;";}U=G.cloneNode(true);U.id=this.id+"_mask";document.body.insertBefore(U,document.body.firstChild);this.mask=U;if(YAHOO.env.ua.gecko&&this.platform=="mac"){A.addClass(this.mask,"block-scrollbars");}this.stackMask();}},hideMask:function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";A.removeClass(document.body,"masked");this.hideMaskEvent.fire();}},showMask:function(){if(this.cfg.getProperty("modal")&&this.mask){A.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}},sizeMask:function(){if(this.mask){var V=this.mask,W=A.getViewportWidth(),U=A.getViewportHeight();if(this.mask.offsetHeight>U){this.mask.style.height=U+"px";}if(this.mask.offsetWidth>W){this.mask.style.width=W+"px";}this.mask.style.height=A.getDocumentHeight()+"px";this.mask.style.width=A.getDocumentWidth()+"px";}},stackMask:function(){if(this.mask){var U=A.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(U)&&!isNaN(U)){A.setStyle(this.mask,"zIndex",U-1);}}},render:function(U){return O.superclass.render.call(this,U,this.innerElement);},destroy:function(){H.windowResizeEvent.unsubscribe(this.sizeMask,this);this.removeMask();if(this.close){T.purgeElement(this.close);}O.superclass.destroy.call(this);},toString:function(){return"Panel "+this.id;}});}());(function(){YAHOO.widget.Dialog=function(J,I){YAHOO.widget.Dialog.superclass.constructor.call(this,J,I);};var B=YAHOO.util.Event,G=YAHOO.util.CustomEvent,E=YAHOO.util.Dom,A=YAHOO.widget.Dialog,F=YAHOO.lang,H={"BEFORE_SUBMIT":"beforeSubmit","SUBMIT":"submit","MANUAL_SUBMIT":"manualSubmit","ASYNC_SUBMIT":"asyncSubmit","FORM_SUBMIT":"formSubmit","CANCEL":"cancel"},C={"POST_METHOD":{key:"postmethod",value:"async"},"BUTTONS":{key:"buttons",value:"none",supercedes:["visible"]},"HIDEAFTERSUBMIT":{key:"hideaftersubmit",value:true}};A.CSS_DIALOG="yui-dialog";function D(){var L=this._aButtons,J,K,I;if(F.isArray(L)){J=L.length;if(J>0){I=J-1;do{K=L[I];if(YAHOO.widget.Button&&K instanceof YAHOO.widget.Button){K.destroy();}else{if(K.tagName.toUpperCase()=="BUTTON"){B.purgeElement(K);B.purgeElement(K,false);}}}while(I--);}}}YAHOO.extend(A,YAHOO.widget.Panel,{form:null,initDefaultConfig:function(){A.superclass.initDefaultConfig.call(this);this.callback={success:null,failure:null,argument:null};this.cfg.addProperty(C.POST_METHOD.key,{handler:this.configPostMethod,value:C.POST_METHOD.value,validator:function(I){if(I!="form"&&I!="async"&&I!="none"&&I!="manual"){return false;}else{return true;}}});this.cfg.addProperty(C.HIDEAFTERSUBMIT.key,{value:C.HIDEAFTERSUBMIT.value});this.cfg.addProperty(C.BUTTONS.key,{handler:this.configButtons,value:C.BUTTONS.value,supercedes:C.BUTTONS.supercedes});},initEvents:function(){A.superclass.initEvents.call(this);var I=G.LIST;this.beforeSubmitEvent=this.createEvent(H.BEFORE_SUBMIT);this.beforeSubmitEvent.signature=I;this.submitEvent=this.createEvent(H.SUBMIT);this.submitEvent.signature=I;this.manualSubmitEvent=this.createEvent(H.MANUAL_SUBMIT);this.manualSubmitEvent.signature=I;this.asyncSubmitEvent=this.createEvent(H.ASYNC_SUBMIT);this.asyncSubmitEvent.signature=I;this.formSubmitEvent=this.createEvent(H.FORM_SUBMIT);this.formSubmitEvent.signature=I;this.cancelEvent=this.createEvent(H.CANCEL);this.cancelEvent.signature=I;},init:function(J,I){A.superclass.init.call(this,J);this.beforeInitEvent.fire(A);E.addClass(this.element,A.CSS_DIALOG);this.cfg.setProperty("visible",false);if(I){this.cfg.applyConfig(I,true);}this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.subscribe("changeBody",this.registerForm);this.initEvent.fire(A);},doSubmit:function(){var J=YAHOO.util.Connect,P=this.form,N=false,M=false,O,I,L,K;switch(this.cfg.getProperty("postmethod")){case"async":O=P.elements;I=O.length;if(I>0){L=I-1;do{if(O[L].type=="file"){N=true;break;}}while(L--);}if(N&&YAHOO.env.ua.ie&&this.isSecure){M=true;}K=this._getFormAttributes(P);J.setForm(P,N,M);J.asyncRequest(K.method,K.action,this.callback);this.asyncSubmitEvent.fire();break;case"form":P.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}},_getFormAttributes:function(K){var I={method:null,action:null};
if(K){if(K.getAttributeNode){var J=K.getAttributeNode("action");var L=K.getAttributeNode("method");if(J){I.action=J.value;}if(L){I.method=L.value;}}else{I.action=K.getAttribute("action");I.method=K.getAttribute("method");}}I.method=(F.isString(I.method)?I.method:"POST").toUpperCase();I.action=F.isString(I.action)?I.action:"";return I;},registerForm:function(){var I=this.element.getElementsByTagName("form")[0];if(this.form){if(this.form==I&&E.isAncestor(this.element,this.form)){return ;}else{B.purgeElement(this.form);this.form=null;}}if(!I){I=document.createElement("form");I.name="frm_"+this.id;this.body.appendChild(I);}if(I){this.form=I;B.on(I,"submit",this._submitHandler,this,true);}},_submitHandler:function(I){B.stopEvent(I);this.submit();this.form.blur();},setTabLoop:function(I,J){I=I||this.firstButton;J=this.lastButton||J;A.superclass.setTabLoop.call(this,I,J);},setFirstLastFocusable:function(){A.superclass.setFirstLastFocusable.call(this);var J,I,K,L=this.focusableElements;this.firstFormElement=null;this.lastFormElement=null;if(this.form&&L&&L.length>0){I=L.length;for(J=0;J<I;++J){K=L[J];if(this.form===K.form){this.firstFormElement=K;break;}}for(J=I-1;J>=0;--J){K=L[J];if(this.form===K.form){this.lastFormElement=K;break;}}}},configClose:function(J,I,K){A.superclass.configClose.apply(this,arguments);},_doClose:function(I){B.preventDefault(I);this.cancel();},configButtons:function(S,R,M){var N=YAHOO.widget.Button,U=R[0],K=this.innerElement,T,P,J,Q,O,I,L;D.call(this);this._aButtons=null;if(F.isArray(U)){O=document.createElement("span");O.className="button-group";Q=U.length;this._aButtons=[];this.defaultHtmlButton=null;for(L=0;L<Q;L++){T=U[L];if(N){J=new N({label:T.text});J.appendTo(O);P=J.get("element");if(T.isDefault){J.addClass("default");this.defaultHtmlButton=P;}if(F.isFunction(T.handler)){J.set("onclick",{fn:T.handler,obj:this,scope:this});}else{if(F.isObject(T.handler)&&F.isFunction(T.handler.fn)){J.set("onclick",{fn:T.handler.fn,obj:((!F.isUndefined(T.handler.obj))?T.handler.obj:this),scope:(T.handler.scope||this)});}}this._aButtons[this._aButtons.length]=J;}else{P=document.createElement("button");P.setAttribute("type","button");if(T.isDefault){P.className="default";this.defaultHtmlButton=P;}P.innerHTML=T.text;if(F.isFunction(T.handler)){B.on(P,"click",T.handler,this,true);}else{if(F.isObject(T.handler)&&F.isFunction(T.handler.fn)){B.on(P,"click",T.handler.fn,((!F.isUndefined(T.handler.obj))?T.handler.obj:this),(T.handler.scope||this));}}O.appendChild(P);this._aButtons[this._aButtons.length]=P;}T.htmlButton=P;if(L===0){this.firstButton=P;}if(L==(Q-1)){this.lastButton=P;}}this.setFooter(O);I=this.footer;if(E.inDocument(this.element)&&!E.isAncestor(K,I)){K.appendChild(I);}this.buttonSpan=O;}else{O=this.buttonSpan;I=this.footer;if(O&&I){I.removeChild(O);this.buttonSpan=null;this.firstButton=null;this.lastButton=null;this.defaultHtmlButton=null;}}this.setFirstLastFocusable();this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");},getButtons:function(){return this._aButtons||null;},focusFirst:function(K,I,M){var J=this.firstFormElement;if(I&&I[1]){B.stopEvent(I[1]);}if(J){try{J.focus();}catch(L){}}else{this.focusFirstButton();}},focusLast:function(K,I,M){var N=this.cfg.getProperty("buttons"),J=this.lastFormElement;if(I&&I[1]){B.stopEvent(I[1]);}if(N&&F.isArray(N)){this.focusLastButton();}else{if(J){try{J.focus();}catch(L){}}}},_getButton:function(J){var I=YAHOO.widget.Button;if(I&&J&&J.nodeName&&J.id){J=I.getButton(J.id)||J;}return J;},focusDefaultButton:function(){var I=this._getButton(this.defaultHtmlButton);if(I){try{I.focus();}catch(J){}}},blurButtons:function(){var N=this.cfg.getProperty("buttons"),K,M,J,I;if(N&&F.isArray(N)){K=N.length;if(K>0){I=(K-1);do{M=N[I];if(M){J=this._getButton(M.htmlButton);if(J){try{J.blur();}catch(L){}}}}while(I--);}}},focusFirstButton:function(){var L=this.cfg.getProperty("buttons"),K,I;if(L&&F.isArray(L)){K=L[0];if(K){I=this._getButton(K.htmlButton);if(I){try{I.focus();}catch(J){}}}}},focusLastButton:function(){var M=this.cfg.getProperty("buttons"),J,L,I;if(M&&F.isArray(M)){J=M.length;if(J>0){L=M[(J-1)];if(L){I=this._getButton(L.htmlButton);if(I){try{I.focus();}catch(K){}}}}}},configPostMethod:function(J,I,K){this.registerForm();},validate:function(){return true;},submit:function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();if(this.cfg.getProperty("hideaftersubmit")){this.hide();}return true;}else{return false;}},cancel:function(){this.cancelEvent.fire();this.hide();},getData:function(){var Y=this.form,K,R,U,M,S,P,O,J,V,L,W,Z,I,N,a,X,T;function Q(c){var b=c.tagName.toUpperCase();return((b=="INPUT"||b=="TEXTAREA"||b=="SELECT")&&c.name==M);}if(Y){K=Y.elements;R=K.length;U={};for(X=0;X<R;X++){M=K[X].name;S=E.getElementsBy(Q,"*",Y);P=S.length;if(P>0){if(P==1){S=S[0];O=S.type;J=S.tagName.toUpperCase();switch(J){case"INPUT":if(O=="checkbox"){U[M]=S.checked;}else{if(O!="radio"){U[M]=S.value;}}break;case"TEXTAREA":U[M]=S.value;break;case"SELECT":V=S.options;L=V.length;W=[];for(T=0;T<L;T++){Z=V[T];if(Z.selected){I=Z.value;if(!I||I===""){I=Z.text;}W[W.length]=I;}}U[M]=W;break;}}else{O=S[0].type;switch(O){case"radio":for(T=0;T<P;T++){N=S[T];if(N.checked){U[M]=N.value;break;}}break;case"checkbox":W=[];for(T=0;T<P;T++){a=S[T];if(a.checked){W[W.length]=a.value;}}U[M]=W;break;}}}}}return U;},destroy:function(){D.call(this);this._aButtons=null;var I=this.element.getElementsByTagName("form"),J;if(I.length>0){J=I[0];if(J){B.purgeElement(J);if(J.parentNode){J.parentNode.removeChild(J);}this.form=null;}}A.superclass.destroy.call(this);},toString:function(){return"Dialog "+this.id;}});}());(function(){YAHOO.widget.SimpleDialog=function(E,D){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,E,D);};var C=YAHOO.util.Dom,B=YAHOO.widget.SimpleDialog,A={"ICON":{key:"icon",value:"none",suppressEvent:true},"TEXT":{key:"text",value:"",suppressEvent:true,supercedes:["icon"]}};B.ICON_BLOCK="blckicon";B.ICON_ALARM="alrticon";
B.ICON_HELP="hlpicon";B.ICON_INFO="infoicon";B.ICON_WARN="warnicon";B.ICON_TIP="tipicon";B.ICON_CSS_CLASSNAME="yui-icon";B.CSS_SIMPLEDIALOG="yui-simple-dialog";YAHOO.extend(B,YAHOO.widget.Dialog,{initDefaultConfig:function(){B.superclass.initDefaultConfig.call(this);this.cfg.addProperty(A.ICON.key,{handler:this.configIcon,value:A.ICON.value,suppressEvent:A.ICON.suppressEvent});this.cfg.addProperty(A.TEXT.key,{handler:this.configText,value:A.TEXT.value,suppressEvent:A.TEXT.suppressEvent,supercedes:A.TEXT.supercedes});},init:function(E,D){B.superclass.init.call(this,E);this.beforeInitEvent.fire(B);C.addClass(this.element,B.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(D){this.cfg.applyConfig(D,true);}this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(B);},registerForm:function(){B.superclass.registerForm.call(this);this.form.innerHTML+='<input type="hidden" name="'+this.id+'" value=""/>';},configIcon:function(F,E,J){var K=E[0],D=this.body,I=B.ICON_CSS_CLASSNAME,H,G;if(K&&K!="none"){H=C.getElementsByClassName(I,"*",D);if(H){G=H.parentNode;if(G){G.removeChild(H);H=null;}}if(K.indexOf(".")==-1){H=document.createElement("span");H.className=(I+" "+K);H.innerHTML="&#160;";}else{H=document.createElement("img");H.src=(this.imageRoot+K);H.className=I;}if(H){D.insertBefore(H,D.firstChild);}}},configText:function(E,D,F){var G=D[0];if(G){this.setBody(G);this.cfg.refireEvent("icon");}},toString:function(){return"SimpleDialog "+this.id;}});}());(function(){YAHOO.widget.ContainerEffect=function(E,H,G,D,F){if(!F){F=YAHOO.util.Anim;}this.overlay=E;this.attrIn=H;this.attrOut=G;this.targetElement=D||E.element;this.animClass=F;};var B=YAHOO.util.Dom,C=YAHOO.util.CustomEvent,A=YAHOO.widget.ContainerEffect;A.FADE=function(D,F){var G=YAHOO.util.Easing,I={attributes:{opacity:{from:0,to:1}},duration:F,method:G.easeIn},E={attributes:{opacity:{to:0}},duration:F,method:G.easeOut},H=new A(D,I,E,D.element);H.handleUnderlayStart=function(){var K=this.overlay.underlay;if(K&&YAHOO.env.ua.ie){var J=(K.filters&&K.filters.length>0);if(J){B.addClass(D.element,"yui-effect-fade");}}};H.handleUnderlayComplete=function(){var J=this.overlay.underlay;if(J&&YAHOO.env.ua.ie){B.removeClass(D.element,"yui-effect-fade");}};H.handleStartAnimateIn=function(K,J,L){B.addClass(L.overlay.element,"hide-select");if(!L.overlay.underlay){L.overlay.cfg.refireEvent("underlay");}L.handleUnderlayStart();B.setStyle(L.overlay.element,"visibility","visible");B.setStyle(L.overlay.element,"opacity",0);};H.handleCompleteAnimateIn=function(K,J,L){B.removeClass(L.overlay.element,"hide-select");if(L.overlay.element.style.filter){L.overlay.element.style.filter=null;}L.handleUnderlayComplete();L.overlay.cfg.refireEvent("iframe");L.animateInCompleteEvent.fire();};H.handleStartAnimateOut=function(K,J,L){B.addClass(L.overlay.element,"hide-select");L.handleUnderlayStart();};H.handleCompleteAnimateOut=function(K,J,L){B.removeClass(L.overlay.element,"hide-select");if(L.overlay.element.style.filter){L.overlay.element.style.filter=null;}B.setStyle(L.overlay.element,"visibility","hidden");B.setStyle(L.overlay.element,"opacity",1);L.handleUnderlayComplete();L.overlay.cfg.refireEvent("iframe");L.animateOutCompleteEvent.fire();};H.init();return H;};A.SLIDE=function(F,D){var I=YAHOO.util.Easing,L=F.cfg.getProperty("x")||B.getX(F.element),K=F.cfg.getProperty("y")||B.getY(F.element),M=B.getClientWidth(),H=F.element.offsetWidth,J={attributes:{points:{to:[L,K]}},duration:D,method:I.easeIn},E={attributes:{points:{to:[(M+25),K]}},duration:D,method:I.easeOut},G=new A(F,J,E,F.element,YAHOO.util.Motion);G.handleStartAnimateIn=function(O,N,P){P.overlay.element.style.left=((-25)-H)+"px";P.overlay.element.style.top=K+"px";};G.handleTweenAnimateIn=function(Q,P,R){var S=B.getXY(R.overlay.element),O=S[0],N=S[1];if(B.getStyle(R.overlay.element,"visibility")=="hidden"&&O<L){B.setStyle(R.overlay.element,"visibility","visible");}R.overlay.cfg.setProperty("xy",[O,N],true);R.overlay.cfg.refireEvent("iframe");};G.handleCompleteAnimateIn=function(O,N,P){P.overlay.cfg.setProperty("xy",[L,K],true);P.startX=L;P.startY=K;P.overlay.cfg.refireEvent("iframe");P.animateInCompleteEvent.fire();};G.handleStartAnimateOut=function(O,N,R){var P=B.getViewportWidth(),S=B.getXY(R.overlay.element),Q=S[1];R.animOut.attributes.points.to=[(P+25),Q];};G.handleTweenAnimateOut=function(P,O,Q){var S=B.getXY(Q.overlay.element),N=S[0],R=S[1];Q.overlay.cfg.setProperty("xy",[N,R],true);Q.overlay.cfg.refireEvent("iframe");};G.handleCompleteAnimateOut=function(O,N,P){B.setStyle(P.overlay.element,"visibility","hidden");P.overlay.cfg.setProperty("xy",[L,K]);P.animateOutCompleteEvent.fire();};G.init();return G;};A.prototype={init:function(){this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn");this.beforeAnimateInEvent.signature=C.LIST;this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut");this.beforeAnimateOutEvent.signature=C.LIST;this.animateInCompleteEvent=this.createEvent("animateInComplete");this.animateInCompleteEvent.signature=C.LIST;this.animateOutCompleteEvent=this.createEvent("animateOutComplete");this.animateOutCompleteEvent.signature=C.LIST;this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);},animateIn:function(){this.beforeAnimateInEvent.fire();this.animIn.animate();},animateOut:function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();},handleStartAnimateIn:function(E,D,F){},handleTweenAnimateIn:function(E,D,F){},handleCompleteAnimateIn:function(E,D,F){},handleStartAnimateOut:function(E,D,F){},handleTweenAnimateOut:function(E,D,F){},handleCompleteAnimateOut:function(E,D,F){},toString:function(){var D="ContainerEffect";
if(this.overlay){D+=" ["+this.overlay.toString()+"]";}return D;}};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);})();YAHOO.register("container",YAHOO.widget.Module,{version:"2.6.0",build:"1321"});


/* Overlay patch */
(function(){var A=YAHOO.widget.Overlay,B=A.prototype,C=YAHOO.util.Dom;B.getConstrainedX=function(K){var H=this,D=H.element,T=D.offsetWidth,R=A.VIEWPORT_OFFSET,W=C.getViewportWidth(),S=C.getDocumentScrollLeft(),N=(T+R<W),Q=this.cfg.getProperty("context"),F,M,Y,I=false,U,L,V=S+R,E=S+W-T-R,X=K,J={tltr:true,blbr:true,brbl:true,trtl:true};var O=function(){var Z;if((H.cfg.getProperty("x")-S)>M){Z=(M-T)}else{Z=(M+Y)}H.cfg.setProperty("x",(Z+S),true);return Z};var G=function(){if((H.cfg.getProperty("x")-S)>M){return(L-R)}else{return(U-R)}};var P=function(){var Z=G(),a;if(T>Z){if(I){O()}else{O();I=true;a=P()}}return a};if(K<V||K>E){if(N){if(this.cfg.getProperty("preventcontextoverlap")&&Q&&J[(Q[1]+Q[2])]){F=Q[0];M=C.getX(F)-S;Y=F.offsetWidth;U=M;L=(W-(M+Y));P();X=this.cfg.getProperty("x")}else{if(K<V){X=V}else{if(K>E){X=E}}}}else{X=R+S}}return X};B.getConstrainedY=function(O){var L=this,E=L.element,X=E.offsetHeight,W=A.VIEWPORT_OFFSET,S=C.getViewportHeight(),V=C.getDocumentScrollTop(),T=(X+W<S),U=this.cfg.getProperty("context"),J,P,Q,M=false,K,F,R=V+W,H=V+S-X-W,D=O,N={trbr:true,tlbl:true,bltl:true,brtr:true};var I=function(){var Z;if((L.cfg.getProperty("y")-V)>P){Z=(P-X)}else{Z=(P+Q)}L.cfg.setProperty("y",(Z+V),true);return Z};var G=function(){if((L.cfg.getProperty("y")-V)>P){return(F-W)}else{return(K-W)}};var Y=function(){var a=G(),Z;if(X>a){if(M){I()}else{I();M=true;Z=Y()}}return Z};if(O<R||O>H){if(T){if(this.cfg.getProperty("preventcontextoverlap")&&U&&N[(U[1]+U[2])]){J=U[0];Q=J.offsetHeight;P=(C.getY(J)-V);K=P;F=(S-(P+Q));Y();D=L.cfg.getProperty("y")}else{if(O<R){D=R}else{if(O>H){D=H}}}}else{D=W+V}}return D}}());

/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
(function(){var A=YAHOO.util;A.Selector={_foundCache:[],_regexCache:{},_re:{nth:/^(?:([-]?\d*)(n){1}|(odd|even)$)*([-+]?\d*)$/,attr:/(\[.*\])/g,urls:/^(?:href|src)/},document:window.document,attrAliases:{},shorthand:{"\\#(-?[_a-z]+[-\\w]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w]*)":"[class~=$1]"},operators:{"=":function(B,C){return B===C;},"!=":function(B,C){return B!==C;},"~=":function(B,D){var C=" ";return(C+B+C).indexOf((C+D+C))>-1;},"|=":function(B,C){return B===C||B.slice(0,C.length+1)===C+"-";},"^=":function(B,C){return B.indexOf(C)===0;},"$=":function(B,C){return B.slice(-C.length)===C;},"*=":function(B,C){return B.indexOf(C)>-1;},"":function(B,C){return B;}},pseudos:{"root":function(B){return B===B.ownerDocument.documentElement;},"nth-child":function(B,C){return A.Selector._getNth(B,C);},"nth-last-child":function(B,C){return A.Selector._getNth(B,C,null,true);},"nth-of-type":function(B,C){return A.Selector._getNth(B,C,B.tagName);},"nth-last-of-type":function(B,C){return A.Selector._getNth(B,C,B.tagName,true);},"first-child":function(B){return A.Selector._getChildren(B.parentNode)[0]===B;},"last-child":function(C){var B=A.Selector._getChildren(C.parentNode);return B[B.length-1]===C;},"first-of-type":function(B,C){return A.Selector._getChildren(B.parentNode,B.tagName)[0];},"last-of-type":function(C,D){var B=A.Selector._getChildren(C.parentNode,C.tagName);return B[B.length-1];},"only-child":function(C){var B=A.Selector._getChildren(C.parentNode);return B.length===1&&B[0]===C;},"only-of-type":function(B){return A.Selector._getChildren(B.parentNode,B.tagName).length===1;},"empty":function(B){return B.childNodes.length===0;},"not":function(B,C){return !A.Selector.test(B,C);},"contains":function(B,D){var C=B.innerText||B.textContent||"";return C.indexOf(D)>-1;},"checked":function(B){return B.checked===true;}},test:function(F,D){F=A.Selector.document.getElementById(F)||F;if(!F){return false;}var C=D?D.split(","):[];if(C.length){for(var E=0,B=C.length;E<B;++E){if(A.Selector._test(F,C[E])){return true;}}return false;}return A.Selector._test(F,D);},_test:function(D,G,F,E){F=F||A.Selector._tokenize(G).pop()||{};if(!D.tagName||(F.tag!=="*"&&D.tagName!==F.tag)||(E&&D._found)){return false;}if(F.attributes.length){var B,H,C=A.Selector._re.urls;if(!D.attributes||!D.attributes.length){return false;}for(var I=0,K;K=F.attributes[I++];){H=(C.test(K[0]))?2:0;B=D.getAttribute(K[0],H);if(B===null||B===undefined){return false;}if(A.Selector.operators[K[1]]&&!A.Selector.operators[K[1]](B,K[2])){return false;}}}if(F.pseudos.length){for(var I=0,J=F.pseudos.length;I<J;++I){if(A.Selector.pseudos[F.pseudos[I][0]]&&!A.Selector.pseudos[F.pseudos[I][0]](D,F.pseudos[I][1])){return false;}}}return(F.previous&&F.previous.combinator!==",")?A.Selector._combinators[F.previous.combinator](D,F):true;},filter:function(E,D){E=E||[];var G,C=[],H=A.Selector._tokenize(D);if(!E.item){for(var F=0,B=E.length;F<B;++F){if(!E[F].tagName){G=A.Selector.document.getElementById(E[F]);if(G){E[F]=G;}else{}}}}C=A.Selector._filter(E,A.Selector._tokenize(D)[0]);return C;},_filter:function(E,G,H,D){var C=H?null:[],I=A.Selector._foundCache;for(var F=0,B=E.length;F<B;F++){if(!A.Selector._test(E[F],"",G,D)){continue;}if(H){return E[F];}if(D){if(E[F]._found){continue;}E[F]._found=true;I[I.length]=E[F];}C[C.length]=E[F];}return C;},query:function(C,D,E){var B=A.Selector._query(C,D,E);return B;},_query:function(H,M,N,F){var P=(N)?null:[],E;if(!H){return P;}var D=H.split(",");if(D.length>1){var O;for(var I=0,J=D.length;I<J;++I){O=arguments.callee(D[I],M,N,true);P=N?O:P.concat(O);}A.Selector._clearFoundCache();return P;}if(M&&!M.nodeName){M=A.Selector.document.getElementById(M);if(!M){return P;}}M=M||A.Selector.document;if(M.nodeName!=="#document"){A.Dom.generateId(M);H=M.tagName+"#"+M.id+" "+H;E=M;M=M.ownerDocument;}var L=A.Selector._tokenize(H);var K=L[A.Selector._getIdTokenIndex(L)],B=[],C,G=L.pop()||{};if(K){C=A.Selector._getId(K.attributes);}if(C){E=E||A.Selector.document.getElementById(C);if(E&&(M.nodeName==="#document"||A.Dom.isAncestor(M,E))){if(A.Selector._test(E,null,K)){if(K===G){B=[E];}else{if(K.combinator===" "||K.combinator===">"){M=E;}}}}else{return P;}}if(M&&!B.length){B=M.getElementsByTagName(G.tag);}if(B.length){P=A.Selector._filter(B,G,N,F);}return P;},_clearFoundCache:function(){var E=A.Selector._foundCache;for(var C=0,B=E.length;C<B;++C){try{delete E[C]._found;}catch(D){E[C].removeAttribute("_found");}}E=[];},_getRegExp:function(D,B){var C=A.Selector._regexCache;B=B||"";if(!C[D+B]){C[D+B]=new RegExp(D,B);}return C[D+B];},_getChildren:function(){if(document.documentElement.children){return function(C,B){return(B)?C.children.tags(B):C.children||[];};}else{return function(F,C){if(F._children){return F._children;}var E=[],G=F.childNodes;for(var D=0,B=G.length;D<B;++D){if(G[D].tagName){if(!C||G[D].tagName===C){E[E.length]=G[D];}}}F._children=E;return E;};}}(),_combinators:{" ":function(C,B){while((C=C.parentNode)){if(A.Selector._test(C,"",B.previous)){return true;}}return false;},">":function(C,B){return A.Selector._test(C.parentNode,null,B.previous);},"+":function(D,C){var B=D.previousSibling;while(B&&B.nodeType!==1){B=B.previousSibling;}if(B&&A.Selector._test(B,null,C.previous)){return true;}return false;},"~":function(D,C){var B=D.previousSibling;while(B){if(B.nodeType===1&&A.Selector._test(B,null,C.previous)){return true;}B=B.previousSibling;}return false;}},_getNth:function(C,L,N,G){A.Selector._re.nth.test(L);var K=parseInt(RegExp.$1,10),B=RegExp.$2,H=RegExp.$3,I=parseInt(RegExp.$4,10)||0,M=[],E;var J=A.Selector._getChildren(C.parentNode,N);if(H){K=2;E="+";B="n";I=(H==="odd")?1:0;}else{if(isNaN(K)){K=(B)?1:0;}}if(K===0){if(G){I=J.length-I+1;}if(J[I-1]===C){return true;}else{return false;}}else{if(K<0){G=!!G;K=Math.abs(K);}}if(!G){for(var D=I-1,F=J.length;D<F;D+=K){if(D>=0&&J[D]===C){return true;}}}else{for(var D=J.length-I,F=J.length;D>=0;D-=K){if(D<F&&J[D]===C){return true;}}}return false;},_getId:function(C){for(var D=0,B=C.length;D<B;
++D){if(C[D][0]=="id"&&C[D][1]==="="){return C[D][2];}}},_getIdTokenIndex:function(D){for(var C=0,B=D.length;C<B;++C){if(A.Selector._getId(D[C].attributes)){return C;}}return -1;},_patterns:{tag:/^((?:-?[_a-z]+[\w-]*)|\*)/i,attributes:/^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,pseudos:/^:([-\w]+)(?:\(['"]?(.+)['"]?\))*/i,combinator:/^\s*([>+~]|\s)\s*/},_tokenize:function(B){var D={},H=[],I,G=false,F=A.Selector._patterns,C;B=A.Selector._replaceShorthand(B);do{G=false;for(var E in F){if(YAHOO.lang.hasOwnProperty(F,E)){if(E!="tag"&&E!="combinator"){D[E]=D[E]||[];}if((C=F[E].exec(B))){G=true;if(E!="tag"&&E!="combinator"){if(E==="attributes"&&C[1]==="id"){D.id=C[3];}D[E].push(C.slice(1));}else{D[E]=C[1];}B=B.replace(C[0],"");if(E==="combinator"||!B.length){D.attributes=A.Selector._fixAttributes(D.attributes);D.pseudos=D.pseudos||[];D.tag=D.tag?D.tag.toUpperCase():"*";H.push(D);D={previous:D};}}}}}while(G);return H;},_fixAttributes:function(C){var D=A.Selector.attrAliases;C=C||[];for(var E=0,B=C.length;E<B;++E){if(D[C[E][0]]){C[E][0]=D[C[E][0]];}if(!C[E][1]){C[E][1]="";}}return C;},_replaceShorthand:function(C){var D=A.Selector.shorthand;var E=C.match(A.Selector._re.attr);if(E){C=C.replace(A.Selector._re.attr,"REPLACED_ATTRIBUTE");}for(var G in D){if(YAHOO.lang.hasOwnProperty(D,G)){C=C.replace(A.Selector._getRegExp(G,"gi"),D[G]);}}if(E){for(var F=0,B=E.length;F<B;++F){C=C.replace("REPLACED_ATTRIBUTE",E[F]);}}return C;}};if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<8){A.Selector.attrAliases["class"]="className";A.Selector.attrAliases["for"]="htmlFor";}})();YAHOO.register("selector",YAHOO.util.Selector,{version:"2.7.0",build:"1799"});

/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
YAHOO.lang.JSON=(function(){var l=YAHOO.lang,_UNICODE_EXCEPTIONS=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_ESCAPES=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,_VALUES=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,_BRACKETS=/(?:^|:|,)(?:\s*\[)+/g,_INVALID=/^[\],:{}\s]*$/,_SPECIAL_CHARS=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_CHARS={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function _revive(data,reviver){var walk=function(o,key){var k,v,value=o[key];if(value&&typeof value==="object"){for(k in value){if(l.hasOwnProperty(value,k)){v=walk(value,k);if(v===undefined){delete value[k];}else{value[k]=v;}}}}return reviver.call(o,key,value);};return typeof reviver==="function"?walk({"":data},""):data;}function _char(c){if(!_CHARS[c]){_CHARS[c]="\\u"+("0000"+(+(c.charCodeAt(0))).toString(16)).slice(-4);}return _CHARS[c];}function _prepare(s){return s.replace(_UNICODE_EXCEPTIONS,_char);}function _isValid(str){return l.isString(str)&&_INVALID.test(str.replace(_ESCAPES,"@").replace(_VALUES,"]").replace(_BRACKETS,""));}function _string(s){return'"'+s.replace(_SPECIAL_CHARS,_char)+'"';}function _stringify(h,key,d,w,pstack){var o=typeof w==="function"?w.call(h,key,h[key]):h[key],i,len,j,k,v,isArray,a;if(o instanceof Date){o=l.JSON.dateToString(o);}else{if(o instanceof String||o instanceof Boolean||o instanceof Number){o=o.valueOf();}}switch(typeof o){case"string":return _string(o);case"number":return isFinite(o)?String(o):"null";case"boolean":return String(o);case"object":if(o===null){return"null";}for(i=pstack.length-1;i>=0;--i){if(pstack[i]===o){return"null";}}pstack[pstack.length]=o;a=[];isArray=l.isArray(o);if(d>0){if(isArray){for(i=o.length-1;i>=0;--i){a[i]=_stringify(o,i,d-1,w,pstack)||"null";}}else{j=0;if(l.isArray(w)){for(i=0,len=w.length;i<len;++i){k=w[i];v=_stringify(o,k,d-1,w,pstack);if(v){a[j++]=_string(k)+":"+v;}}}else{for(k in o){if(typeof k==="string"&&l.hasOwnProperty(o,k)){v=_stringify(o,k,d-1,w,pstack);if(v){a[j++]=_string(k)+":"+v;}}}}a.sort();}}pstack.pop();return isArray?"["+a.join(",")+"]":"{"+a.join(",")+"}";}return undefined;}return{isValid:function(s){return _isValid(_prepare(s));},parse:function(s,reviver){s=_prepare(s);if(_isValid(s)){return _revive(eval("("+s+")"),reviver);}throw new SyntaxError("parseJSON");},stringify:function(o,w,d){if(o!==undefined){if(l.isArray(w)){w=(function(a){var uniq=[],map={},v,i,j,len;for(i=0,j=0,len=a.length;i<len;++i){v=a[i];if(typeof v==="string"&&map[v]===undefined){uniq[(map[v]=j++)]=v;}}return uniq;})(w);}d=d>=0?d:1/0;return _stringify({"":o},"",d,w,[]);}return undefined;},dateToString:function(d){function _zeroPad(v){return v<10?"0"+v:v;}return d.getUTCFullYear()+"-"+_zeroPad(d.getUTCMonth()+1)+"-"+_zeroPad(d.getUTCDate())+"T"+_zeroPad(d.getUTCHours())+":"+_zeroPad(d.getUTCMinutes())+":"+_zeroPad(d.getUTCSeconds())+"Z";},stringToDate:function(str){if(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/.test(str)){var d=new Date();d.setUTCFullYear(RegExp.$1,(RegExp.$2|0)-1,RegExp.$3);d.setUTCHours(RegExp.$4,RegExp.$5,RegExp.$6);return d;}return str;}};})();YAHOO.register("json",YAHOO.lang.JSON,{version:"2.6.0",build:"1321"});

/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
(function(){var S="DIV",O="hd",K="bd",N="ft",X="LI",A="disabled",D="mouseover",F="mouseout",U="mousedown",G="mouseup",R=YAHOO.env.ua.ie?"focusin":"focus",V="click",B="keydown",M="keyup",I="keypress",L="clicktohide",T="position",P="dynamic",Y="showdelay",J="selected",E="visible",W="UL",Q="MenuManager",C=YAHOO.util.Dom,Z=YAHOO.util.Event,H=YAHOO.lang;YAHOO.widget.MenuManager=function(){var a=false,c={},r={},d={},n={"click":"clickEvent","mousedown":"mouseDownEvent","mouseup":"mouseUpEvent","mouseover":"mouseOverEvent","mouseout":"mouseOutEvent","keydown":"keyDownEvent","keyup":"keyUpEvent","keypress":"keyPressEvent","focus":"focusEvent","focusin":"focusEvent","blur":"blurEvent","focusout":"blurEvent"},m=null,k=null;function o(u){var s,t;if(u&&u.tagName){switch(u.tagName.toUpperCase()){case S:s=u.parentNode;if((C.hasClass(u,O)||C.hasClass(u,K)||C.hasClass(u,N))&&s&&s.tagName&&s.tagName.toUpperCase()==S){t=s;}else{t=u;}break;case X:t=u;break;default:s=u.parentNode;if(s){t=o(s);}break;}}return t;}function q(w){var s=Z.getTarget(w),t=o(s),y,u,v,AA,z;if(t){u=t.tagName.toUpperCase();if(u==X){v=t.id;if(v&&d[v]){AA=d[v];z=AA.parent;}}else{if(u==S){if(t.id){z=c[t.id];}}}}if(z){y=n[w.type];if(AA&&!AA.cfg.getProperty(A)){AA[y].fire(w);}z[y].fire(w,AA);}else{if(w.type==U){for(var x in r){if(H.hasOwnProperty(r,x)){z=r[x];if(z.cfg.getProperty(L)&&!(z instanceof YAHOO.widget.MenuBar)&&z.cfg.getProperty(T)==P){z.hide();}else{if(z.cfg.getProperty(Y)>0){z._cancelShowDelay();}if(z.activeItem){z.activeItem.blur();z.activeItem.cfg.setProperty(J,false);z.activeItem=null;}}}}}else{if(w.type==R){m=s;}}}}function f(t,s,u){if(c[u.id]){this.removeMenu(u);}}function j(t,s){var u=s[1];if(u){k=u;}}function i(t,s){k=null;}function b(t,s,v){if(v&&v.focus){try{v.focus();}catch(u){}}this.hideEvent.unsubscribe(b,v);}function l(t,s){if(this===this.getRoot()&&this.cfg.getProperty(T)===P){this.hideEvent.subscribe(b,m);this.focus();}}function g(u,t){var s=t[0],v=this.id;if(s){r[v]=this;}else{if(r[v]){delete r[v];}}}function h(t,s){p(this);}function p(t){var s=t.id;if(s&&d[s]){if(k==t){k=null;}delete d[s];t.destroyEvent.unsubscribe(h);}}function e(t,s){var v=s[0],u;if(v instanceof YAHOO.widget.MenuItem){u=v.id;if(!d[u]){d[u]=v;v.destroyEvent.subscribe(h);}}}return{addMenu:function(t){var s;if(t instanceof YAHOO.widget.Menu&&t.id&&!c[t.id]){c[t.id]=t;if(!a){s=document;Z.on(s,D,q,this,true);Z.on(s,F,q,this,true);Z.on(s,U,q,this,true);Z.on(s,G,q,this,true);Z.on(s,V,q,this,true);Z.on(s,B,q,this,true);Z.on(s,M,q,this,true);Z.on(s,I,q,this,true);Z.onFocus(s,q,this,true);Z.onBlur(s,q,this,true);a=true;}t.cfg.subscribeToConfigEvent(E,g);t.destroyEvent.subscribe(f,t,this);t.itemAddedEvent.subscribe(e);t.focusEvent.subscribe(j);t.blurEvent.subscribe(i);t.showEvent.subscribe(l);}},removeMenu:function(v){var t,s,u;if(v){t=v.id;if((t in c)&&(c[t]==v)){s=v.getItems();if(s&&s.length>0){u=s.length-1;do{p(s[u]);}while(u--);}delete c[t];if((t in r)&&(r[t]==v)){delete r[t];}if(v.cfg){v.cfg.unsubscribeFromConfigEvent(E,g);}v.destroyEvent.unsubscribe(f,v);v.itemAddedEvent.unsubscribe(e);v.focusEvent.unsubscribe(j);v.blurEvent.unsubscribe(i);}}},hideVisible:function(){var s;for(var t in r){if(H.hasOwnProperty(r,t)){s=r[t];if(!(s instanceof YAHOO.widget.MenuBar)&&s.cfg.getProperty(T)==P){s.hide();}}}},getVisible:function(){return r;},getMenus:function(){return c;},getMenu:function(t){var s;if(t in c){s=c[t];}return s;},getMenuItem:function(t){var s;if(t in d){s=d[t];}return s;},getMenuItemGroup:function(w){var t=C.get(w),s,y,x,u,v;if(t&&t.tagName&&t.tagName.toUpperCase()==W){y=t.firstChild;if(y){s=[];do{u=y.id;if(u){x=this.getMenuItem(u);if(x){s[s.length]=x;}}}while((y=y.nextSibling));if(s.length>0){v=s;}}}return v;},getFocusedMenuItem:function(){return k;},getFocusedMenu:function(){var s;if(k){s=k.parent.getRoot();}return s;},toString:function(){return Q;}};}();})();(function(){var AN=YAHOO.lang,Ao="Menu",H="DIV",K="div",Ak="id",AI="SELECT",f="xy",R="y",Av="UL",L="ul",AK="first-of-type",l="LI",i="OPTGROUP",Ax="OPTION",Af="disabled",AY="none",z="selected",Ar="groupindex",j="index",O="submenu",As="visible",AX="hidedelay",Ab="position",AE="dynamic",C="static",Al=AE+","+C,Y="windows",Q="url",M="#",V="target",AU="maxheight",T="topscrollbar",y="bottomscrollbar",e="_",P=T+e+Af,E=y+e+Af,c="mousemove",At="showdelay",d="submenuhidedelay",AG="iframe",x="constraintoviewport",A2="preventcontextoverlap",AP="submenualignment",a="autosubmenudisplay",AD="clicktohide",h="container",k="scrollincrement",Ah="minscrollheight",A0="classname",Ae="shadow",Ap="keepopen",Ay="hd",D="hastitle",q="context",v="",Ai="mousedown",Ac="keydown",Am="height",U="width",AR="px",Aw="effect",AF="monitorresize",AW="display",AV="block",J="visibility",AA="absolute",AT="zindex",m="yui-menu-body-scrolled",AL="&#32;",Az=" ",Ag="mouseover",G="mouseout",AS="itemAdded",o="itemRemoved",AM="hidden",t="yui-menu-shadow",AH=t+"-visible",n=t+Az+AH;YAHOO.widget.Menu=function(A4,A3){if(A3){this.parent=A3.parent;this.lazyLoad=A3.lazyLoad||A3.lazyload;this.itemData=A3.itemData||A3.itemdata;}YAHOO.widget.Menu.superclass.constructor.call(this,A4,A3);};function B(A4){var A3=false;if(AN.isString(A4)){A3=(Al.indexOf((A4.toLowerCase()))!=-1);}return A3;}var g=YAHOO.util.Dom,AB=YAHOO.util.Event,Au=YAHOO.widget.Module,AC=YAHOO.widget.Overlay,s=YAHOO.widget.Menu,A1=YAHOO.widget.MenuManager,F=YAHOO.util.CustomEvent,Aq=YAHOO.env.ua,An,Aa=[["mouseOverEvent",Ag],["mouseOutEvent",G],["mouseDownEvent",Ai],["mouseUpEvent","mouseup"],["clickEvent","click"],["keyPressEvent","keypress"],["keyDownEvent",Ac],["keyUpEvent","keyup"],["focusEvent","focus"],["blurEvent","blur"],["itemAddedEvent",AS],["itemRemovedEvent",o]],AZ={key:As,value:false,validator:AN.isBoolean},AQ={key:x,value:true,validator:AN.isBoolean,supercedes:[AG,"x",R,f]},AJ={key:A2,value:true,validator:AN.isBoolean,supercedes:[x]},S={key:Ab,value:AE,validator:B,supercedes:[As,AG]},A={key:AP,value:["tl","tr"]},u={key:a,value:true,validator:AN.isBoolean,suppressEvent:true},Z={key:At,value:250,validator:AN.isNumber,suppressEvent:true},r={key:AX,value:0,validator:AN.isNumber,suppressEvent:true},w={key:d,value:250,validator:AN.isNumber,suppressEvent:true},p={key:AD,value:true,validator:AN.isBoolean,suppressEvent:true},AO={key:h,suppressEvent:true},Ad={key:k,value:1,validator:AN.isNumber,supercedes:[AU],suppressEvent:true},N={key:Ah,value:90,validator:AN.isNumber,supercedes:[AU],suppressEvent:true},X={key:AU,value:0,validator:AN.isNumber,supercedes:[AG],suppressEvent:true},W={key:A0,value:null,validator:AN.isString,suppressEvent:true},b={key:Af,value:false,validator:AN.isBoolean,suppressEvent:true},I={key:Ae,value:true,validator:AN.isBoolean,suppressEvent:true,supercedes:[As]},Aj={key:Ap,value:false,validator:AN.isBoolean};
YAHOO.lang.extend(s,AC,{CSS_CLASS_NAME:"yuimenu",ITEM_TYPE:null,GROUP_TITLE_TAG_NAME:"h6",OFF_SCREEN_POSITION:"-999em",_bHideDelayEventHandlersAssigned:false,_bHandledMouseOverEvent:false,_bHandledMouseOutEvent:false,_aGroupTitleElements:null,_aItemGroups:null,_aListElements:null,_nCurrentMouseX:0,_bStopMouseEventHandlers:false,_sClassName:null,lazyLoad:false,itemData:null,activeItem:null,parent:null,srcElement:null,init:function(A5,A4){this._aItemGroups=[];this._aListElements=[];this._aGroupTitleElements=[];if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuItem;}var A3;if(AN.isString(A5)){A3=g.get(A5);}else{if(A5.tagName){A3=A5;}}if(A3&&A3.tagName){switch(A3.tagName.toUpperCase()){case H:this.srcElement=A3;if(!A3.id){A3.setAttribute(Ak,g.generateId());}s.superclass.init.call(this,A3);this.beforeInitEvent.fire(s);break;case AI:this.srcElement=A3;s.superclass.init.call(this,g.generateId());this.beforeInitEvent.fire(s);break;}}else{s.superclass.init.call(this,A5);this.beforeInitEvent.fire(s);}if(this.element){g.addClass(this.element,this.CSS_CLASS_NAME);this.initEvent.subscribe(this._onInit);this.beforeRenderEvent.subscribe(this._onBeforeRender);this.renderEvent.subscribe(this._onRender);this.beforeShowEvent.subscribe(this._onBeforeShow);this.hideEvent.subscribe(this._onHide);this.showEvent.subscribe(this._onShow);this.beforeHideEvent.subscribe(this._onBeforeHide);this.mouseOverEvent.subscribe(this._onMouseOver);this.mouseOutEvent.subscribe(this._onMouseOut);this.clickEvent.subscribe(this._onClick);this.keyDownEvent.subscribe(this._onKeyDown);this.keyPressEvent.subscribe(this._onKeyPress);this.blurEvent.subscribe(this._onBlur);if(Aq.gecko||Aq.webkit){this.cfg.subscribeToConfigEvent(R,this._onYChange);}if(A4){this.cfg.applyConfig(A4,true);}A1.addMenu(this);this.initEvent.fire(s);}},_initSubTree:function(){var A4=this.srcElement,A3,A6,A9,BA,A8,A7,A5;if(A4){A3=(A4.tagName&&A4.tagName.toUpperCase());if(A3==H){BA=this.body.firstChild;if(BA){A6=0;A9=this.GROUP_TITLE_TAG_NAME.toUpperCase();do{if(BA&&BA.tagName){switch(BA.tagName.toUpperCase()){case A9:this._aGroupTitleElements[A6]=BA;break;case Av:this._aListElements[A6]=BA;this._aItemGroups[A6]=[];A6++;break;}}}while((BA=BA.nextSibling));if(this._aListElements[0]){g.addClass(this._aListElements[0],AK);}}}BA=null;if(A3){switch(A3){case H:A8=this._aListElements;A7=A8.length;if(A7>0){A5=A7-1;do{BA=A8[A5].firstChild;if(BA){do{if(BA&&BA.tagName&&BA.tagName.toUpperCase()==l){this.addItem(new this.ITEM_TYPE(BA,{parent:this}),A5);}}while((BA=BA.nextSibling));}}while(A5--);}break;case AI:BA=A4.firstChild;do{if(BA&&BA.tagName){switch(BA.tagName.toUpperCase()){case i:case Ax:this.addItem(new this.ITEM_TYPE(BA,{parent:this}));break;}}}while((BA=BA.nextSibling));break;}}}},_getFirstEnabledItem:function(){var A3=this.getItems(),A7=A3.length,A6,A5;for(var A4=0;A4<A7;A4++){A6=A3[A4];if(A6&&!A6.cfg.getProperty(Af)&&A6.element.style.display!=AY){A5=A6;break;}}return A5;},_addItemToGroup:function(A8,A9,BD){var BB,BE,A6,BC,A7,A4,A5,BA;function A3(BF,BG){return(BF[BG]||A3(BF,(BG+1)));}if(A9 instanceof this.ITEM_TYPE){BB=A9;BB.parent=this;}else{if(AN.isString(A9)){BB=new this.ITEM_TYPE(A9,{parent:this});}else{if(AN.isObject(A9)){A9.parent=this;BB=new this.ITEM_TYPE(A9.text,A9);}}}if(BB){if(BB.cfg.getProperty(z)){this.activeItem=BB;}BE=AN.isNumber(A8)?A8:0;A6=this._getItemGroup(BE);if(!A6){A6=this._createItemGroup(BE);}if(AN.isNumber(BD)){A7=(BD>=A6.length);if(A6[BD]){A6.splice(BD,0,BB);}else{A6[BD]=BB;}BC=A6[BD];if(BC){if(A7&&(!BC.element.parentNode||BC.element.parentNode.nodeType==11)){this._aListElements[BE].appendChild(BC.element);}else{A4=A3(A6,(BD+1));if(A4&&(!BC.element.parentNode||BC.element.parentNode.nodeType==11)){this._aListElements[BE].insertBefore(BC.element,A4.element);}}BC.parent=this;this._subscribeToItemEvents(BC);this._configureSubmenu(BC);this._updateItemProperties(BE);this.itemAddedEvent.fire(BC);this.changeContentEvent.fire();BA=BC;}}else{A5=A6.length;A6[A5]=BB;BC=A6[A5];if(BC){if(!g.isAncestor(this._aListElements[BE],BC.element)){this._aListElements[BE].appendChild(BC.element);}BC.element.setAttribute(Ar,BE);BC.element.setAttribute(j,A5);BC.parent=this;BC.index=A5;BC.groupIndex=BE;this._subscribeToItemEvents(BC);this._configureSubmenu(BC);if(A5===0){g.addClass(BC.element,AK);}this.itemAddedEvent.fire(BC);this.changeContentEvent.fire();BA=BC;}}}return BA;},_removeItemFromGroupByIndex:function(A6,A4){var A5=AN.isNumber(A6)?A6:0,A7=this._getItemGroup(A5),A9,A8,A3;if(A7){A9=A7.splice(A4,1);A8=A9[0];if(A8){this._updateItemProperties(A5);if(A7.length===0){A3=this._aListElements[A5];if(this.body&&A3){this.body.removeChild(A3);}this._aItemGroups.splice(A5,1);this._aListElements.splice(A5,1);A3=this._aListElements[0];if(A3){g.addClass(A3,AK);}}this.itemRemovedEvent.fire(A8);this.changeContentEvent.fire();}}return A8;},_removeItemFromGroupByValue:function(A6,A3){var A8=this._getItemGroup(A6),A9,A7,A5,A4;if(A8){A9=A8.length;A7=-1;if(A9>0){A4=A9-1;do{if(A8[A4]==A3){A7=A4;break;}}while(A4--);if(A7>-1){A5=this._removeItemFromGroupByIndex(A6,A7);}}}return A5;},_updateItemProperties:function(A4){var A5=this._getItemGroup(A4),A8=A5.length,A7,A6,A3;if(A8>0){A3=A8-1;do{A7=A5[A3];if(A7){A6=A7.element;A7.index=A3;A7.groupIndex=A4;A6.setAttribute(Ar,A4);A6.setAttribute(j,A3);g.removeClass(A6,AK);}}while(A3--);if(A6){g.addClass(A6,AK);}}},_createItemGroup:function(A5){var A3,A4;if(!this._aItemGroups[A5]){this._aItemGroups[A5]=[];A3=document.createElement(L);this._aListElements[A5]=A3;A4=this._aItemGroups[A5];}return A4;},_getItemGroup:function(A5){var A3=AN.isNumber(A5)?A5:0,A6=this._aItemGroups,A4;if(A3 in A6){A4=A6[A3];}return A4;},_configureSubmenu:function(A3){var A4=A3.cfg.getProperty(O);if(A4){this.cfg.configChangedEvent.subscribe(this._onParentMenuConfigChange,A4,true);this.renderEvent.subscribe(this._onParentMenuRender,A4,true);}},_subscribeToItemEvents:function(A3){A3.destroyEvent.subscribe(this._onMenuItemDestroy,A3,this);A3.cfg.configChangedEvent.subscribe(this._onMenuItemConfigChange,A3,this);
},_onVisibleChange:function(A5,A4){var A3=A4[0];if(A3){g.addClass(this.element,As);}else{g.removeClass(this.element,As);}},_cancelHideDelay:function(){var A3=this.getRoot()._hideDelayTimer;if(A3){A3.cancel();}},_execHideDelay:function(){this._cancelHideDelay();var A3=this.getRoot();A3._hideDelayTimer=AN.later(A3.cfg.getProperty(AX),this,function(){if(A3.activeItem){if(A3.hasFocus()){A3.activeItem.focus();}A3.clearActiveItem();}if(A3==this&&!(this instanceof YAHOO.widget.MenuBar)&&this.cfg.getProperty(Ab)==AE){this.hide();}});},_cancelShowDelay:function(){var A3=this.getRoot()._showDelayTimer;if(A3){A3.cancel();}},_execSubmenuHideDelay:function(A5,A4,A3){A5._submenuHideDelayTimer=AN.later(50,this,function(){if(this._nCurrentMouseX>(A4+10)){A5._submenuHideDelayTimer=AN.later(A3,A5,function(){this.hide();});}else{A5.hide();}});},_disableScrollHeader:function(){if(!this._bHeaderDisabled){g.addClass(this.header,P);this._bHeaderDisabled=true;}},_disableScrollFooter:function(){if(!this._bFooterDisabled){g.addClass(this.footer,E);this._bFooterDisabled=true;}},_enableScrollHeader:function(){if(this._bHeaderDisabled){g.removeClass(this.header,P);this._bHeaderDisabled=false;}},_enableScrollFooter:function(){if(this._bFooterDisabled){g.removeClass(this.footer,E);this._bFooterDisabled=false;}},_onMouseOver:function(BF,A8){var BG=A8[0],BC=A8[1],A3=AB.getTarget(BG),A7=this.getRoot(),BE=this._submenuHideDelayTimer,A4,A6,BB,A5,BA,A9;var BD=function(){if(this.parent.cfg.getProperty(z)){this.show();}};if(!this._bStopMouseEventHandlers){if(!this._bHandledMouseOverEvent&&(A3==this.element||g.isAncestor(this.element,A3))){this._nCurrentMouseX=0;AB.on(this.element,c,this._onMouseMove,this,true);if(!(BC&&g.isAncestor(BC.element,AB.getRelatedTarget(BG)))){this.clearActiveItem();}if(this.parent&&BE){BE.cancel();this.parent.cfg.setProperty(z,true);A4=this.parent.parent;A4._bHandledMouseOutEvent=true;A4._bHandledMouseOverEvent=false;}this._bHandledMouseOverEvent=true;this._bHandledMouseOutEvent=false;}if(BC&&!BC.handledMouseOverEvent&&!BC.cfg.getProperty(Af)&&(A3==BC.element||g.isAncestor(BC.element,A3))){A6=this.cfg.getProperty(At);BB=(A6>0);if(BB){this._cancelShowDelay();}A5=this.activeItem;if(A5){A5.cfg.setProperty(z,false);}BA=BC.cfg;BA.setProperty(z,true);if(this.hasFocus()||A7._hasFocus){BC.focus();A7._hasFocus=false;}if(this.cfg.getProperty(a)){A9=BA.getProperty(O);if(A9){if(BB){A7._showDelayTimer=AN.later(A7.cfg.getProperty(At),A9,BD);}else{A9.show();}}}BC.handledMouseOverEvent=true;BC.handledMouseOutEvent=false;}}},_onMouseOut:function(BB,A5){var BC=A5[0],A9=A5[1],A6=AB.getRelatedTarget(BC),BA=false,A8,A7,A3,A4;if(!this._bStopMouseEventHandlers){if(A9&&!A9.cfg.getProperty(Af)){A8=A9.cfg;A7=A8.getProperty(O);if(A7&&(A6==A7.element||g.isAncestor(A7.element,A6))){BA=true;}if(!A9.handledMouseOutEvent&&((A6!=A9.element&&!g.isAncestor(A9.element,A6))||BA)){if(!BA){A9.cfg.setProperty(z,false);if(A7){A3=this.cfg.getProperty(d);A4=this.cfg.getProperty(At);if(!(this instanceof YAHOO.widget.MenuBar)&&A3>0&&A4>=A3){this._execSubmenuHideDelay(A7,AB.getPageX(BC),A3);}else{A7.hide();}}}A9.handledMouseOutEvent=true;A9.handledMouseOverEvent=false;}}if(!this._bHandledMouseOutEvent&&((A6!=this.element&&!g.isAncestor(this.element,A6))||BA)){AB.removeListener(this.element,c,this._onMouseMove);this._nCurrentMouseX=AB.getPageX(BC);this._bHandledMouseOutEvent=true;this._bHandledMouseOverEvent=false;}}},_onMouseMove:function(A4,A3){if(!this._bStopMouseEventHandlers){this._nCurrentMouseX=AB.getPageX(A4);}},_onClick:function(BD,A5){var BE=A5[0],A9=A5[1],BB=false,A7,A4,A3,A8,BA,BC;var A6=function(){if(!((Aq.gecko&&this.platform==Y)&&BE.button>0)){A4=this.getRoot();if(A4 instanceof YAHOO.widget.MenuBar||A4.cfg.getProperty(Ab)==C){A4.clearActiveItem();}else{A4.hide();}}};if(A9){if(A9.cfg.getProperty(Af)){AB.preventDefault(BE);A6.call(this);}else{A7=A9.cfg.getProperty(O);A8=A9.cfg.getProperty(Q);if(A8){BA=A8.indexOf(M);BC=A8.length;if(BA!=-1){A8=A8.substr(BA,BC);BC=A8.length;if(BC>1){A3=A8.substr(1,BC);BB=g.isAncestor(this.element,A3);}else{if(BC===1){BB=true;}}}}if(BB&&!A9.cfg.getProperty(V)){AB.preventDefault(BE);if(Aq.webkit){A9.focus();}else{A9.focusEvent.fire();}}if(!A7&&!this.cfg.getProperty(Ap)){A6.call(this);}}}},_onKeyDown:function(BH,BB){var BE=BB[0],BD=BB[1],BA,BF,A4,A8,BI,A3,BK,A7,BG,A6,BC,BJ,A9;function A5(){this._bStopMouseEventHandlers=true;AN.later(10,this,function(){this._bStopMouseEventHandlers=false;});}if(BD&&!BD.cfg.getProperty(Af)){BF=BD.cfg;A4=this.parent;switch(BE.keyCode){case 38:case 40:BI=(BE.keyCode==38)?BD.getPreviousEnabledSibling():BD.getNextEnabledSibling();if(BI){this.clearActiveItem();BI.cfg.setProperty(z,true);BI.focus();if(this.cfg.getProperty(AU)>0){A3=this.body;BK=A3.scrollTop;A7=A3.offsetHeight;BG=this.getItems();A6=BG.length-1;BC=BI.element.offsetTop;if(BE.keyCode==40){if(BC>=(A7+BK)){A3.scrollTop=BC-A7;}else{if(BC<=BK){A3.scrollTop=0;}}if(BI==BG[A6]){A3.scrollTop=BI.element.offsetTop;}}else{if(BC<=BK){A3.scrollTop=BC-BI.element.offsetHeight;}else{if(BC>=(BK+A7)){A3.scrollTop=BC;}}if(BI==BG[0]){A3.scrollTop=0;}}BK=A3.scrollTop;BJ=A3.scrollHeight-A3.offsetHeight;if(BK===0){this._disableScrollHeader();this._enableScrollFooter();}else{if(BK==BJ){this._enableScrollHeader();this._disableScrollFooter();}else{this._enableScrollHeader();this._enableScrollFooter();}}}}AB.preventDefault(BE);A5();break;case 39:BA=BF.getProperty(O);if(BA){if(!BF.getProperty(z)){BF.setProperty(z,true);}BA.show();BA.setInitialFocus();BA.setInitialSelection();}else{A8=this.getRoot();if(A8 instanceof YAHOO.widget.MenuBar){BI=A8.activeItem.getNextEnabledSibling();if(BI){A8.clearActiveItem();BI.cfg.setProperty(z,true);BA=BI.cfg.getProperty(O);if(BA){BA.show();BA.setInitialFocus();}else{BI.focus();}}}}AB.preventDefault(BE);A5();break;case 37:if(A4){A9=A4.parent;if(A9 instanceof YAHOO.widget.MenuBar){BI=A9.activeItem.getPreviousEnabledSibling();if(BI){A9.clearActiveItem();BI.cfg.setProperty(z,true);BA=BI.cfg.getProperty(O);if(BA){BA.show();
BA.setInitialFocus();}else{BI.focus();}}}else{this.hide();A4.focus();}}AB.preventDefault(BE);A5();break;}}if(BE.keyCode==27){if(this.cfg.getProperty(Ab)==AE){this.hide();if(this.parent){this.parent.focus();}}else{if(this.activeItem){BA=this.activeItem.cfg.getProperty(O);if(BA&&BA.cfg.getProperty(As)){BA.hide();this.activeItem.focus();}else{this.activeItem.blur();this.activeItem.cfg.setProperty(z,false);}}}AB.preventDefault(BE);}},_onKeyPress:function(A5,A4){var A3=A4[0];if(A3.keyCode==40||A3.keyCode==38){AB.preventDefault(A3);}},_onBlur:function(A4,A3){if(this._hasFocus){this._hasFocus=false;}},_onYChange:function(A4,A3){var A6=this.parent,A8,A5,A7;if(A6){A8=A6.parent.body.scrollTop;if(A8>0){A7=(this.cfg.getProperty(R)-A8);g.setY(this.element,A7);A5=this.iframe;if(A5){g.setY(A5,A7);}this.cfg.setProperty(R,A7,true);}}},_onScrollTargetMouseOver:function(A9,BC){var BB=this._bodyScrollTimer;if(BB){BB.cancel();}this._cancelHideDelay();var A5=AB.getTarget(A9),A7=this.body,A6=this.cfg.getProperty(k),A3,A4;function BA(){var BD=A7.scrollTop;if(BD<A3){A7.scrollTop=(BD+A6);this._enableScrollHeader();}else{A7.scrollTop=A3;this._bodyScrollTimer.cancel();this._disableScrollFooter();}}function A8(){var BD=A7.scrollTop;if(BD>0){A7.scrollTop=(BD-A6);this._enableScrollFooter();}else{A7.scrollTop=0;this._bodyScrollTimer.cancel();this._disableScrollHeader();}}if(g.hasClass(A5,Ay)){A4=A8;}else{A3=A7.scrollHeight-A7.offsetHeight;A4=BA;}this._bodyScrollTimer=AN.later(10,this,A4,null,true);},_onScrollTargetMouseOut:function(A5,A3){var A4=this._bodyScrollTimer;if(A4){A4.cancel();}this._cancelHideDelay();},_onInit:function(A4,A3){this.cfg.subscribeToConfigEvent(As,this._onVisibleChange);var A5=!this.parent,A6=this.lazyLoad;if(((A5&&!A6)||(A5&&(this.cfg.getProperty(As)||this.cfg.getProperty(Ab)==C))||(!A5&&!A6))&&this.getItemGroups().length===0){if(this.srcElement){this._initSubTree();}if(this.itemData){this.addItems(this.itemData);}}else{if(A6){this.cfg.fireQueue();}}},_onBeforeRender:function(A6,A5){var A7=this.element,BA=this._aListElements.length,A4=true,A9=0,A3,A8;if(BA>0){do{A3=this._aListElements[A9];if(A3){if(A4){g.addClass(A3,AK);A4=false;}if(!g.isAncestor(A7,A3)){this.appendToBody(A3);}A8=this._aGroupTitleElements[A9];if(A8){if(!g.isAncestor(A7,A8)){A3.parentNode.insertBefore(A8,A3);}g.addClass(A3,D);}}A9++;}while(A9<BA);}},_onRender:function(A4,A3){if(this.cfg.getProperty(Ab)==AE){if(!this.cfg.getProperty(As)){this.positionOffScreen();}}},_onBeforeShow:function(A5,A4){var A7,BA,A6,A8=this.cfg.getProperty(h);if(this.lazyLoad&&this.getItemGroups().length===0){if(this.srcElement){this._initSubTree();}if(this.itemData){if(this.parent&&this.parent.parent&&this.parent.parent.srcElement&&this.parent.parent.srcElement.tagName.toUpperCase()==AI){A7=this.itemData.length;for(BA=0;BA<A7;BA++){if(this.itemData[BA].tagName){this.addItem((new this.ITEM_TYPE(this.itemData[BA])));}}}else{this.addItems(this.itemData);}}A6=this.srcElement;if(A6){if(A6.tagName.toUpperCase()==AI){if(g.inDocument(A6)){this.render(A6.parentNode);}else{this.render(A8);}}else{this.render();}}else{if(this.parent){this.render(this.parent.element);}else{this.render(A8);}}}var A9=this.parent,A3;if(!A9&&this.cfg.getProperty(Ab)==AE){this.cfg.refireEvent(f);}if(A9){A3=A9.parent.cfg.getProperty(AP);this.cfg.setProperty(q,[A9.element,A3[0],A3[1]]);this.align();}},getConstrainedY:function(BF){var BQ=this,BM=BQ.cfg.getProperty(q),BT=BQ.cfg.getProperty(AU),BP,BE={"trbr":true,"tlbl":true,"bltl":true,"brtr":true},A8=(BM&&BE[BM[1]+BM[2]]),BA=BQ.element,BU=BA.offsetHeight,BO=AC.VIEWPORT_OFFSET,BJ=g.getViewportHeight(),BN=g.getDocumentScrollTop(),BK=(BQ.cfg.getProperty(Ah)+BO<BJ),BS,BB,BH,BI,BD=false,BC,A5,BG,A7,A3=BF;var A9=function(){var BV;if((BQ.cfg.getProperty(R)-BN)>BH){BV=(BH-BU);}else{BV=(BH+BI);}BQ.cfg.setProperty(R,(BV+BN),true);return BV;};var A6=function(){if((BQ.cfg.getProperty(R)-BN)>BH){return(A5-BO);}else{return(BC-BO);}};var BL=function(){var BV;if((BQ.cfg.getProperty(R)-BN)>BH){BV=(BH+BI);}else{BV=(BH-BA.offsetHeight);}BQ.cfg.setProperty(R,(BV+BN),true);};var A4=function(){BQ._setScrollHeight(this.cfg.getProperty(AU));BQ.hideEvent.unsubscribe(A4);};var BR=function(){var BZ=A6(),BV=(BQ.getItems().length>0),BY,BX,BW;if(BU>BZ){BY=BV?BQ.cfg.getProperty(Ah):BU;if((BZ>BY)&&BV){BP=BZ;}else{BP=BT;}BQ._setScrollHeight(BP);BQ.hideEvent.subscribe(A4);BL();if(BZ<BY){if(BD){A9();}else{A9();BD=true;BX=BR();}}}else{if(BP&&(BP!=BT)){BQ._setScrollHeight(BT);BQ.hideEvent.subscribe(A4);BL();}}return BX;};if(BQ.cfg.getProperty(A2)&&A8){if(BK){BB=BM[0];BI=BB.offsetHeight;BH=(g.getY(BB)-BN);BC=BH;A5=(BJ-(BH+BI));BR();}A3=BQ.cfg.getProperty(R);}else{if(!(BQ instanceof YAHOO.widget.MenuBar)&&BU>=BJ){BS=(BJ-(BO*2));if(BS>BQ.cfg.getProperty(Ah)){BQ._setScrollHeight(BS);BQ.hideEvent.subscribe(A4);BL();A3=BQ.cfg.getProperty(R);}}else{if(BK){BG=BN+BO;A7=BN+BJ-BU-BO;if(BF<BG){A3=BG;}else{if(BF>A7){A3=A7;}}}else{A3=BO+BN;}}}return A3;},_onHide:function(A4,A3){if(this.cfg.getProperty(Ab)===AE){this.positionOffScreen();}},_onShow:function(BB,A9){var A3=this.parent,A5,A6,A8,A4;function A7(BD){var BC;if(BD.type==Ai||(BD.type==Ac&&BD.keyCode==27)){BC=AB.getTarget(BD);if(BC!=A5.element||!g.isAncestor(A5.element,BC)){A5.cfg.setProperty(a,false);AB.removeListener(document,Ai,A7);AB.removeListener(document,Ac,A7);}}}function BA(BD,BC,BE){this.cfg.setProperty(U,v);this.hideEvent.unsubscribe(BA,BE);}if(A3){A5=A3.parent;if(!A5.cfg.getProperty(a)&&(A5 instanceof YAHOO.widget.MenuBar||A5.cfg.getProperty(Ab)==C)){A5.cfg.setProperty(a,true);AB.on(document,Ai,A7);AB.on(document,Ac,A7);}if((this.cfg.getProperty("x")<A5.cfg.getProperty("x"))&&(Aq.gecko<1.9)&&!this.cfg.getProperty(U)){A6=this.element;A8=A6.offsetWidth;A6.style.width=A8+AR;A4=(A8-(A6.offsetWidth-A8))+AR;this.cfg.setProperty(U,A4);this.hideEvent.subscribe(BA,A4);}}},_onBeforeHide:function(A5,A4){var A3=this.activeItem,A7=this.getRoot(),A8,A6;if(A3){A8=A3.cfg;A8.setProperty(z,false);A6=A8.getProperty(O);if(A6){A6.hide();}}if(Aq.ie&&this.cfg.getProperty(Ab)===AE&&this.parent){A7._hasFocus=this.hasFocus();
}if(A7==this){A7.blur();}},_onParentMenuConfigChange:function(A4,A3,A7){var A5=A3[0][0],A6=A3[0][1];switch(A5){case AG:case x:case AX:case At:case d:case AD:case Aw:case A0:case k:case Ah:case AF:case Ae:case A2:A7.cfg.setProperty(A5,A6);break;case AP:if(!(this.parent.parent instanceof YAHOO.widget.MenuBar)){A7.cfg.setProperty(A5,A6);}break;}},_onParentMenuRender:function(A4,A3,A9){var A6=A9.parent.parent,A5=A6.cfg,A7={constraintoviewport:A5.getProperty(x),xy:[0,0],clicktohide:A5.getProperty(AD),effect:A5.getProperty(Aw),showdelay:A5.getProperty(At),hidedelay:A5.getProperty(AX),submenuhidedelay:A5.getProperty(d),classname:A5.getProperty(A0),scrollincrement:A5.getProperty(k),minscrollheight:A5.getProperty(Ah),iframe:A5.getProperty(AG),shadow:A5.getProperty(Ae),preventcontextoverlap:A5.getProperty(A2),monitorresize:A5.getProperty(AF)},A8;if(!(A6 instanceof YAHOO.widget.MenuBar)){A7[AP]=A5.getProperty(AP);}A9.cfg.applyConfig(A7);if(!this.lazyLoad){A8=this.parent.element;if(this.element.parentNode==A8){this.render();}else{this.render(A8);}}},_onMenuItemDestroy:function(A5,A4,A3){this._removeItemFromGroupByValue(A3.groupIndex,A3);},_onMenuItemConfigChange:function(A5,A4,A3){var A7=A4[0][0],A8=A4[0][1],A6;switch(A7){case z:if(A8===true){this.activeItem=A3;}break;case O:A6=A4[0][1];if(A6){this._configureSubmenu(A3);}break;}},configVisible:function(A5,A4,A6){var A3,A7;if(this.cfg.getProperty(Ab)==AE){s.superclass.configVisible.call(this,A5,A4,A6);}else{A3=A4[0];A7=g.getStyle(this.element,AW);g.setStyle(this.element,J,As);if(A3){if(A7!=AV){this.beforeShowEvent.fire();g.setStyle(this.element,AW,AV);this.showEvent.fire();}}else{if(A7==AV){this.beforeHideEvent.fire();g.setStyle(this.element,AW,AY);this.hideEvent.fire();}}}},configPosition:function(A5,A4,A8){var A7=this.element,A6=A4[0]==C?C:AA,A9=this.cfg,A3;g.setStyle(A7,Ab,A6);if(A6==C){g.setStyle(A7,AW,AV);A9.setProperty(As,true);}else{g.setStyle(A7,J,AM);}if(A6==AA){A3=A9.getProperty(AT);if(!A3||A3===0){A9.setProperty(AT,1);}}},configIframe:function(A4,A3,A5){if(this.cfg.getProperty(Ab)==AE){s.superclass.configIframe.call(this,A4,A3,A5);}},configHideDelay:function(A4,A3,A7){var A9=A3[0],A8=this.mouseOutEvent,A5=this.mouseOverEvent,A6=this.keyDownEvent;if(A9>0){if(!this._bHideDelayEventHandlersAssigned){A8.subscribe(this._execHideDelay);A5.subscribe(this._cancelHideDelay);A6.subscribe(this._cancelHideDelay);this._bHideDelayEventHandlersAssigned=true;}}else{A8.unsubscribe(this._execHideDelay);A5.unsubscribe(this._cancelHideDelay);A6.unsubscribe(this._cancelHideDelay);this._bHideDelayEventHandlersAssigned=false;}},configContainer:function(A4,A3,A6){var A5=A3[0];if(AN.isString(A5)){this.cfg.setProperty(h,g.get(A5),true);}},_clearSetWidthFlag:function(){this._widthSetForScroll=false;this.cfg.unsubscribeFromConfigEvent(U,this._clearSetWidthFlag);},_setScrollHeight:function(BF){var BB=BF,BA=false,BG=false,A7,A8,BE,A5,A4,BD,BH,A3,BC,A9,A6;if(this.getItems().length>0){A7=this.element;A8=this.body;BE=this.header;A5=this.footer;BD=this._onScrollTargetMouseOver;BH=this._onScrollTargetMouseOut;A3=this.cfg.getProperty(Ah);A4=this.parent;if(BB>0&&BB<A3){BB=A3;}g.setStyle(A8,Am,v);g.removeClass(A8,m);A8.scrollTop=0;BG=((Aq.gecko&&A4&&A4.parent&&A4.parent.cfg.getProperty(Ab)==AE)||Aq.ie);if(BB>0&&BG&&!this.cfg.getProperty(U)){A9=A7.offsetWidth;A7.style.width=A9+AR;A6=(A9-(A7.offsetWidth-A9))+AR;this.cfg.unsubscribeFromConfigEvent(U,this._clearSetWidthFlag);this.cfg.setProperty(U,A6);this._widthSetForScroll=true;this.cfg.subscribeToConfigEvent(U,this._clearSetWidthFlag);}if(BB>0&&(!BE&&!A5)){this.setHeader(AL);this.setFooter(AL);BE=this.header;A5=this.footer;g.addClass(BE,T);g.addClass(A5,y);A7.insertBefore(BE,A8);A7.appendChild(A5);}BC=BB;if(BE&&A5){BC=(BC-(BE.offsetHeight+A5.offsetHeight));}if((BC>0)&&(A8.offsetHeight>BB)){g.addClass(A8,m);g.setStyle(A8,Am,(BC+AR));if(!this._hasScrollEventHandlers){AB.on(BE,Ag,BD,this,true);AB.on(BE,G,BH,this,true);AB.on(A5,Ag,BD,this,true);AB.on(A5,G,BH,this,true);this._hasScrollEventHandlers=true;}this._disableScrollHeader();this._enableScrollFooter();BA=true;}else{if(BE&&A5){if(this._widthSetForScroll){this._widthSetForScroll=false;this.cfg.unsubscribeFromConfigEvent(U,this._clearSetWidthFlag);this.cfg.setProperty(U,v);}this._enableScrollHeader();this._enableScrollFooter();if(this._hasScrollEventHandlers){AB.removeListener(BE,Ag,BD);AB.removeListener(BE,G,BH);AB.removeListener(A5,Ag,BD);AB.removeListener(A5,G,BH);this._hasScrollEventHandlers=false;}A7.removeChild(BE);A7.removeChild(A5);this.header=null;this.footer=null;BA=true;}}if(BA){this.cfg.refireEvent(AG);this.cfg.refireEvent(Ae);}}},_setMaxHeight:function(A4,A3,A5){this._setScrollHeight(A5);this.renderEvent.unsubscribe(this._setMaxHeight);},configMaxHeight:function(A4,A3,A5){var A6=A3[0];if(this.lazyLoad&&!this.body&&A6>0){this.renderEvent.subscribe(this._setMaxHeight,A6,this);}else{this._setScrollHeight(A6);}},configClassName:function(A5,A4,A6){var A3=A4[0];if(this._sClassName){g.removeClass(this.element,this._sClassName);}g.addClass(this.element,A3);this._sClassName=A3;},_onItemAdded:function(A4,A3){var A5=A3[0];if(A5){A5.cfg.setProperty(Af,true);}},configDisabled:function(A5,A4,A8){var A7=A4[0],A3=this.getItems(),A9,A6;if(AN.isArray(A3)){A9=A3.length;if(A9>0){A6=A9-1;do{A3[A6].cfg.setProperty(Af,A7);}while(A6--);}if(A7){this.clearActiveItem(true);g.addClass(this.element,Af);this.itemAddedEvent.subscribe(this._onItemAdded);}else{g.removeClass(this.element,Af);this.itemAddedEvent.unsubscribe(this._onItemAdded);}}},configShadow:function(BB,A5,BA){var A9=function(){var BE=this.element,BD=this._shadow;if(BD&&BE){if(BD.style.width&&BD.style.height){BD.style.width=v;BD.style.height=v;}BD.style.width=(BE.offsetWidth+6)+AR;BD.style.height=(BE.offsetHeight+1)+AR;}};var BC=function(){this.element.appendChild(this._shadow);};var A7=function(){g.addClass(this._shadow,AH);};var A8=function(){g.removeClass(this._shadow,AH);};var A4=function(){var BE=this._shadow,BD;if(!BE){BD=this.element;
if(!An){An=document.createElement(K);An.className=n;}BE=An.cloneNode(false);BD.appendChild(BE);this._shadow=BE;this.beforeShowEvent.subscribe(A7);this.beforeHideEvent.subscribe(A8);if(Aq.ie){AN.later(0,this,function(){A9.call(this);this.syncIframe();});this.cfg.subscribeToConfigEvent(U,A9);this.cfg.subscribeToConfigEvent(Am,A9);this.cfg.subscribeToConfigEvent(AU,A9);this.changeContentEvent.subscribe(A9);Au.textResizeEvent.subscribe(A9,this,true);this.destroyEvent.subscribe(function(){Au.textResizeEvent.unsubscribe(A9,this);});}this.cfg.subscribeToConfigEvent(AU,BC);}};var A6=function(){if(this._shadow){BC.call(this);if(Aq.ie){A9.call(this);}}else{A4.call(this);}this.beforeShowEvent.unsubscribe(A6);};var A3=A5[0];if(A3&&this.cfg.getProperty(Ab)==AE){if(this.cfg.getProperty(As)){if(this._shadow){BC.call(this);if(Aq.ie){A9.call(this);}}else{A4.call(this);}}else{this.beforeShowEvent.subscribe(A6);}}},initEvents:function(){s.superclass.initEvents.call(this);var A4=Aa.length-1,A5,A3;do{A5=Aa[A4];A3=this.createEvent(A5[1]);A3.signature=F.LIST;this[A5[0]]=A3;}while(A4--);},positionOffScreen:function(){var A4=this.iframe,A5=this.element,A3=this.OFF_SCREEN_POSITION;A5.style.top=v;A5.style.left=v;if(A4){A4.style.top=A3;A4.style.left=A3;}},getRoot:function(){var A5=this.parent,A4,A3;if(A5){A4=A5.parent;A3=A4?A4.getRoot():this;}else{A3=this;}return A3;},toString:function(){var A4=Ao,A3=this.id;if(A3){A4+=(Az+A3);}return A4;},setItemGroupTitle:function(A8,A7){var A6,A5,A4,A3;if(AN.isString(A8)&&A8.length>0){A6=AN.isNumber(A7)?A7:0;A5=this._aGroupTitleElements[A6];if(A5){A5.innerHTML=A8;}else{A5=document.createElement(this.GROUP_TITLE_TAG_NAME);A5.innerHTML=A8;this._aGroupTitleElements[A6]=A5;}A4=this._aGroupTitleElements.length-1;do{if(this._aGroupTitleElements[A4]){g.removeClass(this._aGroupTitleElements[A4],AK);A3=A4;}}while(A4--);if(A3!==null){g.addClass(this._aGroupTitleElements[A3],AK);}this.changeContentEvent.fire();}},addItem:function(A3,A4){return this._addItemToGroup(A4,A3);},addItems:function(A7,A6){var A9,A3,A8,A4,A5;if(AN.isArray(A7)){A9=A7.length;A3=[];for(A4=0;A4<A9;A4++){A8=A7[A4];if(A8){if(AN.isArray(A8)){A3[A3.length]=this.addItems(A8,A4);}else{A3[A3.length]=this._addItemToGroup(A6,A8);}}}if(A3.length){A5=A3;}}return A5;},insertItem:function(A3,A4,A5){return this._addItemToGroup(A5,A3,A4);},removeItem:function(A3,A5){var A6,A4;if(!AN.isUndefined(A3)){if(A3 instanceof YAHOO.widget.MenuItem){A6=this._removeItemFromGroupByValue(A5,A3);}else{if(AN.isNumber(A3)){A6=this._removeItemFromGroupByIndex(A5,A3);}}if(A6){A6.destroy();A4=A6;}}return A4;},getItems:function(){var A6=this._aItemGroups,A4,A5,A3=[];if(AN.isArray(A6)){A4=A6.length;A5=((A4==1)?A6[0]:(Array.prototype.concat.apply(A3,A6)));}return A5;},getItemGroups:function(){return this._aItemGroups;},getItem:function(A4,A5){var A6,A3;if(AN.isNumber(A4)){A6=this._getItemGroup(A5);if(A6){A3=A6[A4];}}return A3;},getSubmenus:function(){var A4=this.getItems(),A8=A4.length,A3,A5,A7,A6;if(A8>0){A3=[];for(A6=0;A6<A8;A6++){A7=A4[A6];if(A7){A5=A7.cfg.getProperty(O);if(A5){A3[A3.length]=A5;}}}}return A3;},clearContent:function(){var A7=this.getItems(),A4=A7.length,A5=this.element,A6=this.body,BB=this.header,A3=this.footer,BA,A9,A8;if(A4>0){A8=A4-1;do{BA=A7[A8];if(BA){A9=BA.cfg.getProperty(O);if(A9){this.cfg.configChangedEvent.unsubscribe(this._onParentMenuConfigChange,A9);this.renderEvent.unsubscribe(this._onParentMenuRender,A9);}this.removeItem(BA,BA.groupIndex);}}while(A8--);}if(BB){AB.purgeElement(BB);A5.removeChild(BB);}if(A3){AB.purgeElement(A3);A5.removeChild(A3);}if(A6){AB.purgeElement(A6);A6.innerHTML=v;}this.activeItem=null;this._aItemGroups=[];this._aListElements=[];this._aGroupTitleElements=[];this.cfg.setProperty(U,null);},destroy:function(){this.clearContent();this._aItemGroups=null;this._aListElements=null;this._aGroupTitleElements=null;s.superclass.destroy.call(this);},setInitialFocus:function(){var A3=this._getFirstEnabledItem();if(A3){A3.focus();}},setInitialSelection:function(){var A3=this._getFirstEnabledItem();if(A3){A3.cfg.setProperty(z,true);}},clearActiveItem:function(A5){if(this.cfg.getProperty(At)>0){this._cancelShowDelay();}var A3=this.activeItem,A6,A4;if(A3){A6=A3.cfg;if(A5){A3.blur();this.getRoot()._hasFocus=true;}A6.setProperty(z,false);A4=A6.getProperty(O);if(A4){A4.hide();}this.activeItem=null;}},focus:function(){if(!this.hasFocus()){this.setInitialFocus();}},blur:function(){var A3;if(this.hasFocus()){A3=A1.getFocusedMenuItem();if(A3){A3.blur();}}},hasFocus:function(){return(A1.getFocusedMenu()==this.getRoot());},subscribe:function(){function A6(BB,BA,BD){var BE=BA[0],BC=BE.cfg.getProperty(O);if(BC){BC.subscribe.apply(BC,BD);}}function A9(BB,BA,BD){var BC=this.cfg.getProperty(O);if(BC){BC.subscribe.apply(BC,BD);}}s.superclass.subscribe.apply(this,arguments);s.superclass.subscribe.call(this,AS,A6,arguments);var A3=this.getItems(),A8,A7,A4,A5;if(A3){A8=A3.length;if(A8>0){A5=A8-1;do{A7=A3[A5];A4=A7.cfg.getProperty(O);if(A4){A4.subscribe.apply(A4,arguments);}else{A7.cfg.subscribeToConfigEvent(O,A9,arguments);}}while(A5--);}}},initDefaultConfig:function(){s.superclass.initDefaultConfig.call(this);var A3=this.cfg;A3.addProperty(AZ.key,{handler:this.configVisible,value:AZ.value,validator:AZ.validator});A3.addProperty(AQ.key,{handler:this.configConstrainToViewport,value:AQ.value,validator:AQ.validator,supercedes:AQ.supercedes});A3.addProperty(AJ.key,{value:AJ.value,validator:AJ.validator,supercedes:AJ.supercedes});A3.addProperty(S.key,{handler:this.configPosition,value:S.value,validator:S.validator,supercedes:S.supercedes});A3.addProperty(A.key,{value:A.value,suppressEvent:A.suppressEvent});A3.addProperty(u.key,{value:u.value,validator:u.validator,suppressEvent:u.suppressEvent});A3.addProperty(Z.key,{value:Z.value,validator:Z.validator,suppressEvent:Z.suppressEvent});A3.addProperty(r.key,{handler:this.configHideDelay,value:r.value,validator:r.validator,suppressEvent:r.suppressEvent});A3.addProperty(w.key,{value:w.value,validator:w.validator,suppressEvent:w.suppressEvent});
A3.addProperty(p.key,{value:p.value,validator:p.validator,suppressEvent:p.suppressEvent});A3.addProperty(AO.key,{handler:this.configContainer,value:document.body,suppressEvent:AO.suppressEvent});A3.addProperty(Ad.key,{value:Ad.value,validator:Ad.validator,supercedes:Ad.supercedes,suppressEvent:Ad.suppressEvent});A3.addProperty(N.key,{value:N.value,validator:N.validator,supercedes:N.supercedes,suppressEvent:N.suppressEvent});A3.addProperty(X.key,{handler:this.configMaxHeight,value:X.value,validator:X.validator,suppressEvent:X.suppressEvent,supercedes:X.supercedes});A3.addProperty(W.key,{handler:this.configClassName,value:W.value,validator:W.validator,supercedes:W.supercedes});A3.addProperty(b.key,{handler:this.configDisabled,value:b.value,validator:b.validator,suppressEvent:b.suppressEvent});A3.addProperty(I.key,{handler:this.configShadow,value:I.value,validator:I.validator});A3.addProperty(Aj.key,{value:Aj.value,validator:Aj.validator});}});})();(function(){YAHOO.widget.MenuItem=function(AO,AN){if(AO){if(AN){this.parent=AN.parent;this.value=AN.value;this.id=AN.id;}this.init(AO,AN);}};var v=YAHOO.util.Dom,h=YAHOO.widget.Module,x=YAHOO.widget.Menu,a=YAHOO.widget.MenuItem,AG=YAHOO.util.CustomEvent,i=YAHOO.env.ua,AM=YAHOO.lang,AH="text",M="#",O="-",K="helptext",l="url",AD="target",A="emphasis",L="strongemphasis",Z="checked",u="submenu",G="disabled",B="selected",N="hassubmenu",S="checked-disabled",AE="hassubmenu-disabled",z="hassubmenu-selected",R="checked-selected",o="onclick",I="classname",AF="",g="OPTION",t="OPTGROUP",J="LI",Q="li",AA="href",AB='<a href="#"></a>',p="SELECT",V="DIV",AJ='<em class="helptext">',Y="<em>",H="</em>",U="<strong>",w="</strong>",W="preventcontextoverlap",f="obj",AC="scope",r="none",T="visible",D=" ",k="MenuItem",n=[["mouseOverEvent","mouseover"],["mouseOutEvent","mouseout"],["mouseDownEvent","mousedown"],["mouseUpEvent","mouseup"],["clickEvent","click"],["keyPressEvent","keypress"],["keyDownEvent","keydown"],["keyUpEvent","keyup"],["focusEvent","focus"],["blurEvent","blur"],["destroyEvent","destroy"]],m={key:AH,value:AF,validator:AM.isString,suppressEvent:true},q={key:K,supercedes:[AH],suppressEvent:true},F={key:l,value:M,suppressEvent:true},AK={key:AD,suppressEvent:true},AL={key:A,value:false,validator:AM.isBoolean,suppressEvent:true,supercedes:[AH]},b={key:L,value:false,validator:AM.isBoolean,suppressEvent:true,supercedes:[AH]},j={key:Z,value:false,validator:AM.isBoolean,suppressEvent:true,supercedes:[G,B]},E={key:u,suppressEvent:true,supercedes:[G,B]},AI={key:G,value:false,validator:AM.isBoolean,suppressEvent:true,supercedes:[AH,B]},d={key:B,value:false,validator:AM.isBoolean,suppressEvent:true},s={key:o,suppressEvent:true},y={key:I,value:null,validator:AM.isString,suppressEvent:true},c={},C;var X=function(AQ,AP){var AN=c[AQ];if(!AN){c[AQ]={};AN=c[AQ];}var AO=AN[AP];if(!AO){AO=AQ+O+AP;AN[AP]=AO;}return AO;};var e=function(AN){v.addClass(this.element,X(this.CSS_CLASS_NAME,AN));v.addClass(this._oAnchor,X(this.CSS_LABEL_CLASS_NAME,AN));};var P=function(AN){v.removeClass(this.element,X(this.CSS_CLASS_NAME,AN));v.removeClass(this._oAnchor,X(this.CSS_LABEL_CLASS_NAME,AN));};a.prototype={CSS_CLASS_NAME:"yuimenuitem",CSS_LABEL_CLASS_NAME:"yuimenuitemlabel",SUBMENU_TYPE:null,_oAnchor:null,_oHelpTextEM:null,_oSubmenu:null,_oOnclickAttributeValue:null,_sClassName:null,constructor:a,index:null,groupIndex:null,parent:null,element:null,srcElement:null,value:null,browser:h.prototype.browser,id:null,init:function(AN,AX){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=x;}this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();var AT=this.cfg,AU=M,AP,AW,AV,AO,AR,AQ,AS;if(AM.isString(AN)){this._createRootNodeStructure();AT.queueProperty(AH,AN);}else{if(AN&&AN.tagName){switch(AN.tagName.toUpperCase()){case g:this._createRootNodeStructure();AT.queueProperty(AH,AN.text);AT.queueProperty(G,AN.disabled);this.value=AN.value;this.srcElement=AN;break;case t:this._createRootNodeStructure();AT.queueProperty(AH,AN.label);AT.queueProperty(G,AN.disabled);this.srcElement=AN;this._initSubTree();break;case J:AV=v.getFirstChild(AN);if(AV){AU=AV.getAttribute(AA,2);AO=AV.getAttribute(AD);AR=AV.innerHTML;}this.srcElement=AN;this.element=AN;this._oAnchor=AV;AT.setProperty(AH,AR,true);AT.setProperty(l,AU,true);AT.setProperty(AD,AO,true);this._initSubTree();break;}}}if(this.element){AQ=(this.srcElement||this.element).id;if(!AQ){AQ=this.id||v.generateId();this.element.id=AQ;}this.id=AQ;v.addClass(this.element,this.CSS_CLASS_NAME);v.addClass(this._oAnchor,this.CSS_LABEL_CLASS_NAME);AS=n.length-1;do{AW=n[AS];AP=this.createEvent(AW[1]);AP.signature=AG.LIST;this[AW[0]]=AP;}while(AS--);if(AX){AT.applyConfig(AX);}AT.fireQueue();}},_createRootNodeStructure:function(){var AN,AO;if(!C){C=document.createElement(Q);C.innerHTML=AB;}AN=C.cloneNode(true);AN.className=this.CSS_CLASS_NAME;AO=AN.firstChild;AO.className=this.CSS_LABEL_CLASS_NAME;this.element=AN;this._oAnchor=AO;},_initSubTree:function(){var AT=this.srcElement,AP=this.cfg,AR,AQ,AO,AN,AS;if(AT.childNodes.length>0){if(this.parent.lazyLoad&&this.parent.srcElement&&this.parent.srcElement.tagName.toUpperCase()==p){AP.setProperty(u,{id:v.generateId(),itemdata:AT.childNodes});}else{AR=AT.firstChild;AQ=[];do{if(AR&&AR.tagName){switch(AR.tagName.toUpperCase()){case V:AP.setProperty(u,AR);break;case g:AQ[AQ.length]=AR;break;}}}while((AR=AR.nextSibling));AO=AQ.length;if(AO>0){AN=new this.SUBMENU_TYPE(v.generateId());AP.setProperty(u,AN);for(AS=0;AS<AO;AS++){AN.addItem((new AN.ITEM_TYPE(AQ[AS])));}}}}},configText:function(AW,AP,AR){var AO=AP[0],AQ=this.cfg,AU=this._oAnchor,AN=AQ.getProperty(K),AV=AF,AS=AF,AT=AF;if(AO){if(AN){AV=AJ+AN+H;}if(AQ.getProperty(A)){AS=Y;AT=H;}if(AQ.getProperty(L)){AS=U;AT=w;}AU.innerHTML=(AS+AO+AT+AV);}},configHelpText:function(AP,AO,AN){this.cfg.refireEvent(AH);},configURL:function(AP,AO,AN){var AR=AO[0];if(!AR){AR=M;}var AQ=this._oAnchor;if(i.opera){AQ.removeAttribute(AA);}AQ.setAttribute(AA,AR);},configTarget:function(AQ,AP,AO){var AN=AP[0],AR=this._oAnchor;
if(AN&&AN.length>0){AR.setAttribute(AD,AN);}else{AR.removeAttribute(AD);}},configEmphasis:function(AP,AO,AN){var AR=AO[0],AQ=this.cfg;if(AR&&AQ.getProperty(L)){AQ.setProperty(L,false);}AQ.refireEvent(AH);},configStrongEmphasis:function(AQ,AP,AO){var AN=AP[0],AR=this.cfg;if(AN&&AR.getProperty(A)){AR.setProperty(A,false);}AR.refireEvent(AH);},configChecked:function(AP,AO,AN){var AR=AO[0],AQ=this.cfg;if(AR){e.call(this,Z);}else{P.call(this,Z);}AQ.refireEvent(AH);if(AQ.getProperty(G)){AQ.refireEvent(G);}if(AQ.getProperty(B)){AQ.refireEvent(B);}},configDisabled:function(AP,AO,AN){var AR=AO[0],AS=this.cfg,AQ=AS.getProperty(u),AT=AS.getProperty(Z);if(AR){if(AS.getProperty(B)){AS.setProperty(B,false);}e.call(this,G);if(AQ){e.call(this,AE);}if(AT){e.call(this,S);}}else{P.call(this,G);if(AQ){P.call(this,AE);}if(AT){P.call(this,S);}}},configSelected:function(AP,AO,AN){var AT=this.cfg,AS=this._oAnchor,AR=AO[0],AU=AT.getProperty(Z),AQ=AT.getProperty(u);if(i.opera){AS.blur();}if(AR&&!AT.getProperty(G)){e.call(this,B);if(AQ){e.call(this,z);}if(AU){e.call(this,R);}}else{P.call(this,B);if(AQ){P.call(this,z);}if(AU){P.call(this,R);}}if(this.hasFocus()&&i.opera){AS.focus();}},_onSubmenuBeforeHide:function(AQ,AP){var AR=this.parent,AN;function AO(){AR._oAnchor.blur();AN.beforeHideEvent.unsubscribe(AO);}if(AR.hasFocus()){AN=AR.parent;AN.beforeHideEvent.subscribe(AO);}},configSubmenu:function(AU,AP,AS){var AR=AP[0],AQ=this.cfg,AO=this.parent&&this.parent.lazyLoad,AT,AV,AN;if(AR){if(AR instanceof x){AT=AR;AT.parent=this;AT.lazyLoad=AO;}else{if(AM.isObject(AR)&&AR.id&&!AR.nodeType){AV=AR.id;AN=AR;AN.lazyload=AO;AN.parent=this;AT=new this.SUBMENU_TYPE(AV,AN);AQ.setProperty(u,AT,true);}else{AT=new this.SUBMENU_TYPE(AR,{lazyload:AO,parent:this});AQ.setProperty(u,AT,true);}}if(AT){AT.cfg.setProperty(W,true);e.call(this,N);if(AQ.getProperty(l)===M){AQ.setProperty(l,(M+AT.id));}this._oSubmenu=AT;if(i.opera){AT.beforeHideEvent.subscribe(this._onSubmenuBeforeHide);}}}else{P.call(this,N);if(this._oSubmenu){this._oSubmenu.destroy();}}if(AQ.getProperty(G)){AQ.refireEvent(G);}if(AQ.getProperty(B)){AQ.refireEvent(B);}},configOnClick:function(AP,AO,AN){var AQ=AO[0];if(this._oOnclickAttributeValue&&(this._oOnclickAttributeValue!=AQ)){this.clickEvent.unsubscribe(this._oOnclickAttributeValue.fn,this._oOnclickAttributeValue.obj);this._oOnclickAttributeValue=null;}if(!this._oOnclickAttributeValue&&AM.isObject(AQ)&&AM.isFunction(AQ.fn)){this.clickEvent.subscribe(AQ.fn,((f in AQ)?AQ.obj:this),((AC in AQ)?AQ.scope:null));this._oOnclickAttributeValue=AQ;}},configClassName:function(AQ,AP,AO){var AN=AP[0];if(this._sClassName){v.removeClass(this.element,this._sClassName);}v.addClass(this.element,AN);this._sClassName=AN;},initDefaultConfig:function(){var AN=this.cfg;AN.addProperty(m.key,{handler:this.configText,value:m.value,validator:m.validator,suppressEvent:m.suppressEvent});AN.addProperty(q.key,{handler:this.configHelpText,supercedes:q.supercedes,suppressEvent:q.suppressEvent});AN.addProperty(F.key,{handler:this.configURL,value:F.value,suppressEvent:F.suppressEvent});AN.addProperty(AK.key,{handler:this.configTarget,suppressEvent:AK.suppressEvent});AN.addProperty(AL.key,{handler:this.configEmphasis,value:AL.value,validator:AL.validator,suppressEvent:AL.suppressEvent,supercedes:AL.supercedes});AN.addProperty(b.key,{handler:this.configStrongEmphasis,value:b.value,validator:b.validator,suppressEvent:b.suppressEvent,supercedes:b.supercedes});AN.addProperty(j.key,{handler:this.configChecked,value:j.value,validator:j.validator,suppressEvent:j.suppressEvent,supercedes:j.supercedes});AN.addProperty(AI.key,{handler:this.configDisabled,value:AI.value,validator:AI.validator,suppressEvent:AI.suppressEvent});AN.addProperty(d.key,{handler:this.configSelected,value:d.value,validator:d.validator,suppressEvent:d.suppressEvent});AN.addProperty(E.key,{handler:this.configSubmenu,supercedes:E.supercedes,suppressEvent:E.suppressEvent});AN.addProperty(s.key,{handler:this.configOnClick,suppressEvent:s.suppressEvent});AN.addProperty(y.key,{handler:this.configClassName,value:y.value,validator:y.validator,suppressEvent:y.suppressEvent});},getNextEnabledSibling:function(){var AQ,AT,AN,AS,AR,AO;function AP(AU,AV){return AU[AV]||AP(AU,(AV+1));}if(this.parent instanceof x){AQ=this.groupIndex;AT=this.parent.getItemGroups();if(this.index<(AT[AQ].length-1)){AN=AP(AT[AQ],(this.index+1));}else{if(AQ<(AT.length-1)){AS=AQ+1;}else{AS=0;}AR=AP(AT,AS);AN=AP(AR,0);}AO=(AN.cfg.getProperty(G)||AN.element.style.display==r)?AN.getNextEnabledSibling():AN;}return AO;},getPreviousEnabledSibling:function(){var AS,AU,AO,AN,AR,AQ;function AT(AV,AW){return AV[AW]||AT(AV,(AW-1));}function AP(AV,AW){return AV[AW]?AW:AP(AV,(AW+1));}if(this.parent instanceof x){AS=this.groupIndex;AU=this.parent.getItemGroups();if(this.index>AP(AU[AS],0)){AO=AT(AU[AS],(this.index-1));}else{if(AS>AP(AU,0)){AN=AS-1;}else{AN=AU.length-1;}AR=AT(AU,AN);AO=AT(AR,(AR.length-1));}AQ=(AO.cfg.getProperty(G)||AO.element.style.display==r)?AO.getPreviousEnabledSibling():AO;}return AQ;},focus:function(){var AQ=this.parent,AP=this._oAnchor,AN=AQ.activeItem;function AO(){try{if(!(i.ie&&!document.hasFocus())){if(AN){AN.blurEvent.fire();}AP.focus();this.focusEvent.fire();}}catch(AR){}}if(!this.cfg.getProperty(G)&&AQ&&AQ.cfg.getProperty(T)&&this.element.style.display!=r){AM.later(0,this,AO);}},blur:function(){var AN=this.parent;if(!this.cfg.getProperty(G)&&AN&&AN.cfg.getProperty(T)){AM.later(0,this,function(){try{this._oAnchor.blur();this.blurEvent.fire();}catch(AO){}},0);}},hasFocus:function(){return(YAHOO.widget.MenuManager.getFocusedMenuItem()==this);},destroy:function(){var AP=this.element,AO,AN,AR,AQ;if(AP){AO=this.cfg.getProperty(u);if(AO){AO.destroy();}AN=AP.parentNode;if(AN){AN.removeChild(AP);this.destroyEvent.fire();}AQ=n.length-1;do{AR=n[AQ];this[AR[0]].unsubscribeAll();}while(AQ--);this.cfg.configChangedEvent.unsubscribeAll();}},toString:function(){var AO=k,AN=this.id;if(AN){AO+=(D+AN);}return AO;}};AM.augmentProto(a,YAHOO.util.EventProvider);
})();(function(){var B="xy",C="mousedown",F="ContextMenu",J=" ";YAHOO.widget.ContextMenu=function(L,K){YAHOO.widget.ContextMenu.superclass.constructor.call(this,L,K);};var I=YAHOO.util.Event,E=YAHOO.env.ua,G=YAHOO.widget.ContextMenu,A={"TRIGGER_CONTEXT_MENU":"triggerContextMenu","CONTEXT_MENU":(E.opera?C:"contextmenu"),"CLICK":"click"},H={key:"trigger",suppressEvent:true};function D(L,K,M){this.cfg.setProperty(B,M);this.beforeShowEvent.unsubscribe(D,M);}YAHOO.lang.extend(G,YAHOO.widget.Menu,{_oTrigger:null,_bCancelled:false,contextEventTarget:null,triggerContextMenuEvent:null,init:function(L,K){G.superclass.init.call(this,L);this.beforeInitEvent.fire(G);if(K){this.cfg.applyConfig(K,true);}this.initEvent.fire(G);},initEvents:function(){G.superclass.initEvents.call(this);this.triggerContextMenuEvent=this.createEvent(A.TRIGGER_CONTEXT_MENU);this.triggerContextMenuEvent.signature=YAHOO.util.CustomEvent.LIST;},cancel:function(){this._bCancelled=true;},_removeEventHandlers:function(){var K=this._oTrigger;if(K){I.removeListener(K,A.CONTEXT_MENU,this._onTriggerContextMenu);if(E.opera){I.removeListener(K,A.CLICK,this._onTriggerClick);}}},_onTriggerClick:function(L,K){if(L.ctrlKey){I.stopEvent(L);}},_onTriggerContextMenu:function(M,K){var L;if(!(M.type==C&&!M.ctrlKey)){I.stopEvent(M);this.contextEventTarget=I.getTarget(M);this.triggerContextMenuEvent.fire(M);YAHOO.widget.MenuManager.hideVisible();if(!this._bCancelled){L=I.getXY(M);if(!YAHOO.util.Dom.inDocument(this.element)){this.beforeShowEvent.subscribe(D,L);}else{this.cfg.setProperty(B,L);}this.show();}this._bCancelled=false;}},toString:function(){var L=F,K=this.id;if(K){L+=(J+K);}return L;},initDefaultConfig:function(){G.superclass.initDefaultConfig.call(this);this.cfg.addProperty(H.key,{handler:this.configTrigger,suppressEvent:H.suppressEvent});},destroy:function(){this._removeEventHandlers();G.superclass.destroy.call(this);},configTrigger:function(L,K,N){var M=K[0];if(M){if(this._oTrigger){this._removeEventHandlers();}this._oTrigger=M;I.on(M,A.CONTEXT_MENU,this._onTriggerContextMenu,this,true);if(E.opera){I.on(M,A.CLICK,this._onTriggerClick,this,true);}}else{this._removeEventHandlers();}}});}());YAHOO.widget.ContextMenuItem=YAHOO.widget.MenuItem;(function(){var D=YAHOO.lang,N="static",M="dynamic,"+N,A="disabled",F="selected",B="autosubmenudisplay",G="submenu",C="visible",Q=" ",H="submenutoggleregion",P="MenuBar";YAHOO.widget.MenuBar=function(T,S){YAHOO.widget.MenuBar.superclass.constructor.call(this,T,S);};function O(T){var S=false;if(D.isString(T)){S=(M.indexOf((T.toLowerCase()))!=-1);}return S;}var R=YAHOO.util.Event,L=YAHOO.widget.MenuBar,K={key:"position",value:N,validator:O,supercedes:[C]},E={key:"submenualignment",value:["tl","bl"]},J={key:B,value:false,validator:D.isBoolean,suppressEvent:true},I={key:H,value:false,validator:D.isBoolean};D.extend(L,YAHOO.widget.Menu,{init:function(T,S){if(!this.ITEM_TYPE){this.ITEM_TYPE=YAHOO.widget.MenuBarItem;}L.superclass.init.call(this,T);this.beforeInitEvent.fire(L);if(S){this.cfg.applyConfig(S,true);}this.initEvent.fire(L);},CSS_CLASS_NAME:"yuimenubar",SUBMENU_TOGGLE_REGION_WIDTH:20,_onKeyDown:function(U,T,Y){var S=T[0],Z=T[1],W,X,V;if(Z&&!Z.cfg.getProperty(A)){X=Z.cfg;switch(S.keyCode){case 37:case 39:if(Z==this.activeItem&&!X.getProperty(F)){X.setProperty(F,true);}else{V=(S.keyCode==37)?Z.getPreviousEnabledSibling():Z.getNextEnabledSibling();if(V){this.clearActiveItem();V.cfg.setProperty(F,true);W=V.cfg.getProperty(G);if(W){W.show();W.setInitialFocus();}else{V.focus();}}}R.preventDefault(S);break;case 40:if(this.activeItem!=Z){this.clearActiveItem();X.setProperty(F,true);Z.focus();}W=X.getProperty(G);if(W){if(W.cfg.getProperty(C)){W.setInitialSelection();W.setInitialFocus();}else{W.show();W.setInitialFocus();}}R.preventDefault(S);break;}}if(S.keyCode==27&&this.activeItem){W=this.activeItem.cfg.getProperty(G);if(W&&W.cfg.getProperty(C)){W.hide();this.activeItem.focus();}else{this.activeItem.cfg.setProperty(F,false);this.activeItem.blur();}R.preventDefault(S);}},_onClick:function(e,Y,b){L.superclass._onClick.call(this,e,Y,b);var d=Y[1],T=true,S,f,U,W,Z,a,c,V;var X=function(){if(a.cfg.getProperty(C)){a.hide();}else{a.show();}};if(d&&!d.cfg.getProperty(A)){f=Y[0];U=R.getTarget(f);W=this.activeItem;Z=this.cfg;if(W&&W!=d){this.clearActiveItem();}d.cfg.setProperty(F,true);a=d.cfg.getProperty(G);if(a){S=d.element;c=YAHOO.util.Dom.getX(S);V=c+(S.offsetWidth-this.SUBMENU_TOGGLE_REGION_WIDTH);if(Z.getProperty(H)){if(R.getPageX(f)>V){X();R.preventDefault(f);T=false;}}else{X();}}}return T;},configSubmenuToggle:function(U,T){var S=T[0];if(S){this.cfg.setProperty(B,false);}},toString:function(){var T=P,S=this.id;if(S){T+=(Q+S);}return T;},initDefaultConfig:function(){L.superclass.initDefaultConfig.call(this);var S=this.cfg;S.addProperty(K.key,{handler:this.configPosition,value:K.value,validator:K.validator,supercedes:K.supercedes});S.addProperty(E.key,{value:E.value,suppressEvent:E.suppressEvent});S.addProperty(J.key,{value:J.value,validator:J.validator,suppressEvent:J.suppressEvent});S.addProperty(I.key,{value:I.value,validator:I.validator,handler:this.configSubmenuToggle});}});}());YAHOO.widget.MenuBarItem=function(B,A){YAHOO.widget.MenuBarItem.superclass.constructor.call(this,B,A);};YAHOO.lang.extend(YAHOO.widget.MenuBarItem,YAHOO.widget.MenuItem,{init:function(B,A){if(!this.SUBMENU_TYPE){this.SUBMENU_TYPE=YAHOO.widget.Menu;}YAHOO.widget.MenuBarItem.superclass.init.call(this,B);var C=this.cfg;if(A){C.applyConfig(A,true);}C.fireQueue();},CSS_CLASS_NAME:"yuimenubaritem",CSS_LABEL_CLASS_NAME:"yuimenubaritemlabel",toString:function(){var A="MenuBarItem";if(this.cfg&&this.cfg.getProperty("text")){A+=(": "+this.cfg.getProperty("text"));}return A;}});YAHOO.register("menu",YAHOO.widget.Menu,{version:"2.6.0",build:"1321"});


/* Menu patch */
(function(){var B=YAHOO.widget.Overlay,E=YAHOO.util.Dom,G="context",A="y",F="maxheight",C="minscrollheight",D="preventcontextoverlap";YAHOO.widget.Menu.prototype.getConstrainedY=function(T){var e=this,a=e.cfg.getProperty(G),h=e.cfg.getProperty(F),d,S={trbr:true,tlbl:true,bltl:true,brtr:true},M=(a&&S[a[1]+a[2]]),O=e.element,i=O.offsetHeight,c=B.VIEWPORT_OFFSET,X=E.getViewportHeight(),b=E.getDocumentScrollTop(),Y=(e.cfg.getProperty(C)+c<X),g,P,V,W,R=false,Q,J,U=b+c,L=b+X-i-c,H=T;var N=function(){var j;if((e.cfg.getProperty(A)-b)>V){j=(V-i)}else{j=(V+W)}e.cfg.setProperty(A,(j+b),true);return j};var K=function(){if((e.cfg.getProperty(A)-b)>V){return(J-c)}else{return(Q-c)}};var Z=function(){var j;if((e.cfg.getProperty(A)-b)>V){j=(V+W)}else{j=(V-O.offsetHeight)}e.cfg.setProperty(A,(j+b),true)};var I=function(){e._setScrollHeight(this.cfg.getProperty(F));e.hideEvent.unsubscribe(I)};var f=function(){var n=K(),j=(e.getItems().length>0),m,l,k;if(i>n){m=j?e.cfg.getProperty(C):i;if((n>m)&&j){d=n}else{d=h}e._setScrollHeight(d);e.hideEvent.subscribe(I);Z();if(n<m){if(R){N()}else{N();R=true;l=f()}}}else{if(d&&(d!==h)){e._setScrollHeight(h);e.hideEvent.subscribe(I);Z()}}return l};if(T<U||T>L){if(Y){if(e.cfg.getProperty(D)&&M){P=a[0];W=P.offsetHeight;V=(E.getY(P)-b);Q=V;J=(X-(V+W));f();H=e.cfg.getProperty(A)}else{if(!(e instanceof YAHOO.widget.MenuBar)&&i>=X){g=(X-(c*2));if(g>e.cfg.getProperty(C)){e._setScrollHeight(g);e.hideEvent.subscribe(I);Z();H=e.cfg.getProperty(A)}}else{if(T<U){H=U}else{if(T>L){H=L}}}}}else{H=c+b}}return H}}());

/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
YAHOO.namespace("util");YAHOO.util.Cookie={_createCookieString:function(B,D,C,A){var F=YAHOO.lang;var E=encodeURIComponent(B)+"="+(C?encodeURIComponent(D):D);if(F.isObject(A)){if(A.expires instanceof Date){E+="; expires="+A.expires.toGMTString();}if(F.isString(A.path)&&A.path!=""){E+="; path="+A.path;}if(F.isString(A.domain)&&A.domain!=""){E+="; domain="+A.domain;}if(A.secure===true){E+="; secure";}}return E;},_createCookieHashString:function(B){var D=YAHOO.lang;if(!D.isObject(B)){throw new TypeError("Cookie._createCookieHashString(): Argument must be an object.");}var C=new Array();for(var A in B){if(D.hasOwnProperty(B,A)&&!D.isFunction(B[A])&&!D.isUndefined(B[A])){C.push(encodeURIComponent(A)+"="+encodeURIComponent(String(B[A])));}}return C.join("&");},_parseCookieHash:function(E){var D=E.split("&"),F=null,C=new Object();if(E.length>0){for(var B=0,A=D.length;B<A;B++){F=D[B].split("=");C[decodeURIComponent(F[0])]=decodeURIComponent(F[1]);}}return C;},_parseCookieString:function(I,A){var J=new Object();if(YAHOO.lang.isString(I)&&I.length>0){var B=(A===false?function(K){return K;}:decodeURIComponent);if(/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(I)){var G=I.split(/;\s/g);var H=null;var C=null;var E=null;for(var D=0,F=G.length;D<F;D++){E=G[D].match(/([^=]+)=/i);if(E instanceof Array){H=decodeURIComponent(E[1]);C=B(G[D].substring(E[1].length+1));}else{H=decodeURIComponent(G[D]);C=H;}J[H]=C;}}}return J;},get:function(A,B){var D=YAHOO.lang;var C=this._parseCookieString(document.cookie);if(!D.isString(A)||A===""){throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");}if(D.isUndefined(C[A])){return null;}if(!D.isFunction(B)){return C[A];}else{return B(C[A]);}},getSub:function(A,C,B){var E=YAHOO.lang;var D=this.getSubs(A);if(D!==null){if(!E.isString(C)||C===""){throw new TypeError("Cookie.getSub(): Subcookie name must be a non-empty string.");}if(E.isUndefined(D[C])){return null;}if(!E.isFunction(B)){return D[C];}else{return B(D[C]);}}else{return null;}},getSubs:function(A){if(!YAHOO.lang.isString(A)||A===""){throw new TypeError("Cookie.getSubs(): Cookie name must be a non-empty string.");}var B=this._parseCookieString(document.cookie,false);if(YAHOO.lang.isString(B[A])){return this._parseCookieHash(B[A]);}return null;},remove:function(B,A){if(!YAHOO.lang.isString(B)||B===""){throw new TypeError("Cookie.remove(): Cookie name must be a non-empty string.");}A=A||{};A.expires=new Date(0);return this.set(B,"",A);},removeSub:function(B,D,A){if(!YAHOO.lang.isString(B)||B===""){throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.");}if(!YAHOO.lang.isString(D)||D===""){throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.");}var C=this.getSubs(B);if(YAHOO.lang.isObject(C)&&YAHOO.lang.hasOwnProperty(C,D)){delete C[D];return this.setSubs(B,C,A);}else{return"";}},set:function(B,C,A){var E=YAHOO.lang;if(!E.isString(B)){throw new TypeError("Cookie.set(): Cookie name must be a string.");}if(E.isUndefined(C)){throw new TypeError("Cookie.set(): Value cannot be undefined.");}var D=this._createCookieString(B,C,true,A);document.cookie=D;return D;},setSub:function(B,D,C,A){var F=YAHOO.lang;if(!F.isString(B)||B===""){throw new TypeError("Cookie.setSub(): Cookie name must be a non-empty string.");}if(!F.isString(D)||D===""){throw new TypeError("Cookie.setSub(): Subcookie name must be a non-empty string.");}if(F.isUndefined(C)){throw new TypeError("Cookie.setSub(): Subcookie value cannot be undefined.");}var E=this.getSubs(B);if(!F.isObject(E)){E=new Object();}E[D]=C;return this.setSubs(B,E,A);},setSubs:function(B,C,A){var E=YAHOO.lang;if(!E.isString(B)){throw new TypeError("Cookie.setSubs(): Cookie name must be a string.");}if(!E.isObject(C)){throw new TypeError("Cookie.setSubs(): Cookie value must be an object.");}var D=this._createCookieString(B,this._createCookieHashString(C),false,A);document.cookie=D;return D;}};YAHOO.register("cookie",YAHOO.util.Cookie,{version:"2.6.0",build:"1321"});

/*!
 * yShort 0.4 
 * http://github.com/kltan/yshort/tree/master 
 * A really short way to write YUI 2.6.x - 2.7.x 
 * Dual licensed under the MIT and BSD 
 * Copyright 2008-2009 Kean Tan 
 * Start date: 2008-12-17
 * Last build: 2009-04-01 03:07:50 PM 
 */

(function(){

// caching of even natives to improve reference speed in non-JIT bytecode javascript engines
var doc = document,
	win = this,
	nav = navigator,
	undefined, // speeding up undefined
	myToString = Object.prototype.toString, // type detection function call
	UT = win.YAHOO.util, // YAHOO.util
	DOM = UT.Dom, // YAHOO.util.Dom
	EV = UT.Event, // YAHOO.util.Event
	CON = UT.Connect, // YAHOO.util.Connect
	SEL = function(qry, context){ return win.Sizzle ? win.Sizzle(qry, context) : UT.Selector.query(qry, context)}, // Sizzle or YAHOO.util.Selector.query
	EL = UT.Element, // YAHOO.util.Element
	FIL = function(o, qry){	return win.Sizzle ?	win.Sizzle.filter(qry, o): UT.Selector.filter(o, qry); },
	
	// check for object, not using Miller as we want Array to be detected as object in many instance
	isObj = function(o) { return typeof o === "object" }, // array is also detected as object
	
	// some internal properties
	get1stNode = function(o) { 	return o.nodeType ? o : SEL(o)[0]; }, // yShort internal method
	yshortdata = 'yshortdata', // for data() use
	yshorteffects ='yshorteffects', // for animate() use
	
	
	// remapping some YUI namespace
	shortcuts = YAHOO.util.Shortcuts = {
		DOM: DOM, // Y.DOM -> YAHOO.util.Dom
		EVENT: EV, // Y.EVENT -> YAHOO.util.Event
		CONNECT: CON, // Y.CONNECT -> YAHOO.util.Connect
		QUERY: SEL, // Y.QUERY -> YAHOO.util.Selector.query
		EL: EL,  // Y.ELEMENT -> YAHOO.util.Element
		GET: UT.Get // Y.GET -> YAHOO.util.Get
	};

// yS for internal use 
// YAHOO.util.Short for global use
var yS = UT.Short = win.yShort = win.y$ = function( qry, context ) {
	// Constructor
	return new yS.fn.init( qry, context );
};

yS.fn = yS.prototype = {
	// constructor, determines what to do with the query passed in
	// the lesser the function calls from here the better
	init: function(qry, context) {
		this.context = context || doc;
		qry = qry || doc;
	
		this.previousStack = [];
		var myresult = [];
		
		// if DOM node
		if (qry.nodeType)
			myresult = [qry];
		
		// if String
		else if (typeof qry === "string") {
			// if HTML, create nodes from it and push into yShort object, then we can manipulate the nodes with yShort methods
			if (/^<(.|\s)+>$/.test(qry)) {
				var x = doc.createElement('DIV');
				x.innerHTML = qry;
				for (var i =0; i < x.childNodes.length; i++)
					myresult[i] = x.childNodes[i];
			}
			else {
				// if CSS query
				this.selector = qry;
				var result = SEL(qry, this.context);
				myresult = result;
			}
		}
		
		// if array, object or yShort object
		else if (typeof qry === "object") {						
			myresult = qry;
			if (!yS.isArray(myresult))
				myresult = Array.prototype.slice.call(myresult);

			this.selector = qry.selector || null;
		}
		
		// onDOMready, we call the qry function and pass window object as the calling object, 
		// YAHOO.util.Short as it's first argument and YAHOO.util.Shortcuts as second
		else if (typeof qry === "function") {
			EV.onDOMReady(function(){ 
				qry.call(win, yS, shortcuts);
			});
		}
		
		this.length = 0;
		this.push.apply(this, myresult);
	},
	
	/****************************************************************
	 * all the members below are shared amongs all yShort objects,  *
	 * you change one, they affect ALL YAHOO.util.Short objects     *
	 ****************************************************************/
	 
	// overload three of these and it will trick firebug to display yShort as array (false array)
	push: Array.prototype.push,
	sort: Array.prototype.sort,
	splice: Array.prototype.splice,
	
	// version number and also for yShort object detection
	yShort: '0.4',
	// numbers of nodes inside current yShort obj
	length: null,
	// the initial selector that was used to create this yshort obj, useful for live and die
	selector: null,
	
	// not used in init to minimize function calls, use everywhere except init
	populate: function(els){
		this.length = 0;
		this.push.apply(this, els);
		return this;
	},
	
	// iterate through all of yShorts elements or o's elements
	each: function(o, fn) {
		// for performance, no vigorous check, let there be errors if user pass something out of the ordinary
		if (!fn)
			for (var i=0; i < this.length; i++)
				o.call(this[i], i);
		//
		else {
			if (!o.yShort && !yS.isArray(o))
				o = yS.makeArray(o); // if not array or yShort object, we need it to be an array
			for (var i=0; i < o.length; i++)
				fn.call(o[i], i);
		}
		return this;
	},
	
	// destroys elements on and after array[n]
	wipe: function(n) {
		n = n || 0;
		// we cannot use each cause  i = n
		for (var i = n; i < this.length; i++)
			delete this[i];

		this.length = n;
		return this;
	},
	
	// push in stack
	stack: function(prev){
		this.previousStack.push(prev);
		return this;
	},
	
	//end pops previous stacks and put in this	
	end: function(){
		return this.previousStack[0];
	},
	
	// returns the nth item in yShort
	eq: function(num){
		var $ = yS(this);
		num = num || 0; // if none is specified, we return the first element

		$[0] = this[num];
		
		$.stack(this).wipe(1);

		return $;
	},
	
	// get an array of nodes (convert yShort object into an Array)
	get: function(num) {
		return (num === undefined) ? Array.prototype.slice.call(this) : this[num];
	},
	
	addClass: function(str) {
		DOM.addClass(this, str);
		return this;
	},
	
	removeClass: function(str) {
		DOM.removeClass(this, str);
		return this;
	},
	
	hasClass: function(str) {
		return DOM.hasClass(this[0], str);
	},
	
	toggleClass: function(str) {
		for (var i=0; i< this.length; i++)
			DOM.hasClass(this[i], str)? DOM.removeClass(this[i], str) : DOM.addClass(this[i], str);

		return this;
	},
	
	replaceClass: function(str, str2) {
		DOM.replaceClass(this, str, str2);
		return this;
	},
	
	// manipulate innerHTML of nodes or return innerHTML of first node
	html: function(str) {
		if (yS.isNumber(str) || yS.isString(str))
			for (var i=0; i< this.length; i++) {		
				this[i].innerHTML = str;
			}
		else 
			return this[0].innerHTML;
			
		return this;
	},
	
	// manipulate value of nodes or return value of first node
	val: function(str) {
		// stringent check on integer or empty string to prevent 0 as being detected as false
		if (yS.isNumber(str) || yS.isString(str))
			for (var i=0; i< this.length; i++)
				this[i].value = str;
		else
			return this[0].value;
			
		return this;
	},
	
	// filter current nodes based on the CSS rules
	filter: function(qry) {
		var $ = yS(this),
			els = FIL($, qry);
		// wipe plus reset length
		$.stack(this)
		 .wipe(els.length)
		 .populate(els);
	
		return $;
	},
	
	is: function(qry, obj) {
		var o = [];
		if (obj) {o[0] = obj }
		else { o = this; }

		var els = FIL(o, qry);

		return els.length ? true: false;
	},
	
	// just pass this to the selector filter and wrap them in :not
	not: function(qry) {
		var $ = yS(this);
		var els = FIL($, ":not("+qry+")");
		
		$.stack(this)
		 .wipe(els.length)
		 .populate(els);
		return $;
	},
	
	add: function(qry) {
		var els = [], 
			$ = yS(this);

		if (qry.nodeType)  // you can add a node
			els[0] = qry;
		else if (isObj(qry)) { 
			// a yshort object, array or object
			// if not yshort object and is object, convert to array
			if (!qry.yshort && yS.isObject(qry)) 
				qry = yS.makeArray(qry);
			for (var i=0; i<qry.length; i++)
				els[i] = qry[i];
		}
		else
			els = SEL(qry) || [];
		
		$.stack(this);
		
		// adding to the length
		for(var i=$.length; i<$.length+els.length; i++)
			$[i] = els[i-$.length];
			
		$.length += els.length;
		
		return $;
	},
	
	children: function(qry) {
		var $ = yS(this),
			els = [];

		// cause we are concatenating array with array			
		for (var i=0; i< $.length; i++)
			els = els.concat(DOM.getChildren($[i]));

		if (qry)
			els = FIL(els, qry);
		
		// we wipe first, so we increase 'this' length for easy looping to match with els
		$.stack(this)		
		 .wipe(els.length);
		 
		/*
		for (var i=0; i< $.length; i++)
			$[i] = els[i];
		*/
		$.populate(els);
		return $;
	},
	
	parent: function(){
		var els=[],
			$ = yS(this);
		
		// cause we are concatenating node with array, see above difference with children method		
		for (var i=0; i< $.length; i++)
			els[i] = $[i].parentNode;
		
		els = yS.unique(els);
		
		// we wipe first, so we reduce 'this' length for easy looping to match with els
		$.stack(this)
		 .wipe(els.length);
		 
		/*for (var i=0; i< $.length; i++)
			$[i] = els[i];*/
		$.populate(els);

		return $;
	},

	ancestors: function(str){
		var els=[],
			$ = yS(this);
		

		for (var i=0; i< $.length; i++) {
			var temp = $[i];
			while(temp){
				els.push(temp);
				temp=temp.parentNode;
			}
		};
			
		if(str)	{
			els = FIL(els, str);
			els = yS.unique(els);
		}
		
		// we wipe first, so we reduce 'this' length for easy looping to match with els
		$.stack(this)
		 .wipe(els.length)
		 .populate(els);

		return $;
	},
	
	find: function(qry) {
		var els = [],
			$ = yS(this);

		els = SEL(qry, $[0]);
		
		// we wipe first, so we reduce 'this' length for easy looping to match with els
		$.stack(this)
		 .wipe(els.length)
		 .populate(els);

		return $;
	},
	
	// TODO: rewrite without using YUI
	next: function(){
		var $ = yS(this), 
			nS = [];
		
		for (var i=0; i< $.length; i++) {
			var temp = DOM.getNextSibling($[i]);
			if (temp)
				nS.push(temp);
		};

		$.stack(this)
		 .wipe(nS.length)
		 .populate(nS);

		
		return $;
	},

	// TODO: rewrite without using YUI
	prev: function(){
		var $ = yS(this), 
			pS = [];
		
		for (var i=0; i< $.length; i++) {
			var temp = DOM.getPreviousSibling($[i]);
			if (temp)
				pS.push(temp);
		};

		$.stack(this)
		 .wipe(pS.length)
		 .populate(pS);

		return $;
	},
	
	css: function(o, o2) {
		if (isObj(o)) {
			for (var p in o) {
				DOM.setStyle(this , p , o[p]);
			}
		}
		else if (yS.isString(o2)) {
			DOM.setStyle(this , o , o2) 
		}
		
		else if (yS.isString(o))
			return DOM.getStyle (this[0], o);

		return this;		
	},

	data: function(key,value) {
		if (value)
			for (var i=0; i< this.length; i++) {
				if(!this[i][yshortdata+yS.ySrandom]) this[i][yshortdata+yS.ySrandom] = [];
				this[i][yshortdata+yS.ySrandom][key] = value;
			}
		else if (key)
			return this[0][yshortdata+yS.ySrandom][key];
			
		return this;
	},
	
	removeData: function(key) {
		for (var i=0; i< this.length; i++) {
			if(this[i][yshortdata+yS.ySrandom]) {
				if(key) 
					delete this[i][yshortdata+yS.ySrandom][key];
				else
					delete this[i][yshortdata+yS.ySrandom];		
			}
		};

		return this;
	},
	
	/* this has to be rewritten to have event namespacing */
	bind: function(type, fn) {
		var tmp = type.split(' ');

		for (var i=0; i< tmp.length; i++)
			if(tmp[i])
				EV.addListener(this, tmp[i], fn);
		
		return this;
	},
	
	/* this has to be rewritten to have event namespacing */
	unbind: function(type, fn) {
		for(var i=0; i<this.length; i++)
			EV.removeListener(this[i], fn);

		return this;
	},
	
	dimension: function(o, type) {
		var obj = {};
			
		if (o) {
			// detect if string or int
			obj[type.toLowerCase()] = yS.isString(o) ? o: parseInt(o, 10) + "px"; 
			this.css(obj);
			return this;
		}
		// if windows
		if (this[0] === win)
			return yS.viewport()[type.toLowerCase()] || null;

		// if document or documentElement
		else if (this[0] === doc || this[0] === doc.documentElement)
			return DOM['getDocument' + type]() || null;
		
		else {
			var region = DOM.getRegion(this[0]);
			if (type === 'Width')
				return (region.right - region.left) || null;
			
			else if (type === 'Height')
				return (region.bottom - region.top) || null;
		}
		return null; // null for error
	},
	
	// return width as calculated by browser
	width: function(o) {
		return this.dimension(o, 'Width');
	},
	
	// return height as calculated by browser
	height: function(o) {
		return this.dimension(o, 'Height');
	},
		
	offset: function(){
		return DOM.getRegion(this[0]);
	},
	
	// attr does not support style and events, meant to be like this for elegant code
	attr: function(prop, val) {
		var el;
		// if prop is obj, we disregard val
		if (isObj(prop)) {
			for(var i=0; i<this.length; i++)
				for(var attribute in prop)
					this[i].setAttribute(attribute,prop[attribute]);
		}
		// if prop is not obj (means string) and val exists
		else if (val){
			for(var i=0; i<this.length; i++)
				this[i].setAttribute(prop,val);
		}
		// if prop does exists as string and val does not exist
		else if (prop){
			return this[0].getAttribute(prop);
		}

		return this;
	},
	
	appendTo: function(o) {
		var tmp = get1stNode(o),
			fragment = doc.createDocumentFragment();

		if (tmp) {
			for (var i=0; i< this.length; i++) {
				fragment.appendChild(this[i]);
			};
			tmp.appendChild(fragment);
			
		}

		return this;
	},
	
	prependTo: function(o) {
		var tmp = get1stNode(o),
			fragment = doc.createDocumentFragment();
			
		if (tmp) {
			for (var i=0; i< this.length; i++) {
				fragment.appendChild(this[i]);
			};
			var first = tmp.firstChild;
			tmp.insertBefore(fragment, first);
		}
		return this;
	},
	
	insertBefore: function(o){
		var tmp = get1stNode(o),
			fragment = doc.createDocumentFragment();

		if (tmp) {
			for (var i=0; i< this.length; i++) {
				fragment.appendChild(this[i]);
			};
			var parent = tmp.parentNode;
			parent.insertBefore(fragment, tmp);
		}
		return this;
	},
	
	insertAfter: function(o){
		var tmp = get1stNode(o),
			fragment = doc.createDocumentFragment();
		
		if (tmp) {
			for (var i=0; i< this.length; i++) {
				fragment.appendChild(this[i]);
			};
			
			var parent = tmp.parentNode,
				next = DOM.getNextSibling(tmp);
			parent.insertBefore(fragment, next);
		}
		return this;
	},
	
	empty: function(){
		this.html('');
		return this;
	},

	remove: function(){
		for (var i=0; i< this.length; i++)
			this[i].parentNode.removeChild(this[i]);
	},
	
	clone: function(){
		var $ = yS(this),
			cloned = [];

		for(var i=0;i<$.length;i++) {
			var string;
			if ($[i].outerHTML){
				string = $[i].outerHTML;		
			}
			else {
				var x = doc.createElement('DIV');
				x.appendChild($[i].cloneNode(true));
				string = x.innerHTML;
			}
			// newlines and spaces will cause some browsers to breakdown
			cloned.push(yS(string.replace(/[\n\r\t]/g, '').replace( /^\s+|\s+$/g, ''))[0]);
		}

		$.wipe()
		 .stack(this)
		 .populate(cloned);
				
		return $;
	},
	
	serialize: function() {
		var tmp = '';
		for (var i=0; i<this.length; i++)
			if (this[i].name) // not necessary to have a value
				tmp += this[i].name + '=' + this[i].value + '&';
		// rtrim the & symbol
		return tmp.substring(0, tmp.length-1);
	},
	
	// used internally for now
	animate: function(attr, milisec, fn, easing){
		var sec = milisec/1000 || 1,
			ease = easing || YAHOO.util.Easing.easeNone,
			counter = 0,
			$ = this,
			total = function(){// total adds up when a function has completed animating
				counter++;
				if (counter === $.length) {
					fn.call($);
				}
			};

		for(var i=0; i<this.length; i++) {
			// make yshortEffects expando an array if not exists
			var fx = this[i][yshorteffects+yS.ySrandom] = this[i][yshorteffects+yS.ySrandom] || [];
			// push new effects into node expando
			fx.push(new YAHOO.util.Anim(this[i], attr, sec, ease));
			// animate the effects now
			fx[fx.length-1].animate();
			fx[fx.length-1].onComplete.subscribe(total);
		};
		
		return this;
	},
	
	// stops all animation
	stop: function() {
		for(var i=0; i<this.length; i++) {
			var fx =this[i][yshorteffects+yS.ySrandom];
			if(fx)
				for(var j=0; j<fx.length; j++) 
					if(fx[j])
						fx[j].stop();
		}

		return this;
	},
	
	// checks for animation, returns true or false
	animated: function() {
		var fx = this[0][yshorteffects+yS.ySrandom];
		
		if (fx)
			for (var i=0; i< fx.length; i++)
				if (fx[i].isAnimated())
					return true;

		return false;
	},
	
	// starting the animations / effects
	fadeIn: function(dur, fn, easing){
		return this.animate({opacity: { from:0, to: 1 }}, dur, fn, easing);
	},
	
	fadeOut: function(dur, fn, easing){
		return this.animate({ opacity: { to: 0 } }, dur, fn, easing);
	},

	fadeTo: function(val, dur, fn, easing){
		return this.animate({opacity: { to: val }}, dur, fn, easing);
	},
		
	fadeColor: function(attr, dur){
		var duration = dur/1000 || 1,
			counter = 0,
			total = function(){// total adds up when a function has completed animating
				counter++;
				if (counter === this.length)
					fn.call(this);
			};
		
		if (isObj(attr)) {
			for (var i=0; i< this.length; i++) {
				var fx = this[i][yshorteffects+yS.ySrandom] = this[i][yshorteffects+yS.ySrandom] || [];
				fx.push(new UT.ColorAnim(this[i], attr, duration));
				fx[fx.length-1].animate();
			};
		}
		return this;
	}
}

// drop init from list of prototypes as it's the constructor to prevent circular reference
for(var prop in yS.fn) {
	if (prop != 'init')
		yS.fn.init.prototype[prop] = yS.fn[prop];
}

// define extend (o,o2,o3,o4,o5 .......)
yS.extend = function(o) {
	for ( var i = 0; i < arguments.length; i++ ) 
		for ( var key in arguments[i] ) 
			o[key] = arguments[i][key]; 
	return o;
};

var expr = win.Sizzle ? { ':': Sizzle.selectors.filters } : {};

// execute to extend yShort methods and properties
yS.extend(yS, expr, {
	// add random number to prevent collision
	ySrandom: Math.floor(Math.random() * 100000),
	
	// iterate through each item in array
	each: yS.fn.each,
	
	viewport: function() {
		return DOM.getClientRegion();
	},
	
	noConflict: function() {
		win.$ = _$;
		return yS;
	},
	// Make Object into Array
	makeArray: function( array ) {
		var ret = [];
		ret.prototype = array.prototype;

		if( array != null ){
			var i = array.length;
			// The window, strings (and functions) also have 'length'
			if( i == null || typeof array === "string" || yShort.isFunction(array) || array.setInterval )
				ret[0] = array;
			else
				while( i )
					ret[--i] = array[i];
		}
		
		return ret;
	},
	
	// returns a unique set of array
	unique : function(a) {
		var r = [];
		o:for(var i = 0, n = a.length; i < n; i++) {
			for(var x = i + 1 ; x < n; x++) {
				if(a[x]===a[i]) continue o; // prevent window == document for DOM comparison
			}
			r[r.length] = a[i];
		}
		return r;
	},
	
	grep: function(o, fn) {
		var arry = [];
		// Go through the array, only saving the items that pass the validator function
		for ( var i = 0; i < o.length; i++ )
			if (!fn.call(o[i], o[i], i) === false)
				arry.push( o[i] );

		return arry;
	},

	inArray: function(el, o){
		// prevent ie's window == document problem
		for ( var i = 0; i < o.length; i++ )
			if ( o[i] === elem )
				return i;
		return -1;
	},

	map: function(o, fn) {
		var arry = [];
		for ( var i = 0; i < o.length; i++ ) 
			arry.push(fn.call(o[i], o[i], i));

		return arry;
	},
	
	// merge two arrays
	merge: function(o, o2){
		var arry = [];
		arry = o.concat(o, o2);	
		return arry;
	},

	// trim head and tail whitespace from strings
	trim: function( text ) {
		return (String(text)).replace( /^\s+|\s+$/g, "" );
	},

	// remap YUI's asyncRequest to jQuery style
	ajax: function(o) {
		var opts = this.extend({
			cache: true,
			data: null,
			type: 'GET',
			url: '/'
		}, o);
		
		if(this.trim(opts.type) === 'GET') {
			if (opts.data)
				opts.url += '?' + opts.data;
		}
		
		var callback = {
			loading: function(o){ opts.loading.call(win, o.responseText); },
			success: function(o){ opts.success.call(win, o.responseText); },
			failure: function(o){ opts.error.call(win, o.responseText); },
			cache: opts.cache
		}
		
		CON.startEvent.subscribe(callback.loading, callback);
		var transaction = CON.asyncRequest(opts.type, opts.url, callback, opts.data); 
	},
	
	
	// A general namespace function, support root as window obj
	namespace: function(name, root) {
		if (name) {
			// explode namespace with delimiter
		    name=name.split(".");
			// root is defaulted to window obj
		    var ns = root || win;
			// loop through each level of the namespace
		    for (var i =0; i<name.length; i++) {
				// nm is current level name
		    	var nm = name[i];
				// if not exist, add current name as obj to parent level, assign ns (parent) to current
				ns = ns[nm] || ( ns[nm] = {} ); 
				
				// this will determine if we have successfully created the namespace
				if (i === name.length-1) 
					return (yS.isObject(ns)) ? true: false;
			}
		}
		return false;
	},
	
	// Public type detection, using Object.prototype.toString.call for ambigous cases
	typeOf: function(o){ return myToString.call(o).slice(8, -1).toLowerCase(); },
	isArray: function(o){ return myToString.call(o) === "[object Array]" },
	isObject: function(o){ return myToString.call(o) === "[object Object]" },
	isDate: function(o){ return myToString.call(o) === "[object Date]" },
	isFunction: function(o) { return typeof o === "function" },
	isString: function(o) { return typeof o === "string" },
	isNumber: function(o){ return typeof o === "number" },
	isBoolean: function(o){ return typeof o === "boolean" },

	// Detecting major browsers using feature detection
	isIE6: function(){ return (doc.body.style.maxHeight === undefined) },
	isIE7: function(){ return (!win.opera && win.XMLHttpRequest && !doc.querySelectorAll) },
	isIE8: function(){ return (!win.opera && win.XMLHttpRequest && doc.querySelectorAll) },
	isIE: !!(win.ActiveXObject && doc.all && !win.opera),
	isGecko: !!!(doc.getBoxObjectFor === undefined),
	isOpera: !!win.opera,
	isWebkit: !!(!win.opera && !nav.taintEnable && doc.evaluate && doc.getBoxObjectFor === undefined)

}); // end yS.extend 
})(); //end anonymous function


// namespaces used in this header
YAHOO.namespace("gaia.util.Dom");
YAHOO.namespace("gaia.app");


/**
* Launch flash games from the header
* provides a means for launching the flash games with parameterized n/v pairs
*/
function header_launcher(obj, srv, sid, params) {
	trim_obj = obj.split("&")[0];
  var gaia_game;


  /**
   *  if you edit here, you also have to edit in /src/js/core.js
   */
  var game_dims_ads = {
      'towns': new Array (740, 580),
      'rally': new Array (740, 580),
      'wordbump': new Array (640, 573),
      'slots': new Array (640, 673),
      'blackjack': new Array (640, 673),
      'arranger': new Array (760, 360),
      'jigsaw': new Array (770, 673),
      'cinema': new Array (740, 670),
      'vj': new Array (740, 675),
      'gameshell': new Array (770, 585),
      'battle': new Array (1068,905),
	  'zomg': new Array (1000,555),
      'prom': new Array (740, 580),
      'olympics2008': new Array (764, 652),
      'olympics2008stadium': new Array (740, 580),
      'default': new Array ( 640, 580 )
   };

  var game_dims = {
      'towns': new Array (740, 580),
      'rally': new Array (740, 580),
      'wordbump': new Array (640, 480),
      'slots': new Array (640, 580),
      'blackjack': new Array (640, 580),
      'arranger': new Array (760, 360),
      'jigsaw': new Array (770, 580),
      'cinema': new Array (740, 670),
      'vj': new Array (740, 675),
      'gameshell': new Array (770, 585),
	  'zomg': new Array (1000,555),
      'battle': new Array (1068,905),
      'prom': new Array (740, 580),
      'olympics2008': new Array (764, 652),
      'olympics2008stadium': new Array (740, 580),
      'default': new Array ( 640, 580 )
   };

	var dims = Array();
  if (game_dims[obj] != null) {
    dims = game_dims[obj];
  } else {
    dims = game_dims['default'];
  }

	// add an & to sid if there is one
	if (sid.length > 0) sid = "&"+sid;
	else sid='';
	
	if (params != null) {
		param_list = "&" + params.replace(/,/g, "&").replace(/:/g, "=");
	} else {
		param_list = "";
	}
  
    var resizable = 'no';
    if ( obj == 'zomg' || obj == 'gameshell' ) resizable='yes';

    gaia_game = window.open( "http://"+srv+"/launch/"+obj+"?"+param_list+sid , trim_obj, "alwaysRaised=yes,toolbar=no,status=no,scrollbars=no,menubar=no,locationbar=no,width="+dims[0]+",height="+dims[1]+",resizable=" + resizable);
    
    if ((!gaia_game) || (gaia_game.closed)) {
        // stopped. do we have flash to notify?
        // send fail to browser
        var message = "";
        message += "We detected that you have a popup blocker"+"\n"+"that is stopping the game from loading."+"\n";
        message += "Please check your browser's settings and try again.";
        alert(message);
    } else {
        gaia_game.focus();
    }

	return false;
};

var sfHover = function() {
	var navIcons = $("navicons");
	if (navIcons) {
		var sfEls = navIcons.getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}

function $(strId) {
    if (typeof strId == "string") {
	    return YAHOO.util.Dom.get(strId);
    }
    return strId;
}

if(typeof Array.prototype.push != "function"){
	Array.prototype.push = function (){
		for(var i=0; i<arguments.length; i++){
        	this[this.length] = arguments[i];
        }
		return this.length;
	}
}

function getElementsByClassName(oElm, strTagName, strClassName){
    var tag_scope = (strTagName == "*") ? null : strTagName;
    return YAHOO.util.Dom.getElementsByClassName(strClassName, tag_scope, oElm);
}


function addClassName(oElm, strClassName){
    return YAHOO.util.Dom.addClass(oElm, strClassName);
}

function removeClassName(oElm, strClassName){
    return YAHOO.util.Dom.removeClass(oElm, strClassName);
}

function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){
    return YAHOO.gaia.util.Dom.getElementsByAttribute(strAttributeName, strAttributeValue, strTagName, oElm);
}

function getStyle(oElm, strCssRule){
	return YAHOO.util.Dom.getStyle(oElm.id.toString(), strCssRule);
}

ELO = {
    functionsToCallOnload: {
        push: function(execute_call) {
            YAHOO.util.Event.onContentReady("wrap", function() { eval(execute_call); });
        }
    }
}

/**
* Migration of Robert Nyman's getElementsByAttribute
* coded for integration with the yahoo UI library
*/
YAHOO.gaia.util.getElementsByAttribute = function(strAttributeName, strAttributeValue, strTagName, oRootElement) {
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
	var oCurrent;
	var oAttribute;
	for(var i=0; i<arrElements.length; i++){
		oCurrent = arrElements[i];
		oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);
		if(typeof oAttribute == "string" && oAttribute.length > 0){
			if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
				arrReturnElements.push(oCurrent);
			}
		}
	}
	return arrReturnElements;
}


/**
* Gaia Online Form Submit Button Replacement
* Used to replace submit buttons with button tags in order
* to support proper stylization in all browsers, including
* Camino and Safari.
*/
YAHOO.gaia.util.Dom.swapSubmit = function() {
    this.replacedEles = new Object();
    
    if (YAHOO.widget.LogWriter) {
        this.logger = new YAHOO.widget.LogWriter("swapSubmit");
    }
    
    this.log("Instance of swapSubmit creaited", "info");
}
YAHOO.gaia.util.Dom.swapSubmit.prototype.log = function(message, level) {
    if (YAHOO.widget.LogWriter) {
        this.logger.log(message, level);
    }
}
YAHOO.gaia.util.Dom.swapSubmit.prototype.replace = function(formid, eleid) {
    var ele = $(eleid);
    
    if (ele == null) {
        this.log("Could not find occurance of "+eleid.toString()+" in DOM", "error");
        return;
    }

	// build thew new element.
	var o = this.build(ele);
		
	// get the parent node.
	var pn = ele.parentNode;
	
	// use a blank span temporarily to save IE from itself.
	// re-added to live code 05.24.07 [kaia] (orig:05.03.07)
	var blank = document.createElement('span');
	pn.appendChild(blank);
	pn.removeChild(ele);
	pn.appendChild(o);
	pn.removeChild(blank);

	/** 
	* old style of replacing the node.
	* replaced with blank span on 05.24.07 [kaia]
	* * * * * * * * * * * * * * * * * * * * * * * *
	* pn.removeChild(ele);
	* pn.appendChild(document.createTextNode(''));
	* pn.appendChild(o);
	*/
	
	// define the values of the replaced element.
	this.replacedEles[eleid]            = new Object();
	this.replacedEles[eleid]['name']    = ele.getAttribute('name');;
	this.replacedEles[eleid]['value']   = ele.getAttribute('value');
	this.replacedEles[eleid]['click']   = ele.getAttribute('onclick');
	this.replacedEles[eleid]['form']    = formid;
	
	this.log("Replaced "+eleid.toString()+" for form "+formid.toString(), "info");
	//window.location = location.href;
}
YAHOO.gaia.util.Dom.swapSubmit.prototype.build = function(ele) {
    
	// create the new element
	var o = document.createElement("button");
    
	// make sure it has the old id and classname.
    o.id = ele.id;
    o.className = ele.className;
	
	// moved the onclick execution to the submitForm function. 05.24.07 [kaia]
    //o.setAttribute("onclick", ele.getAttribute("onclick"));
    
	// add a listener to make it submit the form like a submit button would.
	YAHOO.util.Event.addListener(o, "click", this.submitForm, this);
	
    this.log("Added onclick handler for "+o.id.toString(), "info");
    
    return o;
}
YAHOO.gaia.util.Dom.swapSubmit.prototype.buildInputField = function(name, value) {
    var o = document.createElement("input");

    o.setAttribute("type", "hidden");
    o.id = name;
    o.setAttribute("name", name);
    o.setAttribute("value", value);

    return o;
}
YAHOO.gaia.util.Dom.swapSubmit.prototype.submitForm = function(e, obj) {
    
    if (obj._disabled) {
        return false;
    }
    
    // load the click id and get all the names
    // name = the original form control element's name
    // value = the original value of the original form control
    // form = the form this element belongs to
    var clickId         = this.id;
    var name            = obj.replacedEles[clickId]["name"];
    var value           = obj.replacedEles[clickId]["value"];
    var formid          = obj.replacedEles[clickId]["form"];
    var submit_form     = $(formid);
    obj.log("Submit on form "+formid+" called", "info");
    // add an input field with the proper name and value
    // if there is no form, just bail
    if (!$(formid)) {
        obj.log("There is no form to submit for this button", "info");
    }
    else {
        var o = obj.buildInputField(name, value);
        submit_form.appendChild(o);
        submit_form.submit();
    }
}

YAHOO.gaia.util.Dom.swapSubmit.prototype.disable = function() {
    this._disabled = true;
}
YAHOO.gaia.util.Dom.swapSubmit.prototype.enable = function() {
    this._disabled = false;
}

var GAIA_SwapSubmit = {
	replace: function(formid, eleid) {
        var ss = new YAHOO.gaia.util.Dom.swapSubmit();
        ss.replace(formid, eleid);
	}
};


/**
* Utility for checking / unchecking all items in a form
*/
YAHOO.gaia.util.Dom.checkAll = function(formid, mark) {
    
}

/**
 * Mimics the PHP version of addSlashes. Escapes several potentially dangerous characters
 * single quote '
 * double quote "
 * slash \
 * @author tlynn
 * @param {String} str The unescaped string
 * @return {String} Escaped string
 */
YAHOO.gaia.util.Dom.addSlashes = function(str) {
	var tmp = str.split('');
	var cleanStr = new Array();
	for (var x = 0; x < tmp.length; x++) {
		switch (tmp[x]) {
			/*case String.fromCharCode(0):
				cleanStr.push('\\');
				cleanStr.push(String.fromCharCode(0));
				break;*/
			case "'":
			case '"':
			case '\\':
				cleanStr.push('\\');
				/* break is missing *intentionally* */
			default:
				cleanStr.push(tmp[x]);
				break;
		}
	}
	return cleanStr.join('');
};

var GAIA_FormHandler = {
	checkall: function( formid, mark ) {
		var form = $(formid);
		var nodes = document.getElementsByTagName('input');
		if ( mark=='open' && typeof openrec=='undefined' ) return;
		for ( var i=0; i< nodes.length; i++) {
			if ( nodes[i].getAttribute( 'type' )!='checkbox') continue;
			var value = nodes[i].getAttribute('value');
			if ( mark==true ) nodes[i].setAttribute( 'checked', true );
			else if ( mark=='some' && Math.random() > .5 ) nodes[i].setAttribute( 'checked', true );
			else if ( mark=='open' && openrec[value]==1 ) nodes[i].setAttribute( 'checked', true );
			else {
				nodes[i].setAttribute( 'checked', 0);
				nodes[i].removeAttribute( 'checked' );
			}
		}	
	}
};

var GAIA_Element = {
	show: function( divname ) {
		var _div = $(divname);
		if (_div) {
			_div.style.visibility="visible";
			_div.style.display="block";
		}
	},
	hide: function( divname ) {
		var _div = $(divname);
		if (_div) {
			_div.style.visibility="hidden";
			_div.style.display="none";
		}
	},
	setVisibilities: function( props ) {
		for (elename in props) {
			if (props[elename] == true) {
				this.show(elename);
			}
			else {
				this.hide(elename);
			}
		}
	},
	stopform: function() {
		return false;
	}
};



ELO.functionsToCallOnload.push("if(window.attachEvent) sfHover();");


// this will run a swapsubmit on all input.swapSubmitButton that exist on the page
// both when #content loads, and when the dom has completed (in case of something in the
// footer).  Orig code from Kaia's Moddog.  Does not conflict.
// open scope
(function(){

// creates a function that will swap all input.swapSubmitButton with the gaia util class
var swapSubmitLoader = function(){
    // if there's nothing to swap, return false. prevents conflicts with onDomReady and moddog
    if( !YAHOO.util.Dom.getElementsByClassName('swapSubmitButton', 'input') ) return false;
    
    // create an instance of swap submit
    var SwapSubmit = new YAHOO.gaia.util.Dom.swapSubmit();
    
    // capture the inputs of .swapSubmitButton
    var allbuttons = YAHOO.util.Dom.getElementsByClassName('swapSubmitButton', 'input');
    
    // loop and assign an anon function to each button
    // this is where the replace is
    // this makes one swap submit instance hold onto all swaps for the page
	for( var i=0; i< allbuttons.length; i++) {
        YAHOO.util.Event.onAvailable(allbuttons[i].id, function() {
            var element = document.getElementById( this.id );
            SwapSubmit.replace(element.form.id, this.id);
		}); 
	}
	
	// done
	return true;
}

// add listeners
YAHOO.util.Event.onContentReady('content', swapSubmitLoader);
//YAHOO.util.Event.onContentReady('footer', swapSubmitLoader);
})(); // end scope



(function() {
    var loc = window.location;
    var server = loc.hostname.toLowerCase();
    var redirect = false;

    switch(server) {
      case GAIA_config('login_server'):
      case GAIA_config('main_server'):
      break;

      case 'avatarsave.gaiaonline.com':
        /* only redirect if you're not saving/deleting an avatar */
        if (loc.pathname.match('/avatar/save') == null &&
            loc.pathname.match('/profile/inventory.php') == null &&
            loc.pathname.match('/register/html/') == null) {
          redirect = true;
        }
      break;

      default:
        redirect = true;
      break;
    }

    if (redirect) {
      window.location = loc.protocol + '//' + GAIA_config('main_server') + loc.pathname + loc.search + loc.hash;
    }
})();

/* namespaces used in Gaia. Migrate header.js into this file eventually. */

YAHOO.namespace("gaia.app");
YAHOO.namespace("gaia.widgets");
YAHOO.namespace("gaia.event");
YAHOO.namespace("gaia.login");
YAHOO.namespace("gaia.facebookRegistration");

/**
 * YAHOO.gaia.widgets.ErrorDisplay returns a skinned YUI panel with which to display error messages
 *
 * @param _errorPanel YUI panel object
 * @param _isHidden tracks the state of the panel display
 * @param _render set to false until the panel is rendered
 * @param _footerContent footer content to be passed into the panel footer
 * @return changeMsg
 * @return hide
 * @return panel
 * @return show
 */
YAHOO.gaia.widgets.ErrorDisplay = (function(){

	var _errorMessage = ["D'OH!","Whoops!"],
		_errorPanel = new YAHOO.widget.Panel("errorDisplayPanel", {
			effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.3},
			width:"300px",
			fixedcenter: true,
			constraintoviewport: true,
			underlay:"shadow",
			close:false,
			visible:false,
			modal:false,
			zIndex:400} ),
		_isHidden = true,
		_rnd = Math.floor(Math.random()*2),
		_render = false;

	/**
	 * Build the header message using the a random number to change the error message title.
	 */
	function _buildHeader(){
		var rnd = _generateRandomNum();
		return '<h3 class="errorMsg' + rnd + '"><span>' + _errorMessage[rnd] + '</span></h3>';
	}

	/**
	 * Build the contents of the error message panel
	 *
	 * @param msg the error message passed into the function to be displayed in the panel
	 */
	var _buildPanel = function(msg) {
		msg = msg || "";

		_errorPanel.setHeader(_buildHeader());
		_errorPanel.setBody(msg);

		var _footerContent = '<img src="http://' + GAIA_config("graphics_server") + '/images/gaia_global/body/buttons/bn_continue.gif" onclick="YAHOO.gaia.widgets.ErrorDisplay.hide();" title="Close" alt="Close" />';

		_errorPanel.setFooter(_footerContent);
		_errorPanel.render("gaia_header");
	}

	/**
	 * Return a random number for the error message header
	 */
	function _generateRandomNum(){
		return	Math.floor(Math.random()*2);
	}

	return {
		changeMsg: function(msg){
			if (_render && !_isHidden){
				this.hide();
				_errorPanel.hideEvent.subscribe(function(){
					_errorPanel.setHeader(_buildHeader());
					_errorPanel.setBody(msg);
					_errorPanel.show();
					_errorPanel.hideEvent.unsubscribeAll();
					_isHidden = false;
				});
			}
			else{
				this.show(msg);
			}
		},
		hide: function(){
			_errorPanel.hide();
			_isHidden = true;
		},
		panel: function(){
			return _errorPanel;
		},
		show: function(msg){
			if(!_render){
				_buildPanel(msg);
				_errorPanel.show();
			}
			else{
				_errorPanel.setBody(msg);
				_errorPanel.show();
			}
			_isHidden = false;
		}
	};

})();

/**
 * YAHOO.gaia.widgets.AlertDisplay returns a skinned YUI panel with which to display alert messages
 *
 * @param msg the alert message/HTML passed into the function to be displayed in the panel
 * @param _alertPanel YUI panel object
 * @param _footerContent footer content to be passed into the panel footer
 * @param _isHidden tracks the state of the panel display
 * @param _render set to false until the panel is rendered
 * @return changeMsg
 * @return hide
 * @return panel
 * @return show
 */
YAHOO.gaia.widgets.AlertDisplay = (function(){

	var _alertPanel = new YAHOO.widget.Panel("alertDisplayPanel", {
		effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.3},
		width:"300px",
		fixedcenter: true,
		constraintoviewport: true,
		underlay:"none",
		close:false,
		visible:false,
		modal:true,
		zIndex:400} ),
		_isHidden = true,
		_render = false;

	/**
	 * Build the contents of the error message panel
	 *
	 * @param msg the error message passed into the function to be displayed in the panel
	 */
	var _buildPanel = function(msg) {
		msg = msg || "";

		_alertPanel.setHeader('<span class="container-close" onclick="YAHOO.gaia.widgets.AlertDisplay.hide();"></span>');
		_alertPanel.setBody(msg);
		_alertPanel.render("gaia_header");

		_render = true;
	}

	return {
		changeMsg: function(msg){
			if (_render && !_isHidden){
				this.hide();
				_alertPanel.hideEvent.subscribe(function(){
					_alertPanel.setBody(msg);
					_alertPanel.show();
					_alertPanel.hideEvent.unsubscribeAll();
					_isHidden = false;
				});
			}
			else{
				this.show(msg);
			}
		},
		hide: function(){
			_alertPanel.hide();
			_isHidden = true;
		},
		panel: function(){
			return _alertPanel;
		},
		show: function(msg){
			if(!_render){
				_buildPanel(msg);
				_alertPanel.show();
			}
			else{
				_alertPanel.setBody(msg);
				_alertPanel.show();
			}
			_isHidden = false;
		}
	};

})();


/**
 * Header namespace attaches onAvailabe when gaia_header is loaded. It runs all functionality for the
 * header including: drop down menuing, world map animation, daily reward AJAX
 *
 * @param _attachFlashData passes back params for the popup window size and game to be played
 * @param _cacheValue random cachebust number for just in time loading of CSS and JS
 * @param _graphicServer current graphic server returned from function GAIA_config
 * @param _mainServer current server returned from function GAIA_config
 * @param _newWin popup window object to be set for flash components
 * @param _rewardPrecache image precache information to help IE6 image loading on daily chance
 * @return init
 */
YAHOO.gaia.app.Header = (function(){
	//private shorthand references to YUI utilities:
	var EVENT = YAHOO.util.Event,
	DOM = YAHOO.util.Dom,
	MENUBAR = YAHOO.widget.MenuBar,
	MODULE = YAHOO.widget.Module,
	GET = YAHOO.util.Get;

	//private variables

	/**
	 *  if you edit here, you also have to edit in /js/common/header.js
	 */
	var _attachFlashData = {
			"gaia_menuitem_zomg":[1000, 555,"zomg",''],
			"gaia_menuitem_jigsaw":[770, 585,"gameshell",'&game=jigsaw'],
			"gaia_menuitem_slots":[640, 580,"slots",''],
			"gaia_menuitem_rally":[740, 580,"rally",''],
			"gaia_menuitem_blackjack":[640, 580,"blackjack",''],
			"gaia_menuitem_wordbump":[640, 480,"wordbump",''],
			"gaia_menuitem_fishing":[640, 580,"fishing",''],
			"gaia_menuitem_fishing_bassken":[640, 580,"fishing",'&l=bassken'],
			"gaia_menuitem_fishing_durem":[640, 580,"fishing",'&l=durem'],
			"gaia_menuitem_fishing_gambino":[640, 580,"fishing",'&l=gambino'],
    		"gaia_menuitem_towns":[740, 580,"towns",''],
			"gaia_menuitem_gameshell":[770, 585,"gameshell",'&game=gPinball'],
			"gaia_menuitem_mallcop":[740, 580,"mallcop",''],
			"gaia_menuitem_kfp":[740, 580,"kfp",''],
			"gaia_menuitem_mtv":[740, 580,"mtv",''],
            "gaia_menuitem_mtv2":[740, 580,"mtv",''],
            "gaia_menuitem_venus":[740, 580,"venus",''],
			"gaia_menuitem_skittles2009":[740, 580,"skittles2009",''],
            "gaia_menuitem_madagascar":[740, 580,"madagascar",''],
      "gaia_menuitem_elf":[770, 585,"gameshell",'&game=electricLoveFaktori']
		},
		_cacheValue = GAIA_config('cache_value'),
		_graphicServer = GAIA_config('graphics_server'),
		_mainServer = GAIA_config('main_server'),
		_newWin,
		_reload = false,
		_rewardPreCache = {};

	/**
	 *  Attach pop-up window events to those that launch Flash interactive windows
	 */
	function _doAttachMenuClick() {
        for (ids in _attachFlashData){
            EVENT.addListener(ids, "click", _doLaunchFlashWindow, {"data":_attachFlashData[ids]});
            //var allelements =  document.getElementById(ids);
            //if (allelements) EVENT.addListener(allelements, "click", _doLaunchFlashWindow, {"data":_attachFlashData[ids]});

            var allelements_class = DOM.getElementsByClassName(ids);
            if (allelements_class) EVENT.addListener(allelements_class, "click", _doLaunchFlashWindow, {"data":_attachFlashData[ids]}); 
        }
	}

	/**
	 *  Attach the map browser event to the world map
	 */
	function _doAttachMapBrowser() {
		EVENT.addListener("worldMap", "click",
			function(e) {
				EVENT.preventDefault(e);
				var server = _graphicServer,
					event_url = this,
					cacheBust = _cacheValue;

				var failureHandler = function(){
					window.location.href = event_url;
				};

				var successHandler = function(){

					GET.script(("http://" + server + "/src/js/header/mapBrowser.js?" + cacheBust),{
										   onSuccess: function(){
										   		EVENT.removeListener("worldMap", "click");
												YAHOO.gaia.app.MapBrowser.init();
										   },
										   onFailure: failureHandler
										  });

				};

				var dailyChanceCSS = YAHOO.util.Get.css(("http://" + server + "/src/css/header/mapBrowser.css?" + cacheBust),
														{ onSuccess: successHandler,
														  onFailure: failureHandler
														});
			}
		);
	}

	/**
	 *  Attach Daily Reward click AJAX call to the image assets. Check first to see if the ID "dailyReward" is in the document.
	 */
	function _doAttachRewardClick() {
		if (DOM.inDocument("dailyReward")) {
			_doImagePreCache();
			reload = _reload;
			// we don't want them double-clicking this...
			EVENT.addListener("dailyChance_clawMachine", "dblclick",
				function(e) {
					EVENT.preventDefault(e);
					return false;
				});
			EVENT.addListener("dailyChance_clawMachine", "click",
				function(e) {
					EVENT.preventDefault(e);
					// did we already click on this? If not, draw a hidden <div> to show we did...
					if ( ! document.getElementById("dailyRewardClick") ) {
						var targetDiv = document.getElementById('dailyReward');
						var newDiv = document.createElement('div');
						newDiv.setAttribute('id', 'dailyRewardClick');
						DOM.setStyle(newDiv,'display','none');
						DOM.insertAfter(newDiv, 'dailyReward');
						}
					// second (or however-many-th) click; just exit. The postman never rings twice...
					else {
						return false;
						}
					var server = _graphicServer,
						event_url = this,
						cacheBust = _cacheValue;

					var failureHandler = function(){
						window.location.href = event_url;
					};
					var successHandler = function(){
						GET.script(("http://" + server + "/src/js/header/dailyChance.js?" + cacheBust),{
											   onSuccess: function(){
													YAHOO.gaia.app.DailyChance.init(reload,_rewardPreCache);
											   },
											   onFailure: failureHandler
											  });

					};
					var dailyChanceCSS = GET.css(("http://" + server + "/src/css/header/dailyChance.css?" + cacheBust),
															{ onSuccess: successHandler,
															  onFailure: failureHandler
															});
				}
			);
		}
	}

	/**
	 *  Precache the background images for the daily reward
	 */
	function _doImagePreCache() {
		_rewardPreCache.dailyRewardBorderHeader = new Image();
		_rewardPreCache.dailyRewardBorderHeader.src = "http://" + _graphicServer + "/images/dailycandy/border-top.png";
		_rewardPreCache.dailyRewardBorderFooter = new Image();
		_rewardPreCache.dailyRewardBorderFooter.src = "http://" + _graphicServer + "/images/dailycandy/border-bottom.png";
		_rewardPreCache.dailyRewardBorderLeft = new Image();
		_rewardPreCache.dailyRewardBorderLeft.src = "http://" + _graphicServer + "/images/dailycandy/border-left.png";
		_rewardPreCache.dailyRewardBorderRight = new Image();
		_rewardPreCache.dailyRewardBorderRight.src = "http://" + _graphicServer + "/images/dailycandy/border-right.png";
	}

	/**
	 *  Attach pop-up window events to those that launch Flash interactive windows
	 *
	 * @param e the window event passed back to the function
	 * @param oData is the _attachFlashData to build a query string for the flash
	 */
	function _doLaunchFlashWindow(e,oData) {
		var data = oData.data;
		var target = EVENT.getTarget(e);
		/**
		 * this is temporary and ugly like ramoneguru
		 * if you click a game submenu it bubbles up to the parent
		 * no good. we need to short-circuit that for now
		 */
		try {
			if (target.id != this.id && target.parentNode.id != this.id) {
				return;
			}
		} catch(e) {}
		EVENT.stopEvent(e);

		var resizable = 'no';
		if (data[2] == 'zomg' || data[2] == 'gameshell') {
			resizable = 'yes';
		}

        // link embedded in the page
         if (this.href && (this.href.indexOf("http") == 0)) {
		    _newWin = window.open( this.href,data[2],"alwaysRaised=yes,toolbar=no,status=no,scrollbars=no,menubar=no,locationbar=no,width="+data[0]+",height="+data[1]+",resizable="+resizable);
         }
                // pull-down menu item
        else {
		    _newWin = window.open( "http://"+_mainServer+"/launch/"+data[2]+"?"+data[3],data[2],"alwaysRaised=yes,toolbar=no,status=no,scrollbars=no,menubar=no,locationbar=no,width="+data[0]+",height="+data[1]+",resizable="+resizable);
        }

		if ((!_newWin) || (_newWin.closed)) {
			// stopped. do we have flash to notify?
			// send fail to browser
			var message = "";
			message += "We detected that you have a popup blocker"+"\n"+"that is stopping the game from loading."+"\n";
			message += "Please check your browser's settings and try again.";
			alert(message);
		} else {
			_newWin.focus();
		}
	}

	/**
	 *  Render the drop-down menu bar
	 *
	 * @param navMenu the YUI menubar
	 */
	function _doMenuBar(){
		// initialize the resize monitor, attaching it to the gaia header (if one doesn't exist yet)
		var resizeMonitor = new MODULE().initResizeMonitor('gaia_header');
		var navMenu = new MENUBAR("gaia_menu", { autosubmenudisplay:true, hidedelay:750, lazyload:true, zindex:400});
		navMenu.render();
	}
	
	
	return {
		init: function() {
			_doMenuBar();
			_doAttachMenuClick();
			_doAttachRewardClick();
			_doAttachMapBrowser();					
		}
	}; // end return
})();

YAHOO.util.Event.onContentReady('gaia_header',YAHOO.gaia.app.Header.init);

/**
 * Automatically creates a toolPanel, toolTip or balloon callout, depending
 * on classnames used.
 * @usage See the wiki!
 */
YAHOO.gaia.widgets.ToolPanel = function() {
	var instances = [],
		Dom = YAHOO.util.Dom,
		Event = YAHOO.util.Event,
		panel = {},
		clicked = {},
		panelEffect = {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},
		tooltips = [],
		tooltipElems = [],
		callouts = [],
		calloutElems = [];

  var config = {
      'root': document,
      'preventDefault': false,
      'autodismissdelay': 10 * 1000
  };

	/**
	 * Instantiates a new panel instance with the desired effects
	 */
	var createPanel = function() {
		return new YAHOO.widget.Panel(Dom.generateId(), {
			close : false,
			visible : false,
			effect : panelEffect,
			constraintoviewport : false,
			draggable : false
		});
	};
	/**
	 * Creates a new tooltip instance
	 * @param el {String,Object} The ID as a string, or dom node we're using to create the tooltip
	 * @param context {String,Object} The ID as a string, or dom node that the tooltip is attached to
	 */
	var createTooltip = function(el,context) {
		var delay = (context.delay != null) ? context.delay : 750;

    var panelConfig = {
				context: context,
				preventoverlap: true,
				showdelay: delay,
				autodismissdelay: config.autodismissdelay,
				effect: panelEffect,
				zIndex: 210
		};

		if (context._orientation) {
			  panelConfig['constraintoviewport'] = false;
		}

    var props = ['container', 'width'];
    for (prop in props) {
      var key = props[prop];
      if (config[key] != undefined) {
        panelConfig[key] = config[key];
      }
    }

    return new YAHOO.widget.Tooltip(el, panelConfig);

	};
	/**
	 * Moves the panel to the proper position, taking into account its
	 * height and width.
	 */
	var setPosition = function(thePanel,context) {
		var region = Dom.getRegion(thePanel.element);
		var panelWidth = region.right - region.left;
		var panelHeight = region.bottom - region.top;
        
        // force region refresh so the tooltip position reflects any scrolling
        context.region = Dom.getRegion(context);
        
		switch (context._orientation) {
			case 'o1':
				var x = context.region.right - panelWidth;
				var y = context.region.bottom;
				break;
			case 'o2':
				var x = context.region.left - panelWidth;
				var y = context.region.top;
				break;
			case 'o3':
				var x = context.region.left - panelWidth;
				var y = context.region.bottom - panelHeight;
				break;
			case 'o4':
				var x = context.region.right - panelWidth;
				var y = context.region.top - panelHeight;
				break;
			case 'o5':
				var x = context.region.left;
				var y = context.region.top - panelHeight;
				break;
			case 'o6':
				var x = context.region.right;
				var y = context.region.bottom - panelHeight;
				break;
			case 'o7':
				var x = context.region.right;
				var y = context.region.top;
				break;
			case 'o8':
			default:
				var x = context.region.left;
				var y = context.region.bottom;
				break;
		}
		thePanel.cfg.setProperty('xy',[x,y]);
	};
	/**
	 * Adjusts the position of the tooltip and applies the proper classname for arrow orientation
	 */
	var adjustPosition = function(type, args, elems){
		var tt = elems.tooltip.element;
		var context = elems.context;
		var orientation = context._orientation;
		if (orientation) {
			return setPosition(elems.tooltip,context);
		}
		// Tooltip is above the context element
		if(Dom.getY(tt) < Dom.getY(context)){
			Dom.replaceClass(tt,'o8','o5');
			Dom.setY(tt, Dom.getY(context) - tt.offsetHeight);
		}
		// Tooltip is under the context element
		else{
			Dom.replaceClass(tt,'o5','o8');
			Dom.setY(tt, Dom.getY(context) + context.offsetHeight);
		}
		// Set static position relative to context
		Dom.setX(tt, Dom.getX(context));
	};
	/**
	 * Handles the hiding/showing of the panel
	 */
	var _onclick = function(evt,obj) {
		var prevClicked = obj.getClicked();
		var panel = obj.getPanel();

		if (prevClicked && (this != prevClicked) && panel._showing) {
			obj.hide();
		}
		obj.setClicked(this);

		/* Cancel propagation on anchors */
    var tag = this.tagName.toLowerCase();
		if (tag == 'a') {
			Event.stopEvent(evt);
    }

		if (panel._showing) {
			obj.hide();
		} else {
			if (tag != 'input') {
				obj.show();
			} else if ((tag == 'input') && this.checked) {
				obj.show();
			}
		}
	};
	return {
		adjustPos : function(type, args, elems) {
			adjustPosition(type, args, elems);
		},
		/* Returns the target that was clicked */
		getClicked : function() {
			return clicked;
		},
		/* Checks if the delay was specified as a classname on the anchor */
		getDelay : function(el) {
			var classnames = el.className,
				check = /delay-([0-9]*)\b/,
				result = classnames.match(check);
			if (result) {
				result = result[1] * 1;
			}
			return result;
		},
		/**
		 * Determines which of the 8 orientation classes is applied, if any. It
		 * will automatically return o8 if no class was defined, unless you set
		 * noDefault to true.
		 */
		getOrientationClass : function(el,noDefault) {
			var classnames = el.className;
			var orientation = (!noDefault) ? 'o8' : false;
			classnames = classnames.split(' ');
			for (var y = 0; y < classnames.length; y++) {
				if (/o[1-8]/.test(classnames[y])) {
					orientation = classnames[y];
				}
			}
			return orientation;
		},
		/* Returns the panel instance */
		getPanel : function() {
			return panel;
		},
		/* handles hiding/destroying the panel instance */
		hide : function() {
      if ( (panel._showing == null) || (panel._showing == false) ) {
        return;
      }

			panel.hide();
			panel._showing = false;
			clicked.title = panel._content;
			panel.destroy();
			Dom.removeClass(panel.innerElement,clicked._orientation);
		},
		/* Used to add acccessAid class to the balloon content */
		hideBalloons : function() {
		  var elems = Dom.getElementsByClassName('balloonCallout', null, config.root);
			for (var x = 0; x < elems.length; x++) {
				Dom.addClass(elems[x],'accessAid');
			}
		},
		/* Starts the show */
		init : function() {
			this.initPanels();
			this.initTooltips();
			this.initBalloons();
		},
		/* Handles initialization of toolPanels */
		initPanels : function() {
			instances = Dom.getElementsByClassName('autoToolPanel');
			if (!instances.length) {
				return false;
			}
			var instance = null;
			for (var x = 0; x < instances.length; x++) {
				instance = instances[x];
				if (!instance.title) {
					continue;
				}
				instance.region = Dom.getRegion(instance);
				instance._orientation = this.getOrientationClass(instance);
				Event.addListener(instance,'click',_onclick,this);
			}
		},
		/* Handles initialization of tooltips */
		initTooltips : function() {
			var tooltipElems = Dom.getElementsByClassName("autoTooltip", null, document);
			for(var i = 0; i < tooltipElems.length; i++){
                tooltipElems[i].region = Dom.getRegion(tooltipElems[i]);
                tooltipElems[i]._orientation = this.getOrientationClass(tooltipElems[i]);
            	  tooltipElems[i].delay = this.getDelay(tooltipElems[i]);
                var orientVal = tooltipElems[i]._orientation;

				tooltips[i] = createTooltip('autoTooltip'+i,tooltipElems[i]);
				tooltips[i].beforeShowEvent.subscribe(adjustPosition, { context: tooltipElems[i], tooltip: tooltips[i] });
				Dom.addClass(tooltips[i].element,'autoTooltip ' + orientVal);
			}
		},
		/* Handles initialization of ballooncallouts */
		initBalloons : function() {
		  var anchors = Dom.getElementsByClassName("balloonControl", "a", config.root);
			if (!anchors.length) {
				return false;
			}
			var id = '';
			var	el = null;
			var body = null;
			var theAnchor = null;
			var callout = null;
			for(var i = 0; i < anchors.length; i++){
				theAnchor = anchors[i];
        if (config.preventDefault) {
            Event.addListener(theAnchor, 'click', function(e) { Event.preventDefault(e); }, this);
        }
				id = theAnchor.href;
				if(id.indexOf("#") > -1){
					id = id.split("#")[1];
					el = document.getElementById(id);
					if(el){
						theAnchor._orientation = this.getOrientationClass(theAnchor,true);
						theAnchor.region = Dom.getRegion(theAnchor);
						theAnchor.delay = this.getDelay(theAnchor);
					  body = Dom.getElementsByClassName("bd", "div", el);
						if(body.length > 0){
							body = body[0].innerHTML;
						}
						else{
							body = null;
						}
						callout = createTooltip(el,theAnchor);
						callout.contextTriggerEvent.subscribe(adjustPosition, { context: theAnchor, tooltip: callout });
						if(body){
							callout.setBody(body);
						}
						if (theAnchor._orientation) {
							Dom.addClass(callout.element,theAnchor._orientation);
						}
						Dom.removeClass(callout.element,'accessAid');
						callouts[i] = callout;
					}
				}
			}
		},
		/* Used to set which panel target was clicked */
		setClicked : function(obj) {
			clicked = obj;
		},
		/* Creation/showing of toolpanel */
		show : function() {
			panel = createPanel();
			Dom.addClass(panel.innerElement,'toolPanel');
			panel._showing = true;
			panel._content = clicked.title;
			clicked.title = '';
			var closer = '<div class="closer" onclick="YAHOO.gaia.widgets.ToolPanel.hide()">&nbsp;</div>';
			panel.setBody(closer + panel._content);
			panel.render(document.body);
			Dom.addClass(panel.innerElement,clicked._orientation);
			setPosition(panel,clicked);
			panel.show();
		},

    setConfig: function(o) {
      for(val in o) {
        config[val] = o[val];
      }
    }
	}
}();
YAHOO.util.Event.onDOMReady(function(){YAHOO.gaia.widgets.ToolPanel.hideBalloons();});
YAHOO.util.Event.addListener(window,'load',function() {YAHOO.gaia.widgets.ToolPanel.init();});

/**
 * Tab Navigation Widget
 * loads on page, scans for specific class + div combinations
 **/
(function() {
var EVENT = YAHOO.util.Event,
DOM = YAHOO.util.Dom,
MENU = YAHOO.widget.Menu,
MODULE = YAHOO.widget.Module,
GET = YAHOO.util.Get;

/**
 * Have to wait until onload to do this. Safari wasn't playing
 * nice with the menu position when we tried onDOMReady. Re-
 * visit when YUI Menu has been corrected
 */
EVENT.on(window,'load',function() {
    // need a resize monitor, like header. it should already exist
    var resizeMonitor = new MODULE().initResizeMonitor('gaia_header');

	// makes the down arrow dropdown link and adds it to the page
    var makeDropDownButton = function(menu, config, menu_node_id) {
        var a = document.createElement('a');
        a.href = "#";
        DOM.addClass(a, 'yuimenu_trigger');

		var timer = null;

        EVENT.addListener(a, 'mouseover', function(e) {
            EVENT.stopEvent(e);
            menu.render();
            menu.show();
        });

        EVENT.addListener(a, 'mouseout', function(e) {
            // start a timer
			if (config.hidedelay) {
				timer = window.setTimeout(function() {
					menu.hide();
				}, config.hidedelay);
			}
        });

		EVENT.addListener(a, 'mouseover', function(e) {
			window.clearTimeout(timer);
			timer = null;
		});

		EVENT.addListener(menu_node_id, 'mouseover', function(e) {
			window.clearTimeout(timer);
			timer = null;
		});

        EVENT.addListener(a, 'mouseover', function(e) {
            DOM.addClass(a.parentNode, 'menu_over');
        });

        EVENT.addListener(a, 'mouseout', function(e) {
            DOM.removeClass(a.parentNode, 'menu_over');
        });

        a.appendChild(document.createTextNode("more"));

        return a;
    };

	// hides all submenus when one submenu is hidden
    var hideAllSubmenus = function(except) {
        for (mname in menus) if (menus.hasOwnProperty(mname)) {
            if (mname == except) {
                continue;
            }
            menus[mname].hide();
	        DOM.removeClass(DOM.get(mname).parentNode, 'menu_enabled');
	        DOM.removeClass(DOM.get(mname).parentNode, 'menu_over');
        }
    };

	// menu show event handler
    var onMenuShow = function(type, args) {
        if (acting) {
            return;
        }

        acting = true;
        DOM.addClass(DOM.get(this.id).parentNode, 'menu_enabled');
        hideAllSubmenus(this.id);
        acting = false;
    };

	// menu hide event handler
    var onMenuHide = function(type, args) {
        if (acting) {
            return;
        }

        acting = true;
        DOM.removeClass(DOM.get(this.id).parentNode, 'menu_enabled');
        DOM.removeClass(DOM.get(this.id).parentNode, 'menu_over');
        hideAllSubmenus(this.id);
        acting = false;
    };

	// find all nodes set to become menus
    var finds = DOM.getElementsByClassName('gaia_tab_menu_structure', 'div');
    var finds_length = finds.length;

    if (!finds_length) {
        return;
    }

	// vars
    var menus = {};
    var acting = false;

    // everything needs an ID to make scanning faster
    for (var i = 0; i < finds_length; i++) {
        if (!finds[i].id) {
            finds[i].id = DOM.generateId();
        }

		// now collect all of the nodes that would be submenus
        var nodes = DOM.getElementsByClassName('yuimenu', 'div', finds[i].id);
        var nodes_length = nodes.length;

		// for each node, make sure it has an ID, and then enable a menu on it
        for (var j = 0; j < nodes_length; j++) {
            if (!nodes[j].id) {
                nodes[j].id = DOM.generateId();
            }

            var reg = DOM.getRegion(nodes[j].parentNode);
			var pos = [reg.left,reg.bottom];
            var config = {
                autosubmenudisplay: true,
                hidedelay: 750,
                lazyload: true,
                zindex: 405,
                position: 'dynamic',
                xy: pos,
				constraintoviewport:false
            }

			// attach listeners
            var myGaiaMenu = new MENU(nodes[j].id, config);
			myGaiaMenu.render();
            myGaiaMenu.subscribe('show', onMenuShow);
            myGaiaMenu.subscribe('hide', onMenuHide);

            // store for operations
            menus[nodes[j].id] = myGaiaMenu;

            // attach an A to the parent node
            var a = makeDropDownButton(myGaiaMenu, config, nodes[j].id);
            nodes[j].parentNode.insertBefore(a, nodes[j]);
        }
    }
});

})(); // end anon


(function($){

	YAHOO.gaia.widgets.ShowItem = function(item_id, tracking_id){
		// in Javascript language means, use tracking_id is exists, else use 1734 as tracking_id
		tracking_id = tracking_id || 1734;

		$('<img src ="/internal/mkt_t.php?mid='+tracking_id + '&t='+(new Date()).getTime() +'" />');
		
		
		var success = function(o){
			try{ o = eval(o); } catch(e){}

			if (o.item_id)
			{
				YAHOO.gaia.app.CashShop.SenderApplication.show({
					tracked: true,
					store: 18,
					origin: 'landing',
					goto_item: {
						item_id: o.item_id,
						item_nonce: o.nonce,
						thumbnail: o.thumbfile,
						gpass: o.gpass,
						gold: o.gold,
						name: o.name,
						contains: o.contains
					}
				});
			}
			else {			
				failure();
			}

		}

		var failure = function(){

			YAHOO.gaia.app.CashShop.SenderApplication.show({
				tracked: true,
				store: 18,
				origin: 'landing'
			});
		}

		$.ajax({
			url: '/api/v1/item/get/'+item_id,
			success: success,
			error: failure
		});
				
	}


	$(function(){
		// 0 or 1
		var rand=Math.floor(Math.random()*2),
			$btn = $("#gaia_header .header_content div.needGold");

		$btn.css('display', 'block');

		if (rand) {
			$btn.addClass('needCash');
			$("#gaia_header .header_content div.needGold a").attr('href','/info/gold/gcash');
		}
	});


})(YAHOO.util.Short); // end anon


YAHOO.namespace("gaia.widgets");

(function(){
	// true will log to firebug, false will not
	var debug = false;		  
	
	// our mini logger
	var firebug = function(strOrObj) {
		if (debug)
			try{ console.log(strOrObj); } catch(e){};
	}
	// local vars in anonymous function, byte saving feature and sheilding from conflict
	var EVENT = YAHOO.util.Event; 
	var DOM = YAHOO.util.Dom;
	
	EVENT.onDOMReady(function(){

		YAHOO.gaia.widgets.getIM = function(str){
			var $ = this;
			this.callback = {
				success: function(o){ 
					$.name = o.responseText;
					firebug(o); 
					$.success(); 
				},
				failure: function(o){
					firebug(o); 
					$.failure();
				}
			}

			$.success = function(){
				firebug("IM name successfully gotten");
				$.name= $.name.replace(/^\s*(.*?)\s*$/,"$1");
				if ($.name.length>0)
				{
					if(!window.global_launcher){
						$.failure();
					}
					global_launcher.launchUser($.name, true);
				}
				else {
					$.failure();
				}
			}

			$.failure = function(){
				firebug("IM name failure");
				gim_launcher.listLaunch();
			}

			YAHOO.util.Connect.asyncRequest('GET', '/get/im?userid='+str, $.callback, null);
		}

	});

})();//anon



(function($, Y){ // start anonymous function / closure

// local vars that can be shared amongst our friendly functions
    var $dropdowns, $dropbox, $trigger, $menu, cur_id, cur_obj, cache={}, $pushbox, headshotEvents, statusbarEvents, timer, $current, $img, $img2, $imgftr;

// onDOMready check if dropdown-ready avatar exists
$(function(){

	$dropdowns = $('.avatarImage'),
	$pushbox = $('.pushBox');

	if($dropdowns.length || $pushbox.length)
		YAHOO.gaia.app.dropdown();

    // inserting some useful menu html into the page
    $img = $('<img src="http://'+GAIA_config('graphics_server')+'/images/template/dropdown/ajax-loader.gif" style="display:none; position:absolute; z-index:501" width="50" height="50" />').appendTo(document.body);
    $imgftr = $('<img src="http://'+GAIA_config('graphics_server')+'/images/template/dropdown/ajax-loader.gif" style="display:none; position:absolute; z-index:501" width="20" height="30" />').appendTo(document.body);
    headshotEvents();
	


	if ($pushbox.length) {
		$img2 = $('<img src="http://'+GAIA_config('graphics_server')+'/images/template/dropdown/ajax-loader2.gif" style="display:none; position:absolute; z-index:501" width="105" height="21" />').appendTo(document.body);
		statusbarEvents();
	}
}); // end onDOMready

YAHOO.namespace('gaia.app');

// will only run when dropdown 'trigger' is discovered
YAHOO.gaia.app.dropdown = function() {

	// inserting some useful menu html into the page
    if(typeof($trigger) == "undefined")
	$dropbox = $('<div id="avatar_dropbox"><div id="trigger">&nbsp;</div></div>').appendTo(document.body);
	$trigger = $('#trigger');
	$menu = $('<ul id="avatar_menu"></ul>').appendTo(document.body);

	// this function populates the menu bitch
	var populate = function(o){
		// construct the menu's html
		var str = '<li><a href="/profiles/'+o.id+'/?_gaia_t_=718" title="View '+o.username+'\'s Profile">Profile</a></li><li id="jointhem"><a title="Join '+o.username+'" href="/get/location?userid='+o.id+'&_gaia_t_=720">Join Them</a></li><li id="journalentry"><a href="/journal/journal.php?mode=view&u='+o.id+'&_gaia_t_=722">Journal</a></li><li id="addfriend"><a title="Add '+o.username+' as friend" onclick="YAHOO.gaia.widgets.addFriend.click(event)" href="/friends/add/'+o.id+'?_gaia_t_=724">Add as Friend</a></li><li class="menu_seperator">&nbsp;</li><li id="sendpm"><a href="/profile/privmsg.php?mode=post&u='+o.id+'&_gaia_t_=726">Send PM</a></li><li id="sendtext"><a href="/textmessage?recipient_id='+o.id+'&_gaia_t_=866" title="Send Text Message">Send Text</a></li><li id="sendim"><a href="javascript:YAHOO.gaia.widgets.getIM(\''+o.id+'\');">Send IM</a></li><li id="sendline" class="menu_seperator">&nbsp;</li><li id="trade"><a href="/gaia/bank.php?mode=trade&uid='+o.id+'&_gaia_t_=728">Trade</a></li><li><a id="buyGift" title="Buy a gift for '+o.username+'" href="javascript:YAHOO.gaia.app.CashShop.SenderApplication.show({store: 18, origin: \'pulldown\', target: { user_id: '+o.id+', username: \''+o.username+'\'} });">Buy a Gift</a></li><li><a title="View '+o.username+'\'s Item" href="javascript:YAHOO.gaia.apps.ei.getItemList('+o.id+');">View Equipped List</a></li><li id="website"><a title="Visit '+o.username+'\'s Website" class="www" target="_userwww" href="/gaia/redirect.php?r='+o.website+'&_gaia_t_=730">My website</a></li><li class="menu_seperator" id="ignoreline">&nbsp;</li><li id="ignore"><a title="Ignore '+o.username+'" href="/profile/friendlist.php?hook='+o.id+'&_gaia_t_=724">Ignore</a></li><li class="menu_seperator" id="toolsline">&nbsp;</li><li id="mtools"><a title="Moddog Tools" href="/moddog/note/?go=Search&searchstr='+o.id+'&searchby=user&_gaia_t_=734">Moddog Tools</a></li><li id="ptools"><a title="Profile Tools" href="/admin/mod_user.php?u='+o.id+'&page=&_gaia_t_=736">Profile Tools</a></li>';
		// populate the menu with the html
		$menu.html(str);

		// test for cashshop presence
		var test = null;

		try	{ test = YAHOO.gaia.app.CashShop.SenderApplication.show } catch (e){ test = null;}
		
		// go to market landing is cashshop is not there
		if(!test)
			$('#buyGift')[0].href = '/market/?cashshop=true&username='+o.username;

		// hide irrelavent options based on the data ajax returns
		if(!o.location) $('#jointhem').css('display', 'none');
		else { $('#jointhem a')[0].href = o.location.url; }
		if(o.is_friend) $('#addfriend').css('display', 'none');
		if((o.receive_pm == 2 && !o.is_friend) || !o.receive_pm) $('#sendpm, #sendtext, #sendim, #sendline').css('display', 'none'); 
		if(!o.website) $('#website').css('display', 'none');
		if(!o.moderator) $('#mtools, #ptools, #toolsline').css('display', 'none');
		if(o.self) $('#jointhem, #addfriend, #sendpm, #sendtext, #sendim, #sendline, #ignore, #ignoreline, #trade').css('display', 'none');
		if(!o.online) $('#jointhem, #sendim').css('display', 'none');

	};

	// calculate x,y coordinates of where the menu should appear
	var displaymenu = function(obj){
		var $offset;
		if ($current == 'head')
			$offset = $dropbox;

		else if ($current == 'statusbar')
			$offset = $(obj).parent().parent();

		
		$menu.css({
			top: $offset.offset().bottom - 1 + 'px',
			left: $offset.offset().left + 'px',
			display: 'block'
		});

		// flip, if can't display fully top down
		if($.viewport().bottom - $menu.offset().bottom <= 0) {
			$menu.css({
				top: $offset.offset().top - $menu.height() + 1 + 'px',
				left: $offset.offset().left + 'px'
			});
		}
	
	};

	// these events are shared by avatar and status bar menu

	// do not fire event when mouseover these containers
	$dropbox.add($menu).bind('mouseover', function(e) {
		Y.EVENT.stopEvent(e);
	});

	// do not prevent event from firing when doing a menu click
	$menu.bind('click', function(e){
		// no stopEvent as we still want the default stuff to happen in the menu :)
		Y.EVENT.stopPropagation(e);
		$dropbox.add($menu).css('display', 'none');
	});

	// hide the menu if you ever leave the avatar or status bar
	$().bind('mouseover', function(e) {
		$dropbox.add($menu).css({
			display: 'none'
		});
	});

	// these are the events registered to avatar headshots
	headshotEvents = function(){
        $dropdowns = $('.avatarImage');//testing
		$dropdowns.bind('mouseover', function(e) {
			$current = 'head';
			Y.EVENT.stopEvent(e);
			cur_id = this.title;
			$dropbox.css({
				display: 'block',
				top: $(this).offset().top - 1 + 'px',
				left: $(this).offset().left - 1 + 'px'
			});
            if(this.className.indexOf('gfooter') > -1)
                $dropbox.addClass('gfooter');
            else
                $dropbox.removeClass('gfooter');
			$menu.css('display', 'none');
		});

		$dropbox.bind('mouseout', function(e) {
			Y.EVENT.stopEvent(e);
			$dropbox.removeClass('trigger');
		});

		$trigger.bind('mouseover', function(e) {
			Y.EVENT.stopEvent(e);
			$dropbox.addClass('trigger')[0].cur_id=cur_id;
            var isFooter = (Y.EVENT.getTarget(e).parentNode.className.indexOf('gfooter') > -1) ?true:false;
			
			if(!cache[cur_id]) {
                if(!isFooter){     
                $img.css({
                    display: 'block',
                            top: $dropbox.offset().top + 1 + 'px',
                            left: $dropbox.offset().left + 1 + 'px',
                            opacity: 0.4
                            });
                }else{
                    $imgftr.css({
                    display: 'block',
                            top: $dropbox.offset().top + 1 + 'px',
                            left: $dropbox.offset().left + 1 + 'px',
                            opacity: 0.4
                                });

                }
                
				
				$.ajax({
					url: '/avatarmenu/' + cur_id,
                            success: function(o) {
                            var str = eval(o);
                            var id = cur_id;
                            cache[str.id] = str;
				
                            populate(str);
                            if(!isFooter){
                            $img.animate({opacity: { to: 0 }}, 700, null, function(){
                                    $img.css('display', 'none');		
                                });
                            }else{
                                $imgftr.animate({opacity: { to: 0 }}, 700, null, function(){
                                        $imgftr.css('display', 'none');
                                    });
                            }

                            // if our dropbox is still the one that we need
                            if($dropbox.css('display') == 'block' && $dropbox[0].cur_id == id) 
                                displaymenu();
						
                        }
				
				});
			}
			else {
				populate(cache[cur_id]);
				displaymenu();
			}

		});
	};
	
	// these are the events registered to the status bar
	statusbarEvents = function(){
		$().bind('mouseover', function(e) {
			$pushbox.removeClass('trig');
		});

		$pushbox.bind('mouseover', function(e){
			$current = 'statusbar';
			Y.EVENT.stopEvent(e);
			cur_id = $(this).addClass('trig')[0].id.substring(2);
			cur_obj = this;

			var $parent = $(this).parent().parent();

			if(!cache[cur_id]) {
				$img2.css({
					display: 'block',
					top: $parent.offset().top + 1+ 'px',
					left: $parent.offset().left + 1+ 'px',
					opacity: 0.1
				});
				$.ajax({
					url: '/avatarmenu/' + cur_id,
					success: function(o) {
						var str = eval(o);
						cache[str.id] = str;
						populate(str);
						displaymenu(cur_obj);

						$img2.animate({opacity: { to: 0 }}, 700, null, function(){
							$img2.css('display', 'none');		
						});
			
					}
				});
			}
			else {
				populate(cache[cur_id]);
				displaymenu(cur_obj);
			}
		});

		// no event should fire here
		$pushbox.parent().parent().bind('mouseover', function(e){
			Y.EVENT.stopEvent(e);
		});
	};
    YAHOO.gaia.app.dropdown.headshotEvents = headshotEvents;

}

})(YAHOO.util.Short, YAHOO.util.Shortcuts); // end anon


// JavaScript Document

// equipped items namespace
YAHOO.namespace("gaia.apps");

// means onDOMready
YAHOO.util.Short(function($, Y){
	$("#id_wishlist a, #wishlist a").bind("click", function(e){
		Y.EVENT.preventDefault(e);
		var item=this.id.split("_")[1];
		YAHOO.gaia.apps.ei.getItemDetails(item);

	});
	$("#id_equipment, #equipped_id a").bind("click", function(e){
		Y.EVENT.preventDefault(e);
		var $eid = $('#equipped_id'),
			$dt = $("#details_title"),
			cur_id;

		if ($eid.length)
			cur_id = $eid[0].title;
		
		else if ($dt.length)
			cur_id = $dt[0].className;;
		

		YAHOO.gaia.apps.ei.getItemList(cur_id);
	});
});


(function(){
	// true will log to firebug, false will not
	var debug = 0;

	// our mini logger
	var firebug = function(strOrObj) {
		if (debug && window.console && window.console.log)
			console.log(strOrObj);
	}

	var myAppend = function(obj){
		 var _div = document.createElement('DIV');
		 _div.innerHTML = obj.responseText;
		 document.getElementsByTagName('body')[0].appendChild(_div);
	}

	// local vars in anonymous function, byte saving feature and sheilding from conflict
	var EVENT = YAHOO.util.Event;
	var DOM = YAHOO.util.Dom;

		YAHOO.gaia.apps.ei = function(){
			// private vars
			var storeUserItem = [];
			var storeOutfits = [];
			var user;
			var outfit_id;
			var getList = false;
			var getOutfit = false;
			var checkOutfitCache;
			var listContainer = 'equipped-list';
			var detailContainer = 'equipped-item-details';
			var myItemsPanel;
			var myItemDetailsPanel;
			var myItems;
			var myItemDetails;
			var template = false; // ei template has not been loaded
			var sigs = DOM.getElementsByClassName('extra_sigs');
			var curItem;
			var getCurItem = false;
			var curDetails;
			var $ = function(str){ return document.getElementById(str)};

      var config = { 'detailsOnly': false,
                     'template': 'template',
                     'offset': {'x': -15, 'y': 5}
                   };

			// return public methods
			return {
				// just to get template and append to body
				init : function (){
						// try to get template
						if(!template)
							YAHOO.util.Connect.asyncRequest('GET', '/equip/' + config.template + '?'+GAIA_config('cache_value'), YAHOO.gaia.apps.ei.template_callback, null);
				},//end init

				template_callback : {
					success: function(o){
						firebug(o);
						template = o;
						YAHOO.gaia.apps.ei.template_success();
					},
					failure: function(o){
						firebug(o);
						YAHOO.gaia.apps.ei.template_failure();
					}
				},

				template_success : function(){
					firebug("template successfully gotten");
					YAHOO.gaia.apps.ei.createPanel();
				},

				template_failure : function(){
					firebug("template failure");
					if (!user){
						user = '';
					}
					top.location.href = "/p/" + user;
				},

				createPanel: function(){
					myAppend(template);
					inited = true;

          if (!config.detailsOnly) {
					  myItemsPanel = new YAHOO.widget.Panel(listContainer, { 
						  zIndex: 1000,
	  			    fixedcenter: true,
  						/*constraintoviewport: true,  */
			  			underlay: "none",  
				  		close: false,  
					  	visible: false,  
						  draggable: false,
  						modal: true,
	  					effect : {effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.25}
		  			});

  					myItemsPanel.render();
          }
					
					myItemDetailsPanel = new YAHOO.widget.Panel(detailContainer, { 
						zIndex: 2000,
						underlay: "none",
						close: false,
						visible: false,
						draggable: false,
						modal: true,
						effect : {effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.25}
					});

					myItemDetailsPanel.render();

					// event handling after init
					EVENT.addListener( 'icon-close-list' , "click" , function(){
						YAHOO.gaia.apps.ei.allHide();
					});

					EVENT.addListener( 'icon-close-details' , "click" , function(){
						YAHOO.gaia.apps.ei.detailHide();
					});

					EVENT.addListener( 'equipped-item-details' , "mouseover" , function(){
						//prevent weird event behavior in ie, stupid hacks to please ie
						DOM.removeClass(this, 'yui-panel');
					});

					EVENT.addListener( window , "resize" , function(){
						myItemDetailsPanel.hide();
					});

					EVENT.addListener( window , "scroll" , function(e){
						myItemDetailsPanel.hide();
					});

					EVENT.addListener( 'itemDesc' , "scroll" , function(e){
						EVENT.stopEvent(e);
					});

					if (getList) {
						YAHOO.util.Connect.asyncRequest('GET', '/equip/list/'+user+'?_gaia_t_=850', YAHOO.gaia.apps.ei.itemList_callback, null);
						getList = false;
					}

					else if (getCurItem)
					{
						YAHOO.util.Connect.asyncRequest('GET', '/equip/list/'+user+'?_gaia_t_=850', YAHOO.gaia.apps.ei.wish_callback, null);
						getCurItem = false;
					}
					else if (getOutfit) {
					  YAHOO.util.Connect.asyncRequest('GET', '/equip/outfit/'+user+'/'+outfit_id, YAHOO.gaia.apps.ei.itemList_callback, null);
					  getOutfit = false;
					}
				},

				// get item list
				getItemList: function(userid){
					// woops template not gotten yet, get template first
					if (!template) {
						getList = true;
						user = userid;
						YAHOO.gaia.apps.ei.init();
					}
					else {
						// last load, no need to fetch data, just display
						if (user == userid)	{
							firebug("ran last load");
							user = userid;
							YAHOO.gaia.apps.ei.listShow();

						}

						// recent load, we get data from our cache/javascript_obj, and display
						else if (storeUserItem[userid])	{
							firebug("ran recent load");
							user = userid;
							YAHOO.gaia.apps.ei.itemList_success();
						}

						// fetch data from server and display;
						else {
							firebug("ran fetchdata and display");
							user = userid;
							YAHOO.util.Connect.asyncRequest('GET', '/equip/list/'+userid+'?_gaia_t_=850', YAHOO.gaia.apps.ei.itemList_callback, null);
						}

					}
				},
				// get outfit list
			        getOutfitList: function(userid, outfitid){
			                checkOutfitCache = true;
					// woops template not gotten yet, get template first
					if (!template) {
						getOutfit = true;
						user = userid;
						outfit_id = outfitid;
                                                config.template = 'template/outfititems';
						YAHOO.gaia.apps.ei.init();
					}
					else {
						// last load, no need to fetch data, just display
						if (outfit_id == outfitid)	{
							firebug("ran last load");
							outfit_id = outfitid;
							YAHOO.gaia.apps.ei.listShow();

						}

						// recent load, we get data from our cache/javascript_obj, and display
						else if (storeOutfits[outfitid])	{
							firebug("ran recent load");
							outfit_id = outfitid;
							YAHOO.gaia.apps.ei.itemList_success();
						}

						// fetch data from server and display;
						else {
							firebug("ran fetchdata and display");
							outfit_id = outfitid;
							YAHOO.util.Connect.asyncRequest('GET', '/equip/outfit/'+userid+'/'+outfitid, YAHOO.gaia.apps.ei.itemList_callback, null);
						}

					}
				},

				// get item list callback
				itemList_callback : {
					success: function(o){
						myItems = eval(o.responseText);
						firebug("Succeeded in getting item list");
						firebug("outputting json object");
						firebug(myItems);
						YAHOO.gaia.apps.ei.itemList_success()
					},
					failure: function(o){
						firebug(o);
						YAHOO.gaia.apps.ei.itemList_failure()
					}
				},

				itemList_success : function(){
			          if (checkOutfitCache) {
					if (storeOutfits[outfit_id]) {
						myItems = storeOutfits[outfit_id];
					}
					else {
						storeOutfits[outfit_id] = myItems;
					}
			                checkOutfitCache = false;
				  }
				  else {
				        if (storeUserItem[user]) {
						myItems = storeUserItem[user];
					}
					else {
						storeUserItem[user] = myItems;
					}
				  }
					firebug("iterating each obj");
					var myList = DOM.get('equipped-item-list');
					myList.innerHTML = '';
					if (myItems == -1)
					{
						myList.innerHTML = 'User does not allow viewing of currently equipped items';
					}
					if (myItems){
						for( item_id in myItems) {
							firebug(item_id);
							var _li = document.createElement("li");
							var _img = document.createElement("img");
							var _div = document.createElement("div");
							var _a = document.createElement("a");

							// filling in values
							_div.className = "itemIcon";
							_img.setAttribute("src", "/images/thumbnails/"+myItems[item_id].thumbfile);
							_a.className = "itemDesc";
							_a.innerHTML = myItems[item_id].name;

							// appending to DOM accordingly
							myList.appendChild(_li);
							_li.appendChild(_div);
							_li.appendChild(_a);
							_div.appendChild(_img);
							_a.id = item_id;

							// attach event to every single one of them
							EVENT.addListener( _a , "mouseover" , function(){
								YAHOO.gaia.apps.ei.itemDetails(this);
							});
						}
					}
					else {
						myList.innerHTML = 'No items found for this user.';
					}
					YAHOO.gaia.apps.ei.listShow();

				},

				itemList_failure : function(){
					firebug("item list failure");
					var myList = DOM.get('equipped-item-list');
					myList.innerHTML = 'We have encountered an internal error.';
					YAHOO.gaia.apps.ei.listShow();
				},

				populateDetails : function(cur) {
					
					var image = document.createElement("img");
					image.setAttribute("src", "/images/thumbnails/"+cur.thumbfile);

					$('itemIcon').innerHTML = '';
					$('itemIcon').appendChild(image);
					$('itemTitle').innerHTML = cur.name;
					$('itemDesc').innerHTML = cur.description;

					// reset for security
					$('itemAvail').innerHTML = '';
					$('itemAvail').style.display = "none"
                                        if ($('gotoShop') != null) {
					  $('gotoShop').style.display = "none";
					}
					$('buttons').style.display = "block";

					// if we detect that it's available on gold shop
					// show go to shop, item price and availability
					if (typeof (cur.store_id) == "object") {
					  if ($('gotoShop') != null) {
						$('gotoShop').style.display = "block";
						$('gotoShop').href = '/gaia/shopping.php/?key=' + cur.store_id.store_key +'&item_id=' + cur.item_id;
					  }
						$('itemAvail').style.display = "block";
						$('itemAvail').innerHTML ="Available at "+ cur.store_id.store_name + " for "+ cur.price + " Gold or " + cur.gpass + " Gaia Cash";
						if (cur.store_id.store_name == "Prize & Joy") {
							$('itemAvail').innerHTML ="Available at "+ cur.store_id.store_name + " for "+ cur.price + " tokens";
						}
					}
					// in cash only shop
					// show go to shop, item price and availability
					else if (cur.store_id == 18) {
						$('itemAvail').style.display = "block";
						$('itemAvail').innerHTML ="Available at Cash Shop La Victoire for "+ cur.gpass + " Gaia Cash";
					  if ($('gotoShop') != null) {
						$('gotoShop').style.display = "block";
						$('gotoShop').href = 'javascript:YAHOO.gaia.apps.ei.allHide();YAHOO.gaia.app.CashShop.SenderApplication.show({store:18,self:true,origin:"hero",goto_item: {item_id: '+ cur.item_id +',item_nonce: "'+cur.nonce+'",thumbnail: "\/images\/thumbnails\/'+cur.thumbfile+'",gpass: '+cur.gpass+',gold: '+cur.price+',name: "'+cur.name+'"}});';
					  }

						try	{
							if (disable_cashshop){
								$('gotoShop').href = '/market/?cashshop=true';
							}
						}
						catch (e){}

					}

					if (cur.item_key == '') {
						$('buttons').style.display = 'none';
					}

					// add to wish list
				        if ($('addWishlist') != null) {
					  $('addWishlist').href = '/account/addwishlist/?key=' + cur.item_key;
					}

					// this gets rid of the extra separate div when we disable the 
					// buttons for hte outfit item details and there is no shop data
					if ($('itemAvail').style.display == "none" && $('gotoShop') == null && $('addWishlist') == null) {
						$('buttons').style.display = 'none';
					}

					// populate market listing link
					$('itemMarketLink').href = '/marketplace/itemdetail/' + cur.item_id;

					// populate avg price
					$('currentPrice').innerHTML = cur.averages + ' Gold';
					$('currentDeviation').innerHTML = parseInt(cur.deviations) + '%';

					// positive or negative trend?
					if (cur.deviations == 0) $('currentDeviation').className = 'deltaSame';
					else (cur.deviations < 0) ? $('currentDeviation').className = 'deltaDown' :  $('currentDeviation').className = 'deltaUp';

				},

				itemDetails : function(obj){
					//myItemDetailsPanel.hide();
            var cur;
            if (config.strip_id != null) {
                var id_str = obj.id;
                id_str = id_str.replace(config.strip_id, "");
                cur = myItems[id_str];
            } else {
					      cur = myItems[obj.id];
            }

					YAHOO.gaia.apps.ei.populateDetails(cur);

					var curPos = DOM.getRegion(obj);
					var detailPos = DOM.getRegion($('equipped-item-details'));

					var ypos = curPos.top - (detailPos.bottom - detailPos.top) + config.offset.y;
					var xpos = curPos.left - (detailPos.right - detailPos.left)/2 + config.offset.x;

					myItemDetailsPanel.cfg.setProperty("x", xpos);
					myItemDetailsPanel.cfg.setProperty("y", ypos);

					// show the panel after populating the details
					myItemDetailsPanel.show();
				},

				onlyDetails: function(cur) {
					!template ? YAHOO.gaia.apps.ei.init() : '';
					YAHOO.util.Short('#equipped-list_c').parent().css('display', 'block');
					YAHOO.gaia.apps.ei.populateDetails(cur);

					var region = DOM.getClientRegion();
					var ei = DOM.getRegion(DOM.get('equipped-item-details'));
					var left = region.left + (region.right-region.left)/2-135;
					var top = region.top + (region.bottom-region.top)/2 - (ei.bottom-ei.top)/2 ;

					DOM.get('dialogArrow').style.display='none';

					myItemDetailsPanel.cfg.setProperty("x", left);
					myItemDetailsPanel.cfg.setProperty("y", top);
					myItemDetailsPanel.show();
					DOM.get('equipped-item-details_mask').style.display = 'block';
					DOM.get('equipped-item-details_mask').style.visibility = 'visible';
				},

				// show / hide functions below
				listShow : function (){
					YAHOO.util.Short('#equipped-list_c').parent().css('display', 'block');
					if (config.detailsOnly == false) myItemsPanel.show(); 

					DOM.setStyle('ad_inject', 'visibility', 'hidden'); 
					DOM.setStyle('grid_ad', 'visibility', 'hidden');
					DOM.setStyle(sigs, 'display', 'none'); 
				},

				listHide : function (){
					if (config.detailsOnly == false) {
  						myItemsPanel.hide();
						YAHOO.util.Short('#equipped-list_c').parent().css('display', 'none');
					}
					DOM.setStyle('ad_inject', 'visibility', 'visible');
					DOM.setStyle('grid_ad', 'visibility', 'visible');
					DOM.setStyle(sigs, 'display', 'block');
				},

				detailShow : function (){
					YAHOO.util.Short('#equipped-list_c').parent().css('display', 'block');
					myItemDetailsPanel.show();
				},

				detailHide : function (){
					myItemDetailsPanel.hide();

					var mask = DOM.get('equipped-item-details_mask');
					DOM.get('dialogArrow').style.display='block';
					if (mask) {
						mask.style.display = 'none';
						mask.style.visibility = 'hidden';
					}

					myItemDetailsPanel.cfg.setProperty("fixedcenter", false);
				},

				allHide: function(){

					if (config.detailsOnly == false) myItemsPanel.hide();
					YAHOO.util.Short('#equipped-list_c').parent().css('display', 'none');
					YAHOO.gaia.apps.ei.detailHide();
					DOM.setStyle('grid_ad', 'visibility', 'visible');
					DOM.setStyle('ad_inject', 'visibility', 'visible');
					DOM.setStyle(sigs, 'display', 'block');
					DOM.setStyle('id_aquarium', 'visibility', 'visible');
				},

				wishGetItem: function(o, curuser){
					curItem = o;
					user = curuser;
					getCurItem = true;
					firebug('wish get item init');
					YAHOO.util.Connect.asyncRequest('GET', '/equip/template?'+GAIA_config('cache_value'), YAHOO.gaia.apps.ei.template_callback, null);
				},

				wish_callback : {
					success: function(o){
						myItems = eval(o.responseText);
						YAHOO.gaia.apps.ei.wish_success();

					},
					failure: function(o){
						firebug(o);
						//YAHOO.gaia.apps.ei.wish_failure()
					}
				},

				wish_success: function(){
					firebug(myItems);
				},

				getItemDetails: function(item_id){
					YAHOO.gaia.apps.ei.init();
					YAHOO.util.Connect.asyncRequest('GET', '/equip/id/'+item_id+'?_gaia_t_=850', YAHOO.gaia.apps.ei.getItemDetails_callback, null);
				},

				getItemDetails_callback: {
					success: function(o) {
						var cur = eval(o.responseText);
						YAHOO.gaia.apps.ei.onlyDetails(cur);
					},
					failure: function(){
						// do nothing
					}
				},

        setItems: function(items) {
          myItems = items;
        },

        setConfig: function(data) {
          for(val in data) {
            config[val] = data[val];
          }
        }
			}
		}();

})(); // end anonymos function



(function($){
/////////////////////////////// START ////////////////////////////	

// caching the ajax offer
var offer;
var $treasureChest;
var end; // offer ends
var hideTimeout;
var looper;

// THOSE THAT SHOULD BE FIRED ONDOMREADY
$(function(){
	$treasureChest = $('#treasureChest');
	

	var showTreasure = function() {
		var maxLoop = 2;
		var loop = 0;

		var iterator = function(){
			if (window.addEventListener)
			$treasureChest.animate({ opacity: { to: 0.2 }}, 400, function(){
				$treasureChest.animate({ opacity: { to: 1 }}, 600, function(){
					if (loop != maxLoop){
						loop++;
						setTimeout(function(){	iterator(); }, 300);
					}
				});
			});
		};

		iterator();

		$treasureChest.bind('click', function(e){
			YAHOO.util.Event.stopEvent(e);
			$.ajax({
				url: '/treasure/offer',
				success: function(o){
					try{ offer = eval(o); }	catch(e){}
					
					if (offer && offer.id && offer.timeout > 20) {
						$('<img src ="http://'+ GAIA_config('main_server') + '/internal/mkt_t.php?mid=2886&t='+(new Date()).getTime() +'" />');
						YAHOO.gaia.apps.treasure.populateItems();
						setTimeout(function(){ 
							YAHOO.gaia.apps.treasure.show();
						}, 500);
					
						end = Math.ceil(new Date().getTime()/1000) + offer.timeout - 20;

						hideTimeout = setTimeout(function(){ 
							$treasureChest.css('display', 'none'); 
						}, (offer.timeout-20)*1000);

					}
					else {
						YAHOO.gaia.apps.treasure.hide();
					}
				}
			})
		});
	}

	if ($treasureChest.length) {
		YAHOO.gaia.apps.treasure.constructPanel();
		$treasureChest.css('display', 'block'); 
		showTreasure();
		$('<img src ="http://'+ GAIA_config('main_server') + '/internal/mkt_t.php?mid=2884&t='+(new Date()).getTime() +'" />');
	}
});


// THOSE THAT DOES NOT NEED TO BE ONDOMREADY, IE FUNCTION DECLARATION
YAHOO.namespace('gaia.apps');

YAHOO.gaia.apps.treasure = (function(){
	var template = '<div id="treasureDetails"><div class="treasureTopBorder">&nbsp;</div><div class="treasureContentOuter"><div class="treasureContentInner"><h1>Get a Key to Open This Chest</h1><h2>One of these great items will be hiding inside:</h2><div id="treasureBoxList"><div class="thumb"></div><ul class="price"></ul></div><p id="treasureHurry">Hurry!... The chest will disappear in: <span id="treasureCountDown"></span></p><p id="treasureKeyDetails"></p><p id="errorTreasureMessage">&nbsp;</p><div id="buttonContainer"><a id="purchaseKey" class="button"></a><a id="haveKey" class="button"></a><a id="closeTreasureBox" href="#">No thanks</a></div></div></div><div class="treasureBottomBorder">&nbsp;</div></div>';
	var grant_template = '<h1>Woo Hoo!</h1><h2>You have unlocked <span id="grantedName"></span></h2><div id="grantedContainer"><div id="grantedItem"></div></div><div id="buttonContainer"><a id="gotoInventory" class="button">Go to inventory</a><a id="closeTreasureBox" class="button2 button">Close Window</a></div></div>';
	var treasurePanel;
	var treasureContainer;
	var countDownContainer;

	var countDown = function() {
		countDownContainer = countDownContainer || $('#treasureCountDown')[0];

		var timeRemaining = function(){
			var current = end - Math.ceil(new Date().getTime()/1000);
			var myMinutes = Math.floor(current/60);
			var mySeconds = current % 60;
			var prettyMinutes = (myMinutes > 9) ? myMinutes : '0' + myMinutes;
			var prettySeconds = (mySeconds > 9) ? mySeconds : '0' + mySeconds;	
			countDownContainer.innerHTML = prettyMinutes + " : " + prettySeconds;
			if (myMinutes + mySeconds <= 0) {
				clearInterval(myInterval);
				YAHOO.gaia.apps.treasure.hide();
				$treasureChest.stop().css('display', 'none');
			}

		}
		timeRemaining();

		var myInterval = setInterval(function(){
			timeRemaining();
		}, 400);		
	
	
	};

	return {
		constructPanel: function() {
			if (!$('#treasureDetails').length){
				treasureContainer = $(template).appendTo(document.body)[0];
				treasurePanel = new YAHOO.widget.Panel('treasureDetails', { 
					zIndex: 2000,
					fixedcenter: true,
					underlay: "none",  
					close: false,  
					visible: false,  
					draggable: false,
					modal: true,
					effect : { effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.25}
				});

				treasurePanel.render();

				// attach events to the modal window
				$('#treasureDetails').bind('click', function(e){
					// close box
					if ((e.target|| e.srcElement).id == 'closeTreasureBox') {
						YAHOO.util.Event.stopEvent(e);
						YAHOO.gaia.apps.treasure.hide();
						$.ajax({
							url: '/treasure/decline',
							success: function(){}
						});
					}
					// have key
					else if ((e.target|| e.srcElement).id == 'haveKey') {
						YAHOO.util.Event.stopEvent(e);

						$(treasureContainer).css('cursor','wait');
						
						$.ajax({
							url: '/treasure/grant',
							success: function(o){
								$(treasureContainer).css('cursor','default');
								var grant = eval(o);
								var graphics_server = GAIA_config('graphics_server');
								if (grant && grant.id) {
									
									if (grant.item_id && grant.id > 0){
										$('<img src ="http://'+ GAIA_config('main_server') + '/internal/mkt_t.php?mid=2888&t='+(new Date()).getTime() +'" />');
										// we don't want to windows to close automatically now
										clearTimeout(hideTimeout);

										$treasureChest.stop().css('display', 'none');
										
										$('<div id="treasureStarAnim"></div>').prependTo('#treasureDetails_c');
										$('#treasureDetails .treasureContentInner').html(grant_template);
										$('#grantedItem').html('<img src="http://'+graphics_server+'/images/thumbnails/'+grant.thumbfile+'" title="'+grant.name+'" height="70" width="70" />');
										$('#grantedName').html(grant.name);
										$('#gotoInventory')[0].href = '/inventory/view/' + grant.type;
									}
									else if (grant.id == -2 ){
										$('#errorTreasureMessage').html('Oops, the treasure chest is still locked. Perhaps you have the wrong key?');
									}
									else {
										$('#errorTreasureMessage').html('Oops, the treasure chest has disappeared! Better luck next time.');
									}

								}
							}
						});
					}
					// purchase Key
					else if ((e.target|| e.srcElement).id == 'purchaseKey') {
						YAHOO.util.Event.stopEvent(e);
						setTimeout(function(){
							YAHOO.gaia.widgets.ShowItem(offer.unlock_item.item_id);
						}, 500);
					}
					
				});

			}
		},

		show: function(){
			$(treasureContainer).css('display', '');
			if(treasurePanel) treasurePanel.show();
			countDown();
			$('#grid_ad, #featured, .extra_sigs').addClass('temp_hide').css('display', 'none');
		},

		hide: function(){
			clearInterval(looper);
			$(treasureContainer).css('display', 'none');
			if(treasurePanel) treasurePanel.hide();
			$treasureChest.stop().css('display', 'none');

			$('.temp_hide').removeClass('temp_hide').css('display', '');
		},

		populateItems: function(){
			if (offer){
				var $price = $('#treasureBoxList .price'),
					$thumb = $('#treasureBoxList .thumb'),
					$treasureDetails = $('#treasureKeyDetails'),
					graphics_server = GAIA_config('graphics_server'),
					mycounter = [],
					i = 1,
					str = str2 = '';

				for (var item_id in offer.item_list) {
					//mycounter.push(item_id);
					str += '<img src="http://'+graphics_server+'/images/thumbnails/'+offer.item_list[item_id].thumbfile + '" />';
					str2 += '<li><img align="top" src="http://'+graphics_server+'/images/treasurechest/ic_gcash_icon.gif"/>' + offer.item_list[item_id].gpass + '</li>'
				}
				$treasureDetails.html('<img src="http://'+graphics_server+'/images/thumbnails/'+offer.unlock_item.thumbfile+'" align="absmiddle" /> '+ offer.unlock_item.name + ' Key cost <img src="http://'+graphics_server+'/images/treasurechest/ic_gcash_icon.gif" align="absmiddle" /> '+ offer.unlock_item.gpass);
				$price.html(str2);
				$thumb.html(str);

			}
		}
	} // end return
})();

/////////////////////////////////// END ///////////////////////////////////

})(YAHOO.util.Short);

/**
 * Lock: A Unified Locking Library
 * Thanks to the magic of the event stack in Firefox / IE, it is possible to
 * have your data be changed behind your back when using browser window
 * events. A basic lock will help stop that. An object is returned to
 * the requesting application which will say if a lock was obtained or not.
 *
 * This class is licensed under the New BSD License:
 * http://www.opensource.org/licenses/bsd-license.html
 *
 * Copyright (c) 2007 Jakob Heuser (jakob@felocity.org). All rights reserved.
 **/
if (!Lock) var Lock = function() {
    var locks = {};
    
    var normalize_namespace = function(name) {
        return ("c" + name).replace(/[^a-z0-9\-\_]/gi, "");
    };

    return {
        declare: function() {
            for (var i = 0; i < arguments.length; i++) {
                if (!locks[normalize_namespace(arguments[i])]) {
                    locks[normalize_namespace(arguments[i])] = new Array();
                }
            }
        },
        obtain: function(space) {
            // atomic assignment, no 2 objects are same
            var lock = new Object();
            
            // no namespace? problem
            space = normalize_namespace(space);
            if (!locks[space]) {
                throw "Namespaces must be declared before getting into locks.";
            }
    
            // atomic op for as long as JS is single threaded
            // whenever JS multi-threads, this one call is synchronized
            locks[space].push(lock);
    
            // push goes onto end, so no matter how concurrent, we care only
            // about element 0
            var owner = (locks[space][0] === lock);
    
            // safely clean lock_owner
            if (owner) {
                locks[space] = [locks[space][0]];
            }
    
            var lock_obj = {
                isOwner: function() {
                    return owner;
                },
                release: function() {
                    if (owner) {
                        locks[space] = new Array();
                    }
                }
            };
    
            return lock_obj;
        }
    };
}();

/**
 * Just In Time (JIT) Loader
 * JIT makes it easy to load one or more JavaScript files on demand. It's goal
 * is to encourage developers to only load scripts when they need to as
 * opposed to overloading the HEAD of their document.
 *
 * Many of the base loading concepts are attrributed to LazyLoad, developed
 * by Ryan Grove, please see copyright information below for additional
 * details. This software is licensed under the New BSD License:
 * http://www.opensource.org/licenses/bsd-license.html
 *
 * LazyLoad segments Copyright (c) 2007 Ryan Grove (ryan@wonko.com). All rights reserved.
 * JIT segments Copyright (c) 2007 Jakob Heuser (jakob@felocity.org). All rights reserved.
 *
 * For additional details, please check out the following usage guides:
 * LazyLoad: http://wonko.com/article/527
 *
 * Version: 1.0.0; 1.0.3 (LazyLoad)
 **/
if (!JIT) var JIT = function() {
    
    /**
     * Denotes an object that is pending a requestComplete() call
     * it is null if there is no request in progress
     **/
    var pending = null;
    
    /** 
     * A mutable array of the current script IDs in use. This makes
     * cleanup of the scripts after they have finished loading easier.
     **/
    var script_ids = [];
    
    /**
     * A counter for the total number of scripts we have created.
     * Helps to ensure clean loading without collisions.
     **/
    var script_id_counter = 0;
    
    /**
     * A variable that defines the lock owner.
     * Using the counter and owner, a function can determine if they
     * are the lock.
     **/
    var lock_owner = null;
    
    /**
     * The prefix our our custom IDs. This ensures we don't collide w/ stuff
     **/
    var script_id_prefix = "jit-gen";
    
    /**
     * An index of URLs that have been loaded
     * At the expense of more memory, this speeds up scanning for all
     * included scripts
     **/
    var loaded_scripts = {};

    /**
     * sets an IE version based on @_jscript_version
     * replace if cc ever gets IE versioning, this is used for CSS
     **/
    var IEVersion = /*@cc_on function(){ switch(@_jscript_version){ case 1.0:return 3; case 3.0:return 4; case 5.0:return 5; case 5.1:return 5; case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7; case 5.8:return 8;}}()||@*/0;
    
    /**
     * Declare our locks
     **/
    var LOCK_SERIALIZED_LOADING = "JIT_load";
    Lock.declare(LOCK_SERIALIZED_LOADING);
    
    /**
     * creates a unique ID using the counter and prefix
     * @return {string}
     **/
    var generateId = function() {
        script_id_counter++;
        return script_id_prefix + script_id_counter;
    };
    
    /**
     * Detect all loaded scripts, and add their URLs to the list
     * If there is a faster method than getting the elements by tag name
     * it should be used instead.
     * This runs on loadOnce so that we can see if other scripts also
     * added their own JS.
     * @return {null}
     **/
    var detectLoadedScripts = function() {
        var script_nodes = document.getElementsByTagName("script");
        var css_nodes = document.getElementsByTagName("link");

        for (var i = 0; i < script_nodes.length; i++) {
            // skip sourcelss scripts
            var node = script_nodes[i];
            if (!node.src || node.src.length == 0) {
                continue;
            }
            loaded_scripts[normalizeScriptPath(node.src)] = true;
        }
        for (var j = 0; j < css_nodes.length; j++) {
            // skip sourcelss css or wrong types
            var node = css_nodes[j];

            if (!node.href || node.href.length == 0 ||
                !node.rel || node.rel.toString().toLowerCase() != "stylesheet" ||
                !node.type || node.type.toString().toLowerCase() != "text/css") {
            
                continue;
            }

            loaded_scripts[normalizeScriptPath(node.href)] = true;
        }
    };
    
    /**
     * A helper function which normalizes the script path
     * the resulting path can be used as a property name in an object
     * @param {string} path to normalize
     * @return {string} normalized path
     **/
    var normalizeScriptPath = function(path) {
        return "s" + escape(path);
    };
    
    /**
     * Handle a load function for Javascript or CSS
     * @see load
     * @see loadOnce
     * @param {type} a type to load, either script or css
     * @param {boolean} once if true, load will ensure everything loads only once
     **/
    var handleLoad = function(urls, verifier, callback, obj, scope, type, once) {
        // we wait on document.body, otherwise we can't be certain we have
        // a closed HEAD tag in IE6 for insertion
        if (!document.body) {
            window.setTimeout(function() { handleLoad(urls, verifier, callback, obj, scope, type, once); }, 50);
            return;
        }
        
        // if you are not the lock owner, then your request goes into wait mode
        // techincally a spinlock.  Wait is fixed at 10ms right now, can change
        // to reflect number of current "threads" later
        var lock = Lock.obtain(LOCK_SERIALIZED_LOADING);
        if (!lock.isOwner()) {
            window.setTimeout(function() { handleLoad(urls, verifier, callback, obj, scope, type, once); }, 10);
            return;
        }
        
        // obtained lock
        
        // cast URLs to an array if we need to
        urls = (urls.constructor === Array) ? urls : [urls];
        
        // if verifier was skipped or nulled, then we need to make one
        if (!verifier || typeof(verifier) != "function") {
            veifier = function() { return true; };
        }
        
        // hold onto the pending object for requestComplete and loadComplete
        pending = {urls: urls, verifier: verifier, callback: callback, obj: obj, scope: scope, type: type, once: once, lock: lock};
        
        // scrape all loaded scripts in case things have changed
        detectLoadedScripts();
        
        // if we are running in loadOnce mode
        if (once) {
            var urls_to_load = [];
            for (var i = 0; i < urls.length; i += 1) {
                var loaded = (loaded_scripts[normalizeScriptPath(urls[i])]) ? true : false;
                if (!loaded) {
                    urls_to_load.push(urls[i]);
                }
            }
            
            // do we have any URLs to load? If not, loading is complete and we are done
            if (urls_to_load.length <= 0) {
                loadComplete();
                return;
            }
            
            // there is stuff to load still
            // redefine URls by our new definition, and our pending
            urls = urls_to_load;
            pending = {urls: urls, verifier: verifier, callback: callback, obj: obj, scope: scope, type: type, once: once, lock: lock};
        }
        
        if (type == "js") {
            insertScripts(urls);
        }
        else if (type == "css" || (type.match(/^css/i) && type == "css"+IEVersion)) {
            insertStyles(urls);
        }
        else {
            // whatever we had, we can't use... release the lock
            JIT.scriptsComplete();
        }

    };
    
    var insertStyles = function(urls) {
        // define the head of the document for easy appends
        var head = document.getElementsByTagName('head')[0];
        
        // Cast urls to an Array.
        urls = urls.constructor === Array ? urls : [urls];
        
        var node;
        
        for (var i = 0; i < urls.length; i += 1) {
    
            // create a unique ID and add to our ID list
            var sc_id = generateId();
            //script_ids.push(sc_id);
    
            // create the script object, and append it to the head
            node = document.createElement('link');
            node.id = sc_id;
            node.href = urls[i];
            node.rel = "stylesheet";
            node.type = "text/css";
            node.media = "screen";
    
            head.appendChild(node);
        }
        
        // in MSIE, we will need to listen to the onreadystatechange
        // if the file is cached, we may not even see "loaded" as an option
        // and may instead see "complete". Because of this, we need to scan
        // for both. Script loading is linear, so we only need to watch
        // the last script we were inserting
        if (IEVersion) {
            node.onreadystatechange = function () {
                if (this.readyState == 'loaded' || this.readyState == 'complete') {
                    JIT.scriptsComplete();
                }
            };
        }
        else {
            // this is a non MSIE browser. We can use a safer method of
            // detecting when a script is done. We insert a small scriptlet
            // at the end of all our script objects which executes the
            // requestComplete() code.
            var sc_id = generateId();
            script_ids.push(sc_id);

            var smart_script = document.createElement('script');        
            smart_script.id = sc_id;
            smart_script.type = "text/javascript";
            smart_script.appendChild(document.createTextNode("JIT.scriptsComplete();"));

            head.appendChild(smart_script);
        }
    };
    
    var insertScripts = function(urls) {
        // define the head of the document for easy appends
        var head = document.getElementsByTagName('head')[0];
        
        // Cast urls to an Array.
        urls = urls.constructor === Array ? urls : [urls];
        
        // Load the scripts at the specified URLs.
        var script;

        for (var i = 0; i < urls.length; i += 1) {
    
            // create a unique ID and add to our ID list
            var sc_id = generateId();
            script_ids.push(sc_id);
    
            // create the script object, and append it to the head
            script = document.createElement('script');
            script.id = sc_id;
            script.src = urls[i];
            script.type = "text/javascript";
    
            head.appendChild(script);
        }

        // no script at this point, we're in trouble
        if (!script) {
            return;
        }

        // in MSIE, we will need to listen to the onreadystatechange
        // if the file is cached, we may not even see "loaded" as an option
        // and may instead see "complete". Because of this, we need to scan
        // for both. Script loading is linear, so we only need to watch
        // the last script we were inserting
        if (IEVersion) {
            script.onreadystatechange = function () {
                if (this.readyState == 'loaded' || this.readyState == 'complete') {
                    JIT.scriptsComplete();
                }
            };
        }
        else {
            // this is a non MSIE browser. We can use a safer method of
            // detecting when a script is done. We insert a small scriptlet
            // at the end of all our script objects which executes the
            // requestComplete() code.
            var sc_id = generateId();
            script_ids.push(sc_id);

            var smart_script = document.createElement('script');        
            smart_script.id = sc_id;
            smart_script.type = "text/javascript";
            smart_script.appendChild(document.createTextNode("JIT.scriptsComplete();"));

            head.appendChild(smart_script);
        }
    };
    
    /**
     * A helper function which completes the request
     * it fires off any callbacks that are required, and hands off the lock
     * to the next request in line
     **/
    var loadComplete = function() {
        // remove any script IDs we have made, they are all done
        // while (script_ids.length > 0) {
        //    var sc_id = script_ids.shift();
        //    var script = document.getElementById(sc_id);
        //    script.parentNode.removeChild(script);
        // }
        // script_ids = [];
        
        // Execute the callback.
        if (pending.callback) {
            if (pending.obj) {
                if (pending.scope) {
                    pending.callback.call(pending.obj);
                } else {
                    pending.callback.call(window, pending.obj);
                }
            } else {
                pending.callback.call();
            }
        }

        // release our lock which lets whatever is on setTimeout go
        pending.lock.release();
        
        // clear our pending object for the next request
        // not required, just nice to clean
        pending = null;
        
    };
    
    // begin public interface
    return {
        /**
         * Loads the specified script(s) and then sets up a call to requestComplete
         * this is the meat of the JIT loader.
         * @param {string|array} the URLs to load
         * @param {function} verifier a funtion definition that asserts load is done
         * @param {function} callback a function definition to call when loaded
         * @param {object} obj an object to pass to the callback function [object]
         * @param {boolean} scope if true, *callback* will be scoped to *obj*
         **/
        load: function(urls, verifier, callback, obj, scope) {
            handleLoad(urls, verifier, callback, obj, scope, "js", false);
        },
        
        addCss: function(urls, verifier, callback, obj, scope, ie_restrict) {
            if (!ie_restrict) {
                ie_restrict = "";
            }
            handleLoad(urls, verifier, callback, obj, scope, "css"+ie_restrict, true);
        },
        
        /**
         * Load a script only once. If that script has existed in our document.
         * When initialized, we poll and take a capture of all scripts. If
         * any urls are found, they will be discarded.
         * @param {string|array} the URLs to load
         * @param {function} verifier a funtion definition that asserts load is done
         * @param {function} callback a function definition to call when loaded
         * @param {object} obj an object to pass to the callback function [object]
         * @param {boolean} scope if true, *callback* will be scoped to *obj*
         **/
        loadOnce: function(urls, verifier, callback, obj, scope) {
            handleLoad(urls, verifier, callback, obj, scope, "js", true);
        },
        
        /**
         * Runs the current verifier until it passes, then calls loadComplete
         **/
        scriptsComplete: function() {
            // run the current verifier until it passes
            if (pending.verifier && !pending.verifier.call(window)) {
                // did not pass, try again in X seconds
                window.setTimeout(function() { JIT.scriptsComplete(); }, 100);
                return;
            }
            
            // loadComplete call to hand off and clean up
            loadComplete();
        }
    };
}();


(function() {
    var createCashshopJSPath = function(name) {
        return "http://"+GAIA_config("JSCOMPILER_SERVER")+"/src/_/"+GAIA_config("CACHE_VALUE")+"/js/cashshop/" + name;
    };
    var createCashshopRollupJSPath = function() {
        return "http://"+GAIA_config("JSCOMPILER_SERVER")+"/src/_/"+GAIA_config("CACHE_VALUE")+"/pkg-cashshop.js";
    };
    var createCashshopCSSPath = function(name) {
        // return "http://"+GAIA_config("JSCOMPILER_SERVER")+"/src/_/"+GAIA_config("CACHE_VALUE")+"/css/cashshop/" + name;
        return "http://"+GAIA_config("GRAPHICS_SERVER")+"/src/css/cashshop/" + name + "?"+GAIA_config("CACHE_VALUE");
    };

    var queued_show = false;
    
    var urls = {
        css: [createCashshopCSSPath("cashshop.css")],
        css_ie6: [createCashshopCSSPath("cashshop_ie6.css")],
        css_ie7: [createCashshopCSSPath("cashshop_ie7.css")],
        js_package: [createCashshopRollupJSPath()],
        concretes: [
            createCashshopJSPath("browser.js"),
            createCashshopJSPath("home.js"),
            createCashshopJSPath("gaiacashad.js"),
            createCashshopJSPath("cashheader.js"),
            createCashshopJSPath("giftmessage.js"),
            createCashshopJSPath("itemdetail.js"),
            createCashshopJSPath("itempreview.js"),
            createCashshopJSPath("npc.js"),
            createCashshopJSPath("privacy.js"),
            createCashshopJSPath("receipt.js"),
            createCashshopJSPath("reviewgift.js"),
            createCashshopJSPath("selectdestination.js"),
            createCashshopJSPath("shopbanner.js")
        ],
        applications: [createCashshopJSPath("cashshop.js")]
    };

    
    YAHOO.namespace("gaia.app.CashShop.SenderApplication");
    YAHOO.namespace("gaia.app.CashShop.Modules");
    
    var beginLoad = function() {};
    var onBaseCssComplete = function() {};
    var onIE7CssComplete = function() {};
    var onIE6CssComplete = function() {};
    var onAbstractsComplete = function() {};
    var onConcretesComplete = function() {};
    var onApplicationsComplete = function() {};
    
    var beginLoad = function() {
        JIT.addCss(urls.css, null, onBaseCssComplete);
    };
    
    var onBaseCssComplete = function() {
        JIT.addCss(urls.css_ie7, null, onIE7CssComplete, null, null, 7);
    };
    
    var onIE7CssComplete = function() {
        JIT.addCss(urls.css_ie6, null, onIE6CssComplete, null, null, 6);
    };
    
    var onIE6CssComplete = function() {
        // all CSS has been loaded
        // JIT.loadOnce(urls.abstracts, function() {
        //     return (YAHOO.gaia.app.CashShop.Modules.AbstractModule) ? true : false;
        // }, onAbstractsComplete);
        
        JIT.loadOnce(urls.js_package, function() {
            return (YAHOO.gaia.app.CashShop.SenderApplication.init) ? true : false;
        }, onApplicationsComplete);
    };

    // skipped if using rollup, go straight to app complete
    var onAbstractsComplete = function() {
        var ck = function() {
            if (YAHOO.gaia.app.CashShop.Modules.Browser
                && YAHOO.gaia.app.CashShop.Modules.HomeScreen
                && YAHOO.gaia.app.CashShop.Modules.GaiaCashAd
                && YAHOO.gaia.app.CashShop.Modules.CashHeader
                && YAHOO.gaia.app.CashShop.Modules.GiftMessage
                && YAHOO.gaia.app.CashShop.Modules.ItemDetail
                && YAHOO.gaia.app.CashShop.Modules.NPC
                && YAHOO.gaia.app.CashShop.Modules.Privacy
                && YAHOO.gaia.app.CashShop.Modules.Receipt
                && YAHOO.gaia.app.CashShop.Modules.ReviewGiftPurchase
                && YAHOO.gaia.app.CashShop.Modules.SelectDestination
                && YAHOO.gaia.app.CashShop.Modules.ShopBanner) {
                return true;
            }
            
            return false;
        };
        
        JIT.loadOnce(urls.concretes, ck, onConcretesComplete);
    };

    var onConcretesComplete = function() {
        JIT.loadOnce(urls.applications, function() {
            return (YAHOO.gaia.app.CashShop.SenderApplication.init) ? true : false;
        }, onApplicationsComplete);
    };
    
    var onApplicationsComplete = function() {
       YAHOO.gaia.app.CashShop.SenderApplication.init();

       // a show is waiting...
        if (queued_show) {
            YAHOO.gaia.app.CashShop.SenderApplication.show(queued_show);
            queued_show = false;
        }
    };


    // redefine the sender app's SHOW until we actually have it loaded
    YAHOO.gaia.app.CashShop.SenderApplication = { 
        show: function(oConfig) {
            queued_show = oConfig;
            beginLoad();
        }
    };
    
    // add a listener for the cash shop launcher to buy things for yourself.
    // if not found by window.onload, it won't attach
    YAHOO.util.Event.addListener("gaia_menuitem_cashshop", "click", function(e) {
		YAHOO.util.Event.stopEvent(e);
        YAHOO.gaia.app.CashShop.SenderApplication.show({
            store: 18,
            origin: "header",
            self: true
        });
    });

    //beginLoad();
})();

YAHOO.util.Event.onDOMReady(function() {
     if (location.search.match(/cashshop=true/)) {
         YAHOO.gaia.app.CashShop.SenderApplication.show({
             store: 18,
             origin: "url",
             self: true
         });
     }
});


YAHOO.namespace('gaia.widgets.addFriend');
YAHOO.gaia.widgets.addFriend = function() {
	var Y = YAHOO.util,
		E = Y.Event,
		C = Y.Connect,
		D = Y.Dom,
		timeout, markup, conn_url, f,
		rendered = false,
		anchor = null,
		requestSent = false,
		panel = new YAHOO.widget.Panel("addfriend", {
			fixedcenter : true,
			constraintoviewport : true,
			underlay : "none",
			close : true,
			visible : false,
			draggable : false,
			modal : true,
			zIndex: 1000,
			effect : {effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.25}
		}),
		key = new Y.KeyListener(document, {keys:27}, {
			fn: panel.hide,
			scope: panel,
			correctScope: true},"keyup"
		),
		sigs = D.getElementsByClassName('extra_sigs'),
		others = ['id_aquarium','ad_inject','ad_inject2'];

	panel.cfg.queueProperty("keylisteners", key);
	panel.hideEvent.subscribe(function() {
		if (timeout) {
			window.clearTimeout(timeout);
			timeout = null;
		}
		if (C.isCallInProgress(YAHOO.gaia.widgets.addFriend.async)) {
			C.abort(YAHOO.gaia.widgets.addFriend.async);
		}
		E.purgeElement(panel.body, true);
		try {
			D.removeClass(sigs,'friendhide');
			D.removeClass(others,'friendhide');
		}catch(e){}
		if (requestSent && anchor) {
			anchor.href = 'http://'+GAIA_config('main_server')+'/profile/friendlist.php?list=pending';
			anchor.setAttribute('onclick','');
			anchor.innerHTML = 'View Friend Requests';
			anchor.title = 'View your outgoing friend requests';
		}
		YAHOO.gaia.widgets.addFriend.processing = false;
	});

	var conn_callback = {
		success : function(o) {
			try {
				markup = YAHOO.lang.JSON.parse(o.responseText);
			}
			catch(err) {
				this.failure();
			}
			populatePanel(markup);
		},
		failure : function(o) {
			window.location = conn_url;
		},
		cache : false
	};

	var populatePanel = function(msg) {
		msg = msg || {};

		if (panel.body) {
			E.purgeElement(panel.body, true);
		}

		panel.setHeader(msg.header);
		panel.setBody(msg.body);
		if (!rendered) {
			panel.render(document.body);
			panel.innerElement.id = 'modal'
			rendered = true;
		}

		if (document.getElementById('addfriend_char_counter')) {
			var input = document.getElementById('message');
			var char_counter = document.getElementById('addfriend_char_counter');
			var max_chars = char_counter.innerHTML * 1;
			var text = document.getElementById('addfriend_char_counter_message');
			text.innerHTML = ' characters remaining.';

			acknowledgeRemainingCount = function() {
				remaining = max_chars - input.value.length;
				char_counter.innerHTML = remaining;
			};

			E.on(input, 'keydown', function(e) {
				if (e.keyCode == 13) {
					E.preventDefault(e);
					return;
				}
			});

			E.on(input, 'keyup', function(e) {
				if (input.value.length >= max_chars) {
					input.value = input.value.substr(0, max_chars);
				}

				if (!input.getAttribute('previous_length') || input.getAttribute('previous_length') != input.value.length) {
					input.setAttribute('previous_length', input.value.length);
					acknowledgeRemainingCount();
				}
			});
		}

		if (document.getElementById('addfriend_close')) {
			timeout = window.setTimeout(function(){panel.hide();},5*1000);
		}

		E.on('controls','click',function(e) {
			var target = E.getTarget(e);
			if (target.tagName.toLowerCase() == 'a') {
				E.stopEvent(e);
				panel.hide();
				YAHOO.gaia.widgets.addFriend.processing = false;
				return;
			}
			if (target.id == 'submitadd') {
				E.stopEvent(e);
				var formObject = document.getElementById('addfriendForm');
				C.setForm(formObject);
				YAHOO.gaia.widgets.addFriend.async = C.asyncRequest('POST',formObject.action,conn_callback,'view=ajax');
				requestSent = true;
				showLoader(true);
			}
		});
		panel.show();
		panel.center();
	};

	var showLoader = function(hasForm) {
		var msg = {
			header : '<h3>Loading...</h3>',
			body : '<p class="progress_indicator"><img src="http://'+GAIA_config("graphics_server")+'/images/loader.gif" height="60" width="72" alt="Please wait...Loading" title="Please wait...Loading" /></p>'
		};

		var formObject = document.getElementById('addfriendForm');
		if (hasForm===true && formObject) {
			// hide the form and add the msg. removing the form from the dom pisses IE off
			var parent = formObject.parentNode;
			formObject.style.display = 'none';
			var content = document.createElement('div');
			content.innerHTML = msg.body;
			parent.appendChild(content);
		}
		else {
			if (panel.body) {
				E.purgeElement(panel.body, true);
			}
			panel.setHeader(msg.header);
			panel.setBody(msg.body);
		}

		if (!rendered) {
			panel.render(document.body);
			panel.innerElement.id = 'modal'
			rendered = true;
		}
		panel.show();
		panel.center();
	};

	return {
		processing : false,
		doRequest : function(url) {
			try {
				try {
					D.addClass(sigs,'friendhide');
					D.addClass(others,'friendhide');
				}catch(e){}
				var separator = (conn_url.indexOf('?')>=0) ? '&' : '?';
				this.async = C.asyncRequest('GET',conn_url+separator+'view=ajax',conn_callback);
			}
			catch (err) {
				window.location = conn_url;
			}
		},
		click : function(event,friend_id) {
			if (this.processing) {
				return false;
			}
			this.processing = true;

			if (event) {
				anchor = E.getTarget(event);
				if(anchor){
					E.stopEvent(event);
				}
			}
			showLoader();

			conn_url = (typeof friend_id === 'undefined') ? anchor.href : '/friends/add/'+friend_id;

			if (!this.css) {
				Y.Get.css('http://'+GAIA_config("graphics_server")+'/src/css/friends/addfriend.css?'+Math.random(), {
					onSuccess : function(css_obj) {
						this.css = css_obj;
						this.doRequest(conn_url);
					},
					scope : this
				});
			}
			else {
				this.doRequest(conn_url);
			}
		}
	};
}();

(function($){

    // create the object to observe the MegaMenu (keep track of timer and currently opened menu)
    YAHOO.namespace("gaia.widgets");
    YAHOO.gaia.widgets.MegaMenu = {};
    YAHOO.gaia.widgets.MegaMenu = {
        initialDelay: 50,       // 0.05 seconds delay before the menu panel opens
        interMenuDelay: 150,    // 0.15 seconds tolerance
        currentMenu: -1,
        doFixups: false,
        fixupElements: null,
        timer: 0,
        elem: null,
        tabs: [],
        handleMouseIn: function(el) {
            var delay = 0;
            if(this.currentMenu < 0) { // are any of the panels already open?
                delay = this.initialDelay;
            } else {
                this.resetTimer(); // cancel any other use for the timer so we can use it
                delay = this.interMenuDelay;
            }
            
            var menu = this;
            this.timer = window.setTimeout( function(){menu.changeShownMenu(el);} , delay);
        },
        handleMouseOut: function() {
            this.resetTimer();
            var delay = 0;
            delay = this.interMenuDelay;
            var menu = this;
            this.timer = window.setTimeout(function(){menu.hideShownMenu();}, delay);
        },
        hideShownMenu: function() {
            $(this.tabs).removeClass('panel-open');	// remove class panel-open (to hide the panel with CSS)
            this.currentMenu = -1;
            this.hideFixups();
        },
        showHiddenMenu: function(el) {
            this.hideShownMenu();
            var cursorNode = $(el);
            cursorNode.addClass('panel-open');	// add class sfhover
                
            var position = 0;
            var siblings = [];
            while(cursorNode.prev().length) {
                position++;
                siblings.push(cursorNode.prev());
                cursorNode = cursorNode.prev();
            }
            this.currentMenu = position;
            this.showFixups();
        },
        changeShownMenu: function(newMenuToShow) {
            this.resetTimer();
            var menu = this;
            this.timer = window.setTimeout(function(){menu.showHiddenMenu(newMenuToShow);}, menu.interMenuDelay);
        },
        resetTimer: function() {
            window.clearTimeout(this.timer);
            this.timer = 0;
        },
        hideFixups: function() {
            if(this.doFixups && this.fixupElements)
                this.fixupElements.css('display', '');
            if(this.makeWindowsCompatible && this.windowsShowThruElements)
                this.windowsShowThruElements.css('display', '');
        },
        showFixups: function() {
            if(this.doFixups && this.fixupElements)
                this.fixupElements.css('display', 'none');
            if(this.makeWindowsCompatible && this.windowsShowThruElements)
                this.windowsShowThruElements.css('display', 'none');
        },
        handleFixups: function() {
            var isWindows = (navigator.userAgent.indexOf('Windows') >= 0);
            var isIE6 = yShort.isIE6();
            
            if(isIE6 || isWindows) {
                this.doFixups = true;
                this.fixupElements = yShort('#grid_ad, #featured_flash, SELECT');
            }
        },
        init: function(elem, menus) {
            this.elem = elem;
            this.tabs = menus;
            var menu = this;
            
            if(this.tabs)
                yShort(this.tabs).bind('mouseover', function(){
                    menu.handleMouseIn(this);
                }).bind('mouseout', function(){
                    menu.handleMouseOut(this);
                });
            
            this.handleFixups();
        }
    };
    
    /**
     *  Temporary JavaScript; The Simple nav will expire when the A/B testing finishes
     */
    YAHOO.gaia.widgets.SimpleNavMenu = {};
    YAHOO.gaia.widgets.SimpleNavMenu = {
        theAncestor: null,
        thePanels: [],
        init: function(ancestorEl, panelEls) {
            this.theAncestor = ancestorEl;
            this.thePanels = panelEls;
            
            yShort(this.thePanels).bind('mouseover', function() {
                yShort(this).addClass('sfhover1');
            }).bind('mouseout', function() {
                yShort(this).removeClass('sfhover1');
            });
        }
    };
    
    // means onDOMready, reassign YAHOO.util.Short into $ and use it inside the closure
    $(function(){
        $('body').removeClass('noJs');
        
        var menuEl = $('#newmenu');
        var menu = null;
        menuEl.appendTo('#gaia_menu_bar');
        
        if(menuEl.hasClass('mega-menu')) {
            menu = YAHOO.gaia.widgets.MegaMenu;
            // init the menu.  params: (1) the destination element (where the menu HTML will be moved/appended) (2) the menu panel ancestors
            menu.init($('#gaia_menu_bar'), $('#newmenu #nav li.standard, #newmenu #nav li.standard_ext'));
        } else {
            menu = YAHOO.gaia.widgets.SimpleNavMenu;
            menu.init($('#gaia_menu_bar'), $('#newmenu li'));
        }
    });
    
    //PreLoad header images
    var preload_image_urls = [
        '/images/gaia_global/gaia_panelnav/navsprite_01_PNG24.png',
        '/images/gaia_global/gaia_panelnav/bg_topnav_456x13.png',
        '/images/gaia_global/gaia_panelnav/ic_topnav_icons.png'
    ];
    
    for(var i in preload_image_urls)
        $('<img src=' + 'http://' + GAIA_config('graphics_server') + preload_image_urls[i] + ' />');

})(YAHOO.util.Short);

/**
 * Gaia Yowl
 * A JavaScript/YUI implementation of Growl - a messaging system
 * Designed to be reusable with many widgets, but primarily
 * Simple Usage:
 *   var yowl = new YAHOO.gaia.widgets.Yowl();
 *   yowl.notify('My message Text', 'my-message-class');
 *  
 */
(function() {
    YAHOO.namespace("gaia.tools");
    // create a function to test if the browser supports "position: fixed"
    YAHOO.gaia.tools.doesBrowserSupportFixedPosition = function() {
        var isSupported = false;
        if (document.createElement) {
            var el = document.createElement("div");
            if (el && el.style) {
                el.style.width = "1px";
                el.style.height = "1px";
                el.style.position = "fixed";
                el.style.top = "10px";
                var root = document.body;
                if (root && root.appendChild && root.removeChild) {
                    root.appendChild(el);
                    isSupported = (el.offsetTop === 10);
                    root.removeChild(el);
                }
                el = null;
            }
        }
        return isSupported;
    };

    YAHOO.namespace("gaia.widgets");
    YAHOO.gaia.widgets.Yowl = function(options) {
        options = options || {};
        var footerParent = document.getElementById('footer');
        var objDefaults = { duration: 6, delay: 0, fade: 0.3, theme: 'default-theme', section: 'no-section', parent: footerParent };
        
        this._browserSupportsFixed  = YAHOO.gaia.tools.doesBrowserSupportFixedPosition(); // if the browser doesn't support, we won't do any Yowl processing...
        this._queuedMessages    = [];
        this._currentMessage    = null;
        this._theme             = options.theme || objDefaults.theme;
        this._parentEl          = options.parent || objDefaults.parent;
    };
    
    Yowl = YAHOO.gaia.widgets.Yowl;
    
    Yowl.prototype.Message = function(yowl, message, options) {
        options = options || {};
        var objDefaults = { duration: 6, delay: 0, fade: 0.3, section: 'no-section', title: 'Notice', theme: 'default-theme' };
        
        this._messageText       = message || '';
        this._messageTitle      = options.title || objDefaults.title;
        this._timeDuration      = options.duration || objDefaults.duration;
        this._fadeDuration      = options.fade || objDefaults.fade;
        this._timeDisplayed     = 0;
        this._section           = options.section || objDefaults.section;
        this._transitionTimer   = null;
        this._timer             = null;
        this._anim              = null;
        this._el                = null;
        this._parentEl          = null;
        this._parentYowl        = yowl;
        this.close = function() {
            if(!this._parentYowl._browserSupportsFixed)
                return false;
            
            this.clear();
            this.hide();
            this._parentYowl.cleanUpAfterClose();
        };
        this.clear = function() {
            if(!this._parentYowl._browserSupportsFixed)
                return false;
            
            if(this._anim) {
                this._anim.stop(true);
                clearTimeout(this._timer);
            }
            this._timer = null;
            this._anim = null;
        };
        this.createHTML = function(yowl, parentEl) {
            if(!this._parentYowl._browserSupportsFixed)
                return false;
            
            if(!parentEl) { // append as a child to the body if parentEl was not passed as a param
                parentEl = document.getElementsByTagName('body');
                parentEl = parentEl[0];
            }
            
            if(!parentEl)
                return false;
            else
                this._parentEl = parentEl;
            
            if(!this._el) {
                this._el = document.createElement('DIV');
                this._el.className = 'yowl';
                this._el.innerHTML = '<div class="yowl-message ' + this._section + '"><div class="top"><h4><span class="icon"><!-- --></span>' + this._messageTitle + '<a href="#closeGrowl" class="close"><!-- --></a></h4></div><div class="message">' + this._messageText + '</div><div class="bottom"><span class="tail no-section"></span></div></div>';
            }
            
            YAHOO.util.Dom.setStyle(this._el, 'opacity', '0.0');
            
            yMsg = this;
            yShort(this._el).find("a.close").bind('click', function(e) {
                e.preventDefault();
                yMsg.close();
            });
            
            // we need to toggle the "display" to ensure a hidden layer doesn't block clicks to lower layers 
            YAHOO.util.Dom.setStyle(this._el, 'display', 'block');
            this._parentEl.appendChild(this._el);
            this._anim = new YAHOO.util.Anim(this._el, {
                opacity: {to: 1.0}
            }, this._fadeDuration, YAHOO.util.Easing.easeOut);
            this._anim.onComplete.subscribe(function(){ yMsg.isShown(); });
            this._anim.animate();
        };
        this.isShown = function() {
            if(!this._parentYowl._browserSupportsFixed)
                return false;
            
            yMsg = this;
            this._timer = setTimeout(function(){ yMsg.hide(); }, this._timeDuration * 1000);
        };
        this.hide = function() {
            if(!this._parentYowl._browserSupportsFixed)
                return false;
            
            this._anim = new YAHOO.util.Anim(this._el, {
                opacity: {to: 0.0}
            }, this._fadeDuration, YAHOO.util.Easing.easeOut);
            yMsg = this;
            this._anim.onComplete.subscribe(function(){ yMsg.hideCleanup(); });
            this._anim.animate();
        };
        this.hideCleanup = function() {
            if(!this._parentYowl._browserSupportsFixed)
                return false;
            
            // we need to toggle the "display" to ensure a hidden layer doesn't block clicks to lower layers 
            if(this._el) {
                YAHOO.util.Dom.setStyle(this._el, 'display', 'none');
                this._el.parentNode.removeChild(this._el);
            }
            this._parentYowl.cleanUpAfterClose();
        };
    };
    
    /*
     * Yowl showMessage()
     * Animate the Yowl message in.
     */
    Yowl.prototype.showMessage = function(message) {
        if(!this._browserSupportsFixed)
            return null;
        
        yowl = this;
        message.createHTML(yowl, document.getElementById('footer'));
    };
    
    YAHOO.gaia.widgets.Yowl.prototype.addMessage = function(message) {
        if(!this._browserSupportsFixed)
            return null;
        
        if(!this._currentMessage)
            this._currentMessage = message;
        else
            this._queuedMessages.unshift(message);
    };
    
    Yowl.prototype.nextMessage = function() {
        if(!this._browserSupportsFixed)
            return null;
        
        if(this._currentMessage)
            this._currentMessage.clear(); // the current hitter is on base...
        this._currentMessage = this._queuedMessages.shift(); // shift the next message into the batter's box
        
        if(this._currentMessage)
            this.showMessage(this._currentMessage);
    };
    
    Yowl.prototype.cleanUpAfterClose = function() {
        if(!this._browserSupportsFixed)
            return null;
        
        this.nextMessage();
    };
    
    Yowl.prototype.clearAll = function() {
        if(!this._browserSupportsFixed)
            return null;
        
        var mql = this._messageQueue.length;
        // call a "clear()" on each Message object
        for(var i = 0; i < mql; i++) {
            this._messageQueue[i].clear();
        }
        // clear the Message objects from 
        this._messageQueue = [];
        
        this._currentMessage.clear();
        this._currentMessage = null;
    };

    Yowl.prototype._validateSection = function(section) {
        if(/^(no|friend|notification|sysmsg|pm|gim)-section$/.test(section))
            return section;
        else
            return 'no-section';
    };
    
    Yowl.prototype.notify = function(messageText, section, messageTitle) {
        if(!this._browserSupportsFixed)
            return null;
        
        var thisMessage = new this.Message(this, messageText, {section: this._validateSection(section), title: messageTitle});
        this.addMessage(thisMessage);
        this.showMessage(this._currentMessage);
    };
})();

/**
 * Gaia Footer
 * @require YUI (YAHOO.util.Dom, YAHOO.util.Cookie, YAHOO.gaia.widgets.Yowl)
 * A menu for the "fixed" footer.
 * Code handles:
 *  - Show/hide menu on trigger action (click)
 *  - Hide menu on "close button" click
 *  - No two menus should display at the same time.
 *  
 */
YAHOO.gaia.util.dump = function (arr,level) {
    var dumped_text = "";
    if (!level) {
        level = 0;
    }

    //The padding given at the beginning of the line.
    var level_padding = "";
    for (var j=0; j<level + 1; j++) {
        level_padding += "    ";
        if (level > 5) {
            level_padding += '...';
            return level_padding;
        }
    }

    // arrays hashes and objects
    if (typeof(arr) == 'object') {
        for (var item in arr) if (YAHOO.lang.hasOwnProperty(arr, item)) {
            var value = arr[item];
 
            if(typeof(value) == 'object') {
                // recursion occurs here because it is an object / hash / etc
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += YAHOO.gaia.util.dump(value,level+1);
            }
            else {
                // does not have anything deeper at that point
                dumped_text += level_padding + "'" + item + "' => ("+typeof(value)+") \"" + value + "\"\n";
            }
        }
    }
    else {
        // strings, etc are all output normally
        dumped_text = "("+typeof(arr)+") \"" + arr + "\"";
    }

    return dumped_text;
};




(function(){
    YAHOO.namespace("gaia.widgets");
    YAHOO.gaia.widgets.Footer = new Object();
    YAHOO.gaia.widgets.Footer = function() {
        this._currentPanel = null;
        this._theDLs = [];
        this._footerYowl = null;
        this._collapseActionEl = null;
        this._hasInitFList = 0;
        this._hasInitQLinks = 0;
    };

    YAHOO.gaia.widgets.Footer.showMenu = function(theDlElem) {
        if(!theDlElem)
            return;
        else if(typeof(theDlElem) == 'object' || typeof(theDlElem) == 'array')
            theDlElem = theDlElem[0];
        
		
    
        var newEPos = -1;
        for(i = 0; i < this._theDLs.length; i++) {
            
            theDL = this._theDLs[i];
            YAHOO.util.Dom.replaceClass(theDL, 'active', 'inactive');
            if(theDL == theDlElem)
                newEPos = i;
        }
            
        YAHOO.util.Dom.replaceClass(theDlElem, 'inactive', 'active');
        if(newEPos > -1) {
            YAHOO.util.Cookie.set('footer_menu', newEPos, {path: '/', expires: new Date("January 12, 2025")});
        }
    };
    
    YAHOO.gaia.widgets.Footer.hideMenu = function(theDlElem) {
        if(!theDlElem)
            return;
        YAHOO.util.Dom.replaceClass(theDlElem, 'active', 'inactive');
        YAHOO.util.Cookie.set('footer_menu', -1, {path: '/', expires: new Date("January 12, 2025")});
    };
        
    YAHOO.gaia.widgets.Footer.handleStatusYowls = function(theTSObj) {
        if(!theTSObj)
            return;
        
        var showThisStatus = false;
        for(var i in theTSObj) {
            thisTS = theTSObj[i];
            if(i != 'now' && parseInt(thisTS.ldate) > 0  && parseInt(thisTS.count) > 0) {
                if(!showThisStatus)
                    showThisStatus = i;
                else if(parseInt(thisTS.ldate) > parseInt(showThisStatus.ldate))
                    showThisStatus = i;
            }
        }
        var message = '';
        var theStatusObj = theTSObj[showThisStatus];
        var haveYowlData = false;
        if(/^(pm|trade|friend|profilecomment|sysmsg)$/.test(showThisStatus)) {
            if(showThisStatus == 'profilecomment') {
                message = '' + theStatusObj.count + ' Profile Comment' + (theStatusObj.count > 0 ? 's' : '');
                section = 'notification-section';
                sectionTitle = 'New Notifications';
                haveYowlData = true;
            } else if(showThisStatus == 'pm') {
                message = '' + theStatusObj.count + ' Private Message' + (theStatusObj.count > 0 ? 's' : '');
                section = 'pm-section';
                sectionTitle = 'New PMs';
                haveYowlData = true;
            } else if(showThisStatus == 'trade') {
                message = '' + theStatusObj.count + ' Trade Request' + (theStatusObj.count > 0 ? 's' : '');
                section = 'notification-section';
                sectionTitle = 'New Notifications';
                haveYowlData = true;
            } else if(showThisStatus == 'friend') {
                message = '' + theStatusObj.count + ' Friend Request' + (theStatusObj.count > 0 ? 's' : '');
                section = 'friend-section';
                sectionTitle = 'New Notifications';
                haveYowlData = true;
            } else if(showThisStatus == 'sysmsg') {
                message = theStatusObj.message || 'System Message';
                section = 'sysmsg-section';
                sectionTitle = 'System Alert';
                haveYowlData = true;
            }
        }
        
        if(haveYowlData) { // do we have any data to show?
            var lastShownRaw = YAHOO.util.Cookie.get('footer_yowl');
            var lastShown = '';
            var lastShownSysmsg = false;
            var suppressSysMsgYowl = false;
            if(lastShownRaw) { // if we've stored the "last displayed time" in the cookie...
                var tmp = lastShownRaw.split('|');
                lastShown = parseInt(tmp[0]);
                lastShownSysmsg = tmp[1]; // let's compare the last message content (if it was a sysmsg) with any current sysmsg
            } else {
                lastShown = 0;
            }
            
            var persistentSysmsgText = '';
            if(lastShownSysmsg && section == 'sysmsg-section') {
                persistentSysmsgText = message;
                if(lastShownSysmsg == message)
                    suppressSysMsgYowl = true;
            }
            
            if(lastShown < parseInt(theStatusObj.ldate)) { // don't show any data if it's older than the most-recently-shown Yowl (according to the cookie)
                YAHOO.util.Cookie.set('footer_yowl', theStatusObj.ldate + '|' + persistentSysmsgText, {path: '/', expires: new Date("January 12, 2025")});
                if(!suppressSysMsgYowl)
                    this._footerYowl.notify(message, section, sectionTitle);
            }
        }
    };
    
    /**
     *  updateChatLink
     *  Dynamically show/hide the "chat" link as GIM notifies us of a user's GIM online status
     *  @param nameToLookup is a gim-style username (normalized to alphanumeric and lowercase)
     *  @param isOnline boolean - the new online_status of this user
     */
    YAHOO.gaia.widgets.Footer.updateChatLink = function(nameToLookup, isOnline) {
        if(!YAHOO.gaia.widgets.Footer.friendlistGimusernames) // this mapping object should be defined in the HTML when the Footer loads
            return false; // this function can't do anything if this object didn't load
        
        var uid = YAHOO.gaia.widgets.Footer.friendlistGimusernames[nameToLookup];
        if(!uid)
            return false;
        
        var el = document.getElementById('footer_fl_chatlink_gimname_' + nameToLookup); // this function expects an HTML element with this ID format
        if(el) {
            if(isOnline) {
                YAHOO.util.Dom.setStyle(el, 'display', 'inline');
            } else {
                YAHOO.util.Dom.setStyle(el, 'display', 'none');
            }
        }
    };
    
    YAHOO.gaia.widgets.Footer.init = function() {
        var footer = YAHOO.gaia.widgets.Footer;
		var plusButton = document.getElementById('plus');

        this._footerYowl = new YAHOO.gaia.widgets.Yowl();
        
    	// create footer menu/panel observers
        //	var footerPanels = YAHOO.util.Short('#footer ul li.tab-menu');
        var footerPanels = YAHOO.util.Short('#footer ul li.tab-menu dt.tab-handle');
    	// suppress any A tags which have the "suppress-link" class (designed for footer: friends list -- can be supressed server-side by a config)
		var suppressLinks = YAHOO.util.Short('#footer dt a.suppress-link');
		suppressLinks.bind('click', function(e) {
            YAHOO.util.Event.preventDefault(e);
		});
		
    	if(footerPanels) {
            footerPanels.bind('click', function(){
             		//var theDL = YAHOO.util.Short(this).find('dl').eq(0);
					var theLi = YAHOO.util.Short(this).ancestors('li').eq(0);
                    var theDL = YAHOO.util.Short(this).ancestors('dl').eq(0);
					var theDt = YAHOO.util.Short(this).ancestors('dt').eq(0);
        		if(theDL.hasClass('inactive')) {
                      footer.showMenu(theDL);
					  if(theLi.hasClass('quick-links')){
						plusButton.style.visibility = "hidden";
					  }else{
						plusButton.style.visibility = "visible";
					  }
                  } else {
                    footer.hideMenu(theDL);
					if(theLi.hasClass('quick-links')){
						plusButton.style.visibility = "visible";			
					}
                 }
            	});
        
        	// create close-box observers
        	YAHOO.util.Short('#footer ul li.tab-menu .close').bind('click', function(){
                    // var theDL = YAHOO.util.Short(this).find('dl');
        		var theDL = YAHOO.util.Short(this).ancestors('dl');
				var theLi = YAHOO.util.Short(this).ancestors('li');
				if(theLi.hasClass('quick-links')){
					plusButton.style.visibility = "visible";
				}
                footer.hideMenu(theDL);
            });
            
            YAHOO.util.Short('#footer .collapse-action').bind('click', function(){
                try{
                    var footerEl = YAHOO.util.Dom.get('footer');
                    // toggle 'collapse-action' class from this
                    if(YAHOO.util.Dom.hasClass(footerEl, 'collapse-action')) {
                        YAHOO.util.Dom.removeClass(footerEl, 'collapse-action');
                        YAHOO.util.Short(this).attr('title', 'Collapse the footer');
                        YAHOO.util.Cookie.set('footer_display_state', 1, {path: '/', expires: new Date("January 12, 2025")});
                        YAHOO.gaia.widgets.Footer._getData("setgfooterdisplay",{display:0},"handleSetDisplay","handleError");
                    } else {
                        YAHOO.util.Dom.addClass(footerEl, 'collapse-action');
                        YAHOO.util.Short(this).attr('title', 'Expand the footer');
                        YAHOO.util.Cookie.set('footer_display_state', 2, {path: '/', expires: new Date("January 12, 2025")});
                        YAHOO.gaia.widgets.Footer._getData("setgfooterdisplay",{display:1},"handleSetDisplay","handleError");
                    }
                } catch(err) {
                    console.debug(err);
                }
                return false;
            });
			
			YAHOO.util.Short('#add-quick-link-plus').bind('click', function(e){
			    YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer._getData("editquicklinks",null,"initQuickLinkSuccess","handleError");
			});

            YAHOO.util.Short('#add-quick-link').bind('click', function(e){
                    YAHOO.util.Event.preventDefault(e);
                    YAHOO.gaia.widgets.Footer._getData("editquicklinks",null,"initQuickLinkSuccess","handleError");
            });
            YAHOO.util.Short('#edit-quick-link').bind('click', function(e){
                    YAHOO.util.Event.preventDefault(e);
                    YAHOO.gaia.widgets.Footer._getData("editquicklinks",null,"initEditSuccess","handleError");
            });

            YAHOO.util.Short('li.online-friends').bind('click', function(e){
                     if(!this._hasInitFList){
                         this._hasInitFList = 1;
                         var wt = YAHOO.util.Short('li.online-friends img.friends-waiting');
                         wt.css('display','block');
                         var args={};
                         YAHOO.gaia.widgets.Footer._getData("getfriendlist",args,"getFriendListSuccess","handleError");
                     }
            });

            YAHOO.util.Short('li.quick-links').bind('click', function(e){
                     var args={};
                     if(!this._hasInitQLinks){
                         this._hasInitQLinks = 1;
                         var wt = YAHOO.util.Short('li.quick-links img.quicklinks-waiting');
                         wt.css('display','block');
                         var args = {};
                         YAHOO.gaia.widgets.Footer._getData("getquicklinks",args,"addQuickLinkSuccess","handleError");                     
                     }
            });


          
    	}
    	
    	footer._theDLs = YAHOO.util.Short('#footer ul li.tab-menu dl');
    };




    YAHOO.gaia.widgets.Footer.addQuickLink = function() { 	
        var short = YAHOO.util.Short;
        var args = {"url":escape(short("#gfooter-url").val()).replace("+","%2B").replace("/","%2F"),"title":short("#gfooter-title").val(),"nonce":short("#gfooter-nonce").val(),"action":"submit"};
        YAHOO.gaia.widgets.Footer._getData("editquicklinks",args,"initEditSuccess","handleError");
       
    };

    YAHOO.gaia.widgets.Footer.initReplace = function(link){	
        var position = link.attr('id').substring(10);
        var short = YAHOO.util.Short;
        var args = {"position":position};       
        YAHOO.gaia.widgets.Footer._getData("editquicklinks",args,"initReplaceSuccess","handleError");
		
		var addButton = document.getElementById("add-quick-link");
		addButton.style.visibility = "hidden";
		var editButton = document.getElementById("edit-quick-link");
		editButton.style.visibility = "hidden";	
		var editHeader = document.getElementById("edit-quick-links-header");
		editHeader.style.display = "block";
    };

    YAHOO.gaia.widgets.Footer.removeQuickLink = function(link){
        var position = link.attr('id').substring(9);
        var short = YAHOO.util.Short;
        var args = {"position":position,"nonce":short("#gfooter-nonce").val(),"action":"delete"};
        YAHOO.gaia.widgets.Footer._getData("editquicklinks",args,"initEditSuccess","handleError");
        
        // animate the delete action
        var theRowLi = link.parent().parent();
        if(theRowLi.length > 0) {
            var anim = new YAHOO.util.Anim(theRowLi[0], {height: { to: 1 }, duration: 750, delay: 200 })
            anim.animate();
        }
    }

    YAHOO.gaia.widgets.Footer.replaceQuickLink = function() {  
        var short = YAHOO.util.Short;
        var args = {position:short("#position").val(),url:escape(short("#gfooter-url").val()).replace("+","%2B").replace("/","%2F").substring(0, 255),title:short("#gfooter-title").val().substring(0, 30),nonce:short("#gfooter-nonce").val(),action:"replace"};
        YAHOO.gaia.widgets.Footer._getData("editquicklinks",args,"initEditSuccess","handleError");
    };

     YAHOO.gaia.widgets.Footer.refreshQuickLink = function() {  
         var args = {};
         YAHOO.gaia.widgets.Footer._getData("getquicklinks",args,"addQuickLinkSuccess","handleError");

     }



    //Ajax CallBacks

    YAHOO.gaia.widgets.Footer.addQuickLinkSuccess = function(o) { 
        if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;		
		
        var data  =  eval("(" + o.responseText + ")").quicklinks;
        var cont = YAHOO.util.Short('li.quick-links dd.quick-links-content ul');
        var ql = [];
        for(i=0;i<data.length;i++) {
            var cInfo = "";
            if(i == 0 ) cInfo='class="first"';
            if(i == (data.length -1)) cInfo='class="last"';
            ql.push('<li><a '+cInfo+' href="'+data[i].url+'">'+data[i].title+'</a></li>');
        }
        cont.html(ql.join(""));
        
    }

    YAHOO.gaia.widgets.Footer.getFriendListSuccess = function(o) { 
        if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;
        var data =  eval("(" + o.responseText + ")");
        var fl =[];
        var yshort = YAHOO.util.Short;
        var cont = yshort('li.online-friends ul#friend-list-container');
        var fhdr = yshort('li.online-friends span.friend-header');
        var fcnt = yshort('li.online-friends span.count');
        var slnk = yshort('li.online-friends a.suppress-link');
        for(i=0;i<data.friendList.length;i++) {
            f = data.friendList[i];
            fl.push('<li><div class="dropBox"><img src="http://'+GAIA_config('avatar_server')+'/gaia/members/'+f.hs+'" title="'+f.uid+'" class="avatarImage gfooter" alt="'+f.un+'"/></div><h5>'+f.un+'</h5>');
            if(f.lurl.length)
                fl.push('<a href="'+f.lurl+'">'+f.ltitle+'</a>');
            else{
                if(f.ltitle.length)
                    fl.push(f.ltitle);
                else
                    fl.push('Idle');
            }
            var display ="none";
            if(YAHOO.gaia.app.Gim.transactions.isOnline(f.fid+'@gaiaonline.com')){
                display ="inline";
            }
            fl.push('<span id="footer_fl_chatlink_gimname_'+f.fid+'" style="display:'+display+';"> | <a href="javascript:YAHOO.gaia.widgets.getIM('+"'"+f.uid+"'"+');">Chat</a></span>');
            YAHOO.gaia.widgets.Footer.friendlistGimusernames[f.fid] = true;
        }
        cont.html(fl.join(""));
        var pl = ''
        if( data.totalOnline > 1) pl='s';
        fcnt.html('('+data.totalOnline+')')
        fhdr.html('Online Friend' +pl+ ' ('+data.totalOnline+')');
        slnk.attr('alt','Online Friend'+pl+ ' '+data.totalOnline);
        slnk.attr('title','Online Friend'+pl+ ' '+data.totalOnline);
        YAHOO.gaia.app.dropdown();
        YAHOO.gaia.app.dropdown.headshotEvents();
    }

    YAHOO.gaia.widgets.Footer.handleError = function(o) {
        if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;
        var data  =  eval("(" + o.responseText + ")");   
        var cont = YAHOO.util.Short('li.quick-links dd.quick-links-content ul');
        if(typeof(data.code) == "undefined") {
            cont.html('<li id="q-error-message" style="white-space:normal">Whoops, There was an error in your connection.<a href="'+
                      YAHOO.gaia.widgets.Footer.pageurl +'">Click here</a> to retry.</li>');
        }
        else{
            switch(data.code){
            case 504:
                cont.html('<li id="q-error-message" style="white-space:normal">Whoops, You must be logged in to complete this action.<a href="http://'+
                      GAIA_config('main_server') +'">Click here</a> to log in.</li>');

            break;
            case 500:
            case 501:
            case 502:
            case 505:
          
                cont.html('<li id="q-error-message" style="white-space:normal">'+data.message+'</li>');

                var myAnim = new YAHOO.util.Anim('q-error-message', {opacity:  
                    {from:1,to:0.70 }  
                    },5,YAHOO.util.Easing.easeOut); 
                myAnim.onComplete.subscribe(YAHOO.gaia.widgets.Footer.refreshQuickLink);
                myAnim.animate(); 
            break;

            default:
               cont.html('<li id="q-error-message" style="white-space:normal">Whoops, Something went wrong.<a href="http://'+
                         GAIA_config('main_server') +'">Click here</a> to refresh the page.</li>');
            break;
            }
        }
    };

    YAHOO.gaia.widgets.Footer.handleSetDisplay = function(o) {
        return true;
    }

    YAHOO.gaia.widgets.Footer.initEditSuccess = function(o){
	
        if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;
		
		var addButton = document.getElementById("add-quick-link");
		addButton.style.visibility = "hidden";
		var editButton = document.getElementById("edit-quick-link");
		editButton.style.visibility = "hidden";	
		var editHeader = document.getElementById("edit-quick-links-header");
		editHeader.style.display = "block";
		
        var data  =  eval("(" + o.responseText + ")");
        var cont = YAHOO.util.Short('li.quick-links dd.quick-links-content ul');
        var ql = [];
        for(i=0;i<data.quicklinks.length;i++) {
            var cInfo = "";
            if(i == 0 ) cInfo='class="first"';
            if(i == (data.quicklinks.length -1)) cInfo='class="last"';
            ql.push('<li '+cInfo+'><span style="display:inline;" class="update-quicklink"><button class="del-quicklink" id="quickdel_'+i+'"></button><button class="edit-quicklink" id="quickedit_'+i+'"></button></span><a style="position: relative;  top: 3px; left: 3px; text-decoration: none;" href="'+data.quicklinks[i].url+'">'+data.quicklinks[i].title+'</a></li>');
        }
        ql.push('<input type="hidden" id="gfooter-nonce" name="gfooter-nonce" value="'+data.nonce+'">');
		ql.push('<button class="done-edit-quick-links" value="done" />');
        cont.html(ql.join(""));

      

        YAHOO.util.Short('#footer ul li.tab-menu .del-quicklink').bind('click', function(e){
                var link = YAHOO.util.Short(this);
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer.removeQuickLink(link);				
        });
       
        YAHOO.util.Short('#footer ul li.tab-menu .edit-quicklink').bind('click', function(e){
                var link = YAHOO.util.Short(this);
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer.initReplace(link);			
        });
		
        YAHOO.util.Short('#footer ul .done-edit-quick-links').bind('click', function(e){
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer._getData("editquicklinks",null,"addQuickLinkSuccess","handleError");
                return false;
            });	
        
    }

    YAHOO.gaia.widgets.Footer.initReplaceSuccess = function(o){
        var footer = YAHOO.gaia.widgets.Footer;
        if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;
		
        var data  =  eval("(" + o.responseText + ")");
        if(typeof(data.quicklinks[data.position]) == 'undefined')
            data.quicklinks[data.position]={url:"",title:""};

        var cont = YAHOO.util.Short('li.quick-links dd.quick-links-content ul');
        cont.html('<form id="quicklink-form" name="quicklinkform" method="post"><li><label>Quick link URL</label></li><li><input type="text" id="gfooter-url" name="gfooter-url" class="light-grey-text" value="'+ data.quicklinks[data.position].url+'" maxlength="255" /></li><li><label>Give this link a short name</label></li><li><input type="text" id="gfooter-title" name="gfooter-title" class="light-grey-text" value="'+ data.quicklinks[data.position].title+'" maxlength="30" /></li><li><input type="hidden" id="gfooter-nonce" name="gfooter-nonce" value="'+data.nonce+'" /><input type="hidden" id="position" name="position" value="'+data.position+'" /><button class="save-quicklink" type="submit" value="replace"></button><button class="cancel-quicklink" value="cancel"></button></form></li>');
       
        YAHOO.util.Short('form#quicklink-form').bind('submit', function(e){
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer.replaceQuickLink();
                return false;
            });
        
        YAHOO.util.Short('#footer ul li.tab-menu .cancel-quicklink').bind('click', function(e){
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer._getData("editquicklinks",null,"addQuickLinkSuccess","handleError");
                return false;
            });
        
        greyIfDefault = function(theE) {
            $this = YAHOO.util.Short(theE);
            if(theE.defaultValue != $this.val())
                $this.removeClass('light-grey-text');
            else
                $this.addClass('light-grey-text');
        };
        
        YAHOO.util.Short('#gfooter-url').bind('change', function(e){
            greyIfDefault(this);
        }).bind('keyup', function(e){
            greyIfDefault(this);
        });
        
        YAHOO.util.Short('#gfooter-title').bind('change', function(e){
            greyIfDefault(this);
        }).bind('keyup', function(e){
            greyIfDefault(this);
        });
    }

  


    YAHOO.gaia.widgets.Footer.initQuickLinkSuccess = function(o) {
        var footer = YAHOO.gaia.widgets.Footer;
        if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;
		
		var addButton = document.getElementById("add-quick-link");
		addButton.style.visibility = "hidden";
		var editButton = document.getElementById("edit-quick-link");
		editButton.style.visibility = "hidden";	
		var addHeader = document.getElementById("add-quick-link-header");
		addHeader.style.display = "block";			
		
        var data  =  eval("(" + o.responseText + ")");
        var cont = YAHOO.util.Short('li.quick-links dd.quick-links-content ul');
        cont.html('<form id="quicklink-form" name="quicklinkform" method="post"><li><label>Quick link URL</label></li><li><input type=text id="gfooter-url" name="gfooter-url" class="light-grey-text" value="'+footer.pageurl+'" maxlength="255" /></li><li><label>Give this link a short name</label></li><li><input type=text id="gfooter-title" name="gfooter-title"" class="light-grey-text" value="'+footer.pagetitle+'" maxlength="30" /></li><li><input type="hidden" id="gfooter-nonce" name="gfooter-nonce" value="'+data.nonce+'" /><button class="save-quicklink" type="submit" value="add"></button><button class="cancel-quicklink" value="cancel"></button></li></form>');

        
        var theDL = YAHOO.util.Short('#add-quick-link').ancestors('dl').eq(1);
        if(theDL.hasClass('inactive')) {
            footer.showMenu(theDL);
        } else {
            footer.hideMenu(theDL);
        }

        YAHOO.util.Short('form#quicklink-form').bind('submit', function(e){
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer.addQuickLink();
                return false;
            });

         YAHOO.util.Short('#footer ul li.tab-menu .cancel-quicklink').bind('click', function(e){
                YAHOO.util.Event.preventDefault(e);
                YAHOO.gaia.widgets.Footer._getData("editquicklinks",null,"addQuickLinkSuccess","handleError");												
                return false;
            });
			
        greyIfDefault = function(theE) {
            $this = YAHOO.util.Short(theE);
            if(theE.defaultValue != $this.val())
                $this.removeClass('light-grey-text');
            else
                $this.addClass('light-grey-text');
        };
        YAHOO.util.Short('#gfooter-url').bind('change', function(e){
            greyIfDefault(this);
        }).bind('keyup', function(e){
            greyIfDefault(this);
        });
        
        YAHOO.util.Short('#gfooter-title').bind('change', function(e){
            greyIfDefault(this);
        }).bind('keyup', function(e){
            greyIfDefault(this);
        });
    };



    //MAIN AJAX HANDLER
    YAHOO.gaia.widgets.Footer._getData = function(method,params,handler,errhandler) {
        var footer = YAHOO.gaia.widgets.Footer;
        var path = "http://"+GAIA_config('main_server') + '/gapi/rest/gfooter/?';
        var callback = {
        success: function(o) {
                if(eval("(" + o.responseText + ")").statusCode != 200)
                     eval("footer."+errhandler+"(o)");
                else
                    eval("footer."+handler+"(o)");
            },
        failure: function(o) {
                eval("footer."+errhandler+"(o)");
            },
        scope:this

        }
        var args = 'method='+method;
        if(typeof(params) != 'undefined'){
            if (typeof(params) == 'object') {
                for (var item in params)
                    args +="&"+item +"="+params[item];
            }
        }
		
		var addButton = document.getElementById("add-quick-link");
		addButton.style.visibility = "visible";
		var editButton = document.getElementById("edit-quick-link");
		editButton.style.visibility = "visible";	
		var addHeader = document.getElementById("add-quick-link-header");
		addHeader.style.display = "none";		
		var editHeader = document.getElementById("edit-quick-links-header");
		editHeader.style.display = "none";	
		
        // alert(args);
        YAHOO.util.Connect.asyncRequest('POST',path,callback,args);
    }


})();


// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.


YAHOO.namespace("gaia.app.FlashUtil");

(function(){
    YAHOO.gaia.app.FlashUtil = function(){
        var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
        var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
        var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
        

        var FU = {
            isIE:isIE,
            isWin:isWin,
            isOpera:isOpera,
            
            ControlVersion: function(){
                var version;
                var axo;
                var e;
                // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
                try {
                    // version will be set for 7.X or greater players
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
                    version = axo.GetVariable("$version");
                } 
                catch (e) {
                }
                if (!version)
                    {
                        try {
                            // version will be set for 6.X players only
                            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                            // installed player is some revision of 6.0
                            // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
                            // so we have to be careful. 
                            // default to the first public version
                            version = "WIN 6,0,21,0";
                            // throws if AllowScripAccess does not exist (introduced in 6.0r47)		
                            axo.AllowScriptAccess = "always";
                            // safe to call for 6.0r47 or greater
                            version = axo.GetVariable("$version");
                        } 
                        catch (e) {
                        }
                    }
            
                if (!version)
                    {
                        try {
                            // version will be set for 4.X or 5.X player
                            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
                            version = axo.GetVariable("$version");
                        } 
                        catch (e) {
                        }
                    }

                if (!version)
                    {
                        try {
                            // version will be set for 3.X player
                            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
                            version = "WIN 3,0,18,0";
                        } 
                        catch (e) {
                        }
                    }

                if (!version)
                    {
                        try {
                            // version will be set for 2.X player
                            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                            version = "WIN 2,0,0,11";
                        } 
                        catch (e) {
                            version = -1;
                        }
                    }
	
                return version;
            },

            // JavaScript helper required to detect Flash Player PlugIn version information
            GetSwfVer:function() {
                // NS/Opera version >= 3 check for Flash plugin in plugin array
                var flashVer = -1;
	
                if (navigator.plugins != null && navigator.plugins.length > 0) {
                    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
                        var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                        var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
                        var descArray = flashDescription.split(" ");
                        var tempArrayMajor = descArray[2].split(".");			
                        var versionMajor = tempArrayMajor[0];
                        var versionMinor = tempArrayMajor[1];
                        var versionRevision = descArray[3];
                        if (versionRevision == "") {
                            versionRevision = descArray[4];
                        }
                        if (versionRevision[0] == "d") {
                            versionRevision = versionRevision.substring(1);
                        } else if (versionRevision[0] == "r") {
                            versionRevision = versionRevision.substring(1);
                            if (versionRevision.indexOf("d") > 0) {
                                versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
                            }
                        }
                        var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
                    }
                }
                // MSN/WebTV 2.6 supports Flash 4
                else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
                // WebTV 2.5 supports Flash 3
                else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
                // older WebTV supports Flash 2
                else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
                else if ( isIE && isWin && !isOpera ) {
                    flashVer = FU.ControlVersion();
                }	
                return flashVer;
            },

            // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
            DetectFlashVer: function(reqMajorVer, reqMinorVer, reqRevision){
                versionStr = FU.GetSwfVer();
                if (versionStr == -1 ) {
                    return false;
                } else if (versionStr != 0) {
                    if(isIE && isWin && !isOpera) {
                        // Given "WIN 2,0,0,11"
                        tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
                        tempString        = tempArray[1];			// "2,0,0,11"
                        versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
                    } else {
                        versionArray      = versionStr.split(".");
                    }
                    var versionMajor      = versionArray[0];
                    var versionMinor      = versionArray[1];
                    var versionRevision   = versionArray[2];

                    // is the major.revision >= requested major.revision AND the minor version >= requested minor
                    if (versionMajor > parseFloat(reqMajorVer)) {
                        return true;
                    } else if (versionMajor == parseFloat(reqMajorVer)) {
                        if (versionMinor > parseFloat(reqMinorVer))
                            return true;
                        else if (versionMinor == parseFloat(reqMinorVer)) {
                            if (versionRevision >= parseFloat(reqRevision))
                                return true;
                        }
                    }
                    return false;
                }
            },

            AC_AddExtension: function(src, ext)
            {
                if (src.indexOf('?') != -1)
                    return src.replace(/\?/, ext+'?'); 
                else
                    return src + ext;
            },

            AC_Generateobj: function(objAttrs, params, embedAttrs,div_id) { 
                var str = '';
                if (isIE && isWin && !isOpera)
                    {
                        str += '<object ';
                        for (var i in objAttrs)
                            str += i + '="' + objAttrs[i] + '" ';
                        str += '>';
                        for (var i in params)
                            str += '<param name="' + i + '" value="' + params[i] + '" /> ';
                        str += '</object>';
                    } else {
                    str += '<embed ';
                    for (var i in embedAttrs)
                        str += i + '="' + embedAttrs[i] + '" ';
                    str += '> </embed>';
                }

                var el = document.getElementById(div_id);
                if(!el) {
                    el = document.createElement("div");
                    document.body.appendChild(el);
                    el.setAttribute('id',div_id);
                }

                var flObj = null;
                if (isIE && isWin && !isOpera)
                    {
                        flObj = document.createElement("object");
                        for (var i in objAttrs)
                            flObj.setAttribute(i,objAttrs[i]);
                        for (var i in params){
                            var param = document.createElement("param");
                            param.setAttribute("name",i);
                            param.setAttribute("value",params[i]);
                            flObj.appendChild(param);
                        }
                    } else {
                    flObj = document.createElement("embed");
                    for (var i in embedAttrs)
                        flObj.setAttribute(i,embedAttrs[i]);
  	   
                }

                el.appendChild(flObj);
    
            },

            AC_FL_RunContent: function(){
                var ret = 
                FU.AC_GetArgs
                (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
                   , "application/x-shockwave-flash"
                   );
                FU.AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs,ret.div_id);
            },
            AC_GetArgs: function(args, ext, srcParamName, classid, mimeType){
                var ret = new Object();
                ret.embedAttrs = new Object();
                ret.params = new Object();
                ret.objAttrs = new Object();
                ret.div_id = '_flashMovie';
                for (var i=0; i < args.length; i=i+2){
                    var currArg = args[i].toLowerCase();    

                    switch (currArg){	
                    case "div_id":
                        ret.div_id = args[i+1];
                        break;
                    case "classid":
                        break;
                    case "pluginspage":
                        ret.embedAttrs[args[i]] = args[i+1];
                        break;
                    case "src":
                    case "movie":	
                        args[i+1] = FU.AC_AddExtension(args[i+1], ext);
                        ret.embedAttrs["src"] = args[i+1];
                        ret.params[srcParamName] = args[i+1];
                        break;
                    case "onafterupdate":
                    case "onbeforeupdate":
                    case "onblur":
                    case "oncellchange":
                    case "onclick":
                    case "ondblClick":
                    case "ondrag":
                    case "ondragend":
                    case "ondragenter":
                    case "ondragleave":
                    case "ondragover":
                    case "ondrop":
                    case "onfinish":
                    case "onfocus":
                    case "onhelp":
                    case "onmousedown":
                    case "onmouseup":
                    case "onmouseover":
                    case "onmousemove":
                    case "onmouseout":
                    case "onkeypress":
                    case "onkeydown":
                    case "onkeyup":
                    case "onload":
                    case "onlosecapture":
                    case "onpropertychange":
                    case "onreadystatechange":
                    case "onrowsdelete":
                    case "onrowenter":
                    case "onrowexit":
                    case "onrowsinserted":
                    case "onstart":
                    case "onscroll":
                    case "onbeforeeditfocus":
                    case "onactivate":
                    case "onbeforedeactivate":
                    case "ondeactivate":
                    case "type":
                    case "codebase":
                        ret.objAttrs[args[i]] = args[i+1];
                        break;
                    case "id":
                    case "width":
                    case "height":
                    case "align":
                    case "vspace": 
                    case "hspace":
                    case "class":
                    case "title":
                    case "accesskey":
                    case "name":
                    case "tabindex":
                        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
                        break;
                    default:
                        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
                    }
                }
                ret.objAttrs["classid"] = classid;
                if (mimeType) ret.embedAttrs["type"] = mimeType;
                return ret;
            }
        };
        return FU;

    }
})();

YAHOO.namespace("gaia.util");
YAHOO.namespace('gaia.app.Gim');

YAHOO.gaia.util.dump = function (arr,level) {
    var dumped_text = "";
    if (!level) {
        level = 0;
    }
    //The padding given at the beginning of the line.
    var level_padding = "";
    for (var j=0; j<level + 1; j++) {
        level_padding += "    ";
        if (level > 5) {
            level_padding += '...';
            return level_padding;
        }
    }
    // arrays hashes and objects
    if (typeof(arr) == 'object') {
        for (var item in arr) if (YAHOO.lang.hasOwnProperty(arr, item)) {
            var value = arr[item];
            if(typeof(value) == 'object') {
                // recursion occurs here because it is an object / hash / etc
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += YAHOO.gaia.util.dump(value,level+1);
            }
            else {
                // does not have anything deeper at that point
                dumped_text += level_padding + "'" + item + "' => ("+typeof(value)+") \"" + value + "\"\n";
            }
        }
    }
    else {
        // strings, etc are all output normally
        dumped_text = "("+typeof(arr)+") \"" + arr + "\"";
    }
    return dumped_text;
};


(function(){
YAHOO.gaia.app.Gim.params = {   
    LOGIN_COUNTER:0,
    SCROLL_TIMEOUT:null,
    OLD_HEADER:document.title,
    HEADER_MESSAGE:null,
    P_STORE: null,
    P_STORE_SWF_PATH:"http://" +  GAIA_config("graphics_server") +'/src/js/persist/persist',
    GAPI_URI:"http://" + GAIA_config("main_server") + '/gapi/rest/gim/?',
    GAPI_SECURE_URI:"https://" + GAIA_config("main_server") + '/gapi/rest/gim/?',
    DEBUG: false,
    PS_MSG_VAR: 'gimMsgStorage',
    REQUEST_TIMEOUT:((navigator.userAgent.indexOf("Firefox")>-1 || navigator.userAgent.indexOf("Camino") >-1 || window.opera) && !document.all)?1000:1000,
    DEFAULT_ICON:  "http://" + GAIA_config('graphics_server') + "/images/gim/ic_gim_aimuser_29x23.gif",
    CHAT_ICON: "http://" + GAIA_config('graphics_server') + "/images/gim/rs_gim_bublogo_44x37.png",
    BLANK_ICON: "http://" + GAIA_config('graphics_server') + "/images/1x1.gif",
    USE_EMOTICONS: true,
    GIM_SUFFIX: '@gaiaonline.com',
    GUILD_BOT_NAME: 'gaiaguildbot',
    EMOTICON_URI:  "http://" + GAIA_config('graphics_server') + "/images/common/smilies/",
    temp_count:0,
    gUserId:'',
    seqKey:'',
    seqCookies:null,
    gXid:'',
    settingsCookies:'',
    oldTimestamp:0,
    settings:null,
    gSignature:'',
    timestamp:'',
    listenerURI:'',
    loginAttempts:0,
    pStoreKey:'',
    gSecret:'',
    glauncher:null,
    userId:null,
    debugWindow:null,
    msgWindow:null,
    blopen:'',
    onlineCount:0,
    blWasOpen:false,
    blmessage:'',
    gFriendsList:[],
    friendslist:[],
    pollingInt:5,
    blLoaded:false,
    hasGaiaGroup:false,
    emoticons: [
        {code:[':D',':-D'],description:'Very Happy',path:'icon_biggrin.gif'},
        {code:[':)',':-)'],description:'Smile',path:'icon_smile.gif'},
        {code:[':-[',':-!',':oops:'],description:'Embarassed',path:'icon_redface.gif'},
        {code:[":'(",'T_T'],description:'Crying',path:'icon_crying.gif'},
        {code:[':stare:'],description:'Stare',path:'icon_stare.gif'},
        {code:[':XD'],description:'XD',path:'icon_xd.gif'},
        {code:[':3nod:'],description:':3 Nodding',path:'icon_3nodding.gif'},
        {code:[':big:'],description:'Big Laugh',path:'icon_blaugh.gif'},
        {code:[':gonk:'],description:'Gonk',path:'icon_gonk.gif'},
        {code:['\>:o',':scream:'],description:'Scream',path:'icon_scream.gif'},
        {code:[':vein:'],description:'Stressed',path:'icon_stressed.gif'},
        {code:[':sweat:'],description:'Sweat',path:'icon_sweatdrop.gif'},
        {code:[':heart:','\<3'],description:'Heart',path:'icon_heart.gif'},
        {code:[':xp:'],description:'XP',path:'icon_xp.gif'},
        {code:[':whee:'],description:'Whee!',path:'icon_whee.gif'},
        {code:[';)',';-)',':wink:'],description:'Wink',path:'icon_wink.gif'},
        {code:[':(',':-('],description:'Sad',path:'icon_frown.gif'},
        {code:['=-o',':o'],description:'Surprised',path:'icon_surprised.gif'},
        {code:[':shock:'],description:'Shocked',path:'icon_eek.gif'},
        {code:[':?:'],description:'Question?',path:'icon_question.gif'},
        {code:[':?'],description:'Confused',path:'icon_confused.gif'},
        {code:['8-)','8)'],description:'Cool',path:'icon_cool.gif'},
        {code:[':lol:'],description:'Laughing',path:'icon_lol.gif'},
        {code:[':x'],description:'Mad',path:'icon_mad.gif'},
        {code:[':pirate:'],description:'Pirate',path:'icon_pirate.gif'},
        {code:[':p',':-p'],description:'Razz',path:'icon_razz.gif'},
        {code:[':cry:'],description:'Very sad',path:'icon_cry.gif'},
        {code:[':twisted:',':evil:'],description:'Evil',path:'icon_evil.gif'},
        {code:[":-\\",":-\/",':roll:'],description:'Rolling eyes',path:'icon_rolleyes.gif'},
        {code:[':!:'],description:'Exclamation!',path:'icon_exclaim.gif'},
        {code:[':idea:'],description:'Idea',path:'icon_idea.gif'},
        {code:[':arrow:'],description:'Arrow',path:'icon_arrow.gif'},
        {code:[':|'],description:'Neutral',path:'icon_neutral.gif'},
        {code:[':mrgreen:'],description:'Mr. Green',path:'icon_mrgreen.gif'},
        {code:[':ninja:'],description:'Ninja',path:'icon_ninja.gif'},
        {code:[':-*',':cute:'],description:'Cute laugh',path:'icon_4laugh.gif'},
        {code:[':rofl:'],description:'ROFL',path:'icon_rofl.gif'},
        {code:[':talk2hand:'],description:'Talk to the hand',path:'icon_talk2hand.gif'},
        {code:[':burning:'],description:'AUGH! My eyes!',path:'burning_eyes.gif'},
        {code:[':cheese:'],description:'Cheese and whine',path:'cheese_whine.gif'},
        {code:[':dramallama:'],description:'Drama llama',path:'dramallama.gif'},
        {code:[':wahmbulance:'],description:'Wahhhhhmbulance',path:'icon_wahmbulance.gif'},
        {code:[':emo:'],description:'Emo',path:'emo.gif'}
    ],
    transactions: {
        getSessionData:'method=aimauth&type=header'
    },
    callbacks: {
        setPermitDeny:["YAHOO.gaia.app.Gim.callbacks.setPermitDeny"],
        getPermitDeny:["YAHOO.gaia.app.Gim.callbacks.getPermitDeny"],
        getBuddyInfo: ["YAHOO.gaia.app.Gim.callbacks.getBuddyInfo"],
        getBuddyList: ["YAHOO.gaia.app.Gim.callbacks.getBuddyList"],
        sendTextIM: ["YAHOO.gaia.app.Gim.callbacks.sendTextIM"],
        getPresenceInfo: ["YAHOO.gaia.app.Gim.callbacks.getPresenceInfo"],
        typingStatus:["YAHOO.gaia.app.Gim.callbacks.typingStatus"],
        setState:["YAHOO.gaia.app.Gim.callbacks.setState"],
        endSession:["YAHOO.gaia.app.Gim.callbacks.endSession"],
        addGroup:["YAHOO.gaia.app.Gim.callbacks.addGroup"],
        getSessionData:["YAHOO.gaia.app.Gim.callbacks.getSessionData"],
        listener: {
            im: ["YAHOO.gaia.app.Gim.ui.acceptIncomingMessage"],
            offlineIM:["YAHOO.gaia.app.Gim.ui.acceptIncomingMessage"],
            imData:["YAHOO.gaia.app.Gim.callbacks.acceptDataIM"],
            buddylist:["YAHOO.gaia.app.Gim.ui.createBuddyList"],
            presence:["YAHOO.gaia.app.Gim.ui.updateBuddyList"],
            typing:["YAHOO.gaia.app.Gim.ui.updateTypingStatus"],
            sessionEnded:["YAHOO.gaia.app.Gim.callbacks.sessionEnded"]
        }
    }
}

})();

(function() {
 
    var U = YAHOO.gaia.util;
    var params = YAHOO.gaia.app.Gim.params;
    var E = YAHOO.util.Event;
    var D = YAHOO.util.Dom;
    var C = YAHOO.util.Cookie;

    YAHOO.gaia.app.Gim.widgets = {

        header:{
            launch: function(settings){
                params.settings = settings;
                params.gUserId = settings.gUserId;
                params.settingsCookies = params.gUserId + '_settingsCookies';
                params.glauncher = new YAHOO.gaia.app.Gim.GlobalLauncher(); 
                params.glauncher.init({gUserId: params.gUserId});
                params.listenerURI = settings.listenerURI + "&f=json&c=YAHOO%2Egaia%2Eapp%2EGim%2Ecore%2Elisten&timeout=" + params.REQUEST_TIMEOUT;
                params.seqKey = settings.seqKey;
                params.seqCookies = C.getSubs(params.seqKey);
                params.blopen = params.gUserId + "_" + "blopen";
                params.blmessage = params.gUserId + "_" + "blmessage";
                params.autoLogin = settings.autoLogin;
                if(!params.seqCookies){
                    params.seqCookies ={lastTime:0,lastNum:0,mCount:0,lastViewTime:0};
                }
                params.oldTimestamp = params.seqCookies.lastTime;
                var now = new Date();
                now.setHours(now.getHours()+24);
                
                C.setSub(params.settingsCookies,"enablePopup",params.settings.enablePopup,{domain:document.domain,path:'/',expires:now});
                if(params.autoLogin == 1){
                    YAHOO.gaia.app.Gim.core.destroyListenerObject(true);
                }
                
                YAHOO.gaia.app.Gim.core.startTimers();
                //YAHOO.gaia.app.Gim.transactions.getGaiaBuddyList();
            }
        }

    }

    /**
     *	YAHOO.gaia.app.Gim.core contains all of the methods that are REQUIRED for the API to funtion.
     */
    YAHOO.gaia.app.Gim.core = {
        AIMData:[],
        authAttempts:0,
        requestInterval:null,
        subscriptions: null,
        activeSession: false,
        pendingTransaction: null,
        msgQueue:[],
        /**
         *	Checks to see if the browser the user is in is part of the "officially supported browser matrix"
         */
        supportedBrowser: function() {
            if(window.opera || document.layers || !document.getElementById) return false;
            var FF = navigator.userAgent.match("Firefox/[1-3]\.");
            var MSIE = navigator.userAgent.match(/MSIE [6-9]/);
            var SAF = navigator.userAgent.match(/Safari\/[4-9]/);
            if(FF || MSIE || SAF) return true;
            return false;
        },
        popupEnabled: function() {
            var test = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
            if(test){
                test.close();
                return true;
            }
            else return false;
        },
        /**
         *	Sends a request to the host, i.e, an instant message, status update, etc.
         *	@param { Object } transactionObject An object defined by the YAHOO.gaia.app.Gim.transactions.* methods with properties required by the transaction
         */
        requestData: function(transactionObject,skip) {
            var len = YAHOO.gaia.app.Gim.core.AIMData.length;
            transactionObject.timestamp = Date.parse(new Date());
            YAHOO.gaia.app.Gim.core.AIMData[len] = null;
            YAHOO.gaia.app.Gim.core.AIMData[len] = {};
            YAHOO.gaia.app.Gim.core.AIMData[len].oScript = document.createElement("script");
            YAHOO.gaia.app.Gim.core.AIMData[len].oScript.setAttribute("id","AIMBuddyList-AIMData-" + len);
            YAHOO.gaia.app.Gim.core.AIMData[len].oScript.setAttribute("type","text/javascript");
            YAHOO.gaia.app.Gim.core.AIMData[len].objData = transactionObject;
            if(skip != '1'){
                if(transactionObject.dataURI.indexOf("?") == -1) {
                    transactionObject.dataURI+="?r=" + len + "&nocache=" + Date.parse(new Date());
                } else {
                    transactionObject.dataURI+="&r=" + len + "&nocache=" + Date.parse(new Date());
                }

            }
            // YAHOO.gaia.app.Gim.core.debug("requestData: " + transactionObject.dataURI + "<br> Request-id AIMBuddyList-AIMData-" +len );
            //alert("requestData: " + transactionObject.dataURI);
            YAHOO.gaia.app.Gim.core.AIMData[len].oScript.setAttribute("src",transactionObject.dataURI);
            document.getElementsByTagName("head")[0].appendChild(YAHOO.gaia.app.Gim.core.AIMData[len].oScript);
        },
        
        startTimers: function() {
            var fn = function() {
                YAHOO.gaia.app.Gim.ui.updateCount();
                var blCookie = C.get(params.blopen);
                if(blCookie == "true") {
                    YAHOO.gaia.app.Gim.ui.updateBLMessage();
                    params.blWasOpen=true;
                    return;
                    //showLastMessage
                }
                
                if(params.autoLogin == 1) {
                    YAHOO.gaia.app.Gim.ui.updateMessageCount(params.blWasOpen);
                    params.blWasOpen=false;
                    return;
                    //showMessageCount
                }
               
            }
            window.setInterval(fn,5000);
        },

        /**
         *	Accepts all the incoming responses that result from requestData and routes them to the appropriate callback(s)
         *	@param { Object } json The JSON response from the host.
         */
        acceptData:function(json) {
            var requestId = parseInt(json.response.requestId);
            var code = parseInt(json.response.statusCode);
            if(code != 200) {
                try{
                    if(code == 401) {
                        var t = YAHOO.gaia.app.Gim.core.AIMData[requestId].objData.type;
                        // only these transactions expect a 401 - if we get it on any other, kill the session
                    }
                }
                catch(err) {
                    //YAHOO.gaia.app.Gim.core.debug("YAHOO.gaia.app.Gim.core.acceptData: Callback error! " + err.message + " (line " + err.line + ")");
                }
            }
            try{
                // YAHOO.gaia.app.Gim.core.debug("<b>YAHOO.gaia.app.Gim.core.acceptData:</b><br />" + json.response.toSource());
            } catch(err) { }
            var type = YAHOO.gaia.app.Gim.core.AIMData[requestId].objData.type;
            var fn = eval("params.callbacks." + type);
            var i = fn.length;
            while(i-- >0)	{
                try {
                    eval(fn[i] +"(json)");
                } catch(err) {
                    //YAHOO.gaia.app.Gim.core.debug("YAHOO.gaia.app.Gim.core.acceptData: Callback error! " + err.message + " (line " + err.line + ")")
                }
            }
            try {
                if(YAHOO.gaia.app.Gim.core.AIMData[requestId]) {
                    if(YAHOO.gaia.app.Gim.core.AIMData[requestId].oScript) {
                        YAHOO.gaia.app.Gim.core.AIMData[requestId].oScript.parentNode.removeChild(YAHOO.gaia.app.Gim.core.AIMData[requestId].oScript);
                    }
                }
            } catch(err) {
                //YAHOO.gaia.app.Gim.core.debug("YAHOO.gaia.app.Gim.core.acceptData: Unable to remove YAHOO.gaia.app.Gim.core.AIMData[" + requestId + "] -- " + err.message);
            }
        },
        /**
         *	Listens for event updates (i.e., a buddy signs off) from the host and routes to the appropriate callback(s)
         *	@param { Object } json The JSON response from the host.
         */
        listen:function(json) {
            
            
            var ePop = C.getSub(params.settingsCookies,"enablePopup");
            if(typeof(ePop) != 'undefined') {
                if (ePop == 1) {params.settings.enablePopup =1}
                if (ePop == 0) {params.settings.enablePopup =0}
            }
            
            if(json.response.statusCode == 460) {
                //if(params.loginAttempts > 2) return;
                //YAHOO.gaia.app.Gim.transactions.getSessionData(true);
                //params.loginAttempts++;
                return;
            }
            if(!json.response.data) return;
            YAHOO.gaia.app.Gim.core.destroyListenerObject(false);
            params.listenerURI = null
            params.listenerURI = json.response.data.fetchBaseURL + "&f=json&c=YAHOO%2Egaia%2Eapp%2EGim%2Ecore%2Elisten&timeout=" + params.REQUEST_TIMEOUT;
            if(json.response.data.events) {
                try {
                    //if(json.response.data.events.length > 0) ///YAHOO.gaia.app.Gim.core.debug("<b>YAHOO.gaia.app.Gim.core.listen:</b><br/>" + json.response.data.toSource());
                } catch(err) { }
                
                if(json.response.statusCode == 200) {
                    // YAHOO.gaia.app.Gim.core.debug(Util.dump(json.response.data.events));
                    json.response.data.events = json.response.data.events.reverse();
                    var i = json.response.data.events.length;
                    while(i-- > 0) {
                        if(json.response.data.events[i].type == 'sessionEnded'){
                            return;
                        }
                        var fn = eval("params.callbacks.listener." + json.response.data.events[i].type);
                        //YAHOO.gaia.app.Gim.core.debug(fn);
                        var j = fn.length;
                        while(j-- > 0) {
                            try {
                                var oResponse = json.response.data.events[i].eventData;
                                if(typeof(json.response.data.events[i].seqNum) !="undefined")
                                    oResponse.seqNum = json.response.data.events[i].seqNum;
                                eval(fn[j] +"(oResponse)");
                            } catch(err) {
                                YAHOO.gaia.app.Gim.core.debug("YAHOO.gaia.app.Gim.core.listen: Callback Error! " + err.message + " (line " + err.line + ")");
                            }
                        }
                    
                    }
                } 
             }
            
            
            //var timeToNextFetch = json.response.data.timeToNextFetch ;
            var timeToNextFetch = 15000;
            YAHOO.gaia.app.Gim.core.requestInterval = setTimeout("YAHOO.gaia.app.Gim.core.destroyListenerObject(true)",timeToNextFetch);
        },

        /**
         *	Creates a script element that "listens" for event updates from the host.
         */
        createListenerObject:function() {
            clearTimeout(YAHOO.gaia.app.Gim.core.requestInterval);
            YAHOO.gaia.app.Gim.core.requestInterval = null;
            YAHOO.gaia.app.Gim.core.destroyListenerObject(false);
            var oListener = document.createElement("script");
            oListener.setAttribute("type","text/javascript");
            oListener.setAttribute("src", params.listenerURI + "&"  + Date.parse(new Date()));
            oListener.setAttribute("id","AIMListener");
            document.getElementsByTagName("body")[0].appendChild(oListener);
            // YAHOO.gaia.app.Gim.core.debug("AIMListener Script: "+params.listenerURI+"&"+Date.parse(new Date())+"'>");
        },
        /**
         *	Destroys the data container object that houses the script element that made the request and all data associated with it.
         *	@param { Variant } objIndex The index in the YAHOO.gaia.app.Gim.core.AIMData array that corresponds to the data to be destroyed. This is generally the requestId property of the JSON response
         */
        destroyDataObject:function(objIndex) {
            return; // this function causing FF to crash all of a sudden...I hate teh intarwebs
            try {
                if(YAHOO.gaia.app.Gim.core.AIMData[objIndex]) {
                    if(YAHOO.gaia.app.Gim.core.AIMData[objIndex].oScript) YAHOO.gaia.app.Gim.core.AIMData[objIndex].oScript.parentNode.removeChild(YAHOO.gaia.app.Gim.core.AIMData[objIndex].oScript);
                }
            } catch(err) { }
            YAHOO.gaia.app.Gim.core.AIMData[objIndex] = null;
        },
        /**
         *	Destroys the listener script object, and creates a new one if createNew is true.
         *	@param { Boolean } createNew Creates a new listener if true.
         */
        destroyListenerObject: function(createNew) {
            clearInterval(YAHOO.gaia.app.Gim.core.requestInterval);
            YAHOO.gaia.app.Gim.core.requestInterval = null;
            if(document.getElementById("AIMListener")) document.getElementById("AIMListener").parentNode.removeChild(document.getElementById("AIMListener"));
            if(createNew) YAHOO.gaia.app.Gim.core.createListenerObject();
        },
        /**
         *	Adds a callback to the callback object
         *	@param { Array } callbackObject The array that contains the callback functions for the event
         *	@param {String } newCallBack The name of the function to be called.
         */
        addCallback: function(callbackObject,newCallback) {
            callbackObject.push(newCallback);
        },
        /**
         *	Removes a callback from the specified callback array
         *	@param { Array } callbackObject The array that contains the callback function to be removed
         *	@param { String } oldCallback The callback to be removed
         */
        removeCallback: function(callbackObject,oldCallback) {
            callbackObject.splice(callbackObject.indexOf(oldCallback));
        },
        
        debug: function(str) {
            if(!params.DEBUG) return;
            if(typeof(params.debugWindow) == 'undefined' || params.debugWindow == null || params.debugWindow.closed) {
                params.debugWindow = null;
                params.debugWindow = window.open("","GIMDebug","status=1,toolbar=1,menu=1,resizable=1,height=400,width=500");
                var html = "<html><head></head><body><div></div></body></html>";
                params.debugWindow.document.write(html);
                params.debugWindow.document.close();
            }
            if(typeof(params.debugWindow) == 'undefined' || params.debugWindow == null || params.debugWindow.closed) return;
            var dbg = params.debugWindow.document.getElementById("AIMDebugger");
            if(!dbg) {
                dbg = params.debugWindow.document.getElementsByTagName("body")[0].appendChild(params.debugWindow.document.createElement("div"));
                D.setStyle(dbg,"overflow-y","auto");
                D.setStyle(dbg,"height","500px");
                dbg.setAttribute("id","AIMDebugger");
            }
            params.debugWindow.document.getElementById("AIMDebugger").innerHTML =  params.debugWindow.document.getElementById("AIMDebugger").innerHTML + "<p><span style=\"color:green;\">" + new Date() + "(" + Date.parse(new Date()) + ")</span><br/>" + str + "</p>";
            dbg.scrollTop = dbg.scrollHeight;
        }
        
    }
    
    YAHOO.gaia.app.Gim.transactions = {


        isOnline: function(aimId) {
            var params = YAHOO.gaia.app.Gim.params;
            if(typeof(aimId) == "undefined") 
                return false;
            if(typeof(params.friendslist[aimId]) != "undefined" && params.friendslist[aimId].state =="online")
                return true;
            
            return false;
                                              
        },
        
        getSessionData: function(purge_cache) {

            var URI = params.GAPI_URI;
            
            if(GAIA_config("main_server") == 'www.gaiaonline.com'){
                URI = params.GAPI_SECURE_URI;
            }

            var tObj = {
                dataURI: URI + params.transactions.getSessionData + "&purge_cache="+purge_cache+"&format=callback&c=YAHOO%2Egaia%2Eapp%2EGim%2Ecore%2EacceptData",
                type:"getSessionData"
            }
            
            YAHOO.gaia.app.Gim.core.requestData(tObj);
            
        },
            
        getGaiaBuddyList: function(){

            
            var callback = {

                success: function(o) {
                    if(typeof(o.responseText) == "undefined" || o.responseText == null || !o.responseText) return;
                    var tmpList  =  eval("(" + o.responseText + ")");
                    YAHOO.gaia.app.Gim.params.gFriendsList = tmpList;
                    tmpList = null;
                    YAHOO.gaia.app.Gim.transactions.getSessionData(false); //Do not purge cache for initial call
                    //console.log("success :"+U.dump(o));
                },
                failure: function(o) {
                    //console.log("failure :"+U.dump(o));
                },
                scope:this
                
            }

            var args = 'method=getinlinebuddylist';
            YAHOO.util.Connect.asyncRequest('POST',YAHOO.gaia.app.Gim.params.GAPI_URI,callback,args);

        }
        
    }

    YAHOO.gaia.app.Gim.ui = {
        
        storedBuddyInfo:[],
            
        createBuddyList: function(response) {

            var groupings = response.groups;
            var i = groupings.length;
            var group = null;

            while(i --> 0) {
                group = groupings[i];
                if(group.name == "All Gaia Friends"){
                    params.onlineCount=0;
                    var buddies = group.buddies;
                    var blen = buddies?buddies.length:0;
                    if(blen) buddies = buddies.reverse();
                    var j = blen;
                    var gname='';
                    while(j-- > 0){
                        params.friendslist[buddies[j].aimId] = buddies[j];
                        if(buddies[j].state == "online") {
                            gname = buddies[j].aimId;
                            if(gname.substr(gname.length-15) == '@gaiaonline.com')
                                gname = gname.substr( 0, gname.length - 15);
                            YAHOO.gaia.widgets.Footer.updateChatLink(gname, true);
                        }
                    }
                    params.hasGaiaGroup= true;
                    YAHOO.gaia.app.Gim.ui.updateCount(true);
                }
            }
            params.blLoaded = true;
            
        },
            
        updateCount: function(recount) {
            
            if(typeof(recount) != "undefined" && recount) {
                var oCount = 0;
            
                for( var aimId in params.friendslist) {
                    if(params.friendslist[aimId].state == "online"){
                        oCount++;
                    }
                }
                
                params.onlineCount = oCount;
            }
            
            var count = D.getElementsByClassName("count","span","buddylist")[0];
            if(count) {
                    count.innerHTML = ' (' + params.onlineCount + ')'; 
                count.setAttribute('alt',params.onlineCount + ' friends online');
                count.setAttribute('title',params.onlineCount + ' friends online');
            }

        },

        updateBuddyList: function(response) {

            if(typeof(response.aimId) != "undefined") {
                params.friendslist[response.aimId].state = response.state;
                var gname = response.aimId;
                if(gname.substr(gname.length-15) == '@gaiaonline.com')
                    gname = gname.substr( 0, gname.length - 15);
                if(response.state == "online") {
                    YAHOO.gaia.widgets.Footer.updateChatLink(gname, true);
                }else{
                    YAHOO.gaia.widgets.Footer.updateChatLink(gname, false);
                }
                YAHOO.gaia.app.Gim.ui.updateCount(true);
                
            }

            

        },

        scrollNotification : function (){ 

            if(params.temp_count == params.seqCookies.mCount) return;

            if(params.HEADER_MESSAGE == ""){
                return;
            } 
            params.HEADER_MESSAGE = params.HEADER_MESSAGE.substring(1, params.HEADER_MESSAGE.length) + params.HEADER_MESSAGE.substring(0, 1);

            document.title = params.HEADER_MESSAGE;
            params.SCROLL_TIMEOUT = window.setTimeout("YAHOO.gaia.app.Gim.ui.scrollNotification()", 200);
            E.addListener(window,'focus', function(){if(params.HEADER_MESSAGE == "") return;params.HEADER_MESSAGE= ""; document.title = params.OLD_HEADER; clearInterval(params.SCROLL_TIMEOUT);params.temp_count = params.seqCookies.mCount;
});
        },
            
    
        acceptIncomingMessage: function(response){
            
            //Show bubble setting is turned off, return and dont display
            if(params.settings.showBubble == '0') return;
            var aimId = response.source.aimId;
    
            //reject those without @gaiaonline.com and not the bot  and not a friend.
            if(aimId.indexOf('@gaiaonline.com') == -1 && aimId != 'gaiaguildbot' && typeof(params.friendslist[aimId]) == 'undefined') return;            
            if(response.seqNum <= params.seqCookies.lastNum && response.timestamp <= params.seqCookies.lastTime) {
                return;
            }
            else{
                var now = new Date();
                now.setSeconds(now.getSeconds()+300);
                params.seqCookies.lastNum = response.seqNum;
                params.seqCookies.lastTime = response.timestamp;
                params.seqCookies.mCount++;
                C.setSubs(params.seqKey,params.seqCookies,{domain:document.domain,path:'/'});
            }


            if(typeof(params.friendslist) == "undefined" || typeof(params.friendslist[aimId]) == "undefined"){
                if(params.blLoaded && !params.hasGaiaGroup) {
                    params.glauncher.launchUser("",true,"true");
                    params.hasGaiaGroup = true;
                }
                return;
            }
            
            if(params.settings.enablePopup && !params.blWasOpen){
                params.glauncher.launchUser(aimId,true,"false");
            }
        },

        
        updateMessageCount: function(blWasOpen) {

            if(blWasOpen) {
                params.seqCookies = C.getSubs(params.seqKey);
                if(!params.seqCookies ) {
                    params.seqCookies={lastNum:0,lastTime:0,mCount:0};
                }
                params.seqCookies.mCount=0;
                params.oldTimestamp = params.seqCookies.lastTime;
            }
            if(params.seqCookies.mCount < 1){
                if(typeof(params.SCROLL_TIMEOUT) != 'undefined') {
                    clearTimeout(params.SCROLL_TIMEOUT);
                }
                return;
            }
   
            if(params.oldTimestamp < params.seqCookies.lastTime){

                params.oldTimestamp = params.seqCookies.lastTime;
                
            
           
                var uMess = "You have "+params.seqCookies.mCount+" message"+ (params.seqCookies.mCount > 1?"s":"");
                YAHOO.gaia.widgets.Footer._footerYowl.notify(uMess, 'gim-section');

            }
        },

        updateBLMessage: function() {
            
            var nHeader = document.getElementById('AIMBuddyListNotifierHeader');
            var blItems = C.getSubs(params.blmessage);
            if(blItems) {
                var mDate = new Date(blItems.lastTime);
                var now = new Date();
                
                
                if(now < mDate.setMinutes(mDate.getMinutes() + params.pollingInt) && params.oldTimestamp != blItems.lastTime){
                    params.oldTimestamp=blItems.lastTime;
                   
                    var msg = blItems.lastBuddy + ': ' + blItems.lastMessage.replace(/(&#160;|&#160||&|#)/g,"");
                    YAHOO.gaia.widgets.Footer._footerYowl.notify(msg, 'gim-section');
                    
                   
                    params.glauncher.init({gUserId: params.gUserId});
                    E.addListener(nHeader,'mousedown',function(){
                                          D.setStyle(nHeader,"display","none");
                                          params.glauncher.launchUser(blItems.lastBuddyId,true,"true");
                                          if(typeof(params.SCROLL_TIMEOUT) != 'undefined') {
                                               clearTimeout(params.SCROLL_TIMEOUT);
                                           }
                                          E.removeListener(nHeader,'mousedown');
                                              });

                    params.HEADER_MESSAGE = 'Gaia Online - ' + 'You have a message from ' + blItems.lastBuddy +' --';
                    clearTimeout(params.SCROLL_TIMEOUT);
                    YAHOO.gaia.app.Gim.ui.scrollNotification();
                }
            }
            else {
                 if(typeof(params.SCROLL_TIMEOUT) != 'undefined') {
                    clearTimeout(params.SCROLL_TIMEOUT);
                }
            }
        },

         /**
         *	Replaces emoticons with images, i.e., :) becomes smile.png
         *	@param { String } txt The text to have the regexp permformed on
         *	@return { String} the modifed string
         */
		addEmoticons: function(txt) {
			if(params.USE_EMOTICONS) {
				for(var y = 0; y < params.emoticons.length; y++) {
					var emoticon = params.emoticons[y];
					for (var x = 0; x < emoticon.code.length; x++) {
						var code = emoticon.code[x];
						txt = txt.replace(code,'<img src="'+params.EMOTICON_URI+emoticon.path+'" />','g');
					}
				}
			}
			return txt;
		},
            
        updateTypingStatus: function(json){return;}

    }

    YAHOO.gaia.app.Gim.callbacks = {
        //Get session data and populate and try to send to listener object
        getSessionData: function(json) {
            //YAHOO.gaia.app.Gim.core.debug('getSessionCallback :' + U.dump(json));
            if(json.response.statusCode == 200){
                params.gSecret = json.response.gsecret;
                params.seqKey = json.response.sequence_key;
                params.listenerURI = json.response.fetchBaseURL + "&f=json&c=YAHOO%2Egaia%2Eapp%2EGim%2Ecore%2Elisten&timeout=" + params.REQUEST_TIMEOUT;
                                    
                YAHOO.gaia.app.Gim.core.destroyListenerObject(true);
            }
        }
    
    }

         
})();
   


YAHOO.namespace("gaia.util");

/**
 * A port of PHP's print_r for getting a detailed output on an object
 * @param {Object} arr an Array / Hash / Object to analyze
 * @param {Int} level the level to scan [optional]
 * @return {String} the var dump structure
 **/
YAHOO.gaia.util.dump = function (arr,level) {
    var dumped_text = "";
    if (!level) {
        level = 0;
    }

    //The padding given at the beginning of the line.
    var level_padding = "";
    for (var j=0; j<level + 1; j++) {
        level_padding += "    ";
        if (level > 5) {
            level_padding += '...';
            return level_padding;
        }
    }

    // arrays hashes and objects
    if (typeof(arr) == 'object') {
        for (var item in arr) if (YAHOO.lang.hasOwnProperty(arr, item)) {
            var value = arr[item];
 
            if(typeof(value) == 'object') {
                // recursion occurs here because it is an object / hash / etc
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += YAHOO.gaia.util.dump(value,level+1);
            }
            else {
                // does not have anything deeper at that point
                dumped_text += level_padding + "'" + item + "' => ("+typeof(value)+") \"" + value + "\"\n";
            }
        }
    }
    else {
        // strings, etc are all output normally
        dumped_text = "("+typeof(arr)+") \"" + arr + "\"";
    }

    return dumped_text;
};

YAHOO.gaia.util.popupEnabled = function() {

    var test = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
    if(test){
        test.close();
        return true;
    }
    else {
        return false;
    }
       
};

YAHOO.namespace("gaia.app.Gim");
(function() {

    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
        Cookie = YAHOO.util.Cookie,
        Util = YAHOO.gaia.util;
        

YAHOO.gaia.app.Gim.Launcher = function() {
    this._gUserId = null;
    this._cookies = null;
    this._path = null;
    this._domain = null;
    this._gUrl= null;
    this._nContainerId = null;
    this._lLaunchLink = null;
    this._nPollingInt = null;
    this._cOName = null;
    this._cFName = null;
    this._cMName = null;
    this._cSName = null;
    this._blHeaderTimer = null;
    this._gimSetup = true;
    this._DEBUG = false;
    this._debugWindow = null;
    this._opening = false;
    this._showtoolbar = false;
    this._store = null;
    this._autoLogin = true;    
};

YAHOO.gaia.app.Gim.Launcher.prototype.init = function(settings){

   
    this._gUserId = settings.gUserId;
    this._cookies = {
        blfocus: settings.blfocus || 'blfocus',
        blopen:  settings.blopen || 'blopen',
        blmessage: settings.blmessage || 'blmessage',
        settingscookies: settings.settingscookies || 'settingsCookies',
        subpopupwarned: settings.subpopupwarned ||'popupwarned',
        subsessionclosed: settings.subsessionclosed || 'sessionClosed'
                     }
    var gaiaUrl = 'http://' + GAIA_config("main_server") + '/gim';
    this._path = settings.path ? settings.path : '/';
    this._domain = settings.domain ? settings.domain : document.domain;
    this._gUrl = settings.url ? settings.gUrl : gaiaUrl;
    this._nContainerId = settings.nContainer ? settings.nContainer : 'AIMBuddyListNotifierHeader';
    this._lLaunchLink = settings.lLaunchLink ? settings.lLaunchLink : 'buddylist';
    this._nPollingInt = settings.nPollingInt ? settings.nPollingInt : 5;    
    this._cOName = this._gUserId + '_' + this._cookies.blopen;
    this._cFName = this._gUserId + '_' + this._cookies.blfocus;
    this._cMName = this._gUserId + '_' + this._cookies.blmessage;
    this._cSName = this._gUserId + '_' + this._cookies.settingscookies;
    this._gimSetup = settings.gimSetup;
    this._showtoolbar = settings.showtoolbar;
    if(typeof(settings.autoLogin) != "undefined" && settings.autoLogin == 0){
        this._autoLogin = false;
    }

    if(this._gimSetup != 1) {
        var headID = document.getElementsByTagName("head")[0];         
        var newScript = document.createElement('script');
        newScript.type = 'text/javascript';
        newScript.src = "http://" +  GAIA_config("graphics_server") + "/src/js/gim/setup/setup.js";
        headID.appendChild(newScript);
    }

    YAHOO.util.Event.addListener(this._lLaunchLink,"click",this.listLaunch,this,true);

 
 
    var blCookie = Cookie.get(this._cOName);

    if(settings.enablePopup == 1 && blCookie != 'true' && this._gimSetup > 0 && settings.validated > 0 && settings.user_tos_status > 0 && settings.disable_gim_popup == 0 ){
        this.listLaunch();
        window.focus();
    }

    YAHOO.gaia.app.Gim.widgets.header.launch(settings);

};


YAHOO.gaia.app.Gim.Launcher.prototype.listLaunch = function(ev,override) {
  
    //document.getElementById('GIMLaunch').innerHTML = 'Gaia IM';
    if(!this._gimSetup) return;

    //this._store.get('testdata',function(ok,val) {alert('some_key=' + val)});
    var isClick = false;
    if(typeof(ev) != 'undefined'){
        if((typeof(ev.type) != 'unknown' && ev.type == "click") || override == true){
            isClick = true;
        }
    }

    if(!isClick) {
        var sStatus = Cookie.getSub(this._cSName,this._cookies.subsessionclosed);
         if(sStatus != null && sStatus == "true" ) {
             return;
         }
    }
    var blCookie = Cookie.get(this._cOName);
    // if buddy list open
    if(blCookie == 'true') {
        var now = new Date();
        now.setSeconds(now.getSeconds + 5);
        Cookie.set(this._cFName,'true',{path:"/",domain:document.domain});
    }
    else{
        if(this._opening) return;
        this._opening = true;

        if(this._showtoolbar == 1) {
            var w = window.open(this._gUrl, "buddylist", "toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=no,width=275,height=480,resizable");
        }
        else {
            var w = window.open(this._gUrl, "buddylist", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=275,height=480,resizable");
        }
        if(!w) {
            var warned = Cookie.getSub(this._cSName,this._cookies.subpopupwarned);
            if(warned == null || warned != "true" || isClick) {
                var now = new Date();
                now.setHours(now.getHours() + 24);
                Cookie.setSub(this._cSName,this._cookies.subpopupwarned,'true',{path:"/",domain:document.domain,expires:now});
                alert("The browser you are using is disabling pop-ups from this site, for full functionality of the Gaia instant Messenger please enable pop-up windows from Gaia");
                   
            }
            this._opening = false;
            return;
            
              
        }
        else {
            var now = new Date();
            now.setSeconds(now.getSeconds()+10);
            Cookie.set(this._cOName,'true',{domain:document.domain,path:'/',expires:now});
            w.focus();
        }
        var scope = this;
        window.setTimeout(function(){ scope._opening=false},5000);
    }
    
};



YAHOO.gaia.app.Gim.Launcher.prototype.updateBLHeader = function(){
    var scope = this;
    var fn = function(){
        var blCookie = Cookie.get(scope._cOName);
        var nHeader = document.getElementById(scope._nContainerId);
        if(blCookie == 'true') {
            
            var blItems = Cookie.getSubs(scope._cMName);
            if(blItems) {
                var mDate = new Date(blItems.lastTime);
                var now = new Date();
                var oldTime = nHeader.getAttribute("timestamp");
                if(now < mDate.setMinutes(mDate.getMinutes() + scope._nPollingInt) && oldTime != blItems.lastTime){
                    nHeader.setAttribute("timestamp",blItems.lastTime);
                    var iContainer = document.getElementById("AIMNoticeIconContainer");
                    if(iContainer) {
                        iContainer.parentNode.removeChild(iContainer);
                        iContainer = null;
                    }
                    
                    iContainer = document.createElement("div");
                    iContainer.setAttribute("id",'AIMNoticeIconContainer');
                    nHeader.appendChild(iContainer);
                    var img = document.createElement("img");
                    img.setAttribute('src',blItems.lastIcon);
                    img.setAttribute('height','30');
                    img.setAttribute('width','30');
                    Dom.addClass(img,'AIMNoticeIconImage');
                    iContainer.appendChild(img);

                    var mContainer = document.getElementById("AIMNoticeMsgContainer");
                    if(mContainer) {
                        mContainer.parentNode.removeChild(mContainer);
                        mContainer = null;
                    }
                    
                    mContainer = document.createElement("div");
                    mContainer.setAttribute("id","AIMNoticeMsgContainer");
                    nHeader.appendChild(mContainer);
                    var uName = document.createElement("div");
                    Dom.addClass(uName,"AIMNoticeMsgName");
                    uName.setAttribute('id','closeNotice');
                    uName.appendChild(document.createTextNode(blItems.lastBuddy + ": "));
                    mContainer.appendChild(uName);
                    var uMess = document.createElement("div");
                    Dom.addClass(uMess,"AIMNoticeMsg");

                    //msg = blItems.lastMessage.replace(/^[0-9a-zA-Zs]+$/g,"");
                    //msg = msg.replace(/&#160;/g,"");
                    var msg = blItems.lastMessage.replace(/(&#160;|&#160||&|#)/g,"");
                    uMess.appendChild(document.createTextNode(msg));
                    mContainer.appendChild(uMess);
                    
                    Dom.setStyle(nHeader,"display","block");
                    // Event.addListener('closeNotice','click',function(){Dom.setStyle(nHeader,"display","none"); });
                    var glauncher = new YAHOO.gaia.app.Gim.GlobalLauncher(); 
                    glauncher.init({gUserId: scope._gUserId});
                    Event.addListener(nHeader,'click',function(){
                                          Dom.setStyle(nHeader,"display","none");
                                          glauncher.launchUser(blItems.lastBuddyId,true,"false")
                                              });
                }
            }
            else {
                Dom.setStyle(nHeader,"display","none");
            }
        }
        else{
            //   Dom.setStyle(nHeader,"display","none");
        }
                     
    };
    scope._blHeaderTimer = window.setInterval(fn,5000);

};


YAHOO.gaia.app.Gim.Launcher.prototype.debug = function(str) {

    if(!this._DEBUG) return;
    
    if(this._debugWindow == null || this._debugWindow.closed) {
        this._debugWindow = window.open("","HeaderDebug","status=1,toolbar=1,menu=1,resizable=1,height=400,width=500");
        var html = "<html><head></head><body><div></div></body></html>";
        this._debugWindow.document.write(html);               
    }
    var dbg = this._debugWindow.document.getElementById("AIMDebugger");
    if(!dbg) {

        dbg = this._debugWindow.document.getElementsByTagName("body")[0].appendChild(this._debugWindow.document.createElement("div"));
        Dom.setStyle(dbg,"overflow-y","auto");
        Dom.setStyle(dbg,"height","500px");
        dbg.setAttribute("id","AIMDebugger");
               
    }
    this._debugWindow.document.getElementById("AIMDebugger").innerHTML =  this._debugWindow.document.getElementById("AIMDebugger").innerHTML + "<p><span style=\"color:green;\">" + new Date() + "(" + Date.parse(new Date()) + ")</span><br />" + str + "</p>";
    this._debugWindow.document.close();
            //dbg.scrollTop = dbg.scrollHeight;

};

})()


YAHOO.namespace("gaia.app.Gim");
(function() {

    var Cookie = YAHOO.util.Cookie;


    YAHOO.gaia.app.Gim.GlobalLauncher = function() {

        this._cookies = null;
        this._gUserId = null;

    };


    YAHOO.gaia.app.Gim.GlobalLauncher.prototype.init = function(settings) {
        

        this._gUserId = settings.gUserId;
        this._gUrl = "/gim";
        this._cookies = {
            blstartconvo : (settings.blfocus || 'blstartconvo'),
            blopen : (settings.blopen || 'blopen')
        };


        this._cStartConvoId =  this._gUserId + '_' + this._cookies.blstartconvo;
        this._cOpenId = this._gUserId + '_' + this._cookies.blopen;
        
        
        
    };

    YAHOO.gaia.app.Gim.GlobalLauncher.prototype.launchUser = function(userId,useAimId,focus) {
        var blCookie = Cookie.get(this._cOpenId,{path:"/",domain:document.domain});

        if(blCookie != 'true') {
            var w = window.open(this._gUrl, "buddylist", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=600,height=480,resizable");
            w.focus();
        }
        else {
            focus="true";
        }
  
        var now = new Date();
        if(typeof(useAimId) == 'undefined')
            useAimId = false;
        if(typeof(focus) == 'undefined')
            focus = true;

        var items = {gUserId:userId,timestamp:now,useAimId:useAimId,focus:focus};
        now.setSeconds(now.getSeconds() + 5);
        Cookie.setSubs(this._cStartConvoId,items,{path:"/",domain:document.domain});
        
    };

})();
