
function insertMedia()
{
for( var k = 0, l = arguments.length; k < l; k++ )
{
document.write( arguments[k] );
}
}
function insertMedia2( node_id, string )
{
var flashNode = document.getElementById( node_id );
flashNode.innerHTML = string;
}
if(typeof YAHOO=="undefined"){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};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(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);}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={isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice)&&!A.hasOwnProperty(B.length);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var C={},A=arguments,B;for(B=0;B<A.length;B=B+1){YAHOO.lang.augmentObject(C,A[B],true);}return C;},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.1",build:"541"});(function(){var B=YAHOO.util,K,I,H=0,J={},F={};var C=YAHOO.env.ua.opera,L=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var M=function(O){if(!E.HYPHEN.test(O)){return O;}if(J[O]){return J[O];}var P=O;while(E.HYPHEN.exec(P)){P=P.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}J[O]=P;return P;};var N=function(P){var O=F[P];if(!O){O=new RegExp("(?:^|\\s+)"+P+"(?:\\s+|$)");F[P]=O;}return O;};if(document.defaultView&&document.defaultView.getComputedStyle){K=function(O,R){var Q=null;if(R=="float"){R="cssFloat";}var P=document.defaultView.getComputedStyle(O,"");if(P){Q=P[M(R)];}return O.style[R]||Q;};}else{if(document.documentElement.currentStyle&&G){K=function(O,Q){switch(M(Q)){case"opacity":var S=100;try{S=O.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(R){try{S=O.filters("alpha").opacity;}catch(R){}}return S/100;case"float":Q="styleFloat";default:var P=O.currentStyle?O.currentStyle[Q]:null;return(O.style[Q]||P);}};}else{K=function(O,P){return O.style[P];};}}if(G){I=function(O,P,Q){switch(P){case"opacity":if(YAHOO.lang.isString(O.style.filter)){O.style.filter="alpha(opacity="+Q*100+")";if(!O.currentStyle||!O.currentStyle.hasLayout){O.style.zoom=1;}}break;case"float":P="styleFloat";default:O.style[P]=Q;}};}else{I=function(O,P,Q){if(P=="float"){P="cssFloat";}O.style[P]=Q;};}var D=function(O,P){return O&&O.nodeType==1&&(!P||P(O));};YAHOO.util.Dom={get:function(Q){if(Q&&(Q.tagName||Q.item)){return Q;}if(YAHOO.lang.isString(Q)||!Q){return document.getElementById(Q);}if(Q.length!==undefined){var R=[];for(var P=0,O=Q.length;P<O;++P){R[R.length]=B.Dom.get(Q[P]);}return R;}return Q;},getStyle:function(O,Q){Q=M(Q);var P=function(R){return K(R,Q);};return B.Dom.batch(O,P,B.Dom,true);},setStyle:function(O,Q,R){Q=M(Q);var P=function(S){I(S,Q,R);};B.Dom.batch(O,P,B.Dom,true);},getXY:function(O){var P=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=document.body){return false;}var Q=null;var V=[];var S;var T=R.ownerDocument;if(R.getBoundingClientRect){S=R.getBoundingClientRect();return[S.left+B.Dom.getDocumentScrollLeft(R.ownerDocument),S.top+B.Dom.getDocumentScrollTop(R.ownerDocument)];}else{V=[R.offsetLeft,R.offsetTop];Q=R.offsetParent;var U=this.getStyle(R,"position")=="absolute";if(Q!=R){while(Q){V[0]+=Q.offsetLeft;V[1]+=Q.offsetTop;if(L&&!U&&this.getStyle(Q,"position")=="absolute"){U=true;}Q=Q.offsetParent;}}if(L&&U){V[0]-=R.ownerDocument.body.offsetLeft;V[1]-=R.ownerDocument.body.offsetTop;}}Q=R.parentNode;while(Q.tagName&&!E.ROOT_TAG.test(Q.tagName)){if(B.Dom.getStyle(Q,"display").search(/^inline|table-row.*$/i)){V[0]-=Q.scrollLeft;V[1]-=Q.scrollTop;}Q=Q.parentNode;}return V;};return B.Dom.batch(O,P,B.Dom,true);},getX:function(O){var P=function(Q){return B.Dom.getXY(Q)[0];};return B.Dom.batch(O,P,B.Dom,true);},getY:function(O){var P=function(Q){return B.Dom.getXY(Q)[1];};return B.Dom.batch(O,P,B.Dom,true);},setXY:function(O,R,Q){var P=function(U){var T=this.getStyle(U,"position");if(T=="static"){this.setStyle(U,"position","relative");T="relative";}var W=this.getXY(U);if(W===false){return false;}var V=[parseInt(this.getStyle(U,"left"),10),parseInt(this.getStyle(U,"top"),10)];if(isNaN(V[0])){V[0]=(T=="relative")?0:U.offsetLeft;}if(isNaN(V[1])){V[1]=(T=="relative")?0:U.offsetTop;}if(R[0]!==null){U.style.left=R[0]-W[0]+V[0]+"px";}if(R[1]!==null){U.style.top=R[1]-W[1]+V[1]+"px";}if(!Q){var S=this.getXY(U);if((R[0]!==null&&S[0]!=R[0])||(R[1]!==null&&S[1]!=R[1])){this.setXY(U,R,true);}}};B.Dom.batch(O,P,B.Dom,true);},setX:function(P,O){B.Dom.setXY(P,[O,null]);},setY:function(O,P){B.Dom.setXY(O,[null,P]);},getRegion:function(O){var P=function(Q){if((Q.parentNode===null||Q.offsetParent===null||this.getStyle(Q,"display")=="none")&&Q!=document.body){return false;}var R=B.Region.getRegion(Q);return R;};return B.Dom.batch(O,P,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(S,W,T,U){W=W||"*";T=(T)?B.Dom.get(T):null||document;if(!T){return[];}var P=[],O=T.getElementsByTagName(W),V=N(S);for(var Q=0,R=O.length;Q<R;++Q){if(V.test(O[Q].className)){P[P.length]=O[Q];if(U){U.call(O[Q],O[Q]);}}}return P;},hasClass:function(Q,P){var O=N(P);var R=function(S){return O.test(S.className);};return B.Dom.batch(Q,R,B.Dom,true);},addClass:function(P,O){var Q=function(R){if(this.hasClass(R,O)){return false;}R.className=YAHOO.lang.trim([R.className,O].join(" "));return true;};return B.Dom.batch(P,Q,B.Dom,true);},removeClass:function(Q,P){var O=N(P);var R=function(S){if(!this.hasClass(S,P)){return false;}var T=S.className;S.className=T.replace(O," ");if(this.hasClass(S,P)){this.removeClass(S,P);}S.className=YAHOO.lang.trim(S.className);return true;};return B.Dom.batch(Q,R,B.Dom,true);},replaceClass:function(R,P,O){if(!O||P===O){return false;}var Q=N(P);var S=function(T){if(!this.hasClass(T,P)){this.addClass(T,O);return true;}T.className=T.className.replace(Q," "+O+" ");if(this.hasClass(T,P)){this.replaceClass(T,P,O);}T.className=YAHOO.lang.trim(T.className);return true;};return B.Dom.batch(R,S,B.Dom,true);},generateId:function(O,Q){Q=Q||"yui-gen";var P=function(R){if(R&&R.id){return R.id;}var S=Q+H++;if(R){R.id=S;}return S;};return B.Dom.batch(O,P,B.Dom,true)||P.apply(B.Dom,arguments);},isAncestor:function(P,Q){P=B.Dom.get(P);if(!P||!Q){return false;}var O=function(R){if(P.contains&&R.nodeType&&!L){return P.contains(R);}else{if(P.compareDocumentPosition&&R.nodeType){return !!(P.compareDocumentPosition(R)&16);}else{if(R.nodeType){return !!this.getAncestorBy(R,function(S){return S==P;});}}}return false;};return B.Dom.batch(Q,O,B.Dom,true);},inDocument:function(O){var P=function(Q){if(L){while(Q=Q.parentNode){if(Q==document.documentElement){return true;}}return false;}return this.isAncestor(document.documentElement,Q);};return B.Dom.batch(O,P,B.Dom,true);},getElementsBy:function(V,P,Q,S){P=P||"*";
Q=(Q)?B.Dom.get(Q):null||document;if(!Q){return[];}var R=[],U=Q.getElementsByTagName(P);for(var T=0,O=U.length;T<O;++T){if(V(U[T])){R[R.length]=U[T];if(S){S(U[T]);}}}return R;},batch:function(S,V,U,Q){S=(S&&(S.tagName||S.item))?S:B.Dom.get(S);if(!S||!V){return false;}var R=(Q)?U:window;if(S.tagName||S.length===undefined){return V.call(R,S,U);}var T=[];for(var P=0,O=S.length;P<O;++P){T[T.length]=V.call(R,S[P],U);}return T;},getDocumentHeight:function(){var P=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var O=Math.max(P,B.Dom.getViewportHeight());return O;},getDocumentWidth:function(){var P=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var O=Math.max(P,B.Dom.getViewportWidth());return O;},getViewportHeight:function(){var O=self.innerHeight;var P=document.compatMode;if((P||G)&&!C){O=(P=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return O;},getViewportWidth:function(){var O=self.innerWidth;var P=document.compatMode;if(P||G){O=(P=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;}return O;},getAncestorBy:function(O,P){while(O=O.parentNode){if(D(O,P)){return O;}}return null;},getAncestorByClassName:function(P,O){P=B.Dom.get(P);if(!P){return null;}var Q=function(R){return B.Dom.hasClass(R,O);};return B.Dom.getAncestorBy(P,Q);},getAncestorByTagName:function(P,O){P=B.Dom.get(P);if(!P){return null;}var Q=function(R){return R.tagName&&R.tagName.toUpperCase()==O.toUpperCase();};return B.Dom.getAncestorBy(P,Q);},getPreviousSiblingBy:function(O,P){while(O){O=O.previousSibling;if(D(O,P)){return O;}}return null;},getPreviousSibling:function(O){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getPreviousSiblingBy(O);},getNextSiblingBy:function(O,P){while(O){O=O.nextSibling;if(D(O,P)){return O;}}return null;},getNextSibling:function(O){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getNextSiblingBy(O);},getFirstChildBy:function(O,Q){var P=(D(O.firstChild,Q))?O.firstChild:null;return P||B.Dom.getNextSiblingBy(O.firstChild,Q);},getFirstChild:function(O,P){O=B.Dom.get(O);if(!O){return null;}return B.Dom.getFirstChildBy(O);},getLastChildBy:function(O,Q){if(!O){return null;}var P=(D(O.lastChild,Q))?O.lastChild:null;return P||B.Dom.getPreviousSiblingBy(O.lastChild,Q);},getLastChild:function(O){O=B.Dom.get(O);return B.Dom.getLastChildBy(O);},getChildrenBy:function(P,R){var Q=B.Dom.getFirstChildBy(P,R);var O=Q?[Q]:[];B.Dom.getNextSiblingBy(Q,function(S){if(!R||R(S)){O[O.length]=S;}return false;});return O;},getChildren:function(O){O=B.Dom.get(O);if(!O){}return B.Dom.getChildrenBy(O);},getDocumentScrollLeft:function(O){O=O||document;return Math.max(O.documentElement.scrollLeft,O.body.scrollLeft);},getDocumentScrollTop:function(O){O=O||document;return Math.max(O.documentElement.scrollTop,O.body.scrollTop);},insertBefore:function(P,O){P=B.Dom.get(P);O=B.Dom.get(O);if(!P||!O||!O.parentNode){return null;}return O.parentNode.insertBefore(P,O);},insertAfter:function(P,O){P=B.Dom.get(P);O=B.Dom.get(O);if(!P||!O||!O.parentNode){return null;}if(O.nextSibling){return O.parentNode.insertBefore(P,O.nextSibling);}else{return O.parentNode.appendChild(P);}}};})();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.3.1",build:"541"});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(){var E=this.subscribers.length;if(!E&&this.silent){return true;}var H=[],G=true,D,I=false;for(D=0;D<arguments.length;++D){H.push(arguments[D]);}var A=H.length;if(!this.silent){}for(D=0;D<E;++D){var L=this.subscribers[D];if(!L){I=true;}else{if(!this.silent){}var K=L.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(H.length>0){B=H[0];}try{G=L.fn.call(K,B,L.obj);}catch(F){this.lastError=F;}}else{try{G=L.fn.call(K,this.type,H,L.obj);}catch(F){this.lastError=F;}}if(false===G){if(!this.silent){}return false;}}}if(I){var J=[],C=this.subscribers;for(D=0,E=C.length;D<E;D=D+1){J.push(C[D]);}this.subscribers=J;}return true;},unsubscribeAll:function(){for(var B=0,A=this.subscribers.length;B<A;++B){this._delete(A-1-B);}this.subscribers=[];return B;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers[A]=null;},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 J=false;var I=[];var K=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var L=this;var M=function(){L._tryPreloadAttach();};this._interval=setInterval(M,this.POLL_INTERVAL);}},onAvailable:function(N,L,O,M){F.push({id:N,fn:L,obj:O,override:M,checkReady:false});C=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(L,N,M){if(J){setTimeout(function(){var O=window;if(M){if(M===true){O=N;}else{O=M;}}L.call(O,"DOMReady",[],N);},0);}else{this.DOMReadyEvent.subscribe(L,N,M);}},onContentReady:function(N,L,O,M){F.push({id:N,fn:L,obj:O,override:M,checkReady:true});C=this.POLL_RETRYS;this.startInterval();},addListener:function(N,L,W,R,M){if(!W||!W.call){return false;}if(this._isValidCollection(N)){var X=true;for(var S=0,U=N.length;S<U;++S){X=this.on(N[S],L,W,R,M)&&X;}return X;}else{if(YAHOO.lang.isString(N)){var Q=this.getEl(N);if(Q){N=Q;}else{this.onAvailable(N,function(){YAHOO.util.Event.on(N,L,W,R,M);});return true;}}}if(!N){return false;}if("unload"==L&&R!==this){K[K.length]=[N,L,W,R,M];return true;}var Z=N;if(M){if(M===true){Z=R;}else{Z=M;}}var O=function(a){return W.call(Z,YAHOO.util.Event.getEvent(a,N),R);};var Y=[N,L,W,O,Z,R,M];var T=I.length;I[T]=Y;if(this.useLegacyEvent(N,L)){var P=this.getLegacyIndex(N,L);if(P==-1||N!=G[P][0]){P=G.length;B[N.id+L]=P;G[P]=[N,L,N["on"+L]];E[P]=[];N["on"+L]=function(a){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(a),P);};}E[P].push(Y);}else{try{this._simpleAdd(N,L,O,false);}catch(V){this.lastError=V;this.removeListener(N,L,W);return false;}}return true;},fireLegacyEvent:function(P,N){var R=true,L,T,S,U,Q;T=E[N];for(var M=0,O=T.length;M<O;++M){S=T[M];if(S&&S[this.WFN]){U=S[this.ADJ_SCOPE];Q=S[this.WFN].call(U,P);R=(R&&Q);}}L=G[N];if(L&&L[2]){L[2](P);}return R;},getLegacyIndex:function(M,N){var L=this.generateId(M)+N;if(typeof B[L]=="undefined"){return -1;}else{return B[L];}},useLegacyEvent:function(M,N){if(this.webkit&&("click"==N||"dblclick"==N)){var L=parseInt(this.webkit,10);if(!isNaN(L)&&L<418){return true;}}return false;},removeListener:function(M,L,U){var P,S,W;if(typeof M=="string"){M=this.getEl(M);}else{if(this._isValidCollection(M)){var V=true;for(P=0,S=M.length;P<S;++P){V=(this.removeListener(M[P],L,U)&&V);}return V;}}if(!U||!U.call){return this.purgeElement(M,false,L);}if("unload"==L){for(P=0,S=K.length;P<S;P++){W=K[P];if(W&&W[0]==M&&W[1]==L&&W[2]==U){K[P]=null;return true;}}return false;}var Q=null;var R=arguments[3];if("undefined"===typeof R){R=this._getCacheIndex(M,L,U);}if(R>=0){Q=I[R];}if(!M||!Q){return false;}if(this.useLegacyEvent(M,L)){var O=this.getLegacyIndex(M,L);var N=E[O];if(N){for(P=0,S=N.length;P<S;++P){W=N[P];if(W&&W[this.EL]==M&&W[this.TYPE]==L&&W[this.FN]==U){N[P]=null;break;}}}}else{try{this._simpleRemove(M,L,Q[this.WFN],false);}catch(T){this.lastError=T;return false;}}delete I[R][this.WFN];delete I[R][this.FN];I[R]=null;return true;},getTarget:function(N,M){var L=N.target||N.srcElement;return this.resolveTextNode(L);},resolveTextNode:function(L){if(L&&3==L.nodeType){return L.parentNode;}else{return L;}},getPageX:function(M){var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(this.isIE){L+=this._getScrollLeft();}}return L;},getPageY:function(L){var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(this.isIE){M+=this._getScrollTop();}}return M;},getXY:function(L){return[this.getPageX(L),this.getPageY(L)];
},getRelatedTarget:function(M){var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement;}else{if(M.type=="mouseover"){L=M.fromElement;}}}return this.resolveTextNode(L);},getTime:function(N){if(!N.time){var M=new Date().getTime();try{N.time=M;}catch(L){this.lastError=L;return M;}}return N.time;},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L);},stopPropagation:function(L){if(L.stopPropagation){L.stopPropagation();}else{L.cancelBubble=true;}},preventDefault:function(L){if(L.preventDefault){L.preventDefault();}else{L.returnValue=false;}},getEvent:function(Q,O){var P=Q||window.event;if(!P){var R=this.getEvent.caller;while(R){P=R.arguments[0];if(P&&Event==P.constructor){break;}R=R.caller;}}if(P&&this.isIE){try{var N=P.srcElement;if(N){var M=N.type;}}catch(L){P.target=O;}}return P;},getCharCode:function(M){var L=M.keyCode||M.charCode||0;if(YAHOO.env.ua.webkit&&(L in D)){L=D[L];}return L;},_getCacheIndex:function(P,Q,O){for(var N=0,M=I.length;N<M;++N){var L=I[N];if(L&&L[this.FN]==O&&L[this.EL]==P&&L[this.TYPE]==Q){return N;}}return -1;},generateId:function(L){var M=L.id;if(!M){M="yuievtautoid-"+A;++A;L.id=M;}return M;},_isValidCollection:function(M){try{return(typeof M!=="string"&&M.length&&!M.tagName&&!M.alert&&typeof M[0]!=="undefined");}catch(L){return false;}},elCache:{},getEl:function(L){return(typeof L==="string")?document.getElementById(L):L;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(M){if(!H){H=true;var L=YAHOO.util.Event;L._ready();L._tryPreloadAttach();}},_ready:function(M){if(!J){J=true;var L=YAHOO.util.Event;L.DOMReadyEvent.fire();L._simpleRemove(document,"DOMContentLoaded",L._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}if(this.isIE){if(!J){this.startInterval();return false;}}this.locked=true;var Q=!H;if(!Q){Q=(C>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var M,L,O,N;for(M=0,L=F.length;M<L;++M){O=F[M];if(O&&!O.checkReady){N=this.getEl(O.id);if(N){R(N,O);F[M]=null;}else{P.push(O);}}}for(M=0,L=F.length;M<L;++M){O=F[M];if(O&&O.checkReady){N=this.getEl(O.id);if(N){if(H||N.nextSibling){R(N,O);F[M]=null;}}else{P.push(O);}}}C=(P.length===0)?0:C-1;if(Q){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(O,P,R){var Q=this.getListeners(O,R),N,L;if(Q){for(N=0,L=Q.length;N<L;++N){var M=Q[N];this.removeListener(O,M.type,M.fn,M.index);}}if(P&&O&&O.childNodes){for(N=0,L=O.childNodes.length;N<L;++N){this.purgeElement(O.childNodes[N],P,R);}}},getListeners:function(N,L){var Q=[],M;if(!L){M=[I,K];}else{if(L=="unload"){M=[K];}else{M=[I];}}for(var P=0;P<M.length;P=P+1){var T=M[P];if(T&&T.length>0){for(var R=0,S=T.length;R<S;++R){var O=T[R];if(O&&O[this.EL]===N&&(!L||L===O[this.TYPE])){Q.push({type:O[this.TYPE],fn:O[this.FN],obj:O[this.OBJ],adjust:O[this.OVERRIDE],scope:O[this.ADJ_SCOPE],index:R});}}}}return(Q.length)?Q:null;},_unload:function(S){var R=YAHOO.util.Event,P,O,M,L,N;for(P=0,L=K.length;P<L;++P){M=K[P];if(M){var Q=window;if(M[R.ADJ_SCOPE]){if(M[R.ADJ_SCOPE]===true){Q=M[R.UNLOAD_OBJ];}else{Q=M[R.ADJ_SCOPE];}}M[R.FN].call(Q,R.getEvent(S,M[R.EL]),M[R.UNLOAD_OBJ]);K[P]=null;M=null;Q=null;}}K=null;if(I&&I.length>0){O=I.length;while(O){N=O-1;M=I[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N);}O=O-1;}M=null;R.clearCache();}for(P=0,L=G.length;P<L;++P){G[P][0]=null;G[P]=null;}G=null;R._simpleRemove(window,"unload",R._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft];}else{if(M){return[M.scrollTop,M.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(N,O,M,L){N.addEventListener(O,M,(L));};}else{if(window.attachEvent){return function(N,O,M,L){N.attachEvent("on"+O,M);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(N,O,M,L){N.removeEventListener(O,M,(L));};}else{if(window.detachEvent){return function(M,N,L){M.detachEvent("on"+N,L);};}else{return function(){};}}}()};}();(function(){var D=YAHOO.util.Event;D.on=D.addListener;if(D.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var B,E=document,A=E.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){B=document.createElement("script");var C=E.getElementsByTagName("head")[0]||A;C.insertBefore(B,C.firstChild);}else{E.write("<script id=\"_yui_eu_dr\" defer=\"true\" src=\"//:\"></script>");B=document.getElementById("_yui_eu_dr");}if(B){B.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{}B=null;}else{if(D.webkit){D._drwatch=setInterval(function(){var F=document.readyState;if("loaded"==F||"complete"==F){clearInterval(D._drwatch);D._drwatch=null;D._ready();}},D.POLL_INTERVAL);}else{D._simpleAdd(document,"DOMContentLoaded",D._ready);}}D._simpleAdd(window,"load",D._load);D._simpleAdd(window,"unload",D._unload);D._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(K,J){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(K.shiftKey==F.shift&&K.altKey==F.alt&&K.ctrlKey==F.ctrl){var H;var G;if(F.keys instanceof Array){for(var I=0;I<F.keys.length;I++){H=F.keys[I];if(H==K.charCode){D.fire(K.charCode,K);break;}else{if(H==K.keyCode){D.fire(K.keyCode,K);break;}}}}else{H=F.keys;if(H==K.charCode){D.fire(K.charCode,K);}else{if(H==K.keyCode){D.fire(K.keyCode,K);}}}}}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.register("event",YAHOO.util.Event,{version:"2.3.1",build:"541"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.3.1", build: "541"});
(function () {
YAHOO.util.Config = function (owner) {
if (owner) {
this.init(owner);
}
if (!owner) {
}
};
var Lang = YAHOO.lang,
CustomEvent = YAHOO.util.CustomEvent,
Config = YAHOO.util.Config;
Config.CONFIG_CHANGED_EVENT = "configChanged";
Config.BOOLEAN_TYPE = "boolean";
Config.prototype = {
owner: null,
queueInProgress: false,
config: null,
initialConfig: null,
eventQueue: null,
configChangedEvent: null,
init: function (owner) {
this.owner = owner;
this.configChangedEvent =
this.createEvent(Config.CONFIG_CHANGED_EVENT);
this.configChangedEvent.signature = CustomEvent.LIST;
this.queueInProgress = false;
this.config = {};
this.initialConfig = {};
this.eventQueue = [];
},
checkBoolean: function (val) {
return (typeof val == Config.BOOLEAN_TYPE);
},
checkNumber: function (val) {
return (!isNaN(val));
},
fireEvent: function ( key, value ) {
var property = this.config[key];
if (property && property.event) {
property.event.fire(value);
}
},
addProperty: function ( key, propertyObject ) {
key = key.toLowerCase();
this.config[key] = propertyObject;
propertyObject.event = this.createEvent(key, { scope: this.owner });
propertyObject.event.signature = CustomEvent.LIST;
propertyObject.key = key;
if (propertyObject.handler) {
propertyObject.event.subscribe(propertyObject.handler,
this.owner);
}
this.setProperty(key, propertyObject.value, true);
if (! propertyObject.suppressEvent) {
this.queueProperty(key, propertyObject.value);
}
},
getConfig: function () {
var cfg = {},
prop,
property;
for (prop in this.config) {
property = this.config[prop];
if (property && property.event) {
cfg[prop] = property.value;
}
}
return cfg;
},
getProperty: function (key) {
var property = this.config[key.toLowerCase()];
if (property && property.event) {
return property.value;
} else {
return undefined;
}
},
resetProperty: function (key) {
key = key.toLowerCase();
var property = this.config[key];
if (property && property.event) {
if (this.initialConfig[key] &&
!Lang.isUndefined(this.initialConfig[key])) {
this.setProperty(key, this.initialConfig[key]);
return true;
}
} else {
return false;
}
},
setProperty: function (key, value, silent) {
var property;
key = key.toLowerCase();
if (this.queueInProgress && ! silent) {
this.queueProperty(key,value);
return true;
} else {
property = this.config[key];
if (property && property.event) {
if (property.validator && !property.validator(value)) {
return false;
} else {
property.value = value;
if (! silent) {
this.fireEvent(key, value);
this.configChangedEvent.fire([key, value]);
}
return true;
}
} else {
return false;
}
}
},
queueProperty: function (key, value) {
key = key.toLowerCase();
var property = this.config[key],
foundDuplicate = false,
iLen,
queueItem,
queueItemKey,
queueItemValue,
sLen,
supercedesCheck,
qLen,
queueItemCheck,
queueItemCheckKey,
queueItemCheckValue,
i,
s,
q;
if (property && property.event) {
if (!Lang.isUndefined(value) && property.validator &&
!property.validator(value)) { // validator
return false;
} else {
if (!Lang.isUndefined(value)) {
property.value = value;
} else {
value = property.value;
}
foundDuplicate = false;
iLen = this.eventQueue.length;
for (i = 0; i < iLen; i++) {
queueItem = this.eventQueue[i];
if (queueItem) {
queueItemKey = queueItem[0];
queueItemValue = queueItem[1];
if (queueItemKey == key) {
this.eventQueue[i] = null;
this.eventQueue.push(
[key, (!Lang.isUndefined(value) ?
value : queueItemValue)]);
foundDuplicate = true;
break;
}
}
}
if (! foundDuplicate && !Lang.isUndefined(value)) {
this.eventQueue.push([key, value]);
}
}
if (property.supercedes) {
sLen = property.supercedes.length;
for (s = 0; s < sLen; s++) {
supercedesCheck = property.supercedes[s];
qLen = this.eventQueue.length;
for (q = 0; q < qLen; q++) {
queueItemCheck = this.eventQueue[q];
if (queueItemCheck) {
queueItemCheckKey = queueItemCheck[0];
queueItemCheckValue = queueItemCheck[1];
if (queueItemCheckKey ==
supercedesCheck.toLowerCase() ) {
this.eventQueue.push([queueItemCheckKey,
queueItemCheckValue]);
this.eventQueue[q] = null;
break;
}
}
}
}
}
return true;
} else {
return false;
}
},
refireEvent: function (key) {
key = key.toLowerCase();
var property = this.config[key];
if (property && property.event &&
!Lang.isUndefined(property.value)) {
if (this.queueInProgress) {
this.queueProperty(key);
} else {
this.fireEvent(key, property.value);
}
}
},
applyConfig: function (userConfig, init) {
var sKey,
oValue,
oConfig;
if (init) {
oConfig = {};
for (sKey in userConfig) {
if (Lang.hasOwnProperty(userConfig, sKey)) {
oConfig[sKey.toLowerCase()] = userConfig[sKey];
}
}
this.initialConfig = oConfig;
}
for (sKey in userConfig) {
if (Lang.hasOwnProperty(userConfig, sKey)) {
this.queueProperty(sKey, userConfig[sKey]);
}
}
},
refresh: function () {
var prop;
for (prop in this.config) {
this.refireEvent(prop);
}
},
fireQueue: function () {
var i,
queueItem,
key,
value,
property;
this.queueInProgress = true;
for (i = 0;i < this.eventQueue.length; i++) {
queueItem = this.eventQueue[i];
if (queueItem) {
key = queueItem[0];
value = queueItem[1];
property = this.config[key];
property.value = value;
this.fireEvent(key,value);
}
}
this.queueInProgress = false;
this.eventQueue = [];
},
subscribeToConfigEvent: function (key, handler, obj, override) {
var property = this.config[key.toLowerCase()];
if (property && property.event) {
if (!Config.alreadySubscribed(property.event, handler, obj)) {
property.event.subscribe(handler, obj, override);
}
return true;
} else {
return false;
}
},
unsubscribeFromConfigEvent: function (key, handler, obj) {
var property = this.config[key.toLowerCase()];
if (property && property.event) {
return property.event.unsubscribe(handler, obj);
} else {
return false;
}
},
toString: function () {
var output = "Config";
if (this.owner) {
output += " [" + this.owner.toString() + "]";
}
return output;
},
outputEventQueue: function () {
var output = "",
queueItem,
q,
nQueue = this.eventQueue.length;
for (q = 0; q < nQueue; q++) {
queueItem = this.eventQueue[q];
if (queueItem) {
output += queueItem[0] + "=" + queueItem[1] + ", ";
}
}
return output;
},
destroy: function () {
var oConfig = this.config,
sProperty,
oProperty;
for (sProperty in oConfig) {
if (Lang.hasOwnProperty(oConfig, sProperty)) {
oProperty = oConfig[sProperty];
oProperty.event.unsubscribeAll();
oProperty.event = null;
}
}
this.configChangedEvent.unsubscribeAll();
this.configChangedEvent = null;
this.owner = null;
this.config = null;
this.initialConfig = null;
this.eventQueue = null;
}
};
Config.alreadySubscribed = function (evt, fn, obj) {
var nSubscribers = evt.subscribers.length,
subsc,
i;
if (nSubscribers > 0) {
i = nSubscribers - 1;
do {
subsc = evt.subscribers[i];
if (subsc && subsc.obj == obj && subsc.fn == fn) {
return true;
}
}
while (i--);
}
return false;
};
YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
}());
YAHOO.widget.DateMath = {
DAY : "D",
WEEK : "W",
YEAR : "Y",
MONTH : "M",
ONE_DAY_MS : 1000*60*60*24,
add : function(date, field, amount) {
var d = new Date(date.getTime());
switch (field) {
case this.MONTH:
var newMonth = date.getMonth() + amount;
var years = 0;
if (newMonth < 0) {
while (newMonth < 0) {
newMonth += 12;
years -= 1;
}
} else if (newMonth > 11) {
while (newMonth > 11) {
newMonth -= 12;
years += 1;
}
}
d.setMonth(newMonth);
d.setFullYear(date.getFullYear() + years);
break;
case this.DAY:
d.setDate(date.getDate() + amount);
break;
case this.YEAR:
d.setFullYear(date.getFullYear() + amount);
break;
case this.WEEK:
d.setDate(date.getDate() + (amount * 7));
break;
}
return d;
},
subtract : function(date, field, amount) {
return this.add(date, field, (amount*-1));
},
before : function(date, compareTo) {
var ms = compareTo.getTime();
if (date.getTime() < ms) {
return true;
} else {
return false;
}
},
after : function(date, compareTo) {
var ms = compareTo.getTime();
if (date.getTime() > ms) {
return true;
} else {
return false;
}
},
between : function(date, dateBegin, dateEnd) {
if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
return true;
} else {
return false;
}
},
getJan1 : function(calendarYear) {
return new Date(calendarYear,0,1);
},
getDayOffset : function(date, calendarYear) {
var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
return dayOffset;
},
getWeekNumber : function(date, calendarYear) {
date = this.clearTime(date);
var nearestThurs = new Date(date.getTime() + (4 * this.ONE_DAY_MS) - ((date.getDay()) * this.ONE_DAY_MS));
var jan1 = new Date(nearestThurs.getFullYear(),0,1);
var dayOfYear = ((nearestThurs.getTime() - jan1.getTime()) / this.ONE_DAY_MS) - 1;
var weekNum = Math.ceil((dayOfYear)/ 7);
return weekNum;
},
isYearOverlapWeek : function(weekBeginDate) {
var overlaps = false;
var nextWeek = this.add(weekBeginDate, this.DAY, 6);
if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
overlaps = true;
}
return overlaps;
},
isMonthOverlapWeek : function(weekBeginDate) {
var overlaps = false;
var nextWeek = this.add(weekBeginDate, this.DAY, 6);
if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
overlaps = true;
}
return overlaps;
},
findMonthStart : function(date) {
var start = new Date(date.getFullYear(), date.getMonth(), 1);
return start;
},
findMonthEnd : function(date) {
var start = this.findMonthStart(date);
var nextMonth = this.add(start, this.MONTH, 1);
var end = this.subtract(nextMonth, this.DAY, 1);
return end;
},
clearTime : function(date) {
date.setHours(12,0,0,0);
return date;
}
};
YAHOO.widget.Calendar = function(id, containerId, config) {
this.init(id, containerId, config);
};
YAHOO.widget.Calendar.IMG_ROOT = null;
YAHOO.widget.Calendar.DATE = "D";
YAHOO.widget.Calendar.MONTH_DAY = "MD";
YAHOO.widget.Calendar.WEEKDAY = "WD";
YAHOO.widget.Calendar.RANGE = "R";
YAHOO.widget.Calendar.MONTH = "M";
YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
YAHOO.widget.Calendar.STOP_RENDER = "S";
YAHOO.widget.Calendar.SHORT = "short";
YAHOO.widget.Calendar.LONG = "long";
YAHOO.widget.Calendar.MEDIUM = "medium";
YAHOO.widget.Calendar.ONE_CHAR = "1char";
YAHOO.widget.Calendar._DEFAULT_CONFIG = {
PAGEDATE : {key:"pagedate", value:null},
SELECTED : {key:"selected", value:null},
TITLE : {key:"title", value:""},
CLOSE : {key:"close", value:false},
IFRAME : {key:"iframe", value:(YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) ? true : false},
MINDATE : {key:"mindate", value:null},
MAXDATE : {key:"maxdate", value:null},
MULTI_SELECT : {key:"multi_select", value:false},
START_WEEKDAY : {key:"start_weekday", value:0},
SHOW_WEEKDAYS : {key:"show_weekdays", value:true},
SHOW_WEEK_HEADER : {key:"show_week_header", value:false},
SHOW_WEEK_FOOTER : {key:"show_week_footer", value:false},
HIDE_BLANK_WEEKS : {key:"hide_blank_weeks", value:false},
NAV_ARROW_LEFT: {key:"nav_arrow_left", value:null} ,
NAV_ARROW_RIGHT : {key:"nav_arrow_right", value:null} ,
MONTHS_SHORT : {key:"months_short", value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
MONTHS_LONG: {key:"months_long", value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]},
WEEKDAYS_1CHAR: {key:"weekdays_1char", value:["S", "M", "T", "W", "T", "F", "S"]},
WEEKDAYS_SHORT: {key:"weekdays_short", value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]},
WEEKDAYS_MEDIUM: {key:"weekdays_medium", value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]},
WEEKDAYS_LONG: {key:"weekdays_long", value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]},
LOCALE_MONTHS:{key:"locale_months", value:"long"},
LOCALE_WEEKDAYS:{key:"locale_weekdays", value:"short"},
DATE_DELIMITER:{key:"date_delimiter", value:","},
DATE_FIELD_DELIMITER:{key:"date_field_delimiter", value:"/"},
DATE_RANGE_DELIMITER:{key:"date_range_delimiter", value:"-"},
MY_MONTH_POSITION:{key:"my_month_position", value:1},
MY_YEAR_POSITION:{key:"my_year_position", value:2},
MD_MONTH_POSITION:{key:"md_month_position", value:1},
MD_DAY_POSITION:{key:"md_day_position", value:2},
MDY_MONTH_POSITION:{key:"mdy_month_position", value:1},
MDY_DAY_POSITION:{key:"mdy_day_position", value:2},
MDY_YEAR_POSITION:{key:"mdy_year_position", value:3},
MY_LABEL_MONTH_POSITION:{key:"my_label_month_position", value:1},
MY_LABEL_YEAR_POSITION:{key:"my_label_year_position", value:2},
MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix", value:" "},
MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix", value:""}
};
YAHOO.widget.Calendar._EVENT_TYPES = {
BEFORE_SELECT : "beforeSelect",
SELECT : "select",
BEFORE_DESELECT : "beforeDeselect",
DESELECT : "deselect",
CHANGE_PAGE : "changePage",
BEFORE_RENDER : "beforeRender",
RENDER : "render",
RESET : "reset",
CLEAR : "clear"
};
YAHOO.widget.Calendar._STYLES = {
CSS_ROW_HEADER: "calrowhead",
CSS_ROW_FOOTER: "calrowfoot",
CSS_CELL : "calcell",
CSS_CELL_SELECTOR : "selector",
CSS_CELL_SELECTED : "selected",
CSS_CELL_SELECTABLE : "selectable",
CSS_CELL_RESTRICTED : "restricted",
CSS_CELL_TODAY : "today",
CSS_CELL_OOM : "oom",
CSS_CELL_OOB : "previous",
CSS_HEADER : "calheader",
CSS_HEADER_TEXT : "calhead",
CSS_BODY : "calbody",
CSS_WEEKDAY_CELL : "calweekdaycell",
CSS_WEEKDAY_ROW : "calweekdayrow",
CSS_FOOTER : "calfoot",
CSS_CALENDAR : "yui-calendar",
CSS_SINGLE : "single",
CSS_CONTAINER : "yui-calcontainer",
CSS_NAV_LEFT : "calnavleft",
CSS_NAV_RIGHT : "calnavright",
CSS_CLOSE : "calclose",
CSS_CELL_TOP : "calcelltop",
CSS_CELL_LEFT : "calcellleft",
CSS_CELL_RIGHT : "calcellright",
CSS_CELL_BOTTOM : "calcellbottom",
CSS_CELL_HOVER : "calcellhover",
CSS_CELL_HIGHLIGHT1 : "highlight1",
CSS_CELL_HIGHLIGHT2 : "highlight2",
CSS_CELL_HIGHLIGHT3 : "highlight3",
CSS_CELL_HIGHLIGHT4 : "highlight4"
};
YAHOO.widget.Calendar.prototype = {
Config : null,
parent : null,
index : -1,
cells : null,
cellDates : null,
id : null,
oDomContainer : null,
today : null,
renderStack : null,
_renderStack : null,
_selectedDates : null,
domEventMap : null
};
YAHOO.widget.Calendar.prototype.init = function(id, containerId, config) {
this.initEvents();
this.today = new Date();
YAHOO.widget.DateMath.clearTime(this.today);
this.id = id;
this.oDomContainer = document.getElementById(containerId);
this.cfg = new YAHOO.util.Config(this);
this.Options = {};
this.Locale = {};
this.initStyles();
YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
this.cellDates = [];
this.cells = [];
this.renderStack = [];
this._renderStack = [];
this.setupConfig();
if (config) {
this.cfg.applyConfig(config, true);
}
this.cfg.fireQueue();
};
YAHOO.widget.Calendar.prototype.configIframe = function(type, args, obj) {
var useIframe = args[0];
if (!this.parent) {
if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
if (useIframe) {
var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
if (pos == "absolute" || pos == "relative") {
if (!YAHOO.util.Dom.inDocument(this.iframe)) {
this.iframe = document.createElement("iframe");
this.iframe.src = "javascript:false;";
YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
YAHOO.util.Dom.addClass(this.iframe, "fixedsize");
}
this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
}
}
} else {
if (this.iframe) {
if (this.iframe.parentNode) {
this.iframe.parentNode.removeChild(this.iframe);
}
this.iframe = null;
}
}
}
}
};
YAHOO.widget.Calendar.prototype.configTitle = function(type, args, obj) {
var title = args[0], tDiv;
if (title) {
this.createTitleBar(title);
} else {
var close = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);
if (!close) {
this.removeTitleBar();
} else {
this.createTitleBar("&#160;");
}
}
};
YAHOO.widget.Calendar.prototype.configClose = function(type, args, obj) {
var close = args[0],
title = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);
if (close) {
if (!title) {
this.createTitleBar("&#160;");
}
this.createCloseButton();
} else {
this.removeCloseButton();
if (!title) {
this.removeTitleBar();
}
}
};
YAHOO.widget.Calendar.prototype.initEvents = function() {
var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
this.selectEvent.subscribe(this.onSelect, this, true);
this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
this.deselectEvent.subscribe(this.onDeselect, this, true);
this.changePageEvent.subscribe(this.onChangePage, this, true);
this.renderEvent.subscribe(this.onRender, this, true);
this.resetEvent.subscribe(this.onReset, this, true);
this.clearEvent.subscribe(this.onClear, this, true);
};
YAHOO.widget.Calendar.prototype.doSelectCell = function(e, cal) {
var cell,index,d,date;
var target = YAHOO.util.Event.getTarget(e);
var tagName = target.tagName.toLowerCase();
var defSelector = false;
while (tagName != "td" && ! YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
if (!defSelector && tagName == "a" && YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
defSelector = true;
}
target = target.parentNode;
tagName = target.tagName.toLowerCase();
if (tagName == "html") {
return;
}
}
if (defSelector) {
YAHOO.util.Event.preventDefault(e);
}
cell = target;
if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
index = cell.id.split("cell")[1];
d = cal.cellDates[index];
date = new Date(d[0],d[1]-1,d[2]);
var link;
if (cal.Options.MULTI_SELECT) {
link = cell.getElementsByTagName("a")[0];
if (link) {
link.blur();
}
var cellDate = cal.cellDates[index];
var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
if (cellDateIndex > -1) {
cal.deselectCell(index);
} else {
cal.selectCell(index);
}
} else {
link = cell.getElementsByTagName("a")[0];
if (link) {
link.blur();
}
cal.selectCell(index);
}
}
};
YAHOO.widget.Calendar.prototype.doCellMouseOver = function(e, cal) {
var target;
if (e) {
target = YAHOO.util.Event.getTarget(e);
} else {
target = this;
}
while (target.tagName.toLowerCase() != "td") {
target = target.parentNode;
if (target.tagName.toLowerCase() == "html") {
return;
}
}
if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
}
};
YAHOO.widget.Calendar.prototype.doCellMouseOut = function(e, cal) {
var target;
if (e) {
target = YAHOO.util.Event.getTarget(e);
} else {
target = this;
}
while (target.tagName.toLowerCase() != "td") {
target = target.parentNode;
if (target.tagName.toLowerCase() == "html") {
return;
}
}
if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
}
};
YAHOO.widget.Calendar.prototype.setupConfig = function() {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
this.cfg.addProperty(defCfg.PAGEDATE.key, { value:new Date(), handler:this.configPageDate } );
this.cfg.addProperty(defCfg.SELECTED.key, { value:[], handler:this.configSelected } );
this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.configMinDate } );
this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.configMaxDate } );
this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.configOptions, validator:this.cfg.checkNumber  } );
this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:this.cfg.checkBoolean  } );
this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key, { value:defCfg.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key, { value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.configOptions } );
this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key, { value:defCfg.NAV_ARROW_RIGHT.value, handler:this.configOptions } );
this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.configLocale } );
var refreshLocale = function() {
this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
};
this.cfg.subscribeToConfigEvent(defCfg.START_WEEKDAY.key, refreshLocale, this, true);
this.cfg.subscribeToConfigEvent(defCfg.MONTHS_SHORT.key, refreshLocale, this, true);
this.cfg.subscribeToConfigEvent(defCfg.MONTHS_LONG.key, refreshLocale, this, true);
this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_SHORT.key, refreshLocale, this, true);
this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_LONG.key, refreshLocale, this, true);
this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.configLocaleValues } );
this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key, { value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key, { value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,	{ value:defCfg.MY_LABEL_MONTH_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,	{ value:defCfg.MY_LABEL_YEAR_POSITION.value, handler:this.configLocale, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,	{ value:defCfg.MY_LABEL_MONTH_SUFFIX.value, handler:this.configLocale } );
this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, { value:defCfg.MY_LABEL_YEAR_SUFFIX.value, handler:this.configLocale } );
};
YAHOO.widget.Calendar.prototype.configPageDate = function(type, args, obj) {
this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key, this._parsePageDate(args[0]), true);
};
YAHOO.widget.Calendar.prototype.configMinDate = function(type, args, obj) {
var val = args[0];
if (YAHOO.lang.isString(val)) {
val = this._parseDate(val);
this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key, new Date(val[0],(val[1]-1),val[2]));
}
};
YAHOO.widget.Calendar.prototype.configMaxDate = function(type, args, obj) {
var val = args[0];
if (YAHOO.lang.isString(val)) {
val = this._parseDate(val);
this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key, new Date(val[0],(val[1]-1),val[2]));
}
};
YAHOO.widget.Calendar.prototype.configSelected = function(type, args, obj) {
var selected = args[0];
var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
if (selected) {
if (YAHOO.lang.isString(selected)) {
this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
}
}
if (! this._selectedDates) {
this._selectedDates = this.cfg.getProperty(cfgSelected);
}
};
YAHOO.widget.Calendar.prototype.configOptions = function(type, args, obj) {
this.Options[type.toUpperCase()] = args[0];
};
YAHOO.widget.Calendar.prototype.configLocale = function(type, args, obj) {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
this.Locale[type.toUpperCase()] = args[0];
this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
};
YAHOO.widget.Calendar.prototype.configLocaleValues = function(type, args, obj) {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
type = type.toLowerCase();
var val = args[0];
switch (type) {
case defCfg.LOCALE_MONTHS.key:
switch (val) {
case YAHOO.widget.Calendar.SHORT:
this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_SHORT.key).concat();
break;
case YAHOO.widget.Calendar.LONG:
this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_LONG.key).concat();
break;
}
break;
case defCfg.LOCALE_WEEKDAYS.key:
switch (val) {
case YAHOO.widget.Calendar.ONE_CHAR:
this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_1CHAR.key).concat();
break;
case YAHOO.widget.Calendar.SHORT:
this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_SHORT.key).concat();
break;
case YAHOO.widget.Calendar.MEDIUM:
this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_MEDIUM.key).concat();
break;
case YAHOO.widget.Calendar.LONG:
this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_LONG.key).concat();
break;
}
var START_WEEKDAY = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
if (START_WEEKDAY > 0) {
for (var w=0;w<START_WEEKDAY;++w) {
this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());
}
}
break;
}
};
YAHOO.widget.Calendar.prototype.initStyles = function() {
var defStyle = YAHOO.widget.Calendar._STYLES;
this.Style = {
CSS_ROW_HEADER: defStyle.CSS_ROW_HEADER,
CSS_ROW_FOOTER: defStyle.CSS_ROW_FOOTER,
CSS_CELL : defStyle.CSS_CELL,
CSS_CELL_SELECTOR : defStyle.CSS_CELL_SELECTOR,
CSS_CELL_SELECTED : defStyle.CSS_CELL_SELECTED,
CSS_CELL_SELECTABLE : defStyle.CSS_CELL_SELECTABLE,
CSS_CELL_RESTRICTED : defStyle.CSS_CELL_RESTRICTED,
CSS_CELL_TODAY : defStyle.CSS_CELL_TODAY,
CSS_CELL_OOM : defStyle.CSS_CELL_OOM,
CSS_CELL_OOB : defStyle.CSS_CELL_OOB,
CSS_HEADER : defStyle.CSS_HEADER,
CSS_HEADER_TEXT : defStyle.CSS_HEADER_TEXT,
CSS_BODY : defStyle.CSS_BODY,
CSS_WEEKDAY_CELL : defStyle.CSS_WEEKDAY_CELL,
CSS_WEEKDAY_ROW : defStyle.CSS_WEEKDAY_ROW,
CSS_FOOTER : defStyle.CSS_FOOTER,
CSS_CALENDAR : defStyle.CSS_CALENDAR,
CSS_SINGLE : defStyle.CSS_SINGLE,
CSS_CONTAINER : defStyle.CSS_CONTAINER,
CSS_NAV_LEFT : defStyle.CSS_NAV_LEFT,
CSS_NAV_RIGHT : defStyle.CSS_NAV_RIGHT,
CSS_CLOSE : defStyle.CSS_CLOSE,
CSS_CELL_TOP : defStyle.CSS_CELL_TOP,
CSS_CELL_LEFT : defStyle.CSS_CELL_LEFT,
CSS_CELL_RIGHT : defStyle.CSS_CELL_RIGHT,
CSS_CELL_BOTTOM : defStyle.CSS_CELL_BOTTOM,
CSS_CELL_HOVER : defStyle.CSS_CELL_HOVER,
CSS_CELL_HIGHLIGHT1 : defStyle.CSS_CELL_HIGHLIGHT1,
CSS_CELL_HIGHLIGHT2 : defStyle.CSS_CELL_HIGHLIGHT2,
CSS_CELL_HIGHLIGHT3 : defStyle.CSS_CELL_HIGHLIGHT3,
CSS_CELL_HIGHLIGHT4 : defStyle.CSS_CELL_HIGHLIGHT4
};
};
YAHOO.widget.Calendar.prototype.buildMonthLabel = function() {
var pageDate = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
var monthLabel  = this.Locale.LOCALE_MONTHS[pageDate.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX;
var yearLabel = pageDate.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
if (this.Locale.MY_LABEL_MONTH_POSITION == 2 || this.Locale.MY_LABEL_YEAR_POSITION == 1) {
return yearLabel + monthLabel;
} else {
return monthLabel + yearLabel;
}
};
YAHOO.widget.Calendar.prototype.buildDayLabel = function(workingDate) {
return workingDate.getDate();
};
YAHOO.widget.Calendar.prototype.createTitleBar = function(strTitle) {
var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
tDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
tDiv.innerHTML = strTitle;
this.oDomContainer.insertBefore(tDiv, this.oDomContainer.firstChild);
YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
return tDiv;
};
YAHOO.widget.Calendar.prototype.removeTitleBar = function() {
var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
if (tDiv) {
YAHOO.util.Event.purgeElement(tDiv);
this.oDomContainer.removeChild(tDiv);
}
YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
};
YAHOO.widget.Calendar.prototype.createCloseButton = function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
DEPR_CLOSE_PATH = "us/my/bn/x_d.gif";
var lnk = Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0];
if (!lnk) {
lnk = document.createElement("a");
Event.addListener(lnk, "click", function(e, cal) {
cal.hide();
Event.preventDefault(e);
}, this);
}
lnk.href = "#";
lnk.className = "link-close";
if (YAHOO.widget.Calendar.IMG_ROOT !== null) {
var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
img.src = YAHOO.widget.Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
img.className = cssClose;
lnk.appendChild(img);
} else {
lnk.innerHTML = '<span class="' + cssClose + ' ' + this.Style.CSS_CLOSE + '"></span>';
}
this.oDomContainer.appendChild(lnk);
return lnk;
};
YAHOO.widget.Calendar.prototype.removeCloseButton = function() {
var btn = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
if (btn) {
YAHOO.util.Event.purgeElement(btn);
this.oDomContainer.removeChild(btn);
}
};
YAHOO.widget.Calendar.prototype.renderHeader = function(html) {
var colSpan = 7;
var DEPR_NAV_LEFT = "us/tr/callt.gif";
var DEPR_NAV_RIGHT = "us/tr/calrt.gif";
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
colSpan += 1;
}
if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
colSpan += 1;
}
html[html.length] = "<thead>";
html[html.length] =		"<tr>";
html[html.length] =			'<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
html[html.length] =				'<div class="' + this.Style.CSS_HEADER + '">';
var renderLeft, renderRight = false;
if (this.parent) {
if (this.index === 0) {
renderLeft = true;
}
if (this.index == (this.parent.cfg.getProperty("pages") -1)) {
renderRight = true;
}
} else {
renderLeft = true;
renderRight = true;
}
var cal = this.parent || this;
if (renderLeft) {
var leftArrow = this.cfg.getProperty(defCfg.NAV_ARROW_LEFT.key);
if (leftArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
leftArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_LEFT;
}
var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + ' >&#160;</a>';
}
html[html.length] = this.buildMonthLabel();
if (renderRight) {
var rightArrow = this.cfg.getProperty(defCfg.NAV_ARROW_RIGHT.key);
if (rightArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
rightArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
}
var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + ' >&#160;</a>';
}
html[html.length] =	'</div>\n</th>\n</tr>';
if (this.cfg.getProperty(defCfg.SHOW_WEEKDAYS.key)) {
html = this.buildWeekdays(html);
}
html[html.length] = '</thead>';
return html;
};
YAHOO.widget.Calendar.prototype.buildWeekdays = function(html) {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
html[html.length] = '<tr class="' + this.Style.CSS_WEEKDAY_ROW + '">';
if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
html[html.length] = '<th>&#160;</th>';
}
for(var i=0;i<this.Locale.LOCALE_WEEKDAYS.length;++i) {
html[html.length] = '<th class="calweekdaycell">' + this.Locale.LOCALE_WEEKDAYS[i] + '</th>';
}
if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
html[html.length] = '<th>&#160;</th>';
}
html[html.length] = '</tr>';
return html;
};
YAHOO.widget.Calendar.prototype.renderBody = function(workingDate, html) {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
var startDay = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
this.preMonthDays = workingDate.getDay();
if (startDay > 0) {
this.preMonthDays -= startDay;
}
if (this.preMonthDays < 0) {
this.preMonthDays += 7;
}
this.monthDays = YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();
this.postMonthDays = YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
workingDate = YAHOO.widget.DateMath.subtract(workingDate, YAHOO.widget.DateMath.DAY, this.preMonthDays);
var weekNum,weekClass;
var weekPrefix = "w";
var cellPrefix = "_cell";
var workingDayPrefix = "wd";
var dayPrefix = "d";
var cellRenderers;
var renderer;
var todayYear = this.today.getFullYear();
var todayMonth = this.today.getMonth();
var todayDate = this.today.getDate();
var useDate = this.cfg.getProperty(defCfg.PAGEDATE.key);
var hideBlankWeeks = this.cfg.getProperty(defCfg.HIDE_BLANK_WEEKS.key);
var showWeekFooter = this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key);
var showWeekHeader = this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key);
var mindate = this.cfg.getProperty(defCfg.MINDATE.key);
var maxdate = this.cfg.getProperty(defCfg.MAXDATE.key);
if (mindate) {
mindate = YAHOO.widget.DateMath.clearTime(mindate);
}
if (maxdate) {
maxdate = YAHOO.widget.DateMath.clearTime(maxdate);
}
html[html.length] = '<tbody class="m' + (useDate.getMonth()+1) + ' ' + this.Style.CSS_BODY + '">';
var i = 0;
var tempDiv = document.createElement("div");
var cell = document.createElement("td");
tempDiv.appendChild(cell);
var jan1 = new Date(useDate.getFullYear(),0,1);
var cal = this.parent || this;
for (var r=0;r<6;r++) {
weekNum = YAHOO.widget.DateMath.getWeekNumber(workingDate, useDate.getFullYear(), startDay);
weekClass = weekPrefix + weekNum;
if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth()) {
break;
} else {
html[html.length] = '<tr class="' + weekClass + '">';
if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
for (var d=0;d<7;d++){ // Render actual days
cellRenderers = [];
renderer = null;
this.clearElement(cell);
cell.className = this.Style.CSS_CELL;
cell.id = this.id + cellPrefix + i;
if (workingDate.getDate()		== todayDate &&
workingDate.getMonth()		== todayMonth &&
workingDate.getFullYear()	== todayYear) {
cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
}
var workingArray = [workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];
this.cellDates[this.cellDates.length] = workingArray; // Add this date to cellDates
if (workingDate.getMonth() != useDate.getMonth()) {
cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
} else {
YAHOO.util.Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
YAHOO.util.Dom.addClass(cell, dayPrefix + workingDate.getDate());
for (var s=0;s<this.renderStack.length;++s) {
var rArray = this.renderStack[s];
var type = rArray[0];
var month;
var day;
var year;
switch (type) {
case YAHOO.widget.Calendar.DATE:
month = rArray[1][1];
day = rArray[1][2];
year = rArray[1][0];
if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
renderer = rArray[2];
this.renderStack.splice(s,1);
}
break;
case YAHOO.widget.Calendar.MONTH_DAY:
month = rArray[1][0];
day = rArray[1][1];
if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {
renderer = rArray[2];
this.renderStack.splice(s,1);
}
break;
case YAHOO.widget.Calendar.RANGE:
var date1 = rArray[1][0];
var date2 = rArray[1][1];
var d1month = date1[1];
var d1day = date1[2];
var d1year = date1[0];
var d1 = new Date(d1year, d1month-1, d1day);
var d2month = date2[1];
var d2day = date2[2];
var d2year = date2[0];
var d2 = new Date(d2year, d2month-1, d2day);
if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
renderer = rArray[2];
if (workingDate.getTime()==d2.getTime()) {
this.renderStack.splice(s,1);
}
}
break;
case YAHOO.widget.Calendar.WEEKDAY:
var weekday = rArray[1][0];
if (workingDate.getDay()+1 == weekday) {
renderer = rArray[2];
}
break;
case YAHOO.widget.Calendar.MONTH:
month = rArray[1][0];
if (workingDate.getMonth()+1 == month) {
renderer = rArray[2];
}
break;
}
if (renderer) {
cellRenderers[cellRenderers.length]=renderer;
}
}
}
if (this._indexOfSelectedFieldArray(workingArray) > -1) {
cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;
}
if ((mindate && (workingDate.getTime() < mindate.getTime())) ||
(maxdate && (workingDate.getTime() > maxdate.getTime()))
) {
cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
} else {
cellRenderers[cellRenderers.length]=cal.styleCellDefault;
cellRenderers[cellRenderers.length]=cal.renderCellDefault;
}
for (var x=0; x < cellRenderers.length; ++x) {
if (cellRenderers[x].call(cal, workingDate, cell) == YAHOO.widget.Calendar.STOP_RENDER) {
break;
}
}
workingDate.setTime(workingDate.getTime() + YAHOO.widget.DateMath.ONE_DAY_MS);
if (i >= 0 && i <= 6) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TOP);
}
if ((i % 7) === 0) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
}
if (((i+1) % 7) === 0) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
}
var postDays = this.postMonthDays;
if (hideBlankWeeks && postDays >= 7) {
var blankWeeks = Math.floor(postDays/7);
for (var p=0;p<blankWeeks;++p) {
postDays -= 7;
}
}
if (i >= ((this.preMonthDays+postDays+this.monthDays)-7)) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
}
html[html.length] = tempDiv.innerHTML;
i++;
}
if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
html[html.length] = '</tr>';
}
}
html[html.length] = '</tbody>';
return html;
};
YAHOO.widget.Calendar.prototype.renderFooter = function(html) { return html; };
YAHOO.widget.Calendar.prototype.render = function() {
this.beforeRenderEvent.fire();
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(defCfg.PAGEDATE.key));
this.resetRenderers();
this.cellDates.length = 0;
YAHOO.util.Event.purgeElement(this.oDomContainer, true);
var html = [];
html[html.length] = '<table cellSpacing="0" class="' + this.Style.CSS_CALENDAR + ' y' + workingDate.getFullYear() + '" id="' + this.id + '">';
html = this.renderHeader(html);
html = this.renderBody(workingDate, html);
html = this.renderFooter(html);
html[html.length] = '</table>';
this.oDomContainer.innerHTML = html.join("\n");
this.applyListeners();
this.cells = this.oDomContainer.getElementsByTagName("td");
this.cfg.refireEvent(defCfg.TITLE.key);
this.cfg.refireEvent(defCfg.CLOSE.key);
this.cfg.refireEvent(defCfg.IFRAME.key);
this.renderEvent.fire();
};
YAHOO.widget.Calendar.prototype.applyListeners = function() {
var root = this.oDomContainer;
var cal = this.parent || this;
var anchor = "a";
var mousedown = "mousedown";
var linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root);
var linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
if (linkLeft && linkLeft.length > 0) {
this.linkLeft = linkLeft[0];
YAHOO.util.Event.addListener(this.linkLeft, mousedown, cal.previousMonth, cal, true);
}
if (linkRight && linkRight.length > 0) {
this.linkRight = linkRight[0];
YAHOO.util.Event.addListener(this.linkRight, mousedown, cal.nextMonth, cal, true);
}
if (this.domEventMap) {
var el,elements;
for (var cls in this.domEventMap) {
if (YAHOO.lang.hasOwnProperty(this.domEventMap, cls)) {
var items = this.domEventMap[cls];
if (! (items instanceof Array)) {
items = [items];
}
for (var i=0;i<items.length;i++)	{
var item = items[i];
elements = YAHOO.util.Dom.getElementsByClassName(cls, item.tag, this.oDomContainer);
for (var c=0;c<elements.length;c++) {
el = elements[c];
YAHOO.util.Event.addListener(el, item.event, item.handler, item.scope, item.correct );
}
}
}
}
}
YAHOO.util.Event.addListener(this.oDomContainer, "click", this.doSelectCell, this);
YAHOO.util.Event.addListener(this.oDomContainer, "mouseover", this.doCellMouseOver, this);
YAHOO.util.Event.addListener(this.oDomContainer, "mouseout", this.doCellMouseOut, this);
};
YAHOO.widget.Calendar.prototype.getDateByCellId = function(id) {
var date = this.getDateFieldsByCellId(id);
return new Date(date[0],date[1]-1,date[2]);
};
YAHOO.widget.Calendar.prototype.getDateFieldsByCellId = function(id) {
id = id.toLowerCase().split("_cell")[1];
id = parseInt(id, 10);
return this.cellDates[id];
};
YAHOO.widget.Calendar.prototype.renderOutOfBoundsDate = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);
cell.innerHTML = workingDate.getDate();
return YAHOO.widget.Calendar.STOP_RENDER;
};
YAHOO.widget.Calendar.prototype.renderRowHeader = function(weekNum, html) {
html[html.length] = '<th class="calrowhead">' + weekNum + '</th>';
return html;
};
YAHOO.widget.Calendar.prototype.renderRowFooter = function(weekNum, html) {
html[html.length] = '<th class="calrowfoot">' + weekNum + '</th>';
return html;
};
YAHOO.widget.Calendar.prototype.renderCellDefault = function(workingDate, cell) {
cell.innerHTML = '<a href="#" class="' + this.Style.CSS_CELL_SELECTOR + '">' + this.buildDayLabel(workingDate) + "</a>";
};
YAHOO.widget.Calendar.prototype.styleCellDefault = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
};
YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1 = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
};
YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2 = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
};
YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3 = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
};
YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4 = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
};
YAHOO.widget.Calendar.prototype.renderCellStyleToday = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
};
YAHOO.widget.Calendar.prototype.renderCellStyleSelected = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
};
YAHOO.widget.Calendar.prototype.renderCellNotThisMonth = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
cell.innerHTML=workingDate.getDate();
return YAHOO.widget.Calendar.STOP_RENDER;
};
YAHOO.widget.Calendar.prototype.renderBodyCellRestricted = function(workingDate, cell) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
cell.innerHTML=workingDate.getDate();
return YAHOO.widget.Calendar.STOP_RENDER;
};
YAHOO.widget.Calendar.prototype.addMonths = function(count) {
var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
this.resetRenderers();
this.changePageEvent.fire();
};
YAHOO.widget.Calendar.prototype.subtractMonths = function(count) {
var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
this.resetRenderers();
this.changePageEvent.fire();
};
YAHOO.widget.Calendar.prototype.addYears = function(count) {
var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
this.resetRenderers();
this.changePageEvent.fire();
};
YAHOO.widget.Calendar.prototype.subtractYears = function(count) {
var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
this.resetRenderers();
this.changePageEvent.fire();
};
YAHOO.widget.Calendar.prototype.nextMonth = function() {
this.addMonths(1);
};
YAHOO.widget.Calendar.prototype.previousMonth = function() {
this.subtractMonths(1);
};
YAHOO.widget.Calendar.prototype.nextYear = function() {
this.addYears(1);
};
YAHOO.widget.Calendar.prototype.previousYear = function() {
this.subtractYears(1);
};
YAHOO.widget.Calendar.prototype.reset = function() {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
this.cfg.resetProperty(defCfg.SELECTED.key);
this.cfg.resetProperty(defCfg.PAGEDATE.key);
this.resetEvent.fire();
};
YAHOO.widget.Calendar.prototype.clear = function() {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
this.cfg.setProperty(defCfg.SELECTED.key, []);
this.cfg.setProperty(defCfg.PAGEDATE.key, new Date(this.today.getTime()));
this.clearEvent.fire();
};
YAHOO.widget.Calendar.prototype.select = function(date) {
var aToBeSelected = this._toFieldArray(date);
var validDates = [];
var selected = [];
var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
for (var a=0; a < aToBeSelected.length; ++a) {
var toSelect = aToBeSelected[a];
if (!this.isDateOOB(this._toDate(toSelect))) {
if (validDates.length === 0) {
this.beforeSelectEvent.fire();
selected = this.cfg.getProperty(cfgSelected);
}
validDates.push(toSelect);
if (this._indexOfSelectedFieldArray(toSelect) == -1) {
selected[selected.length] = toSelect;
}
}
}
if (validDates.length > 0) {
if (this.parent) {
this.parent.cfg.setProperty(cfgSelected, selected);
} else {
this.cfg.setProperty(cfgSelected, selected);
}
this.selectEvent.fire(validDates);
}
return this.getSelectedDates();
};
YAHOO.widget.Calendar.prototype.selectCell = function(cellIndex) {
var cell = this.cells[cellIndex];
var cellDate = this.cellDates[cellIndex];
var dCellDate = this._toDate(cellDate);
var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
if (selectable) {
this.beforeSelectEvent.fire();
var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
var selected = this.cfg.getProperty(cfgSelected);
var selectDate = cellDate.concat();
if (this._indexOfSelectedFieldArray(selectDate) == -1) {
selected[selected.length] = selectDate;
}
if (this.parent) {
this.parent.cfg.setProperty(cfgSelected, selected);
} else {
this.cfg.setProperty(cfgSelected, selected);
}
this.renderCellStyleSelected(dCellDate,cell);
this.selectEvent.fire([selectDate]);
this.doCellMouseOut.call(cell, null, this);
}
return this.getSelectedDates();
};
YAHOO.widget.Calendar.prototype.deselect = function(date) {
var aToBeDeselected = this._toFieldArray(date);
var validDates = [];
var selected = [];
var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
for (var a=0; a < aToBeDeselected.length; ++a) {
var toDeselect = aToBeDeselected[a];
if (!this.isDateOOB(this._toDate(toDeselect))) {
if (validDates.length === 0) {
this.beforeDeselectEvent.fire();
selected = this.cfg.getProperty(cfgSelected);
}
validDates.push(toDeselect);
var index = this._indexOfSelectedFieldArray(toDeselect);
if (index != -1) {
selected.splice(index,1);
}
}
}
if (validDates.length > 0) {
if (this.parent) {
this.parent.cfg.setProperty(cfgSelected, selected);
} else {
this.cfg.setProperty(cfgSelected, selected);
}
this.deselectEvent.fire(validDates);
}
return this.getSelectedDates();
};
YAHOO.widget.Calendar.prototype.deselectCell = function(cellIndex) {
var cell = this.cells[cellIndex];
var cellDate = this.cellDates[cellIndex];
var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
if (selectable) {
this.beforeDeselectEvent.fire();
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
var selected = this.cfg.getProperty(defCfg.SELECTED.key);
var dCellDate = this._toDate(cellDate);
var selectDate = cellDate.concat();
if (cellDateIndex > -1) {
if (this.cfg.getProperty(defCfg.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
this.cfg.getProperty(defCfg.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
}
selected.splice(cellDateIndex, 1);
}
if (this.parent) {
this.parent.cfg.setProperty(defCfg.SELECTED.key, selected);
} else {
this.cfg.setProperty(defCfg.SELECTED.key, selected);
}
this.deselectEvent.fire(selectDate);
}
return this.getSelectedDates();
};
YAHOO.widget.Calendar.prototype.deselectAll = function() {
this.beforeDeselectEvent.fire();
var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
var selected = this.cfg.getProperty(cfgSelected);
var count = selected.length;
var sel = selected.concat();
if (this.parent) {
this.parent.cfg.setProperty(cfgSelected, []);
} else {
this.cfg.setProperty(cfgSelected, []);
}
if (count > 0) {
this.deselectEvent.fire(sel);
}
return this.getSelectedDates();
};
YAHOO.widget.Calendar.prototype._toFieldArray = function(date) {
var returnDate = [];
if (date instanceof Date) {
returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
} else if (YAHOO.lang.isString(date)) {
returnDate = this._parseDates(date);
} else if (YAHOO.lang.isArray(date)) {
for (var i=0;i<date.length;++i) {
var d = date[i];
returnDate[returnDate.length] = [d.getFullYear(),d.getMonth()+1,d.getDate()];
}
}
return returnDate;
};
YAHOO.widget.Calendar.prototype._toDate = function(dateFieldArray) {
if (dateFieldArray instanceof Date) {
return dateFieldArray;
} else {
return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);
}
};
YAHOO.widget.Calendar.prototype._fieldArraysAreEqual = function(array1, array2) {
var match = false;
if (array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2]) {
match=true;
}
return match;
};
YAHOO.widget.Calendar.prototype._indexOfSelectedFieldArray = function(find) {
var selected = -1;
var seldates = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
for (var s=0;s<seldates.length;++s) {
var sArray = seldates[s];
if (find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2]) {
selected = s;
break;
}
}
return selected;
};
YAHOO.widget.Calendar.prototype.isDateOOM = function(date) {
return (date.getMonth() != this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());
};
YAHOO.widget.Calendar.prototype.isDateOOB = function(date) {
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
var minDate = this.cfg.getProperty(defCfg.MINDATE.key);
var maxDate = this.cfg.getProperty(defCfg.MAXDATE.key);
var dm = YAHOO.widget.DateMath;
if (minDate) {
minDate = dm.clearTime(minDate);
}
if (maxDate) {
maxDate = dm.clearTime(maxDate);
}
var clearedDate = new Date(date.getTime());
clearedDate = dm.clearTime(clearedDate);
return ((minDate && clearedDate.getTime() < minDate.getTime()) || (maxDate && clearedDate.getTime() > maxDate.getTime()));
};
YAHOO.widget.Calendar.prototype._parsePageDate = function(date) {
var parsedDate;
var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
if (date) {
if (date instanceof Date) {
parsedDate = YAHOO.widget.DateMath.findMonthStart(date);
} else {
var month, year, aMonthYear;
aMonthYear = date.split(this.cfg.getProperty(defCfg.DATE_FIELD_DELIMITER.key));
month = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_MONTH_POSITION.key)-1], 10)-1;
year = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_YEAR_POSITION.key)-1], 10);
parsedDate = new Date(year, month, 1);
}
} else {
parsedDate = new Date(this.today.getFullYear(), this.today.getMonth(), 1);
}
return parsedDate;
};
YAHOO.widget.Calendar.prototype.onBeforeSelect = function() {
if (this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key) === false) {
if (this.parent) {
this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
this.parent.deselectAll();
} else {
this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
this.deselectAll();
}
}
};
YAHOO.widget.Calendar.prototype.onSelect = function(selected) { };
YAHOO.widget.Calendar.prototype.onBeforeDeselect = function() { };
YAHOO.widget.Calendar.prototype.onDeselect = function(deselected) { };
YAHOO.widget.Calendar.prototype.onChangePage = function() {
this.render();
};
YAHOO.widget.Calendar.prototype.onRender = function() { };
YAHOO.widget.Calendar.prototype.onReset = function() { this.render(); };
YAHOO.widget.Calendar.prototype.onClear = function() { this.render(); };
YAHOO.widget.Calendar.prototype.validate = function() { return true; };
YAHOO.widget.Calendar.prototype._parseDate = function(sDate) {
var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER);
var rArray;
if (aDate.length == 2) {
rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
rArray.type = YAHOO.widget.Calendar.MONTH_DAY;
} else {
rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
rArray.type = YAHOO.widget.Calendar.DATE;
}
for (var i=0;i<rArray.length;i++) {
rArray[i] = parseInt(rArray[i], 10);
}
return rArray;
};
YAHOO.widget.Calendar.prototype._parseDates = function(sDates) {
var aReturn = [];
var aDates = sDates.split(this.Locale.DATE_DELIMITER);
for (var d=0;d<aDates.length;++d) {
var sDate = aDates[d];
if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {
var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER);
var dateStart = this._parseDate(aRange[0]);
var dateEnd = this._parseDate(aRange[1]);
var fullRange = this._parseRange(dateStart, dateEnd);
aReturn = aReturn.concat(fullRange);
} else {
var aDate = this._parseDate(sDate);
aReturn.push(aDate);
}
}
return aReturn;
};
YAHOO.widget.Calendar.prototype._parseRange = function(startDate, endDate) {
var dStart   = new Date(startDate[0],startDate[1]-1,startDate[2]);
var dCurrent = YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);
var dEnd     = new Date(endDate[0],  endDate[1]-1,  endDate[2]);
var results = [];
results.push(startDate);
while (dCurrent.getTime() <= dEnd.getTime()) {
results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);
dCurrent = YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);
}
return results;
};
YAHOO.widget.Calendar.prototype.resetRenderers = function() {
this.renderStack = this._renderStack.concat();
};
YAHOO.widget.Calendar.prototype.clearElement = function(cell) {
cell.innerHTML = "&#160;";
cell.className="";
};
YAHOO.widget.Calendar.prototype.addRenderer = function(sDates, fnRender) {
var aDates = this._parseDates(sDates);
for (var i=0;i<aDates.length;++i) {
var aDate = aDates[i];
if (aDate.length == 2) { // this is either a range or a month/day combo
if (aDate[0] instanceof Array) { // this is a range
this._addRenderer(YAHOO.widget.Calendar.RANGE,aDate,fnRender);
} else { // this is a month/day combo
this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,aDate,fnRender);
}
} else if (aDate.length == 3) {
this._addRenderer(YAHOO.widget.Calendar.DATE,aDate,fnRender);
}
}
};
YAHOO.widget.Calendar.prototype._addRenderer = function(type, aDates, fnRender) {
var add = [type,aDates,fnRender];
this.renderStack.unshift(add);
this._renderStack = this.renderStack.concat();
};
YAHOO.widget.Calendar.prototype.addMonthRenderer = function(month, fnRender) {
this._addRenderer(YAHOO.widget.Calendar.MONTH,[month],fnRender);
};
YAHOO.widget.Calendar.prototype.addWeekdayRenderer = function(weekday, fnRender) {
this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[weekday],fnRender);
};
YAHOO.widget.Calendar.prototype.clearAllBodyCellStyles = function(style) {
for (var c=0;c<this.cells.length;++c) {
YAHOO.util.Dom.removeClass(this.cells[c],style);
}
};
YAHOO.widget.Calendar.prototype.setMonth = function(month) {
var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
var current = this.cfg.getProperty(cfgPageDate);
current.setMonth(parseInt(month, 10));
this.cfg.setProperty(cfgPageDate, current);
};
YAHOO.widget.Calendar.prototype.setYear = function(year) {
var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
var current = this.cfg.getProperty(cfgPageDate);
current.setFullYear(parseInt(year, 10));
this.cfg.setProperty(cfgPageDate, current);
};
YAHOO.widget.Calendar.prototype.getSelectedDates = function() {
var returnDates = [];
var selected = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
for (var d=0;d<selected.length;++d) {
var dateArray = selected[d];
var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);
returnDates.push(date);
}
returnDates.sort( function(a,b) { return a-b; } );
return returnDates;
};
YAHOO.widget.Calendar.prototype.hide = function() {
this.oDomContainer.style.display = "none";
};
YAHOO.widget.Calendar.prototype.show = function() {
this.oDomContainer.style.display = "block";
};
YAHOO.widget.Calendar.prototype.browser = function() {
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
return 'opera';
} else if (ua.indexOf('msie 7')!=-1) { // IE7
return 'ie7';
} else if (ua.indexOf('msie') !=-1) { // IE
return 'ie';
} else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
return 'safari';
} else if (ua.indexOf('gecko') != -1) { // Gecko
return 'gecko';
} else {
return false;
}
}();
YAHOO.widget.Calendar.prototype.toString = function() {
return "Calendar " + this.id;
};
YAHOO.widget.Calendar_Core = YAHOO.widget.Calendar;
YAHOO.widget.Cal_Core = YAHOO.widget.Calendar;
YAHOO.widget.CalendarGroup = function(id, containerId, config) {
if (arguments.length > 0) {
this.init(id, containerId, config);
}
};
YAHOO.widget.CalendarGroup.prototype.init = function(id, containerId, config) {
this.initEvents();
this.initStyles();
this.pages = [];
this.id = id;
this.containerId = containerId;
this.oDomContainer = document.getElementById(containerId);
YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
this.cfg = new YAHOO.util.Config(this);
this.Options = {};
this.Locale = {};
this.setupConfig();
if (config) {
this.cfg.applyConfig(config, true);
}
this.cfg.fireQueue();
if (YAHOO.env.ua.opera){
this.renderEvent.subscribe(this._fixWidth, this, true);
}
};
YAHOO.widget.CalendarGroup.prototype.setupConfig = function() {
var defCfg = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;
this.cfg.addProperty(defCfg.PAGES.key, { value:defCfg.PAGES.value, validator:this.cfg.checkNumber, handler:this.configPages } );
this.cfg.addProperty(defCfg.PAGEDATE.key, { value:new Date(), handler:this.configPageDate } );
this.cfg.addProperty(defCfg.SELECTED.key, { value:[], handler:this.configSelected } );
this.cfg.addProperty(defCfg.TITLE.key, { value:defCfg.TITLE.value, handler:this.configTitle } );
this.cfg.addProperty(defCfg.CLOSE.key, { value:defCfg.CLOSE.value, handler:this.configClose } );
this.cfg.addProperty(defCfg.IFRAME.key, { value:defCfg.IFRAME.value, handler:this.configIframe, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.MINDATE.key, { value:defCfg.MINDATE.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.MAXDATE.key, { value:defCfg.MAXDATE.value, handler:this.delegateConfig  } );
this.cfg.addProperty(defCfg.MULTI_SELECT.key,	{ value:defCfg.MULTI_SELECT.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.START_WEEKDAY.key,	{ value:defCfg.START_WEEKDAY.value, handler:this.delegateConfig, validator:this.cfg.checkNumber  } );
this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key,	{ value:defCfg.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key,{ value:defCfg.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key,{ value:defCfg.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key,{ value:defCfg.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator:this.cfg.checkBoolean } );
this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key,	{ value:defCfg.NAV_ARROW_LEFT.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key,	{ value:defCfg.NAV_ARROW_RIGHT.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.MONTHS_SHORT.key,	{ value:defCfg.MONTHS_SHORT.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.MONTHS_LONG.key,		{ value:defCfg.MONTHS_LONG.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key,	{ value:defCfg.WEEKDAYS_1CHAR.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key,	{ value:defCfg.WEEKDAYS_SHORT.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key,	{ value:defCfg.WEEKDAYS_MEDIUM.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key,	{ value:defCfg.WEEKDAYS_LONG.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.LOCALE_MONTHS.key,	{ value:defCfg.LOCALE_MONTHS.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key,	{ value:defCfg.LOCALE_WEEKDAYS.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.DATE_DELIMITER.key,		{ value:defCfg.DATE_DELIMITER.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key,{ value:defCfg.DATE_FIELD_DELIMITER.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key,{ value:defCfg.DATE_RANGE_DELIMITER.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key,	{ value:defCfg.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key,	{ value:defCfg.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key,	{ value:defCfg.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MD_DAY_POSITION.key,		{ value:defCfg.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key,	{ value:defCfg.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key,	{ value:defCfg.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key,	{ value:defCfg.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key,	{ value:defCfg.MY_LABEL_MONTH_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key,	{ value:defCfg.MY_LABEL_YEAR_POSITION.value, handler:this.delegateConfig, validator:this.cfg.checkNumber } );
this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key,	{ value:defCfg.MY_LABEL_MONTH_SUFFIX.value, handler:this.delegateConfig } );
this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, { value:defCfg.MY_LABEL_YEAR_SUFFIX.value, handler:this.delegateConfig } );
};
YAHOO.widget.CalendarGroup.prototype.initEvents = function() {
var me = this;
var strEvent = "Event";
var sub = function(fn, obj, bOverride) {
for (var p=0;p<me.pages.length;++p) {
var cal = me.pages[p];
cal[this.type + strEvent].subscribe(fn, obj, bOverride);
}
};
var unsub = function(fn, obj) {
for (var p=0;p<me.pages.length;++p) {
var cal = me.pages[p];
cal[this.type + strEvent].unsubscribe(fn, obj);
}
};
var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
this.beforeSelectEvent.subscribe = sub; this.beforeSelectEvent.unsubscribe = unsub;
this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
this.selectEvent.subscribe = sub; this.selectEvent.unsubscribe = unsub;
this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
this.beforeDeselectEvent.subscribe = sub; this.beforeDeselectEvent.unsubscribe = unsub;
this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
this.deselectEvent.subscribe = sub; this.deselectEvent.unsubscribe = unsub;
this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
this.changePageEvent.subscribe = sub; this.changePageEvent.unsubscribe = unsub;
this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
this.beforeRenderEvent.subscribe = sub; this.beforeRenderEvent.unsubscribe = unsub;
this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
this.renderEvent.subscribe = sub; this.renderEvent.unsubscribe = unsub;
this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
this.resetEvent.subscribe = sub; this.resetEvent.unsubscribe = unsub;
this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
this.clearEvent.subscribe = sub; this.clearEvent.unsubscribe = unsub;
};
YAHOO.widget.CalendarGroup.prototype.configPages = function(type, args, obj) {
var pageCount = args[0];
var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
var sep = "_";
var groupCalClass = "groupcal";
var firstClass = "first-of-type";
var lastClass = "last-of-type";
for (var p=0;p<pageCount;++p) {
var calId = this.id + sep + p;
var calContainerId = this.containerId + sep + p;
var childConfig = this.cfg.getConfig();
childConfig.close = false;
childConfig.title = false;
var cal = this.constructChild(calId, calContainerId, childConfig);
var caldate = cal.cfg.getProperty(cfgPageDate);
this._setMonthOnDate(caldate, caldate.getMonth() + p);
cal.cfg.setProperty(cfgPageDate, caldate);
YAHOO.util.Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
YAHOO.util.Dom.addClass(cal.oDomContainer, groupCalClass);
if (p===0) {
YAHOO.util.Dom.addClass(cal.oDomContainer, firstClass);
}
if (p==(pageCount-1)) {
YAHOO.util.Dom.addClass(cal.oDomContainer, lastClass);
}
cal.parent = this;
cal.index = p;
this.pages[this.pages.length] = cal;
}
};
YAHOO.widget.CalendarGroup.prototype.configPageDate = function(type, args, obj) {
var val = args[0];
var firstPageDate;
var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
if (p === 0) {
firstPageDate = cal._parsePageDate(val);
cal.cfg.setProperty(cfgPageDate, firstPageDate);
} else {
var pageDate = new Date(firstPageDate);
this._setMonthOnDate(pageDate, pageDate.getMonth() + p);
cal.cfg.setProperty(cfgPageDate, pageDate);
}
}
};
YAHOO.widget.CalendarGroup.prototype.configSelected = function(type, args, obj) {
var cfgSelected = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;
this.delegateConfig(type, args, obj);
var selected = (this.pages.length > 0) ? this.pages[0].cfg.getProperty(cfgSelected) : [];
this.cfg.setProperty(cfgSelected, selected, true);
};
YAHOO.widget.CalendarGroup.prototype.delegateConfig = function(type, args, obj) {
var val = args[0];
var cal;
for (var p=0;p<this.pages.length;p++) {
cal = this.pages[p];
cal.cfg.setProperty(type, val);
}
};
YAHOO.widget.CalendarGroup.prototype.setChildFunction = function(fnName, fn) {
var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
for (var p=0;p<pageCount;++p) {
this.pages[p][fnName] = fn;
}
};
YAHOO.widget.CalendarGroup.prototype.callChildFunction = function(fnName, args) {
var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
for (var p=0;p<pageCount;++p) {
var page = this.pages[p];
if (page[fnName]) {
var fn = page[fnName];
fn.call(page, args);
}
}
};
YAHOO.widget.CalendarGroup.prototype.constructChild = function(id,containerId,config) {
var container = document.getElementById(containerId);
if (! container) {
container = document.createElement("div");
container.id = containerId;
this.oDomContainer.appendChild(container);
}
return new YAHOO.widget.Calendar(id,containerId,config);
};
YAHOO.widget.CalendarGroup.prototype.setMonth = function(month) {
month = parseInt(month, 10);
var currYear;
var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
for (var p=0; p<this.pages.length; ++p) {
var cal = this.pages[p];
var pageDate = cal.cfg.getProperty(cfgPageDate);
if (p === 0) {
currYear = pageDate.getFullYear();
} else {
pageDate.setYear(currYear);
}
this._setMonthOnDate(pageDate, month+p);
cal.cfg.setProperty(cfgPageDate, pageDate);
}
};
YAHOO.widget.CalendarGroup.prototype.setYear = function(year) {
var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
year = parseInt(year, 10);
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
var pageDate = cal.cfg.getProperty(cfgPageDate);
if ((pageDate.getMonth()+1) == 1 && p>0) {
year+=1;
}
cal.setYear(year);
}
};
YAHOO.widget.CalendarGroup.prototype.render = function() {
this.renderHeader();
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.render();
}
this.renderFooter();
};
YAHOO.widget.CalendarGroup.prototype.select = function(date) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.select(date);
}
return this.getSelectedDates();
};
YAHOO.widget.CalendarGroup.prototype.selectCell = function(cellIndex) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.selectCell(cellIndex);
}
return this.getSelectedDates();
};
YAHOO.widget.CalendarGroup.prototype.deselect = function(date) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.deselect(date);
}
return this.getSelectedDates();
};
YAHOO.widget.CalendarGroup.prototype.deselectAll = function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.deselectAll();
}
return this.getSelectedDates();
};
YAHOO.widget.CalendarGroup.prototype.deselectCell = function(cellIndex) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.deselectCell(cellIndex);
}
return this.getSelectedDates();
};
YAHOO.widget.CalendarGroup.prototype.reset = function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.reset();
}
};
YAHOO.widget.CalendarGroup.prototype.clear = function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.clear();
}
};
YAHOO.widget.CalendarGroup.prototype.nextMonth = function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.nextMonth();
}
};
YAHOO.widget.CalendarGroup.prototype.previousMonth = function() {
for (var p=this.pages.length-1;p>=0;--p) {
var cal = this.pages[p];
cal.previousMonth();
}
};
YAHOO.widget.CalendarGroup.prototype.nextYear = function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.nextYear();
}
};
YAHOO.widget.CalendarGroup.prototype.previousYear = function() {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.previousYear();
}
};
YAHOO.widget.CalendarGroup.prototype.getSelectedDates = function() {
var returnDates = [];
var selected = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);
for (var d=0;d<selected.length;++d) {
var dateArray = selected[d];
var date = new Date(dateArray[0],dateArray[1]-1,dateArray[2]);
returnDates.push(date);
}
returnDates.sort( function(a,b) { return a-b; } );
return returnDates;
};
YAHOO.widget.CalendarGroup.prototype.addRenderer = function(sDates, fnRender) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.addRenderer(sDates, fnRender);
}
};
YAHOO.widget.CalendarGroup.prototype.addMonthRenderer = function(month, fnRender) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.addMonthRenderer(month, fnRender);
}
};
YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer = function(weekday, fnRender) {
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
cal.addWeekdayRenderer(weekday, fnRender);
}
};
YAHOO.widget.CalendarGroup.prototype.renderHeader = function() {};
YAHOO.widget.CalendarGroup.prototype.renderFooter = function() {};
YAHOO.widget.CalendarGroup.prototype.addMonths = function(count) {
this.callChildFunction("addMonths", count);
};
YAHOO.widget.CalendarGroup.prototype.subtractMonths = function(count) {
this.callChildFunction("subtractMonths", count);
};
YAHOO.widget.CalendarGroup.prototype.addYears = function(count) {
this.callChildFunction("addYears", count);
};
YAHOO.widget.CalendarGroup.prototype.subtractYears = function(count) {
this.callChildFunction("subtractYears", count);
};
YAHOO.widget.CalendarGroup.prototype.show = function() {
this.oDomContainer.style.display = "block";
if (YAHOO.env.ua.opera) {
this._fixWidth();
}
};
YAHOO.widget.CalendarGroup.prototype._setMonthOnDate = function(date, iMonth) {
if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420 && (iMonth < 0 || iMonth > 11)) {
var DM = YAHOO.widget.DateMath;
var newDate = DM.add(date, DM.MONTH, iMonth-date.getMonth());
date.setTime(newDate.getTime());
} else {
date.setMonth(iMonth);
}
};
YAHOO.widget.CalendarGroup.prototype._fixWidth = function() {
var startW = this.oDomContainer.offsetWidth;
var w = 0;
for (var p=0;p<this.pages.length;++p) {
var cal = this.pages[p];
w += cal.oDomContainer.offsetWidth;
}
if (w > 0) {
this.oDomContainer.style.width = w + "px";
}
};
YAHOO.widget.CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
YAHOO.widget.CalendarGroup.CSS_MULTI_UP = "multi";
YAHOO.widget.CalendarGroup.CSS_2UPTITLE = "title";
YAHOO.widget.CalendarGroup.CSS_2UPCLOSE = "close-icon";
YAHOO.lang.augmentProto(YAHOO.widget.CalendarGroup, YAHOO.widget.Calendar, "buildDayLabel",
"buildMonthLabel",
"renderOutOfBoundsDate",
"renderRowHeader",
"renderRowFooter",
"renderCellDefault",
"styleCellDefault",
"renderCellStyleHighlight1",
"renderCellStyleHighlight2",
"renderCellStyleHighlight3",
"renderCellStyleHighlight4",
"renderCellStyleToday",
"renderCellStyleSelected",
"renderCellNotThisMonth",
"renderBodyCellRestricted",
"initStyles",
"configTitle",
"configClose",
"configIframe",
"createTitleBar",
"createCloseButton",
"removeTitleBar",
"removeCloseButton",
"hide",
"browser");
YAHOO.widget.CalendarGroup._DEFAULT_CONFIG = YAHOO.widget.Calendar._DEFAULT_CONFIG;
YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES = {key:"pages", value:2};
YAHOO.widget.CalendarGroup.prototype.toString = function() {
return "CalendarGroup " + this.id;
};
YAHOO.widget.CalGrp = YAHOO.widget.CalendarGroup;
YAHOO.widget.Calendar2up = function(id, containerId, config) {
this.init(id, containerId, config);
};
YAHOO.extend(YAHOO.widget.Calendar2up, YAHOO.widget.CalendarGroup);
YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.3.1", build: "541"});
function handleSelect(type,args,obj) {
var dates = args[0];
var date = dates[0];
var year = date[0], month = date[1], day = date[2];
var objIDArray = obj.id.split( '_' );
var id = objIDArray[3];
var datatype = objIDArray[1];
var base = objIDArray[0];
var txtYear = document.getElementsByName( base + '_' + datatype + '_year_' + id );
txtYear[0].value = year;
var txtMonth = document.getElementsByName( base + '_' + datatype + '_month_' + id );
txtMonth[0].value = month;
var txtDay = document.getElementsByName( base + '_' + datatype + '_day_' + id );
txtDay[0].value = day;
window['cal'+id].hide();
}
function showDatePicker( base, id, datatype ) {
var calIconID = base + '_' + datatype + '_cal_' + id;
var calContainerID = base + '_' + datatype + '_cal_container_' + id;
var calContainer = document.getElementById( calContainerID );
var xy = YAHOO.util.Dom.getXY( calIconID );
calContainer.style.left = ( xy[0] + 26 ) + 'px';
calContainer.style.top = ( xy[1] + 30 ) + 'px';
calContainer.style.display = 'block';
window['cal'+id] = new YAHOO.widget.Calendar( base + '_' + datatype + '_cal_' + id , calContainerID, { close: true,
mindate: "1/1/1970",
LOCALE_WEEKDAYS: "medium" } );
window['cal'+id].render();
window['cal'+id].selectEvent.subscribe( handleSelect, window['cal'+id], true );
}
function ezflowClassesSelection(id)
{
var select = document.getElementById('ezflow_fetch_classes_selection_' + id);
var input = document.getElementById('ezflow_fetch_classes_hidden_' + id);
input.value = "";
for( var i = 0; i < select.options.length; i++ )
{
if( select.options[i].selected )
{
if( input.value != "" )
input.value = input.value + ";";
input.value = input.value + select.options[i].value;
}
}
}
function ezflowClassesSelectionCustomAttribute(id)
{
var select = document.getElementById('ezflow_classes_selection_' + id);
var input = document.getElementById('ezflow_classes_hidden_' + id);
input.value = "";
for( var i = 0; i < select.options.length; i++ )
{
if( select.options[i].selected )
{
if( input.value != "" )
input.value = input.value + ";";
input.value = input.value + select.options[i].value;
}
}
}
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};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];}}}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||{isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var D={},B=arguments;for(var C=0,A=B.length;C<A;C=C+1){YAHOO.lang.augmentObject(D,B[C],true);}return D;},later:function(H,B,I,D,E){H=H||0;B=B||{};var C=I,G=D,F,A;if(YAHOO.lang.isString(I)){C=B[I];}if(!C){throw new TypeError("method undefined");}if(!YAHOO.lang.isArray(G)){G=[D];}F=function(){C.apply(B,G);};A=(E)?setInterval(F,H):setTimeout(F,H);return{interval:E,cancel:function(){if(this.interval){clearInterval(A);}else{clearTimeout(A);}}};},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.5.0",build:"895"});
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};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];}}}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||{isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType" in A&&"tagName" in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var D={},B=arguments;for(var C=0,A=B.length;C<A;C=C+1){YAHOO.lang.augmentObject(D,B[C],true);}return D;},later:function(H,B,I,D,E){H=H||0;B=B||{};var C=I,G=D,F,A;if(YAHOO.lang.isString(I)){C=B[I];}if(!C){throw new TypeError("method undefined");}if(!YAHOO.lang.isArray(G)){G=[D];}F=function(){C.apply(B,G);};A=(E)?setInterval(F,H):setTimeout(F,H);return{interval:E,cancel:function(){if(this.interval){clearInterval(A);}else{clearTimeout(A);}}};},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.5.0",build:"895"});(function(){var B=YAHOO.util,K,I,J={},F={},M=window.document;YAHOO.env._id_counter=YAHOO.env._id_counter||0;var C=YAHOO.env.ua.opera,L=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var N=function(P){if(!E.HYPHEN.test(P)){return P;}if(J[P]){return J[P];}var Q=P;while(E.HYPHEN.exec(Q)){Q=Q.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}J[P]=Q;return Q;};var O=function(Q){var P=F[Q];if(!P){P=new RegExp("(?:^|\\s+)"+Q+"(?:\\s+|$)");F[Q]=P;}return P;};if(M.defaultView&&M.defaultView.getComputedStyle){K=function(P,S){var R=null;if(S=="float"){S="cssFloat";}var Q=M.defaultView.getComputedStyle(P,"");if(Q){R=Q[N(S)];}return P.style[S]||R;};}else{if(M.documentElement.currentStyle&&G){K=function(P,R){switch(N(R)){case"opacity":var T=100;try{T=P.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(S){try{T=P.filters("alpha").opacity;}catch(S){}}return T/100;case"float":R="styleFloat";default:var Q=P.currentStyle?P.currentStyle[R]:null;return(P.style[R]||Q);}};}else{K=function(P,Q){return P.style[Q];};}}if(G){I=function(P,Q,R){switch(Q){case"opacity":if(YAHOO.lang.isString(P.style.filter)){P.style.filter="alpha(opacity="+R*100+")";if(!P.currentStyle||!P.currentStyle.hasLayout){P.style.zoom=1;}}break;case"float":Q="styleFloat";default:P.style[Q]=R;}};}else{I=function(P,Q,R){if(Q=="float"){Q="cssFloat";}P.style[Q]=R;};}var D=function(P,Q){return P&&P.nodeType==1&&(!Q||Q(P));};YAHOO.util.Dom={get:function(R){if(R&&(R.nodeType||R.item)){return R;}if(YAHOO.lang.isString(R)||!R){return M.getElementById(R);}if(R.length!==undefined){var S=[];for(var Q=0,P=R.length;Q<P;++Q){S[S.length]=B.Dom.get(R[Q]);}return S;}return R;},getStyle:function(P,R){R=N(R);var Q=function(S){return K(S,R);};return B.Dom.batch(P,Q,B.Dom,true);},setStyle:function(P,R,S){R=N(R);var Q=function(T){I(T,R,S);};B.Dom.batch(P,Q,B.Dom,true);},getXY:function(P){var Q=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=R.ownerDocument.body){return false;}return H(R);};return B.Dom.batch(P,Q,B.Dom,true);},getX:function(P){var Q=function(R){return B.Dom.getXY(R)[0];};return B.Dom.batch(P,Q,B.Dom,true);},getY:function(P){var Q=function(R){return B.Dom.getXY(R)[1];};return B.Dom.batch(P,Q,B.Dom,true);},setXY:function(P,S,R){var Q=function(V){var U=this.getStyle(V,"position");if(U=="static"){this.setStyle(V,"position","relative");U="relative";}var X=this.getXY(V);if(X===false){return false;}var W=[parseInt(this.getStyle(V,"left"),10),parseInt(this.getStyle(V,"top"),10)];if(isNaN(W[0])){W[0]=(U=="relative")?0:V.offsetLeft;}if(isNaN(W[1])){W[1]=(U=="relative")?0:V.offsetTop;}if(S[0]!==null){V.style.left=S[0]-X[0]+W[0]+"px";}if(S[1]!==null){V.style.top=S[1]-X[1]+W[1]+"px";}if(!R){var T=this.getXY(V);if((S[0]!==null&&T[0]!=S[0])||(S[1]!==null&&T[1]!=S[1])){this.setXY(V,S,true);}}};B.Dom.batch(P,Q,B.Dom,true);},setX:function(Q,P){B.Dom.setXY(Q,[P,null]);},setY:function(P,Q){B.Dom.setXY(P,[null,Q]);},getRegion:function(P){var Q=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=M.body){return false;}var S=B.Region.getRegion(R);return S;};return B.Dom.batch(P,Q,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(T,X,U,V){X=X||"*";U=(U)?B.Dom.get(U):null||M;if(!U){return[];}var Q=[],P=U.getElementsByTagName(X),W=O(T);for(var R=0,S=P.length;R<S;++R){if(W.test(P[R].className)){Q[Q.length]=P[R];if(V){V.call(P[R],P[R]);}}}return Q;},hasClass:function(R,Q){var P=O(Q);var S=function(T){return P.test(T.className);};return B.Dom.batch(R,S,B.Dom,true);},addClass:function(Q,P){var R=function(S){if(this.hasClass(S,P)){return false;}S.className=YAHOO.lang.trim([S.className,P].join(" "));return true;};return B.Dom.batch(Q,R,B.Dom,true);},removeClass:function(R,Q){var P=O(Q);var S=function(T){if(!Q||!this.hasClass(T,Q)){return false;}var U=T.className;T.className=U.replace(P," ");if(this.hasClass(T,Q)){this.removeClass(T,Q);}T.className=YAHOO.lang.trim(T.className);return true;};return B.Dom.batch(R,S,B.Dom,true);},replaceClass:function(S,Q,P){if(!P||Q===P){return false;}var R=O(Q);var T=function(U){if(!this.hasClass(U,Q)){this.addClass(U,P);return true;}U.className=U.className.replace(R," "+P+" ");if(this.hasClass(U,Q)){this.replaceClass(U,Q,P);}U.className=YAHOO.lang.trim(U.className);return true;};return B.Dom.batch(S,T,B.Dom,true);},generateId:function(P,R){R=R||"yui-gen";var Q=function(S){if(S&&S.id){return S.id;}var T=R+YAHOO.env._id_counter++;if(S){S.id=T;}return T;};return B.Dom.batch(P,Q,B.Dom,true)||Q.apply(B.Dom,arguments);},isAncestor:function(P,Q){P=B.Dom.get(P);Q=B.Dom.get(Q);if(!P||!Q){return false;}if(P.contains&&Q.nodeType&&!L){return P.contains(Q);}else{if(P.compareDocumentPosition&&Q.nodeType){return !!(P.compareDocumentPosition(Q)&16);}else{if(Q.nodeType){return !!this.getAncestorBy(Q,function(R){return R==P;});}}}return false;},inDocument:function(P){return this.isAncestor(M.documentElement,P);},getElementsBy:function(W,Q,R,T){Q=Q||"*";R=(R)?B.Dom.get(R):null||M;if(!R){return[];}var S=[],V=R.getElementsByTagName(Q);for(var U=0,P=V.length;U<P;++U){if(W(V[U])){S[S.length]=V[U];if(T){T(V[U]);}}}return S;},batch:function(T,W,V,R){T=(T&&(T.tagName||T.item))?T:B.Dom.get(T);if(!T||!W){return false;}var S=(R)?V:window;if(T.tagName||T.length===undefined){return W.call(S,T,V);}var U=[];for(var Q=0,P=T.length;Q<P;++Q){U[U.length]=W.call(S,T[Q],V);}return U;},getDocumentHeight:function(){var Q=(M.compatMode!="CSS1Compat")?M.body.scrollHeight:M.documentElement.scrollHeight;var P=Math.max(Q,B.Dom.getViewportHeight());return P;},getDocumentWidth:function(){var Q=(M.compatMode!="CSS1Compat")?M.body.scrollWidth:M.documentElement.scrollWidth;var P=Math.max(Q,B.Dom.getViewportWidth());return P;},getViewportHeight:function(){var P=self.innerHeight;var Q=M.compatMode;if((Q||G)&&!C){P=(Q=="CSS1Compat")?M.documentElement.clientHeight:M.body.clientHeight;
}return P;},getViewportWidth:function(){var P=self.innerWidth;var Q=M.compatMode;if(Q||G){P=(Q=="CSS1Compat")?M.documentElement.clientWidth:M.body.clientWidth;}return P;},getAncestorBy:function(P,Q){while(P=P.parentNode){if(D(P,Q)){return P;}}return null;},getAncestorByClassName:function(Q,P){Q=B.Dom.get(Q);if(!Q){return null;}var R=function(S){return B.Dom.hasClass(S,P);};return B.Dom.getAncestorBy(Q,R);},getAncestorByTagName:function(Q,P){Q=B.Dom.get(Q);if(!Q){return null;}var R=function(S){return S.tagName&&S.tagName.toUpperCase()==P.toUpperCase();};return B.Dom.getAncestorBy(Q,R);},getPreviousSiblingBy:function(P,Q){while(P){P=P.previousSibling;if(D(P,Q)){return P;}}return null;},getPreviousSibling:function(P){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getPreviousSiblingBy(P);},getNextSiblingBy:function(P,Q){while(P){P=P.nextSibling;if(D(P,Q)){return P;}}return null;},getNextSibling:function(P){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getNextSiblingBy(P);},getFirstChildBy:function(P,R){var Q=(D(P.firstChild,R))?P.firstChild:null;return Q||B.Dom.getNextSiblingBy(P.firstChild,R);},getFirstChild:function(P,Q){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getFirstChildBy(P);},getLastChildBy:function(P,R){if(!P){return null;}var Q=(D(P.lastChild,R))?P.lastChild:null;return Q||B.Dom.getPreviousSiblingBy(P.lastChild,R);},getLastChild:function(P){P=B.Dom.get(P);return B.Dom.getLastChildBy(P);},getChildrenBy:function(Q,S){var R=B.Dom.getFirstChildBy(Q,S);var P=R?[R]:[];B.Dom.getNextSiblingBy(R,function(T){if(!S||S(T)){P[P.length]=T;}return false;});return P;},getChildren:function(P){P=B.Dom.get(P);if(!P){}return B.Dom.getChildrenBy(P);},getDocumentScrollLeft:function(P){P=P||M;return Math.max(P.documentElement.scrollLeft,P.body.scrollLeft);},getDocumentScrollTop:function(P){P=P||M;return Math.max(P.documentElement.scrollTop,P.body.scrollTop);},insertBefore:function(Q,P){Q=B.Dom.get(Q);P=B.Dom.get(P);if(!Q||!P||!P.parentNode){return null;}return P.parentNode.insertBefore(Q,P);},insertAfter:function(Q,P){Q=B.Dom.get(Q);P=B.Dom.get(P);if(!Q||!P||!P.parentNode){return null;}if(P.nextSibling){return P.parentNode.insertBefore(Q,P.nextSibling);}else{return P.parentNode.appendChild(Q);}},getClientRegion:function(){var R=B.Dom.getDocumentScrollTop(),Q=B.Dom.getDocumentScrollLeft(),S=B.Dom.getViewportWidth()+Q,P=B.Dom.getViewportHeight()+R;return new B.Region(R,S,P,Q);}};var H=function(){if(M.documentElement.getBoundingClientRect){return function(Q){var R=Q.getBoundingClientRect();var P=Q.ownerDocument;return[R.left+B.Dom.getDocumentScrollLeft(P),R.top+B.Dom.getDocumentScrollTop(P)];};}else{return function(R){var S=[R.offsetLeft,R.offsetTop];var Q=R.offsetParent;var P=(L&&B.Dom.getStyle(R,"position")=="absolute"&&R.offsetParent==R.ownerDocument.body);if(Q!=R){while(Q){S[0]+=Q.offsetLeft;S[1]+=Q.offsetTop;if(!P&&L&&B.Dom.getStyle(Q,"position")=="absolute"){P=true;}Q=Q.offsetParent;}}if(P){S[0]-=R.ownerDocument.body.offsetLeft;S[1]-=R.ownerDocument.body.offsetTop;}Q=R.parentNode;while(Q.tagName&&!E.ROOT_TAG.test(Q.tagName)){if(B.Dom.getStyle(Q,"display").search(/^inline|table-row.*$/i)){S[0]-=Q.scrollLeft;S[1]-=Q.scrollTop;}Q=Q.parentNode;}return S;};}}();})();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.5.0",build:"895"});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(){var D=this.subscribers.length;if(!D&&this.silent){return true;}var H=[],F=true,C,I=false;for(C=0;C<arguments.length;++C){H.push(arguments[C]);}if(!this.silent){}for(C=0;C<D;++C){var L=this.subscribers[C];if(!L){I=true;}else{if(!this.silent){}var K=L.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var A=null;if(H.length>0){A=H[0];}try{F=L.fn.call(K,A,L.obj);}catch(E){this.lastError=E;}}else{try{F=L.fn.call(K,this.type,H,L.obj);}catch(G){this.lastError=G;}}if(false===F){if(!this.silent){}return false;}}}if(I){var J=[],B=this.subscribers;for(C=0,D=B.length;C<D;C=C+1){J.push(B[C]);}this.subscribers=J;}return true;},unsubscribeAll:function(){for(var B=0,A=this.subscribers.length;B<A;++B){this._delete(A-1-B);}this.subscribers=[];return B;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers[A]=null;},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};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,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,startInterval:function(){if(!this._interval){var K=this;var L=function(){K._tryPreloadAttach();};this._interval=setInterval(L,this.POLL_INTERVAL);}},onAvailable:function(P,M,Q,O,N){var K=(YAHOO.lang.isString(P))?[P]:P;for(var L=0;L<K.length;L=L+1){F.push({id:K[L],fn:M,obj:Q,override:O,checkReady:N});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(M,K,N,L){this.onAvailable(M,K,N,L,true);},onDOMReady:function(K,M,L){if(this.DOMReady){setTimeout(function(){var N=window;if(L){if(L===true){N=M;}else{N=L;}}K.call(N,"DOMReady",[],M);},0);}else{this.DOMReadyEvent.subscribe(K,M,L);}},addListener:function(M,K,V,Q,L){if(!V||!V.call){return false;}if(this._isValidCollection(M)){var W=true;for(var R=0,T=M.length;R<T;++R){W=this.on(M[R],K,V,Q,L)&&W;}return W;}else{if(YAHOO.lang.isString(M)){var P=this.getEl(M);if(P){M=P;}else{this.onAvailable(M,function(){YAHOO.util.Event.on(M,K,V,Q,L);});return true;}}}if(!M){return false;}if("unload"==K&&Q!==this){J[J.length]=[M,K,V,Q,L];return true;}var Y=M;if(L){if(L===true){Y=Q;}else{Y=L;}}var N=function(Z){return V.call(Y,YAHOO.util.Event.getEvent(Z,M),Q);};var X=[M,K,V,N,Y,Q,L];var S=I.length;I[S]=X;if(this.useLegacyEvent(M,K)){var O=this.getLegacyIndex(M,K);if(O==-1||M!=G[O][0]){O=G.length;B[M.id+K]=O;G[O]=[M,K,M["on"+K]];E[O]=[];M["on"+K]=function(Z){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(Z),O);};}E[O].push(X);}else{try{this._simpleAdd(M,K,N,false);}catch(U){this.lastError=U;this.removeListener(M,K,V);return false;}}return true;},fireLegacyEvent:function(O,M){var Q=true,K,S,R,T,P;S=E[M];for(var L=0,N=S.length;L<N;++L){R=S[L];if(R&&R[this.WFN]){T=R[this.ADJ_SCOPE];P=R[this.WFN].call(T,O);Q=(Q&&P);}}K=G[M];if(K&&K[2]){K[2](O);}return Q;},getLegacyIndex:function(L,M){var K=this.generateId(L)+M;if(typeof B[K]=="undefined"){return -1;}else{return B[K];}},useLegacyEvent:function(L,M){if(this.webkit&&("click"==M||"dblclick"==M)){var K=parseInt(this.webkit,10);if(!isNaN(K)&&K<418){return true;}}return false;},removeListener:function(L,K,T){var O,R,V;if(typeof L=="string"){L=this.getEl(L);}else{if(this._isValidCollection(L)){var U=true;for(O=0,R=L.length;O<R;++O){U=(this.removeListener(L[O],K,T)&&U);}return U;}}if(!T||!T.call){return this.purgeElement(L,false,K);}if("unload"==K){for(O=0,R=J.length;O<R;O++){V=J[O];if(V&&V[0]==L&&V[1]==K&&V[2]==T){J[O]=null;return true;}}return false;}var P=null;var Q=arguments[3];if("undefined"===typeof Q){Q=this._getCacheIndex(L,K,T);}if(Q>=0){P=I[Q];}if(!L||!P){return false;}if(this.useLegacyEvent(L,K)){var N=this.getLegacyIndex(L,K);var M=E[N];if(M){for(O=0,R=M.length;O<R;++O){V=M[O];if(V&&V[this.EL]==L&&V[this.TYPE]==K&&V[this.FN]==T){M[O]=null;break;}}}}else{try{this._simpleRemove(L,K,P[this.WFN],false);}catch(S){this.lastError=S;return false;}}delete I[Q][this.WFN];delete I[Q][this.FN];I[Q]=null;return true;},getTarget:function(M,L){var K=M.target||M.srcElement;return this.resolveTextNode(K);},resolveTextNode:function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},getPageX:function(L){var K=L.pageX;if(!K&&0!==K){K=L.clientX||0;if(this.isIE){K+=this._getScrollLeft();}}return K;},getPageY:function(K){var L=K.pageY;if(!L&&0!==L){L=K.clientY||0;if(this.isIE){L+=this._getScrollTop();}}return L;
},getXY:function(K){return[this.getPageX(K),this.getPageY(K)];},getRelatedTarget:function(L){var K=L.relatedTarget;if(!K){if(L.type=="mouseout"){K=L.toElement;}else{if(L.type=="mouseover"){K=L.fromElement;}}}return this.resolveTextNode(K);},getTime:function(M){if(!M.time){var L=new Date().getTime();try{M.time=L;}catch(K){this.lastError=K;return L;}}return M.time;},stopEvent:function(K){this.stopPropagation(K);this.preventDefault(K);},stopPropagation:function(K){if(K.stopPropagation){K.stopPropagation();}else{K.cancelBubble=true;}},preventDefault:function(K){if(K.preventDefault){K.preventDefault();}else{K.returnValue=false;}},getEvent:function(M,K){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break;}N=N.caller;}}return L;},getCharCode:function(L){var K=L.keyCode||L.charCode||0;if(YAHOO.env.ua.webkit&&(K in D)){K=D[K];}return K;},_getCacheIndex:function(O,P,N){for(var M=0,L=I.length;M<L;++M){var K=I[M];if(K&&K[this.FN]==N&&K[this.EL]==O&&K[this.TYPE]==P){return M;}}return -1;},generateId:function(K){var L=K.id;if(!L){L="yuievtautoid-"+A;++A;K.id=L;}return L;},_isValidCollection:function(L){try{return(L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&typeof L[0]!=="undefined");}catch(K){return false;}},elCache:{},getEl:function(K){return(typeof K==="string")?document.getElementById(K):K;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(L){if(!H){H=true;var K=YAHOO.util.Event;K._ready();K._tryPreloadAttach();}},_ready:function(L){var K=YAHOO.util.Event;if(!K.DOMReady){K.DOMReady=true;K.DOMReadyEvent.fire();K._simpleRemove(document,"DOMContentLoaded",K._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}if(this.isIE){if(!this.DOMReady){this.startInterval();return false;}}this.locked=true;var P=!H;if(!P){P=(C>0);}var O=[];var Q=function(S,T){var R=S;if(T.override){if(T.override===true){R=T.obj;}else{R=T.override;}}T.fn.call(R,T.obj);};var L,K,N,M;for(L=0,K=F.length;L<K;++L){N=F[L];if(N&&!N.checkReady){M=this.getEl(N.id);if(M){Q(M,N);F[L]=null;}else{O.push(N);}}}for(L=0,K=F.length;L<K;++L){N=F[L];if(N&&N.checkReady){M=this.getEl(N.id);if(M){if(H||M.nextSibling){Q(M,N);F[L]=null;}}else{O.push(N);}}}C=(O.length===0)?0:C-1;if(P){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=0,K=Q.length;N<K;++N){var L=Q[N];this.removeListener(M,L.type,L.fn,L.index);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N<K;++N){this.purgeElement(M.childNodes[N],P,R);}}},getListeners:function(M,K){var P=[],L;if(!K){L=[I,J];}else{if(K==="unload"){L=[J];}else{L=[I];}}var R=(YAHOO.lang.isString(M))?this.getEl(M):M;for(var O=0;O<L.length;O=O+1){var T=L[O];if(T&&T.length>0){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===R&&(!K||K===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.OVERRIDE],scope:N[this.ADJ_SCOPE],index:Q});}}}}return(P.length)?P:null;},_unload:function(R){var Q=YAHOO.util.Event,O,N,L,K,M;for(O=0,K=J.length;O<K;++O){L=J[O];if(L){var P=window;if(L[Q.ADJ_SCOPE]){if(L[Q.ADJ_SCOPE]===true){P=L[Q.UNLOAD_OBJ];}else{P=L[Q.ADJ_SCOPE];}}L[Q.FN].call(P,Q.getEvent(R,L[Q.EL]),L[Q.UNLOAD_OBJ]);J[O]=null;L=null;P=null;}}J=null;if(I&&I.length>0){N=I.length;while(N){M=N-1;L=I[M];if(L){Q.removeListener(L[Q.EL],L[Q.TYPE],L[Q.FN],M);}N--;}L=null;}G=null;Q._simpleRemove(window,"unload",Q._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);EU._dri=setInterval(function(){var n=document.createElement("p");try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){n=null;}},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.5.0",build:"895"});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(E){var D,A;try{A=new XMLHttpRequest();D={conn:A,tId:E};}catch(C){for(var B=0;B<this._msxml_progid.length;++B){try{A=new ActiveXObject(this._msxml_progid[B]);D={conn:A,tId:E};break;}catch(C){}}}finally{return D;}},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){for(var 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){if(this._has_default_headers){for(var 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(var 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(K,E,B){this.resetFormState();var J;if(typeof K=="string"){J=(document.getElementById(K)||document.forms[K]);}else{if(typeof K=="object"){J=K;}else{return ;}}if(E){var F=this.createFrame((window.location.href.toLowerCase().indexOf("https")===0||B)?true:false);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=J;return ;}var A,I,G,L;var H=false;for(var D=0;D<J.elements.length;D++){A=J.elements[D];L=A.disabled;I=A.name;G=A.value;if(!L&&I){switch(A.type){case"select-one":case"select-multiple":for(var C=0;C<A.options.length;C++){if(A.options[C].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(A.options[C].attributes["value"].specified?A.options[C].value:A.options[C].text)+"&";}else{this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(A.options[C].hasAttribute("value")?A.options[C].value:A.options[C].text)+"&";}}}break;case"radio":case"checkbox":if(A.checked){this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(H===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+"&";}else{this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}H=true;}break;default:this._sFormData+=encodeURIComponent(I)+"="+encodeURIComponent(G)+"&";}}}this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);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(window.ActiveXObject){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=[];var B=A.split("&");for(var C=0;C<B.length;C++){var E=B[C].indexOf("=");if(E!=-1){D[C]=document.createElement("input");D[C].type="hidden";D[C].name=B[C].substring(0,E);D[C].value=B[C].substring(E+1);this._formNode.appendChild(D[C]);}}return D;},uploadFile:function(D,M,E,C){var N=this;var H="yuiIO"+D.tId;var I="multipart/form-data";var K=document.getElementById(H);var J=(M&&M.argument)?M.argument:null;var B={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",H);if(this._formNode.encoding){this._formNode.setAttribute("encoding",I);}else{this._formNode.setAttribute("enctype",I);}if(C){var L=this.appendPostData(C);}this._formNode.submit();this.startEvent.fire(D,J);if(D.startEvent){D.startEvent.fire(D,J);}if(M&&M.timeout){this._timeOut[D.tId]=window.setTimeout(function(){N.abort(D,M,true);},M.timeout);}if(L&&L.length>0){for(var G=0;G<L.length;G++){this._formNode.removeChild(L[G]);}}for(var A in B){if(YAHOO.lang.hasOwnProperty(B,A)){if(B[A]){this._formNode.setAttribute(A,B[A]);}else{this._formNode.removeAttribute(A);}}}this.resetFormState();var F=function(){if(M&&M.timeout){window.clearTimeout(N._timeOut[D.tId]);delete N._timeOut[D.tId];}N.completeEvent.fire(D,J);if(D.completeEvent){D.completeEvent.fire(D,J);}var P={};P.tId=D.tId;P.argument=M.argument;try{P.responseText=K.contentWindow.document.body?K.contentWindow.document.body.innerHTML:K.contentWindow.document.documentElement.textContent;P.responseXML=K.contentWindow.document.XMLDocument?K.contentWindow.document.XMLDocument:K.contentWindow.document;}catch(O){}if(M&&M.upload){if(!M.scope){M.upload(P);}else{M.upload.apply(M.scope,[P]);}}N.uploadEvent.fire(P);if(D.uploadEvent){D.uploadEvent.fire(P);}YAHOO.util.Event.removeListener(K,"load",F);setTimeout(function(){document.body.removeChild(K);N.releaseObject(D);},100);};YAHOO.util.Event.addListener(K,"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.5.0",build:"895"});(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";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 H=YAHOO.util.Dom.getStyle(G,E);
if(this.patterns.transparent.test(H)){var F=G.parentNode;H=C.Dom.getStyle(F,E);while(F&&this.patterns.transparent.test(H)){F=F.parentNode;H=C.Dom.getStyle(F,E);if(F.tagName.toUpperCase()=="HTML"){H="#fff";}}}}else{H=D.getAttribute.call(this,E);}return H;};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;})();
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.5.0",build:"895"});if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var A=YAHOO.util.Event;return{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(D,C){for(var E in this.ids){for(var B in this.ids[E]){var F=this.ids[E][B];if(!this.isTypeOfDD(F)){continue;}F[D].apply(F,C);}}},_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(B){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(C,B){if(!this.initialized){this.init();}if(!this.ids[B]){this.ids[B]={};}this.ids[B][C.id]=C;},removeDDFromGroup:function(D,B){if(!this.ids[B]){this.ids[B]={};}var C=this.ids[B];if(C&&C[D.id]){delete C[D.id];}},_remove:function(C){for(var B in C.groups){if(B&&this.ids[B][C.id]){delete this.ids[B][C.id];}}delete this.handleIds[C.id];},regHandle:function(C,B){if(!this.handleIds[C]){this.handleIds[C]={};}this.handleIds[C][B]=B;},isDragDrop:function(B){return(this.getDDById(B))?true:false;},getRelated:function(G,C){var F=[];for(var E in G.groups){for(var D in this.ids[E]){var B=this.ids[E][D];if(!this.isTypeOfDD(B)){continue;}if(!C||B.isTarget){F[F.length]=B;}}}return F;},isLegalTarget:function(F,E){var C=this.getRelated(F,true);for(var D=0,B=C.length;D<B;++D){if(C[D].id==E.id){return true;}}return false;},isTypeOfDD:function(B){return(B&&B.__ygDragDrop);},isHandle:function(C,B){return(this.handleIds[C]&&this.handleIds[C][B]);},getDDById:function(C){for(var B in this.ids){if(this.ids[B][C]){return this.ids[B][C];}}return null;},handleMouseDown:function(D,C){this.currentTarget=YAHOO.util.Event.getTarget(D);this.dragCurrent=C;var B=C.getEl();this.startX=YAHOO.util.Event.getPageX(D);this.startY=YAHOO.util.Event.getPageY(D);this.deltaX=this.startX-B.offsetLeft;this.deltaY=this.startY-B.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var E=YAHOO.util.DDM;E.startDrag(E.startX,E.startY);E.fromTimeout=true;},this.clickTimeThresh);},startDrag:function(B,D){clearTimeout(this.clickTimeout);var C=this.dragCurrent;if(C&&C.events.b4StartDrag){C.b4StartDrag(B,D);C.fireEvent("b4StartDragEvent",{x:B,y:D});}if(C&&C.events.startDrag){C.startDrag(B,D);C.fireEvent("startDragEvent",{x:B,y:D});}this.dragThreshMet=true;},handleMouseUp:function(B){if(this.dragCurrent){clearTimeout(this.clickTimeout);if(this.dragThreshMet){if(this.fromTimeout){this.handleMouseMove(B);}this.fromTimeout=false;this.fireEvents(B,true);}else{}this.stopDrag(B);this.stopEvent(B);}},stopEvent:function(B){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(B);}if(this.preventDefault){YAHOO.util.Event.preventDefault(B);}},stopDrag:function(D,C){var B=this.dragCurrent;if(B&&!C){if(this.dragThreshMet){if(B.events.b4EndDrag){B.b4EndDrag(D);B.fireEvent("b4EndDragEvent",{e:D});}if(B.events.endDrag){B.endDrag(D);B.fireEvent("endDragEvent",{e:D});}}if(B.events.mouseUp){B.onMouseUp(D);B.fireEvent("mouseUpEvent",{e:D});}}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(E){var B=this.dragCurrent;if(B){if(YAHOO.util.Event.isIE&&!E.button){this.stopEvent(E);return this.handleMouseUp(E);}else{if(E.clientX<0||E.clientY<0){}}if(!this.dragThreshMet){var D=Math.abs(this.startX-YAHOO.util.Event.getPageX(E));var C=Math.abs(this.startY-YAHOO.util.Event.getPageY(E));if(D>this.clickPixelThresh||C>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){if(B&&B.events.b4Drag){B.b4Drag(E);B.fireEvent("b4DragEvent",{e:E});}if(B&&B.events.drag){B.onDrag(E);B.fireEvent("dragEvent",{e:E});}if(B){this.fireEvents(E,false);}}this.stopEvent(E);}},fireEvents:function(U,K){var Z=this.dragCurrent;if(!Z||Z.isLocked()||Z.dragOnly){return ;}var M=YAHOO.util.Event.getPageX(U),L=YAHOO.util.Event.getPageY(U),O=new YAHOO.util.Point(M,L),J=Z.getTargetCoord(O.x,O.y),E=Z.getDragEl(),D=["out","over","drop","enter"],T=new YAHOO.util.Region(J.y,J.x+E.offsetWidth,J.y+E.offsetHeight,J.x),H=[],C={},P=[],a={outEvts:[],overEvts:[],dropEvts:[],enterEvts:[]};for(var R in this.dragOvers){var c=this.dragOvers[R];if(!this.isTypeOfDD(c)){continue;}if(!this.isOverTarget(O,c,this.mode,T)){a.outEvts.push(c);}H[R]=true;delete this.dragOvers[R];}for(var Q in Z.groups){if("string"!=typeof Q){continue;}for(R in this.ids[Q]){var F=this.ids[Q][R];if(!this.isTypeOfDD(F)){continue;}if(F.isTarget&&!F.isLocked()&&F!=Z){if(this.isOverTarget(O,F,this.mode,T)){C[Q]=true;if(K){a.dropEvts.push(F);}else{if(!H[F.id]){a.enterEvts.push(F);}else{a.overEvts.push(F);}this.dragOvers[F.id]=F;}}}}}this.interactionInfo={out:a.outEvts,enter:a.enterEvts,over:a.overEvts,drop:a.dropEvts,point:O,draggedRegion:T,sourceRegion:this.locationCache[Z.id],validDrop:K};for(var B in C){P.push(B);}if(K&&!a.dropEvts.length){this.interactionInfo.validDrop=false;if(Z.events.invalidDrop){Z.onInvalidDrop(U);Z.fireEvent("invalidDropEvent",{e:U});}}for(R=0;R<D.length;R++){var X=null;if(a[D[R]+"Evts"]){X=a[D[R]+"Evts"];}if(X&&X.length){var G=D[R].charAt(0).toUpperCase()+D[R].substr(1),W="onDrag"+G,I="b4Drag"+G,N="drag"+G+"Event",V="drag"+G;if(this.mode){if(Z.events[I]){Z[I](U,X,P);Z.fireEvent(I+"Event",{event:U,info:X,group:P});}if(Z.events[V]){Z[W](U,X,P);Z.fireEvent(N,{event:U,info:X,group:P});}}else{for(var Y=0,S=X.length;Y<S;++Y){if(Z.events[I]){Z[I](U,X[Y].id,P[0]);Z.fireEvent(I+"Event",{event:U,info:X[Y].id,group:P[0]});}if(Z.events[V]){Z[W](U,X[Y].id,P[0]);Z.fireEvent(N,{event:U,info:X[Y].id,group:P[0]});}}}}}},getBestMatch:function(D){var F=null;
var C=D.length;if(C==1){F=D[0];}else{for(var E=0;E<C;++E){var B=D[E];if(this.mode==this.INTERSECT&&B.cursorIsOver){F=B;break;}else{if(!F||!F.overlap||(B.overlap&&F.overlap.getArea()<B.overlap.getArea())){F=B;}}}}return F;},refreshCache:function(C){var E=C||this.ids;for(var B in E){if("string"!=typeof B){continue;}for(var D in this.ids[B]){var F=this.ids[B][D];if(this.isTypeOfDD(F)){var G=this.getLocation(F);if(G){this.locationCache[F.id]=G;}else{delete this.locationCache[F.id];}}}}},verifyEl:function(C){try{if(C){var B=C.offsetParent;if(B){return true;}}}catch(D){}return false;},getLocation:function(G){if(!this.isTypeOfDD(G)){return null;}var E=G.getEl(),J,D,C,L,K,M,B,I,F;try{J=YAHOO.util.Dom.getXY(E);}catch(H){}if(!J){return null;}D=J[0];C=D+E.offsetWidth;L=J[1];K=L+E.offsetHeight;M=L-G.padding[0];B=C+G.padding[1];I=K+G.padding[2];F=D-G.padding[3];return new YAHOO.util.Region(M,B,I,F);},isOverTarget:function(J,B,D,E){var F=this.locationCache[B.id];if(!F||!this.useCache){F=this.getLocation(B);this.locationCache[B.id]=F;}if(!F){return false;}B.cursorIsOver=F.contains(J);var I=this.dragCurrent;if(!I||(!D&&!I.constrainX&&!I.constrainY)){return B.cursorIsOver;}B.overlap=null;if(!E){var G=I.getTargetCoord(J.x,J.y);var C=I.getDragEl();E=new YAHOO.util.Region(G.y,G.x+C.offsetWidth,G.y+C.offsetHeight,G.x);}var H=E.intersect(F);if(H){B.overlap=H;return(D)?true:B.cursorIsOver;}else{return false;}},_onUnload:function(C,B){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);this.ids={};},elementCache:{},getElWrapper:function(C){var B=this.elementCache[C];if(!B||!B.el){B=this.elementCache[C]=new this.ElementWrapper(YAHOO.util.Dom.get(C));}return B;},getElement:function(B){return YAHOO.util.Dom.get(B);},getCss:function(C){var B=YAHOO.util.Dom.get(C);return(B)?B.style:null;},ElementWrapper:function(B){this.el=B||null;this.id=this.el&&B.id;this.css=this.el&&B.style;},getPosX:function(B){return YAHOO.util.Dom.getX(B);},getPosY:function(B){return YAHOO.util.Dom.getY(B);},swapNode:function(D,B){if(D.swapNode){D.swapNode(B);}else{var E=B.parentNode;var C=B.nextSibling;if(C==D){E.insertBefore(D,B);}else{if(B==D.nextSibling){E.insertBefore(B,D);}else{D.parentNode.replaceChild(B,D);E.insertBefore(D,C);}}}},getScroll:function(){var D,B,E=document.documentElement,C=document.body;if(E&&(E.scrollTop||E.scrollLeft)){D=E.scrollTop;B=E.scrollLeft;}else{if(C){D=C.scrollTop;B=C.scrollLeft;}else{}}return{top:D,left:B};},getStyle:function(C,B){return YAHOO.util.Dom.getStyle(C,B);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(B,D){var C=YAHOO.util.Dom.getXY(D);YAHOO.util.Dom.setXY(B,C);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(C,B){return(C-B);},_timeoutCount:0,_addListeners:function(){var B=YAHOO.util.DDM;if(YAHOO.util.Event&&document){B._onLoad();}else{if(B._timeoutCount>2000){}else{setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1;}}}},handleWasClicked:function(B,D){if(this.isHandle(D,B.id)){return true;}else{var C=B.parentNode;while(C){if(this.isHandle(D,C.id)){return true;}else{C=C.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,_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);},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(H,G){var D=H.which||H.button;if(this.primaryButtonOnly&&D>1){return ;}if(this.isLocked()){return ;}var C=this.b4MouseDown(H);if(this.events.b4MouseDown){C=this.fireEvent("b4MouseDownEvent",H);}var E=this.onMouseDown(H);if(this.events.mouseDown){E=this.fireEvent("mouseDownEvent",H);}if((C===false)||(E===false)){return ;}this.DDM.refreshCache(this.groups);var F=new YAHOO.util.Point(A.getPageX(H),A.getPageY(H));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(F,this)){}else{if(this.clickValidator(H)){this.setStartPosition();this.DDM.handleMouseDown(H,this);this.DDM.stopEvent(H);}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","about:blank");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.5.0",build:"895"});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(A&&YAHOO.lang.hasOwnProperty(B,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){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;E=((A.isString(E))?[E]:E)||this.getAttributeKeys();for(var D=0,B=E.length;D<B;++D){if(this._configs[E[D]]&&!A.isUndefined(this._configs[E[D]].value)&&!A.isNull(this._configs[E[D]].value)){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;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;this.get("element").insertBefore(G,H);},removeChild:function(G){G=G.get?G.get("element"):G;this.get("element").removeChild(G);return true;},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");I=I||this;H=this.get("id")||H;var G=this;if(!this._events[K]){if(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);}YAHOO.util.EventProvider.prototype.subscribe.apply(this,arguments);},on:function(){this.addListener.apply(this,arguments);},subscribe:function(){this.addListener.apply(this,arguments);},removeListener:function(H,G){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});},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(YAHOO.lang.isString(H)){C.call(this,"id",{value:G.element});}if(D.get(H)){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:G.element});},this,true);YAHOO.util.Event.onContentReady(G.element,function(){if(!I){B.call(this,G);}this.fireEvent("contentReady",{type:"contentReady",target: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){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.5.0",build:"895"});YAHOO.register("utilities", YAHOO, {version: "2.5.0", build: "895"});
(function() {
YAHOO.widget.TabView = function(el, attr) {
attr = attr || {};
if (arguments.length == 1 && !YAHOO.lang.isString(el) && !el.nodeName) {
attr = el; // treat first arg as attr object
el = attr.element || null;
}
if (!el && !attr.element) { // create if we dont have one
el = _createTabViewElement.call(this, attr);
}
YAHOO.widget.TabView.superclass.constructor.call(this, el, attr);
};
YAHOO.extend(YAHOO.widget.TabView, YAHOO.util.Element);
var proto = YAHOO.widget.TabView.prototype;
var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;
var Tab = YAHOO.widget.Tab;
proto.CLASSNAME = 'yui-navset';
proto.TAB_PARENT_CLASSNAME = 'yui-nav';
proto.CONTENT_PARENT_CLASSNAME = 'yui-content';
proto._tabParent = null;
proto._contentParent = null;
proto.addTab = function(tab, index) {
var tabs = this.get('tabs');
if (!tabs) { // not ready yet
this._queue[this._queue.length] = ['addTab', arguments];
return false;
}
index = (index === undefined) ? tabs.length : index;
var before = this.getTab(index);
var self = this;
var el = this.get('element');
var tabParent = this._tabParent;
var contentParent = this._contentParent;
var tabElement = tab.get('element');
var contentEl = tab.get('contentEl');
if ( before ) {
tabParent.insertBefore(tabElement, before.get('element'));
} else {
tabParent.appendChild(tabElement);
}
if ( contentEl && !Dom.isAncestor(contentParent, contentEl) ) {
contentParent.appendChild(contentEl);
}
if ( !tab.get('active') ) {
tab.set('contentVisible', false, true);
} else {
this.set('activeTab', tab, true);
}
var activate = function(e) {
YAHOO.util.Event.preventDefault(e);
var silent = false;
if (this == self.get('activeTab')) {
silent = true; // dont fire activeTabChange if already active
}
self.set('activeTab', this, silent);
};
tab.addListener( tab.get('activationEvent'), activate);
tab.addListener('activationEventChange', function(e) {
if (e.prevValue != e.newValue) {
tab.removeListener(e.prevValue, activate);
tab.addListener(e.newValue, activate);
}
});
tabs.splice(index, 0, tab);
};
proto.DOMEventHandler = function(e) {
var el = this.get('element');
var target = YAHOO.util.Event.getTarget(e);
var tabParent = this._tabParent;
if (Dom.isAncestor(tabParent, target) ) {
var tabEl;
var tab = null;
var contentEl;
var tabs = this.get('tabs');
for (var i = 0, len = tabs.length; i < len; i++) {
tabEl = tabs[i].get('element');
contentEl = tabs[i].get('contentEl');
if ( target == tabEl || Dom.isAncestor(tabEl, target) ) {
tab = tabs[i];
break; // note break
}
}
if (tab) {
tab.fireEvent(e.type, e);
}
}
};
proto.getTab = function(index) {
return this.get('tabs')[index];
};
proto.getTabIndex = function(tab) {
var index = null;
var tabs = this.get('tabs');
for (var i = 0, len = tabs.length; i < len; ++i) {
if (tab == tabs[i]) {
index = i;
break;
}
}
return index;
};
proto.removeTab = function(tab) {
var tabCount = this.get('tabs').length;
var index = this.getTabIndex(tab);
var nextIndex = index + 1;
if ( tab == this.get('activeTab') ) { // select next tab
if (tabCount > 1) {
if (index + 1 == tabCount) {
this.set('activeIndex', index - 1);
} else {
this.set('activeIndex', index + 1);
}
}
}
this._tabParent.removeChild( tab.get('element') );
this._contentParent.removeChild( tab.get('contentEl') );
this._configs.tabs.value.splice(index, 1);
};
proto.toString = function() {
var name = this.get('id') || this.get('tagName');
return "TabView " + name;
};
proto.contentTransition = function(newTab, oldTab) {
newTab.set('contentVisible', true);
oldTab.set('contentVisible', false);
};
proto.initAttributes = function(attr) {
YAHOO.widget.TabView.superclass.initAttributes.call(this, attr);
if (!attr.orientation) {
attr.orientation = 'top';
}
var el = this.get('element');
if (!YAHOO.util.Dom.hasClass(el, this.CLASSNAME)) {
YAHOO.util.Dom.addClass(el, this.CLASSNAME);
}
this.setAttributeConfig('tabs', {
value: [],
readOnly: true
});
this._tabParent =
this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,
'ul' )[0] || _createTabParent.call(this);
this._contentParent =
this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,
'div')[0] ||  _createContentParent.call(this);
this.setAttributeConfig('orientation', {
value: attr.orientation,
method: function(value) {
var current = this.get('orientation');
this.addClass('yui-navset-' + value);
if (current != value) {
this.removeClass('yui-navset-' + current);
}
switch(value) {
case 'bottom':
this.appendChild(this._tabParent);
break;
}
}
});
this.setAttributeConfig('activeIndex', {
value: attr.activeIndex,
method: function(value) {
this.set('activeTab', this.getTab(value));
},
validator: function(value) {
return !this.getTab(value).get('disabled'); // cannot activate if disabled
}
});
this.setAttributeConfig('activeTab', {
value: attr.activeTab,
method: function(tab) {
var activeTab = this.get('activeTab');
if (tab) {
tab.set('active', true);
this._configs['activeIndex'].value = this.getTabIndex(tab); // keep in sync
}
if (activeTab && activeTab != tab) {
activeTab.set('active', false);
}
if (activeTab && tab != activeTab) { // no transition if only 1
this.contentTransition(tab, activeTab);
} else if (tab) {
tab.set('contentVisible', true);
}
},
validator: function(value) {
return !value.get('disabled'); // cannot activate if disabled
}
});
if ( this._tabParent ) {
_initTabs.call(this);
}
this.DOM_EVENTS.submit = false;
this.DOM_EVENTS.focus = false;
this.DOM_EVENTS.blur = false;
for (var type in this.DOM_EVENTS) {
if ( YAHOO.lang.hasOwnProperty(this.DOM_EVENTS, type) ) {
this.addListener.call(this, type, this.DOMEventHandler);
}
}
};
var _initTabs = function() {
var tab,
attr,
contentEl;
var el = this.get('element');
var tabs = _getChildNodes(this._tabParent);
var contentElements = _getChildNodes(this._contentParent);
for (var i = 0, len = tabs.length; i < len; ++i) {
attr = {};
if (contentElements[i]) {
attr.contentEl = contentElements[i];
}
tab = new YAHOO.widget.Tab(tabs[i], attr);
this.addTab(tab);
if (tab.hasClass(tab.ACTIVE_CLASSNAME) ) {
this._configs.activeTab.value = tab; // dont invoke method
this._configs.activeIndex.value = this.getTabIndex(tab);
}
}
};
var _createTabViewElement = function(attr) {
var el = document.createElement('div');
if ( this.CLASSNAME ) {
el.className = this.CLASSNAME;
}
return el;
};
var _createTabParent = function(attr) {
var el = document.createElement('ul');
if ( this.TAB_PARENT_CLASSNAME ) {
el.className = this.TAB_PARENT_CLASSNAME;
}
this.get('element').appendChild(el);
return el;
};
var _createContentParent = function(attr) {
var el = document.createElement('div');
if ( this.CONTENT_PARENT_CLASSNAME ) {
el.className = this.CONTENT_PARENT_CLASSNAME;
}
this.get('element').appendChild(el);
return el;
};
var _getChildNodes = function(el) {
var nodes = [];
var childNodes = el.childNodes;
for (var i = 0, len = childNodes.length; i < len; ++i) {
if (childNodes[i].nodeType == 1) {
nodes[nodes.length] = childNodes[i];
}
}
return nodes;
};
})();
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
var Tab = function(el, attr) {
attr = attr || {};
if (arguments.length == 1 && !YAHOO.lang.isString(el) && !el.nodeName) {
attr = el;
el = attr.element;
}
if (!el && !attr.element) {
el = _createTabElement.call(this, attr);
}
this.loadHandler =  {
success: function(o) {
this.set('content', o.responseText);
},
failure: function(o) {
}
};
Tab.superclass.constructor.call(this, el, attr);
this.DOM_EVENTS = {}; // delegating to tabView
};
YAHOO.extend(Tab, YAHOO.util.Element);
var proto = Tab.prototype;
proto.LABEL_TAGNAME = 'em';
proto.ACTIVE_CLASSNAME = 'selected';
proto.DISABLED_CLASSNAME = 'disabled';
proto.LOADING_CLASSNAME = 'loading';
proto.dataConnection = null;
proto.loadHandler = null;
proto._loading = false;
proto.toString = function() {
var el = this.get('element');
var id = el.id || el.tagName;
return "Tab " + id;
};
proto.initAttributes = function(attr) {
attr = attr || {};
Tab.superclass.initAttributes.call(this, attr);
var el = this.get('element');
this.setAttributeConfig('activationEvent', {
value: attr.activationEvent || 'click'
});
this.setAttributeConfig('labelEl', {
value: attr.labelEl || _getlabelEl.call(this),
method: function(value) {
var current = this.get('labelEl');
if (current) {
if (current == value) {
return false; // already set
}
this.replaceChild(value, current);
} else if (el.firstChild) { // ensure label is firstChild by default
this.insertBefore(value, el.firstChild);
} else {
this.appendChild(value);
}
}
});
this.setAttributeConfig('label', {
value: attr.label || _getLabel.call(this),
method: function(value) {
var labelEl = this.get('labelEl');
if (!labelEl) { // create if needed
this.set('labelEl', _createlabelEl.call(this));
}
_setLabel.call(this, value);
}
});
this.setAttributeConfig('contentEl', {
value: attr.contentEl || document.createElement('div'),
method: function(value) {
var current = this.get('contentEl');
if (current) {
if (current == value) {
return false; // already set
}
this.replaceChild(value, current);
}
}
});
this.setAttributeConfig('content', {
value: attr.content,
method: function(value) {
this.get('contentEl').innerHTML = value;
}
});
var _dataLoaded = false;
this.setAttributeConfig('dataSrc', {
value: attr.dataSrc
});
this.setAttributeConfig('cacheData', {
value: attr.cacheData || false,
validator: YAHOO.lang.isBoolean
});
this.setAttributeConfig('loadMethod', {
value: attr.loadMethod || 'GET',
validator: YAHOO.lang.isString
});
this.setAttributeConfig('dataLoaded', {
value: false,
validator: YAHOO.lang.isBoolean,
writeOnce: true
});
this.setAttributeConfig('dataTimeout', {
value: attr.dataTimeout || null,
validator: YAHOO.lang.isNumber
});
this.setAttributeConfig('active', {
value: attr.active || this.hasClass(this.ACTIVE_CLASSNAME),
method: function(value) {
if (value === true) {
this.addClass(this.ACTIVE_CLASSNAME);
this.set('title', 'active');
} else {
this.removeClass(this.ACTIVE_CLASSNAME);
this.set('title', '');
}
},
validator: function(value) {
return YAHOO.lang.isBoolean(value) && !this.get('disabled') ;
}
});
this.setAttributeConfig('disabled', {
value: attr.disabled || this.hasClass(this.DISABLED_CLASSNAME),
method: function(value) {
if (value === true) {
Dom.addClass(this.get('element'), this.DISABLED_CLASSNAME);
} else {
Dom.removeClass(this.get('element'), this.DISABLED_CLASSNAME);
}
},
validator: YAHOO.lang.isBoolean
});
this.setAttributeConfig('href', {
value: attr.href ||
this.getElementsByTagName('a')[0].getAttribute('href', 2) || '#',
method: function(value) {
this.getElementsByTagName('a')[0].href = value;
},
validator: YAHOO.lang.isString
});
this.setAttributeConfig('contentVisible', {
value: attr.contentVisible,
method: function(value) {
if (value) {
this.get('contentEl').style.display = 'block';
if ( this.get('dataSrc') ) {
if ( !this._loading && !(this.get('dataLoaded') && this.get('cacheData')) ) {
_dataConnect.call(this);
}
}
} else {
this.get('contentEl').style.display = 'none';
}
},
validator: YAHOO.lang.isBoolean
});
};
var _createTabElement = function(attr) {
var el = document.createElement('li');
var a = document.createElement('a');
a.href = attr.href || '#';
el.appendChild(a);
var label = attr.label || null;
var labelEl = attr.labelEl || null;
if (labelEl) { // user supplied labelEl
if (!label) { // user supplied label
label = _getLabel.call(this, labelEl);
}
} else {
labelEl = _createlabelEl.call(this);
}
a.appendChild(labelEl);
return el;
};
var _getlabelEl = function() {
return this.getElementsByTagName(this.LABEL_TAGNAME)[0];
};
var _createlabelEl = function() {
var el = document.createElement(this.LABEL_TAGNAME);
return el;
};
var _setLabel = function(label) {
var el = this.get('labelEl');
el.innerHTML = label;
};
var _getLabel = function() {
var label,
el = this.get('labelEl');
if (!el) {
return undefined;
}
return el.innerHTML;
};
var _dataConnect = function() {
if (!YAHOO.util.Connect) {
return false;
}
Dom.addClass(this.get('contentEl').parentNode, this.LOADING_CLASSNAME);
this._loading = true;
this.dataConnection = YAHOO.util.Connect.asyncRequest(
this.get('loadMethod'),
this.get('dataSrc'),
{
success: function(o) {
this.loadHandler.success.call(this, o);
this.set('dataLoaded', true);
this.dataConnection = null;
Dom.removeClass(this.get('contentEl').parentNode,
this.LOADING_CLASSNAME);
this._loading = false;
},
failure: function(o) {
this.loadHandler.failure.call(this, o);
this.dataConnection = null;
Dom.removeClass(this.get('contentEl').parentNode,
this.LOADING_CLASSNAME);
this._loading = false;
},
scope: this,
timeout: this.get('dataTimeout')
}
);
};
YAHOO.widget.Tab = Tab;
})();
YAHOO.register("tabview", YAHOO.widget.TabView, {version: "2.3.0", build: "442"});
var eZFlowWidgets = {
personalized: false,
endDragHooks: new Array,
DomCacheArray: {},
addEndDragHook: function( f )
{
eZFlowWidgets.endDragHooks[ eZFlowWidgets.endDragHooks.length ] = f;
},
pause: function(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date();
} while(curDate-date < millis);
return null;
},
addStyleSheet: function( cssfile )
{
var head = document.getElementsByTagName('head');
if( head.length == 1 && head[0] )
{
var link = document.createElement('link');
link.rel = "stylesheet";
link.type = "text/css";
link.href = cssfile;
head[0].appendChild( link );
}
},
registerZone: function( id )
{
if( !eZFlowWidgets.personalized )
return false;
var zone = document.getElementById(id);
eZFlowWidgets.DomCacheRegister( zone );
new YAHOO.util.DDTarget( zone.id );
},
registerBlock: function( id )
{
if( !eZFlowWidgets.personalized )
return false;
var block = document.getElementById(id);
eZFlowWidgets.DomCacheRegister( block );
dd = new eZFlowWidgets.DDList( block.id );
drag_handlers = YAHOO.util.Dom.getElementsByClassName( 'block-drag-handle', 'div', eZFlowWidgets.DomCacheGet(block.id) );
for( j = 0; j < drag_handlers.length; j++ )
{
dd.setHandleElId( drag_handlers[j].id );
}
eZFlowWidgets.cacheBlockDom( eZFlowWidgets.DomCacheGet(block.id) );
},
init: function()
{
if( !eZFlowWidgets.personalized )
return false;
var zonesDiv = document.getElementById('ezpage-zones');
var blocks = YAHOO.util.Dom.getElementsByClassName( 'ezflow-block-address', 'div', zonesDiv );
var columns = YAHOO.util.Dom.getElementsByClassName( 'ezflow-zone-column', 'div', zonesDiv );
var i, dd;
for( i = 0; i < columns.length; i++ )
{
eZFlowWidgets.registerZone( columns[i].id );
}
eZFlowWidgets.DomCacheRegister( YAHOO.util.Dom.get('ezflow-ajax-loader-markup') );
var drag_handlers, config_panels, config_panel_ajax, blockIdData, block_id, instance_id, jsString;
for( i = 0, j = 0; i < blocks.length; i++ )
{
eZFlowWidgets.registerBlock( blocks[i].id );
}
var toggleDiv = YAHOO.util.Dom.get('ezpage-blocks-browse-toggle');
if( toggleDiv )
toggleDiv.onclick = eZFlowWidgets.toggleBrowseMode;
},
getEl: function(id)
{
return YAHOO.util.Dom.get( id );
},
toggleBrowseMode: function() {
var el = YAHOO.util.Dom.get('ezpage-blocks-browse');
var className = el.className;
if( className == 'hidden' )
{
el.className = '';
}
else {
el.className = 'hidden';
}
},
DomCacheRegister: function(el)
{
var key = el.id.replace('-', '_');
eZFlowWidgets.DomCacheArray[key] = el;
},
DomCacheGet: function(id)
{
var key = id.replace('-', '_');
if( eZFlowWidgets.DomCacheArray[key] == undefined )
return YAHOO.util.Dom.get( id );
return eZFlowWidgets.DomCacheArray[key];
},
ajaxLoadingMarkup: function( block_id, instance_id, zone_id )
{
var container = eZFlowWidgets.DomCacheGet('address-' + zone_id + '-' + block_id + '-' + instance_id);
var htmldiv = YAHOO.util.Dom.getElementsByClassName( 'block-content-toggle', 'div', container )[0];
var loadingDiv = eZFlowWidgets.DomCacheGet('ezflow-ajax-loader-markup');
htmldiv.innerHTML = loadingDiv.innerHTML;
},
toggleContent: function( zone_id, block_id, instance_id )
{
var toggler = eZFlowWidgets.DomCacheGet('toggler-' + block_id + '-' + instance_id);
if( toggler )
{
if( toggler.src )
{
if( toggler.src.indexOf('block_up.gif') == -1 )
{
toggler.src = toggler.src.replace('block_down.gif', 'block_up.gif');
}
else
{
toggler.src = toggler.src.replace('block_up.gif', 'block_down.gif');
}
}
else
{
if( toggler.className.indexOf('expand') == -1 )
{
toggler.className = toggler.className.replace('collapse', 'expand');
}
else
{
toggler.className = toggler.className.replace('expand', 'collapse');
}
}
}
var container = eZFlowWidgets.DomCacheGet('address-' + zone_id + '-' + block_id + '-' + instance_id);
var contents = YAHOO.util.Dom.getElementsByClassName( 'block-content-toggle', 'div', container );
for( var i = 0; i < contents.length; i++ )
{
if( contents[i].style.display == 'none' )
contents[i].style.display = 'block';
else
contents[i].style.display = 'none';
}
var uri = YAHOO.util.Dom.get('ezflow_toggleContentURI').value + '/' + zone_id + '/' + block_id + '/' + instance_id;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: eZFlowWidgets.toggleContentCallbacks.success, failure: eZFlowWidgets.toggleContentCallbacks.failure }, "" );
},
toggleConfig: function( zone_id, block_id, instance_id )
{
var configDiv = eZFlowWidgets.DomCacheGet('block-configuration-' + block_id + '-' + instance_id);
if( configDiv )
{
if(configDiv.className.indexOf('block-style-hidden') >= 0)
{
YAHOO.util.Dom.removeClass( configDiv, "block-style-hidden" );
}
else
{
YAHOO.util.Dom.addClass( configDiv, "block-style-hidden" );
}
}
},
toggleUWAConfig: function( block_id, instance_id )
{
var configDiv = eZFlowWidgets.DomCacheGet('uwa-config-' + block_id + '-' + instance_id);
if( configDiv )
{
if(configDiv.className.indexOf('block-style-hidden') >= 0)
{
YAHOO.util.Dom.removeClass( configDiv, "block-style-hidden" );
}
else
{
YAHOO.util.Dom.addClass( configDiv, "block-style-hidden" );
}
}
},
updateBlockTitle: function( block_id, instance_id, title )
{
var titleDiv = eZFlowWidgets.DomCacheGet('headertitle-' + block_id + '-' + instance_id);
if( titleDiv )
{
titleDiv.innerHTML = title;
}
},
storeConfig: function( zone_id, block_id, instance_id, mode )
{
var container = eZFlowWidgets.DomCacheGet('address-' + zone_id + '-' + block_id + '-' + instance_id);
var configClassName = 'block-user-config-item';
if( mode == 'uwa' )
configClassName = 'block-user-config-item-uwa';
var inputs = YAHOO.util.Dom.getElementsByClassName( configClassName, 'input', container );
var selects = YAHOO.util.Dom.getElementsByClassName( configClassName, 'select', container );
var i, l;
var ConfigNames = new Array;
var ConfigValues = new Array;
var configString = 'mode=store';
for( i = 0, l = inputs.length; i < l; i++ )
{
if( inputs[i].type == 'checkbox' )
{
if( inputs[i].checked )
inputs[i].value = "1";
else
inputs[i].value = "0";
}
configString += '&' + 'blockconfig[' + inputs[i].name + ']' + '=' + inputs[i].value;
if( inputs[i].name == 'title' )
eZFlowWidgets.updateBlockTitle( block_id, instance_id, inputs[i].value );
}
for( i = 0, l = selects.length; i < l; i++ )
{
configString += '&' + 'blockconfig[' + selects[i].name + ']' + '=' + selects[i].options[selects[i].selectedIndex].value;
}
var uri = YAHOO.util.Dom.get('ezflow_storeConfigURI').value + '/' + zone_id + '/' + block_id + '/' + instance_id;
var storeConfigLoader = eZFlowWidgets.DomCacheGet('block-config-store-loading-' + block_id + '-' + instance_id);
storeConfigLoader.style.display = "";
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: eZFlowWidgets.storeConfigCallbacks.success, failure: eZFlowWidgets.storeConfigCallbacks.failure }, configString );
eZFlowWidgets.toggleConfig( zone_id, block_id, instance_id );
},
updateBlockIndex: function(id, drop_zone, start, end)
{
var info = id.split("-");
var zone_id = info[1];
var block_id = info[2];
var instance_id = info[3];
var zone_info = drop_zone.split('-');
var new_zone_id = zone_info[1];
if( new_zone_id == 'undefined' || new_zone_id == undefined || typeof new_zone_id == undefined )
return false;
var uri = YAHOO.util.Dom.get('ezflow_updateBlockIndex').value;
uri = uri + '/' + new_zone_id + '/' + block_id + '/' + instance_id + '/' + start + '/' + end;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: eZFlowWidgets.updateBlockCallbacks.success, failure: eZFlowWidgets.updateBlockCallbacks.failure }, '' );
},
refreshBlock: function( zone_id, block_id, instance_id, offset )
{
offset = parseInt( offset );
eZFlowWidgets.ajaxLoadingMarkup( block_id, instance_id, zone_id );
var uri = YAHOO.util.Dom.get('ezflow_refreshURI').value + '/' + block_id + '/' + instance_id + '/json';
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: eZFlowWidgets.refreshCallbacks.success, failure: eZFlowWidgets.refreshCallbacks.failure }, 'block_offset=' + offset );
},
removeBlock: function( question, zone_id, block_id, instance_id )
{
if( confirm( question ) )
{
var container = eZFlowWidgets.DomCacheGet('address-' + zone_id + '-' + block_id + '-' + instance_id);
var p = container.parentNode;
p.removeChild( container );
var uri = YAHOO.util.Dom.get('ezflow_removeBlockURI').value + '/' + block_id + '/' + instance_id;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: eZFlowWidgets.removeCallbacks.success, failure: eZFlowWidgets.removeCallbacks.failure }, '' );
}
},
addBlock: function( block_id, question )
{
var zones = YAHOO.util.Dom.getElementsByClassName('ezflow-zone-column', 'div', document.body);
var zoneArray = new Array, temp;
var zoneCount = zones.length;
for( var i = 0; i < zoneCount; i++ )
{
temp = zones[i].id.split('-');
zoneArray[i] = temp[1];
}
question = question + ' (1-' + zoneCount + ')';
var zoneNumber = 1;
if( zoneNumber == undefined )
return null;
var zoneIndex = parseInt(zoneNumber)-1;
var zone_id = zoneArray[zoneIndex];
var elementId = 'ezpagezone-' + zone_id;
var uri = YAHOO.util.Dom.get('ezflow_addBlockURI').value + '/' + block_id + '/' + zone_id;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: eZFlowWidgets.addBlockCallbacks.success, failure: eZFlowWidgets.addBlockCallbacks.failure }, '' );
},
blockIcon: function(block_id, instance_id, src)
{
var blockicon = eZFlowWidgets.DomCacheGet('block-icon-' + block_id + '-' + instance_id);
if( blockicon )
{
blockicon.src = src;
blockicon.style.display = "";
}
},
cacheBlockDom: function(container)
{
var j;
var config_panels = YAHOO.util.Dom.getElementsByClassName( 'block-configuration-panel', 'div', container );
for( j = 0; j < config_panels.length; j++ )
{
eZFlowWidgets.DomCacheRegister( config_panels[j] );
}
var config_panels_uwa = YAHOO.util.Dom.getElementsByClassName( 'block-uwa-configuration-panel', 'div', container );
for( j = 0; j < config_panels_uwa.length; j++ )
{
eZFlowWidgets.DomCacheRegister( config_panels_uwa[j] );
}
var config_panel_ajax = YAHOO.util.Dom.getElementsByClassName( 'block-config-store-loading', 'div', container );
for( j = 0; j < config_panel_ajax.length; j++ )
{
eZFlowWidgets.DomCacheRegister( config_panel_ajax[j] );
}
var content_toggle = YAHOO.util.Dom.getElementsByClassName( 'block-content-toggle', 'div', container );
for( j = 0; j < content_toggle.length; j++ )
{
eZFlowWidgets.DomCacheRegister( content_toggle[j] );
}
var content_toggle_button = YAHOO.util.Dom.getElementsByClassName( 'button-content-toggler', 'input', container );
for( j = 0; j < content_toggle_button.length; j++ )
{
eZFlowWidgets.DomCacheRegister( content_toggle_button[j] );
}
var dyntabs = YAHOO.util.Dom.getElementsByClassName( 'block-dyntabs', 'div', container );
for( j = 0; j < dyntabs.length; j++ )
{
eZFlowWidgets.DomCacheRegister( dyntabs[j] );
}
var title = YAHOO.util.Dom.getElementsByClassName( 'block-header-title', 'div', container );
if( title.length == 1 )
eZFlowWidgets.DomCacheRegister( title[0] );
var blockicon = YAHOO.util.Dom.getElementsByClassName( 'block-icon', 'img', container );
if( blockicon.length == 1 )
eZFlowWidgets.DomCacheRegister( blockicon[0] );
eZFlowWidgets.DomCacheRegister( container );
}
};
eZFlowWidgets.refreshCallbacks = {
success: function(o)
{
var json = eval( '(' + o.responseText + ')' );
if( json )
{
var block_id = json.id;
var zone_id = json.zone_id;
var instance_id = json.instance_id;
var html = json.html;
var container = eZFlowWidgets.DomCacheGet('address-' + zone_id + '-' + block_id + '-' + instance_id);
var htmldiv = eZFlowWidgets.DomCacheGet('main-content-' + block_id + '-' + instance_id);
htmldiv.innerHTML = html;
eZFlowWidgets.cacheBlockDom( htmldiv );
eZFlowWidgets.pause(100);
if( json.javascripts.length > 0 )
{
for( var i = 0; i < json.javascripts.length; i++ )
{
jscript = eval( '(' + json.javascripts[i] + ')();' );
}
}
}
},
failure: function(o)
{
}
};
eZFlowWidgets.storeConfigCallbacks = {
success: function(o)
{
if(o.responseText !== undefined){
var info = o.responseText.split('-');
var block_id = info[0];
var instance_id = info[1];
var zone_id = info[2];
var storeConfigLoader = eZFlowWidgets.DomCacheGet('block-config-store-loading-' + block_id + '-' + instance_id);
storeConfigLoader.style.display = "none";
eZFlowWidgets.refreshBlock( zone_id, block_id, instance_id, 0 );
}
},
failure: function(o)
{
}
};
eZFlowWidgets.addBlockCallbacks = {
success: function(o)
{
var json = eval( '(' + o.responseText + ')' );
if( json )
{
if(json.success == "true")
{
var zone = YAHOO.util.Dom.get('ezpagezone-' + json.zone_id), jscript;
if( zone )
{
zone.innerHTML = json.html + zone.innerHTML;
eZFlowWidgets.pause(100);
eZFlowWidgets.init();
if( json.javascripts.length > 0 )
{
for( var i = 0; i < json.javascripts.length; i++ )
{
jscript = eval( '(' + json.javascripts[i] + ')();' );
}
}
}
}
}
},
failure: function(o)
{
}
};
eZFlowWidgets.updateBlockCallbacks = {
success: function(o)
{
},
failure: function(o)
{
}
};
eZFlowWidgets.toggleContentCallbacks = {
success: function(o)
{
},
failure: function(o)
{
}
};
eZFlowWidgets.removeCallbacks = {
success: function(o)
{
},
failure: function(o)
{
}
};
eZFlowWidgets.DDList = function(id, sGroup, config) {
eZFlowWidgets.DDList.superclass.constructor.call(this, id, sGroup, config);
this.logger = this.logger || YAHOO;
var el = this.getDragEl();
YAHOO.util.Dom.setStyle(el, "opacity", 0.88); // The proxy is slightly transparent
this.goingUp = false;
this.lastY = 0;
};
var dragStartIndex = false;
var dragEndIndex = false;
YAHOO.extend(eZFlowWidgets.DDList, YAHOO.util.DDProxy, {
lastEl: '',
startParent: false,
startX: 0,
startY: 0,
getIndex: function(srcEl, parent)
{
var blocks = YAHOO.util.Dom.getElementsByClassName( 'ezflow-block', 'div', parent );
for( var i = 0, l = blocks.length; i < l; i++ )
{
if( blocks[i].id == srcEl.id )
return (i+1);
}
},
startDrag: function(x, y) {
this.logger.log(this.id + " startDrag");
this.startX = x;
this.startY = y;
var dragEl = this.getDragEl();
var clickEl = this.getEl();
if( dragStartIndex == false )
dragStartIndex = this.getIndex(clickEl, clickEl.parentNode);
YAHOO.util.Dom.addClass( clickEl, "ezflow-block-address-hidden" );
dragEl.innerHTML = clickEl.innerHTML;
YAHOO.util.Dom.setStyle(dragEl, "color", YAHOO.util.Dom.getStyle(clickEl, "color"));
YAHOO.util.Dom.setStyle(dragEl, "backgroundColor", YAHOO.util.Dom.getStyle(clickEl, "backgroundColor"));
YAHOO.util.Dom.setStyle(dragEl, "border", "2px solid gray");
YAHOO.util.Dom.addClass( dragEl, "ezflow-drag-ghost" );
},
endDrag: function(e) {
var srcEl = this.getEl();
var proxy = this.getDragEl();
YAHOO.util.Dom.setStyle(proxy, "visibility", "");
var a = new YAHOO.util.Motion(
proxy, {
points: {
to: YAHOO.util.Dom.getXY(srcEl)
}
},
0.03,
YAHOO.util.Easing.easeOut
)
var proxyid = proxy.id;
var thisid = srcEl.id;
a.onComplete.subscribe(function() {
YAHOO.util.Dom.setStyle(proxyid, "visibility", "hidden");
YAHOO.util.Dom.setStyle(thisid, "visibility", "");
YAHOO.util.Dom.removeClass( srcEl, "ezflow-block-address-hidden" );
});
a.animate();
dragEndIndex = this.getIndex(srcEl, srcEl.parentNode);
eZFlowWidgets.updateBlockIndex(srcEl.id, srcEl.parentNode.id, dragStartIndex, dragEndIndex);
for( var i = 0; i < eZFlowWidgets.endDragHooks.length; i++ )
{
if( typeof eZFlowWidgets.endDragHooks[i] == 'function' )
eZFlowWidgets.endDragHooks[i]( srcEl );
}
},
onDragDrop: function(e, id) {
var y = YAHOO.util.Event.getPageY(e);
var x = YAHOO.util.Event.getPageX(e);
var th = 50;
var tw = 30;
var diff = this.startY - y;
var diffX = this.startX - x;
if( (diffX >= 0 && diffX <= tw) && (diffX < 0 && diffX >= (tw*-1)) )
{
if( diff >= 0 && diff <= th )
return false;
if( diff < 0 && diff >= (th*-1) )
return false;
}
if (YAHOO.util.DragDropMgr.interactionInfo.drop.length === 1) {
var pt = YAHOO.util.DragDropMgr.interactionInfo.point;
var region = YAHOO.util.DragDropMgr.interactionInfo.sourceRegion;
if (region.intersect(pt)) {
var destEl = eZFlowWidgets.DomCacheGet( id );
var destDD = YAHOO.util.DragDropMgr.getDDById(id);
destEl.appendChild(this.getEl());
destDD.isEmpty = false;
YAHOO.util.DragDropMgr.refreshCache();
}
}
},
onDrag: function(e) {
var y = YAHOO.util.Event.getPageY(e);
if (y < this.lastY) {
this.goingUp = true;
} else if (y > this.lastY) {
this.goingUp = false;
}
this.lastY = y;
},
onDragOver: function(e, id) {
var y = YAHOO.util.Event.getPageY(e);
var x = YAHOO.util.Event.getPageX(e);
var th = 50;
var tw = 30;
var diff = this.startY - y;
var diffX = this.startX - x;
if( (diffX >= 0 && diffX <= tw) && (diffX < 0 && diffX >= (tw*-1)) )
{
if( diff >= 0 && diff <= th )
return false;
if( diff < 0 && diff >= (th*-1) )
return false;
}
var srcEl = this.getEl();
var destEl = eZFlowWidgets.DomCacheGet( id );
if(destEl.nodeName.toLowerCase() == "div" && destEl.className.indexOf("ezflow-zone-column") >= 0 && this.lastEl != destEl)
{
if( YAHOO.util.Dom.getElementsByClassName( 'ezflow-block-address', 'div', destEl ).length == 0 )
{
destEl.insertBefore(srcEl, destEl.firstChild);
}
else
{
destEl.appendChild(srcEl); // insert above
}
this.lastEl = destEl;
}
else if (destEl.nodeName.toLowerCase() == "div" && destEl.className.indexOf("ezflow-block-address") >= 0) {
if (this.goingUp) {
destEl.parentNode.insertBefore(srcEl, destEl); // insert above
} else {
destEl.parentNode.insertBefore(srcEl, destEl.nextSibling); // insert below
}
}
}
});
YAHOO.util.Event.onDOMReady(eZFlowWidgets.init);
var ezkeywordmanager = {
isInit: false,
rootUrl: false,
editClassID: '',
ezInputKeywordTimeout: false,
ezKeywordDropdown: 0,
ezKeywordIndex: 0,
ezKeywordDropdownLI: 0,
ezKeywordDropdownIndex: 0,
ezInputKeyword: false,
bannedKeywords: false,
init: function()
{
if( ezkeywordmanager.isInit == true )
return;
ezkeywordmanager.isInit = true;
var w = window;
if ( w.addEventListener )
w.addEventListener( 'load', ezkeywordmanager.onload, false );
else if ( w.attachEvent )
w.attachEvent( 'onload', ezkeywordmanager.onload );
else
{
var c = w['on' + trigger];
w['on' + trigger] = typeof c !== 'function' ? ezkeywordmanager.onload : function(){ ezkeywordmanager.onload(); c()};
}
},
onload: function()
{
var ezInputKeyword = YAHOO.util.Dom.getElementsByClassName('ezcca-edit-keyword', 'input', document.body);
if (ezInputKeyword.length > 0)
{
newDiv = document.createElement("div");
newDiv.id = 'ez_keyword_dropdown';
newDiv.style.display = 'none';
ezkeywordmanager.ezKeywordDropdown = newDiv;
ezkeywordmanager.ezInputKeyword = ezInputKeyword;
document.body.appendChild(ezkeywordmanager.ezKeywordDropdown);
var tempForm = document.getElementById('editform');
if (tempForm)
{
tempForm.onsubmit = ezkeywordmanager.onSubmit;
}
for( var i = 0; i < ezInputKeyword.length; i++ )
{
YAHOO.util.Event.addListener( ezInputKeyword[i].id, 'keydown', ezkeywordmanager.ezInputKeywordPress, ezInputKeyword[i]);
YAHOO.util.Event.addListener( ezInputKeyword[i].id, 'blur', function() { ezkeywordmanager.ezKeywordDropdownLI = 0; ezkeywordmanager.ezKeywordDropdown.style.display = "none";  });
}
}
},
onSubmit: function()
{
if( typeof ezkeywordmanager.bannedKeywords == 'object' )
{
var keywords, i, j, k, keywordA, keywordB;
for(i = 0; i < ezkeywordmanager.bannedKeywords.length; i++)
{
for( j = 0; j < ezkeywordmanager.ezInputKeyword.length; j++ )
{
keywords = ezkeywordmanager.ezInputKeyword[j].value.split(',');
for( k = 0; k < keywords.length; k++ )
{
keywordA = keywords[k].toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '');
keywordB = ezkeywordmanager.bannedKeywords[i].banned_keyword.toLowerCase().replace(/^\s\s*/, '').replace(/\s\s*$/, '');
if( keywordA == keywordB )
{
ezkeywordmanager.alertBannedKeyword(keywordA);
return false;
}
}
}
}
}
if (ezkeywordmanager.ezKeywordDropdownLI != 0)
return false;
else
return true;
},
alertBannedKeyword: function(keyword)
{
var div = document.getElementById('banned-keyword-warning');
var span = document.getElementById('banned-keyword-string');
if( div && span )
{
span.innerHTML = keyword;
div.style.display = "";
}
},
ezInputKeywordPress: function(e, el)
{
var i = 0;
clearTimeout(ezkeywordmanager.ezInputKeywordTimeout);
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
var c = e.keyCode || e.which;
var keyword = el.value.split(',').pop().replace(/^\s\s*/, '').replace(/\s\s*$/, '');
if (c == 44 || c == 8 || c == 188 || c == 32 || keyword.length < 1) return true;
else if ((c == 38 || c == 40) && ezkeywordmanager.ezKeywordDropdownLI != 0) return ezkeywordmanager.ezInputKeywordSelect(c);
else if (c == 13) return ezkeywordmanager.ezInputKeywordEnter(el);
ezkeywordmanager.ezKeywordDropdown.style.display = "none";
ezkeywordmanager.ezKeywordIndex = i;
ezkeywordmanager.ezInputKeywordTimeout = setTimeout( 'ezkeywordmanager.getKeywords(\'' + keyword + String.fromCharCode(c) + '\')', ((c == 46) ? 350 : 230));
return true;
},
getKeywords: function(keyword)
{
var uri = ezkeywordmanager.rootUrl + '/keyword/' + ezkeywordmanager.editClassID;
var params = 'Keyword=' + keyword;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: ezkeywordmanager.getKeywordsCallbacks.success, failure: ezkeywordmanager.getKeywordsCallbacks.failure }, params );
},
ezInputKeywordMouse: function(el)
{
for( i = 0; i < ezkeywordmanager.ezKeywordDropdownLI.length; i++ )
{
if( ezkeywordmanager.ezKeywordDropdownLI[i] == el )
{
ezkeywordmanager.ezKeywordDropdownIndex = i+1;
}
}
if(ezkeywordmanager.ezKeywordDropdownIndex > 0)
YAHOO.util.Dom.addClass( ezkeywordmanager.ezKeywordDropdownLI[ezkeywordmanager.ezKeywordDropdownIndex-1], "selected" );
else
{
for( var j = 0; j < ezkeywordmanager.ezKeywordDropdownLI.length; j++ )
{
YAHOO.util.Dom.removeClass( ezkeywordmanager.ezKeywordDropdownLI[j], "selected" );
}
}
return false;
},
ezInputKeywordSelect: function(c, i)
{
i = ezkeywordmanager.ezKeywordDropdownIndex;
ezkeywordmanager.ezKeywordDropdownIndex = i = (i < 0) ? 0 : i + c - 39;
ezkeywordmanager.ezKeywordDropdownIndex = i = (ezkeywordmanager.ezKeywordDropdownLI.length <= i) ? ezkeywordmanager.ezKeywordDropdownLI.length : i;
if(i > 0)
YAHOO.util.Dom.addClass( ezkeywordmanager.ezKeywordDropdownLI[i-1], "selected" );
else
{
for( var j = 0; j < ezkeywordmanager.ezKeywordDropdownLI.length; j++ )
{
YAHOO.util.Dom.removeClass( ezkeywordmanager.ezKeywordDropdownLI[j], "selected" );
}
}
return false;
},
ezInputKeywordEnter: function(el)
{
if (ezkeywordmanager.ezKeywordDropdownLI != 0 && ezkeywordmanager.ezKeywordDropdownIndex > 0)
{
var arr = el.value.split(',');
arr[arr.length -1] = ' ' + ezkeywordmanager.ezKeywordDropdownLI[ezkeywordmanager.ezKeywordDropdownIndex-1].innerHTML;
el.value = arr.join(',').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
el.focus();
}
ezkeywordmanager.ezKeywordDropdownIndex = 0;
ezkeywordmanager.ezKeywordDropdown.style.display = "none";
return false;
},
confirmRemove: function(str)
{
return confirm(str);
},
showAddForm: function()
{
var div = document.getElementById('ezkeywordmanager-addbannedword');
var button = document.getElementById('ezkeywordmanager-showbannedform-button');
div.style.display = "";
button.style.display = "none";
},
close: function()
{
document.getElementById('ezkeyword-change-form').style.display = "none";
},
confirm: function(str)
{
var count = document.getElementById('ezkeywordmanager-entries').value;
str = str.replace('%count', count);
var old_keyword = document.getElementById('ezkeywordmanager-keyword').value;
str = str.replace('%old', old_keyword);
var new_keyword = document.getElementById('ezkeywordmanager-keyword-new').value;
str = str.replace('%new', new_keyword);
return confirm(str);
},
toggleObjects: function(index)
{
var div = document.getElementById('ezkeywordmanager-objects-' + index);
if( div.style.display == "none" )
div.style.display = "";
else
div.style.display = "none";
},
clickCheckbox: function(index, inverse)
{
var inputs = document.getElementsByTagName('input');
var valid_inputs = new Array, j = 0;
for(var i = 0; i < inputs.length; i++)
{
if( inputs[i].className == 'ezkeywordmanager-keyword-checkbox' )
{
valid_inputs[j] = inputs[i];
j++;
}
}
if( inverse )
{
if( valid_inputs[index].checked )
valid_inputs[index].checked = true;
else
valid_inputs[index].checked = false;
}
else
{
if( valid_inputs[index].checked )
valid_inputs[index].checked = false;
else
valid_inputs[index].checked = true;
}
ezkeywordmanager.updateKeywords();
},
change: function(keyword, count)
{
document.getElementById('ezkeywordmanager-keyword').value = keyword;
document.getElementById('ezkeywordmanager-keyword-old').value = keyword;
document.getElementById('ezkeywordmanager-keyword-new').value = keyword;
document.getElementById('ezkeywordmanager-entries').value = count;
document.getElementById('ezkeyword-change-form').style.display = "";
},
updateKeywords: function()
{
var inputs = document.getElementsByTagName('input');
var keywords = new Array, countArray = new Array, j = 0, tmp;
var count = 0;
for(var i = 0; i < inputs.length; i++)
{
if( inputs[i].className == 'ezkeywordmanager-keyword-checkbox' )
{
if(inputs[i].checked)
{
tmp = inputs[i].value.split(',');
keywords[j] = tmp[0];
count += parseInt(tmp[1]);
j++;
}
}
}
document.getElementById('ezkeywordmanager-keyword').value = keywords.join(',');
document.getElementById('ezkeywordmanager-keyword-old').value = keywords.join(',');
document.getElementById('ezkeywordmanager-keyword-new').value = keywords[0];
document.getElementById('ezkeywordmanager-entries').value = count;
document.getElementById('ezkeyword-change-form').style.display = "";
},
calculatePos: function(el)
{
if ( !el ) el = (document.body.clientWidth && !window.opera)? document.body : document.documentElement;
var oW = el.offsetWidth, oH = el.offsetHeight, sW = el.scrollWidth, sH = el.scrollHeight;
var pT = 0, pL = 0, t = -1, o = el, s = {sl:0,st:0};
if ( el.style.display == 'none' ) el.style.display = "";
do{	pT = pT + el.offsetTop || 0;
pL = pL + el.offsetLeft || 0;
el = el.offsetParent;
} while (el);
if (t != -1) el.style.display = "none";
return { pl: pL, pt: pT, ow: oW, oh: oH, sw: sW, sh: sH };
}
};
ezkeywordmanager.getKeywordsCallbacks = {
success: function(o) {
ezkeywordmanager.ezKeywordDropdown.innerHTML = o.responseText;
var li = ezkeywordmanager.ezKeywordDropdown.getElementsByTagName('li');
for(var i = 0; i < li.length; i++)
{
li[i].style.display = "";
}
ezkeywordmanager.ezKeywordDropdownLI = li;
var pos = ezkeywordmanager.calculatePos( ezkeywordmanager.ezInputKeyword[0] );
ezkeywordmanager.ezKeywordDropdown.style.display = "";
ezkeywordmanager.ezKeywordDropdown.style.top   = pos.pt + pos.oh + 'px';
ezkeywordmanager.ezKeywordDropdown.style.left  = pos.pl + 'px';
ezkeywordmanager.ezKeywordDropdown.style.width = pos.ow + 'px';
},
failure: function(o) {
}
};
YAHOO.util.Event.onDOMReady(ezkeywordmanager.init);
YAHOO.namespace("util");
YAHOO.util.Cookie = {
_createCookieString : function (name, value, encodeValue, options) {
var lang = YAHOO.lang;
var text = encodeURIComponent(name) + "=" + (encodeValue ? encodeURIComponent(value) : value);
if (lang.isObject(options)){
if (options.expires instanceof Date){
text += "; expires=" + options.expires.toGMTString();
}
if (lang.isString(options.path) && options.path != ""){
text += "; path=" + options.path;
}
if (lang.isString(options.domain) && options.domain != ""){
text += "; domain=" + options.domain;
}
if (options.secure === true){
text += "; secure";
}
}
return text;
},
_createCookieHashString : function (hash) {
var lang = YAHOO.lang;
if (!lang.isObject(hash)){
throw new TypeError("Cookie._createCookieHashString(): Argument must be an object.");
}
var text = new Array();
for (var key in hash){
if (lang.hasOwnProperty(hash, key) && !lang.isFunction(hash[key]) && !lang.isUndefined(hash[key])){
text.push(encodeURIComponent(key) + "=" + encodeURIComponent(String(hash[key])));
}
}
return text.join("&");
},
_parseCookieHash : function (text) {
var hashParts = text.split("&");
var hashPart = null;
var hash = new Object();
for (var i=0, len=hashParts.length; i < len; i++){
hashPart = hashParts[i].split("=");
hash[hashPart[0]] = hashPart[1];
}
return hash;
},
_parseCookieString : function (text) {
var cookies = new Object();
if (YAHOO.lang.isString(text) && text.length > 0) {
if (/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(text)){
var cookieParts = text.split(/;\s/g);
var cookieName = null;
var cookieValue = null;
for (var z=0, len=cookieParts.length; z < len; z++){
var matchRes = cookieParts[z].match(/([a-z]+)=/i);
if( matchRes && matchRes[1] )
{
cookieName = decodeURIComponent(cookieParts[z].match(/([a-z]+)=/i)[1]);
cookieValue = decodeURIComponent(cookieParts[z].substring(cookieName.length+1));
cookies[cookieName] = cookieValue;
}
}
}
}
return cookies;
},
get : function (name, converter){
var lang = YAHOO.lang;
var cookies = this._parseCookieString(document.cookie);
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");
}
if (lang.isUndefined(cookies[name])) {
return null;
}
if (!lang.isFunction(converter)){
return cookies[name];
} else {
return converter(cookies[name]);
}
},
getSub : function (name, subName, converter) {
var lang = YAHOO.lang;
var hash = this.getSubs(name);
if (hash !== null) {
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.getSub(): Subcookie name must be a non-empty string.");
}
if (lang.isUndefined(hash[subName])){
return null;
}
if (!lang.isFunction(converter)){
return hash[subName];
} else {
return converter(hash[subName]);
}
} else {
return null;
}
},
getSubs : function (name) {
return this.get(name, this._parseCookieHash);
},
remove : function (name, options) {
if (!YAHOO.lang.isString(name) || name === ""){
throw new TypeError("Cookie.remove(): Cookie name must be a non-empty string.");
}
options = options || {};
options.expires = new Date(0);
return this.set(name, "", options);
},
set : function (name, value, options) {
var lang = YAHOO.lang;
if (!lang.isString(name)){
throw new TypeError("Cookie.set(): Cookie name must be a string.");
}
if (lang.isUndefined(value)){
throw new TypeError("Cookie.set(): Value cannot be undefined.");
}
var text = this._createCookieString(name, value, true, options);
document.cookie = text;
return text;
},
setSub : function (name, subName, value, options) {
var lang = YAHOO.lang;
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.setSub(): Cookie name must be a non-empty string.");
}
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.setSub(): Subcookie name must be a non-empty string.");
}
if (lang.isUndefined(value)){
throw new TypeError("Cookie.setSub(): Subcookie value cannot be undefined.");
}
var hash = this.getSubs(name);
if (!lang.isObject(hash)){
hash = new Object();
}
hash[subName] = value;
return this.setSubs(name, hash, options);
},
setSubs : function (name, value, options) {
var lang = YAHOO.lang;
if (!lang.isString(name)){
throw new TypeError("Cookie.setSubs(): Cookie name must be a string.");
}
if (!lang.isObject(value)){
throw new TypeError("Cookie.setSubs(): Cookie value must be an object.");
}
var text = this._createCookieString(name, this._createCookieHashString(value), false, options);
document.cookie = text;
return text;
}
};
YAHOO.register("cookie", YAHOO.util.Cookie, {version: "2.5.0", build: "895"});
var UNGweb = {
ratingInProgress: false,
specialResizeHandling: false,
twitterUpdateURI: "",
friendPopupURI: "",
tickerItemArray: new Array,
currentTickerIndex: 0,
tickerIsActive: true,
lastRequestedURI: "/",
printerUpload: function()
{
var file = document.getElementById('print_file').value;
if (!file || (file.lastIndexOf(".ps") == -1 && file.lastIndexOf(".txt") == -1)) {
alert('Berre filer av typen .ps og .txt kan sendes til utskrift via utskriftswidgeten!');
return false;
}
var f = document.getElementById('printerwidget-upload-form');
var d = document.getElementById('printerwidget-upload-loading-text');
if( f ) f.style.diplay = "none";
if( d ) d.style.display = "";
},
printerUploadComplete: function()
{
var f = document.getElementById('printerwidget-upload-form');
var d = document.getElementById('printerwidget-upload-loading-text');
if( f ) f.style.diplay = "";
if( d ) d.style.display = "none";
},
printerDelete: function()
{
var f = document.getElementById('printerwidget-delete-form');
var d = document.getElementById('printerwidget-delete-loading-text');
if( f ) f.style.diplay = "none";
if( d ) d.style.display = "";
},
printerDeleteComplete: function()
{
var f = document.getElementById('printerwidget-delete-form');
var d = document.getElementById('printerwidget-delete-loading-text');
if( f ) f.style.diplay = "none";
if( d ) d.style.display = "";
},
addBoxClass: function( block_id, instance_id, newClass )
{
var div = document.getElementById('box-' + block_id + '-' + instance_id);
if( div )
{
div.className = div.className + " " + newClass;
}
},
friendAction: function( action, id )
{
var actionForm = document.getElementById('friend_' + action);
if( actionForm )
{
actionForm.action = actionForm.action + "/" + id;
actionForm.submit();
}
},
friendPopup: function( user_id )
{
var h = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight);
var w = (typeof window.innerWidth != 'undefined' ? window.innerWidth : document.body.offsetWidth);
var popW = 600;
var popH = 330;
var oW = (w / 2) - (popW / 2);
var oH = (h / 2) - (popH / 2);
var wPop = window.open( UNGweb.friendPopupURI + "/" + user_id, "friendpopup", "status=1,toolbar=0,scrollbars=0,resizable=0,location=0,height=" + popH + ",width=" + popW );
wPop.moveTo(oW,oH);
wPop.focus();
},
myProfileTwitterEdit: function(mode)
{
var twText = document.getElementById('my_profile_twitter_text');
var twEdit = document.getElementById('my_profile_twitter_edit');
if( twText && twEdit )
{
if( mode == 'show' )
{
twText.style.display = "none";
twEdit.style.display = "";
}
else
{
twText.style.display = "";
twEdit.style.display = "none";
var twTextEdit = document.getElementById('my_profile_twitter_edit_textarea');
twText.innerHTML = twTextEdit.value;
UNGweb.storeTwitter(twTextEdit.value);
}
}
},
voidCallback: function( o )
{
},
storeTwitter: function(twitterValue)
{
YAHOO.util.Connect.asyncRequest( 'post', UNGweb.twitterUpdateURI, { success: UNGweb.voidCallback, failure: UNGweb.voidCallback }, "twitterText=" + twitterValue );
},
init: function()
{
if( eZFlowWidgets.personalized )
{
UNGweb.resizeCols();
eZFlowWidgets.addEndDragHook( UNGweb.resizeCols );
eZFlowWidgets.addEndDragHook( UNGweb.tabsSizeFix );
}
UNGweb.initTicker();
},
initTicker: function()
{
var tickerItem = document.getElementById('latest-ticker-item');
if( tickerItem && UNGweb.tickerItemArray.length > 0 )
{
tickerItem.onmouseover = UNGweb.haltTicker;
tickerItem.onmouseout = UNGweb.startTicker;
UNGweb.updateTicker();
}
},
haltTicker: function()
{
UNGweb.tickerIsActive = false;
},
startTicker: function()
{
UNGweb.tickerIsActive = true;
},
updateTicker: function()
{
var index = UNGweb.currentTickerIndex;
var tickerItem = document.getElementById('latest-ticker-item');
var cfg;
if( UNGweb.tickerIsActive && tickerItem && UNGweb.tickerItemArray[ index ] )
{
cfg = UNGweb.tickerItemArray[ index ];
var hideAnim = new YAHOO.util.Anim(tickerItem, { opacity: { from: 1, to: 0 } }, 1, YAHOO.util.Easing.easeOut);
hideAnim.onComplete.subscribe(function() {
tickerItem.href = cfg.href;
tickerItem.innerHTML = cfg.innerHTML;
if( cfg.popup == '1' )
tickerItem.target = "_blank";
else
tickerItem.target = "_self";
var showAnim = new YAHOO.util.Anim(tickerItem, { opacity: { from: 0, to: 1 } }, 1, YAHOO.util.Easing.easeOut);
showAnim.animate();
});
hideAnim.animate();
}
UNGweb.currentTickerIndex = index + 1;
if( UNGweb.currentTickerIndex > UNGweb.tickerItemArray.length - 1 )
UNGweb.currentTickerIndex = 0;
setTimeout( 'UNGweb.updateTicker();', 7000 );
},
addTickerItem: function( cfg )
{
UNGweb.tickerItemArray[ UNGweb.tickerItemArray.length ] = cfg;
},
selectLayout: function( layout )
{
var layoutForm = document.getElementById('mypage_select_layout');
var selectedLayout = document.getElementById('mypage_select_layout_allowed_type');
if( layoutForm && selectedLayout )
{
selectedLayout.value = layout;
layoutForm.submit();
}
},
selectTheme: function( theme )
{
var themeForm = document.getElementById('mypage_select_theme');
var selectedTheme = document.getElementById('mypage_selected_theme');
if( themeForm && selectedTheme )
{
selectedTheme.value = theme;
themeForm.submit();
}
},
tabsSizeFix: function( srcEl )
{
var tabs = YAHOO.util.Dom.getElementsByClassName( 'block-dyntabs', 'div', srcEl );
var tabButtons = YAHOO.util.Dom.getElementsByClassName( 'widget-tab-select', 'a', srcEl );
if( tabs.length > 0 )
{
var width = UNGweb.getElementWidth( srcEl );
var tablength = 121;
var totalLength = parseInt( tablength * parseInt(tabButtons.length) );
if( width <= ( totalLength - 10 ) )
{
var hideClass = 'mainmenus-tabs';
var showClass = 'mainmenus-select';
}
else
{
var hideClass = 'mainmenus-select';
var showClass = 'mainmenus-tabs';
}
var showDiv = YAHOO.util.Dom.getElementsByClassName( showClass, 'div', srcEl );
var hideDiv = YAHOO.util.Dom.getElementsByClassName( hideClass, 'div', srcEl );
if( showDiv.length )
showDiv[0].style.display = '';
if( hideDiv.length )
hideDiv[0].style.display = 'none';
}
},
blockIconClass: function( block_id, instance_id, className )
{
var blockicon = eZFlowWidgets.DomCacheGet('block-icon-' + block_id + '-' + instance_id);
if( blockicon )
{
YAHOO.util.Dom.addClass( blockicon, className );
}
},
toggleLogin: function(url)
{
var ddlogin = document.getElementById('logindd-redirecturi');
var ddbanner = document.getElementById('top_banner');
if( ddlogin && url )
ddlogin.value = url;
UNGweb.toggleDiv('ungweb_login');
if( ddbanner )
UNGweb.toggleDiv('top_banner');
},
resizeCols: function( srcEl )
{
var ezpagezones = document.getElementById('ezpage-zones');
if( ezpagezones )
{
var maxHeight = 0, curHeight = 0;
var cols = YAHOO.util.Dom.getElementsByClassName( 'ezflow-zone-column', 'div', ezpagezones );
for( var i = 0; i < cols.length; i++ )
{
cols[i].style.height = "";
curHeight = UNGweb.getElementHeight( cols[i] );
if( curHeight > maxHeight )
maxHeight = curHeight;
}
if( maxHeight > 0 )
maxHeight = maxHeight + 50;
if( maxHeight > 0 )
{
for( i = 0; i < cols.length; i++ )
{
if( !UNGweb.specialResizeHandling )
cols[i].style.height = maxHeight + 'px';
else if( cols[i].parentNode.className.indexOf('colresize') >= 0 )
cols[i].style.height = maxHeight + 'px';
else
{
cols[i].style.height = "";
curHeight = UNGweb.getElementHeight( cols[i] );
if( curHeight <= 10 )
curHeight = parseInt( curHeight ) + 25;
else
curHeight = parseInt( curHeight ) + 10;
cols[i].style.height = curHeight + 'px';
}
}
}
}
},
getElementHeight: function(el)
{
if( !el )
return 0;
if( el.offsetHeight )
return el.offsetHeight;
if( el.clientHeight )
return el.clientHeight;
if( document.layers && document.layers[el.id] && document.layers[el.id].clip && document.layers[el.id].clip.height )
return document.layers[el.id].clip.height;
if( document.defaultView && document.defaultView.getComputedStyle(el, null).getPropertyValue('height', null) )
return document.defaultView.getComputedStyle(el, null).getPropertyValue('height', null);
return 0;
},
getElementWidth: function(el)
{
if( !el )
return 0;
if( el.offsetWidth )
return el.offsetWidth;
if( el.clientWidth )
return el.clientWidth;
if( document.layers && document.layers[el.id] && document.layers[el.id].clip && document.layers[el.id].clip.width )
return document.layers[el.id].clip.width;
if( document.defaultView && document.defaultView.getComputedStyle(el, null).getPropertyValue('width', null) )
return document.defaultView.getComputedStyle(el, null).getPropertyValue('width', null);
return 0;
},
selectTabsDropdown: function( select, block_id, instance_id )
{
var tabId = select.options[select.selectedIndex].value;
UNGweb.selectTab( block_id, instance_id, tabId );
},
selectTab: function( block_id, instance_id, tabId )
{
var tabView = eZFlowWidgets.DomCacheGet( 'widgettabs-' + block_id + '-' + instance_id + '-dyntabs' );
if( tabView )
{
var tabsSelecters = YAHOO.util.Dom.getElementsByClassName( 'widget-tab-select', 'a', tabView );
for( var i = 0; i < tabsSelecters.length; i++ )
YAHOO.util.Dom.removeClass( tabsSelecters[i], "active" );
if( tabsSelecters[tabId] )
{
YAHOO.util.Dom.addClass( tabsSelecters[tabId], "active" );
}
var tabs = YAHOO.util.Dom.getElementsByClassName( 'widgettabs-tab', 'div', tabView );
for( i = 0; i < tabs.length; i++ )
{
tabs[i].style.display = "none";
}
if( tabs[tabId] )
{
tabs[tabId].style.display = "";
}
UNGweb.resizeCols();
}
},
myProfileWidgetCategory: function(a, catId)
{
var links = a.parentNode.getElementsByTagName('a');
for( var i = 0; i < links.length; i++ )
{
YAHOO.util.Dom.removeClass( links[i], "active" );
}
YAHOO.util.Dom.addClass( a, "active" );
var categories = YAHOO.util.Dom.getElementsByClassName( 'my_profile_widget_category', 'div', document.getElementById('my_profile_add_widgets') );
for( i = 0; i < categories.length; i++ )
{
categories[i].style.display = 'none';
}
var selectedCategory = document.getElementById( 'my_profile_widget_category_' + catId );
if( selectedCategory )
selectedCategory.style.display = "";
},
myProfileSettingArea: function(a, area)
{
var links = YAHOO.util.Dom.getElementsByClassName( 'my_profile_change_setting_area', 'a', a.parentNode );
for( var i = 0; i < links.length; i++ )
{
YAHOO.util.Dom.removeClass( links[i], "active" );
}
YAHOO.util.Dom.addClass( a, "active" );
var areas = YAHOO.util.Dom.getElementsByClassName( 'my_profile_setting_area', 'div', document.getElementById('my_profile_popup') );
for( i = 0; i < areas.length; i++ )
{
areas[i].style.display = 'none';
}
var areaDiv = document.getElementById( 'my_profile_' + area );
areaDiv.style.display = "";
},
toggleProfileSettings: function()
{
UNGweb.toggleDiv('my_profile_show');
UNGweb.toggleDiv('my_profile_popup');
},
toggleDiv: function(id)
{
var div = document.getElementById(id);
if( div )
{
if( div.style.display == 'none' )
div.style.display = '';
else
div.style.display = 'none';
}
},
submitForm: function( formid )
{
var tempForm = document.getElementById(formid);
if( tempForm )
tempForm.submit();
},
rate: function( object_id, type )
{
if( UNGweb.ratingInProgress == false )
{
var uri = document.getElementById('ungweb_rateURI').value + '/' + object_id + '/' + type;
var rate_markup = document.getElementById('rate-loading-markup-' + object_id);
var rate = document.getElementById('rate-' + object_id);
if( rate )
rate.style.display = "none";
if( rate_markup )
rate_markup.style.display = "";
UNGweb.ratingInProgress = true;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: UNGweb.rateCallbacks.success, failure: UNGweb.rateCallbacks.failure }, '' );
}
},
createComment: function()
{
var form = document.getElementById('create_comment_form');
if( form ) form.submit();
},
initTagCloud: function( block_id, instance_id )
{
var cookieVal = YAHOO.util.Cookie.get( "tagcloudpref" );
if( cookieVal == null )
{
var myDate=new Date();
myDate.setDate(myDate.getDate()+365);
YAHOO.util.Cookie.set( "tagcloudpref", "cloud", { expires: myDate } );
}
cookieVal = YAHOO.util.Cookie.get( "tagcloudpref" );
if( cookieVal == 'cloud' )
var otherVal = 'list';
else
var otherVal = 'cloud';
UNGweb.setTagCloudMode( cookieVal, otherVal, block_id, instance_id );
},
setTagCloudMode: function( showMode, hideMode, block_id, instance_id )
{
var showDiv = document.getElementById('tag-' + showMode + '-' + block_id + '-' + instance_id);
var hideDiv = document.getElementById('tag-' + hideMode + '-' + block_id + '-' + instance_id);
var activeMenu = document.getElementById('box-menu-' + block_id + '-' + instance_id + '-' + showMode);
var inactiveMenu = document.getElementById('box-menu-' + block_id + '-' + instance_id + '-' + hideMode);
if( showDiv )
showDiv.style.display = "";
if( hideDiv )
hideDiv.style.display = "none";
if( inactiveMenu )
{
inactiveMenu.className = activeMenu.className.replace('active', '');
}
if( activeMenu )
{
activeMenu.className = activeMenu.className.replace('active', '');
activeMenu.className = inactiveMenu.className + " active";
}
var myDate=new Date();
myDate.setDate(myDate.getDate()+365);
YAHOO.util.Cookie.set( "tagcloudpref", showMode, { expires: myDate } );
},
articleTime: function(node_id, year, month, day, hours, seconds)
{
var oldDate=new Date(year,month-1,day,hours,seconds,0);
var newDate=new Date();
var span = document.getElementById('time-node-' + node_id);
var minutes = 1000*60;
var hours = minutes*60;
var days = hours*24;
var years = days*365;
var difference = newDate.getTime() - oldDate.getTime();
var daysDifference = Math.floor(difference/days);
var hoursDifference = Math.floor(difference/hours);
var minutesDifference = Math.floor(difference/minutes);
var string = "";
if( daysDifference >= 1 )
{
if( daysDifference == 1 )
string = string + daysDifference + " dag ";
else
string = string + daysDifference + " dager ";
}
else if( hoursDifference > 0 )
{
if( hoursDifference == 1 )
string = string + hoursDifference + " time ";
else
string = string + hoursDifference + " timer ";
}
else if( minutesDifference > 0 )
{
if( minutesDifference == 1 )
string = string + minutesDifference + " minutt ";
else
string = string + minutesDifference + " minutter ";
}
if( span && string != "" )
{
span.innerHTML = "(" + string.replace(/^\s\s*/, '').replace(/\s\s*$/, '') + " siden)";
}
}
};
UNGweb.facebook = {
currentInterval: false,
checkWidget: function( uwaEnv, block_id, instance_id )
{
if( uwaEnv.widget )
{
if( uwaEnv.widget.getValue('uid') != "" )
{
var uid = uwaEnv.widget.getValue('uid');
var session_key = uwaEnv.widget.getValue('session_key');
var secret = uwaEnv.widget.getValue('secret');
var zone_id = "zone";
var uri = YAHOO.util.Dom.get('ezflow_storeConfigURI').value + '/' + zone_id + '/' + block_id + '/' + instance_id;
var configString = 'mode=store&blockconfig[uwa-uid]=' + uid + '&blockconfig[uwa-session_key]=' + session_key + '&blockconfig[uwa-secret]=' + secret;
YAHOO.util.Connect.asyncRequest( 'post', uri, { success: UNGweb.noCallback.success, failure: UNGweb.noCallback.failure }, configString );
clearInterval( UNGweb.currentInterval );
}
}
}
};
UNGweb.noCallback = {
success: function(o) { },
failure: function(o) { }
};
UNGweb.rateCallbacks = {
success: function(o)
{
var json = eval( '(' + o.responseText + ')' );
var rate = false;
if( json )
{
if( json.contentobject_id )
rate = document.getElementById('rate-' + json.contentobject_id);
if( json.error_message )
{
}
else if( json.data.vote_count )
{
if( rate )
rate.innerHTML = 'Poeng: ' + json.data.score;
}
if( json.contentobject_id )
{
var rate_markup = document.getElementById('rate-loading-markup-' + json.contentobject_id);
if( rate_markup )
rate_markup.style.display = "none";
}
}
if( rate )
rate.style.display = "";
UNGweb.ratingInProgress = false;
},
failure: function(o)
{
var rate = document.getElementById('rate');
if( rate )
rate.style.display = "";
UNGweb.ratingInProgress = false;
}
};
YAHOO.util.Event.onDOMReady(UNGweb.init);
var NV_HOST = 'www.netvibes.com', NV_PATH = 'http://www.netvibes.com/', NV_STATIC = '', NV_MODULES = 'nvmodules2.netvibes.com', NV_AVATARS = 'avatars.netvibes.com';
var MooTools = {
'version': '1.2dev',
'build': '1374'
};
var Native = function(options){
options = options || {};
var afterImplement = options.afterImplement || function(){};
var generics = options.generics;
generics = (generics !== false);
var legacy = options.legacy;
var initialize = options.initialize;
var protect = options.protect;
var name = options.name;
var object = initialize || legacy;
object.constructor = Native;
object.$family = {name: 'native'};
if (legacy && initialize) object.prototype = legacy.prototype;
object.prototype.constructor = object;
if (name){
var family = name.toLowerCase();
object.prototype.$family = {name: family};
Native.typize(object, family);
}
var add = function(obj, name, method, force){
if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method;
if (generics) Native.genericize(obj, name, protect);
afterImplement.call(obj, name, method);
return obj;
};
object.implement = function(a1, a2, a3){
if (typeof a1 == 'string') return add(this, a1, a2, a3);
for (var p in a1) add(this, p, a1[p], a2);
return this;
};
object.alias = function(existing, property, force){
existing = this.prototype[existing];
if (existing) add(this, property, existing, force);
return this;
};
return object;
};
Native.implement = function(objects, properties){
for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties);
};
Native.genericize = function(object, property, check){
if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){
var args = Array.prototype.slice.call(arguments);
return object.prototype[property].apply(args.shift(), args);
};
};
Native.typize = function(object, family){
if (!object.type) object.type = function(item){
return ($type(item) === family);
};
};
(function(objects){
for (var name in objects) Native.typize(objects[name], name.toLowerCase());
})({'Boolean': Boolean, 'Native': Native, 'Object': Object});
(function(objects){
for (var name in objects) new Native({name: name, initialize: objects[name], protect: true});
})({'String': String, 'Function': Function, 'Number': Number, 'Array': Array, 'RegExp': RegExp, 'Date': Date});
(function(object, methods){
for (var i = 0, l = methods.length; i < l; i++) Native.genericize(object, methods[i], true);
return arguments.callee;
})
(Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 'toString', 'valueOf', 'indexOf', 'lastIndexOf'])
(String, ['charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'replace', 'search', 'slice', 'split', 'substr', 'substring', 'toLowerCase', 'toUpperCase', 'valueOf']);
function $chk(obj){
return !!(obj || obj === 0);
};
function $clear(timer){
clearTimeout(timer);
clearInterval(timer);
return null;
};
function $defined(obj){
return (obj != undefined);
};
function $empty(){};
function $arguments(i){
return function(){
return arguments[i];
};
};
function $lambda(value){
return (typeof value == 'function') ? value : function(){
return value;
};
};
function $extend(original, extended){
for (var key in (extended || {})) original[key] = extended[key];
return original;
};
function $unlink(object){
var unlinked = null;
switch ($type(object)){
case 'object':
unlinked = {};
for (var p in object) unlinked[p] = $unlink(object[p]);
break;
case 'array':
unlinked = [];
for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]);
break;
default: return object;
}
return unlinked;
};
function $merge(){
var mix = {};
for (var i = 0, l = arguments.length; i < l; i++){
var object = arguments[i];
if ($type(object) != 'object') continue;
for (var key in object){
var op = object[key], mp = mix[key];
mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $merge(mp, op) : $unlink(op);
}
}
return mix;
};
function $pick(){
for (var i = 0, l = arguments.length; i < l; i++){
if ($defined(arguments[i])) return arguments[i];
}
return null;
};
function $random(min, max){
return Math.floor(Math.random() * (max - min + 1) + min);
};
function $splat(obj){
var type = $type(obj);
return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
};
var $time = Date.now || function(){
return new Date().getTime();
};
function $try(fn, bind, args){
try {
return fn.apply(bind, $splat(args));
} catch(e){
return false;
}
};
function $type(obj){
if (obj == undefined) return false;
if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
if (obj.nodeName){
switch (obj.nodeType){
case 1: return 'element';
case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
}
} else if (typeof obj.length == 'number'){
if (obj.callee) return 'arguments';
else if (obj.item) return 'collection';
}
return typeof obj;
};
var Hash = new Native({
name: 'Hash',
initialize: function(object){
if ($type(object) == 'hash') object = $unlink(object.getClean());
for (var key in object){
if (!this[key]) this[key] = object[key];
}
return this;
}
});
Hash.implement({
getLength: function(){
var length = 0;
for (var key in this){
if (this.hasOwnProperty(key)) length++;
}
return length;
},
forEach: function(fn, bind){
for (var key in this){
if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this);
}
},
getClean: function(){
var clean = {};
for (var key in this){
if (this.hasOwnProperty(key)) clean[key] = this[key];
}
return clean;
}
});
Hash.alias('forEach', 'each');
function $H(object){
return new Hash(object);
};
Array.implement({
forEach: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this);
}
});
Array.alias('forEach', 'each');
function $A(iterable){
if ($type(iterable) == 'collection'){
var array = [];
for (var i = 0, l = iterable.length; i < l; i++) array[i] = iterable[i];
return array;
}
return Array.prototype.slice.call(iterable);
};
function $each(iterable, fn, bind){
var type = $type(iterable);
((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind);
};
var Browser = new Hash({
Engine: {name: 'unknown', version: ''},
Platform: {name: (navigator.platform.match(/mac|win|linux|nix/i) || ['other'])[0].toLowerCase()},
Features: {xhr: !!(window.XMLHttpRequest), xpath: !!(document.evaluate), air: !!(window.runtime)}
});
if (window.opera) Browser.Engine = {name: 'presto', version: (document.getElementsByClassName) ? 950 : 925};
else if (window.ActiveXObject) Browser.Engine = {name: 'trident', version: (Browser.Features.xhr) ? 5 : 4};
else if (!navigator.taintEnabled) Browser.Engine = {name: 'webkit', version: (Browser.Features.xpath) ? 420 : 419};
else if (document.getBoxObjectFor != null) Browser.Engine.name = 'gecko';
Browser.Engine[Browser.Engine.name] = Browser.Engine[Browser.Engine.name + Browser.Engine.version] = true;
Browser.Platform[Browser.Platform.name] = true;
function $exec(text){
if (!text) return text;
if (window.execScript){
window.execScript(text);
} else {
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.text = text;
document.head.appendChild(script);
document.head.removeChild(script);
}
return text;
};
Native.UID = 0;
var Window = new Native({
name: 'Window',
legacy: window.Window,
initialize: function(win){
if (!win.Element){
win.Element = $empty;
if (Browser.Engine.webkit) win.document.createElement("iframe");
win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {};
}
win.uid = Native.UID++;
return $extend(win, Window.Prototype);
},
afterImplement: function(property, value){
window[property] = Window.Prototype[property] = value;
}
});
Window.Prototype = {$family: {name: 'window'}};
new Window(window);
var Document = new Native({
name: 'Document',
legacy: window.Document,
initialize: function(doc){
doc.head = doc.getElementsByTagName('head')[0];
doc.html = doc.getElementsByTagName('html')[0];
doc.window = doc.defaultView || doc.parentWindow;
if (Browser.Engine.trident4) $try(function(){
doc.execCommand("BackgroundImageCache", false, true);
});
doc.uid = Native.UID++;
return $extend(doc, Document.Prototype);
},
afterImplement: function(property, value){
document[property] = Document.Prototype[property] = value;
}
});
Document.Prototype = {$family: {name: 'document'}};
new Document(document);
Array.implement({
every: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if (!fn.call(bind, this[i], i, this)) return false;
}
return true;
},
filter: function(fn, bind){
var results = [];
for (var i = 0, l = this.length; i < l; i++){
if (fn.call(bind, this[i], i, this)) results.push(this[i]);
}
return results;
},
clean: function() {
return this.filter($arguments(0));
},
indexOf: function(item, from){
var len = this.length;
for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
if (this[i] === item) return i;
}
return -1;
},
map: function(fn, bind){
var results = [];
for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this);
return results;
},
some: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if (fn.call(bind, this[i], i, this)) return true;
}
return false;
},
associate: function(keys){
var obj = {}, length = Math.min(this.length, keys.length);
for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
return obj;
},
link: function(object){
var result = {};
for (var i = 0, l = this.length; i < l; i++){
for (var key in object){
if (object[key](this[i])){
result[key] = this[i];
delete object[key];
break;
}
}
}
return result;
},
contains: function(item, from){
return this.indexOf(item, from) != -1;
},
extend: function(array){
for (var i = 0, j = array.length; i < j; i++) this.push(array[i]);
return this;
},
getLast: function(){
return (this.length) ? this[this.length - 1] : null;
},
getRandom: function(){
return (this.length) ? this[$random(0, this.length - 1)] : null;
},
include: function(item){
if (!this.contains(item)) this.push(item);
return this;
},
merge: function(array){
for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
return this;
},
remove: function(item){
for (var i = this.length; i--; i){
if (this[i] === item) this.splice(i, 1);
}
return this;
},
empty: function(){
this.length = 0;
return this;
},
flatten: function(){
var array = [];
for (var i = 0, l = this.length; i < l; i++){
var type = $type(this[i]);
if (!type) continue;
array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]);
}
return array;
},
hexToRgb: function(array){
if (this.length != 3) return null;
var rgb = this.map(function(value){
if (value.length == 1) value += value;
return value.toInt(16);
});
return (array) ? rgb : 'rgb(' + rgb + ')';
},
rgbToHex: function(array){
if (this.length < 3) return null;
if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
var hex = [];
for (var i = 0; i < 3; i++){
var bit = (this[i] - 0).toString(16);
hex.push((bit.length == 1) ? '0' + bit : bit);
}
return (array) ? hex : '#' + hex.join('');
}
});
Function.implement({
extend: function(properties){
for (var property in properties) this[property] = properties[property];
return this;
},
create: function(options){
var self = this;
options = options || {};
return function(event){
var args = options.arguments;
args = $defined(args) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0);
if (options.event) args = [event || window.event].extend(args);
var returns = function(){
return self.apply(options.bind || null, args);
};
if (options.delay) return setTimeout(returns, options.delay);
if (options.periodical) return setInterval(returns, options.periodical);
if (options.attempt) return $try(returns);
return returns();
};
},
pass: function(args, bind){
return this.create({'arguments': args, 'bind': bind});
},
attempt: function(args, bind){
return this.create({'arguments': args, 'bind': bind, 'attempt': true})();
},
bind: function(bind, args){
return this.create({'bind': bind, 'arguments': args});
},
bindWithEvent: function(bind, args){
return this.create({'bind': bind, 'event': true, 'arguments': args});
},
delay: function(delay, bind, args){
return this.create({'delay': delay, 'bind': bind, 'arguments': args})();
},
periodical: function(interval, bind, args){
return this.create({'periodical': interval, 'bind': bind, 'arguments': args})();
},
run: function(args, bind){
return this.apply(bind, $splat(args));
}
});
Number.implement({
limit: function(min, max){
return Math.min(max, Math.max(min, this));
},
round: function(precision){
precision = Math.pow(10, precision || 0);
return Math.round(this * precision) / precision;
},
times: function(fn, bind){
for (var i = 0; i < this; i++) fn.call(bind, i, this);
},
toFloat: function(){
return parseFloat(this);
},
toInt: function(base){
return parseInt(this, base || 10);
}
});
Number.alias('times', 'each');
(function(math){
var methods = {};
math.each(function(name){
if (!Number[name]) methods[name] = function(){
return Math[name].apply(null, [this].concat($A(arguments)));
};
});
Number.implement(methods);
})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
String.implement({
test: function(regex, params){
return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this);
},
contains: function(string, separator){
return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
},
trim: function(){
return this.replace(/^\s+|\s+$/g, '');
},
clean: function(){
return this.replace(/\s+/g, ' ').trim();
},
camelCase: function(){
return this.replace(/-\D/g, function(match){
return match.charAt(1).toUpperCase();
});
},
hyphenate: function(){
return this.replace(/[A-Z]/g, function(match){
return ('-' + match.charAt(0).toLowerCase());
});
},
capitalize: function(){
return this.replace(/\b[a-z]/g, function(match){
return match.toUpperCase();
});
},
escapeRegExp: function(){
return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
},
toInt: function(base){
return parseInt(this, base || 10);
},
toFloat: function(){
return parseFloat(this);
},
hexToRgb: function(array){
var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return (hex) ? hex.slice(1).hexToRgb(array) : null;
},
rgbToHex: function(array){
var rgb = this.match(/\d{1,3}/g);
return (rgb) ? rgb.rgbToHex(array) : null;
},
stripScripts: function(option){
var scripts = '';
var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
scripts += arguments[1] + '\n';
return '';
});
if (option === true) $exec(scripts);
else if ($type(option) == 'function') option(scripts, text);
return text;
}
});
Hash.implement({
has: Object.prototype.hasOwnProperty,
keyOf: function(value){
for (var key in this){
if (this.hasOwnProperty(key) && this[key] === value) return key;
}
return null;
},
hasValue: function(value){
return (Hash.keyOf(this, value) !== null);
},
extend: function(properties){
Hash.each(properties, function(value, key){
Hash.set(this, key, value);
}, this);
return this;
},
merge: function(properties){
Hash.each(properties, function(value, key){
Hash.include(this, key, value);
}, this);
return this;
},
remove: function(key){
if (this.hasOwnProperty(key)) delete this[key];
return this;
},
get: function(key){
return (this.hasOwnProperty(key)) ? this[key] : null;
},
set: function(key, value){
if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
return this;
},
empty: function(){
Hash.each(this, function(value, key){
delete this[key];
}, this);
return this;
},
include: function(key, value){
var k = this[key];
if (!$defined(k)) this[key] = value;
return this;
},
map: function(fn, bind){
var results = new Hash;
Hash.each(this, function(value, key){
results.set(key, fn.call(bind, value, key, this));
}, this);
return results;
},
filter: function(fn, bind){
var results = new Hash;
Hash.each(this, function(value, key){
if (fn.call(bind, value, key, this)) results.set(key, value);
}, this);
return results;
},
every: function(fn, bind){
for (var key in this){
if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false;
}
return true;
},
some: function(fn, bind){
for (var key in this){
if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true;
}
return false;
},
getKeys: function(){
var keys = [];
Hash.each(this, function(value, key){
keys.push(key);
});
return keys;
},
getValues: function(){
var values = [];
Hash.each(this, function(value){
values.push(value);
});
return values;
},
toQueryString: function(){
var queryString = [];
Hash.each(this, function(value, key){
$splat(value).each(function(val){
queryString.push(key + '=' + encodeURIComponent(val));
});
});
return queryString.join('&');
}
});
Hash.alias('keyOf', 'indexOf').alias('hasValue', 'contains').alias('remove', 'erase');
var Event = new Native({
name: 'Event',
initialize: function(event, win){
win = win || window;
event = event || win.event;
if (event.$extended) return event;
this.$extended = true;
var type = event.type;
var target = event.target || event.srcElement;
while (target && target.nodeType == 3) target = target.parentNode;
if (type.test(/key/)){
var code = event.which || event.keyCode;
var key = Event.Keys.keyOf(code);
if (type == 'keydown'){
var fKey = code - 111;
if (fKey > 0 && fKey < 13) key = 'f' + fKey;
}
key = key || String.fromCharCode(code).toLowerCase();
} else if (type.match(/(click|mouse|menu)/i)){
var page = {
x: event.pageX || event.clientX + win.document.documentElement.scrollLeft,
y: event.pageY || event.clientY + win.document.documentElement.scrollTop
};
var client = {
x: event.pageX ? event.pageX - win.pageXOffset : event.clientX,
y: event.pageY ? event.pageY - win.pageYOffset : event.clientY
};
if (type.match(/DOMMouseScroll|mousewheel/)){
var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3;
}
var rightClick = (event.which == 3) || (event.button == 2);
var related = null;
if (type.match(/over|out/)){
switch (type){
case 'mouseover': related = event.relatedTarget || event.fromElement; break;
case 'mouseout': related = event.relatedTarget || event.toElement;
}
if ((function(){
while (related && related.nodeType == 3) related = related.parentNode;
}).create({attempt: Browser.Engine.gecko})() === false) related = false;
}
}
return $extend(this, {
event: event,
type: type,
page: page,
client: client,
rightClick: rightClick,
wheel: wheel,
relatedTarget: related,
target: target,
code: code,
key: key,
shift: event.shiftKey,
control: event.ctrlKey,
alt: event.altKey,
meta: event.metaKey
});
}
});
Event.Keys = new Hash({
'enter': 13,
'up': 38,
'down': 40,
'left': 37,
'right': 39,
'esc': 27,
'space': 32,
'backspace': 8,
'tab': 9,
'delete': 46
});
Event.implement({
stop: function(){
return this.stopPropagation().preventDefault();
},
stopPropagation: function(){
if (this.event.stopPropagation) this.event.stopPropagation();
else this.event.cancelBubble = true;
return this;
},
preventDefault: function(){
if (this.event.preventDefault) this.event.preventDefault();
else this.event.returnValue = false;
return this;
}
});
var Class = new Native({
name: 'Class',
initialize: function(properties){
properties = properties || {};
var klass = function(){
for (var property in this) this[property] = $unlink(this[property]);
this.parent = null;
['Implements', 'Extends'].each(function(Property){
if (!this[Property]) return;
Class[Property](this, this[Property]);
delete this[Property];
}, this);
this.constructor = klass;
var self = (arguments[0] !== $empty && this.initialize) ? this.initialize.apply(this, arguments) : this;
if (this.options && this.options.initialize) this.options.initialize.call(this);
return self;
};
$extend(klass, this);
klass.constructor = Class;
klass.prototype = properties;
return klass;
}
});
Class.implement({
implement: function(){
Class.Implements(this.prototype, Array.slice(arguments));
return this;
}
});
Class.Implements = function(self, klasses){
$splat(klasses).each(function(klass){
$extend(self, ($type(klass) == 'class') ? new klass($empty) : klass);
});
};
Class.Extends = function(self, klass){
klass = new klass($empty);
for (var property in klass){
var kp = klass[property];
var sp = self[property];
self[property] = (function(previous, current){
if ($defined(current) && previous != current){
var type = $type(current);
if (type != $type(previous)) return current;
switch (type){
case 'function':
return function(){
current.parent = this.parent = previous.bind(this);
var value = current.apply(this, arguments);
this.parent = current.parent;
return value;
};
case 'object': return $merge(previous, current);
default: return current;
}
}
return previous;
})(kp, sp);
}
};
Class.prototype.extend = function(properties){
properties.Extends = this;
return new Class(properties);
};
var Chain = new Class({
chain: function(){
this.$chain = (this.$chain || []).extend(arguments);
return this;
},
callChain: function(){
if (this.$chain && this.$chain.length) this.$chain.shift().apply(this, arguments);
return this;
},
clearChain: function(){
if (this.$chain) this.$chain.empty();
return this;
}
});
var Events = new Class({
addEvent: function(type, fn, internal){
if (fn != $empty){
this.$events = this.$events || {};
this.$events[type] = this.$events[type] || [];
this.$events[type].include(fn);
if (internal) fn.internal = true;
}
return this;
},
addEvents: function(events){
for (var type in events) this.addEvent(type, events[type]);
return this;
},
fireEvent: function(type, args, delay){
if (!this.$events || !this.$events[type]) return this;
this.$events[type].each(function(fn){
fn.create({'bind': this, 'delay': delay, 'arguments': args})();
}, this);
return this;
},
removeEvent: function(type, fn){
if (!this.$events || !this.$events[type]) return this;
if (!fn.internal) this.$events[type].remove(fn);
return this;
},
removeEvents: function(type){
for (var e in this.$events){
if (type && type != e) continue;
var fns = this.$events[e];
for (var i = fns.length; i--; i) this.removeEvent(e, fns[i]);
}
return this;
}
});
var Options = new Class({
setOptions: function(){
this.options = $merge.run([this.options].extend(arguments));
if (!this.addEvent) return this;
for (var option in this.options){
if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
this.addEvent(option, this.options[option]);
delete this.options[option];
}
return this;
}
});
Document.implement({
newElement: function(tag, props){
if (Browser.Engine.trident && props){
['name', 'type', 'checked'].each(function(attribute){
if (!props[attribute]) return;
tag += ' ' + attribute + '="' + props[attribute] + '"';
if (attribute != 'checked') delete props[attribute];
});
tag = '<' + tag + '>';
}
return $.element(this.createElement(tag)).set(props);
},
newTextNode: function(text){
return this.createTextNode(text);
},
getDocument: function(){
return this;
},
getWindow: function(){
return this.defaultView || this.parentWindow;
}
});
var Element = new Native({
name: 'Element',
legacy: window.Element,
initialize: function(tag, props){
var konstructor = Element.Constructors.get(tag);
if (konstructor) return konstructor(props);
if (typeof tag == 'string') return document.newElement(tag, props);
return $(tag).set(props);
},
afterImplement: function(key, value){
if (!Array[key]) Elements.implement(key, Elements.multi(key));
Element.Prototype[key] = value;
}
});
Element.Prototype = {$family: {name: 'element'}};
Element.Constructors = new Hash;
var IFrame = new Native({
name: 'IFrame',
generics: false,
initialize: function(){
Native.UID++;
var params = Array.link(arguments, {properties: Object.type, iframe: $defined});
var props = params.properties || {};
var iframe = $(params.iframe) || false;
var onload = props.onload || $empty;
delete props.onload;
props.id = props.name = $pick(props.id, props.name, iframe.id, iframe.name, 'IFrame_' + Native.UID);
iframe = new Element(iframe || 'iframe', props);
var onFrameLoad = function(){
var host = $try(function(){
return iframe.contentWindow.location.host;
});
if (host && host == window.location.host){
iframe.window = iframe.contentWindow;
var win = new Window(iframe.window);
var doc = new Document(iframe.window.document);
$extend(win.Element.prototype, Element.Prototype);
}
onload.call(iframe.contentWindow);
};
(!window.frames[props.id]) ? iframe.addListener('load', onFrameLoad) : onFrameLoad();
return iframe;
}
});
var Elements = new Native({
initialize: function(elements, options){
options = $extend({ddup: true, cash: true}, options);
elements = elements || [];
if (options.ddup || options.cash){
var uniques = {};
var returned = [];
for (var i = 0, l = elements.length; i < l; i++){
var el = $.element(elements[i], !options.cash);
if (options.ddup){
if (uniques[el.uid]) continue;
uniques[el.uid] = true;
}
returned.push(el);
}
elements = returned;
}
return (options.cash) ? $extend(elements, this) : elements;
}
});
Elements.implement({
filterBy: function(filter){
if (!filter) return this;
return new Elements(this.filter((typeof filter == 'string') ? function(item){
return item.match(filter);
} : filter));
}
});
Elements.multi = function(property){
return function(){
var items = [];
var elements = true;
for (var i = 0, j = this.length; i < j; i++){
var returns = this[i][property].apply(this[i], arguments);
items.push(returns);
if (elements) elements = ($type(returns) == 'element');
}
return (elements) ? new Elements(items) : items;
};
};
Window.implement({
$: function(el, notrash){
if (el && el.$attributes) return el;
var type = $type(el);
return ($[type]) ? $[type](el, notrash, this.document) : null;
},
$$: function(selector){
if (arguments.length == 1 && typeof selector == 'string') return this.document.getElements(selector);
var elements = [];
var args = Array.flatten(arguments);
for (var i = 0, l = args.length; i < l; i++){
var item = args[i];
switch ($type(item)){
case 'element': item = [item]; break;
case 'string': item = this.document.getElements(item, true); break;
default: item = false;
}
if (item) elements.extend(item);
}
return new Elements(elements);
},
getDocument: function(){
return this.document;
},
getWindow: function(){
return this;
}
});
$.string = function(id, notrash, doc){
id = doc.getElementById(id);
return (id) ? $.element(id, notrash) : null;
};
$.element = function(el, notrash){
el.uid = el.uid || [Native.UID++];
if (!notrash && Garbage.collect(el) && !el.$family) $extend(el, Element.Prototype);
return el;
};
$.textnode = $.window = $.document = $arguments(0);
$.number = function(uid){
return Garbage.Elements[uid] || null;
};
Native.implement([Element, Document], {
getElement: function(selector, notrash){
return $(this.getElements(selector, true)[0] || null, notrash);
},
getElements: function(tags, nocash){
tags = tags.split(',');
var elements = [];
var ddup = (tags.length > 1);
tags.each(function(tag){
var partial = this.getElementsByTagName(tag.trim());
(ddup) ? elements.extend(partial) : elements = partial;
}, this);
return new Elements(elements, {ddup: ddup, cash: !nocash});
}
});
Element.Storage = {
get: function(uid){
return (this[uid] = this[uid] || {});
}
};
Element.Inserters = new Hash({
before: function(context, element){
if (element.parentNode) element.parentNode.insertBefore(context, element);
},
after: function(context, element){
if (!element.parentNode) return;
var next = element.nextSibling;
(next) ? element.parentNode.insertBefore(context, next) : element.parentNode.appendChild(context);
},
bottom: function(context, element){
element.appendChild(context);
},
top: function(context, element){
var first = element.firstChild;
(first) ? element.insertBefore(context, first) : element.appendChild(context);
}
});
Element.Inserters.inside = Element.Inserters.bottom;
Element.Inserters.each(function(value, key){
var Key = key.capitalize();
Element.implement('inject' + Key, function(el){
Element.Inserters[key](this, $(el, true));
return this;
});
Element.implement('grab' + Key, function(el){
Element.Inserters[key]($(el, true), this);
return this;
});
});
Element.implement({
getDocument: function(){
return this.ownerDocument;
},
getWindow: function(){
return this.ownerDocument.getWindow();
},
getElementById: function(id, nocash){
var el = this.ownerDocument.getElementById(id);
if (!el) return null;
for (var parent = el.parentNode; parent != this; parent = parent.parentNode){
if (!parent) return null;
}
return $.element(el, nocash);
},
set: function(prop, value){
switch ($type(prop)){
case 'object':
for (var p in prop) this.set(p, prop[p]);
break;
case 'string':
var property = Element.Properties.get(prop);
(property && property.set) ? property.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(prop, value);
}
return this;
},
get: function(prop){
var property = Element.Properties.get(prop);
return (property && property.get) ? property.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(prop);
},
erase: function(prop){
var property = Element.Properties.get(prop);
(property && property.erase) ? property.erase.apply(this, Array.slice(arguments, 1)) : this.removeProperty(prop);
return this;
},
match: function(tag){
return (!tag || Element.get(this, 'tag') == tag);
},
inject: function(el, where){
Element.Inserters.get(where || 'bottom')(this, $(el, true));
return this;
},
wraps: function(el, where){
el = $(el, true);
return this.replaces(el).grab(el);
},
grab: function(el, where){
Element.Inserters.get(where || 'bottom')($(el, true), this);
return this;
},
appendText: function(text, where){
return this.grab(this.getDocument().newTextNode(text), where);
},
adopt: function(){
Array.flatten(arguments).each(function(element){
this.appendChild($(element, true));
}, this);
return this;
},
dispose: function(){
return this.parentNode.removeChild(this);
},
clone: function(contents, keepid){
switch ($type(this)){
case 'element':
var attributes = {};
for (var j = 0, l = this.attributes.length; j < l; j++){
var attribute = this.attributes[j], key = attribute.nodeName, value = attribute.nodeValue;
if ((key != 'id' || keepid) && value && value != 'inherit' && ['string', 'number'].contains($type(value))) attributes[key] = value;
}
var element = new Element(this.nodeName.toLowerCase(), attributes);
if (contents !== false){
var children = [];
for (var i = 0, k = this.childNodes.length; i < k; i++){
var child = Element.clone(this.childNodes[i], true, keepid);
if (child) children.push(child);
}
element.adopt(children);
}
return element;
case 'textnode': return document.newTextNode(this.nodeValue);
}
return null;
},
replaces: function(el){
el = $(el, true);
el.parentNode.replaceChild(this, el);
return this;
},
hasClass: function(className){
return this.className.contains(className, ' ');
},
addClass: function(className){
if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean();
return this;
},
removeClass: function(className){
this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1').clean();
return this;
},
toggleClass: function(className){
return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);
},
getComputedStyle: function(property){
var result = null;
if (this.currentStyle){
result = this.currentStyle[property.camelCase()];
} else {
var computed = this.getWindow().getComputedStyle(this, null);
if (computed) result = computed.getPropertyValue([property.hyphenate()]);
}
return result;
},
empty: function(){
var elements = $A(this.getElementsByTagName('*'));
elements.each(function(element){
$try(Element.prototype.dispose, element);
});
Garbage.trash(elements);
$try(Element.prototype.set, this, ['html', '']);
return this;
},
destroy: function(){
Garbage.kill(this.empty().dispose());
return null;
},
toQueryString: function(){
var queryString = [];
this.getElements('input, select, textarea', true).each(function(el){
var name = el.name, type = el.type, value = Element.get(el, 'value');
if (value === false || !name || el.disabled) return;
$splat(value).each(function(val){
queryString.push(name + '=' + encodeURIComponent(val));
});
});
return queryString.join('&');
},
getProperty: function(attribute){
var EA = Element.Attributes, key = EA.Props[attribute];
var value = (key) ? this[key] : this.getAttribute(attribute);
return (EA.Bools[attribute]) ? !!value : value;
},
getProperties: function(){
var args = $A(arguments);
return args.map(function(attr){
return this.getProperty(attr);
}, this).associate(args);
},
setProperty: function(attribute, value){
var EA = Element.Attributes, key = EA.Props[attribute], hasValue = $defined(value);
if (key && EA.Bools[attribute]) value = (value || !hasValue) ? true : false;
else if (!hasValue) return this.removeProperty(attribute);
(key) ? this[key] = value : this.setAttribute(attribute, value);
return this;
},
setProperties: function(attributes){
for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
return this;
},
removeProperty: function(attribute){
var EA = Element.Attributes, key = EA.Props[attribute], isBool = (key && EA.Bools[attribute]);
(key) ? this[key] = (isBool) ? false : '' : this.removeAttribute(attribute);
return this;
},
removeProperties: function(){
Array.each(arguments, this.removeProperty, this);
return this;
}
});
(function(){
var walk = function(element, walk, start, match, all, nocash){
var el = element[start || walk];
var elements = [];
while (el){
if (el.nodeType == 1 && (!match || Element.match(el, match))){
elements.push(el);
if (!all) break;
}
el = el[walk];
}
return (all) ? new Elements(elements, {ddup: false, cash: !nocash}) : $(elements[0], nocash);
};
Element.implement({
getPrevious: function(match, nocash){
return walk(this, 'previousSibling', null, match, false, nocash);
},
getAllPrevious: function(match, nocash){
return walk(this, 'previousSibling', null, match, true, nocash);
},
getNext: function(match, nocash){
return walk(this, 'nextSibling', null, match, false, nocash);
},
getAllNext: function(match, nocash){
return walk(this, 'nextSibling', null, match, true, nocash);
},
getFirst: function(match, nocash){
return walk(this, 'nextSibling', 'firstChild', match, false, nocash);
},
getLast: function(match, nocash){
return walk(this, 'previousSibling', 'lastChild', match, false, nocash);
},
getParent: function(match, nocash){
return walk(this, 'parentNode', null, match, false, nocash);
},
getParents: function(match, nocash){
return walk(this, 'parentNode', null, match, true, nocash);
},
getChildren: function(match, nocash){
return walk(this, 'nextSibling', 'firstChild', match, true, nocash);
},
hasChild: function(el){
el = $(el, true);
return (el && $A(this.getElementsByTagName(el.tagName)).contains(el));
}
});
})();
Element.alias('dispose', 'remove').alias('getLast', 'getLastChild');
Element.Properties = new Hash;
Element.Properties.style = {
set: function(style){
this.style.cssText = style;
},
get: function(){
return this.style.cssText;
},
erase: function(){
this.style.cssText = '';
}
};
Element.Properties.value = {get: function(){
switch (Element.get(this, 'tag')){
case 'select':
var values = [];
Array.each(this.options, function(option){
if (option.selected) values.push(option.value);
});
return (this.multiple) ? values : values[0];
case 'input': if (['checkbox', 'radio'].contains(this.type) && !this.checked) return false;
default: return $pick(this.value, false);
}
}};
Element.Properties.tag = {get: function(){
return this.tagName.toLowerCase();
}};
Element.Properties.html = {set: function(){
return this.innerHTML = Array.flatten(arguments).join('');
}};
Element.implement({
getText: function(){
return this.get('text');
},
setText: function(text){
return this.set('text', text);
},
setHTML: function(){
return this.set('html', arguments);
},
getHTML: function(){
return this.get('html');
},
getTag: function(){
return this.get('tag');
}
});
Native.implement([Element, Window, Document], {
addListener: function(type, fn){
if (this.addEventListener) this.addEventListener(type, fn, false);
else this.attachEvent('on' + type, fn);
return this;
},
removeListener: function(type, fn){
if (this.removeEventListener) this.removeEventListener(type, fn, false);
else this.detachEvent('on' + type, fn);
return this;
},
retrieve: function(property, dflt){
var storage = Element.Storage.get(this.uid);
var prop = storage[property];
if ($defined(dflt) && !$defined(prop)) prop = storage[property] = dflt;
return $pick(prop);
},
store: function(property, value){
var storage = Element.Storage.get(this.uid);
storage[property] = value;
return this;
},
eliminate: function(property){
var storage = Element.Storage.get(this.uid);
delete storage[property];
return this;
}
});
Element.Attributes = new Hash({
Props: {'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'text': (Browser.Engine.trident || Browser.Engine.webkit) ? 'innerText' : 'textContent'},
Bools: ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer'],
Camels: ['value', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 'rowSpan', 'tabIndex', 'useMap']
});
(function(EA){
var EAB = EA.Bools, EAC = EA.Camels;
EA.Bools = EAB = EAB.associate(EAB);
Hash.extend(Hash.merge(EA.Props, EAB), EAC.associate(EAC.map(function(v){
return v.toLowerCase();
})));
EA.remove('Camels');
})(Element.Attributes);
var Garbage = {
Elements: {},
ignored: {object: 1, embed: 1, OBJECT: 1, EMBED: 1},
collect: function(el){
if (el.$attributes) return true;
if (Garbage.ignored[el.tagName]) return false;
Garbage.Elements[el.uid] = el;
el.$attributes = {};
return true;
},
trash: function(elements){
for (var i = elements.length, el; i--; i) Garbage.kill(elements[i]);
},
kill: function(el){
if (!el || !el.$attributes) return;
delete Garbage.Elements[el.uid];
if (el.retrieve('events')) el.removeEvents();
for (var p in el.$attributes) el.$attributes[p] = null;
if (Browser.Engine.trident){
for (var d in Element.Prototype) el[d] = null;
}
el.$attributes = el.uid = null;
},
empty: function(){
for (var uid in Garbage.Elements) Garbage.kill(Garbage.Elements[uid]);
}
};
window.addListener('beforeunload', function(){
window.addListener('unload', Garbage.empty);
if (Browser.Engine.trident) window.addListener('unload', CollectGarbage);
});
Element.Properties.events = {set: function(events){
this.addEvents(events);
}};
Native.implement([Element, Window, Document], {
addEvent: function(type, fn){
var events = this.retrieve('events', {});
events[type] = events[type] || {'keys': [], 'values': []};
if (events[type].keys.contains(fn)) return this;
events[type].keys.push(fn);
var realType = type, custom = Element.Events.get(type), condition = fn, self = this;
if (custom){
if (custom.onAdd) custom.onAdd.call(this, fn);
if (custom.condition){
condition = function(event){
if (custom.condition.call(this, event)) return fn.call(this, event);
return false;
};
}
realType = custom.base || realType;
}
var defn = function(){
return fn.call(self);
};
var nativeEvent = Element.NativeEvents[realType] || 0;
if (nativeEvent){
if (nativeEvent == 2){
defn = function(event){
event = new Event(event, self.getWindow());
if (condition.call(self, event) === false) event.stop();
};
}
this.addListener(realType, defn);
}
events[type].values.push(defn);
return this;
},
removeEvent: function(type, fn){
var events = this.retrieve('events');
if (!events || !events[type]) return this;
var pos = events[type].keys.indexOf(fn);
if (pos == -1) return this;
var key = events[type].keys.splice(pos, 1)[0];
var value = events[type].values.splice(pos, 1)[0];
var custom = Element.Events.get(type);
if (custom){
if (custom.onRemove) custom.onRemove.call(this, fn);
type = custom.base || type;
}
return (Element.NativeEvents[type]) ? this.removeListener(type, value) : this;
},
addEvents: function(events){
for (var event in events) this.addEvent(event, events[event]);
return this;
},
removeEvents: function(type){
var events = this.retrieve('events');
if (!events) return this;
if (!type){
for (var evType in events) this.removeEvents(evType);
events = null;
} else if (events[type]){
while (events[type].keys[0]) this.removeEvent(type, events[type].keys[0]);
events[type] = null;
}
return this;
},
fireEvent: function(type, args, delay){
var events = this.retrieve('events');
if (!events || !events[type]) return this;
events[type].keys.each(function(fn){
fn.create({'bind': this, 'delay': delay, 'arguments': args})();
}, this);
return this;
},
cloneEvents: function(from, type){
from = $(from);
var fevents = from.retrieve('events');
if (!fevents) return this;
if (!type){
for (var evType in fevents) this.cloneEvents(from, evType);
} else if (fevents[type]){
fevents[type].keys.each(function(fn){
this.addEvent(type, fn);
}, this);
}
return this;
}
});
Element.NativeEvents = {
'click': 2, 'dblclick': 2, 'mouseup': 2, 'mousedown': 2, 'contextmenu': 2,
'mousewheel': 2, 'DOMMouseScroll': 2,
'mouseover': 2, 'mouseout': 2, 'mousemove': 2, 'selectstart': 2, 'selectend': 2,
'keydown': 2, 'keypress': 2, 'keyup': 2,
'focus': 2, 'blur': 2, 'change': 2, 'reset': 2, 'select': 2, 'submit': 2,
'load': 1, 'unload': 1, 'beforeunload': 1, 'resize': 1, 'move': 1, 'DOMContentLoaded': 1, 'readystatechange': 1,
'error': 1, 'abort': 1, 'scroll': 1
};
(function(){
var checkRelatedTarget = function(event){
var related = event.relatedTarget;
if (!related) return true;
return ($type(this) != 'document' && related != this && related.prefix != 'xul' && !this.hasChild(related));
};
Element.Events = new Hash({
mouseenter: {
base: 'mouseover',
condition: checkRelatedTarget
},
mouseleave: {
base: 'mouseout',
condition: checkRelatedTarget
},
mousewheel: {
base: (Browser.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel'
}
});
})();
Element.Properties.styles = {set: function(styles){
this.setStyles(styles);
}};
Element.Properties.opacity = {
set: function(opacity, novisibility){
if (!novisibility){
if (opacity == 0){
if (this.style.visibility != 'hidden') this.style.visibility = 'hidden';
} else {
if (this.style.visibility != 'visible') this.style.visibility = 'visible';
}
}
if (!this.currentStyle || !this.currentStyle.hasLayout) this.style.zoom = 1;
if (Browser.Engine.trident) this.style.filter = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')';
this.style.opacity = opacity;
this.store('opacity', opacity);
},
get: function(){
return this.retrieve('opacity', 1);
}
};
Element.implement({
setOpacity: function(value){
return this.set('opacity', value, true);
},
getOpacity: function(){
return this.get('opacity');
},
setStyle: function(property, value){
switch (property){
case 'opacity': return this.set('opacity', parseFloat(value));
case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat';
}
property = property.camelCase();
if ($type(value) != 'string'){
var map = (Element.Styles.get(property) || '@').split(' ');
value = $splat(value).map(function(val, i){
if (!map[i]) return '';
return ($type(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
}).join(' ');
} else if (value == String(Number(value))){
value = Math.round(value);
}
this.style[property] = value;
return this;
},
getStyle: function(property){
switch (property){
case 'opacity': return this.get('opacity');
case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat';
}
property = property.camelCase();
var result = this.style[property];
if (!$chk(result)){
result = [];
for (var style in Element.ShortStyles){
if (property != style) continue;
for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s));
return result.join(' ');
}
result = this.getComputedStyle(property);
}
if (result){
result = String(result);
var color = result.match(/rgba?\([\d\s,]+\)/);
if (color) result = result.replace(color[0], color[0].rgbToHex());
}
if (Browser.Engine.presto || (Browser.Engine.trident && !$chk(parseInt(result)))){
if (property.test(/^(height|width)$/)){
var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
values.each(function(value){
size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
}, this);
return this['offset' + property.capitalize()] - size + 'px';
}
if (Browser.Engine.presto && String(result).test('px')) return result;
if (property.test(/(border(.+)Width|margin|padding)/)) return '0px';
}
return result;
},
setStyles: function(styles){
for (var style in styles) this.setStyle(style, styles[style]);
return this;
},
getStyles: function(){
var result = {};
Array.each(arguments, function(key){
result[key] = this.getStyle(key);
}, this);
return result;
}
});
Element.Styles = new Hash({
width: '@px', height: '@px', left: '@px', top: '@px', bottom: '@px', right: '@px', maxWidth: '@px', maxHeight: '@px',
backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
zIndex: '@', 'zoom': '@', fontWeight: '@',
textIndent: '@px', opacity: '@'
});
Element.ShortStyles = {'margin': {}, 'padding': {}, 'border': {}, 'borderWidth': {}, 'borderStyle': {}, 'borderColor': {}};
['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
var Short = Element.ShortStyles;
var All = Element.Styles;
['margin', 'padding'].each(function(style){
var sd = style + direction;
Short[style][sd] = All[sd] = '@px';
});
var bd = 'border' + direction;
Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
Short[bd] = {};
Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
});
(function(){
function $body(el){
return el.tagName.toLowerCase() == 'body';
};
Element.implement({
positioned: function(){
if ($body(this)) return true;
return (Element.getComputedStyle(this, 'position') != 'static');
},
getOffsetParent: function(){
if ($body(this)) return null;
if (!Browser.Engine.trident) return $(this.offsetParent);
var el = this;
while ((el = el.parentNode)){
if (Element.positioned(el)) return $(el);
}
return null;
},
getSize: function(){
if ($body(this)) return this.getWindow().getSize();
return {x: this.offsetWidth, y: this.offsetHeight};
},
getScrollSize: function(){
if ($body(this)) return this.getWindow().getScrollSize();
return {x: this.scrollWidth, y: this.scrollHeight};
},
getScroll: function(){
if ($body(this)) return this.getWindow().getScroll();
return {x: this.scrollLeft, y: this.scrollTop};
},
scrollTo: function(x, y){
if ($body(this)) return this.getWindow().scrollTo(x, y);
this.scrollLeft = x;
this.scrollTop = y;
return this;
},
getPosition: function(relative){
if ($body(this)) return {x: 0, y: 0};
var el = this, position = {x: 0, y: 0};
while (el){
position.x += el.offsetLeft;
position.y += el.offsetTop;
el = el.offsetParent;
}
var rpos = (relative) ? $(relative).getPosition() : {x: 0, y: 0};
return {x: position.x - rpos.x, y: position.y - rpos.y};
},
getCoordinates: function(element){
if ($body(this)) return this.getWindow().getCoordinates();
var position = this.getPosition(element), size = this.getSize();
var obj = {'top': position.y, 'left': position.x, 'width': size.x, 'height': size.y};
obj.right = obj.left + obj.width;
obj.bottom = obj.top + obj.height;
return obj;
},
getRelativePosition: function(){
return this.getPosition(this.getOffsetParent());
},
computePosition: function(obj){
return {
left: obj.x - (this.getComputedStyle('margin-left').toInt() || 0),
top: obj.y - (this.getComputedStyle('margin-top').toInt() || 0)
};
},
position: function(obj){
return this.setStyles(this.computePosition(obj));
}
});
})();
Native.implement([Window, Document], {
getSize: function(){
var doc = this.getDocument(), win = this.getWindow(), html = doc.documentElement;
if (Browser.Engine.webkit419) return {x: win.innerWidth, y: win.innerHeight};
if (Browser.Engine.presto925) return {x: doc.body.clientWidth, y: doc.body.clientHeight};
return {x: html.clientWidth, y: html.clientHeight};
},
getScroll: function(){
var win = this.getWindow(), html = this.getDocument().documentElement;
return {x: $pick(win.pageXOffset, html.scrollLeft), y: $pick(win.pageYOffset, html.scrollTop)};
},
getScrollSize: function(){
var doc = this.getDocument(), html = doc.documentElement, body = doc.body;
if (Browser.Engine.trident) return {x: Math.max(html.clientWidth, html.scrollWidth), y: Math.max(html.clientHeight, html.scrollHeight)};
if (Browser.Engine.webkit) return {x: body.scrollWidth, y: body.scrollHeight};
return {x: html.scrollWidth, y: html.scrollHeight};
},
getPosition: function(){
return {x: 0, y: 0};
},
getCoordinates: function(){
var size = this.getSize();
return {top: 0, left: 0, height: size.y, width: size.x, bottom: size.y, right: size.x};
}
});
Native.implement([Window, Document, Element], {
getHeight: function(){
return this.getSize().y;
},
getWidth: function(){
return this.getSize().x;
},
getScrollTop: function(){
return this.getScroll().y;
},
getScrollLeft: function(){
return this.getScroll().x;
},
getScrollHeight: function(){
return this.getScrollSize().y;
},
getScrollWidth: function(){
return this.getScrollSize().x;
},
getTop: function(){
return this.getPosition().y;
},
getLeft: function(){
return this.getPosition().x;
}
});
Native.implement([Element, Document], {
getElements: function(selectors, nocash){
var Local = {};
selectors = selectors.split(',');
var elements = [], j = selectors.length;
var ddup = (j > 1);
for (var i = 0; i < j; i++){
var selector = selectors[i], items = [], separators = [];
selector = selector.trim().replace(Selectors.sRegExp, function(match){
if (match.charAt(2)) match = match.trim();
separators.push(match.charAt(0));
return ':)' + match.charAt(1);
}).split(':)');
for (var k = 0, l = selector.length; k < l; k++){
var sel = Selectors.parse(selector[k]);
if (!sel) return [];
var temp = Selectors.Method.getParam(items, separators[k - 1] || false, this, sel, Local);
if (!temp) break;
items = temp;
}
var partial = Selectors.Method.getItems(items, this);
elements = (ddup) ? elements.concat(partial) : partial;
}
return new Elements(elements, {ddup: ddup, cash: !nocash});
}
});
Window.implement({
$E: function(selector){
return this.document.getElement(selector);
}
});
var Selectors = {
regExp: (/:([^-:(]+)[^:(]*(?:\((["']?)(.*?)\2\))?|\[(\w+)(?:([!*^$~|]?=)(["']?)(.*?)\6)?\]|\.[\w-]+|#[\w-]+|\w+|\*/g),
sRegExp: (/\s*([+>~\s])[a-zA-Z#.*\s]/g)
};
Selectors.parse = function(selector){
var params = {tag: '*', id: null, classes: [], attributes: [], pseudos: []};
selector = selector.replace(Selectors.regExp, function(bit){
switch (bit.charAt(0)){
case '.': params.classes.push(bit.slice(1)); break;
case '#': params.id = bit.slice(1); break;
case '[': params.attributes.push([arguments[4], arguments[5], arguments[7]]); break;
case ':':
var xparser = Selectors.Pseudo.get(arguments[1]);
if (!xparser){
params.attributes.push([arguments[1], arguments[3] ? '=' : '', arguments[3]]);
break;
}
var pseudo = {'name': arguments[1], 'parser': xparser, 'argument': (xparser.parser) ? xparser.parser(arguments[3]) : arguments[3]};
params.pseudos.push(pseudo);
break;
default: params.tag = bit;
}
return '';
});
return params;
};
Selectors.Pseudo = new Hash;
Selectors.XPath = {
getParam: function(items, separator, context, params){
var temp = '';
switch (separator){
case ' ': temp += '//'; break;
case '>': temp += '/'; break;
case '+': temp += '/following-sibling::*[1]/self::'; break;
case '~': temp += '/following-sibling::'; break;
}
temp += (context.namespaceURI) ? 'xhtml:' + params.tag : params.tag;
var i;
for (i = params.pseudos.length; i--; i){
var pseudo = params.pseudos[i];
if (pseudo.parser && pseudo.parser.xpath) temp += pseudo.parser.xpath(pseudo.argument);
else temp += ($chk(pseudo.argument)) ? '[@' + pseudo.name + '="' + pseudo.argument + '"]' : '[@' + pseudo.name + ']';
}
if (params.id) temp += '[@id="' + params.id + '"]';
for (i = params.classes.length; i--; i) temp += '[contains(concat(" ", @class, " "), " ' + params.classes[i] + ' ")]';
for (i = params.attributes.length; i--; i){
var bits = params.attributes[i];
switch (bits[1]){
case '=': temp += '[@' + bits[0] + '="' + bits[2] + '"]'; break;
case '*=': temp += '[contains(@' + bits[0] + ', "' + bits[2] + '")]'; break;
case '^=': temp += '[starts-with(@' + bits[0] + ', "' + bits[2] + '")]'; break;
case '$=': temp += '[substring(@' + bits[0] + ', string-length(@' + bits[0] + ') - ' + bits[2].length + ' + 1) = "' + bits[2] + '"]'; break;
case '!=': temp += '[@' + bits[0] + '!="' + bits[2] + '"]'; break;
case '~=': temp += '[contains(concat(" ", @' + bits[0] + ', " "), " ' + bits[2] + ' ")]'; break;
case '|=': temp += '[contains(concat("-", @' + bits[0] + ', "-"), "-' + bits[2] + '-")]'; break;
default: temp += '[@' + bits[0] + ']';
}
}
items.push(temp);
return items;
},
getItems: function(items, context){
var elements = [];
var doc = context.getDocument();
var xpath = doc.evaluate('.//' + items.join(''), context, Selectors.XPath.resolver, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0, j = xpath.snapshotLength; i < j; i++) elements[i] = xpath.snapshotItem(i);
return elements;
},
resolver: function(prefix){
return (prefix == 'xhtml') ? 'http://www.w3.org/1999/xhtml' : false;
}
};
Selectors.Filter = {
getParam: function(items, separator, context, params, Local){
var found = [];
var tag = params.tag;
if (separator){
var uniques = {}, child, children, item, k, l;
var add = function(child){
child.uid = child.uid || [Native.UID++];
if (!uniques[child.uid] && Selectors.Filter.match(child, params, Local)){
uniques[child.uid] = true;
found.push(child);
return true;
}
return false;
};
for (var i = 0, j = items.length; i < j; i++){
item = items[i];
switch(separator){
case ' ':
children = item.getElementsByTagName(tag);
params.tag = false;
for (k = 0, l = children.length; k < l; k++) add(children[k]);
break;
case '>':
children = item.childNodes;
for (k = 0, l = children.length; k < l; k++){
if (children[k].nodeType == 1) add(children[k]);
}
break;
case '+':
while ((item = item.nextSibling)){
if (item.nodeType == 1){
add(item);
break;
}
}
break;
case '~':
while ((item = item.nextSibling)){
if (item.nodeType == 1 && add(item)) break;
}
break;
}
}
return found;
}
if (params.id){
el = context.getElementById(params.id, true);
params.id = false;
return (el && Selectors.Filter.match(el, params, Local)) ? [el] : false;
} else {
items = context.getElementsByTagName(tag);
params.tag = false;
for (var m = 0, n = items.length; m < n; m++){
if (Selectors.Filter.match(items[m], params, Local)) found.push(items[m]);
}
}
return found;
},
getItems: $arguments(0)
};
Selectors.Filter.match = function(el, params, Local){
Local = Local || {};
if (params.id && params.id != el.id) return false;
if (params.tag && params.tag != '*' && params.tag != el.tagName.toLowerCase()) return false;
var i;
for (i = params.classes.length; i--; i){
if (!el.className || !el.className.contains(params.classes[i], ' ')) return false;
}
for (i = params.attributes.length; i--; i){
var bits = params.attributes[i];
var result = Element.prototype.getProperty.call(el, bits[0]);
if (!result) return false;
if (!bits[1]) continue;
var condition;
switch (bits[1]){
case '=': condition = (result == bits[2]); break;
case '*=': condition = (result.contains(bits[2])); break;
case '^=': condition = (result.substr(0, bits[2].length) == bits[2]); break;
case '$=': condition = (result.substr(result.length - bits[2].length) == bits[2]); break;
case '!=': condition = (result != bits[2]); break;
case '~=': condition = result.contains(bits[2], ' '); break;
case '|=': condition = result.contains(bits[2], '-');
}
if (!condition) return false;
}
for (i = params.pseudos.length; i--; i){
if (!params.pseudos[i].parser.filter.call(el, params.pseudos[i].argument, Local)) return false;
}
return true;
};
Selectors.Method = (Browser.Features.xpath) ? Selectors.XPath : Selectors.Filter;
Element.implement({
match: function(selector){
return (!selector || Selectors.Filter.match(this, Selectors.parse(selector)));
}
});
Element.Events.domready = {
onAdd: function(fn){
if (Browser.loaded) fn.call(this);
}
};
(function(){
var domready = function(){
if (Browser.loaded) return;
Browser.loaded = true;
window.fireEvent('domready');
document.fireEvent('domready');
};
switch (Browser.Engine.name){
case 'webkit': (function(){
(['loaded', 'complete'].contains(document.readyState)) ? domready() : arguments.callee.delay(50);
})(); break;
case 'trident': (function(){
var temp = document.createElement('div');
try {
temp.doScroll('left');
} catch(e){
arguments.callee.delay(50);
return;
}
domready();
})(); break;
default:
window.addEvent('load', domready);
document.addEvent('DOMContentLoaded', domready);
}
})();
var JSON = new Hash({
encode: function(obj){
switch ($type(obj)){
case 'string':
return '"' + obj.replace(/[\x00-\x1f\\"]/g, JSON.$replaceChars) + '"';
case 'array':
return '[' + String(obj.map(JSON.encode).filter($defined)) + ']';
case 'object': case 'hash':
var string = [];
Hash.each(obj, function(value, key){
var json = JSON.encode(value);
if (json) string.push(JSON.encode(key) + ':' + json);
});
return '{' + String(string) + '}';
case 'number': case 'boolean': return String(obj);
case false: return 'null';
}
return null;
},
$specialChars: {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'},
$replaceChars: function(chr){
return JSON.$specialChars[chr] || '\\u00' + Math.floor(chr.charCodeAt() / 16).toString(16) + (chr.charCodeAt() % 16).toString(16);
},
decode: function(string, secure){
if ($type(string) != 'string' || !string.length) return null;
if (secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null;
return eval('(' + string + ')');
}
});
Native.implement([Hash, Array, String, Number], {
toJSON: function(){
return JSON.encode(this);
}
});
var Cookie = new Class({
Implements: Options,
options: {
path: false,
domain: false,
duration: false,
secure: false,
document: document
},
initialize: function(key, options){
this.key = key;
this.setOptions(options);
},
write: function(value){
value = encodeURIComponent(value);
if (this.options.domain) value += '; domain=' + this.options.domain;
if (this.options.path) value += '; path=' + this.options.path;
if (this.options.duration){
var date = new Date();
date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
value += '; expires=' + date.toGMTString();
}
if (this.options.secure) value += '; secure';
this.options.document.cookie = this.key + '=' + value;
return this;
},
read: function(){
var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
return value ? decodeURIComponent(value[1]) : null;
},
erase: function(){
new Cookie(this.key, $merge(this.options, {duration: -1})).write('');
return this;
}
});
Cookie.set = function(key, value, options){
return new Cookie(key, options).write(value);
};
Cookie.get = function(key){
return new Cookie(key).read();
};
Cookie.remove = function(key, options){
return new Cookie(key, options).erase();
};
var Color = new Native({
initialize: function(color, type){
if (arguments.length >= 3){
type = "rgb"; color = Array.slice(arguments, 0, 3);
} else if (typeof color == 'string'){
if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
else if (color.match(/hsb/)) color = color.hsbToRgb();
else color = color.hexToRgb(true);
}
type = type || 'rgb';
switch (type){
case 'hsb':
var old = color;
color = color.hsbToRgb();
color.hsb = old;
break;
case 'hex': color = color.hexToRgb(true); break;
}
color.rgb = color.slice(0, 3);
color.hsb = color.hsb || color.rgbToHsb();
color.hex = color.rgbToHex();
return $extend(color, this);
}
});
Color.implement({
mix: function(){
var colors = Array.slice(arguments);
var alpha = ($type(colors.getLast()) == 'number') ? colors.pop() : 50;
var rgb = this.slice();
colors.each(function(color){
color = new Color(color);
for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
});
return new Color(rgb, 'rgb');
},
invert: function(){
return new Color(this.map(function(value){
return 255 - value;
}));
},
setHue: function(value){
return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
},
setSaturation: function(percent){
return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
},
setBrightness: function(percent){
return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
}
});
function $RGB(r, g, b){
return new Color([r, g, b], 'rgb');
};
function $HSB(h, s, b){
return new Color([h, s, b], 'hsb');
};
function $HEX(hex){
return new Color(hex, 'hex');
};
Array.implement({
rgbToHsb: function(){
var red = this[0], green = this[1], blue = this[2];
var hue, saturation, brightness;
var max = Math.max(red, green, blue), min = Math.min(red, green, blue);
var delta = max - min;
brightness = max / 255;
saturation = (max != 0) ? delta / max : 0;
if (saturation == 0){
hue = 0;
} else {
var rr = (max - red) / delta;
var gr = (max - green) / delta;
var br = (max - blue) / delta;
if (red == max) hue = br - gr;
else if (green == max) hue = 2 + rr - br;
else hue = 4 + gr - rr;
hue /= 6;
if (hue < 0) hue++;
}
return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
},
hsbToRgb: function(){
var br = Math.round(this[2] / 100 * 255);
if (this[1] == 0){
return [br, br, br];
} else {
var hue = this[0] % 360;
var f = hue % 60;
var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
switch (Math.floor(hue / 60)){
case 0: return [br, t, p];
case 1: return [q, br, p];
case 2: return [p, br, t];
case 3: return [p, q, br];
case 4: return [t, p, br];
case 5: return [br, p, q];
}
}
return false;
}
});
String.implement({
rgbToHsb: function(){
var rgb = this.match(/\d{1,3}/g);
return (rgb) ? hsb.rgbToHsb() : null;
},
hsbToRgb: function(){
var hsb = this.match(/\d{1,3}/g);
return (hsb) ? hsb.hsbToRgb() : null;
}
});
var Fx = new Class({
Implements: [Chain, Events, Options],
options: {
fps: 50,
unit: false,
duration: 500,
link: 'ignore',
transition: function(p){
return -(Math.cos(Math.PI * p) - 1) / 2;
}
},
initialize: function(options){
this.pass = this.pass || this;
this.setOptions(options);
this.options.duration = Fx.Durations[this.options.duration] || this.options.duration.toInt();
var wait = this.options.wait;
if (wait === false) this.options.link = 'cancel';
},
step: function(){
var time = $time();
if (time < this.time + this.options.duration){
var delta = this.options.transition((time - this.time) / this.options.duration);
this.set(this.compute(this.from, this.to, delta));
} else {
this.set(this.compute(this.from, this.to, 1));
this.complete();
}
},
set: function(now){
return now;
},
compute: function(from, to, delta){
return Fx.compute(from, to, delta);
},
check: function(){
if (!this.timer) return true;
switch (this.options.link){
case 'cancel': this.cancel(); return true;
case 'chain': this.chain(this.start.bind(this, arguments)); return false;
}
return false;
},
start: function(from, to){
if (!this.check(from, to)) return this;
this.from = from;
this.to = to;
this.time = 0;
this.startTimer();
this.onStart();
return this;
},
complete: function(){
return (!this.stopTimer()) ? this : this.onComplete();
},
cancel: function(){
return (!this.stopTimer()) ? this : this.onCancel();
},
onStart: function(){
return this.fireEvent('onStart', this.pass);
},
onComplete: function(){
return this.fireEvent('onComplete', this.pass).callChain();
},
onCancel: function(){
return this.fireEvent('onCancel', this.pass).clearChain();
},
pause: function(){
this.stopTimer();
return this;
},
resume: function(){
this.startTimer();
return this;
},
stopTimer: function(){
if (!this.timer) return false;
this.time = $time() - this.time;
this.timer = $clear(this.timer);
return true;
},
startTimer: function(){
if (this.timer) return false;
this.time = $time() - this.time;
this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this);
return true;
}
});
Fx.compute = function(from, to, delta){
return (to - from) * delta + from;
};
Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
Fx.CSS = new Class({
Extends: Fx,
prepare: function(element, property, values){
values = $splat(values);
var values1 = values[1];
if (!$chk(values1)){
values[1] = values[0];
values[0] = element.getStyle(property);
}
var parsed = values.map(this.parse);
return {from: parsed[0], to: parsed[1]};
},
parse: function(value){
value = $lambda(value)();
value = (typeof value == 'string') ? value.split(' ') : $splat(value);
return value.map(function(val){
val = String(val);
var found = false;
Fx.CSS.Parsers.each(function(parser, key){
if (found) return;
var parsed = parser.parse(val);
if ($chk(parsed)) found = {'value': parsed, 'parser': parser};
});
found = found || {value: val, parser: Fx.CSS.Parsers.String};
return found;
});
},
compute: function(from, to, delta){
var computed = [];
(Math.min(from.length, to.length)).times(function(i){
computed.push({'value': from[i].parser.compute(from[i].value, to[i].value, delta), 'parser': from[i].parser});
});
computed.$family = {name: 'fx:css:value'};
return computed;
},
serve: function(value, unit){
if ($type(value) != 'fx:css:value') value = this.parse(value);
var returned = [];
value.each(function(bit){
returned = returned.concat(bit.parser.serve(bit.value, unit));
});
return returned;
},
render: function(element, property, value){
element.setStyle(property, this.serve(value, this.options.unit));
},
search: function(selector){
var to = {};
Array.each(document.styleSheets, function(sheet, j){
var rules = sheet.rules || sheet.cssRules;
Array.each(rules, function(rule, i){
if (!rule.style || !rule.selectorText || !rule.selectorText.test('^' + selector + '$')) return;
Element.Styles.each(function(value, style){
if (!rule.style[style] || Element.ShortStyles[style]) return;
value = String(rule.style[style]);
to[style] = (value.test(/^rgb/)) ? value.rgbToHex() : value;
});
});
});
return to;
}
});
Fx.CSS.Parsers = new Hash({
Color: {
parse: function(value){
if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
},
compute: function(from, to, delta){
return from.map(function(value, i){
return Math.round(Fx.compute(from[i], to[i], delta));
});
},
serve: function(value){
return value.map(Number);
}
},
Number: {
parse: function(value){
return parseFloat(value);
},
compute: function(from, to, delta){
return Fx.compute(from, to, delta);
},
serve: function(value, unit){
return (unit) ? value + unit : value;
}
},
String: {
parse: $lambda(false),
compute: $arguments(1),
serve: $arguments(0)
}
});
Fx.Tween = new Class({
Extends: Fx.CSS,
initialize: function(element, property, options){
this.element = this.pass = $(element);
this.property = property;
arguments.callee.parent(options);
},
set: function(now){
this.render(this.element, this.property, now);
return this;
},
start: function(){
var fromto = Array.slice(arguments);
if (!this.check(fromto)) return this;
var parsed = this.prepare(this.element, this.property, fromto);
return arguments.callee.parent(parsed.from, parsed.to);
}
});
Element.Properties.tween = {
set: function(options){
var tween = this.retrieve('tween');
if (tween) tween.cancel();
return this.store('tween', new Fx.Tween(this, null, $extend({link: 'cancel'}, options)));
},
get: function(property, options){
if (options || !this.retrieve('tween')) this.set('tween', options);
var tween = this.retrieve('tween');
tween.property = property;
return tween;
}
};
Element.implement({
tween: function(property){
var tween = this.get('tween', property);
tween.start.apply(tween, Array.slice(arguments, 1));
return this;
},
fade: function(how){
var fade = this.get('tween', 'opacity');
how = $pick(how, 'toggle');
switch (how){
case 'in': fade.start(1); break;
case 'out': fade.start(0); break;
case 'show': fade.set(1); break;
case 'hide': fade.set(0); break;
case 'toggle': fade.start((function(){
return (this.getStyle('visibility') == 'hidden') ? 1 : 0;
}).bind(this)); break;
default: fade.start.apply(fade, arguments);
}
return this;
},
highlight: function(start, end){
if (!end){
var style = this.getStyle('background-color');
end = (style == 'transparent') ? '#ffffff' : style;
}
this.get('tween', 'background-color').start(start || '#ffff88', end);
return this;
},
effect: function(property, options){
return new Fx.Tween(this, property, options);
}
});
Fx.Morph = new Class({
Extends: Fx.CSS,
initialize: function(element, options){
this.element = this.pass = $(element);
arguments.callee.parent(options);
},
set: function(now){
if (typeof now == 'string') now = this.search(now);
for (var p in now) this.render(this.element, p, now[p]);
return this;
},
compute: function(from, to, delta){
var now = {};
for (var p in from) now[p] = arguments.callee.parent(from[p], to[p], delta);
return now;
},
start: function(properties){
if (!this.check(properties)) return this;
if (typeof properties == 'string') properties = this.search(properties);
var from = {}, to = {};
for (var p in properties){
var parsed = this.prepare(this.element, p, properties[p]);
from[p] = parsed.from;
to[p] = parsed.to;
}
return arguments.callee.parent(from, to);
}
});
Element.Properties.morph = {
set: function(options){
var morph = this.retrieve('morph');
if (morph) morph.cancel();
return this.store('morph', new Fx.Morph(this, $extend({link: 'cancel'}, options)));
},
get: function(options){
if (options || !this.retrieve('morph')) this.set('morph', options);
return this.retrieve('morph');
}
};
Element.implement({
morph: function(props){
this.get('morph').start(props);
return this;
},
effects: function(options){
return new Fx.Morph(this, options);
}
});
Fx.Slide = new Class({
Extends: Fx,
options: {
mode: 'vertical'
},
initialize: function(element, options){
this.addEvent('onComplete', function(){
this.open = (this.wrapper['offset' + this.layout.capitalize()] != 0);
if (this.open && Browser.Engine.webkit419) this.element.dispose().inject(this.wrapper);
}, true);
this.element = this.subject = $(element);
arguments.callee.parent(options);
var wrapper = this.element.retrieve('wrapper');
this.wrapper = wrapper || new Element('div', {
styles: $extend(this.element.getStyles('margin', 'position'), {'overflow': 'hidden'})
}).wraps(this.element);
this.element.store('wrapper', this.wrapper).setStyle('margin', 0);
this.now = [];
this.open = true;
},
vertical: function(){
this.margin = 'margin-top';
this.layout = 'height';
this.offset = this.element.offsetHeight;
},
horizontal: function(){
this.margin = 'margin-left';
this.layout = 'width';
this.offset = this.element.offsetWidth;
},
set: function(now){
this.element.setStyle(this.margin, now[0]);
this.wrapper.setStyle(this.layout, now[1]);
return this;
},
compute: function(from, to, delta){
var now = [];
(2).times(function(i){
now[i] = Fx.compute(from[i], to[i], delta);
});
return now;
},
start: function(how, mode){
if (!this.check(how, mode)) return this;
this[mode || this.options.mode]();
var margin = this.element.getStyle(this.margin).toInt();
var layout = this.wrapper.getStyle(this.layout).toInt();
var caseIn = [[margin, layout], [0, this.offset]];
var caseOut = [[margin, layout], [-this.offset, 0]];
var start;
switch(how){
case 'in': start = caseIn; break;
case 'out': start = caseOut; break;
case 'toggle': start = (this.wrapper['offset' + this.layout.capitalize()] == 0) ? caseIn : caseOut;
}
return arguments.callee.parent(start[0], start[1]);
},
slideIn: function(mode){
return this.start('in', mode);
},
slideOut: function(mode){
return this.start('out', mode);
},
hide: function(mode){
this[mode || this.options.mode]();
this.open = false;
return this.set([-this.offset, 0]);
},
show: function(mode){
this[mode || this.options.mode]();
this.open = true;
return this.set([0, this.offset]);
},
toggle: function(mode){
return this.start('toggle', mode);
}
});
Element.Properties.slide = {
set: function(options){
var slide = this.retrieve('slide');
if (slide) slide.cancel();
return this.store('slide', new Fx.Slide(this, $extend({link: 'cancel'}, options)));
},
get: function(options){
if (options || !this.retrieve('slide')) this.set('slide', options);
return this.retrieve('slide');
}
};
Element.implement({
slide: function(how){
how = how || 'toggle';
var slide = this.get('slide');
switch(how){
case 'hide': slide.hide(); break;
case 'show': slide.show(); break;
default: slide.start(how);
}
return this;
}
});
Fx.Scroll = new Class({
Extends: Fx,
options: {
offset: {'x': 0, 'y': 0},
wheelStops: true
},
initialize: function(element, options){
this.element = this.pass = $(element);
arguments.callee.parent(options);
var cancel = this.cancel.bind(this, false);
if ($type(this.element) != 'element') this.element = $(this.element.getDocument().body);
var stopper = this.element;
if (this.options.wheelStops){
this.addEvent('onStart', function(){
stopper.addEvent('mousewheel', cancel);
}, true);
this.addEvent('onComplete', function(){
stopper.removeEvent('mousewheel', cancel);
}, true);
}
},
set: function(){
var now = Array.flatten(arguments);
this.element.scrollTo(now[0], now[1]);
},
compute: function(from, to, delta){
var now = [];
(2).times(function(i){
now.push(Fx.compute(from[i], to[i], delta));
});
return now;
},
start: function(x, y){
if (!this.check(x, y)) return this;
var offsetSize = this.element.getSize(), scrollSize = this.element.getScrollSize(), scroll = this.element.getScroll(), values = {'x': x, 'y': y};
for (var z in values){
var max = scrollSize[z] - offsetSize[z];
if ($chk(values[z])) values[z] = ($type(values[z]) == 'number') ? values[z].limit(0, max) : max;
else values[z] = scroll[z];
values[z] += this.options.offset[z];
}
return arguments.callee.parent([scroll.x, scroll.y], [values.x, values.y]);
},
toTop: function(){
return this.start(false, 0);
},
toLeft: function(){
return this.start(0, false);
},
toRight: function(){
return this.start('right', false);
},
toBottom: function(){
return this.start(false, 'bottom');
},
toElement: function(el){
var position = $(el).getPosition(this.element);
return this.start(position.x, position.y);
}
});
(function(){
var old = Fx.prototype.initialize;
Fx.prototype.initialize = function(options){
old.call(this, options);
var trans = this.options.transition;
if (typeof trans == 'string' && (trans = trans.split(':'))){
var base = Fx.Transitions;
base = base[trans[0]] || base[trans[0].capitalize()];
if (trans[1]) base = base['ease' + trans[1].capitalize() + (trans[2] ? trans[2].capitalize() : '')];
this.options.transition = base;
}
};
})();
Fx.Transition = function(transition, params){
params = $splat(params);
return $extend(transition, {
easeIn: function(pos){
return transition(pos, params);
},
easeOut: function(pos){
return 1 - transition(1 - pos, params);
},
easeInOut: function(pos){
return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2;
}
});
};
Fx.Transitions = new Hash({
linear: $arguments(0)
});
Fx.Transitions.extend = function(transitions){
for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
};
Fx.Transitions.extend({
Pow: function(p, x){
return Math.pow(p, x[0] || 6);
},
Expo: function(p){
return Math.pow(2, 8 * (p - 1));
},
Circ: function(p){
return 1 - Math.sin(Math.acos(p));
},
Sine: function(p){
return 1 - Math.sin((1 - p) * Math.PI / 2);
},
Back: function(p, x){
x = x[0] || 1.618;
return Math.pow(p, 2) * ((x + 1) * p - x);
},
Bounce: function(p){
var value;
for (var a = 0, b = 1; 1; a += b, b /= 2){
if (p >= (7 - 4 * a) / 11){
value = - Math.pow((11 - 6 * a - 11 * p) / 4, 2) + b * b;
break;
}
}
return value;
},
Elastic: function(p, x){
return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3);
}
});
['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
Fx.Transitions[transition] = new Fx.Transition(function(p){
return Math.pow(p, [i + 2]);
});
});
var Request = new Class({
Implements: [Chain, Events, Options],
options: {
url: '',
data: '',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
},
async: true,
method: 'post',
link: 'ignore',
isSuccess: null,
emulation: true,
urlEncoded: true,
encoding: 'utf-8',
evalScripts: false,
evalResponse: false
},
getXHR: function(){
return (window.XMLHttpRequest) ? new XMLHttpRequest() : ((window.ActiveXObject) ? new ActiveXObject('Microsoft.XMLHTTP') : false);
},
initialize: function(options){
if (!(this.xhr = this.getXHR())) return;
this.setOptions(options);
this.options.isSuccess = this.options.isSuccess || this.isSuccess;
this.headers = new Hash(this.options.headers);
},
onStateChange: function(){
if (this.xhr.readyState != 4 || !this.running) return;
this.running = false;
this.status = 0;
$try(function(){
this.status = this.xhr.status;
}, this);
if (this.options.isSuccess.call(this, this.status)){
this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML};
this.success(this.response.text, this.response.xml);
} else {
this.response = {text: null, xml: null};
this.failure();
}
this.xhr.onreadystatechange = $empty;
},
isSuccess: function(){
return ((this.status >= 200) && (this.status < 300));
},
processScripts: function(text){
if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return $exec(text);
return text.stripScripts(this.options.evalScripts);
},
success: function(text, xml){
this.onSuccess(this.processScripts(text), xml);
},
onSuccess: function(){
this.fireEvent('onComplete', arguments).fireEvent('onSuccess', arguments).callChain();
},
failure: function(){
this.onFailure();
},
onFailure: function(){
this.fireEvent('onComplete').fireEvent('onFailure', this.xhr);
},
setHeader: function(name, value){
this.headers.set(name, value);
return this;
},
getHeader: function(name){
return $try(function(){
return this.getResponseHeader(name);
}, this.xhr) || null;
},
check: function(){
if (!this.running) return true;
switch (this.options.link){
case 'cancel': this.cancel(); return true;
case 'chain': this.chain(this.send.bind(this, arguments)); return false;
}
return false;
},
send: function(options){
if (!this.check(options)) return this;
this.running = true;
var type = $type(options);
if (type == 'string' || type == 'element') options = {data: options};
var old = this.options;
options = $extend({data: old.data, url: old.url, method: old.method}, options);
var data = options.data, url = options.url, method = options.method;
switch($type(data)){
case 'element': data = $(data).toQueryString(); break;
case 'object': case 'hash': data = Hash.toQueryString(data);
}
if (this.options.emulation && ['put', 'delete'].contains(method)){
var _method = '_method=' + method;
data = (data) ? _method + '&' + data : _method;
method = 'post';
}
if (this.options.urlEncoded && method == 'post'){
var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
this.headers.set('Content-type', 'application/x-www-form-urlencoded' + encoding);
}
if (data && method == 'get'){
url = url + (url.contains('?') ? '&' : '?') + data;
data = null;
}
this.xhr.open(method.toUpperCase(), url, this.options.async);
this.xhr.onreadystatechange = this.onStateChange.bind(this);
this.headers.each(function(value, key){
try{
this.xhr.setRequestHeader(key, value);
} catch(e){
this.fireEvent('onException', [e, key, value]);
}
}, this);
this.fireEvent('onRequest');
this.xhr.send(data);
if (!this.options.async) this.onStateChange();
return this;
},
cancel: function(){
if (!this.running) return this;
this.running = false;
this.xhr.abort();
this.xhr.onreadystatechange = $empty;
this.xhr = this.getXHR();
this.fireEvent('onCancel');
return this;
}
});
(function(){
var methods = {};
['get', 'post', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){
methods[method] = function(){
var params = Array.link(arguments, {url: String.type, data: $defined});
return this.send($extend(params, {method: method.toLowerCase()}));
};
});
Request.implement(methods);
})();
Element.Properties.send = {
get: function(options){
if (options || !this.retrieve('send')) this.set('send', options);
return this.retrieve('send');
},
set: function(options){
var send = this.retrieve('send');
if (send) send.cancel();
return this.store('send', new Request($extend({
data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
}, options)));
}
};
Element.implement({
send: function(url){
var sender = this.get('send');
sender.send({data: this, url: url || sender.options.url});
return this;
}
});
Request.HTML = new Class({
Extends: Request,
options: {
update: false,
evalScripts: true,
filter: false
},
processHTML: function(text){
var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i), root;
text = (match) ? match[1] : text;
text = '<root>' + text + '</root>';
if (Browser.Engine.trident){
root = new ActiveXObject('Microsoft.XMLDOM');
root.async = false;
root.loadXML(text);
} else {
root = new DOMParser().parseFromString(text, 'text/xml');
}
root = root.getElementsByTagName('root')[0];
var temp = new Element('div');
for (var i = 0, k = root.childNodes.length; i < k; i++){
var child = Element.clone(root.childNodes[i], true, true);
if (child) temp.grab(child);
}
return temp;
},
success: function(text){
var opts = this.options, response = this.response;
response.html = text.stripScripts(function(script){
response.javascript = script;
});
var temp = this.processHTML(response.html);
response.tree = temp.childNodes;
response.elements = temp.getElements('*');
if (opts.filter) response.tree = response.elements.filterBy(opts.filter);
if (opts.update) $(opts.update).empty().adopt(response.tree);
if (opts.evalScripts) $exec(response.javascript);
this.onSuccess(response.tree, response.elements, response.html, response.javascript);
}
});
Element.Properties.load = {
get: function(options){
if (options || !this.retrieve('load')) this.set('load', options);
return this.retrieve('load');
},
set: function(options){
var load = this.retrieve('load');
if (load) load.cancel();
return this.store('load', new Request.HTML($extend({link: 'cancel', update: this, method: 'get'}, options)));
}
};
Element.implement({
load: function(){
this.get('load').send(Array.link(arguments, {data: Object.type, url: String.type}));
return this;
}
});
Request.JSON = new Class({
Extends: Request,
options: {
secure: true
},
initialize: function(options){
arguments.callee.parent(options);
this.headers.extend({'Accept': 'application/json', 'X-Request': 'JSON'});
},
success: function(text){
this.response.json = JSON.decode(text, this.options.secure);
this.onSuccess(this.response.json, text);
}
});
var Drag = new Class({
Implements: [Events, Options],
options: {/*
onBeforeStart: $empty,
onStart: $empty,
onDrag: $empty,
onCancel: $empty,
onComplete: $empty,*/
snap: 6,
unit: 'px',
grid: false,
style: true,
limit: false,
handle: false,
invert: false,
modifiers: {x: 'left', y: 'top'}
},
initialize: function(){
var params = Array.link(arguments, {'options': Object.type, 'element': $defined});
this.element = $(params.element);
this.document = this.element.getDocument();
this.setOptions(params.options || {});
var htype = $type(this.options.handle);
this.handles = (htype == 'array' || htype == 'collection') ? $$(this.options.handle) : $(this.options.handle) || this.element;
this.mouse = {'now': {}, 'pos': {}};
this.value = {'start': {}, 'now': {}};
this.selection = (Browser.Engine.trident) ? 'selectstart' : 'mousedown';
this.bound = {
start: this.start.bind(this),
check: this.check.bind(this),
drag: this.drag.bind(this),
stop: this.stop.bind(this),
cancel: this.cancel.bind(this),
eventStop: $lambda(false)
};
this.attach();
},
attach: function(){
this.handles.addEvent('mousedown', this.bound.start);
return this;
},
detach: function(){
this.handles.removeEvent('mousedown', this.bound.start);
return this;
},
start: function(event){
this.fireEvent('onBeforeStart', this.element);
this.mouse.start = event.page;
var limit = this.options.limit;
this.limit = {'x': [], 'y': []};
for (var z in this.options.modifiers){
if (!this.options.modifiers[z]) continue;
if (this.options.style) this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt();
else this.value.now[z] = this.element[this.options.modifiers[z]];
if (this.options.invert) this.value.now[z] *= -1;
this.mouse.pos[z] = event.page[z] - this.value.now[z];
if (limit && limit[z]){
for (var i = 2; i--; i){
if ($chk(limit[z][i])) this.limit[z][i] = $lambda(limit[z][i])();
}
}
}
if ($type(this.options.grid) == 'number') this.options.grid = {'x': this.options.grid, 'y': this.options.grid};
this.document.addEvents({mousemove: this.bound.check, mouseup: this.bound.cancel});
this.document.addEvent(this.selection, this.bound.eventStop);
},
check: function(event){
var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2)));
if (distance > this.options.snap){
this.cancel();
this.document.addEvents({
mousemove: this.bound.drag,
mouseup: this.bound.stop
});
this.fireEvent('onStart', this.element).fireEvent('onSnap', this.element);
}
},
drag: function(event){
this.mouse.now = event.page;
for (var z in this.options.modifiers){
if (!this.options.modifiers[z]) continue;
this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
if (this.options.invert) this.value.now[z] *= -1;
if (this.options.limit && this.limit[z]){
if ($chk(this.limit[z][1]) && (this.value.now[z] > this.limit[z][1])){
this.value.now[z] = this.limit[z][1];
} else if ($chk(this.limit[z][0]) && (this.value.now[z] < this.limit[z][0])){
this.value.now[z] = this.limit[z][0];
}
}
if (this.options.grid[z]) this.value.now[z] -= (this.value.now[z] % this.options.grid[z]);
if (this.options.style) this.element.setStyle(this.options.modifiers[z], this.value.now[z] + this.options.unit);
else this.element[this.options.modifiers[z]] = this.value.now[z];
}
this.fireEvent('onDrag', this.element);
},
cancel: function(event){
this.document.removeEvent('mousemove', this.bound.check);
this.document.removeEvent('mouseup', this.bound.cancel);
if (event){
this.document.removeEvent(this.selection, this.bound.eventStop);
this.fireEvent('onCancel', this.element);
}
},
stop: function(event){
this.document.removeEvent(this.selection, this.bound.eventStop);
this.document.removeEvent('mousemove', this.bound.drag);
this.document.removeEvent('mouseup', this.bound.stop);
if (event) this.fireEvent('onComplete', this.element);
}
});
Element.implement({
makeResizable: function(options){
return new Drag(this, $merge({modifiers: {'x': 'width', 'y': 'height'}}, options));
}
});
Drag.Move = new Class({
Extends: Drag,
options: {
droppables: [],
container: false
},
initialize: function(element, options){
arguments.callee.parent(element, options);
this.droppables = $$(this.options.droppables);
this.container = $(this.options.container);
var position = (this.element.positioned()) ? this.element.getStyle('position') : 'absolute';
var styleposition = this.element.getStyles('left', 'top');
if (styleposition.left == 'auto' || styleposition.top == 'auto') this.element.position(this.element.getRelativePosition());
this.element.setStyle('position', position);
},
start: function(event){
if (this.overed){
this.overed.fireEvent('leave', [this.element, this]);
this.overed = null;
}
if (this.container){
var el = this.element, cont = this.container, ccoo = cont.getCoordinates(el.getOffsetParent()), cps = {}, ems = {};
['top', 'right', 'bottom', 'left'].each(function(pad){
cps[pad] = cont.getStyle('padding-' + pad).toInt();
ems[pad] = el.getStyle('margin-' + pad).toInt();
}, this);
var width = el.offsetWidth + ems.left + ems.right, height = el.offsetHeight + ems.top + ems.bottom;
var x = [ccoo.left + cps.left, ccoo.right - cps.right - width];
var y = [ccoo.top + cps.top, ccoo.bottom - cps.bottom - height];
this.options.limit = {x: x, y: y};
}
arguments.callee.parent(event);
},
checkAgainst: function(el){
el = el.getCoordinates();
var now = this.mouse.now;
return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
},
checkDroppables: function(){
var overed = this.droppables.filter(this.checkAgainst, this).getLast();
if (this.overed != overed){
if (this.overed) this.overed.fireEvent('leave', [this.element, this]);
this.overed = overed ? overed.fireEvent('over', [this.element, this]) : null;
}
},
drag: function(event){
arguments.callee.parent(event);
if (this.droppables.length) this.checkDroppables();
},
stop: function(event){
this.checkDroppables();
if (this.overed) this.overed.fireEvent('drop', [this.element, this]);
else this.element.fireEvent('emptydrop', this);
return arguments.callee.parent(event);
}
});
Element.implement({
makeDraggable: function(options){
return new Drag.Move(this, options);
}
});
var Sortables = new Class({
Implements: [Events, Options],
options: {/*
onSort: $empty,
onStart: $empty,
onComplete: $empty,*/
snap: 4,
handle: false,
revert: false,
constrain: false,
cloneOpacity: 0.7,
elementOpacity: 0.3
},
initialize: function(lists, options){
this.setOptions(options);
this.elements = [];
this.lists = [];
this.idle = true;
this.addLists($$($(lists) || lists));
if (this.options.revert) this.effect = new Fx.Morph(null, $merge({duration: 250, link: 'cancel'}, this.options.revert));
},
attach: function(){
this.addLists(this.lists);
return this;
},
detach: function(){
this.lists = this.removeLists(this.lists);
return this;
},
addItems: function(){
Array.flatten(arguments).each(function(element){
this.elements.push(element);
var start = element.retrieve('sortables:start', this.start.bindWithEvent(this, element));
var insert = element.retrieve('sortables:insert', this.insert.bind(this, element));
(this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
element.addEvent('over', insert);
}, this);
return this;
},
addLists: function(){
Array.flatten(arguments).each(function(list){
this.lists.push(list);
this.addItems(list.getChildren());
list.addEvent('over', list.retrieve('sortables:insert', this.insert.bind(this, [list, 'inside'])));
}, this);
return this;
},
removeItems: function(){
var elements = [];
Array.flatten(arguments).each(function(element){
elements.push(element);
this.elements.remove(element);
var start = element.retrieve('sortables:start');
var insert = element.retrieve('sortables:insert');
(this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
element.removeEvent('over', insert);
}, this);
return elements;
},
removeLists: function(){
var lists = [];
Array.flatten(arguments).each(function(list){
lists.push(list);
this.lists.remove(list);
this.removeItems(list.getChildren());
list.removeEvent('over', list.retrieve('sortables:insert'));
}, this);
return lists;
},
getClone: function(element){
return element.clone(true).setStyles({
'margin': '0px',
'position': 'absolute',
'visibility': 'hidden'
}).inject(this.list).position(element.getRelativePosition());
},
getDroppables: function(){
var droppables = this.list.getChildren();
if (!this.options.constrain) droppables = this.lists.concat(droppables).remove(this.list);
return droppables.remove(this.clone).remove(this.element);
},
insert: function(element, where){
if (where) {
this.list = element;
this.drag.droppables = this.getDroppables();
}
where = where || (this.element.getAllPrevious().contains(element) ? 'before' : 'after');
this.element.inject(element, where);
this.fireEvent('onSort', [this.element, this.clone]);
},
start: function(event, element){
if (!this.idle) return;
this.idle = false;
this.element = element;
this.opacity = element.get('opacity');
this.list = element.getParent();
this.clone = this.getClone(element);
this.drag = this.clone.makeDraggable({
snap: this.options.snap,
container: this.options.constrain && this.clone.getParent(),
droppables: this.getDroppables(),
onStart: function(){
event.stop();
this.clone.set('opacity', this.options.cloneOpacity);
this.element.set('opacity', this.options.elementOpacity);
this.fireEvent('onStart', [this.element, this.clone]);
}.bind(this),
onCancel: this.reset.bind(this),
onComplete: this.end.bind(this)
});
this.drag.start(event);
},
end: function(){
this.element.set('opacity', this.opacity);
this.drag.detach();
if (this.effect){
var dim = this.element.getStyles('width', 'height');
var pos = this.clone.computePosition(this.element.getPosition(this.clone.offsetParent), this.clone.getParent().positioned());
this.effect.element = this.clone;
this.effect.start({
'top': pos.top,
'left': pos.left,
'width': dim.width,
'height': dim.height,
'opacity': 0.25
}).chain(this.reset.bind(this));
} else {
this.reset();
}
},
reset: function(){
this.idle = true;
this.clone.destroy();
this.fireEvent('onComplete', this.element);
},
serialize: function(index, modifier){
var serial = this.lists.map(function(list){
return list.getChildren().map(modifier || function(element, index){
return element.get('id');
}, this);
}, this);
if (this.lists.length == 1) index = 0;
return $chk(index) && index >= 0 && index < this.lists.length ? serial[index] : serial;
}
});
var Tips = new Class({
Implements: [Events, Options],
options: {
onShow: function(tip){
tip.setStyle('visibility', 'visible');
},
onHide: function(tip){
tip.setStyle('visibility', 'hidden');
},
maxTitleChars: 30,
showDelay: 100,
hideDelay: 100,
className: 'tool',
offsets: {'x': 16, 'y': 16},
fixed: false
},
initialize: function(elements, options){
this.setOptions(options);
elements = $$(elements);
this.document = (elements.length) ? elements[0].ownerDocument : document;
this.toolTip = new Element('div', {
'class': this.options.className + '-tip',
'styles': {
'position': 'absolute',
'top': '0',
'left': '0',
'visibility': 'hidden'
}
}, this.document).inject(this.document.body);
this.wrapper = new Element('div').inject(this.toolTip);
elements.each(this.build, this);
},
build: function(el){
el.$attributes.myTitle = (el.href && el.get('tag') == 'a') ? el.href.replace('http://', '') : (el.rel || false);
if (el.title){
var dual = el.title.split('::');
if (dual.length > 1){
el.$attributes.myTitle = dual[0].trim();
el.$attributes.myText = dual[1].trim();
} else {
el.$attributes.myText = el.title;
}
el.removeProperty('title');
} else {
el.$attributes.myText = false;
}
if (el.$attributes.myTitle && el.$attributes.myTitle.length > this.options.maxTitleChars)
el.$attributes.myTitle = el.$attributes.myTitle.substr(0, this.options.maxTitleChars - 1) + "&hellip;";
el.addEvent('mouseenter', function(event){
this.start(el);
if (!this.options.fixed) this.locate(event);
else this.position(el);
}.bind(this));
if (!this.options.fixed) el.addEvent('mousemove', this.locate.bind(this));
var end = this.end.bind(this);
el.addEvent('mouseleave', end);
},
start: function(el){
this.wrapper.empty();
if (el.$attributes.myTitle){
this.title = new Element('span').inject(
new Element('div', {'class': this.options.className + '-title'}
).inject(this.wrapper)).set('html', el.$attributes.myTitle);
}
if (el.$attributes.myText){
this.text = new Element('span').inject(
new Element('div', {'class': this.options.className + '-text'}
).inject(this.wrapper)).set('html', el.$attributes.myText);
}
$clear(this.timer);
this.timer = this.show.delay(this.options.showDelay, this);
},
end: function(event){
$clear(this.timer);
this.timer = this.hide.delay(this.options.hideDelay, this);
},
position: function(element){
var pos = element.getPosition();
this.toolTip.setStyles({
'left': pos.x + this.options.offsets.x,
'top': pos.y + this.options.offsets.y
});
},
locate: function(event){
var doc = this.document.getSize();
var scroll = this.document.getScroll();
var tip = {'x': this.toolTip.offsetWidth, 'y': this.toolTip.offsetHeight};
var prop = {'x': 'left', 'y': 'top'};
for (var z in prop){
var pos = event.page[z] + this.options.offsets[z];
if ((pos + tip[z] - scroll[z]) > doc[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
this.toolTip.setStyle(prop[z], pos);
}
},
show: function(){
if (this.options.timeout) this.timer = this.hide.delay(this.options.timeout, this);
this.fireEvent('onShow', [this.toolTip]);
},
hide: function(){
this.fireEvent('onHide', [this.toolTip]);
}
});
var SmoothScroll = new Class({
Extends: Fx.Scroll,
initialize: function(options, context){
context = context || document;
var doc = context.getDocument(), win = context.getWindow();
arguments.callee.parent(doc, options);
this.links = (this.options.links) ? $$(this.options.links) : $$(doc.links);
var location = win.location.href.match(/^[^#]*/)[0] + '#';
this.links.each(function(link){
if (link.href.indexOf(location) != 0) return;
var anchor = link.href.substr(location.length);
if (anchor && $(anchor)) this.useLink(link, anchor);
}, this);
if (!Browser.Engine.webkit419) this.addEvent('onComplete', function(){
win.location.hash = this.anchor;
}, true);
},
useLink: function(link, anchor){
link.addEvent('click', function(event){
this.anchor = anchor;
this.toElement(anchor);
event.stop();
}.bind(this));
}
});
var Slider = new Class({
Implements: [Events, Options],
options: {/*
onChange: $empty,
onComplete: $empty,*/
onTick: function(position){
if(this.options.snap) position = this.toPosition(this.step);
this.knob.setStyle(this.property, position);
},
snap: false,
offset: 0,
range: false,
wheel: false,
steps: 100,
mode: 'horizontal'
},
initialize: function(element, knob, options){
this.setOptions(options);
this.element = $(element);
this.knob = $(knob);
this.previousChange = this.previousEnd = this.step = -1;
this.element.addEvent('mousedown', this.clickedElement.bind(this));
if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement.bindWithEvent(this));
var offset, limit = {}, modifiers = {'x': false, 'y': false};
switch (this.options.mode){
case 'vertical':
this.axis = 'y';
this.property = 'top';
offset = 'offsetHeight';
break;
case 'horizontal':
this.axis = 'x';
this.property = 'left';
offset = 'offsetWidth';
}
this.half = this.knob[offset] / 2;
this.full = this.element[offset] - this.knob[offset] + (this.options.offset * 2);
this.min = $chk(this.options.range[0]) ? this.options.range[0] : 0;
this.max = $chk(this.options.range[1]) ? this.options.range[1] : this.options.steps;
this.range = this.max - this.min;
this.steps = this.options.steps || this.full;
this.stepSize = Math.abs(this.range) / this.steps;
this.stepWidth = this.stepSize * this.full / Math.abs(this.range) ;
this.knob.setStyle('position', 'relative').setStyle(this.property, - this.options.offset);
modifiers[this.axis] = this.property;
limit[this.axis] = [- this.options.offset, this.full - this.options.offset];
this.drag = new Drag(this.knob, {
snap: 0,
limit: limit,
modifiers: modifiers,
onDrag: this.draggedKnob.bind(this),
onStart: this.draggedKnob.bind(this),
onComplete: function(){
this.draggedKnob();
this.end();
}.bind(this)
});
if (this.options.snap) {
this.drag.options.grid = Math.ceil(this.stepWidth);
this.drag.options.limit[this.axis][1] = this.full;
}
},
set: function(step){
if (!((this.range > 0) ^ (step < this.min))) step = this.min;
if (!((this.range > 0) ^ (step > this.max))) step = this.max;
this.step = Math.round(step);
this.checkStep();
this.end();
this.fireEvent('onTick', this.toPosition(this.step));
return this;
},
clickedElement: function(event){
var dir = this.range < 0 ? -1 : 1;
var position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
position = position.limit(-this.options.offset, this.full -this.options.offset);
this.step = Math.round(this.min + dir * this.toStep(position));
this.checkStep();
this.end();
this.fireEvent('onTick', position);
},
scrolledElement: function(event){
var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
this.set(mode ? this.step - this.stepSize : this.step + this.stepSize);
event.stop();
},
draggedKnob: function(){
var dir = this.range < 0 ? -1 : 1;
var position = this.drag.value.now[this.axis];
position = position.limit(-this.options.offset, this.full -this.options.offset);
this.step = Math.round(this.min + dir * this.toStep(position));
this.checkStep();
},
checkStep: function(){
if (this.previousChange != this.step){
this.previousChange = this.step;
this.fireEvent('onChange', this.step);
}
},
end: function(){
if (this.previousEnd !== this.step){
this.previousEnd = this.step;
this.fireEvent('onComplete', this.step + '');
}
},
toStep: function(position){
var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
return this.options.steps ? Math.round(step -= step % this.stepSize) : step;
},
toPosition: function(step){
return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset;
}
});
var Scroller = new Class({
Implements: [Events, Options],
options: {
area: 20,
velocity: 1,
onChange: function(x, y){
this.element.scrollTo(x, y);
}
},
initialize: function(element, options){
this.setOptions(options);
this.element = $(element);
this.listener = ($type(this.element) != 'element') ? $(this.element.getDocument().body) : this.element;
this.timer = null;
},
start: function(){
this.coord = this.getCoords.bind(this);
this.listener.addEvent('mousemove', this.coord);
},
stop: function(){
this.listener.removeEvent('mousemove', this.coord);
this.timer = $clear(this.timer);
},
getCoords: function(event){
this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
if (!this.timer) this.timer = this.scroll.periodical(50, this);
},
scroll: function(){
var size = this.element.getSize(), scroll = this.element.getScroll(), pos = this.element.getPosition(), change = {'x': 0, 'y': 0};
for (var z in this.page){
if (this.page[z] < (this.options.area + pos[z]) && scroll[z] != 0)
change[z] = (this.page[z] - this.options.area - pos[z]) * this.options.velocity;
else if (this.page[z] + this.options.area > (size[z] + pos[z]) && size[z] + size[z] != scroll[z])
change[z] = (this.page[z] - size[z] + this.options.area - pos[z]) * this.options.velocity;
}
if (change.y || change.x) this.fireEvent('onChange', [scroll.x + change.x, scroll.y + change.y]);
}
});
var Asset = new Hash({
javascript: function(source, properties){
properties = $extend({
onload: $empty,
document: document,
check: $lambda(true)
}, properties);
var script = new Element('script', {'src': source, 'type': 'text/javascript'});
var load = properties.onload.bind(script), check = properties.check, doc = properties.document;
delete properties.onload; delete properties.check; delete properties.document;
script.addEvents({
load: load,
readystatechange: function(){
if (['loaded', 'complete'].contains(this.readyState)) load();
}
}).setProperties(properties);
if (Browser.Engine.webkit419) var checker = (function(){
if (!$try(check)) return;
$clear(checker);
load();
}).periodical(50);
return script.inject(doc.head);
},
css: function(source, properties){
return new Element('link', $merge({
'rel': 'stylesheet', 'media': 'screen', 'type': 'text/css', 'href': source
}, properties)).inject(document.head);
},
image: function(source, properties){
properties = $merge({
'onload': $empty,
'onabort': $empty,
'onerror': $empty
}, properties);
var image = new Image();
var element = $(image) || new Element('img');
['load', 'abort', 'error'].each(function(name){
var type = 'on' + name;
var event = properties[type];
delete properties[type];
image[type] = function(){
if (!image) return;
if (!element.parentNode){
element.width = image.width;
element.height = image.height;
}
image = image.onload = image.onabort = image.onerror = null;
event.delay(1, element, element);
element.fireEvent(name, element, 1);
};
});
image.src = element.src = source;
if (image && image.complete) image.onload.delay(1);
return element.setProperties(properties);
},
images: function(sources, options){
options = $merge({
onComplete: $empty,
onProgress: $empty
}, options);
if (!sources.push) sources = [sources];
var images = [];
var counter = 0;
sources.each(function(source){
var img = new Asset.image(source, {
'onload': function(){
options.onProgress.call(this, counter, sources.indexOf(source));
counter++;
if (counter == sources.length) options.onComplete();
}
});
images.push(img);
});
return new Elements(images);
}
});
Fx.Elements = new Class({
Extends: Fx.CSS,
initialize: function(elements, options){
this.elements = this.pass = $$(elements);
arguments.callee.parent(options);
},
compute: function(from, to, delta){
var now = {};
for (var i in from){
var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
for (var p in iFrom) iNow[p] = arguments.callee.parent(iFrom[p], iTo[p], delta);
}
return now;
},
set: function(now){
for (var i in now){
var iNow = now[i];
for (var p in iNow) this.render(this.elements[i], p, iNow[p]);
}
return this;
},
start: function(obj){
if (!this.check(obj)) return this;
var from = {}, to = {};
for (var i in obj){
var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
for (var p in iProps){
var parsed = this.prepare(this.elements[i], p, iProps[p]);
iFrom[p] = parsed.from;
iTo[p] = parsed.to;
}
}
return arguments.callee.parent(from, to);
}
});
var Prototype = {
Version: '1.5 moocompat',
ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
emptyFunction: function() {},
K: function(x) {return x}
};
Class.create = function() {
return function() {
this.initialize.apply(this, arguments);
}
}
function $_(element) { // $ light version (used to reduce the collect of elements)
if (typeof element == 'string')
element = document.getElementById(element);
return element;
}
function $F(element) { // to obseletize
return $(element).getValue();
}
Object.clone = function(object) {
return $merge(object);
}
Object.extend = $extend;
Object.toQueryString = Hash.toQueryString;
Fx.Styles = Fx.Morph;
Fx.Style = Fx.Tween;
String.implement({
escapeHTML: function() { // 1.4
var div = document.createElement('div');
var text = document.createTextNode(this);
div.appendChild(text);
return div.innerHTML;
},
unescapeHTML: function() { // 1.4
var div = document.createElement('div');
div.innerHTML = this.stripTags();
return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
},
stripTags: function() {
return this.replace(/<\/?[^>]+>/gi, '');
},
extractScripts: function() {
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
return (this.match(matchAll) || []).map(function(scriptTag) {
return (scriptTag.match(matchOne) || ['', ''])[1];
});
},
parseJSON: function() {
try {
return eval('(' + this + ')');
} catch (e) {}
throw new SyntaxError("parseJSON");
},
parseUrl: function(){
var bits = this.match(/^(?:([^:\/?#.]+):)?(?:\/\/)?(([^:\/?#]*)(?::(\d*))?)((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[\?#]|$)))*\/?)?([^?#\/]*))?(?:\?([^#]*))?(?:#(.*))?/) || [];
return bits.associate(['uri', 'scheme', 'authority', 'host', 'port', 'path', 'directory', 'file', 'query', 'fragment']);
},
setURL: function() {
var regexp = /(http|https|ftp)([^ ]+)/ig;
return this.replace(regexp, '<a href="$1$2" target="_blank">$1$2</a>');
},
nl2br: function() {
return this.replace(/\n/, '<br>');
}
});
Function.implement({
bindAsEventListener: function(bind, args){
return this.create({'bind': bind, 'event': true, 'arguments': args});
}
});
Array.implement({
inject: function(memo, iterator) {
this.each(function(value, index) {
memo = iterator(memo, value, index);
});
return memo;
},
detect: function(iterator) {
var result;
this.each(function(value, index) {
if (iterator(value, index)) {
result = value;
return result;
}
});
return result;
}
});
Native.implement([Element, Document], {
getElementsByClassName: function(className){
return this.getElements('.' + className);
}
});
Element.implement({
interpolate: function() {
var result = arguments[0].split(/[{}]/);
for (var i = 0; i < result.length; i++) {
if (result[i].trim() != '' && arguments[1][result[i]])
result[i] = arguments[1][result[i]];
}
for (var i = 0; i < result.length; i++) {
if (typeof result[i] == 'string') {
if (result[i].length != 0) {
this.appendChild(document.createTextNode(result[i]));
}
} else {
result[i].inject(this);
}
}
return this;
},
hide: function(){
this.style.display = 'none';
return this;
},
show: function(){
this.style.display = '';
return this;
},
getValue: function(){
return this.get('value');
},
effect: function(property, options){
return new Fx.Style(this, property, options);
},
yellowFade: function(colorStart, colorEnd) {
if (!$defined(colorStart)) colorStart = '#FFFF9C'; // D96072
if (!$defined(colorEnd)) colorEnd = '#FFFFFF';
var fx = this.get('tween', 'background-color', {duration: 500, 'link': 'chain'});
fx.start(colorStart).chain(function(){
fx.start(colorEnd)
});
return this;
},
wait: function(ajax, options) {
var options = $merge(options);
if (!options || !options.notEmpty) {
this.empty();
}
delete options.notEmpty;
var styles = {
};
if (typeof options == 'object') $extend(styles, options);
var spinner = new Element('div', {
'class': 'spinner',
'html': '<div>Loading</div><img src="' + App.getStaticUrl('/img/panel/loading-02.gif') + '" alt="" />',
'styles': styles
}).inject(this);
if (ajax) {
ajax.addEvent('onComplete', function() { spinner.destroy(); })
}
return this;
},
endWait: function() {
var spinner = this.getElement('.spinner');
if (spinner) spinner.destroy();
}
});
$extend(Element, {
getDimensions: function(element) {
element = $_(element);
var display = element.style.display;
if (display != 'none' && display != null) // Safari bug
return {width: element.offsetWidth, height: element.offsetHeight};
var els = element.style;
var originalVisibility = els.visibility;
var originalPosition = els.position;
var originalDisplay = els.display;
els.visibility = 'hidden';
els.position = 'absolute';
els.display = 'block';
var originalWidth = element.clientWidth;
var originalHeight = element.clientHeight;
els.display = originalDisplay;
els.position = originalPosition;
els.visibility = originalVisibility;
return {width: originalWidth, height: originalHeight};
},
visible: function(element) {
return $_(element).style.display != 'none';
},
hide: function(element) { // 66
element = $_(element);
element.style.display = 'none';
return element;
},
show: function(element) { // 53
element = $_(element);
element.style.display = '';
return element;
},
setStyle: function(element, styles) {
return $(element).setStyles(styles);
},
hasClassName: function(element, className){ // 29
element = $_(element);
return element.className.contains(className, ' ');
},
addClassName: function(element, className){ // 207
element = $_(element);
if (!Element.hasClassName(element, className)) element.className = (element.className + ' ' + className).clean();
return element;
},
removeClassName: function(element, className){ // 157
element = $_(element);
element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1').clean();
return element;
},
remove: function(element) {
return $(element).remove();
},
update: function(element, html) {
$_(element).innerHTML = html;
}
});
$extend(Event, {
KEY_BACKSPACE: 8,
KEY_TAB:       9,
KEY_RETURN:   13,
KEY_ESC:      27,
KEY_LEFT:     37,
KEY_UP:       38,
KEY_RIGHT:    39,
KEY_DOWN:     40,
KEY_DELETE:   46,
pointerX: function(event) {
if (!event.$extended) event = new Event(event);
return event.page.x || (event.client.y +
(document.documentElement.scrollLeft || document.body.scrollLeft));
},
pointerY: function(event) {
if (!event.$extended) event = new Event(event);
return event.page.y || (event.client.y +
(document.documentElement.scrollTop || document.body.scrollTop));
},
element: function(event) {
return event.target || new Event(event).target;
},
stop: function(event) {
if (!event || !event.$extended) event = new Event(event);
event.stop();
},
findElement: function(event, tagName) {
var element = event.target || new Event(event).target;
while (element.parentNode && (!element.tagName || (element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
return element;
},
observe: function(element, name, observer, useCapture) {
element = $_(element);
if (name == 'keypress' && $defined(window.webkit)) name = 'keydown';
$(element).addEvent(name, observer);
},
stopObserving: function(element, name, observer, useCapture) {
$(element).removeEvent(name, observer);
}
});
var Ajax = {};
Ajax.Request = new Class({
initialize: function(url, options) {
options.url = url;
if (options.method) {
options.method = options.method.toLowerCase();
}
options.data = options.parameters || options.postBody || '';
if (options.onComplete) {
this.onCompleteFunction = options.onComplete;
options.onComplete = this.onComplete.bind(this);
}
if (options.onSuccess) {
this.onSuccessFunction = options.onSuccess;
options.onSuccess = this.onSuccess.bind(this);
}
if (options.onFailure) {
this.onFailureFunction = options.onFailure;
options.onFailure = this.onFailure.bind(this);
}
this.ajax = new Request(options).send();
},
onSuccess: function() {
if (this.onSuccessFunction && this.ajax.isSuccess()) {
this.onSuccessFunction(this.ajax.xhr);
}
},
onComplete: function() {
if (this.onCompleteFunction) {
this.onCompleteFunction(this.ajax.xhr);
}
},
onFailure: function() {
if (this.onFailureFunction && !this.ajax.isSuccess())
this.onFailureFunction(this.ajax.xhr);
},
request: function(url) {
this.ajax.send(url);
}
});
PeriodicalExecuter = new Class({
initialize: function(callback, frequency) {
this.callback = callback;
this.frequency = frequency;
this.currentlyExecuting = false;
this.registerCallback();
},
registerCallback: function() {
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
},
stop: function() {
if (!this.timer) return;
clearInterval(this.timer);
this.timer = null;
},
onTimerEvent: function() {
if (!this.currentlyExecuting) {
try {
this.currentlyExecuting = true;
this.callback(this);
} finally {
this.currentlyExecuting = false;
}
}
}
});
var Form = {
getElements: function(form) {
return $(form).getElements('input, textarea, select');
}
}
var Position = {
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return [valueL, valueT];
},
page: function(forElement) {
var valueT = 0, valueL = 0;
var element = forElement;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
if (element.offsetParent == document.body)
if (element.getStyle('position')=='absolute') break;
} while (element = element.offsetParent);
element = forElement;
do {
if (!window.opera || element.tagName=='BODY') {
valueT -= element.scrollTop	 || 0;
valueL -= element.scrollLeft || 0;
}
} while (element = element.parentNode);
return [valueL, valueT];
},
clone: function(source, target) {
var options = Object.extend({
setLeft: true,
setTop: true,
setWidth: true,
setHeight: true,
offsetTop: 0,
offsetLeft: 0
}, arguments[2] || {})
source = $(source);
var p = Position.page(source);
target = $(target);
var delta = [0, 0];
var parent = null;
if (target.getStyle('position') == 'absolute') {
parent = Position.offsetParent(target);
delta = Position.page(parent);
}
if (parent == document.body) {
delta[0] -= document.body.offsetLeft;
delta[1] -= document.body.offsetTop;
}
if (options.setLeft)	  target.style.left	 = (p[0] - delta[0] + options.offsetLeft) + 'px';
if (options.setTop)	  target.style.top	 = (p[1] - delta[1] + options.offsetTop) + 'px';
if (options.setWidth)  target.style.width = source.offsetWidth + 'px';
if (options.setHeight) target.style.height = source.offsetHeight + 'px';
},
offsetParent: function(element) {
if (element.offsetParent) return element.offsetParent;
if (element == document.body) return element;
while ((element = element.parentNode) && element != document.body)
if (element.getStyle('position') != 'static')
return element;
return document.body;
},
within: function(element, x, y) {
this.xcomp = x;
this.ycomp = y;
this.offset = this.cumulativeOffset(element);
return (y >= this.offset[1] &&
y <  this.offset[1] + element.offsetHeight &&
x >= this.offset[0] &&
x <  this.offset[0] + element.offsetWidth);
}
};
Hash.implement({
toQueryString: function(){
var queryString = [];
Hash.each(this, function(value, key){
$splat(value).each(function(val){
if ($type(val) == 'object' || $type(val) == 'hash') {
Hash.each(val, function(subvalue, subkey){
$splat(subvalue).each(function(subval){
queryString.push(key + '[' + subkey + ']=' + encodeURIComponent(subval));
});
});
} else {
queryString.push(key + '=' + encodeURIComponent(val));
}
});
});
return queryString.join('&');
}
})
if (typeof window.NV_HOST == "undefined") {
NV_HOST = 'www.netvibes.com';
}
if (typeof window.NV_AVATARS == "undefined") {
NV_AVATARS = 'avatars.netvibes.com';
}
if (typeof window.NV_STATIC == "undefined") {
NV_STATIC = 'http://' + NV_HOST;
}
if (typeof window.NV_PATH == "undefined") {
NV_PATH = 'http://' + NV_HOST + '/';
}
if (typeof UWA == "undefined") var UWA = {};
if (typeof UWA.Widgets == "undefined") UWA.Widgets = {};
if (typeof UWA.Scripts == "undefined") UWA.Scripts = {};
if (typeof UWA.Controls == "undefined") UWA.Controls = {};
if (typeof UWA.Services == "undefined") UWA.Services = {};
if (typeof UWA.Templates == "undefined") UWA.Templates = {};
UWA.version = '1.2';
if (typeof Netvibes == "undefined") var Netvibes = {};
if (typeof Netvibes.UI == "undefined") Netvibes.UI = {};
Netvibes.UI._idIncrement = 0;
UWA.Controls = Netvibes.UI;
if (Netvibes.DLA) UWA.Controls.SearchForm = Netvibes.DLA.SearchForm;
if (typeof _ == "undefined") {
_ = function(s) {
return s
};
}
UWA.extend = function(original, extended) {
for (var key in (extended || {})) original[key] = extended[key];
return original;
}
UWA.merge = function() {
for (var property in arguments[1]) {
if(typeof arguments[0][property] == "undefined")
arguments[0][property] = arguments[1][property];
}
return arguments[0];
}
UWA.log = function(message) {
if (window.console && typeof(console.log) == "function") console.log(message); // firebug, safari
else if (window.opera && typeof(opera.postError) == "function") opera.postError(message);
}
UWA.Class = Class;
UWA.Form = {
getElements: function(form) {
return $(form).getElements('input, textarea, select');
}
}
UWA.Ajax = {
getRequest: function(url, options) {
options.url = url;
if (options.postBody) {
options.data = options.postBody;
options.urlEncoded = false;
delete options.postBody;
} else if (options.parameters) {
options.data = options.parameters;
delete options.parameters;
}
if (options.method) {
options.method = options.method.toLowerCase();
}
if (options.requestHeaders) {
options.headers = options.requestHeaders;
delete options.requestHeaders;
}
if (options.headers) {
options.headers['X-Requested-With'] = 'XMLHttpRequest';
}
return new Request(options);
},
Request: function(url, options) {
var request = this.getRequest(url, options);
return request.send();
},
onCompleteXML: function(arg, callback, context) {
if (typeof callback == "function") callback(arg[1])
},
onCompleteText: function(arg, callback, context) {
if (typeof callback == "function") callback(arg[0])
},
onCompleteFeed: function(arg, callback, context) {
var response = {responseText: arg[0], responseXML: arg[1]};
var feed = UWA.Utils.parseFeed(response);
if (typeof callback == "function") callback(feed)
},
onCompleteJson: function(arg, callback, context) {
try {
eval("var j = " + arg[0]);
if (typeof callback == "function") callback(j, context);
} catch(e) {
UWA.log(e);
}
}
}
UWA.createElement = function(tagName, options){
return UWA.$element( new Element(tagName, options) );
}
UWA.extendElement = function(el){
if (el) {
el = $(el);
if (!el.isUwaExtended) {
UWA.merge(el, UWA.Element);
el.setStyle = UWA.Element.setStyle; // conflict between mootools setStyle and UWA setStyle
el.isUwaExtended = true;
}
return el;
}
}
UWA.$element = UWA.extendElement;
if (typeof UWA.Element == "undefined") UWA.Element = {};
UWA.extend(UWA.Element, {
setAttributes: function(properties) {
return this.setProperties(properties);
}
});
if (typeof UWA.Json == "undefined") UWA.Json = {};
UWA.Json.encode = JSON.encode;
UWA.Json.decode = function(string) { return JSON.decode(string, true) }
UWA.merge(String.prototype, {
stripTags: function() {
return this.replace(/<\/?[^>]+>/gi, '');
},
truncate: function(length, truncation) {
length = length || 30;
truncation = truncation === undefined ? '...' : truncation;
return this.length > length ?
this.slice(0, length - truncation.length) + truncation : String(this);
},
escapeRegExp: function() {
return this.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
},
trim: function(){
return this.replace(/^\s+|\s+$/g, '');
},
isEmail: function() {
var regexp = /^([a-zA-Z0-9_.\-+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regexp.test(this);
},
s: function() {
var str = this;
if (arguments.length < 1) return str;
var re = /([^%]*)%s(.*)/;
var a = [], numSubstitutions = -1;
while (a = re.exec(str)) {
var leftpart = a[1], rightPart = a[2];
if (++numSubstitutions >= arguments.length) {
break;
}
str = leftpart + arguments[numSubstitutions] + rightPart;
}
return str;
},
format : function() {
var args = arguments;
return this.replace(/\{(\d+)\}/g, function(m, i){
return args[i];
});
},
parseRelativeTime: function(raw, offset) {
if (typeof offset != 'number') offset = 0;
var matches = (raw && raw.match(/^(\d\d\d\d)\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/));
if (!matches) return false;
var date = new Date(matches[1], matches[2] - 1, matches[3], matches[4], matches[5], matches[6]);
var relative_to = new Date();
var delta = parseInt((relative_to.getTime() - date.getTime()) / 1000); // Compute the diff
delta = delta + (relative_to.getTimezoneOffset() * 60 + 3600 * offset); // Add timezone offset (+1 because we are not in GMT)
if (delta < 60) {
return _("less than a minute ago");
} else if(delta < 120) {
return _("about a minute ago");
} else if(delta < (45*60)) {
return _("{0} minutes ago").format( Math.round(delta/60) );
} else if(delta < (90*60)) {
return _("about an hour ago");
} else if(delta < (24*60*60)) {
return _("about {0} hours ago").format( Math.round(delta/3600) );
} else if(delta < (48*60*60)) {
return _("yesterday");
} else {
return _("{0} days ago").format( Math.round(delta/86400) );
}
},
contains: function(string, separator) {
return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
},
camelCase: function() {
return this.replace(/-\D/g, function(match) {
return match.charAt(1).toUpperCase();
});
},
makeClickable: function() {
var lines = this.split("<br>");
for(var z=0; z<lines.length; z++){
var tmp = lines[z].split(" ");
for(var i=0; i<tmp.length; i++){
if(tmp[i].indexOf("www.")!=-1 && tmp[i].indexOf("http://")==-1 && tmp[i].indexOf("https://")==-1){
tmp[i] = "<a href='http://"+tmp[i]+"' target='_blank'>"+tmp[i]+"</a>";
} else if(tmp[i].indexOf("http://")!=-1 || tmp[i].indexOf("ftp://")!=-1 || tmp[i].indexOf("https://")!=-1){
tmp[i] = "<a href='"+tmp[i]+"' target='_blank'>"+tmp[i]+"</a>";
}
}
lines[z] = tmp.join(" ");
}
return lines.join("<br>");
}
});
String.format = function(str){
var args = Array.prototype.slice.call(arguments, 1);
return str.format(args);
}
String.parseRelativeTime = String.prototype.parseRelativeTime;
UWA.merge(Array.prototype, {
forEach: function(fn, bind){
for (var i = 0, j = this.length; i < j; i++) fn.call(bind, this[i], i, this);
},
filter: function(fn, bind){
var results = [];
for (var i = 0, j = this.length; i < j; i++){
if (fn.call(bind, this[i], i, this)) results.push(this[i]);
}
return results;
},
map: function(fn, bind){
var results = [];
for (var i = 0, j = this.length; i < j; i++) results[i] = fn.call(bind, this[i], i, this);
return results;
},
every: function(fn, bind){
for (var i = 0, j = this.length; i < j; i++){
if (!fn.call(bind, this[i], i, this)) return false;
}
return true;
},
some: function(fn, bind){
for (var i = 0, j = this.length; i < j; i++){
if (fn.call(bind, this[i], i, this)) return true;
}
return false;
},
indexOf: function(item, from){
var len = this.length;
for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
if (this[i] === item) return i;
}
return -1;
}
});
UWA.merge(Array.prototype, {
normalize: function(sum) {
var x = 0;
var ratio = sum / this.inject(0, function(a, n) { return a + n; } );
for (var i = 0; i < this.length - 1; i++) x += (this[i] *= ratio);
this[this.length - 1] = sum - x;
},
equals: function(compare) {
if (!compare) {
return false;
}
var len = this.length;
if (len != compare.length) {
return false;
}
for (var i = 0; i < len; i++) {
if (this[i] != compare[i]) {
return false;
}
}
return true;
},
detect: function(iterator) {
var result;
this.each(function(value, index) {
if (iterator(value, index)) {
result = value;
return result;
}
});
return result;
}
});
if (typeof Array.prototype.each != "function") {
Array.prototype.each = Array.prototype.forEach;
}
if (typeof UWA.Element == "undefined") UWA.Element = {};
UWA.merge(UWA.Element, {
addContent: function(content) {
if (typeof content == 'string') {
UWA.log("addContent should be soon deprecated. Use alternative syntaxes.");
var node = document.createElement("div");
node.innerHTML = content;
return this.appendChild(node);
}
return this.appendChild(content);
},
setText: function(text) {
this[(typeof this.innerText != 'undefined') ? 'innerText' : 'textContent'] = text;
return this;
},
appendText: function(text) {
var node = document.createTextNode(text);
return this.appendChild(node);
},
setHTML: function(html) {
this.innerHTML = html;
return this;
},
setContent: function(content) {
if (typeof content == 'string') {
this.setHTML(content);
} else if (typeof content == 'object') {
this.innerHTML = '';
this.appendChild(content);
}
return this;
},
hasClassName: function(className) {
return this.className.contains(className, ' ');
},
addClassName: function(className) {
if (!this.hasClassName(className)) this.className = (this.className + ' ' + className);
return this;
},
removeClassName: function(className) {
this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
return this;
},
getParent: function() {
return UWA.$element(this.parentNode);
},
getChildren: function() {
return this.childNodes;
},
empty: function() {
this.innerHTML = '';
return this;
},
hide: function() {
return this.setStyle('display', 'none');
},
show: function() {
return this.setStyle('display', '');
},
toggle: function() {
this.style.display == 'none' ? this.setStyle('display', '') : this.setStyle('display', 'none');
return this;
},
remove: function() {
return this.parentNode.removeChild(this);
},
getDimensions: function() {
return { width: this.offsetWidth, height: this.offsetHeight };
},
setStyle: function(style) {
if (typeof style == 'string') {
style = style.camelCase();
this.style[style] = arguments[1];
} else if (typeof style == 'object') {
return this.setStyles(style);
}
return this;
},
setStyles: function(styles) {
var elementStyle = this.style;
for (var property in styles) {
if (property == 'opacity') {
this.setOpacity(styles[property]);
} else {
elementStyle[(property == 'float' || property == 'cssFloat') ?
(elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
property] = styles[property];
}
}
return this;
},
setOpacity: function(value) {
this.style.opacity = (value == 1 || value === '') ? '' :
(value < 0.00001) ? 0 : value;
return this;
},
inject: function(el, where) {
if (typeof where != 'undefined') {
UWA.log('warning: el.inject. 2nd argument not supported. ' + where);
}
return el.appendChild(this);
},
addListener: function(type, fn) {
if (this.addEventListener) this.addEventListener(type, fn, false);
else this.attachEvent('on' + type, fn);
return this;
},
removeListener: function(type, fn){
if (this.removeEventListener) this.removeEventListener(type, fn, false);
else this.detachEvent('on' + type, fn);
return this;
}
});
if (window.HTMLElement) {
UWA.merge(window.HTMLElement.prototype, UWA.Element);
}
if (typeof UWA.proxies == "undefined") {
UWA.proxies = {
'api'  : NV_PATH + 'proxy/api2Proxy.php',
'rss'  : NV_PATH + 'proxy/xmlProxy.php',
'ajax' : NV_PATH + 'proxy/ajaxProxy.php',
'feed' : NV_PATH + 'proxy/feedProxy.php',
'xml'  : NV_PATH + 'data/xml/'
}
}
if (typeof UWA.Json == "undefined") UWA.Json = {};
UWA.Json.request = function(url, request) {
var varname = 'json';
if (request.context && request.context[0]) varname += request.context[0];
else varname += Math.round(1000*1000*Math.random());
eval(varname + '= false');
url += '&object=' + varname ;
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.src = url;
var head = document.getElementsByTagName('head')[0];
var insert = head.appendChild(script);
if (typeof request.onComplete == "undefined") UWA.log('no callback set');
var callback = request.onComplete;
var myCallback = function(c){ return function(j) { callback(j, c) } }(request.context);
var interval = setInterval( ( function() {
eval('var json = ' + varname);
if (json) {
try {
myCallback(json);
} catch(e) {
UWA.log(e);
}
insert.parentNode.removeChild(insert);
clearInterval(interval);
}
} ).bind(this), 100);
}
UWA.Data = {
useJsonRequest: false,
getFeed: function(url, callback) {
if(UWA.Feeds && UWA.Feeds[url]) {
callback(UWA.Feeds[url]);
setTimeout(function() { UWA.Feeds[url] = null }, 15000);
return;
}
if (typeof UWA.feedCallbackType == "undefined") UWA.feedCallbackType = "json";
return this.request(url, { method : 'GET', proxy: 'feed', type: UWA.feedCallbackType, onComplete: callback } );
},
getXml: function(url, callback) {
return this.request(url, { method : 'GET', type: 'xml', onComplete: callback } );
},
getText: function(url, callback) {
return this.request(url, { method : 'GET', type: 'text', onComplete: callback } );
},
getJson: function(url, callback) {
return this.request(url, { method : 'GET', type: 'json', onComplete: callback } );
},
getModule: function(url, callback, id) {
if (UWA.proxies['api']) {
url = UWA.proxies['api'] + '?moduleUrl=' + encodeURIComponent(url);
return this.request(url, { method : 'GET', type: 'xml', onComplete: callback } );
}
UWA.log('no proxy URL set for module'); return false;
},
request: function(url, request) {
if (typeof request == 'undefined') request = {};
if (typeof request.method == 'undefined') request.method = 'GET';
if (typeof request.headers  == 'undefined') request.headers = {};
request.headers['X-Requested-Method'] = request.method;
if (request.method == 'DELETE' || request.method == 'PUT') {
request.method = 'POST';
}
if (typeof request.proxy == 'undefined') {
if (typeof request.authentication == 'object' || location.hostname == '' ||
(url.substr(0, 4) == "http" && url.indexOf("http://" + location.hostname) == -1) ) {
request.proxy = 'ajax';
}
}
if (typeof request.type == 'undefined') request.type = 'text';
if (UWA.proxies[request.proxy]) {
url = UWA.proxies[request.proxy] + '?url=' + encodeURIComponent(url);
if (request.proxy == "feed" && request.shortFeed != false) url += "&rss=1&g";
} else if (request.proxy) {
UWA.log('no proxy URL set for ' + request.proxy);
}
var auth = request.authentication;
if (typeof auth == 'object') {
if (auth.type) url += '&auth=' + auth.type;
if (auth.gp) url += '&gp=' + auth.gp;
if (auth.moduleId) url += '&moduleId=' + auth.moduleId;
if (auth.username) url += '&username=' + encodeURIComponent(auth.username);
if (auth.password) url += '&password=' + encodeURIComponent(auth.password);
}
if (request.type && request.proxy) {
url += '&type=' + request.type;
}
if (typeof request.cache != 'undefined') {
url += '&cache=' + request.cache;
}
if(UWA.Client.Engine.ie) {
url += '&rnd='+ Math.random();
}
var callbacks = {
'xml'  : 'onCompleteXML',
'feed' : 'onCompleteFeed',
'json' : 'onCompleteJson',
'text' : 'onCompleteText',
'html' : 'onCompleteText'
}
switch(request.type) {
case 'xml':
var callback = request.onComplete;
request.onComplete = function() {
UWA.Ajax.onCompleteXML(arguments, callback);
}
return UWA.Ajax.Request(url, request);
default:
if(typeof request.proxy == 'undefined' || request.proxy == null) {
this.useJsonRequest = false;
}
if (this.useJsonRequest && typeof request.authentication == "undefined") {
return UWA.Json.request(url, request);
} else {
var callback = request.onComplete;
var context = request.context;
if (typeof UWA.Ajax[callbacks[request.type]] == 'undefined') request.type = 'text';
request.onComplete = function() {
UWA.Ajax[callbacks[request.type]](arguments, callback, context);
}
return UWA.Ajax.Request(url, request);
}
}
}
};
UWA.Environment = function() {
this.module = null;
this.widget = this.module;
this.html = {};
this.loaded = false;
this.registered = false;
this.callbacks = {};
this.query = '';
this.data = {};
this.debugMode = false;
this.periodicals = {};
this.delays = {};
this.height = 200;
if(this.initialize) this.initialize();
this.setPeriodical('init', this.init, 100, true);
}
UWA.Environment.prototype = {
init: function() {
if (document.body) {
this.callback('onInit');
this.clearPeriodical('init');
this.log('Environnement loaded');
this.loaded = true;
return true;
}
return false;
},
getModule: function() {
if (this.module) {
var module = this.module;
} else {
var module = new UWA.Module();
this.registerModule(module);
}
return module;
},
registerModule: function(module) {
this.module = module;
this.widget = this.module;
module.environment = this;
this.setPeriodical('register', function() {
if (this.loaded) {
this.callback('onRegisterModule');
this.registered = true;
this.log('Module registered');
this.clearPeriodical('register');
}
}, 100, true);
},
launchModule: function() {
this.setPeriodical('launch', function() {
if (this.loaded && this.module && this.registered) {
this.log('Launching module');
this.clearPeriodical('launch');
this.module.launch();
if (typeof this.module.onLoadComplete != "function") {
this.callback('onLoadComplete');
}
}
}, 100, true);
},
setCallback: function(name, fn) {
this.callbacks[name] = fn;
},
callback: function(name, args, bind) {
if (typeof bind == 'undefined') bind = this;
try {
if (this[name]) return this[name].apply(bind, [args]);
if (this.callbacks[name]) return this.callbacks[name].apply(bind, [args]);
} catch(e) {
this.log(e);
}
return false;
},
setPeriodical: function(name, fn, delay, force) {
this.clearPeriodical(name);
fn = fn.bind(this);
this.periodicals[name] = setInterval(fn, delay);
if (force) fn();
},
clearPeriodical: function(name) {
if (this.periodicals[name]) { clearInterval(this.periodicals[name]) }
},
setDelayed: function(name, fn, delay, bind) {
this.clearDelayed(name);
if(typeof bind == "undefined" || bind === true) fn = fn.bind(this);
this.delays[name] = setTimeout(fn, delay);
},
clearDelayed: function(name) {
if (this.delays[name]) { clearTimeout(this.delays[name]) }
},
setIcon: function(url) {
if(this.module.elements['icon']) this.module.elements['icon'].setHTML('<img width="16" height="16" src="' + url + '" />');
},
log: function(string) {
if (this.debugMode) UWA.log(string);
}
}
UWA.Widget = function() {
this.id = '';
this.environment = null;
this.title = '';
this.body = null;
this.data = {};
this.callbacks = {};
this.preferences = [];
this.metas = {};
this.debugMode = false;
this.periodicals = {};
this.searchResultCount = 0;
this.unreadCount = 0;
this.prefsForm = null;
this.elements = {};
this.inline = false;
this.apiVersion = '1.2';
this.lang = 'en_US';
this.locale = 'us';
this.dir = 'ltr';
this.isNew = false;
this.readOnly = false;
this.theme = null;
if(this.initialize) this.initialize();
}
UWA.Widget.prototype = {
setTitle: function(title, extended) {
this.title = title;
if (this.elements['title']) {
if (extended) {
extended = ' ' + extended + '';
} else {
extended = '';
}
this.elements['title'].setHTML(title + extended);
}
if (this.environment && this.environment.setTitle) this.environment.setTitle(title);
},
getTitle: function() {
if (this.environment && this.environment.getTitle) return this.environment.getTitle();
return this.title.stripTags(); // stripTags = prototype.js
},
setBody: function(content) {
this.body.setContent(content);
this.callback('onUpdateBody');
},
addBody: function(content) {
this.body.addContent(content);
this.callback('onUpdateBody');
},
setIcon: function(url, search) {
if (this.environment.setIcon) {
this.environment.setIcon(url, search);
} else if(this.elements['icon'] && search !== true) {
this.elements['icon'].setHTML('<img width="16" height="16" src="' + url + '" />');
}
},
setElementId: function(element, id) {
UWA.log('widget.setElementId is deprecated');
this.$(element).setAttribute('id', 'm_' + this.id + '_' + id);
},
createElement: function(tagName, options) {
if (typeof options == 'string') {
UWA.log('widget.createElement : elName as 2nd argument is deprecated');
options = {}; // createElement options NEED an objet
}
return UWA.createElement(tagName, options);
},
$: function(el) {
UWA.log('widget.$ is deprecated');
if (typeof el == 'string' && this.elements[el]) {
el = this.elements[el];
}
return UWA.$element(el);
},
initPreferences: function() {
for(var i = 0; i < this.preferences.length; i++) {
var pref = this.preferences[i];
if (typeof pref.name == "undefined") continue; // no name = preference ignored
if (pref.defaultvalue) pref.defaultValue = pref.defaultvalue; // fix after xml parsing
var value = this.getValue(pref.name);
if (value == undefined || value == null || value == 'undefined') { // the last not really needed but could help
if (typeof pref.defaultValue != "undefined") this.data[pref.name] = pref.defaultValue;
else this.data[pref.name] = null;
}
if(pref.defaultValue && value && pref.defaultValue == value) {
}
}
},
getPreference: function(name) {
for(var i = 0; i < this.preferences.length; i++) {
if(this.preferences[i].name == name) return this.preferences[i];
}
return null;
},
setPreferences: function(schema) {
if(typeof schema == 'object') this.preferences = schema;
this.callback('onUpdatePreferences');
},
mergePreferences: function(prefs) {
for (var i = 0; i < prefs.length; i++) {
if (this.getPreference(prefs[i].name) == null) this.addPreference(prefs[i]);
}
},
addPreference: function(preference) {
this.preferences.push(preference);
},
setPreferencesXML: function(prefs) {
this.preferences = []; // this.setPreferences( [] ); // empty preferences array
for(var i = 0; i < prefs.length; i++) {
var preference = {};
for(var j = 0; j < prefs[i].attributes.length; j++) {
var name = prefs[i].attributes[j]['nodeName'];
var value = prefs[i].attributes[j]['nodeValue'];
preference[name] = value;
}
if (preference.type == 'list') {
var options = prefs[i].getElementsByTagName("option");
preference.options = [];
for(var j = 0; j < options.length; j++) {
var option = {};
if ( options[j].attributes[0]['value'] ) option[options[j].attributes[0]['name']] = options[j].attributes[0]['value'];
if ( options[j].attributes[1]['value'] ) option[options[j].attributes[1]['name']] = options[j].attributes[1]['value'];
preference.options.push(option)
}
}
this.addPreference(preference);
}
this.callback('onUpdatePreferences');
},
onEdit: function() {
if (this.prefsForm) {
var form = this.prefsForm;
} else {
var prefsForm = new UWA.Controls.PrefsForm( { module: this } );
var form = prefsForm.getContent();
}
this.elements['edit'].setContent(form);
var infos = this.getInfos();
if(infos) this.elements['edit'].addContent(infos);
this.callback('onShowEdit', this.elements['edit']);
this.elements['edit'].show();
},
getInfos: function() {
if(this.metas['author']) {
if(this.metas['website']) {
var content = 'Widget by <strong><a href="' + this.metas['website'] + '" rel="author">' + this.metas['author'] + '</a></strong>';
} else {
var content = 'Widget by <strong>' + this.metas['author'] + '</strong>';
}
if(this.metas['version']) {
content += ' - version <strong>' + this.metas['version'] + '</strong>';
}
return this.createElement('p').setStyles({'padding': '10px', 'text-align': 'right'}).setHTML(content);
}
return false;
},
endEdit: function() {
this.elements['edit'].hide();
if (this.onRefresh) this.onRefresh();
else if (this.onLoad) this.onLoad();
this.callback('onHideEdit');
},
getValue: function(name) {
if (typeof this.data[name] != "undefined") return this.data[name];
if (this.environment && this.environment.getData) {
var value = this.environment.getData(name);
if (value == 'null') value = null;
this.data[name] = value;
return value;
}
return null;
},
getInt: function(name) {
var value = this.getValue(name);
if(value == 'true' || value == true) value = 1;
value = parseInt(value, 10);
return isNaN(value) ? 0 : value;
},
getBool: function(name) {
return this.getInt(name) ? true : false;
},
setValue: function(name, value) {
if (this.data[name] == value) return value;
this.data[name] = value;
var pref = this.getPreference(name);
if (this.environment && this.environment.setData) this.environment.setData(name, value);
return value;
},
deleteValue: function(name) {
delete this.data[name];
if (this.environment && this.environment.deleteData) return this.environment.deleteData(name);
return false;
},
saveValues: function(callback) {
if (this.environment && this.environment.saveDatas && this.readOnly == false) {
this.environment.saveDatas(callback);
} else {
callback();
}
},
log: function(message) {
if (this.debugMode === true) UWA.log(message);
},
setPeriodical: function(name, fn, delay, force) {
this.clearPeriodical(name);
this.periodicals[name] = setInterval(fn.bind(this), delay);
if (force) fn();
},
clearPeriodical: function(name) {
if (this.periodicals[name]) { clearInterval(this.periodicals[name]) }
},
callback: function(name, args, bind) {
if (typeof bind == 'undefined') bind = this;
try {
if (this[name]) this[name].apply(bind, [args]);
if (this.callbacks[name]) this.callbacks[name].apply(bind, [args]);
} catch(e) {
UWA.log(e);
}
if(this.environment && this.environment.callback) this.environment.callback(name);
},
setCallback: function(name, fn) {
this.callbacks[name] = fn;
},
setMetas: function(metas) {
this.metas = metas;
if(this.metas.debugMode) this.setDebugMode(this.metas.debugMode);
if(this.metas.autoRefresh) this.setAutoRefresh(this.metas.autoRefresh);
},
setDebugMode: function(mode) {
if (mode === true || mode == 'true') this.debugMode = true; else this.debugMode = false;
},
setInline: function(mode) {
UWA.log('widget.setInline is deprecated');
if (mode) this.inline = true; else this.inline = false;
},
setAutoRefresh: function(delay) {
var rndUpdateTime = Math.round(10*1000*Math.random());
delay = parseInt(delay);
if (this.onRefresh && delay && delay > 0) {
delay = delay * 1000 * 60; // from minutes to milliseconds
this.setPeriodical('autoRefresh', this.onRefresh, delay + rndUpdateTime);
}
},
setMetasXML: function(metas) {
var metasArray = [];
for(var i = 0; i < metas.length; i++) {
if(metas[i].name) var name = metas[i].name;
else var name = metas[i].attributes[0]['nodeValue'];
if(metas[i].content) var value = metas[i].content;
else var value = metas[i].attributes[1]['nodeValue'];
if(value == 'false') value = false; else if(value == 'true') value = true; // booleanise
metasArray[name] = value;
}
this.setMetas(metasArray);
},
setStyle: function(style) {
if (typeof style == 'string') {
UWA.Utils.setCss(this.id, style);
}
},
setCSS: function(css) {
UWA.log('widget.setCSS is deprecated. Use widget.setStyle instead.');
UWA.Utils.setCss(this.id, css);
},
setTemplate: function(module) {
UWA.log('setTemplate:' + module.name);
var tpl = module.name;
var klass = new UWA.Templates[tpl](this);
klass.createFromJSON(module);
},
setFeeds: function(feeds) {
if (typeof UWA.Feeds == "undefined") UWA.Feeds = {};
for (key in feeds) UWA.Feeds[key] = feeds[key];
},
setSearchResultCount: function(count) {
this.searchResultCount = count;
if (this.environment.setSearchResultCount) this.environment.setSearchResultCount(count);
},
setUnreadCount: function(count) {
this.unreadCount = count;
if (this.environment && this.environment.setUnreadCount) this.environment.setUnreadCount(count);
},
openURL: function(url) {
if (this.environment && this.environment.openURL) this.environment.openURL(url);
else window.open(url);
},
getHistory: function() {
if (this.environment && this.environment.getHistory) return this.environment.getHistory();
else return this.getValue('history');
},
setHistory: function(history) {
if (this.environment && this.environment.setHistory) this.environment.setHistory(history);
else this.setValue('history', history);
},
saveHistory: function() {
if (this.environment && this.environment.saveHistory) this.environment.saveHistory();
},
addStar: function(data) {
if (this.environment && this.environment.addStar) this.environment.addStar(data);
},
launch: function() {
this.initPreferences();
this.callback('onLoad');
}
};
UWA.Module = UWA.Widget;
UWA.Utils = {
buildUrl: function (moduleUrl, linkHref) {
var first_split = moduleUrl.split("://");
var scheme =  first_split[0]
var without_resource = first_split[1];
var second_split = without_resource.split("/");
var domain = second_split[0];
var path = '';
for (i=1;i<second_split.length-1;i++) {
path += '/' + second_split[i];
}
if (linkHref.split("://").length > 1) { // complete
return false;
} else if (linkHref.substring(0, 1) == '/') { // absolute
return scheme +'://' + domain + linkHref;
} else { // relative
return scheme +'://' + domain + path + '/' + linkHref;
}
},
setTooltip: function(element, text, width) {
if (window.App && App.toolTip)
new App.toolTip(element, text, width, "left");
return false;
},
setCss: function(id, content, namespace) {
if (typeof namespace == 'undefined') {
var namespace = ( id && id != '' ? '#m_' + id : '');
}
var cssId = 'css_' + id;
if (!$(cssId)) {
var css = document.createElement("style");
css.setAttribute('id', cssId);
css.setAttribute('type','text/css');
var head = document.getElementsByTagName('head').item(0);
head.appendChild(css);
}
content = "\n" + content + "\n"; // fix a problem with the final regexp
content = content.replace(/,/g, ",\n"); // fix a problem with the final regexp
content = content.replace(/#moduleContent/g, ''); // remove namespace (Netvibes - not documented)
content = content.replace(/#container/g, ''); // remove namespace (WZD)
content = content.replace(/\n\s*([a-zA-z0-9\.\-, :#]*)\s*([{|,])/g, "\n" + namespace + " $1$2");
if ($(cssId).styleSheet){ // IE
$(cssId).styleSheet.cssText = content;
} else { // w3c
$(cssId).appendChild( document.createTextNode(content) );
}
}
}
UWA.Client = {Engine: {'name': 'unknown', 'version': ''}, Platform: {}, 'features': {}};
UWA.Client.features.xhr = !!(window.XMLHttpRequest);
UWA.Client.features.xpath = !!(document.evaluate);
if (window.opera) UWA.Client.Engine.name = 'opera';
else if (window.ActiveXObject) UWA.Client.Engine = {'name': 'ie', 'version': (UWA.Client.features.xhr) ? 7 : 6};
else if (!navigator.taintEnabled) UWA.Client.Engine = {'name': 'webkit', 'version': (UWA.Client.features.xpath) ? 420 : 419};
else if (document.getBoxObjectFor != null) UWA.Client.Engine.name = 'gecko';
UWA.Client.Engine[UWA.Client.Engine.name] = UWA.Client.Engine[UWA.Client.Engine.name + UWA.Client.Engine.version] = true;
var platform = navigator.platform.match(/(mac)|(win)|(linux)|(nix)/i) || ['Other'];
UWA.Client.Platform.name = platform[0].toLowerCase();
UWA.Client.Platform[UWA.Client.Platform.name] = true;
if (typeof Browser == "undefined") var Browser = {};
if(UWA.Client.Engine.ie) Browser.isIE = true; else Browser.isIE = false;
if(UWA.Client.Engine.opera) Browser.isOpera = true; else Browser.isOpera = false;
UWA.merge(UWA.Utils, {
parseFeed: function(feed) {
var is_xml = false, is_json = false;
if (typeof feed.getResponseHeader == "function" || typeof feed.getResponseHeader == "unknown") {
if (feed.getResponseHeader("Content-type").substr(0, 8) == "text/xml") {
is_xml = true;
}
} else if (typeof feed.responseJson == "object" && (feed.responseJson.nvFeed == 1 || feed.responseJson.error == 1)) {
is_json = true;
} else if (typeof feed.responseText != "undefined" && feed.responseText.substr(0, 1) == "<") {
is_xml = true;
}
if (is_xml) {
newFeed = UWA.Utils.parseXmlFeed(feed);
} else if (is_json) {
newFeed = feed.responseJson;
} else if (feed.responseText != "") {
try {
eval('newFeed = ' + feed.responseText);
} catch (e) {
UWA.log(e);
return false;
}
} else {
return false;
}
delete feed;
feed = null;
var result = {};
for (var i in newFeed) {
if (typeof newFeed.hasOwnProperty != "string" && !newFeed.hasOwnProperty(i)) continue;
result[i] = newFeed[i];
}
delete newFeed;
newFeed = null;
return result;
},
crc32: function(str, crc) {
if (typeof crc == "undefined") crc = 0;
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
var n = 0; // a number between 0 and 255
var x = 0; // an hex number
crc = crc ^ (-1);
for (var i = 0, k = str.length; i < k; i++) {
n = (crc ^ str.charCodeAt(i)) & 0xFF;
x = "0x" + table.substr(n * 9, 8);
crc = (crc >>> 8) ^ x;
}
return crc ^ (-1);
},
baseConvert: function(num, fromBase, toBase) {
var b36arr = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j', 'k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
var str = num.toString().toLowerCase();
var p = 1;
var b10 = 0;
for(i = str.length - 1; i >= 0; i--) {
b = str.charCodeAt(i);
if (b >= 48 && b <= 57){
b -= 48;
} else if (b >= 97 && b <= 122) {
b -= 97 - 10;
}
b10 += b * p;
p *= fromBase;
}
var newval = '';
var ost = 0;
while (b10 > 0) {
ost = b10 % toBase;
b10 = Math.floor(b10 / toBase);
newval = b36arr[ost] + '' + newval;
}
return newval;
},
parseXmlFeed: function(feed) {
var result = {};
if (feed.responseText == ''
|| feed.responseXML.documentElement==null
|| feed.responseXML.documentElement.nodeName=="parsererror") {
result.error = true;
return result;
}
var this_root = feed.responseXML.documentElement;
result.type = (this_root.nodeName=="feed") ? 1 : 0;
var root = (result.type==1) ? this_root : this_root.getElementsByTagName("channel")[0];
var lang = root.getAttribute("xml:lang");
if (typeof lang != "undefined" && lang) result.lang = lang;
var link = UWA.Utils.getChildrenByTagName(root, "link");
if (result.type==1) {
for (var i = 0; i < link.length; i++) {
if (link[i].getAttribute("type")=="text/html" || link.length==1) {
result.htmlUrl = link[i].getAttribute("href");
}
}
} else {
result.htmlUrl = (link && link[0] && link[0].firstChild) ? link[0].firstChild.nodeValue : "";
}
var title = UWA.Utils.getChildrenByTagName(root, "title")[0];
result.title = (title && title.firstChild) ? title.firstChild.nodeValue : result.htmlUrl;
var desc = (result.type==1) ? this_root.getElementsByTagName("tagline") : this_root.getElementsByTagName("description");
result.description = (desc && desc.length>0) ? ((desc[0].firstChild) ? desc[0].firstChild.nodeValue : '') : '';
if (typeof result.lang == "undefined" || !result.lang) {
var lang = this_root.getElementsByTagName("language");
lang = (lang && lang.length > 0) ? ((lang[0].firstChild) ? lang[0].firstChild.nodeValue : '') : '';
if (typeof lang != "undefined" && lang.length > 0) result.lang = lang;
}
if (typeof result.lang != "undefined") {
if (/^(ar|he|fa|ur|ps|dv|yi|iw)\-?[a-z]{0,2}$/i.test(result.lang)) result.dir = "rtl";
}
result.items = [];
var items = (result.type==1) ? this_root.getElementsByTagName("entry") : this_root.getElementsByTagName("item");
var ln = items.length;
var nsParsing = false;
for (var i = 0; i < ln; i++) {
var obj = {};
obj_enclosures = [];
var enclosures = items[i].getElementsByTagName("enclosure");
for (var j = 0; j < enclosures.length; j++) {
var checkType = enclosures[j].getAttribute("type");
if (/audio/.test(checkType)) {
} else if (/video/.test(checkType)) {
} else if (/image/.test(checkType)) {
} else if (/x-shockwave-flash/.test(checkType)) {
} else if (/x-flv/.test(checkType)) {
} else {
continue;
}
var url = enclosures[j].getAttribute("url");
if (checkType == "") {
if (strpos(url, ".mp3") !== false) {
checkType = "audio/mpeg";
}
}
if (checkType == "") continue;
obj_enclosures.push({"type": checkType, "url": url});
}
if (obj_enclosures.length > 0) {
obj.enclosures = obj_enclosures;
}
var title = UWA.Utils.getChildrenByTagName(items[i], 'title')[0];
if (title && title.firstChild) {
if (title.firstChild.nextSibling) obj.title = title.firstChild.nextSibling.nodeValue; // Handle CDATA
else obj.title = title.firstChild.nodeValue;
} else {
var d = items[i].getElementsByTagName("description");
if (d[0] && d[0].firstChild) {
var tmp = document.createElement("div");
tmp.innerHTML = d[0].firstChild.nodeValue;
obj.title = ((tmp.innerText)?tmp.innerText.substring(0,50).stripTags():'')+"...";
} else {
obj.title = '[...]';
}
}
var dcDate = (nsParsing) ? items[i].getElementsByTagName("dc:date") : items[i].getElementsByTagName("date");
if (dcDate.length==0) {
dcDate = items[i].getElementsByTagName("dc:date");
nsParsing = true; // used for next attempt to find namespaced tags
}
dcDate = dcDate[0];
if (items[i].getElementsByTagName("pubDate")[0]) {
obj.date = (items[i].getElementsByTagName("pubDate")[0].firstChild) ? items[i].getElementsByTagName("pubDate")[0].firstChild.nodeValue : "";
} else if (dcDate) {
obj.date = dcDate.firstChild.nodeValue;
} else if (items[i].getElementsByTagName("issued")[0]) {
obj.date = items[i].getElementsByTagName("issued")[0].firstChild.nodeValue;
}
var mediaThumbnail = (nsParsing) ? items[i].getElementsByTagName("media:thumbnail")[0] : items[i].getElementsByTagName("thumbnail")[0];
if(mediaThumbnail){
obj.thumbnail = mediaThumbnail.getAttribute('url');
}
var link = UWA.Utils.getChildrenByTagName(items[i], "link");
if (link.length>0) {
if (result.type==1) {
for (var j = 0; j < link.length; j++) {
if (link[j].getAttribute("type")=="text/html" || link.length==1) {
obj.link = link[j].getAttribute("href");
}
}
} else {
if (link[0] || link[0].firstChild) {
obj.link = (link[0].firstChild) ? link[0].firstChild.nodeValue : '';
}
}
} else if (result.type == 0) {
if (items[i].getElementsByTagName("guid").length > 0 && items[i].getElementsByTagName("guid")[0].firstChild) {
obj.link = items[i].getElementsByTagName("guid")[0].firstChild.nodeValue;
}
}
if (!obj.link) {
obj.link = result.htmlUrl;
}
if (obj.link!="" && obj.link!=result.htmlUrl) {
var str = obj.link;
} else {
var str = obj.title+obj.date+obj.link;
}
obj.id_old = str.replace(/([^0-9a-zA-Z])/g,"");
obj.id = this.baseConvert(this.crc32(obj.id_old), 16, 36);
var guidList = items[i].getElementsByTagName("guid");
if (guidList.length > 0 && guidList[0].firstChild) {
var guidValue = guidList[0].firstChild.nodeValue;
obj.id = guidValue.replace(/([^0-9a-zA-Z])/g,"");
}
if (result.type==1) {
var content = items[i].getElementsByTagName("content")[0];
var desc = items[i].getElementsByTagName("summary")[0];
} else {
var content = (nsParsing) ? items[i].getElementsByTagName("content:encoded")[0] : items[i].getElementsByTagName("encoded")[0];
var desc = items[i].getElementsByTagName("description")[0];
}
contentValue = "";
if (content && content.hasChildNodes()) {
for (var n = content.firstChild; n != null; n = n.nextSibling) {
if (n.innerHTML) {
contentValue += n.innerHTML;
} else if (n.nodeValue) {
contentValue += n.nodeValue;
}
}
} else if (desc && desc.hasChildNodes()) {
for (var n = desc.firstChild; n != null; n = n.nextSibling) {
if (n.innerHTML) {
contentValue += n.innerHTML;
} else if (n.nodeValue) {
contentValue += n.nodeValue;
}
}
}
obj.content = contentValue;
result.items.push(obj);
}
return result;
},
getChildrenByTagName: function(node, tagName) {
var ln = (node && node.childNodes) ? node.childNodes.length : 0;
var arr = [];
for (var z=0; z<ln; z++) {
if (node.childNodes[z].nodeName==tagName) arr.push(node.childNodes[z]);
}
return arr;
}
});
var Feed = function(feed, url) {
return UWA.Utils.parseFeed(feed);
}
if (typeof Utils == "undefined") Utils = {};
Utils.getChildrenByTagName = UWA.Utils.getChildrenByTagName;
if(typeof deconcept == "undefined") var deconcept = {};
if(typeof deconcept.util == "undefined") deconcept.util = {};
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
if (!document.getElementById) { return; }
this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params = {};
this.variables = {};
this.attributes = [];
if(swf) { this.setAttribute('swf', swf); }
if(id) { this.setAttribute('id', id); }
if(w) { this.setAttribute('width', w); }
if(h) { this.setAttribute('height', h); }
if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
if (!window.opera && document.all && this.installedVer.major > 7) {
if (!deconcept.unloadSet) {
deconcept.SWFObjectUtil.prepUnload = function() {
__flash_unloadHandler = function(){};
__flash_savedUnloadHandler = function(){};
window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
}
window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
deconcept.unloadSet = true;
}
}
if(c) { this.addParam('bgcolor', c); }
var q = quality ? quality : 'high';
this.addParam('quality', q);
this.setAttribute('useExpressInstall', false);
this.setAttribute('doExpressInstall', false);
var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
this.setAttribute('xiRedirectUrl', xir);
this.setAttribute('redirectUrl', '');
if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
useExpressInstall: function(path) {
this.xiSWFPath = !path ? "expressinstall.swf" : path;
this.setAttribute('useExpressInstall', true);
},
setAttribute: function(name, value){
this.attributes[name] = value;
},
getAttribute: function(name){
return this.attributes[name] || "";
},
addParam: function(name, value){
this.params[name] = value;
},
getParams: function(){
return this.params;
},
addVariable: function(name, value){
this.variables[name] = value;
},
getVariable: function(name){
return this.variables[name] || "";
},
getVariables: function(){
return this.variables;
},
getVariablePairs: function(){
var variablePairs = [];
var key;
var variables = this.getVariables();
for(key in variables){
variablePairs[variablePairs.length] = key +"="+ variables[key];
}
return variablePairs;
},
getSWFHTML: function() {
var swfNode = "";
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
if (this.getAttribute("doExpressInstall")) {
this.addVariable("MMplayerType", "PlugIn");
this.setAttribute('swf', this.xiSWFPath);
}
swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'"';
swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
var params = this.getParams();
for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
var pairs = this.getVariablePairs().join("&");
if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
swfNode += '/>';
} else { // PC IE
if (this.getAttribute("doExpressInstall")) {
this.addVariable("MMplayerType", "ActiveX");
this.setAttribute('swf', this.xiSWFPath);
}
swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'">';
swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
var params = this.getParams();
for(var key in params) {
swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
}
var pairs = this.getVariablePairs().join("&");
if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
swfNode += "</object>";
}
return swfNode;
},
write: function(elementId){
if(this.getAttribute('useExpressInstall')) {
var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
this.setAttribute('doExpressInstall', true);
this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
this.addVariable("MMdoctitle", document.title);
}
}
if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
n.innerHTML = this.getSWFHTML();
return true;
}else{
if(this.getAttribute('redirectUrl') != "") {
document.location.replace(this.getAttribute('redirectUrl'));
}
}
return false;
}
}
deconcept.SWFObjectUtil.getPlayerVersion = function(){
var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins && navigator.mimeTypes.length){
var x = navigator.plugins["Shockwave Flash"];
if(x && x.description) {
PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
}
}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
var axo = 1;
var counter = 3;
while(axo) {
try {
counter++;
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
} catch (e) {
axo = null;
}
}
} else { // Win IE (non mobile)
try{
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
}catch(e){
try {
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
} catch(e) {
if (PlayerVersion.major == 6) {
return PlayerVersion;
}
}
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
} catch(e) {}
}
if (axo != null) {
PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}
}
return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
if(this.major < fv.major) return false;
if(this.major > fv.major) return true;
if(this.minor < fv.minor) return false;
if(this.minor > fv.minor) return true;
if(this.rev < fv.rev) return false;
return true;
}
deconcept.util = {
getRequestParameter: function(param) {
var q = document.location.search || document.location.hash;
if (param == null) { return q; }
if(q) {
var pairs = q.substring(1).split("&");
for (var i=0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return pairs[i].substring((pairs[i].indexOf("=")+1));
}
}
}
return "";
}
}
deconcept.SWFObjectUtil.cleanupSWFs = function() {
var objects = document.getElementsByTagName("OBJECT");
for (var i = objects.length - 1; i >= 0; i--) {
objects[i].style.display = 'none';
for (var x in objects[i]) {
if (typeof objects[i][x] == 'function') {
objects[i][x] = function(){};
}
}
}
}
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;
if (typeof Netvibes == "undefined" || !Netvibes) var Netvibes = {};
if (typeof Netvibes.UI == "undefined" || !Netvibes.UI) Netvibes.UI = {};
Netvibes.UI.PrefsForm = function(params) {
this.module = params.module;
this.displayButton = params.displayButton;
}
Netvibes.UI.PrefsForm.prototype = {
controls: {
'default': function(pref) {
var value = this.module.getValue(pref.name);
if(!value || value == 'null') value = ''; // why string null ?
var input = this.module.createElement('input');
input.type = "text";
input.value = value;
input.id = 'm_' + this.module.id + '_' + pref.name;
input.name = pref.name;
return input;
},
'boolean': function(pref) {
var input = this.module.createElement('input');
input.type = "checkbox";
input.id = 'm_' + this.module.id + '_' + pref.name;
input.name = pref.name;
if(this.module.getBool(pref.name) === true) {
input.setAttribute('checked', 'checked');
input.defaultChecked = true; // for IE
}
if(pref.onchange) {
input.onclick = ( function(e) {
var sender = (e.target || e.srcElement);
if(sender.checked == true) this.module.setValue(pref.name, 'true');
else this.module.setValue(pref.name, 'false');
this.module.callback(pref.onchange);
} ).bindAsEventListener(this);
}
return input;
},
'password': function(pref) {
var input = '<input type="password" value="" id="m_' + this.module.id + '_pass" name="pass" /> ';
return input;
},
'textarea': function(pref) {
if(this.module.getValue(pref.name)) var value = this.module.getValue(pref.name); else var value = '';
var textarea = '<textarea id="m_' + this.module.id + '_' + name + '" name="' + pref.name + '">' + value + '</textarea> ';
return textarea;
},
'range': function(pref) {
var select = this.module.createElement('select');
select.id = 'm_' + this.module.id + '_' + pref.name;
select.name = pref.name;
if (parseInt(pref.step) > 0) {
for(var i=parseInt(pref.min); i<=parseInt(pref.max); i+=parseInt(pref.step)) {
var option = this.module.createElement('option');
if(this.module.getValue(pref.name) == i) option.setAttribute('selected', 'selected');
option.value = i; option.setText(i);
select.appendChild(option);
}
}
if(pref.onchange) {
select.onchange = ( function(e) {
var sender = (e.target || e.srcElement);
this.module.setValue(pref.name, sender.value)
this.module.callback(pref.onchange);
} ).bindAsEventListener(this);
}
return select;
},
'list': function(pref) {
var select = this.module.createElement('select');
select.id = 'm_' + this.module.id + '_' + pref.name;
select.name = pref.name;
for(var i=0; i<pref.options.length; i++) {
var option = this.module.createElement('option');
if(this.module.getValue(pref.name) == pref.options[i].value) option.setAttribute('selected', 'selected');
option.value = pref.options[i].value;
option.setText( (pref.options[i].label ? pref.options[i].label : pref.options[i].value ) );
select.appendChild(option);
}
if(pref.onchange) {
select.onchange = ( function(e) {
var sender = (e.target || e.srcElement);
this.module.setValue(pref.name, sender.value)
this.module.callback(pref.onchange);
} ).bindAsEventListener(this);
}
return select;
},
'color': function(pref) {
if(typeof pref.colors == "undefined")
pref.colors = ['white', 'yellow', 'green', 'red', 'blue', 'orange'];
var colorSelector = this.module.createElement('div');
colorSelector.addClassName('postItcolorSelection');
for(i=0; i<pref.colors.length;i++) {
var color = this.module.createElement('div');
color.setStyle('background-color', pref.colors[i]);
color.onclick = ( function(e) {
var sender = (e.target || e.srcElement);
this.module.setValue(pref.name, sender.style.backgroundColor);
if(pref.onchange) this.module.callback(pref.onchange);
} ).bindAsEventListener(this);
colorSelector.appendChild(color);
};
return colorSelector;
}
},
getContent: function() {
var editContent = '';
this.form = this.module.createElement("form");
var table = this.module.createElement("table");
table.addClassName("formTable");
table.setStyle('width', '100%');
var tbody = this.module.createElement("tbody");
for(var i = 0; i < this.module.preferences.length; i++) {
var tr = this.module.createElement("tr");
var pref = this.module.preferences[i];
if(pref.type == 'hidden') continue;
if(!pref.label) pref.label = pref.name;
var label = this.module.createElement("label");
label.setAttribute('for', 'm_' + this.module.id + '_' + pref.name);
label.setHTML( _(pref.label+':') );
var tdl = this.module.createElement("td");
tdl.appendChild(label);
tr.appendChild(tdl);
if(!this.controls[pref.type]) pref.type = 'default';
var control = this.controls[pref.type].bind(this)(pref);
var tdc = this.module.createElement("td");
tdc.setContent(control);
tr.appendChild(tdc);
tbody.appendChild(tr);
}
if(this.displayButton == undefined || this.displayButton === true) {
var submit = this.module.createElement('input');
submit.type = 'submit';
submit.value = _("Ok");
submit.addClassName('buttonClean');
var tr = this.module.createElement("tr");
var tds = this.module.createElement("td");
tds.colSpan = '2';
tds.appendChild(submit);
tr.appendChild(tds);
tbody.appendChild(tr);
}
table.appendChild(tbody);
this.form.appendChild(table);
this.form.onsubmit = ( function() {
var callback = ( function() { this.callback('endEdit') } ).bind(this.module);
this.saveValues();
this.module.saveValues(callback);
return false;
} ).bindAsEventListener(this);
return this.form;
},
saveValues: function(form) {
if(typeof form == 'undefined') var form = this.form;
var formElements = UWA.Form.getElements(form);
for (var j = 0; j < formElements.length; j++) {
var el = formElements[j];
if(el.type == "submit") continue;
switch(el.type) {
case 'password':
if(el.value != '' && el.value != 'XXNVXX' )
this.module.setValue(el.name, el.value)
break;
case 'checkbox':
if(el.checked) this.module.setValue(el.name, 'true');
else this.module.setValue(el.name, 'false');
break;
case 'radio':
if(el.checked)
this.module.setValue(el.name, el.value);
break;
default :
this.module.setValue(el.name, el.value);
break;
}
}
}
}
if (typeof Netvibes == "undefined" || !Netvibes) var Netvibes = {};
if (typeof Netvibes.DLA == "undefined" || !Netvibes.DLA) Netvibes.DLA = {};
Netvibes.DLA.SearchForm = function(options) {
this.options = { showCheckbox: false, allowEmpty: false, searchHistory: false }
Object.extend(this.options, options || {});
this._createForm();
}
Netvibes.DLA.SearchForm.prototype = {
setFavicon: function(url, title) {
this.favicon.src = url;
if (typeof(title) != 'undefined') {
this.favicon.alt = this.favicon.title = title;
}
},
setSearchText: function(searchText) {
this.inputSearch.value = searchText;
this.resetButton.style.visibility = this.inputSearch.value.length? 'visible' : 'hidden';
this.inputSearch.onblur();
},
setInitialState: function(favicon, searchText, checked) {
this.setFavicon(favicon);
this.inputSearch.value = searchText;
this.resetButton.style.visibility = this.inputSearch.value.length? 'visible' : 'hidden';
if (typeof checked != 'undefined' && this.checkbox) {
this.checkbox.checked = checked;
}
this.inputSearch.onblur();
},
hide: function() {
Element.hide(this.form);
},
show: function() {
Element.show(this.form);
},
observe: function(name, observer) {
if (!this.observers) this.observers = [];
this.observers.push([name, observer]);
},
_notify: function(event) {
if (!this.observers) return;
var queryText = this.inputSearch.value;
this.observers.each(function(observer) {
if (observer[0] == event && typeof(observer[1]) == 'function') {
observer[1](queryText.stripTags(), this.checkbox? this.checkbox.checked : null);
}
});
},
eventReset: function() {
this._notify("reset");
this.inputSearch.value = '';
this.resetButton.style.visibility = "hidden";
this.inputSearch.onblur();
return false;
},
eventSubmit: function() {
var queryText = this.inputSearch.value;
if (queryText == "" && !this.options.allowEmpty) {
return this.eventReset();
}
this._notify("submit");
this._addHistory(queryText);
this.resetButton.style.visibility = "visible";
return false;
},
eventToggle: function() {
this._notify("toggle");
},
eventFocus: function() {
this.submitButton.disabled = "";
this._notify("focus");
},
eventBlur: function() {
if (this.options.searchHistory) {
setTimeout(this._hideHistory.bindAsEventListener(this), 1000);
}
this._notify("blur");
},
eventClick: function() {
if (this.options.searchHistory) this._toggleHistory();
},
eventKeyPress: function() {
if (this.options.searchHistory) this._hideHistory();
},
_createForm: function() {
this.container = document.createElement("div");
this.container.className = 'search';
this.form = document.createElement("form");
this.form.style.display = 'block';
if (!Browser.isIE) this.form.style.position = 'relative';
this.form.onsubmit = this.eventSubmit.bindAsEventListener(this);
this.favicon =  document.createElement("img");
this.favicon.className = 'favicon';
if (typeof this.options.faviconUrl != "undefined") {
this.favicon.src = this.options.faviconUrl;
}
this.inputSearch = document.createElement("input");
this.inputSearch.className = 'search';
this.inputSearch.type = 'text';
this.inputSearch.value = '';
this.inputSearch.style.paddingRight = '18px';
this.inputSearch.onfocus = this.eventFocus.bindAsEventListener(this);
this.inputSearch.onblur = this.eventBlur.bindAsEventListener(this);
if (this.options.searchHistory) {
this.inputSearch.onclick = this.eventClick.bindAsEventListener(this);
this.inputSearch.onkeypress = this.eventKeyPress.bindAsEventListener(this);
}
this.resetButton = document.createElement("img");
this.resetButton.title = this.resetButton.alt = _("Clear");
this.resetButton.src = "http://" + NV_HOST + "/img/clear.gif";
this.resetButton.className = "clear";
this.resetButton.style.marginTop = (Browser.isIE)? '-6px' : (Browser.isOpera)? '-2px' : (Browser.isSafari)? '-4px' : '-3px';
this.resetButton.onclick = this.eventReset.bindAsEventListener(this);
this.submitButton = document.createElement("input"); UWA.$element(this.submitButton);
this.submitButton.addClassName("submit");
this.submitButton.type = 'submit';
this.submitButton.value = _("Search");
this.submitButton.style.marginLeft = '5px';
this.container.appendChild(this.form);
this.form.appendChild(this.favicon);
this.form.appendChild(this.inputSearch);
this.form.appendChild(this.resetButton);
this.form.appendChild(this.submitButton);
if (this.options.showCheckbox) {
this.checkbox = document.createElement("input");
this.checkbox.type = 'checkbox';
this.checkbox.title = this.options.checkboxTitle;
if (Browser.isIE) { // fixes bug with position: relative
this.checkbox.style.marginLeft = "5px";
} else {
this.checkbox.style.position = 'absolute';
this.checkbox.style.top = '5px';
if ((typeof App != "undefined" && App.dirRTL) ||
(typeof widget != "undefined" && widget.dir == "rtl")) {
this.checkbox.style.left = '5px';
} else {
this.checkbox.style.right = '5px';
}
}
this.checkbox.value = '';
this.checkbox.onclick = this.eventToggle.bindAsEventListener(this);
this.form.appendChild(this.checkbox);
}
},
setHistoryString: function(searchHistory) {
if (this.options.searchHistory == false) return ;
if (typeof this.historyBox == "undefined") {
this.historyBox = document.createElement("ul");
this.historyBox.className = "popupMenu";
this.historyBox.style.textAlign = "left";
this.historyBox.style.display = "none";
this.historyBox.style.position = "absolute";
this.showSearchHistory = false;
var myself = this;
if (typeof searchHistory != "undefined" && searchHistory) {
this.showSearchHistory = true;
searchHistory = searchHistory.split(":");
for (var i = 0; i < searchHistory.length; i++) {
var li = document.createElement("li");
var a = document.createElement("a");
a.onclick = function() {
this.self.inputSearch.value = this.elem.innerHTML;
this.self._hideHistory();
this.self.eventSubmit();
return false;
}.bind({self: this, elem: a});
a.href = "javascript:void(0)";
a.innerHTML = searchHistory[i];
li.setAttribute("query", searchHistory[i]);
li.appendChild(a);
this.historyBox.appendChild(li);
}
}
var li = document.createElement("li");
var a = document.createElement("a");
a.style.borderBottom = "";
a.onclick = function() {
this.self._clearHistory();
return false;
}.bind({self: this, elem: a});
a.href = "javascript:void(0)";
a.className = "action";
a.innerHTML = _("Clear recent searches");
li.appendChild(a);
this.historyBox.appendChild(li);
document.getElementsByTagName('body').item(0).appendChild(this.historyBox);
}
},
getHistoryString: function() {
var res = "";
var history = this.historyBox.getElementsByTagName("li");
for (var i = 0; i < history.length - 1; i++) {
if (i != 0) res += ":";
res += history[i].getAttribute("query");
}
return res;
},
_addHistory: function(query) {
if (this.options.searchHistory) {
if (this.historyBox.firstChild.getAttribute("query") == query) return;
var lis = this.historyBox.getElementsByTagName("li");
if (lis.length > 10) {
this.historyBox.removeChild(lis[lis.length - 2]);
delete lis[lis.length - 2];
}
var li = document.createElement("li");
var a = document.createElement("a");
a.onclick = function() {
this.self.inputSearch.value = this.elem.innerHTML;
this.self._hideHistory();
this.self.eventSubmit();
return false;
}.bind({self: this, elem: a});
a.href = "javascript:void(0)";
a.innerHTML = query;
li.setAttribute("query", query);
li.appendChild(a);
this.historyBox.insertBefore(li, this.historyBox.firstChild);
this.showSearchHistory = true;
this._notify("updateHistory");
}
},
_clearHistory: function(query) {
if (this.options.searchHistory) {
this.historyBox.parentNode.removeChild(this.historyBox);
delete this.historyBox;
this.setHistoryString();
this.showSearchHistory = false;
this._notify("updateHistory");
this.eventReset();
}
},
_hideHistory: function() {
this.historyBox.style.display = "none";
},
_showHistory: function() {
if (this.showSearchHistory != true) return ;
var dim = Element.getDimensions(this.inputSearch);
var pos = Element.getPosition(this.inputSearch);
this.historyBox.style.width = dim.width+"px";
this.historyBox.style.left = pos.x+"px";
this.historyBox.style.top = pos.y+dim.height+"px";
this.historyBox.style.display = "block";
},
_toggleHistory: function() {
if (this.historyBox.style.display == "none") {
this._showHistory();
} else {
this._hideHistory();
}
},
appendTo: function(element) {
element.appendChild(this.container);
}
}
if (typeof UWA == "undefined") UWA = {};
if (typeof UWA.Controls == "undefined") UWA.Controls = {};
UWA.Controls.SearchForm = Netvibes.DLA.SearchForm;
if (typeof Netvibes == "undefined" || !Netvibes) var Netvibes = {};
if (typeof Netvibes.UI == "undefined" || !Netvibes.UI) Netvibes.UI = {};
Netvibes.UI.Pager = function(params) {
this.module = params.module;
this.limit = parseInt(params.limit);
this.offset = parseInt(params.offset);
this.callback = params.callback;
this.dataArray = params.dataArray;
}
Netvibes.UI.Pager.prototype = {
getContent: function() {
var pager = document.createElement("div");
pager.className = 'nv-pager';
if (this.offset > 0) {
var prev = document.createElement("a");
prev.className = 'prev';
prev.href = 'javascript:void(0)';
prev.innerHTML = _("prev");
prev.onclick = ( function() {
this.onChange(this.offset - this.limit);
return false;
} ).bind(this);
pager.appendChild(prev);
}
if (this.offset < this.dataArray.length - this.limit ) {
var next = document.createElement("a");
next.className = 'next';
next.href = 'javascript:void(0)';
next.innerHTML = _("next");
next.onclick = ( function() {
this.onChange(this.offset + this.limit);
return false;
} ).bind(this);
pager.appendChild(next);
}
var fix = document.createElement("div");
fix.innerHTML = '<p style="padding:0;margin:0;line-height:0;height:0;clear:both"></p>';
pager.appendChild(fix);
return pager;
},
getDom: function() { this.getContent() }
}
Netvibes.UI.ToolTip = UWA.Class.create();
Netvibes.UI.ToolTip.prototype = {
initialize: function(element, htmlText, options) {
this.tooltippedEle = $(element);
this.root = null;
this.options = {
'module'  : null,
'width'   : 200,
'offsetX' : 16,
'offsetY' : 16,
'class'   : "tool-tip",
'dir'     : "ltr"
};
this.setOptions(options);
this.widget = this.options.module;
if (this.options.dir =="rtl") {
this.options.offsetX = -this.options.offsetX;
}
this.htmlText = htmlText || "";
this.isStandalone = (this.widget.environment.standalone) ? true : false;
this.isInline = (this.widget.environment.netvibes && this.widget.environment.netvibes.inline) ? true : false;
if (this.widget) this.build();
},
setOptions: function(options) {
UWA.extend(this.options, options || {});
},
build: function(){
this.tooltip = $("nv-tooltip");
if (!this.tooltip) { // only one tooltip at the time
this.tooltip = this.widget.createElement('div', {
'id': 'nv-tooltip',
'class': this.options["class"],
'styles': {
'width': this.options.width,
'position' : 'absolute',
'display': 'none'
}
}).inject(document.body);
}
if (this.htmlText.length > 0) {
this.tooltippedEle.onmouseover  = this.onShowTooltip.bindWithEvent(this);
this.tooltippedEle.onmouseout   = this.onHideTooltip.bindWithEvent(this);
this.tooltippedEle.onmousemove  = this._locate.bindWithEvent(this);
}
},
onShowTooltip: function(e){
if (!this.root) {
this.root = this._getRootNode( this.tooltippedEle );
}
this.tooltip.setHTML(this.htmlText);
this.tooltip.show();
this.tooltipSize = this.tooltip.getDimensions();
this._locate(e);
},
onHideTooltip: function(e){
this.tooltip.hide();
},
_getRootNode: function( element ) {
if (this.isInline || this.isStandalone)
return document.getElementsByTagName('body')[0];
var ret = element;
do {
ret = ret.getParent();
} while(!ret.hasClassName("moduleContent"));
return $(ret);
},
_getViewport: function() {
var viewport;
if (typeof window.innerWidth != 'undefined') {
viewport = { width:window.innerWidth + window.pageXOffset, height:window.innerHeight + window.pageYOffset }
} else {
viewport = { width:document.documentElement.clientWidth + document.body.scrollLeft, height:document.documentElement.clientHeight + document.body.scrollTop }
}
return viewport;
},
_locate: function(e){
var toolTipPos = {};
var offsetXmodif = 0;
var offsetYmodif = 0;
var boundarySize = (!this.isInline) ? Element.getDimensions(this.root) : this._getViewport();
if (this.isInline || this.isStandalone) {
toolTipPos = { x:Event.pointerX(e), y:Event.pointerY(e)};
} else {
var absPos = this._getRelativeCoordinates(e, this.root );
toolTipPos = { x:absPos.x, y:absPos.y};
}
var newToolTipPos = {};
newToolTipPos.x = toolTipPos.x;
newToolTipPos.y = toolTipPos.y;
if (this.tooltipSize) {
if (this.options.dir == "rtl") {
newToolTipPos.x -= this.tooltipSize.width;
}
newToolTipPos.x = newToolTipPos.x + this.options.offsetX;
newToolTipPos.y = newToolTipPos.y + this.options.offsetY;
if (newToolTipPos.x + this.tooltipSize.width > boundarySize.width) {
offsetXmodif = newToolTipPos.x + this.tooltipSize.width - boundarySize.width;
}
if (newToolTipPos.x < 0) {
offsetXmodif = newToolTipPos.x;
}
if (newToolTipPos.y + this.tooltipSize.height > boundarySize.height) {
offsetYmodif += this.tooltipSize.height + this.options.offsetY + (this.options.offsetY / 2);
}
}
newToolTipPos.x = newToolTipPos.x - offsetXmodif;
newToolTipPos.y = newToolTipPos.y - offsetYmodif;
this.tooltip.setStyles({
top: newToolTipPos.y+"px",
left: newToolTipPos.x+"px"
});
},
_getRelativeCoordinates: function(event, reference) {
var x, y;
event = event || window.event;
var el = event.target || event.srcElement;
if (!window.opera && typeof event.offsetX != 'undefined') {
var pos = { x: event.offsetX, y: event.offsetY };
var e = el;
while (e) {
e.mouseX = pos.x;
e.mouseY = pos.y;
pos.x += e.offsetLeft;
pos.y += e.offsetTop;
e = e.offsetParent;
}
var e = reference;
var offset = { x: 0, y: 0 }
while (e) {
if (typeof e.mouseX != 'undefined') {
x = e.mouseX - offset.x;
y = e.mouseY - offset.y;
break;
}
offset.x += e.offsetLeft;
offset.y += e.offsetTop;
e = e.offsetParent;
}
e = el;
while (e) {
e.mouseX = undefined;
e.mouseY = undefined;
e = e.offsetParent;
}
}
else {
var pos = this._getAbsolutePosition(reference);
x = event.pageX  - pos.x;
y = event.pageY - pos.y;
}
return { x: x, y: y };
},
_getAbsolutePosition: function(el) {
var r = { x: el.offsetLeft, y: el.offsetTop };
if (el.offsetParent) {
var tmp = this._getAbsolutePosition(el.offsetParent);
r.x += tmp.x;
r.y += tmp.y;
}
return r;
}
}
if (typeof Netvibes == "undefined" || !Netvibes) var Netvibes = {};
if (typeof Netvibes.UI == "undefined" || !Netvibes.UI) Netvibes.UI = {};
Netvibes.UI.FeedView = Class.create();
Netvibes.UI.FeedView.prototype = {
setOptions: function(options) {
this.options = {
details: false,
openOutside: true,
showDate: true,
feedSiteUrlDomain: "", // for fixing relative URLs at thumbnails
lookForHtmlThumbnail: false,
removeImagePattern: false,
allowVideoPlayButton: false,
showStarring: false,
search: "",
dir: "ltr"
};
Object.extend(this.options, options || {});
},
initialize: function(options) {
this._elements = [];
this.setOptions(options);
this._createList();
},
setSearch: function(search) {
this.options.search = search;
},
resetSearch: function() {
this.options.search = "";
},
addItem: function(index, item, status) {
var watchable = false;
var thumbnail, podcast, mediaUrl, playable;
var li = document.createElement("li");
var a = document.createElement("a");
var displayDesc = this._truncate(item.content.replace(/<\/?[^>]+>/gi, ' '), 100);
if (this.options.search !== "") {
displayDesc = String.highlight(displayDesc, this.options.search);
}
a.href = item.link;
a.target = "_blank"; // why ?
var displayTitle = item.title.stripTags();
if (this.options.search !== "") {
displayTitle = String.highlight(displayTitle, this.options.search);
}
a.innerHTML = displayTitle;
var diffDate = this._getDiffDate(item.date);
if (diffDate) {
var small = document.createElement("small");
small.index = index;
small.style.color = "#AAA";
if (typeof App != "undefined" && App.dirRTL != true && this.options.dir == "rtl") {
small.dir = App.dirRTL ? 'rtl' : 'ltr';
small.innerHTML = diffDate + " - ";
} else {
small.innerHTML = " - " + diffDate;
}
a.appendChild(small);
}
if (this.options.details === false) {
a.desc = displayDesc;
a.onmouseover = function() {
if (typeof UWA != "undefined") {
UWA.Utils.setTooltip(this, this.desc, 250); // to be replaced by new Tooltip ?
}
};
}
a.index = index;
a.onmouseup = this._onItemMouseDown.bindAsEventListener(this);
a.onclick = this._onItemClicked.bindAsEventListener(this);
if (this.options.allowVideoPlayButton && item.video) {
watchable = true;
}
if (typeof item.enclosures == "object") {
item.enclosures.each(function(el) {
if (el.url !== '') {
if (/^image\/(jpeg|gif|jpg|bmp|png)$/.test(el.type)) {
thumbnail = el.url;
} else {
podcast = true;
mediaUrl = el.url;
}
if (/^audio\/mpeg$/.test(el.type) || /\.mp3$/.test(el.url)) {
playable = true;
}
}
});
}
if (this.options.lookForHtmlThumbnail) {
var cleanContent = item.content;
cleanContent = cleanContent.replace(/src="http:\/\/[^"]+\/(~[rfa]|ads)\/[^"]+/mg, "");
var matches = /<img.*?src=('|")?\s*(.*?)\s*('|"|\s*?\/?>|>)/i.exec(cleanContent);
if (matches) {
thumbnail = matches[2].unescapeHTML();
}
}
if (this.options.removeImagePattern && typeof thumbnail != "undefined") {
if (thumbnail.match(new RegExp(this.options.removeImagePattern))) {
thumbnail = '';
}
}
if (typeof podcast != "undefined" && watchable === false) {
a.style[this.options.dir == "rtl" ? "marginLeft" : "marginRight"] = "20px";
var player = document.createElement("img");
player.title = _("Play");
player.style.border = "0px";
player.style.cssFloat = this.options.dir == "rtl" ? "left" : "right";
player.style.styleFloat = this.options.dir == "rtl" ? "left" : "right";
if (typeof App != "undefined" && typeof playable != "undefined") {
player.style.cursor = 'pointer';
player.fileLink = mediaUrl;
player.podName = displayTitle;
player.index = index;
player.src = "http://" + NV_HOST + "/img/speaker.gif";
player.onclick = this._onPodcastPlay.bindAsEventListener(this);
} else {
player.src = "http://" + NV_HOST + "/img/speaker-disabled.png";
}
var downloaderLink = document.createElement("a");
downloaderLink.href = mediaUrl;
var downloader = document.createElement("img");
downloader.title = _("Download");
downloader.src = "http://" + NV_HOST + "/img/ipod.png";
downloader.style[this.options.dir == "rtl" ? "marginRight" : "marginLeft"] = "2px";
downloader.style.border = "0px";
downloaderLink.style.border = "0px";
downloaderLink.style.cursor = 'pointer';
downloaderLink.mediaUrl = mediaUrl;
downloaderLink.index = index;
downloaderLink.onclick = this._onDownload.bindAsEventListener(this);
downloaderLink.style.cssFloat = this.options.dir == "rtl" ? "left" : "right";
downloaderLink.style.styleFloat = this.options.dir == "rtl" ? "left" : "right";
downloaderLink.appendChild(downloader);
if (this.options.dir == "rtl") {
li.appendChild(player);
li.appendChild(downloaderLink);
} else {
li.appendChild(downloaderLink);
li.appendChild(player);
}
}
if (this.options.showStarring === true) {
var star = document.createElement("img");
star.title = _("Share as favorite");
star.style.border = "0px";
star.style.cursor = 'pointer';
star.index = index;
star.src = "/img/icons/favourites_small.gif";
star.style.cssFloat = this.options.dir == "rtl" ? "left" : "right";
star.style.styleFloat = this.options.dir == "rtl" ? "left" : "right";
star.style[this.options.dir == "rtl" ? "marginLeft" : "marginRight"] = "2px";
star.style.visibility = "hidden";
li.onmouseover = function() { star.style.visibility = "visible"; };
li.onmouseout = function() { star.style.visibility = "hidden"; };
star.onclick = this._onAddStar.bindAsEventListener(this);
li.appendChild(star);
}
if (this.options.details === false) {
li.appendChild(a);
} else {
var descMargin = "0px";
var h = document.createElement('h3');
var p = document.createElement('p');
if (item.thumbnail) {
thumbnail = item.thumbnail;
}
if (typeof thumbnail != "undefined" && thumbnail !== '') {
thumbnail = thumbnail.trim();
if (thumbnail.substring(0, 4) !== "http" && this.options.feedSiteUrlDomain !== '') {
var separator = thumbnail.substring(0, 1) == "/" ? "" : "/";
thumbnail = this.options.feedSiteUrlDomain + separator +  thumbnail;
}
var link = document.createElement("a");
link.style.border = "0px";
link.href = item.link;
link.target = "_blank";
link.index = index;
link.style.outline = "none";
link.onmouseup = this._onItemMouseDown.bindAsEventListener(this);
link.onclick = this._onItemClicked.bindAsEventListener(this);
var img = document.createElement("img");
img.index = index;
img.className = "thumb";
img.src = thumbnail;
var div = document.createElement("div");
div.appendChild(link);
div.className = "feedThumbnail";
li.appendChild(div);
if (watchable === true) {
var centerer = document.createElement("div");
centerer.style.width = "80px";
centerer.style.textAlign = "center";
centerer.style.cssFloat = centerer.style.styleFloat = "left";
var overlay = document.createElement("img");
overlay.src = "http://" + NV_HOST + "/img/play.png";
overlay.index = index;
overlay.onclick = this._onVideoPlay.bindAsEventListener(this);
overlay.style.marginLeft = "-80px";
overlay.style.cssFloat = overlay.style.styleFloat = "left";
overlay.style.width = "80px";
overlay.style.height = "60px";
if (UWA.Client.Engine.ie && UWA.Client.Engine.version == 6) {
overlay.src = "http://" + NV_HOST + "/img/s.gif";
overlay.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='http://"+NV_HOST+"/img/play.png');";
}
centerer.appendChild(img);
link.appendChild(centerer);
link.appendChild(overlay);
} else {
link.appendChild(img);
}
descMargin = "88px";
}
p.className = "description";
p.style[this.options.dir == "rtl" ? "marginRight" : "marginLeft"] = descMargin;
p.style[this.options.dir == "rtl" ? "marginLeft" : "marginRight"] = "0px";
p.innerHTML = displayDesc;
h.style[this.options.dir == "rtl" ? "marginRight" : "marginLeft"] = descMargin;
h.style[this.options.dir == "rtl" ? "marginLeft" : "marginRight"] = "0px";
h.appendChild(a);
li.appendChild(h);
var styleStatus = index % 2 ? "even" : "odd";
li.className = "item " + styleStatus;
li.appendChild(p);
}
if (status === true) {
li.className += " read";
} else {
li.className += " unread";
}
this._elements[index] = li;
if (!(this.options.search !== '' &&
this._searchInString(this.options.search, item.title) === false &&
this._searchInString(this.options.search, item.content) === false)) {
this._feedList.appendChild(li);
this._numberDisplayedItems++;
}
},
getContent: function() {
return this._feedList;
},
getItem: function(index) {
return this._elements[index];
},
getNumberOfDisplayedItems: function() {
return this._numberDisplayedItems;
},
setRead: function(index) {
var elem = this._elements[index];
Element.addClassName(elem, "read");
Element.removeClassName(elem, "unread");
},
setUnRead: function(index) {
var elem = this._elements[index];
Element.addClassName(elem, "unread");
Element.removeClassName(elem, "read");
},
observe: function(name, observer, listener) {
if (name == "onaddstar") {
this.options.showStarring = true;
}
if (!this.observers) this.observers = [];
this.observers.push([name, observer, listener]);
},
_notify: function(event, params) {
if (!this.observers) return false;
var ret = false;
this.observers.each(function(observer) {
if (observer[0] == event && typeof(observer[1]) == 'function') {
if (typeof observer[2] == "undefined") ret = observer[1](params);
else ret = observer[1].call(observer[2], params);
}
});
return ret;
},
_createList: function() {
this._numberDisplayedItems = 0;
this._feedList = document.createElement("ul");
if (this.options.details == true) {
this._feedList.className = "nv-thumbnailedList";
this._feedList.style.listStyleType = "none";
} else {
this._feedList.className = "nv-feedList";
}
if (this.options.dir == "rtl") {
Element.addClassName(this._feedList, "rtl");
}
},
_searchInString: function(query, str) {
var test = str.toLowerCase().indexOf(query.toLowerCase());
if (test != -1) return true
return false;
},
_onItemMouseDown: function(e) {
if (typeof e == "undefined") e = event;
var sender = (e.target || e.srcElement);
if ((typeof e.which == "undefined" && e.button == 2) ||      // Internet Explorer
(e.which == 3 && e.button == 2) ||                       // Gecko 1.0 or later and Opera 9
((e.ctrlKey == true || e.metaKey == true) && e.which == 1 && e.button == 0)) { // Gecko and Opera on Mac
this._notify("onrightclick", {index: sender.index});
e.returnValue = true;
return true;
}
if ((typeof e.which == "undefined" && e.button == 4) || // Internet Explorer
(e.which == 2 && e.button == 1) || // Gecko 1.0 or later and Opera 9
(e.which == 2 && e.button == 4) || // Konqueror
(e.which == 2 && e.button == 2) || // Gecko 0.9
(e.which == 3 && e.button == 3) || // Opera 7
(e.ctrlKey == true && !UWA.Client.Platform.mac) || e.shiftKey == true) {
this._notify("onmiddleclick", {index: sender.index});
e.returnValue = true;
return true;
}
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
return false;
},
_onItemClicked: function(e) {
if (typeof e == "undefined" && typeof event != "undefined") e = event;
var sender = (e.target || e.srcElement);
if (typeof e != "undefined" &&
(((e.ctrlKey == true && !UWA.Client.Platform.mac) || e.shiftKey == true) ||
(e.metaKey == true && e.which == 1 && e.button == 0 && UWA.Client.Platform.mac))) {
return true;
}
return !this._notify("onclick", {index: sender.index});
},
_onPodcastPlay: function(e) {
if (typeof e == "undefined") e = event;
var sender = (e.target || e.srcElement);
this._notify("onpodcastplay", {index: sender.index, fileLink: sender.fileLink, podName: sender.podName});
},
_onVideoPlay: function(e) {
if (typeof e == "undefined") e = event;
var sender = (e.target || e.srcElement);
this._notify("onvideoplay", {index: sender.index});
},
_onDownload: function(e) {
if (typeof e == "undefined") e = event;
var sender = (e.target || e.srcElement);
this._notify("ondownload", {index: sender.index, mediaUrl: sender.mediaUrl});
},
_onAddStar: function(e) {
if (typeof e == "undefined") e = event;
var sender = (e.target || e.srcElement);
this._notify("onaddstar", {index: sender.index});
},
_getDiffDate: function(dateItem) {
if (typeof dateItem == "undefined" ||
!this.options.showDate) {
return "";
}
var date = Date.parse(dateItem);
if (isNaN(date)) { // The date is in ISO 8601 format?
if (typeof Date.setISO8601 == "undefined") {
Date.prototype.setISO8601 = function (string) {
var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" +
"(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" +
"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
var d = string.match(new RegExp(regexp));
var offset = 0;
var date = new Date(d[1], 0, 1);
if (d[3]) { date.setMonth(d[3] - 1); }
if (d[5]) { date.setDate(d[5]); }
if (d[7]) { date.setHours(d[7]); }
if (d[8]) { date.setMinutes(d[8]); }
if (d[10]) { date.setSeconds(d[10]); }
if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
if (d[14]) {
offset = (Number(d[16]) * 60) + Number(d[17]);
offset *= ((d[15] == '-') ? 1 : -1);
}
offset -= date.getTimezoneOffset();
time = (Number(date) + (offset * 60 * 1000));
this.setTime(Number(time));
}
}
date = new Date();
date.setISO8601(dateItem);
if (!date) return "";
}
var diff = new Date().getTime() - date;
if (diff <= 0) return ""; // Time in the future...
diff /= 1000;
var time = {};
time.sec = Math.floor(diff);
time.min = Math.floor(diff / 60);
time.hour = Math.floor(diff / 3600);
time.day = Math.floor(diff / 86400);
time.week = Math.floor(time.day / 7);
time.month = Math.floor(time.day / 30);
time.year = Math.floor(time.day / 365);
var strTime;
if (time.year == 1) {
strTime = _("{0} year ago").format(time.year);
} else if (time.year > 1) {
strTime = _("{0} years ago").format(time.year);
} else if (time.month == 1) {
strTime = _("{0} month ago").format(time.month);
} else if (time.month > 1) {
strTime = _("{0} months ago").format(time.month);
} else if (time.week == 1) {
strTime = _("{0} week ago").format(time.week);
} else if (time.week > 1) {
strTime = _("{0} weeks ago").format(time.week);
} else if (time.day == 1) {
strTime = _("yesterday");
} else if (time.day > 1) {
strTime = _("{0} days ago").format(time.day);
} else if (time.hour == 1) {
strTime = _("{0} hour ago").format(time.hour);
} else if (time.hour > 1) {
strTime = _("{0} hours ago").format(time.hour);
} else if (time.min == 1) {
strTime = _("{0} minute ago").format(time.min);
} else if (time.min > 1) {
strTime = _("{0} minutes ago").format(time.min);
} else if (time.sec == 1) {
strTime = _("{0} second ago").format(time.sec);
} else if (time.sec > 1) {
strTime = _("{0} seconds ago").format(time.sec);
}
return strTime;
},
_truncate: function(s, size) {
if (!size) size = 30;
if (s.length <= size) return s;
var punctuation = '.,;!? ';
p = -1;
for (var i = 0; i < size; i++) {
if (punctuation.indexOf(s.charAt(i)) != -1) {
p = i;
}
}
if (p == -1) p = size - 1;
return '' + s.substr(0, p) + '...';
}
}
if (typeof Netvibes == "undefined" || !Netvibes) var Netvibes = {};
if (typeof Netvibes.UI == "undefined" || !Netvibes.UI) Netvibes.UI = {};
Netvibes.UI.Feed = Class.create();
Netvibes.UI.Feed.prototype = {
setOptions: function(options) {
UWA.log("Feed.setOptions()");
this.options = { details: false,
openOutside: false,
showDate: true,
lookForHtmlThumbnail: false,
allowVideoPlayButton: false,
updateIcon: true,
updateTitle: true,
search: "",
dir: "ltr",
nbTitles: 7 };
Object.extend(this.options, options || {});
},
initialize: function(widget, options) {
UWA.log("Feed.initialize()");
this.widget = widget;
this.setOptions(options);
},
display: function(url, container) {
UWA.log("Feed.display()");
delete this.feed;
this.url = url;
this.content = container;
this._displayContent();
},
setVideoContainer: function(videoContainer) {
UWA.log("Feed.setVideoContainer()");
this.videoContainer = videoContainer;
},
_displayContent: function() {
UWA.log("Feed._displayContent()");
var content = this.content;
content.innerHTML = '';
this.feedDiv = document.createElement("div");
if (this.options.searchUrl) {
this.searchDiv = document.createElement("div");
content.appendChild(this.searchDiv);
var query = decodeURIComponent(this.widget.getValue("lastSearch"));
if (query == '__undefined__') {
if (this.options.searchValue) {
query = decodeURIComponent(this.options.searchValue);
} else {
query = '';
}
}
this.searchForm = new UWA.Controls.SearchForm();
this.searchForm.setInitialState('/img/s.gif', query, false);
this.searchForm.observe('submit', function(searchText, checked) { this._doSearch(this.options.searchUrl, searchText, this.options.proxy); }.bind(this));
this.searchForm.observe('reset', function(searchText, checked) { this._doSearch(this.options.searchUrl, '', this.options.proxy); }.bind(this));
this.searchForm.appendTo(this.searchDiv);
this.highlight = query;
this._doSearch(this.options.searchUrl, query, this.options.proxy);
}
if (this.options.hasVideoPlayer == true) {
this.playerDiv = this.videoContainer;
var playerDim = Element.getDimensions(this.playerDiv);
var aspectRatio = this.options.videoAspectRatio || 1;
var flashOptions = { width: playerDim.width, height: playerDim.width / aspectRatio,
wmode: this.options.flashNotOpaque ? "" : "opaque",
autoResize: true, showFullScreenLink: false };
if (this._isInNativeMode()) {
this.widget.environment.obj.dataObj.fixId = Math.random()*100000;
flashOptions.fixModuleId = this.widget.environment.obj.dataObj.fixId;
}
this.flashPlayer = new UWA.Controls.FlashPlayer(this.playerDiv, flashOptions);
}
if (this.options.hasAudioPlayer == true && AudioPlayer && AudioPlayer.init) {
this.audioPlayerDiv = document.createElement("div");
this.audioPlayerDiv.id = 'playermp3Container';
this.content.appendChild(this.audioPlayerDiv);
AudioPlayer.init();
}
content.appendChild(this.feedDiv);
if (this.url) {
if (typeof this.feed == "undefined") {
this._getFeed(this.url, this.options.proxy); // it will call displayFeed
} else {
this._displayFeed();
}
}
},
_displayFeed: function(feed) {
if (this.lastRequest && this.lastRequest.cancel) { this.lastRequest.cancel(); }
if (typeof feed != "undefined") {
this.feed = feed;
if (typeof feed.dir != "undefined" && feed.dir == "rtl") {
this.widget.dir = "rtl";
this.content.dir = "rtl";
if (typeof this.content.parentNode != "undefined") {
Element.addClassName(this.content.parentNode, "rtl");
}
} else {
this.widget.dir = "ltr";
this.content.dir = "ltr";
}
} else {
feed = this.feed;
}
if (this.options.updateIcon) this.widget.setIcon(feed.htmlUrl);
var title = feed.title;
var category = this.widget.getValue("category");
if (this.widget.readOnly == true &&
typeof this.options.category != "undefined") {
category = this.options.category;
}
if (this.options.useCategoriesAsTitle == true) title = this.options.categoryLabels[category];
if (this.options.updateTitle) this.widget.setTitle('<a href="'+feed.htmlUrl+'" target="_blank">'+title+'</a>');
if (!feed || feed.error) {
this._error(_("Error"), _("Looks like this feed is not valid or currently not responding.")); return;
} else
if (feed.status == 401) {
this._error(_("Unauthorized"), _("You don't have the required authorization to access this feed.")); return;
} else
if (!feed.items) {
this._error(_("Error"), _("Looks like this feed is not valid or currently not responding.")); return;
} else
if (feed.items.length == 0) {
this._error(feed.title, _("No items in feed.")); return;
}
var content = this.feedDiv;
var feedSiteUrlDomain = typeof feed.htmlUrl == "undefined" ? "" : feed.htmlUrl;
if (feedSiteUrlDomain) {
var tmp = feedSiteUrlDomain.substring(0, feedSiteUrlDomain.indexOf("/", 7));
if (tmp) feedSiteUrlDomain = tmp;
}
this.history = this.widget.getHistory();
UWA.Services.FeedHistory.build(this.widget.readOnly ? "" : this.history, feed);
this.feedView = new UWA.Controls.FeedView({
details: this.options.details,
showDate: this.options.showDate,
lookForHtmlThumbnail: this.options.lookForHtmlThumbnail,
removeImagePattern: this.options.removeImagePattern,
feedSiteUrlDomain: feedSiteUrlDomain,
search: this.options.search,
dir: this.widget.dir,
allowVideoPlayButton: this.options.hasVideoPlayer });
this.feedView.observe("onclick", this._onClick.bind(this));
this.feedView.observe("onmiddleclick", this._onMiddleClick.bind(this));
this.feedView.observe("onpodcastplay", this._onPodcastPlay.bind(this));
this.feedView.observe("onvideoplay", this._onVideoPlay.bind(this));
this.feedView.observe("ondownload", this._onDownload.bind(this));
if (this._isInNativeMode() && this.widget.readOnly != true) this.feedView.observe("onaddstar", this._onAddStar.bind(this));
if (typeof this.offset == "undefined") this.offset = 0;
if (this.options.search != "") {
limit = feed.items.length;
} else {
this.limit = this.options.nbTitles;
var limit = feed.items.length - this.offset;
limit = limit > this.limit ? this.limit : limit;
}
for (var i = 0; i < limit; i++) {
var index = this.offset + i;
var item = feed.items[index];
if (typeof item.enclosures == "object" && typeof item.video == "undefined") {
item.enclosures.each(function(el) { if (el.type == 'application/x-shockwave-flash') { item.video = el.url; } });
}
if (item.video &&
this.options.hasVideoPlayer == true &&
this.options.videoAutoPlay == true &&
this.widget.getBool("videoAutoPlay")) {
this.flashPlayer.show(item.video, item.flashvars+this.options.sharingLink, {
mediaLinkUrl: item.link, mediaLinkText: _("See on {0}").format(this.options.config.providerName)
});
if (typeof this.options.headerTextColor != "undefined") {
var links = this.playerDiv.getElementsByTagName('a');
for (var li=0; li<links.length; li++) {
links[li].style.color = this.options.headerTextColor;
}
}
this.options.videoAutoPlay = false;
}
this.feedView.addItem(index, item, UWA.Services.FeedHistory.isRead(feed, index));
}
content.innerHTML = "";
content.appendChild(this.feedView.getContent());
if (this.options.hideUnreadCount != true && this.widget.readOnly != true) {
var nbUnread = UWA.Services.FeedHistory.getNbNew(feed, feed.items.length);
this.widget.setUnreadCount(nbUnread);
}
if (this.options.search != "") {
this.widget.setSearchResultCount(this.feedView.getNumberOfDisplayedItems());
} else {
var pager = new UWA.Controls.Pager({module: this,
limit: this.limit,
offset: this.offset,
dataArray: feed.items});
pager.onChange = function(newOffset) {
this.module.offset = newOffset;
this.module._displayFeed();
}
this.pagerContent = pager.getContent();
content.appendChild(this.pagerContent);
if (!this._isInNativeMode() || App.userCustom.showFeedNav == "1") {
this.pagerContent.style.display = "block";
}
this.pagerContent.style.display = "block";
}
this.widget.callback("onUpdateBody");
},
_getFeed: function(url, proxy) {
UWA.log("Feed._getFeed()");
if (typeof url == 'undefined') url = this.url;
if (typeof url == 'undefined') return;
if (typeof proxy == 'undefined') proxy = this.options.proxy || 'feed';
if (this.lastRequest && this.lastRequest.cancel) {
this.lastRequest.cancel();
}
this.url = url;
if (!proxy) { proxy = this.options.proxy || 'feed'; }
this.feedDiv.innerHTML = _("Loading...");
var parameters = { method : 'GET',
proxy: proxy,
shortFeed: false,
type: 'feed',
onComplete: this._displayFeed.bind(this),
onFailure: this._displayFeed.bind(this) };
if (proxy == "ajax" && !this._isInNativeMode()) url = "http://"+NV_HOST+url;
this.lastRequest = UWA.Data.request(url, parameters);
},
_doSearch: function(url, query, proxy) {
query = encodeURIComponent(query);
this.widget.setValue("lastSearch", query);
if (query == '') {
this._error(this.options.title, _("No search entry yet"));
} else {
this.widget.setHistory('');
this._getFeed(url.replace(/%s/, query), proxy);
}
},
_onClick: function(params) {
this._setRead(params.index);
if (this.options.openOutside == true) return false;
if (this.options.forcePlayVideo == true) {
return this._onVideoPlay(params);
}
if (App.inSubscribePreview) return false;
var feed = this.feed;
if (typeof App.FeedReader != "undefined") {
if (this.flashPlayer && typeof this.flashPlayer != "undefined") {
this.flashPlayer.hide();
this.widget.callback("onUpdateBody");
}
var Com = new Netvibes.UI.Feed.FeedReaderCom(this);
var title = feed.title;
var category = this.widget.getValue("category");
if (this.widget.readOnly == true &&
typeof this.options.category != "undefined") {
category = this.options.category;
}
if (this.options.useCategoriesAsTitle == true) title = this.options.categoryLabels[category];
App.FeedReader.display({title: title,
moduleLocalData: Com,
selectedItemIndex: params.index,
moduleObj: Com,
contentObj: Com,
proxy: "proxy/feedProxy.php?url="+encodeURIComponent(this.url)});
} else if (typeof Netvibes.UI.EmbedFeedReader != "undefined") {
new Netvibes.UI.EmbedFeedReader(feed, params.index);
} else {
if (this.widget && this.widget.openURL) this.widget.openURL(feed.items[params.index].link);
}
return true;
},
_onVideoPlay: function(params) {
this._setRead(params.index);
var feed = this.feed;
if (feed.items[params.index].video && this.options.hasVideoPlayer == true) {
this.flashPlayer.show(feed.items[params.index].video, feed.items[params.index].flashvars+this.options.sharingLink, {
mediaLinkUrl: feed.items[params.index].link,
mediaLinkText: _("See on {0}").format(this.options.providerName)
});
if (typeof this.options.headerTextColor != "undefined") {
var links = this.playerDiv.getElementsByTagName('a');
for (var li=0; li<links.length; li++) {
links[li].style.color = this.options.headerTextColor;
}
}
this.widget.callback("onUpdateBody");
}
return true;
},
_onMiddleClick: function(params) {
this._setRead(params.index);
if (this.flashPlayer) {
this.flashPlayer.hide();
this.widget.callback("onUpdateBody");
}
},
_onPodcastPlay: function(params) {
if (this._isInNativeMode()) {
if (App.inSubscribePreview) {
alert(_("Sorry, this feature is not available in preview mode."));
return false;
}
this._setRead(params.index);
if (AudioPlayer && AudioPlayer.play) AudioPlayer.play(params.fileLink, params.podName);
return false;
} else {
this._setRead(params.index);
if (AudioPlayer && AudioPlayer.play) AudioPlayer.play(params.fileLink, params.podName);
return true;
}
},
_setRead: function(index) {
UWA.log("Feed._setRead()");
var feed = this.feed;
if (UWA.Services.FeedHistory.isRead(feed, index) == false) {
UWA.Services.FeedHistory.setRead(feed, index);
this.feedView.setRead(index);
this.widget.setHistory(UWA.Services.FeedHistory.getString(feed));
if (this.options.hideUnreadCount != true && this.widget.readOnly != true) {
var nbUnread = UWA.Services.FeedHistory.getNbNew(feed, feed.items.length);
this.widget.setUnreadCount(nbUnread);
}
}
},
_onDownload: function(params) {
this._setRead(params.index);
this.widget.openURL(params.mediaUrl);
return true;
},
_onAddStar: function(params) {
var feed = this.feed;
var item = feed.items[params.index];
this.widget.addStar({title: item.title, url: item.link});
return true;
},
_error: function(title, error) {
this.feedDiv.innerHTML = "<p>" + error + "</p>";
return false;
},
_isInNativeMode: function() {
return (typeof this.widget.environment.netvibes != "undefined" && this.widget.environment.netvibes.inline);
}
}
Netvibes.UI.Feed.FeedReaderCom = Class.create();
Netvibes.UI.Feed.FeedReaderCom.prototype = {
initialize: function(feedCtrl) {
this.feedCtrl = feedCtrl;
this.feed = this.feedCtrl.feed;
},
save: function() {
UWA.log("FeedReaderCom.save()");
},
setHistory: function(history) {
UWA.log("FeedReaderCom.setHistory();");
this.feedCtrl.widget.setHistory(history);
},
saveHistory: function() {
UWA.log("FeedReaderCom.saveHistory()");
this.feedCtrl.widget.saveHistory();
},
getItemNode: function(index) {
UWA.log("FeedReaderCom.getItemNode()");
return this.feedCtrl.feedView.getItem(index);
},
setFeedTitle: function() {
UWA.log("FeedReaderCom.setFeedTitle()");
if (this.feedCtrl.options.hideUnreadCount != true && this.feedCtrl.widget.readOnly != true) {
var feed = this.feedCtrl.feed;
var nbUnread = UWA.Services.FeedHistory.getNbNew(feed, feed.items.length);
this.feedCtrl.widget.setUnreadCount(nbUnread);
}
},
setAllAsRead: function() {
UWA.log("FeedReaderCom.setAllAsRead()");
if (this.feedCtrl.widget.readOnly == true) return;
var feed = this.feedCtrl.feed;
var nbItems = feed.items.length;
var nbDisplayedItems = this.feedCtrl.feedView.getNumberOfDisplayedItems();
for (var i = 0; i < nbItems; i++) {
if (i >= this.feedCtrl.offset && i < (nbDisplayedItems + this.feedCtrl.offset)) {
if (UWA.Services.FeedHistory.isRead(feed, i)) {
this.feedCtrl.feedView.setRead(i);
} else {
this.feedCtrl.feedView.setUnRead(i);
}
}
}
this.setFeedTitle();
},
getShowPage: function() {
UWA.log("FeedReaderCom.getShowPage()");
return parseInt(this.feedCtrl.widget.getValue("showPage"));
},
setShowPage: function(value) {
UWA.log("FeedReaderCom.setShowPage()");
return parseInt(this.feedCtrl.widget.setValue("showPage", value));
},
addStar: function(data) {
UWA.log("FeedReaderCom.addStar()");
this.feedCtrl.widget.addStar(data);
}
}
if (typeof Netvibes == "undefined" || !Netvibes) var Netvibes = {};
if (typeof Netvibes.UI == "undefined" || !Netvibes.UI) Netvibes.UI = {};
Netvibes.UI.TabView = Class.create();
Netvibes.UI.TabView.prototype = {
setOptions: function(options) {
this.options = {
autohideDropdowns: true,
classTabSet: 'nv-tabSet',
classTabList: 'nv-tabList',
classTabContent: 'nv-tabContent',
softPadding: false,
orientation: 'top',
dataKey: 'text',
extendedAction: false,
allowReload: false
}
Object.extend(this.options, options || {});
},
initialize: function(options) {
this.setOptions(options);
this.dataItems = {}; // private map (name => data)
this.selectedTab = null; // HTMLLiElement
this.selectedIndex = this.options.selectedIndex || 0;
},
_createTabSet: function() {
this.tabSet = document.createElement("div");
this.tabSet.className = this.options.classTabSet;
this.tabList = document.createElement("ul");
this.tabList.className = this.options.classTabList + " autoclear";
this.tabList.style.padding = '0'; // with autoclear: fix IE6 float escaping bug
if (/^(top|bottom|left|right)$/.test(this.options.orientation)) {
Element.addClassName(this.tabList, this.options.orientation);
}
this.tabSet.appendChild(this.tabList);
},
appendTo: function(element) {
if (!this.tabSet) this._createTabSet();
if (!this.selectedTab && this.tabList.hasChildNodes()) this.selectTab(0, false);
$(element).appendChild(this.tabSet);
if (typeof widget == 'object' && typeof widget.callback == 'function') { widget.callback('onUpdateBody'); }
},
addTab: function(name, dataItem, options) {
if (!this.tabSet) this._createTabSet();
if (typeof options == 'undefined') options = {};
var li = document.createElement('li');
li.className = 'tab ' + name;
li.setAttribute('name', name);
if (dataItem.disabled) {
Element.addClassName(li, 'disabled');
} else {
li.onclick = this.eventTabClicked.bindAsEventListener(this);
if (options.staticText) {
li.setAttribute('static', 'static');
}
}
var a = document.createElement("a");
a.href = "javascript:void(0)";
a.title = '';
a.target = "_blank";
a.style.whiteSpace = "nowrap";
a.onclick = function() { return false; }
if (dataItem.length) {
if (dataItem[0].image) {
var imgElement =  document.createElement("img");
imgElement.src = dataItem[0].image;
a.appendChild(imgElement);
} else {
if (dataItem[0].picto) {
var picto = document.createElement("img");
picto.src = dataItem[0].picto;
picto.style.marginRight = "4px";
picto.style.marginBottom = "-2px";
a.appendChild(picto);
} else if (dataItem[0].icon) {
var icon = document.createElement("img");
icon.src = dataItem[0].icon;
icon.style.marginRight = "4px";
icon.style.marginBottom = "-2px";
a.appendChild(icon);
}
var textElement = document.createElement("span");
textElement.appendChild(document.createTextNode(options.staticText || dataItem[0].text));
a.appendChild(textElement);
}
li.setAttribute("key", dataItem[0][this.options.dataKey]);
var dropdownElement = document.createElement("span");
dropdownElement.className = "dropdown";
do {
var uniqueId = "dropdownTab-" + (++Netvibes.UI._idIncrement);
} while($(uniqueId))
dropdownElement.setAttribute("id", uniqueId);
var placeHolder = document.createElement("img");
placeHolder.src = "http://" + NV_HOST + "/img/s.gif";
placeHolder.width = 14;
placeHolder.height = 14;
placeHolder.style.verticalAlign = "middle";
placeHolder.className = "placeHolder";
dropdownElement.appendChild(placeHolder);
a.appendChild(dropdownElement);
dropdownElement.onmousedown = this.eventDropDown.bindAsEventListener(this);
} else {
if (dataItem.image) {
var imgElement =  document.createElement("img");
imgElement.src = dataItem.image;
a.appendChild(imgElement);
} else {
if (dataItem.picto) {
var picto = document.createElement("img");
picto.src = dataItem.picto;
picto.style.marginRight = "4px";
picto.style.marginBottom = "-2px";
a.appendChild(picto);
} else if (dataItem.icon) {
var icon = document.createElement("img");
icon.src = dataItem.icon;
icon.style.marginRight = "4px";
icon.style.marginBottom = "-2px";
a.appendChild(icon);
}
if (typeof dataItem.text == 'string') {
a.appendChild(document.createTextNode(dataItem.text));
} else {
a.appendChild(dataItem.text);
}
}
}
li.appendChild(a);
if (this.selectedTab == null) {
}
this.tabList.appendChild(li);
this.createTabContent(name);
this.dataItems[name] = dataItem;
return li;
},
removeTab: function(name) {
var tabItem = this.getTab(name);
Element.remove(tabItem);
},
addExternalLink: function(name, href) {
var tabItem = this.getTab(name);
tabItem.firstChild.setAttribute("href", href);
},
eventTabClicked: function(e) {
if (Event.element(e).className == "placeHolder") {
return false;
}
var sender = Event.findElement(e, "LI");
if (!Element.hasClassName(sender, 'disabled')) {
this.selectTab(sender);
}
return false;
},
eventExtendedActionClicked: function(e) {
this.hidePopupMenu();
this._notify('extendedActionClicked');
return false;
},
enableTab: function(name, enable) {
var tabItem = this.getTab(name);
if (enable) Element.removeClassName(tabItem, 'disabled');
else Element.addClassName(tabItem, 'disabled');
},
selectTab: function(tabItem, notify) {
if (typeof tabItem == 'number' || typeof tabItem == 'string') {
tabItem = this.getTab(tabItem);
}
var name = tabItem.getAttribute('name');
if (this.selectedTab && (this.selectedTab.getAttribute('name') == name) && notify == undefined && !this.options.allowReload) {
return; // no changes
}
var items = this.tabList.getElementsByTagName('li');
for (var i=0, li; li=items[i]; i++) {
Element.removeClassName(li, 'selected');
if (this.popupMenu) this.hidePopupMenu();
if (this.options.autohideDropdowns) {
var dropdowns = $(li).getElementsByClassName('dropdown');
$A(dropdowns).each( function(el) {Element.hide(el)} );
}
}
Element.addClassName(tabItem, 'selected');
if (this.options.autohideDropdowns) {
var dropdowns = $(tabItem).getElementsByClassName('dropdown');
$A(dropdowns).each( function(el) {Element.show(el)} );
}
for (var i=0, content; content=this.contentArray[i]; i++) {
if (Browser.isSafari && Browser.version < 3.0 &&
content.getElementsByTagName("iframe").length == 1 && content.getElementsByTagName("iframe")[0].style.width == "100%") {
if (name==content.getAttribute('name')) {
content.style.visibility = "visible";
content.style.position = "static";
} else {
var frame = content.getElementsByTagName("iframe")[0];
content.style.width = frame.contentWindow.innerWidth+"px";
content.style.visibility = "hidden";
content.style.position = "absolute";
content.style.left = "0px";
content.style.top = "0px";
}
} else {
if (name==content.getAttribute('name')) Element.show(content); else Element.hide(content);
}
}
this.selectedTab = tabItem;
this.selectedIndex = tabItem.getAttribute('index');
if (notify === false) return;
this._notify('activeTabChange');
},
hide: function() {
Element.hide(this.tabSet);
},
show: function() {
Element.show(this.tabSet);
},
hideTabList: function() {
Element.hide(this.tabList);
},
showTabList: function() {
Element.show(this.tabList);
},
reload: function() {
this._notify('activeTabChange');
},
eventDropDown: function(e) {
var sender = Event.findElement(e, "LI");
this.popupMenu = $('minitabsOptions');
if (!this.popupMenu) {
this.popupMenu = document.createElement('ul');
this.popupMenu.setAttribute('id', 'minitabsOptions');
this.popupMenu.className = 'popupMenu';
this.popupMenu.style.position = 'absolute';
document.getElementsByTagName('body').item(0).appendChild(this.popupMenu);
Element.hide(this.popupMenu);
Event.observe(document, 'mousedown', this.hidePopupMenu.bindAsEventListener(this)); // free on window.unload
}
var dropdownButton = $(sender).getElementsByClassName('dropdown')[0];
if (Element.visible(this.popupMenu) && this.popupMenu.getAttribute("dropdownId") == dropdownButton.id) {
this.hidePopupMenu();
return;
}
this._showPopupMenu(sender);
this.popupMenu.setAttribute("dropdownId", dropdownButton.id);
Event.stop(e);
return false;
},
getTabContent: function(name) {
if (typeof name == 'number') {
return this.contentArray.detect( function(el) {return el.getAttribute("index") == name;} );
}
return this.contentArray.detect( function(el) {return el.getAttribute("name") == name;} );
},
setContent: function(name, content) {
var node = this.getTabContent(name);
if (node) {
if (typeof content == 'string') {
node.innerHTML = content;
} else {
node.innerHTML = '';
node.appendChild(content);
}
}
if (typeof widget == 'object' && typeof widget.callback == 'function') { widget.callback('onUpdateBody'); }
},
getTab: function(name) { // Returns HTMLLiElement
if (typeof name == 'string' || typeof name == 'number') {
var items = this.tabList.getElementsByTagName('li');
for (var i=0, item; item=items[i]; i++) {
if (typeof name == 'number' && name == i) return item;
if (name == item.getAttribute('name')) return item;
}
}
return name; // object
},
observe: function(name, observer) { // onchange
if (!this.observers) this.observers = [];
this.observers.push([name, observer]);
},
_notify: function(event) {
if (!this.observers) return;
var sender = this.selectedTab;
var eventArgs = this.dataItems[sender.getAttribute('name')];
if (eventArgs.length) {
var dataKey = this.options.dataKey;
eventArgs = eventArgs.detect(function(el) { return el[dataKey] == sender.getAttribute('key')});
}
this.observers.each(function(observer) {
if (observer[0] == event && typeof(observer[1]) == 'function')
observer[1](sender.getAttribute('name'), eventArgs);
});
},
_showPopupMenu: function(tabItem) {
var offset = Position.cumulativeOffset(tabItem);
this.popupMenu.innerHTML = '';
try {
var tabName = tabItem.getAttribute('name');
var dataItems = this.dataItems[tabName];
var tabKey = tabItem.getAttribute('key');
for (var i=0, item; item=dataItems[i]; i++) {
if (item[this.options.dataKey] == tabKey && tabItem.getAttribute('static') != 'static')
continue;
var li = document.createElement("li");
var a = document.createElement("a");
if (item.picto) {
var picto = document.createElement("img");
picto.src = item.picto;
picto.style.marginRight = "4px";
picto.style.marginBottom = "-2px";
a.appendChild(picto);
} else if (item.icon) {
var icon = document.createElement("img");
icon.src = item.icon;
icon.style.marginRight = "4px";
icon.style.marginBottom = "-2px";
a.appendChild(icon);
}
a.href = (item.htmlUrl || "javascript:void(0)");
a.setAttribute('context', tabName);
a.appendChild(document.createTextNode(item.text));
a.setAttribute("key", item[this.options.dataKey]);
if (!this.options.extendedAction && (dataItems.length -1) == i) {
Element.addClassName(a, 'last');
}
a.onclick = this.eventPopupMenuClicked.bindAsEventListener(this);
li.appendChild(a);
this.popupMenu.appendChild(li);
}
if (this.options.extendedAction) {
var li = document.createElement("li");
var a = document.createElement("a");
a.href = "javascript:void(0)";
Element.addClassName(a, 'action');
a.setAttribute('context', tabName);
a.appendChild(document.createTextNode(this.options.extendedAction));
a.onclick = this.eventExtendedActionClicked.bindAsEventListener(this);
li.appendChild(a);
this.popupMenu.appendChild(li);
}
} catch(e) {}
var tabDimensions = Element.getDimensions(tabItem);
var delta = (typeof App != 'undefined' && App.userCustom && (App.userCustom.themeTitle == 'Coriander'))? 0 : 1;
if (Browser.isSafari || Browser.isOpera) delta = 0;
this.popupMenu.style.left = (offset[0] + delta)+'px';
this.popupMenu.style.top  = (offset[1] + delta + tabDimensions.height)+'px'; // 24: IE, Opera
this.popupMenu.style.width = "auto";
var menuWidth = Element.getDimensions(this.popupMenu).width;
if (menuWidth < tabDimensions.width) {
var delta = 12;
if (Browser.isIE) delta = 11;
this.popupMenu.style.width = tabDimensions.width-delta + "px";
}
Element.show(this.popupMenu);
var drops = $(this.tabList).getElementsByClassName("dropped");
$A(drops).each(function(el) {
Element.removeClassName(el, "dropped");
});
Element.addClassName(tabItem, 'dropped'); // state ON
if (typeof widget == 'object' && typeof widget.callback == 'function') {
var item; var dim;
item = widget.body; var bodyTop = 0; while (item && item != document.body) { bodyTop += item.offsetTop; item = item.offsetParent; }
item = this.popupMenu; var popupTop = 0; while (item && item != document.body) { popupTop += item.offsetTop; item = item.offsetParent; }
popupDim = Element.getDimensions(this.popupMenu);
bodyDim = widget.body.getDimensions();
var popupHeight = popupTop - bodyTop + popupDim.height;
if (bodyDim.height < popupHeight) {
widget.body.style.height = popupHeight + 'px';
}
widget.callback("onUpdateBody");
}
},
eventPopupMenuClicked: function(e) {
var sender = Event.findElement(e, "A");
var tabName = sender.getAttribute('context');
var tabItem = this.getTab(tabName);
if (tabItem.getAttribute('static') != 'static') {
var dataKey = this.options.dataKey;
var dataItem = this.dataItems[tabName].detect(function(el) { return el[dataKey] == sender.getAttribute('key')});
tabItem.getElementsByTagName("span")[0].innerHTML = dataItem.text;
if (dataItem.picto) {
tabItem.getElementsByTagName("img")[0].src = dataItem.picto;
} else if (dataItem.icon) {
tabItem.getElementsByTagName("img")[0].src = dataItem.icon;
}
}
tabItem.setAttribute("key", sender.getAttribute('key'));
this._notify('activeTabChange');
this.selectTab(tabItem);
this.hidePopupMenu();
Event.stop(e);
return false;
},
selectKey: function(name, key, select) {
var tabItem = this.getTab(name);
var dataItem = null;
var dataKey = this.options.dataKey;
if (typeof (this.dataItems[name].detect) == 'function') {
dataItem = this.dataItems[name].detect(function(el) { return el[dataKey] == key; });
}
if (dataItem) {
tabItem.getElementsByTagName("span")[0].innerHTML = dataItem.text;
tabItem.setAttribute("key", key);
if (dataItem.icon) {
tabItem.getElementsByTagName("img")[0].src = dataItem.icon;
}
if (select == undefined || select) {
this.selectTab(tabItem); // Select by default
}
if (select == undefined || select) {
this.selectTab(tabItem); // Select by default
}
}
},
hidePopupMenu: function(e) {
if (!this.popupMenu)
return false;
if (e && Position.within(this.popupMenu, Event.pointerX(e), Event.pointerY(e))) {
Event.stop(e);
return false;
}
Element.hide(this.popupMenu);
var drops = $(this.tabList).getElementsByClassName("dropped");
$A(drops).each(function(el) {
Element.removeClassName(el, "dropped");
});
if (typeof widget == 'object' && typeof widget.callback == 'function') {
widget.body.style.height = '';
widget.callback("onUpdateBody");
}
},
createTabContent: function(name, index) {
var tabContent = document.createElement("div");
if (this.options.softPadding) {
if (Browser.isIE) tabContent.style.padding = "3px 3px 3px 3px";
else tabContent.style.padding = "6px 3px 3px 3px";
}
tabContent.className = this.options.classTabContent + ' ' + name;
tabContent.setAttribute("name", name);
tabContent.innerHTML = _("Loading...");
this.tabSet.appendChild(tabContent);
if (!this.contentArray) this.contentArray = [];
this.contentArray.push(tabContent);
tabContent.setAttribute("tabIndex", this.contentArray.length-1);
},
restoreState: function(module) {
var data = module.dataObj.data;
if (typeof data.miniTabViewState != 'undefined') {
var state = data.miniTabViewState.parseJSON();
if (state && typeof state.selectedKey == 'string') {
this.selectKey(state.selectedKey);
return;
}
if (state && typeof state.selectedTab == 'string') {
this.selectTab(state.selectedTab);
return;
}
}
this.selectTab(0);
},
saveState: function(module) {
var jsonViewState = null;
var selectedKey = this.selectedTab.getAttribute('key');
if (typeof selectedKey == 'string') {
jsonViewState = '{"selectedKey": "'+selectedKey+'"}';
} else {
jsonViewState = '{"selectedTab": "'+this.selectedTab.getAttribute('name')+'"}';
}
if (jsonViewState && jsonViewState != module.dataObj.data.miniTabViewState) {
module.dataObj.data.miniTabViewState = jsonViewState;
module.save();
}
},
destroy: function() {
Event.stopObserving(document, 'mousedown', this.hidePopupMenu);
}
}
var MiniTabs = {}; // factory
MiniTabs.create = function(element, options) {
var tabs = new Netvibes.UI.TabView(options);
tabs.appendTo(element);
return tabs;
}
Netvibes.UI.FlashPlayer = Class.create();
Netvibes.UI.FlashPlayer._maxzIndex = 9010;
Netvibes.UI.FlashPlayer.prototype = {
setOptions: function(options) {
this.options = { flashVars: '', flashUrl: '', width: 320, height: 240,
wmode: "opaque", showToolbar: true, showFullScreenLink: true,
fixModuleId: 0 }
Object.extend(this.options, options || {});
},
initialize: function(parent, options) {
this.setOptions(options);
this.parent = parent;
this.container = null;
this.linuxIframe = null;
this.isFullScreen = false;
},
show: function(flashUrl, flashVars, options) {
if (typeof options == 'undefined') options = {}
this.options.flashUrl = flashUrl; // ie, googleplayer.swf
if (Browser.isIE) { // Force cache refresh for IE
if (this.options.flashUrl.indexOf('?') != -1)
this.options.flashUrl += ('&' + Math.round(Math.random() * 100));
}
this.options.flashVars = flashVars;
if (!this.container) {
this.container = document.createElement("div");
this.container.className = "flashplayer";
this.container.align = 'center';
this.container.style.position = "absolute";
this.container.style.zIndex = '8000';
this.container.style.background = "#ffffff";
this.parent.appendChild(this.container);
if (!Browser.isIE) {
this.container.style.position = "absolute";
this.placeHolder = document.createElement("div");
this.placeHolder.style.height = this.options.height+"px";
this.parent.appendChild(this.placeHolder);
}
} else {
this.container.innerHTML = "";
}
var playerHtml = '';
playerHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+this.options.width+'" height="'+this.options.height+'">';
playerHtml +=   '<param name="allowScriptAccess" value="sameDomain" />';
playerHtml +=   '<param name="movie" value="'+this.options.flashUrl+'" />';
playerHtml +=   '<param name="quality" value="high" />';
playerHtml +=   '<param name="wmode" value="'+this.options.wmode+'" />';
playerHtml +=   '<param name="bgcolor" value="#ffffff" />';
playerHtml +=   '<param value="true" name="allowfullscreen"/>';
playerHtml +=   '<param name="flashVars" value="'+this.options.flashVars+'" />';
playerHtml +=   '<embed wmode="'+this.options.wmode+'" src="'+this.options.flashUrl+'" quality="high" bgcolor="#ffffff" width="'+this.options.width+'" height="'+this.options.height+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashVars="'+this.options.flashVars+'" allowfullscreen="true"/>';
playerHtml += '</object>';
this.container.innerHTML = playerHtml;
this.element = this.parent.getElementsByTagName((Browser.isIE || Browser.isSafari)? "object" : "embed")[0];
if (this.options.showToolbar) this._createLinks(options.mediaLinkUrl, options.mediaLinkText);
Element.show(this.container);
if (this.placeHolder) Element.show(this.placeHolder);
this.resize();
},
hide: function() {
if (this.container) {
this.container.innerHTML = ''; // Needed for IE in order to stop playing
Element.hide(this.container);
if (this.placeHolder) Element.hide(this.placeHolder);
}
if (this.hide && this.links) {
Element.hide(this.links);
}
if (typeof widget == 'object' && typeof widget.callback == 'function') { widget.callback("onUpdateBody"); }
return false;
},
setFullScreenMode: function(mode) {
this.isFullScreen = (typeof(mode)!='undefined' && mode) ? true : false;
this._fixAdjacentModules();
if (this.isFullScreen) {
window.scrollTo(0, 0);
if (Browser.isIE) this.container.style.position = 'absolute';
this.container.style.top = "0px";
this.container.style.left = "0px";
this.container.style.marginLeft = '0';
this.container.style.zIndex = ++Netvibes.UI.FlashPlayer._maxzIndex;
this._createCloseButton();
Event.observe(window, 'resize', this.resize.bindAsEventListener(this));
} else {
Element.remove(this.closeButton);
if (Browser.isLinux && Browser.isFirefox) Element.remove(this.linuxIframe);
Event.stopObserving(window, 'resize', this.resize);
}
this.resize();
if (Browser.isLinux && Browser.isFirefox) {
this.linuxIframe = document.createElement("iframe");
this.linuxIframe.style.position = "absolute";
this.linuxIframe.style.width = this.closeButton.offsetWidth+"px";
this.linuxIframe.style.height = this.closeButton.offsetHeight+"px";
this.linuxIframe.style.left = this.closeButton.offsetLeft+"px";
this.linuxIframe.style.top = this.closeButton.offsetTop+"px";
this.linuxIframe.setAttribute("frameborder", "0");
this.linuxIframe.setAttribute("scrolling", "no");
this.linuxIframe.style.zIndex = parseInt(this.container.style.zIndex)+1;
document.body.appendChild(this.linuxIframe);
}
return false;
},
resize: function(w, h) {
if (!this.container) return;
if (this.isFullScreen) {
if (this.container.style.width != Browser.getDocumentWidth()) {
this.container.style.width = '1px';
this.container.style.height = '1px';
this.element.style.width = '1px';
this.container.style.width = Browser.getDocumentWidth()+'px';
this.container.style.height = Browser.getDocumentHeight()+'px';
this.element.style.height = Browser.getClientHeight()-(Browser.isFirefox? 3 : 0)+'px';
this.element.style.width = Browser.getDocumentWidth()+'px';
}
return;
}
this.container.style.top = '';
this.container.style.left = '';
this.container.style.width = '1px';
this.container.style.height = '1px';
if (typeof w != "undefined" && typeof h != "undefined") {
this.container.style.width = w+'px';
if (!Browser.isIE) {
this.placeHolder.style.height = h+"px";
this.container.style.marginLeft = '0px';
}
this.container.style.height = h+"px";
this.element.style.width = w+'px';
this.element.style.height = h+"px";
return ;
}
if (Browser.isIE) {
this.container.style.position = '';
var availableSpace = Element.getDimensions(this.parent);
this.container.style.width = availableSpace.width+'px';
this.container.style.height = this.options.height+'px';
this.element.style.width = this.options.width+'px';
this.element.style.height = this.options.height+'px';
} else {
var availableSpace = Element.getDimensions(this.placeHolder);
var width = Math.min(this.options.width, availableSpace.width);
this.container.style.width = width+'px';
this.container.style.height = availableSpace.height+'px';
this.element.style.width = width+'px';
this.element.style.height = availableSpace.height+'px';
this.container.style.marginLeft = Math.round((availableSpace.width-width)/2)+'px';
}
},
_createCloseButton: function() {
this.closeButton = document.createElement("input");
this.closeButton.type = "button";
this.closeButton.id = "flashplayer-back";
this.closeButton.style.position = "absolute";
this.closeButton.style.top = "2px";
this.closeButton.style.right = "2px";
this.closeButton.value = _("Back to my page");
this.closeButton.style.zIndex = parseInt(this.container.style.zIndex)+2;
if (Browser.isIE && Browser.version > 6) {
this.closeButton.style.width = (this.closeButton.value.length)+"em";
}
this.closeButton.onclick = function() {
this.setFullScreenMode(false);
}.bind(this);
document.body.appendChild(this.closeButton);
},
_createLinks: function(linkUrl, linkText) {
if (this.links) Element.remove(this.links);
this.links = document.createElement("p");
this.links.align = 'center';
this.links.style.padding = '4px';
if (linkUrl && linkText) {
var linkOriginal = document.createElement("a");
linkOriginal.href = linkUrl;
linkOriginal.rel = 'external';
linkOriginal.target = '_blank';
linkOriginal.innerHTML = linkText.stripTags();
this.links.appendChild(linkOriginal);
}
this.links.appendChild(document.createTextNode(' | '));
var linkClose = document.createElement("a");
linkClose.href = "javascript:void(0)";
linkClose.onclick = this.hide.bind(this);
linkClose.innerHTML = _("Hide");
this.links.appendChild(linkClose);
this.parent.appendChild(this.links);
},
_fixAdjacentModules: function() {
if (!this.options.fixModuleId) return;
var columnGrippers = $('application').getElementsByClassName("gripper");
for (var i=0;  i < columnGrippers.length; i++) {
var gripper = columnGrippers[i];
if (this.isFullScreen) gripper.style.visibility="hidden"; else gripper.style.visibility="";
}
for (var i=0, module; module=App.moduleList[i]; i++) {
if (module.dataObj.tab == App.selectedTab && module.dataObj.fixId != this.options.fixModuleId) {
if (this.isFullScreen) module.hide(); else module.show();
}
}
}
}
Netvibes.UI.MultiPage = new Class({
Implements: [Events, Options],
options: {
className: 'multipage',
nextText: _("next"),
previousText: _("previous"),
items: [],
perPage: 10,
displayTotal: false,
layout: {
availableWidth: -1,
itemWidth: -1, // 92px
numRows: -1,
computePerRequest: false
}
},
initialize: function(options) {
this.setOptions(options);
this.offset = 0;
this.currentPage = 1;
this.items = this.options.items;
this.total = this.items.length;
this.ajax = null; // virtual
this.build();
if (this.options.layout.availableWidth > 0) {
this.options.perPage = Math.floor(this.options.layout.availableWidth / this.options.layout.itemWidth) * this.options.layout.numRows;
if (this.options.layout.computePerRequest) {
this.options.perRequest = this.options.perPage;
}
}
if (this.items.length) {
this.computeState();
}
},
build: function(){
this.container = new Element('p', {'class': this.options.className});
this.prev = new Element('a', {'class': 'prev disabled', 'rel': 'prev', 'href': 'javascript:void(0)'});
this.prev.adopt(new Element('span').setText(this.options.previousText));
this.prev.setProperty('hidefocus', 'hidefocus').addEvent('click', this.onPageChanged.bindWithEvent(this)).inject(this.container);
this.infos = new Element('em').inject(this.container);
this.next = new Element('a', {'class': 'next disabled', 'rel': 'next', 'href': 'javascript:void(0)'});
this.next.adopt(new Element('span').setText(this.options.nextText));
this.next.setProperty('hidefocus', 'hidefocus').addEvent('click', this.onPageChanged.bindWithEvent(this)).inject(this.container);
return this.container;
},
inject: function(element, parent) {
$(element).adopt(this.container);
return this;
},
show: function() {
if (this.total > this.options.perPage) {
this.container.setStyle('display', '');
}
return this;
},
hide: function() {
this.container.setStyle('display', 'none');
return this;
},
onPageChanged: function(e) {
var sender = Event.findElement(e, 'A');
if (!sender || sender.hasClass('disabled') || this.container.hasClass('loading')) {
return false;
}
if (sender.rel == 'prev') {
this.offset = this.offset - this.options.perPage;
}
else if (sender.rel == 'next') {
if (this.ajax && this.ajax.running) {
return false;
}
this.offset = this.offset + this.options.perPage;
if ((this.offset + this.options.perPage) > this.items.length && this.items.length < this.total) {
this.onRequesting(this.items.length);
return false;
}
}
this.computeState();
return false;
},
onRequesting: function(offset) {
this.container.addClass('loading');
this.infos.setText(_("Loading..."));
this.fireEvent('onRequesting', [this.ajax, offset, this.options.perPage, this.options.perRequest]);
if (this.ajax.options.data == '') { // Default value for options['data']
this.ajax.get({'offset': offset, 'count': this.options.perRequest, 'format': 'json'});
} else {
this.ajax.get();
}
},
computeState: function() {
this.currentPage = (this.offset / this.options.perPage) + 1;
var event = {
items: this.items.slice(this.offset, this.offset + this.options.perPage),
page: {
current: this.currentPage,
offset: this.offset,
total: this.total,
size: this.options.perPage
}
};
var from = this.offset + 1;
var to = this.offset + this.options.perPage;
var infosText = from + '-' + (to > this.total ? this.total : to);
if (this.options.displayTotal) {
infosText += ' / ' + this.total;
}
if (this.total == 0) {
infosText = '--';
}
this.infos.setText(infosText);
this.prev.className = (this.offset > 0)? 'prev' : 'prev disabled';
this.next.className = (this.offset < this.total - this.options.perPage)? 'next' : 'next disabled';
this.fireEvent('onPageChange', event);
}
});
Netvibes.UI.MultiPage.JSON = new Class({
Extends: Netvibes.UI.MultiPage,
options: {
requestUrl: '',
perRequest: 50,
responseParams: {
items: '', // friends
total: ''  // numFriends
}
},
initialize: function(options){
arguments.callee.parent(options);
this.ajax = new Request.JSON({
'url': options.requestUrl,
link: 'cancel',
secure: false, // false to allow benchmark comments
onComplete: this.onComplete.bind(this),
onFailure: this.onFailure.bind(this)
});
this.onRequesting(0);
},
onComplete: function(responseJSON) {
if (responseJSON.success != undefined && responseJSON.success == false) {
var event = { error: responseJSON.error || 'Unknown error' };
this.infos.setText('--');
this.fireEvent('onPageChange', event);
return false;
}
this.container.removeClass('loading');
this.items.merge(responseJSON[this.options.responseParams.items]);
if (responseJSON[this.options.responseParams.total]) {
this.total = responseJSON[this.options.responseParams.total].toInt();
}
this.computeState();
},
onFailure: function() {
this.fireEvent('onFailure');
this.infos.setText('--');
return false;
}
});
var AudioPlayer = new Object();
AudioPlayer.createIcon = function(name, title, width, height, html){
var img = widget.createElement("img");
img.src = "http://" + NV_HOST + '/img/s.gif';
Element.addClassName(img, 'icon');
Element.addClassName(img, name);
img.alt = title;
img.title = title;
img.width = width;
img.height = height;
return img;
}
AudioPlayer.onInit = function()
{
}
AudioPlayer._getControl = function()
{
return document.getElementById("playermp3Control");
}
AudioPlayer.init = function()
{
var container = $("playermp3Container");
if (!container) { return; }
container.innerHTML = '<object id="playermp3Control" style="float: right;" type="application/x-shockwave-flash" data="/player/player_mp3_js.swf" width="1" height="1"><param name="movie" value="/player/player_mp3_js.swf" /><param name="AllowScriptAccess" value="always" /><param name="FlashVars" value="listener=AudioPlayer&amp;interval=500&amp;userexternalinterface=1" /></object><!'+'--[if IE]><'+'script type="text/javascript" event="FSCommand(command,args)" for="playermp3Control">eval(args);<'+'/script><![endif]-'+'-'+'>';
container.style.height = '1px';
var display = document.createElement("div");
display.id = "playermp3Display";
display.style.marginLeft = 'auto';
display.style.marginRight = 'auto';
display.style.display = "none";
var playButton = document.createElement("a");
playButton.href = "javascript:AudioPlayer.play()";
playButton.appendChild(AudioPlayer.createIcon('actions-playermp3-play', _("Play"), 16, 16, true));
display.appendChild(playButton);
this.playButton = playButton;
var pauseButton = document.createElement("a");
pauseButton.href = "javascript:AudioPlayer.pause()";
pauseButton.appendChild(AudioPlayer.createIcon('actions-playermp3-pause', _("Pause"), 16, 16, true));
display.appendChild(pauseButton);
this.pauseButton = pauseButton;
var stopButton = document.createElement("a");
stopButton.href = "javascript:AudioPlayer.stop()";
stopButton.appendChild(AudioPlayer.createIcon('actions-playermp3-stop', _("Stop"), 16, 16, true));
display.appendChild(stopButton);
this.stopButton = stopButton;
var elapsedTime = document.createElement("span");
Element.addClassName(elapsedTime, "playermp3-elapsedtime");
Event.observe(elapsedTime, "mousedown", this.timeClick.bindAsEventListener(this));
elapsedTime.innerHTML = "00:00";
display.appendChild(elapsedTime);
this.elapsedTime = elapsedTime;
var remainingTime = document.createElement("span");
Element.addClassName(remainingTime, "playermp3-remainingtime");
Event.observe(remainingTime, "mousedown", this.timeClick.bindAsEventListener(this));
remainingTime.innerHTML = "00:00";
display.appendChild(remainingTime);
this.remainingTime = remainingTime;
var percentLoaded = document.createElement("span");
Element.addClassName(percentLoaded, "playermp3-percentloaded");
Event.observe(percentLoaded, "mousedown", this.timeClick.bindAsEventListener(this));
percentLoaded.innerHTML = "0%";
display.appendChild(percentLoaded);
this.percentLoaded = percentLoaded;
var timeline = document.createElement("span");
Event.observe(timeline, "mousedown", this.timelineClick.bindAsEventListener(this));
Event.observe(timeline, "mouseover", this.timelineOver.bindAsEventListener(this));
Element.addClassName(timeline, "playermp3-timeline");
var timelineElapsed = document.createElement("span");
Element.addClassName(timelineElapsed, "playermp3-timeline-elapsed");
timelineElapsed.innerHTML = "&nbsp;";
timeline.appendChild(timelineElapsed);
var timelineTitle = document.createElement("span");
Element.addClassName(timelineTitle, "playermp3-timeline-title");
timeline.appendChild(timelineTitle);
display.appendChild(timeline);
this.timeline = timeline;
this.timelineTitle = timelineTitle;
this.timelineElapsed = timelineElapsed;
var volumeButton = document.createElement("span");
Element.addClassName(volumeButton, "playermp3-volume");
Event.observe(volumeButton, "mousedown", this.volumeDown.bindAsEventListener(this));
Event.observe(document, "mousemove", this.volumeMove.bindAsEventListener(this));
Event.observe(document, "mouseup", this.volumeUp.bindAsEventListener(this));
var volumeIndicator = document.createElement("span");
Element.addClassName(volumeIndicator, "playermp3-volume-indicator");
volumeButton.appendChild(volumeIndicator);
display.appendChild(volumeButton);
this.volumeButton = volumeButton;
this.volumeIndicator = volumeIndicator;
var eq = document.createElement("img");
eq.src = '/img/s.gif';
this.eq = eq;
Element.addClassName(this.eq, "playermp3-eq");
display.appendChild(this.eq);
var closeButton = document.createElement("a");
closeButton.href = "javascript:AudioPlayer.close()";
closeButton.appendChild(AudioPlayer.createIcon('actions-window-close', _("Close"), 16, 16, true));
display.appendChild(closeButton);
this.closeButton = closeButton;
container.appendChild(display);
}
AudioPlayer._showPlayer = function()
{
var container = $("playermp3Container");
if (!container) { return; }
container.style.width = '100%';
container.style.height = '18px';
$("playermp3Display").style.display = '';
};
AudioPlayer._hidePlayer = function()
{
var container = $("playermp3Container");
if (!container) { return; }
container.style.height = '1px';
$("playermp3Display").style.display = 'none';
};
AudioPlayer.onUpdate = function()
{
var control = this._getControl();
var position = parseInt(this.position);
var duration = parseInt(this.duration);
var percent = Math.round(position / duration * 100);
var remaining = duration - position;
var volume = this.volume;
if (this.volumeButton) {
var volumeButtonWidth = Element.getStyle(this.volumeButton, "width");
volumeButtonWidth = parseInt(volumeButtonWidth.substr(0, volumeButtonWidth.length - 2));
var volumeWidth = volume / 200 * volumeButtonWidth;
Element.setStyle(this.volumeIndicator, {width: volumeWidth+"px"});
var min = Math.floor(position / (1000 * 60));
var sec = Math.floor(position / 1000) % 60;
this.elapsedTime.innerHTML = ((min < 10)?"0"+min:min) + ":" + ((sec < 10)?"0"+sec:sec);
min = Math.floor(remaining / (1000 * 60));
sec = Math.floor(remaining / 1000) % 60;
this.remainingTime.innerHTML = "-"+((min < 10)?"0"+min:min) + ":" + ((sec < 10)?"0"+sec:sec);
this.percentLoaded.innerHTML = ((this.bytesPercent == "NaN")?0:this.bytesPercent) + "%";
if (this.bytesPercent == "100" && Element.getStyle(this.percentLoaded, "display") == "block") {
this.elapsedTime.style.display = "block";
this.remainingTime.style.display = "none";
this.percentLoaded.style.display = "none";
}
this.timelineTitle.innerHTML = this.title;
var timelineWidth = Element.getStyle(this.timeline, "width");
var timelineElapsedWidth = parseInt(timelineWidth.substr(0, timelineWidth.length - 2));
timelineElapsedWidth = timelineElapsedWidth / this.bytesTotal * this.bytesLoaded;
timelineElapsedWidth = Math.round(timelineElapsedWidth / 100 * percent);
Element.setStyle(this.timelineElapsed, {width: timelineElapsedWidth+"px"});
if (duration > 0 && position == duration) {
this.stop();
this.onUpdate();
}
}
};
AudioPlayer.play = function(pFile, pTitle)
{
if (pFile) {
this.url = pFile;
this.position = 0;
}
if (pTitle) this.title = pTitle.stripTags();
this._showPlayer();
var control = this._getControl();
if (pFile) {
control.SetVariable("method:setUrl", this.url);
}
control.SetVariable("method:play", "");
control.SetVariable("enabled", "true");
Element.hide(this.playButton);
Element.show(this.pauseButton);
Element.removeClassName(this.eq, 'playermp3-eq-stop');
Element.addClassName(this.eq, 'playermp3-eq');
};
AudioPlayer.pause = function()
{
var control = this._getControl();
control.SetVariable("method:pause", "");
Element.hide(this.pauseButton);
Element.show(this.playButton);
Element.removeClassName(this.eq, 'playermp3-eq');
Element.addClassName(this.eq, 'playermp3-eq-stop');
};
AudioPlayer.stop = function()
{
var control = this._getControl();
this.position = 0;
control.SetVariable("method:setPosition", this.position);
control.SetVariable("method:stop", "");
Element.hide(this.pauseButton);
Element.show(this.playButton);
Element.removeClassName(this.eq, 'playermp3-eq');
Element.addClassName(this.eq, 'playermp3-eq-stop');
};
AudioPlayer.timelineClick = function(pEvent)
{
var control = this._getControl();
var timelineWidth = Element.getStyle(this.timeline, "width");
timelineWidth = parseInt(timelineWidth.substr(0, timelineWidth.length - 2));
var startX = findPosX(this.timeline);
var x = Event.pointerX(pEvent);
this.position = Math.round((x - startX) / timelineWidth * this.duration);
control.SetVariable("method:setPosition", this.position);
this.onUpdate();
Event.stop(pEvent);
};
AudioPlayer.timelineOver = function(pEvent)
{
App.toolTip(this.timeline, this.title, 300);
};
AudioPlayer.timeClick = function(pEvent)
{
var elapsedDisplay = Element.getStyle(this.elapsedTime, "display");
var remainingDisplay = Element.getStyle(this.remainingTime, "display");
var percentDisplay = Element.getStyle(this.percentLoaded, "display");
if (elapsedDisplay == "block") {
this.elapsedTime.style.display = "none";
this.remainingTime.style.display = "block";
this.percentLoaded.style.display = "none";
} else if (remainingDisplay == "block") {
if (this.bytesPercent == "100") {
this.elapsedTime.style.display = "block";
this.remainingTime.style.display = "none";
this.percentLoaded.style.display = "none";
} else {
this.elapsedTime.style.display = "none";
this.remainingTime.style.display = "none";
this.percentLoaded.style.display = "block";
}
} else {
this.elapsedTime.style.display = "block";
this.remainingTime.style.display = "none";
this.percentLoaded.style.display = "none";
}
};
AudioPlayer.volumeDown = function(pEvent)
{
this.volumePressed = true;
this.volumeMove(pEvent);
Event.stop(pEvent);
};
AudioPlayer.volumeMove = function(pEvent)
{
if (this.volumePressed) {
var control = this._getControl();
var volumeButtonWidth = Element.getStyle(this.volumeButton, "width");
var volumeButtonHeight = Element.getStyle(this.volumeButton, "height");
volumeButtonWidth = parseInt(volumeButtonWidth.substr(0, volumeButtonWidth.length - 2));
var startX = findPosX(this.volumeButton);
var startY = findPosY(this.volumeButton);
var x = Event.pointerX(pEvent);
var y = Event.pointerY(pEvent);
if (x < startX) {
this.volume = 0;
} else if (x > startX + volumeButtonWidth) {
this.volume = 200;
} else {
this.volume = Math.round((x - startX) / volumeButtonWidth * 200);
}
control.SetVariable("method:setVolume", this.volume);
}
};
AudioPlayer.volumeUp = function(pEvent)
{
this.volumePressed = false;
};
AudioPlayer.close = function ()
{
this.stop();
var control = this._getControl();
control.SetVariable("enabled", "false");
this._hidePlayer();
};
if (typeof UWA == "undefined") var UWA = {};
if (typeof UWA.Services == "undefined") UWA.Services = {};
if (typeof UWA.Services.Mail == "undefined") UWA.Services.Mail = {};
if (typeof UWA.mailproxies == "undefined") {
UWA.mailproxies = {
'pop' : NV_PATH + 'proxy/securePopProxy.php',
'gmail' : NV_PATH + 'proxy/securePassProxy.php',
'hotmail' : NV_PATH + 'modules/hotmail/hotmail.php'
}
}
UWA.Services.Mail.getFromProvider = function(provider, request) {
switch (provider) {
case "pop":
case "gmail":
case "hotmail":
return UWA.Data.request(UWA.mailproxies[provider], {
method: 'POST',
type: 'json',
parameters: request.parameters,
onComplete: request.onComplete
} );
default:
UWA.log('invalid request type');
break;
}
}
if (typeof UWA == "undefined") var UWA = {};
if (typeof UWA.Services == "undefined") UWA.Services = {};
if (typeof UWA.Services.Search == "undefined") UWA.Services.Search = {};
UWA.Services.Search.getFromProvider = function(provider, request) {
var options = "";
if (typeof request.lang != 'undefined') {
options += "&lang=" + request.lang;
}
if (typeof request.locale != 'undefined') {
options += "&locale=" + request.locale;
}
if (typeof request.mode != 'undefined') {
options += "&mode=" + request.mode;
}
switch (request.type) {
case "websearch":
var url = 'http://' + NV_HOST + '/data/websearch/' + '?q=' + encodeURIComponent(request.query) + '&engine=' + encodeURIComponent(provider) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
case "blogsearch":
var url = 'http://' + NV_HOST + '/data/blogsearch/' + '?q=' + encodeURIComponent(request.query) + '&engine=' + encodeURIComponent(provider) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
case "imagesearch":
var url = 'http://' + NV_HOST + '/data/imagesearch/' + '?q=' + encodeURIComponent(request.query) + '&engine=' + encodeURIComponent(provider) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
case "videosearch":
var url = 'http://' + NV_HOST + '/data/videosearch/' + '?q=' + encodeURIComponent(request.query) + '&engine=' + encodeURIComponent(provider) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
case "podcastsearch":
var url = 'http://' + NV_HOST + '/data/podcastsearch/' + '?q=' + encodeURIComponent(request.query) + '&engine=' + encodeURIComponent(provider) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
case "shoppingsearch":
var url = 'http://' + NV_HOST + '/data/shoppingsearch/' + '?q=' + encodeURIComponent(request.query) + '&engine=' + encodeURIComponent(provider) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
case "opensearch":
var url = 'http://' + NV_HOST + '/data/opensearch/' + '?q=' + encodeURIComponent(request.query) + '&url=' + encodeURIComponent(request.url) + options;
return UWA.Data.request(url, { method : 'GET', type: 'json', onComplete: request.onComplete, context : request.context } );
default:
UWA.log('invalid request type');
break;
}
}
UWA.Data.getFromProvider = UWA.Services.Search.getFromProvider
if (typeof UWA == "undefined") UWA = {};
if (typeof UWA.Services == "undefined") UWA.Services = {};
UWA.Services.FeedHistory = {};
UWA.Services.FeedHistory.build = function(historyData, feedObj) {
if (feedObj.history) {
if (feedObj.history.lastPostId) {
UWA.Services.FeedHistory.upgrade(feedObj);
}
} else {
feedObj.history = {};
if (historyData && historyData != "") {
var arr = historyData.split(":");
if (arr[arr.length-1] == 1 || arr[arr.length-1] == 0) {
feedObj.history.lastPostId = arr[0];
arr.splice(0,1);
feedObj.history.postStatus = arr;
UWA.Services.FeedHistory.upgrade(feedObj);
} else {
var ln = feedObj.items.length;
for (var z = 0, ln = arr.length; z < ln; z++) {
feedObj.history[arr[z]] = true;
}
}
}
}
UWA.Services.FeedHistory.cleanup(feedObj);
};
UWA.Services.FeedHistory.cleanup = function(feedObj) {
var newHistory = {};
var ln = feedObj.items.length;
for (var z = 0; z < ln; z++) {
if (feedObj.history[feedObj.items[z].id]) {
newHistory[feedObj.items[z].id] = feedObj.history[feedObj.items[z].id];
continue;
}
if (feedObj.history[feedObj.items[z].id_old]) {
newHistory[feedObj.items[z].id] = feedObj.history[feedObj.items[z].id_old];
continue;
}
}
feedObj.history = newHistory;
};
UWA.Services.FeedHistory.upgrade = function(feedObj) {
if (!feedObj.history.lastPostId) return false;
if (feedObj.history.lastPostId == feedObj.items[0].id || feedObj.history.lastPostId == feedObj.items[0].id_old) {
var oldHistory = feedObj.history.postStatus.slice(); // copy
} else {
var newArr = [];
var ln = feedObj.items.length;
var lastPos;
for (var z = 0; z < ln; z++) {
if (feedObj.history.lastPostId == feedObj.items[z].id || feedObj.history.lastPostId == feedObj.items[z].id_old) {
lastPos = z;
break;
}
}
for (var z = 0; z < ln; z++) {
if (z < lastPos || !lastPos) {
newArr[z] = 0;
} else {
newArr[z] = feedObj.history.postStatus[z - lastPos];
}
}
var oldHistory = newArr;
}
feedObj.history = {};
var ln = feedObj.items.length;
for (var z = 0; z < ln; z++) {
if (oldHistory[z] == 1) {
feedObj.history[feedObj.items[z].id] = true;
}
}
};
UWA.Services.FeedHistory.getString = function(feedObj) {
if (!feedObj.history) return "";
var history = "";
var t = "";
for (var i in feedObj.history) {
if (!feedObj.history[i]) continue;
history += t + i;
t = ":";
}
return history;
};
UWA.Services.FeedHistory.getNbNew = function(feedObj, limit) {
if (!feedObj || !feedObj.history) return 0;
var ln = feedObj.items.length;
var n = 0;
limit = ln < limit ? ln : limit;
for (var z = 0; z < limit ; z++) {
if (!feedObj.history[feedObj.items[z].id]) {
n += 1;
}
}
return n;
};
UWA.Services.FeedHistory.setRead = function(feedObj, index) {
if (typeof feedObj.history == "undefined") return ;
feedObj.history[feedObj.items[index].id] = true;
};
UWA.Services.FeedHistory.setUnRead = function(feedObj, index) {
if (typeof feedObj.history == "undefined") return ;
delete feedObj.history[feedObj.items[index].id];
};
UWA.Services.FeedHistory.isRead = function(feedObj, index) {
if (feedObj.history[feedObj.items[index].id]) return true;
return false;
};
if (typeof App == "undefined") App = {};
if (typeof App.Rss == "undefined") App.Rss = {};
App.Rss.buildHistory = UWA.Services.FeedHistory.build;
App.Rss.getHistoryString = UWA.Services.FeedHistory.getString;
App.Rss.getHistoryNbNew = UWA.Services.FeedHistory.getNbNew;
UWA.Templates.multifeeds = function(obj) {
this.widget = (obj ? obj : widget);
this.tabSet = null;
this.miniTabs = null;
this.currentId = 0;
this.firstLaunch = true;
this.selectedTab = 0;
};
UWA.Templates.multifeeds.prototype = {
createFromXML: function(xml) {
var obj = {};
obj.header = this.getHeader(xml);
obj.tabSet = this.getTabset(xml);
obj.provider = UWA.XMLTemplate.getElement("feeds", xml).getAttribute('provider');
obj.container = this.widget.createElement("div").injectBefore(xml);
xml.remove();
return this.createFromJSON(obj);
},
createFromJSON: function(obj) {
this.tabSet = obj.tabSet;
this.header = obj.header;
this.widget.setValue("provider", obj.provider);
this.container = (typeof obj.container == "string" ? this.widget.body.getElement(obj.container) : obj.container);
this.init();
},
getTabset: function(xml) {
var tabSet = { 'tabList': [], 'tabContent': {}, 'container': null };
var feeds = UWA.XMLTemplate.getElements("feed", xml);
feeds.forEach( function(feed, i) {
tabSet.tabList.push( { 'for': i, 'text': feed.getAttribute('text') } );
tabSet.tabContent[i] = { 'src': feed.getAttribute('url') };
});
return tabSet;
},
getHeader: function(xml) {
var header = { 'background': null, 'img': [{ 'src': null }], 'container': null };
var headerXML = UWA.XMLTempl
