if(typeof Light=="undefined"||!Light){var Light={};}

Light.namespace = function()
{
   var A = arguments, E = null, C, B, D;
   for(C = 0; C < A.length; C = C + 1)
   {
      D = A[C].split(".");
      E = Light;
      for(B = (D[0] == "Light") ? 1 : 0; B < D.length; B = B + 1)
      {
         E[D[B]] = E[D[B]] ||
         {
         }
         ;
         E = E[D[B]];
      }
   }
   return E;
}
;

Light.env = Light.env ||
{
   modules : [], listeners : []
}
;
Light.env.getVersion = function(A)
{
   return Light.env.modules[A] || null;
}
;

Light.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()
{
   Light.namespace("util", "widget", "example");
   if("undefined" !== typeof Light_config)
   {
      var B = Light_config.listener, A = Light.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);
         }
      }
   }
}
)();

Light.lang=Light.lang||{};

(function(){

var A=Light.lang;
var C=["toString","valueOf"];
var 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:(Light.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);Light.util.Lang=A;A.augment=A.augmentProto;Light.augment=A.augmentProto;Light.extend=A.extend;})();





(function(){var B=Light.util,F=Light.lang,L,J,K={},G={},N=window.document;Light.env._id_counter=Light.env._id_counter||0;var C=Light.env.ua.opera,M=Light.env.ua.webkit,A=Light.env.ua.gecko,H=Light.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};

Light.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+Light.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;};}}();})();

Light.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;};
Light.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};



Light.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||Light.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new Light.util.CustomEvent(E,this,true);}this.lastError=null;};
Light.util.CustomEvent.LIST=0;
Light.util.CustomEvent.FLAT=1;

Light.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 Light.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=Light.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==Light.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;}};

Light.util.Subscriber=function(B,C,A){this.fn=B;this.obj=Light.lang.isUndefined(C)?null:C;this.override=A;};

Light.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};

Light.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};

Light.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};

if(!Light.util.Event){

Light.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=Light.env.ua.ie?"focusin":"focus";var L=Light.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:Light.env.ua.webkit,webkit:Light.env.ua.webkit,isIE:Light.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=(Light.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(Light.lang.isString(O)){var R=this.getEl(O);if(R){O=R;}else{this.onAvailable(O,function(){Light.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,Light.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){Light.util.Event.fireLegacyEvent(Light.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(Light.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 Light.util.CustomEvent("DOMReady",this),_load:function(N){if(!H){H=true;var M=Light.util.Event;M._ready();M._tryPreloadAttach();}},_ready:function(N){var M=Light.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=(Light.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=(Light.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=Light.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=Light.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener;if(EU.isIE){Light.util.Event.onDOMReady(Light.util.Event._tryPreloadAttach,Light.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();})();}





$D=Light.util.Dom;$E=Light.util.Event;$=$D.get;
TB={};

///////////////////////////////////////////

TB.namespace = function()
{
   var A = arguments, E = null, C, B, D;
   for(C = 0; C < A.length; C = C + 1)
   {
      D = A[C].split(".");
      E = TB;
      for(B = (D[0] == "TB") ? 1 : 0; B < D.length; B = B + 1)
      {
         E[D[B]] = E[D[B]] ||
         {
         }
         ;
         E = E[D[B]]
      }
   }
   return E
}
;
TB.namespace("env");
TB.env =
{
   hostname : "lightclinic.com", debug : false, lang : "zh-cn"
}
;
TB.namespace("locale");
TB.locale =
{
   Messages :
   {
   }
   , getMessage : function(A)
   {
      return TB.locale.Messages[A] || A
   }
   , setMessage : function(A, B)
   {
      TB.locale.Messages[A] = B
   }
}
;
$M = TB.locale.getMessage;
TB.trace = function(A)
{
   if( ! TB.env.debug)
   {
      return
   }
   if(window.console)
   {
      window.console.debug(A)
   }
   else
   {
      alert(A)
   }
}
;
TB.init = function()
{
   this.namespace("widget", "dom", "bom", "util", "form", "anim"); if(location.hostname.indexOf("lightclinic.com") == - 1)
   {
      TB.env.hostname = location.hostname;
      TB.env.debug = true
   }
   var A = document.getElementsByTagName("script");
   var C = /tbra(?:[\w\.\-]*?)\.js(?:$|\?(.*))/;
   var E;
   for(var B = 0; B < A.length; ++ B)
   {
      if(E = C.exec(A[B].src))
      {
         TB.env["path"] = A[B].src.substring(0, E.index);
         if(E[1])
         {
            var D = E[1].toQueryParams();
            for(n in D)
            {
               if(n == "t" || n == "timestamp")
               {
                  TB.env["timestamp"] = parseInt(D[n]);
                  continue
               }
               TB.env[n] = D[n]
            }
         }
      }
   }
   
   
   /////////////////////////////////////
TB.locale.Messages =
{
   loading : "Loading...", pleaseWait : "Please waiting...", ajaxError : "System Error", prevPageText : "Next Page", nextPageText : "Previous Page", year : "year", month : "month", day : "day", hour : "hour", minute : "minute", second : "second", timeoutText : "Timeout"
}
}
;
TB.init();
TB.common =
{
trim : function(A)
{
   return A.replace(/(^\s*)|(\s*$)/g, "")
}
, escapeHTML : function(B)
{
   var C = document.createElement("div");
   var A = document.createTextNode(B);
   C.appendChild(A);
   return C.innerHTML
}
, unescapeHTML : function(A)
{
   var B = document.createElement("div");
   B.innerHTML = A.replace(/<\/?[^>]+>/gi, "");
   return B.childNodes[0] ? B.childNodes[0].nodeValue : ""
}
, stripTags : function(A)
{
   return A.replace(/<\/?[^>]+>/gi, "")
}
, toArray : function(B, D)
{
   var C = [];
   for(var A = D || 0; A < B.length; A ++ )
   {
      C[C.length] = B[A]
   }
   return C
}
, applyIf : function(C, A)
{
   if(C && A && typeof A == "object")
   {
      for(var B in A)
      {
         if( ! Light.lang.hasOwnProperty(C, B))
         {
            C[B] = A[B]
         }
      }
   }
   return C
}
, apply : function(C, A)
{
   if(C && A && typeof A == "object")
   {
      for(var B in A)
      {
         C[B] = A[B]
      }
   }
   return C
}
, formatMessage : function(D, A, B)
{
   var C = /\{([\w-]+)?\}/g;
   return function(G, E, F)
   {
      return G.replace(C, function(H, I)
      {
         return F ? F(E[I], I) : E[I]
      }
      )
   }
}
(), parseUri : (function()
{
   var B = ["source", "prePath", "scheme", "username", "password", "host", "port", "path", "dir", "file", "query", "fragment"];
   var A = /^((?:([^:\/?#.]+):)?(?:\/\/)?(?:([^:@]*):?([^:@]*)?@)?([^:\/?#]*)(?::(\d*))?)((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?/;
   return function(F)
   {
      var E =
      {
      }
      ;
      var C = A.exec(F);
      for(var D = 0; D < C.length; ++ D)
      {
         E[B[D]] = (C[D] ? C[D] : "")
      }
      return E
   }
}
)()
}
;
TB.applyIf = TB.common.applyIf;
TB.apply = TB.common.apply;
(function()
{
var E = navigator.userAgent.toLowerCase();
var B = E.indexOf("opera") != - 1, G = E.indexOf("safari") != - 1, A = ! B && ! G && E.indexOf("gecko") > - 1, C = ! B && E.indexOf("msie") != - 1, F = ! B && E.indexOf("msie 6") != - 1, D = ! B && E.indexOf("msie 7") != - 1;
TB.bom =
{
   isOpera : B, isSafari : G, isGecko : A, isIE : C, isIE6 : F, isIE7 : D, getCookie : function(H)
   {
      var I = document.cookie.match("(?:^|;)\\s*" + H + "=([^;]*)");
      return I ? unescape(I[1]) : ""
   }
   , setCookie : function(J, L, H, K, M)
   {
      L = escape(L);
      L += (K) ? "; domain=" + K : "";
      L += (M) ? "; path=" + M : "";
      if(H)
      {
         var I = new Date();
         I.setTime(I.getTime() + (H * 86400000));
         L += "; expires=" + I.toGMTString()
      }
      document.cookie = J + "=" + L
   }
   , removeCookie : function(H)
   {
      this.setCookie(H, "", - 1)
   }
   , pickDocumentDomain : function()
   {
      var K = arguments[1] || location.hostname;
      var J = K.split("."), H = J.length;
      var I = arguments[0] || (H < 3 ? 0 : 1);
      if(I >= H || H - I < 2)
      {
         I = H - 2
      }
      return J.slice(I).join(".")
   }
   , addBookmark : function(I, H)
   {
      if(window.sidebar)
      {
         window.sidebar.addPanel(I, H, "")
      }
      else
      {
         if(document.external)
         {
            window.external.AddFavorite(H, I)
         }
         else
         {
         }
      }
   }
}
}
)();
TB.dom =
{
insertAfter : function(B, A)
{
   return $D.insertAfter(B, A)
}
, getAncestorByTagName : function(B, A)
{
   return $D.getAncestorByTagName(B, A)
}
, getAncestorByClassName : function(B, A)
{
   return $D.getAncestorByClassName(B, A)
}
, getNextSibling : function(A)
{
   return $D.getNextSibling(A)
}
, getPreviousSibling : function(A)
{
   return $D.getPreviousSibling(A)
}
, getFieldLabelHtml : function(E, D)
{
   var B = $(E), F = (D || B.parentNode).getElementsByTagName("label");
   for(var C = 0; C < F.length; C ++ )
   {
      var A = F[C].htmlFor || F[C].getAttribute("for"); if(A == B.id)
      {
         return F[C].innerHTML
      }
   }
   return null
}
, getIframeDocument : function(B)
{
   var A = $(B);
   return A.contentWindow ? A.contentWindow.document : A.contentDocument
}
, setFormAction : function(E, C)
{
   E = $(E);
   var B = E.elements["action"];
   var D;
   if(B)
   {
      var A = E.removeChild(B);
      D = function()
      {
         E.appendChild(A)
      }
   }
   E.action = C;
   if(D)
   {
      D()
   }
   return true
}
, addCSS : function(A, C)
{
   C = C || document;
   var B = C.createElement("style");
   B.type = "text/css";
   if(B.styleSheet)
   {
      B.styleSheet.cssText = A
   }
   else
   {
      B.appendChild(C.createTextNode(A))
   }
   C.getElementsByTagName("head")[0].appendChild(B)
}
, getScriptParams : function(C)
{
   var F = /\?(.*?)($|\.js)/;
   var B;
   if(Light.lang.isObject(C) && C.tagName && C.tagName.toLowerCase() == "script")
   {
      if(C.src && (B = C.src.match(F)))
      {
         console.debug(B);
         return B[1].toQueryParams()
      }
   }
   else
   {
      if(Light.lang.isString(C))
      {
         C = new RegExp(C, "i")
      }
      var A = document.getElementsByTagName("script");
      var G, E;
      for(var D = 0; D < A.length; ++ D)
      {
         E = A[D].src;
         if(E && C.test(E) && (B = E.match(F)))
         {
            return B[1].toQueryParams()
         }
      }
   }
}
}
;
TB.anim.Highlight = function(B, A)
{
if( ! B)
{
   return
}
this.init(B, A)
}
;
TB.anim.Highlight.defConfig =
{
startColor : "#ffff99", duration : 0.5, keepBackgroundImage : true
}
;
TB.anim.Highlight.prototype.init = function(E, D)
{
var G = Light.util;
D = TB.applyIf(D ||
{
}
, TB.anim.Highlight.defConfig);
var A =
{
   backgroundColor :
   {
      from : D.startColor
   }
}
;
var F = new G.ColorAnim(E, A, D.duration);
var B = F.getAttribute("backgroundColor");
F.attributes["backgroundColor"]["to"] = B;
if(D.keepBackgroundImage)
{
   var C = $D.getStyle(E, "background-image");
   F.onComplete.subscribe(function()
   {
      $D.setStyle(E, "background-image", C)
   }
   )
}
this.onComplete = F.onComplete;
this.animate = function()
{
   $D.setStyle(E, "background-image", "none");
   F.animate()
}
}
;
TB.widget.InputHint = new function()
{
var B =
{
   hintMessage : "", hintClass : "InputHint", appearOnce : false
}
;
var D = /^\s*$/;
var A = function(E, F)
{
   F.disappear()
}
;
var C = function(E, F)
{
   F.appear()
}
;


this.decorate = function(E, F)
{
   E = $(E);
   F = TB.applyIf(F ||
   {
   }
   , B);
   var H = F.hintMessage || E.title;
   var G =
   {
   }
   ;
   G.disappear = function()
   {
      if(H == E.value)
      {
         E.value = "";
         $D.removeClass(E, F.hintClass)
      }
   }
   ;
   G.appear = function()
   {
      if(D.test(E.value) || H == E.value)
      {
         E.value = H;
         $D.addClass(E, F.hintClass)
      }
   }
   ;
   E.setAttribute("title", H);
   $E.on(E, "focus", A, G);
   $E.on(E, "drop", A, G);
   if( ! F.appearOnce)
   {
      $E.on(E, "blur", C, G)
   }
   G.appear();
   return G
}
}
;
TB.widget.SimplePopup = new function()
{
var F = Light.util;
var E =
{
   position : "right", autoFit : true, eventType : "mouse", delay : 0.1, disableClick : true, width : 200, height : 200
}
;
var D = function(H)
{
   var I = $E.getTarget(H);
   if(D._target == I)
   {
      this.popup.style.display == "block" ? this.hide() : this.show()
   }
   else
   {
      this.show()
   }
   $E.preventDefault(H);
   D._target = I
}
;
var G = function(I)
{
   clearTimeout(this._popupHideTimeId);
   var H = this;
   this._popupShowTimeId = setTimeout(function()
   {
      H.show()
   }
   , this.config.delay * 1000);
   if(this.config.disableClick && ! this.trigger.onclick)
   {
      this.trigger.onclick = function(J)
      {
         $E.preventDefault($E.getEvent(J))
      }
   }
}
;
var C = function(H)
{
   clearTimeout(this._popupShowTimeId);
   if( ! $D.isAncestor(this.popup, $E.getRelatedTarget(H)))
   {
      this.delayHide()
   }
   $E.preventDefault(H)
}
;
var B = function(H)
{
   var I = this.currentHandle ? this.currentHandle : this;
   clearTimeout(I._popupHideTimeId)
}
;
var A = function(H)
{
   var I = this.currentHandle ? this.currentHandle : this;
   if( ! $D.isAncestor(I.popup, $E.getRelatedTarget(H)))
   {
      I.delayHide()
   }
}
;
this.decorate = function(J, H, K)
{
   if(Light.lang.isArray(J) || (Light.lang.isObject(J) && J.length))
   {
      K.shareSinglePopup = true;
      var M =
      {
      }
      ;
      M._handles = [];
      for(var L = 0; L < J.length; L ++ )
      {
         var N = this.decorate(J[L], H, K);
         N._beforeShow = function()
         {
            M.currentHandle = this;
            return true
         }
         ;
         M._handles[L] = N
      }
      if(K.eventType == "mouse")
      {
         $E.on(H, "mouseover", B, M, true);
         $E.on(H, "mouseout", A, M, true)
      }
      return M
   }
   J = $(J);
   H = $(H);
   if( ! J || ! H)
   {
      return
   }
   K = TB.applyIf(K ||
   {
   }
   , E);
   var P =
   {
   }
   ;
   P._popupShowTimeId = null;
   P._popupHideTimeId = null;
   P._beforeShow = function()
   {
      return true
   }
   ;
   var I = new F.CustomEvent("onShow", P, false, F.CustomEvent.FLAT);
   if(K.onShow)
   {
      I.subscribe(K.onShow)
   }
   var O = new F.CustomEvent("onHide", P, false, F.CustomEvent.FLAT);
   if(K.onHide)
   {
      O.subscribe(K.onHide)
   }
   if(K.eventType == "mouse")
   {
      $E.on(J, "mouseover", G, P, true);
      $E.on(J, "mouseout", C, P, true);
      if( ! K.shareSinglePopup)
      {
         $E.on(H, "mouseover", B, P, true);
         $E.on(H, "mouseout", A, P, true)
      }
   }
   else
   {
      if(K.eventType == "click")
      {
         $E.on(J, "click", D, P, true)
      }
   }
   TB.apply(P,
   {
      popup : H, trigger : J, config : K, show : function()
      {
         if( ! this._beforeShow())
         {
            return
         }
         var Y = $D.getXY(this.trigger);
         if(Light.lang.isArray(this.config.offset))
         {
            Y[0] += parseInt(this.config.offset[0]);
            Y[1] += parseInt(this.config.offset[1])
         }
         var V = this.trigger.offsetWidth, R = this.trigger.offsetHeight;
         var Z = K.width, W = K.height;
         var Q = $D.getViewportWidth(), X = $D.getViewportHeight();
         var T = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
         var b = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
         var S = Y[0], a = Y[1];
         if(K.position == "left")
         {
            S = Y[0] - Z
         }
         else
         {
            if(K.position == "right")
            {
               S = Y[0] + V
            }
            else
            {
               if(K.position == "bottom")
               {
                  a = a + R
               }
               else
               {
                  if(K.position == "top")
                  {
                     a = a - W;
                     if(a < 0)
                     {
                        a = 0
                     }
                  }
               }
            }
         }
         if(this.config.autoFit)
         {
            if(a - b + W > X)
            {
               a = X - W + b - 2;
               if(a < 0)
               {
                  a = 0
               }
            }
         }
         this.popup.style.position = "absolute";
         this.popup.style.top = a + "px";
         this.popup.style.left = S + "px";
         if(this.config.effect)
         {
            if(this.config.effect == "fade")
            {
               $D.setStyle(this.popup, "opacity", 0);
               this.popup.style.display = "block";
               var U = new F.Anim(this.popup,
               {
                  opacity :
                  {
                     to : 1
                  }
               }
               , 0.4);
               U.animate()
            }
         }
         else
         {
            this.popup.style.display = "block"
         }
         I.fire()
      }
      , hide : function()
      {
         $D.setStyle(this.popup, "display", "none");
         O.fire()
      }
      , delayHide : function()
      {
         var Q = this;
         this._popupHideTimeId = setTimeout(function()
         {
            Q.hide()
         }
         , this.config.delay * 1000)
      }
   }
   );
   $D.setStyle(H, "display", "none");
   return P
}
}
;
TB.widget.SimpleRating = new function()
{
var defConfig =
{
   rateUrl : "", rateParams : "", scoreParamName : "score", topScore : 5, currentRatingClass : "current-rating"
}
;
var rateHandler = function(ev, handle)
{
   $E.stopEvent(ev);
   var aEl = $E.getTarget(ev);
   var score = parseInt(aEl.innerHTML);
   try
   {
      aEl.blur()
   }
   catch(e)
   {
   }
   handle.rate(score)
}
;
var updateCurrentRating = function(currentRatingLi, avg, config)
{
   if(currentRatingLi)
   {
      currentRatingLi.innerHTML = avg
   }
   $D.setStyle(currentRatingLi, "width", avg * 100 / config.topScore + "%")
}
;
this.decorate = function(ratingContainer, config)
{
   ratingContainer = $(ratingContainer);
   config = TB.applyIf(config ||
   {
   }
   , defConfig);
   var currentRatingLi = $D.getElementsByClassName(config.currentRatingClass, "li", ratingContainer)[0];
   var onRateEvent = new Light.util.CustomEvent("onRate", null, false, Light.util.CustomEvent.FLAT);
   if(config.onRate)
   {
      onRateEvent.subscribe(config.onRate)
   }
   var handle =
   {
   }
   ;
   handle.init = function(avg)
   {
      updateCurrentRating(currentRatingLi, avg, config)
   }
   ;
   handle.update = function(ret)
   {
      if(ret && ret.Average && currentRatingLi)
      {
         updateCurrentRating(currentRatingLi, ret.Average, config)
      }
      $E.purgeElement(ratingContainer, true, "click");
      for(var lis = ratingContainer.getElementsByTagName("li"), i = lis.length - 1;
      i > 0;
      i -- )
      {
         ratingContainer.removeChild(lis[i])
      }
      onRateEvent.fire(ret)
   }
   ;
   handle.rate = function(score)
   {
      var indicator = TB.util.Indicator.attach(ratingContainer,
      {
         message : $M("pleaseWait")
      }
      );
      indicator.show();
      ratingContainer.style.display = "none";
      var postData = config.scoreParamName + "=" + score;
      if(config.rateParams)
      {
         postData += "&" + config.rateParams
      }
      Light.util.Connect.asyncRequest("POST", config.rateUrl,
      {
         success : function(req)
         {
            indicator.hide();
            ratingContainer.style.display = "";
            var ret = eval("(" + req.responseText + ")");
            if(ret.Error)
            {
               alert(ret.Error.Message);
               return
            }
            else
            {
               handle.update(ret)
            }
         }
         , failure : function(req)
         {
            indicator.hide();
            ratingContainer.style.display = "";
            TB.trace($M("ajaxError"))
         }
      }
      , postData)
   }
   ;
   handle.onRate = function(callback)
   {
      if(Light.lang.isFunction(callback))
      {
         onRateEvent.subscribe(callback)
      }
   }
   ;
   var triggers = ratingContainer.getElementsByTagName("a");
   for(var i = 0; i < triggers.length; i ++ )
   {
      $E.on(triggers[i], "click", rateHandler, handle)
   }
   return handle
}
}
;

TB.widget.SimpleScroll = new function()
{
   var Y = Light.util;
   var defConfig =
   {
      delay : 2, speed : 20, startDelay : 2, direction : "vertical", disableAutoPlay : false, distance : "auto", scrollItemCount : 1
   }
   ;
   this.decorate = function(container, config)
   {
      container = $(container);
      config = TB.applyIf(config ||
      {
      }
      , defConfig);
      var step = 2;
      if(config.speed < 20)
      {
         step = 5
      }
      if(config.lineHeight)
      {
         config.distance = config.lineHeight
      }
      var scrollTimeId = null, startTimeId = null, startDelayTimeId = null;
      var isHorizontal = (config.direction.toLowerCase() == "horizontal") || (config.direction.toLowerCase() == "h");
      var handle =
      {
      }
      ;
      handle._distance = 0;
      handle.scrollable = true;
      handle.distance = config.distance;
      handle._distance = 0;
      handle.suspend = false;
      handle.paused = false;
      var _onScrollEvent = new Y.CustomEvent("_onScroll", handle, false, Y.CustomEvent.FLAT);
      _onScrollEvent.subscribe(function()
      {
         var curLi = container.getElementsByTagName("li")[0];
         if( ! curLi)
         {
            this.scrollable = false;
            return
         }
         this.distance = (config.distance == "auto") ? curLi[isHorizontal ? "offsetWidth" : "offsetHeight"] : config.distance;
         with(container)
         {
            if(isHorizontal)
            {
               this.scrollable = (scrollWidth - scrollLeft - offsetWidth) >= this.distance
            }
            else
            {
               this.scrollable = (scrollHeight - scrollTop - offsetHeight) >= this.distance
            }
         }
      }
      );
      var onScrollEvent = new Y.CustomEvent("onScroll", handle, false, Y.CustomEvent.FLAT);
      if(config.onScroll)
      {
         onScrollEvent.subscribe(config.onScroll)
      }
      else
      {
         onScrollEvent.subscribe(function()
         {
            for(var i = 0; i < config.scrollItemCount; i ++ )
            {
               container.appendChild(container.getElementsByTagName("li")[0])
            }
            container[isHorizontal ? "scrollLeft" : "scrollTop"] = 0
         }
         )
      }
      var scroll = function()
      {
         if(handle.suspend)
         {
            return
         }
         handle._distance += step;
         var _d;
         if((_d = handle._distance % handle.distance) < step)
         {
            container[isHorizontal ? "scrollLeft" : "scrollTop"] += (step - _d);
            clearInterval(scrollTimeId);
            onScrollEvent.fire();
            _onScrollEvent.fire();
            startTimeId = null;
            if(handle.scrollable && ! handle.paused)
            {
               handle.play()
            }
         }
         else
         {
            container[isHorizontal ? "scrollLeft" : "scrollTop"] += step
         }
      }
      ;
      var start = function()
      {
         if(handle.paused)
         {
            return
         }
         handle._distance = 0;
         scrollTimeId = setInterval(scroll, config.speed)
      }
      ;
      $E.on(container, "mouseover", function()
      {
         handle.suspend = true
      }
      );
      $E.on(container, "mouseout", function()
      {
         handle.suspend = false
      }
      );
      TB.apply(handle,
      {
         subscribeOnScroll : function(func, override)
         {
            if(override === true && onScrollEvent.subscribers.length > 0)
            {
               onScrollEvent.unsubscribeAll()
            }
            onScrollEvent.subscribe(func)
         }
         , pause : function()
         {
            this.paused = true;
            clearTimeout(startTimeId);
            startTimeId = null
         }
         , play : function()
         {
            this.paused = false;
            if(startDelayTimeId)
            {
               clearTimeout(startDelayTimeId)
            }
            if( ! startTimeId)
            {
               startTimeId = setTimeout(start, config.delay * 1000)
            }
         }
      }
      );
      handle.onScroll = handle.subscribeOnScroll;
      _onScrollEvent.fire();
      if( ! config.disableAutoPlay)
      {
         startDelayTimeId = setTimeout(function()
         {
            handle.play()
         }
         , config.startDelay * 1000)
      }
      return handle
   }
}

var AE={};AE.widget=TB.widget;AE.browse=TB.bom;AE.bom=TB.bom;AE.common=TB.common;AE.dom=TB.dom;
