

/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/
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"});
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(q){try{var S=YAHOO.util.Event.getTarget(q);if(S.type.toLowerCase()=="submit"){YAHOO.util.Connect._submitElementValue=encodeURIComponent(S.name)+"="+encodeURIComponent(S.value);}}catch(q){}});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(S){this._msxml_progid.unshift(S);},setDefaultPostHeader:function(S){if(typeof S=="string"){this._default_post_header=S;}else{if(typeof S=="boolean"){this._use_default_post_header=S;}}},setDefaultXhrHeader:function(S){if(typeof S=="string"){this._default_xhr_header=S;}else{this._use_default_xhr_header=S;}},setPollingInterval:function(S){if(typeof S=="number"&&isFinite(S)){this._polling_interval=S;}},createXhrObject:function(w){var m,S;try{S=new XMLHttpRequest();m={conn:S,tId:w};}catch(R){for(var q=0;q<this._msxml_progid.length;++q){try{S=new ActiveXObject(this._msxml_progid[q]);m={conn:S,tId:w};break;}catch(R){}}}finally{return m;}},getConnectionObject:function(S){var R;var m=this._transaction_id;try{if(!S){R=this.createXhrObject(m);}else{R={};R.tId=m;R.isUpload=true;}if(R){this._transaction_id++;}}catch(q){}finally{return R;}},asyncRequest:function(w,q,m,S){var R=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();if(!R){return null;}else{if(m&&m.customevents){this.initCustomEvents(R,m);}if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(R,m,q,S);return R;}if(w.toUpperCase()=="GET"){if(this._sFormData.length!==0){q+=((q.indexOf("?")==-1)?"?":"&")+this._sFormData;}else{q+="?"+this._sFormData;}}else{if(w.toUpperCase()=="POST"){S=S?this._sFormData+"&"+S:this._sFormData;}}}R.conn.open(w,q,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(this._isFormSubmit==false&&this._use_default_post_header){this.initHeader("Content-Type",this._default_post_header);}if(this._has_default_headers||this._has_http_headers){this.setHeader(R);}this.handleReadyState(R,m);R.conn.send(S||null);this.startEvent.fire(R);if(R.startEvent){R.startEvent.fire(R);}return R;}},initCustomEvents:function(S,R){for(var q in R.customevents){if(this._customEvents[q][0]){S[this._customEvents[q][0]]=new YAHOO.util.CustomEvent(this._customEvents[q][1],(R.scope)?R.scope:null);S[this._customEvents[q][0]].subscribe(R.customevents[q]);}}},handleReadyState:function(q,R){var S=this;if(R&&R.timeout){this._timeOut[q.tId]=window.setTimeout(function(){S.abort(q,R,true);},R.timeout);}this._poll[q.tId]=window.setInterval(function(){if(q.conn&&q.conn.readyState===4){window.clearInterval(S._poll[q.tId]);delete S._poll[q.tId];if(R&&R.timeout){window.clearTimeout(S._timeOut[q.tId]);delete S._timeOut[q.tId];}S.completeEvent.fire(q);if(q.completeEvent){q.completeEvent.fire(q);}S.handleTransactionResponse(q,R);}},this._polling_interval);},handleTransactionResponse:function(w,V,S){var R,q;try{if(w.conn.status!==undefined&&w.conn.status!==0){R=w.conn.status;}else{R=13030;}}catch(m){R=13030;}if(R>=200&&R<300||R===1223){q=this.createResponseObject(w,(V&&V.argument)?V.argument:undefined);if(V){if(V.success){if(!V.scope){V.success(q);}else{V.success.apply(V.scope,[q]);}}}this.successEvent.fire(q);if(w.successEvent){w.successEvent.fire(q);}}else{switch(R){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:q=this.createExceptionObject(w.tId,(V&&V.argument)?V.argument:undefined,(S?S:false));if(V){if(V.failure){if(!V.scope){V.failure(q);}else{V.failure.apply(V.scope,[q]);}}}break;default:q=this.createResponseObject(w,(V&&V.argument)?V.argument:undefined);if(V){if(V.failure){if(!V.scope){V.failure(q);}else{V.failure.apply(V.scope,[q]);}}}}this.failureEvent.fire(q);if(w.failureEvent){w.failureEvent.fire(q);}}this.releaseObject(w);q=null;},createResponseObject:function(S,d){var m={};var T={};try{var R=S.conn.getAllResponseHeaders();var V=R.split("\n");for(var w=0;w<V.length;w++){var q=V[w].indexOf(":");if(q!=-1){T[V[w].substring(0,q)]=V[w].substring(q+2);}}}catch(N){}m.tId=S.tId;m.status=(S.conn.status==1223)?204:S.conn.status;m.statusText=(S.conn.status==1223)?"No Content":S.conn.statusText;m.getResponseHeader=T;m.getAllResponseHeaders=R;m.responseText=S.conn.responseText;m.responseXML=S.conn.responseXML;if(typeof d!==undefined){m.argument=d;}return m;},createExceptionObject:function(N,m,S){var V=0;var d="communication failure";var R=-1;var q="transaction aborted";var w={};w.tId=N;if(S){w.status=R;w.statusText=q;}else{w.status=V;w.statusText=d;}if(m){w.argument=m;}return w;},initHeader:function(S,m,R){var q=(R)?this._default_headers:this._http_headers;q[S]=m;if(R){this._has_default_headers=true;}else{this._has_http_headers=true;}},setHeader:function(S){if(this._has_default_headers){for(var q in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,q)){S.conn.setRequestHeader(q,this._default_headers[q]);}}}if(this._has_http_headers){for(var q in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,q)){S.conn.setRequestHeader(q,this._http_headers[q]);}}delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(M,w,q){this.resetFormState();var f;if(typeof M=="string"){f=(document.getElementById(M)||document.forms[M]);}else{if(typeof M=="object"){f=M;}else{return ;}}if(w){var V=this.createFrame(q?q:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=f;return ;}var S,T,d,p;var N=false;for(var m=0;m<f.elements.length;m++){S=f.elements[m];p=f.elements[m].disabled;T=f.elements[m].name;d=f.elements[m].value;if(!p&&T){switch(S.type){case "select-one":case "select-multiple":for(var R=0;R<S.options.length;R++){if(S.options[R].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(S.options[R].attributes["value"].specified?S.options[R].value:S.options[R].text)+"&";}else{this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(S.options[R].hasAttribute("value")?S.options[R].value:S.options[R].text)+"&";}}}break;case "radio":case "checkbox":if(S.checked){this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(d)+"&";}break;case "file":case undefined:case "reset":case "button":break;case "submit":if(N===false){if(this._hasSubmitListener&&this._submitElementValue){this._sFormData+=this._submitElementValue+"&";}else{this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(d)+"&";}N=true;}break;default:this._sFormData+=encodeURIComponent(T)+"="+encodeURIComponent(d)+"&";}}}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(S){var q="yuiIO"+this._transaction_id;var R;if(window.ActiveXObject){R=document.createElement("<iframe id=\""+q+"\" name=\""+q+"\" />");if(typeof S=="boolean"){R.src="javascript:false";}else{if(typeof secureURI=="string"){R.src=S;}}}else{R=document.createElement("iframe");R.id=q;R.name=q;}R.style.position="absolute";R.style.top="-1000px";R.style.left="-1000px";document.body.appendChild(R);},appendPostData:function(S){var m=[];var q=S.split("&");for(var R=0;R<q.length;R++){var w=q[R].indexOf("=");if(w!=-1){m[R]=document.createElement("input");m[R].type="hidden";m[R].name=q[R].substring(0,w);m[R].value=q[R].substring(w+1);this._formNode.appendChild(m[R]);}}return m;},uploadFile:function(m,p,w,R){var N="yuiIO"+m.tId;var T="multipart/form-data";var f=document.getElementById(N);var U=this;var q={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};this._formNode.setAttribute("action",w);this._formNode.setAttribute("method","POST");this._formNode.setAttribute("target",N);if(this._formNode.encoding){this._formNode.setAttribute("encoding",T);}else{this._formNode.setAttribute("enctype",T);}if(R){var M=this.appendPostData(R);}this._formNode.submit();this.startEvent.fire(m);if(m.startEvent){m.startEvent.fire(m);}if(p&&p.timeout){this._timeOut[m.tId]=window.setTimeout(function(){U.abort(m,p,true);},p.timeout);}if(M&&M.length>0){for(var d=0;d<M.length;d++){this._formNode.removeChild(M[d]);}}for(var S in q){if(YAHOO.lang.hasOwnProperty(q,S)){if(q[S]){this._formNode.setAttribute(S,q[S]);}else{this._formNode.removeAttribute(S);}}}this.resetFormState();var V=function(){if(p&&p.timeout){window.clearTimeout(U._timeOut[m.tId]);delete U._timeOut[m.tId];}U.completeEvent.fire(m);if(m.completeEvent){m.completeEvent.fire(m);}var v={};v.tId=m.tId;v.argument=p.argument;try{v.responseText=f.contentWindow.document.body?f.contentWindow.document.body.innerHTML:f.contentWindow.document.documentElement.textContent;v.responseXML=f.contentWindow.document.XMLDocument?f.contentWindow.document.XMLDocument:f.contentWindow.document;}catch(u){}if(p&&p.upload){if(!p.scope){p.upload(v);}else{p.upload.apply(p.scope,[v]);}}U.uploadEvent.fire(v);if(m.uploadEvent){m.uploadEvent.fire(v);}YAHOO.util.Event.removeListener(f,"load",V);setTimeout(function(){document.body.removeChild(f);U.releaseObject(m);},100);};YAHOO.util.Event.addListener(f,"load",V);},abort:function(m,V,S){var R;if(m.conn){if(this.isCallInProgress(m)){m.conn.abort();window.clearInterval(this._poll[m.tId]);delete this._poll[m.tId];if(S){window.clearTimeout(this._timeOut[m.tId]);delete this._timeOut[m.tId];}R=true;}}else{if(m.isUpload===true){var q="yuiIO"+m.tId;var w=document.getElementById(q);if(w){YAHOO.util.Event.removeListener(w,"load",uploadCallback);document.body.removeChild(w);if(S){window.clearTimeout(this._timeOut[m.tId]);delete this._timeOut[m.tId];}R=true;}}else{R=false;}}if(R===true){this.abortEvent.fire(m);if(m.abortEvent){m.abortEvent.fire(m);}this.handleTransactionResponse(m,V,true);}return R;},isCallInProgress:function(q){if(q&&q.conn){return q.conn.readyState!==4&&q.conn.readyState!==0;}else{if(q&&q.isUpload===true){var S="yuiIO"+q.tId;return document.getElementById(S)?true:false;}else{return false;}}},releaseObject:function(S){if(S.conn){S.conn=null;}S=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.3.1",build:"541"});
YAHOO.util.Anim=function(B,A,C,D){if(!B){}this.init(B,A,C,D);};YAHOO.util.Anim.prototype={toString:function(){var A=this.getEl();var B=A.id||A.tagName||A;return("Anim "+B);},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(A,C,B){return this.method(this.currentFrame,C,B-C,this.totalFrames);},setAttribute:function(A,C,B){if(this.patterns.noNegatives.test(A)){C=(C>0)?C:0;}YAHOO.util.Dom.setStyle(this.getEl(),A,C+B);},getAttribute:function(A){var C=this.getEl();var E=YAHOO.util.Dom.getStyle(C,A);if(E!=="auto"&&!this.patterns.offsetUnit.test(E)){return parseFloat(E);}var B=this.patterns.offsetAttribute.exec(A)||[];var F=!!(B[3]);var D=!!(B[2]);if(D||(YAHOO.util.Dom.getStyle(C,"position")=="absolute"&&F)){E=C["offset"+B[0].charAt(0).toUpperCase()+B[0].substr(1)];}else{E=0;}return E;},getDefaultUnit:function(A){if(this.patterns.defaultUnit.test(A)){return"px";}return"";},setRuntimeAttribute:function(B){var G;var C;var D=this.attributes;this.runtimeAttributes[B]={};var F=function(H){return(typeof H!=="undefined");};if(!F(D[B]["to"])&&!F(D[B]["by"])){return false;}G=(F(D[B]["from"]))?D[B]["from"]:this.getAttribute(B);if(F(D[B]["to"])){C=D[B]["to"];}else{if(F(D[B]["by"])){if(G.constructor==Array){C=[];for(var E=0,A=G.length;E<A;++E){C[E]=G[E]+D[B]["by"][E]*1;}}else{C=G+D[B]["by"]*1;}}}this.runtimeAttributes[B].start=G;this.runtimeAttributes[B].end=C;this.runtimeAttributes[B].unit=(F(D[B].unit))?D[B]["unit"]:this.getDefaultUnit(B);return true;},init:function(C,H,G,A){var B=false;var D=null;var F=0;C=YAHOO.util.Dom.get(C);this.attributes=H||{};this.duration=!YAHOO.lang.isUndefined(G)?G:1;this.method=A||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.setEl=function(K){C=YAHOO.util.Dom.get(K);};this.getEl=function(){return C;};this.isAnimated=function(){return B;};this.getStartTime=function(){return D;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}YAHOO.util.AnimMgr.registerElement(this);return true;};this.stop=function(K){if(K){this.currentFrame=this.totalFrames;this._onTween.fire();}YAHOO.util.AnimMgr.stop(this);};var J=function(){this.onStart.fire();this.runtimeAttributes={};for(var K in this.attributes){this.setRuntimeAttribute(K);}B=true;F=0;D=new Date();};var I=function(){var M={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};M.toString=function(){return("duration: "+M.duration+", currentFrame: "+M.currentFrame);};this.onTween.fire(M);var L=this.runtimeAttributes;for(var K in L){this.setAttribute(K,this.doMethod(K,L[K].start,L[K].end),L[K].unit);}F+=1;};var E=function(){var K=(new Date()-D)/1000;var L={duration:K,frames:F,fps:F/K};L.toString=function(){return("duration: "+L.duration+", frames: "+L.frames+", fps: "+L.fps);};B=false;F=0;this.onComplete.fire(L);};this._onStart=new YAHOO.util.CustomEvent("_start",this,true);this.onStart=new YAHOO.util.CustomEvent("start",this);this.onTween=new YAHOO.util.CustomEvent("tween",this);this._onTween=new YAHOO.util.CustomEvent("_tween",this,true);this.onComplete=new YAHOO.util.CustomEvent("complete",this);this._onComplete=new YAHOO.util.CustomEvent("_complete",this,true);this._onStart.subscribe(J);this._onTween.subscribe(I);this._onComplete.subscribe(E);}};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){G._onComplete.fire();F=F||E(G);if(F==-1){return false;}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){if(B[0].isAnimated()){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(){YAHOO.util.ColorAnim=function(E,D,F,G){YAHOO.util.ColorAnim.superclass.constructor.call(this,E,D,F,G);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var B=YAHOO.util;var C=B.ColorAnim.superclass;var A=B.ColorAnim.prototype;A.toString=function(){var D=this.getEl();var E=D.id||D.tagName;return("ColorAnim "+E);};A.patterns.color=/color$/i;A.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;A.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;A.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;A.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;A.parseColor=function(D){if(D.length==3){return D;}var E=this.patterns.hex.exec(D);if(E&&E.length==4){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)];}E=this.patterns.rgb.exec(D);if(E&&E.length==4){return[parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10)];
}E=this.patterns.hex3.exec(D);if(E&&E.length==4){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)];}return null;};A.getAttribute=function(D){var F=this.getEl();if(this.patterns.color.test(D)){var G=YAHOO.util.Dom.getStyle(F,D);if(this.patterns.transparent.test(G)){var E=F.parentNode;G=B.Dom.getStyle(E,D);while(E&&this.patterns.transparent.test(G)){E=E.parentNode;G=B.Dom.getStyle(E,D);if(E.tagName.toUpperCase()=="HTML"){G="#fff";}}}}else{G=C.getAttribute.call(this,D);}return G;};A.doMethod=function(E,I,F){var H;if(this.patterns.color.test(E)){H=[];for(var G=0,D=I.length;G<D;++G){H[G]=C.doMethod.call(this,E,I[G],F[G]);}H="rgb("+Math.floor(H[0])+","+Math.floor(H[1])+","+Math.floor(H[2])+")";}else{H=C.doMethod.call(this,E,I,F);}return H;};A.setRuntimeAttribute=function(E){C.setRuntimeAttribute.call(this,E);if(this.patterns.color.test(E)){var G=this.attributes;var I=this.parseColor(this.runtimeAttributes[E].start);var F=this.parseColor(this.runtimeAttributes[E].end);if(typeof G[E]["to"]==="undefined"&&typeof G[E]["by"]!=="undefined"){F=this.parseColor(G[E].by);for(var H=0,D=I.length;H<D;++H){F[H]=I[H]+F[H];}}this.runtimeAttributes[E].start=I;this.runtimeAttributes[E].end=F;}};})();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(){YAHOO.util.Motion=function(G,F,H,I){if(G){YAHOO.util.Motion.superclass.constructor.call(this,G,F,H,I);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var D=YAHOO.util;var E=D.Motion.superclass;var B=D.Motion.prototype;B.toString=function(){var F=this.getEl();var G=F.id||F.tagName;return("Motion "+G);};B.patterns.points=/^points$/i;B.setAttribute=function(F,H,G){if(this.patterns.points.test(F)){G=G||"px";E.setAttribute.call(this,"left",H[0],G);E.setAttribute.call(this,"top",H[1],G);}else{E.setAttribute.call(this,F,H,G);}};B.getAttribute=function(F){if(this.patterns.points.test(F)){var G=[E.getAttribute.call(this,"left"),E.getAttribute.call(this,"top")];}else{G=E.getAttribute.call(this,F);}return G;};B.doMethod=function(F,J,G){var I=null;if(this.patterns.points.test(F)){var H=this.method(this.currentFrame,0,100,this.totalFrames)/100;I=D.Bezier.getPosition(this.runtimeAttributes[F],H);}else{I=E.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(O){if(this.patterns.points.test(O)){var G=this.getEl();var I=this.attributes;var F;var K=I["points"]["control"]||[];var H;var L,N;if(K.length>0&&!(K[0] instanceof Array)){K=[K];}else{var J=[];for(L=0,N=K.length;L<N;++L){J[L]=K[L];}K=J;}if(D.Dom.getStyle(G,"position")=="static"){D.Dom.setStyle(G,"position","relative");}if(C(I["points"]["from"])){D.Dom.setXY(G,I["points"]["from"]);}else{D.Dom.setXY(G,D.Dom.getXY(G));}F=this.getAttribute("points");if(C(I["points"]["to"])){H=A.call(this,I["points"]["to"],F);var M=D.Dom.getXY(this.getEl());for(L=0,N=K.length;L<N;++L){K[L]=A.call(this,K[L],F);}}else{if(C(I["points"]["by"])){H=[F[0]+I["points"]["by"][0],F[1]+I["points"]["by"][1]];for(L=0,N=K.length;L<N;++L){K[L]=[F[0]+K[L][0],F[1]+K[L][1]];}}}this.runtimeAttributes[O]=[F];if(K.length>0){this.runtimeAttributes[O]=this.runtimeAttributes[O].concat(K);}this.runtimeAttributes[O][this.runtimeAttributes[O].length]=H;}else{E.setRuntimeAttribute.call(this,O);}};var A=function(F,H){var G=D.Dom.getXY(this.getEl());F=[F[0]-G[0]+H[0],F[1]-G[1]+H[1]];return F;};var C=function(F){return(typeof F!=="undefined");};})();(function(){YAHOO.util.Scroll=function(E,D,F,G){if(E){YAHOO.util.Scroll.superclass.constructor.call(this,E,D,F,G);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var B=YAHOO.util;var C=B.Scroll.superclass;var A=B.Scroll.prototype;A.toString=function(){var D=this.getEl();var E=D.id||D.tagName;return("Scroll "+E);};A.doMethod=function(D,G,E){var F=null;if(D=="scroll"){F=[this.method(this.currentFrame,G[0],E[0]-G[0],this.totalFrames),this.method(this.currentFrame,G[1],E[1]-G[1],this.totalFrames)];
}else{F=C.doMethod.call(this,D,G,E);}return F;};A.getAttribute=function(D){var F=null;var E=this.getEl();if(D=="scroll"){F=[E.scrollLeft,E.scrollTop];}else{F=C.getAttribute.call(this,D);}return F;};A.setAttribute=function(D,G,F){var E=this.getEl();if(D=="scroll"){E.scrollLeft=G[0];E.scrollTop=G[1];}else{C.setAttribute.call(this,D,G,F);}};})();YAHOO.register("animation",YAHOO.util.Anim,{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)){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);}());(function(){YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}else{}};var Dom=YAHOO.util.Dom,Config=YAHOO.util.Config,Event=YAHOO.util.Event,CustomEvent=YAHOO.util.CustomEvent,Module=YAHOO.widget.Module,m_oModuleTemplate,m_oHeaderTemplate,m_oBodyTemplate,m_oFooterTemplate,EVENT_TYPES={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},DEFAULT_CONFIG={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};Module.IMG_ROOT=null;Module.IMG_ROOT_SSL=null;Module.CSS_MODULE="yui-module";Module.CSS_HEADER="hd";Module.CSS_BODY="bd";Module.CSS_FOOTER="ft";Module.RESIZE_MONITOR_SECURE_URL="javascript:false;";Module.textResizeEvent=new CustomEvent("textResize");function createModuleTemplate(){if(!m_oModuleTemplate){m_oModuleTemplate=document.createElement("div");m_oModuleTemplate.innerHTML=("<div class=\""+Module.CSS_HEADER+"\"></div>"+"<div class=\""+Module.CSS_BODY+"\"></div><div class=\""+Module.CSS_FOOTER+"\"></div>");m_oHeaderTemplate=m_oModuleTemplate.firstChild;m_oBodyTemplate=m_oHeaderTemplate.nextSibling;m_oFooterTemplate=m_oBodyTemplate.nextSibling;}return m_oModuleTemplate;}function createHeader(){if(!m_oHeaderTemplate){createModuleTemplate();}return(m_oHeaderTemplate.cloneNode(false));}function createBody(){if(!m_oBodyTemplate){createModuleTemplate();}return(m_oBodyTemplate.cloneNode(false));}function createFooter(){if(!m_oFooterTemplate){createModuleTemplate();}return(m_oFooterTemplate.cloneNode(false));}Module.prototype={constructor:Module,element:null,header:null,body:null,footer:null,id:null,imageRoot:Module.IMG_ROOT,initEvents:function(){var SIGNATURE=CustomEvent.LIST;this.beforeInitEvent=this.createEvent(EVENT_TYPES.BEFORE_INIT);this.beforeInitEvent.signature=SIGNATURE;this.initEvent=this.createEvent(EVENT_TYPES.INIT);this.initEvent.signature=SIGNATURE;this.appendEvent=this.createEvent(EVENT_TYPES.APPEND);this.appendEvent.signature=SIGNATURE;this.beforeRenderEvent=this.createEvent(EVENT_TYPES.BEFORE_RENDER);this.beforeRenderEvent.signature=SIGNATURE;this.renderEvent=this.createEvent(EVENT_TYPES.RENDER);this.renderEvent.signature=SIGNATURE;this.changeHeaderEvent=this.createEvent(EVENT_TYPES.CHANGE_HEADER);this.changeHeaderEvent.signature=SIGNATURE;this.changeBodyEvent=this.createEvent(EVENT_TYPES.CHANGE_BODY);this.changeBodyEvent.signature=SIGNATURE;this.changeFooterEvent=this.createEvent(EVENT_TYPES.CHANGE_FOOTER);this.changeFooterEvent.signature=SIGNATURE;this.changeContentEvent=this.createEvent(EVENT_TYPES.CHANGE_CONTENT);this.changeContentEvent.signature=SIGNATURE;this.destroyEvent=this.createEvent(EVENT_TYPES.DESTORY);this.destroyEvent.signature=SIGNATURE;this.beforeShowEvent=this.createEvent(EVENT_TYPES.BEFORE_SHOW);this.beforeShowEvent.signature=SIGNATURE;this.showEvent=this.createEvent(EVENT_TYPES.SHOW);this.showEvent.signature=SIGNATURE;this.beforeHideEvent=this.createEvent(EVENT_TYPES.BEFORE_HIDE);this.beforeHideEvent.signature=SIGNATURE;this.hideEvent=this.createEvent(EVENT_TYPES.HIDE);this.hideEvent.signature=SIGNATURE;},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key,{handler:this.configVisible,value:DEFAULT_CONFIG.VISIBLE.value,validator:DEFAULT_CONFIG.VISIBLE.validator});this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key,{suppressEvent:DEFAULT_CONFIG.EFFECT.suppressEvent,supercedes:DEFAULT_CONFIG.EFFECT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:DEFAULT_CONFIG.MONITOR_RESIZE.value});this.cfg.addProperty(DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.key,{value:DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.value});},init:function(el,userConfig){var elId,i,child;this.initEvents();this.beforeInitEvent.fire(Module);this.cfg=new Config(this);if(this.isSecure){this.imageRoot=Module.IMG_ROOT_SSL;}if(typeof el=="string"){elId=el;el=document.getElementById(el);if(!el){el=(createModuleTemplate()).cloneNode(false);el.id=elId;}}this.element=el;if(el.id){this.id=el.id;}child=this.element.firstChild;if(child){var fndHd=false,fndBd=false,fndFt=false;do{if(1==child.nodeType){if(!fndHd&&Dom.hasClass(child,Module.CSS_HEADER)){this.header=child;fndHd=true;}else if(!fndBd&&Dom.hasClass(child,Module.CSS_BODY)){this.body=child;fndBd=true;}else if(!fndFt&&Dom.hasClass(child,Module.CSS_FOOTER)){this.footer=child;fndFt=true;}}}while((child=child.nextSibling));}this.initDefaultConfig();Dom.addClass(this.element,Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}if(!Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(Module);},initResizeMonitor:function(){var oDoc,oIFrame,sHTML;function fireTextResize(){Module.textResizeEvent.fire();}if(!YAHOO.env.ua.opera){oIFrame=Dom.get("_yuiResizeMonitor");if(!oIFrame){oIFrame=document.createElement("iframe");if(this.isSecure&&Module.RESIZE_MONITOR_SECURE_URL&&YAHOO.env.ua.ie){oIFrame.src=Module.RESIZE_MONITOR_SECURE_URL;}if(YAHOO.env.ua.gecko){sHTML="<html><head><script "+"type=\"text/javascript\">"+"window.onresize=function(){window.parent."+"YAHOO.widget.Module.textResizeEvent."+"fire();};window.parent.YAHOO.widget.Module."+"textResizeEvent.fire();</script></head>"+"<body></body></html>";oIFrame.src="data:text/html;charset=utf-8,"+encodeURIComponent(sHTML);}oIFrame.id="_yuiResizeMonitor";oIFrame.style.position="absolute";oIFrame.style.visibility="hidden";var fc=document.body.firstChild;if(fc){document.body.insertBefore(oIFrame,fc);}else{document.body.appendChild(oIFrame);}oIFrame.style.width="10em";oIFrame.style.height="10em";oIFrame.style.top=(-1*oIFrame.offsetHeight)+"px";oIFrame.style.left=(-1*oIFrame.offsetWidth)+"px";oIFrame.style.borderWidth="0";oIFrame.style.visibility="visible";if(YAHOO.env.ua.webkit){oDoc=oIFrame.contentWindow.document;oDoc.open();oDoc.close();}}if(oIFrame&&oIFrame.contentWindow){Module.textResizeEvent.subscribe(this.onDomResize,this,true);if(!Module.textResizeInitialized){if(!Event.on(oIFrame.contentWindow,"resize",fireTextResize)){Event.on(oIFrame,"resize",fireTextResize);}Module.textResizeInitialized=true;}this.resizeMonitor=oIFrame;}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){var oHeader=this.header||(this.header=createHeader());if(typeof headerContent=="string"){oHeader.innerHTML=headerContent;}else{oHeader.innerHTML="";oHeader.appendChild(headerContent);}this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){var oHeader=this.header||(this.header=createHeader());oHeader.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){var oBody=this.body||(this.body=createBody());if(typeof bodyContent=="string"){oBody.innerHTML=bodyContent;}else{oBody.innerHTML="";oBody.appendChild(bodyContent);}this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){var oBody=this.body||(this.body=createBody());oBody.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){var oFooter=this.footer||(this.footer=createFooter());if(typeof footerContent=="string"){oFooter.innerHTML=footerContent;}else{oFooter.innerHTML="";oFooter.appendChild(footerContent);}this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){var oFooter=this.footer||(this.footer=createFooter());oFooter.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){var me=this,firstChild;function appendTo(parentNode){if(typeof parentNode=="string"){parentNode=document.getElementById(parentNode);}if(parentNode){me._addToParent(parentNode,me.element);me.appendEvent.fire();}}this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}if(appendToNode){appendTo(appendToNode);}else{if(!Dom.inDocument(this.element)){return false;}}if(this.header&&!Dom.inDocument(this.header)){firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}if(this.body&&!Dom.inDocument(this.body)){if(this.footer&&Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}if(this.footer&&!Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}this.renderEvent.fire();return true;},destroy:function(){var parent,e;if(this.element){Event.purgeElement(this.element,true);parent=this.element.parentNode;}if(parent){parent.removeChild(this.element);}this.element=null;this.header=null;this.body=null;this.footer=null;Module.textResizeEvent.unsubscribe(this.onDomResize,this);this.cfg.destroy();this.cfg=null;this.destroyEvent.fire();for(e in this){if(e instanceof CustomEvent){e.unsubscribeAll();}}},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{Module.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}},_addToParent:function(parentNode,element){if(!this.cfg.getProperty("appendtodocumentbody")&&parentNode===document.body&&parentNode.firstChild){parentNode.insertBefore(element,parentNode.firstChild);}else{parentNode.appendChild(element);}},toString:function(){return"Module "+this.id;}};YAHOO.lang.augmentProto(Module,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);};var Lang=YAHOO.lang,CustomEvent=YAHOO.util.CustomEvent,Module=YAHOO.widget.Module,Event=YAHOO.util.Event,Dom=YAHOO.util.Dom,Config=YAHOO.util.Config,Overlay=YAHOO.widget.Overlay,m_oIFrameTemplate,EVENT_TYPES={"BEFORE_MOVE":"beforeMove","MOVE":"move"},DEFAULT_CONFIG={"X":{key:"x",validator:Lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:Lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:Lang.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:Lang.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(YAHOO.env.ua.ie==6?true:false),validator:Lang.isBoolean,supercedes:["zindex"]}};Overlay.IFRAME_SRC="javascript:false;";Overlay.IFRAME_OFFSET=3;Overlay.TOP_LEFT="tl";Overlay.TOP_RIGHT="tr";Overlay.BOTTOM_LEFT="bl";Overlay.BOTTOM_RIGHT="br";Overlay.CSS_OVERLAY="yui-overlay";Overlay.windowScrollEvent=new CustomEvent("windowScroll");Overlay.windowResizeEvent=new CustomEvent("windowResize");Overlay.windowScrollHandler=function(e){if(YAHOO.env.ua.ie){if(!window.scrollEnd){window.scrollEnd=-1;}clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){Overlay.windowScrollEvent.fire();},1);}else{Overlay.windowScrollEvent.fire();}};Overlay.windowResizeHandler=function(e){if(YAHOO.env.ua.ie){if(!window.resizeEnd){window.resizeEnd=-1;}clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){Overlay.windowResizeEvent.fire();},100);}else{Overlay.windowResizeEvent.fire();}};Overlay._initialized=null;if(Overlay._initialized===null){Event.on(window,"scroll",Overlay.windowScrollHandler);Event.on(window,"resize",Overlay.windowResizeHandler);Overlay._initialized=true;}YAHOO.extend(Overlay,Module,{init:function(el,userConfig){Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(Overlay);Dom.addClass(this.element,Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}if(this.platform=="mac"&&YAHOO.env.ua.gecko){if(!Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}if(!Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}this.initEvent.fire(Overlay);},initEvents:function(){Overlay.superclass.initEvents.call(this);var SIGNATURE=CustomEvent.LIST;this.beforeMoveEvent=this.createEvent(EVENT_TYPES.BEFORE_MOVE);this.beforeMoveEvent.signature=SIGNATURE;this.moveEvent=this.createEvent(EVENT_TYPES.MOVE);this.moveEvent.signature=SIGNATURE;},initDefaultConfig:function(){Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty(DEFAULT_CONFIG.X.key,{handler:this.configX,validator:DEFAULT_CONFIG.X.validator,suppressEvent:DEFAULT_CONFIG.X.suppressEvent,supercedes:DEFAULT_CONFIG.X.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.Y.key,{handler:this.configY,validator:DEFAULT_CONFIG.Y.validator,suppressEvent:DEFAULT_CONFIG.Y.suppressEvent,supercedes:DEFAULT_CONFIG.Y.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.XY.key,{handler:this.configXY,suppressEvent:DEFAULT_CONFIG.XY.suppressEvent,supercedes:DEFAULT_CONFIG.XY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key,{handler:this.configContext,suppressEvent:DEFAULT_CONFIG.CONTEXT.suppressEvent,supercedes:DEFAULT_CONFIG.CONTEXT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key,{handler:this.configFixedCenter,value:DEFAULT_CONFIG.FIXED_CENTER.value,validator:DEFAULT_CONFIG.FIXED_CENTER.validator,supercedes:DEFAULT_CONFIG.FIXED_CENTER.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{handler:this.configWidth,suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.WIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{handler:this.configHeight,suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{handler:this.configzIndex,value:DEFAULT_CONFIG.ZINDEX.value});this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key,{handler:this.configIframe,value:DEFAULT_CONFIG.IFRAME.value,validator:DEFAULT_CONFIG.IFRAME.validator,supercedes:DEFAULT_CONFIG.IFRAME.supercedes});},moveTo:function(x,y){this.cfg.setProperty("xy",[x,y]);},hideMacGeckoScrollbars:function(){Dom.removeClass(this.element,"show-scrollbars");Dom.addClass(this.element,"hide-scrollbars");},showMacGeckoScrollbars:function(){Dom.removeClass(this.element,"hide-scrollbars");Dom.addClass(this.element,"show-scrollbars");},configVisible:function(type,args,obj){var visible=args[0],currentVis=Dom.getStyle(this.element,"visibility"),effect=this.cfg.getProperty("effect"),effectInstances=[],isMacGecko=(this.platform=="mac"&&YAHOO.env.ua.gecko),alreadySubscribed=Config.alreadySubscribed,eff,ei,e,i,j,k,h,nEffects,nEffectInstances;if(currentVis=="inherit"){e=this.element.parentNode;while(e.nodeType!=9&&e.nodeType!=11){currentVis=Dom.getStyle(e,"visibility");if(currentVis!="inherit"){break;}e=e.parentNode;}if(currentVis=="inherit"){currentVis="visible";}}if(effect){if(effect instanceof Array){nEffects=effect.length;for(i=0;i<nEffects;i++){eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}if(effect){if(visible){if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();nEffectInstances=effectInstances.length;for(j=0;j<nEffectInstances;j++){ei=effectInstances[j];if(j===0&&!alreadySubscribed(ei.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){ei.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}ei.animateIn();}}}}else{if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}if(effect){if(currentVis=="visible"){this.beforeHideEvent.fire();nEffectInstances=effectInstances.length;for(k=0;k<nEffectInstances;k++){h=effectInstances[k];if(k===0&&!alreadySubscribed(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}h.animateOut();}}else if(currentVis===""){Dom.setStyle(this.element,"visibility","hidden");}}else{if(currentVis=="visible"||currentVis===""){this.beforeHideEvent.fire();Dom.setStyle(this.element,"visibility","hidden");this.hideEvent.fire();}}}},doCenterOnDOMEvent:function(){if(this.cfg.getProperty("visible")){this.center();}},configFixedCenter:function(type,args,obj){var val=args[0],alreadySubscribed=Config.alreadySubscribed,windowResizeEvent=Overlay.windowResizeEvent,windowScrollEvent=Overlay.windowScrollEvent;if(val){this.center();if(!alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center);}if(!alreadySubscribed(windowResizeEvent,this.doCenterOnDOMEvent,this)){windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}if(!alreadySubscribed(windowScrollEvent,this.doCenterOnDOMEvent,this)){windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{this.beforeShowEvent.unsubscribe(this.center);windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}},configHeight:function(type,args,obj){var height=args[0],el=this.element;Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");},configWidth:function(type,args,obj){var width=args[0],el=this.element;Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");},configzIndex:function(type,args,obj){var zIndex=args[0],el=this.element;if(!zIndex){zIndex=Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}if(this.iframe||this.cfg.getProperty("iframe")===true){if(zIndex<=0){zIndex=1;}}Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);if(this.iframe){this.stackIframe();}},configXY:function(type,args,obj){var pos=args[0],x=pos[0],y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);},configX:function(type,args,obj){var x=args[0],y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);},configY:function(type,args,obj){var x=this.cfg.getProperty("x"),y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);},showIframe:function(){var oIFrame=this.iframe,oParentNode;if(oIFrame){oParentNode=this.element.parentNode;if(oParentNode!=oIFrame.parentNode){this._addToParent(oParentNode,oIFrame);}oIFrame.style.display="block";}},hideIframe:function(){if(this.iframe){this.iframe.style.display="none";}},syncIframe:function(){var oIFrame=this.iframe,oElement=this.element,nOffset=Overlay.IFRAME_OFFSET,nDimensionOffset=(nOffset*2),aXY;if(oIFrame){oIFrame.style.width=(oElement.offsetWidth+nDimensionOffset+"px");oIFrame.style.height=(oElement.offsetHeight+nDimensionOffset+"px");aXY=this.cfg.getProperty("xy");if(!Lang.isArray(aXY)||(isNaN(aXY[0])||isNaN(aXY[1]))){this.syncPosition();aXY=this.cfg.getProperty("xy");}Dom.setXY(oIFrame,[(aXY[0]-nOffset),(aXY[1]-nOffset)]);}},stackIframe:function(){if(this.iframe){var overlayZ=Dom.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(overlayZ)&&!isNaN(overlayZ)){Dom.setStyle(this.iframe,"zIndex",(overlayZ-1));}}},configIframe:function(type,args,obj){var bIFrame=args[0];function createIFrame(){var oIFrame=this.iframe,oElement=this.element,oParent,aXY;if(!oIFrame){if(!m_oIFrameTemplate){m_oIFrameTemplate=document.createElement("iframe");if(this.isSecure){m_oIFrameTemplate.src=Overlay.IFRAME_SRC;}if(YAHOO.env.ua.ie){m_oIFrameTemplate.style.filter="alpha(opacity=0)";m_oIFrameTemplate.frameBorder=0;}else{m_oIFrameTemplate.style.opacity="0";}m_oIFrameTemplate.style.position="absolute";m_oIFrameTemplate.style.border="none";m_oIFrameTemplate.style.margin="0";m_oIFrameTemplate.style.padding="0";m_oIFrameTemplate.style.display="none";}oIFrame=m_oIFrameTemplate.cloneNode(false);oParent=oElement.parentNode;var parentNode=oParent||document.body;this._addToParent(parentNode,oIFrame);this.iframe=oIFrame;}this.showIframe();this.syncIframe();this.stackIframe();if(!this._hasIframeEventListeners){this.showEvent.subscribe(this.showIframe);this.hideEvent.subscribe(this.hideIframe);this.changeContentEvent.subscribe(this.syncIframe);this._hasIframeEventListeners=true;}}function onBeforeShow(){createIFrame.call(this);this.beforeShowEvent.unsubscribe(onBeforeShow);this._iframeDeferred=false;}if(bIFrame){if(this.cfg.getProperty("visible")){createIFrame.call(this);}else{if(!this._iframeDeferred){this.beforeShowEvent.subscribe(onBeforeShow);this._iframeDeferred=true;}}}else{this.hideIframe();if(this._hasIframeEventListeners){this.showEvent.unsubscribe(this.showIframe);this.hideEvent.unsubscribe(this.hideIframe);this.changeContentEvent.unsubscribe(this.syncIframe);this._hasIframeEventListeners=false;}}},configConstrainToViewport:function(type,args,obj){var val=args[0];if(val){if(!Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}},configContext:function(type,args,obj){var contextArgs=args[0],contextEl,elementMagnetCorner,contextMagnetCorner;if(contextArgs){contextEl=contextArgs[0];elementMagnetCorner=contextArgs[1];contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}},align:function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context"),me=this,context,element,contextRegion;function doAlign(v,h){switch(elementAlign){case Overlay.TOP_LEFT:me.moveTo(h,v);break;case Overlay.TOP_RIGHT:me.moveTo((h-element.offsetWidth),v);break;case Overlay.BOTTOM_LEFT:me.moveTo(h,(v-element.offsetHeight));break;case Overlay.BOTTOM_RIGHT:me.moveTo((h-element.offsetWidth),(v-element.offsetHeight));break;}}if(contextArgs){context=contextArgs[0];element=this.element;me=this;if(!elementAlign){elementAlign=contextArgs[1];}if(!contextAlign){contextAlign=contextArgs[2];}if(element&&context){contextRegion=Dom.getRegion(context);switch(contextAlign){case Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}},enforceConstraints:function(type,args,obj){var pos=args[0],x=pos[0],y=pos[1],offsetHeight=this.element.offsetHeight,offsetWidth=this.element.offsetWidth,viewPortWidth=Dom.getViewportWidth(),viewPortHeight=Dom.getViewportHeight(),scrollX=Dom.getDocumentScrollLeft(),scrollY=Dom.getDocumentScrollTop(),topConstraint=scrollY+10,leftConstraint=scrollX+10,bottomConstraint=scrollY+viewPortHeight-offsetHeight-10,rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);},center:function(){var scrollX=Dom.getDocumentScrollLeft(),scrollY=Dom.getDocumentScrollTop(),viewPortWidth=Dom.getClientWidth(),viewPortHeight=Dom.getClientHeight(),elementWidth=this.element.offsetWidth,elementHeight=this.element.offsetHeight,x=(viewPortWidth/2)-(elementWidth/2)+scrollX,y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");},syncPosition:function(){var pos=Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);},onDomResize:function(e,obj){var me=this;Overlay.superclass.onDomResize.call(this,e,obj);setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);},bringToTop:function(){var aOverlays=[],oElement=this.element;function compareZIndexDesc(p_oOverlay1,p_oOverlay2){var sZIndex1=Dom.getStyle(p_oOverlay1,"zIndex"),sZIndex2=Dom.getStyle(p_oOverlay2,"zIndex"),nZIndex1=(!sZIndex1||isNaN(sZIndex1))?0:parseInt(sZIndex1,10),nZIndex2=(!sZIndex2||isNaN(sZIndex2))?0:parseInt(sZIndex2,10);if(nZIndex1>nZIndex2){return-1;}else if(nZIndex1<nZIndex2){return 1;}else{return 0;}}function isOverlayElement(p_oElement){var oOverlay=Dom.hasClass(p_oElement,Overlay.CSS_OVERLAY),Panel=YAHOO.widget.Panel;if(oOverlay&&!Dom.isAncestor(oElement,oOverlay)){if(Panel&&Dom.hasClass(p_oElement,Panel.CSS_PANEL)){aOverlays[aOverlays.length]=p_oElement.parentNode;}else{aOverlays[aOverlays.length]=p_oElement;}}}Dom.getElementsBy(isOverlayElement,"DIV",document.body);aOverlays.sort(compareZIndexDesc);var oTopOverlay=aOverlays[0],nTopZIndex;if(oTopOverlay){nTopZIndex=Dom.getStyle(oTopOverlay,"zIndex");if(!isNaN(nTopZIndex)&&oTopOverlay!=oElement){this.cfg.setProperty("zindex",(parseInt(nTopZIndex,10)+2));}}},destroy:function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);Overlay.superclass.destroy.call(this);},toString:function(){return"Overlay "+this.id;}});}());(function(){YAHOO.widget.Panel=function(el,userConfig){YAHOO.widget.Panel.superclass.constructor.call(this,el,userConfig);};var Lang=YAHOO.lang,DD=YAHOO.util.DD,Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Overlay=YAHOO.widget.Overlay,CustomEvent=YAHOO.util.CustomEvent,Config=YAHOO.util.Config,Panel=YAHOO.widget.Panel,m_oMaskTemplate,m_oUnderlayTemplate,m_oCloseIconTemplate,EVENT_TYPES={"SHOW_MASK":"showMask","HIDE_MASK":"hideMask","DRAG":"drag"},DEFAULT_CONFIG={"CLOSE":{key:"close",value:true,validator:Lang.isBoolean,supercedes:["visible"]},"DRAGGABLE":{key:"draggable",value:(DD?true:false),validator:Lang.isBoolean,supercedes:["visible"]},"UNDERLAY":{key:"underlay",value:"shadow",supercedes:["visible"]},"MODAL":{key:"modal",value:false,validator:Lang.isBoolean,supercedes:["visible","zindex"]},"KEY_LISTENERS":{key:"keylisteners",suppressEvent:true,supercedes:["visible"]}};Panel.CSS_PANEL="yui-panel";Panel.CSS_PANEL_CONTAINER="yui-panel-container";function createHeader(p_sType,p_aArgs){if(!this.header){this.setHeader("&#160;");}}function restoreOriginalWidth(p_sType,p_aArgs,p_oObject){var sOriginalWidth=p_oObject[0],sNewWidth=p_oObject[1],oConfig=this.cfg,sCurrentWidth=oConfig.getProperty("width");if(sCurrentWidth==sNewWidth){oConfig.setProperty("width",sOriginalWidth);}this.unsubscribe("hide",restoreOriginalWidth,p_oObject);}function setWidthToOffsetWidth(p_sType,p_aArgs){var nIE=YAHOO.env.ua.ie,oConfig,sOriginalWidth,sNewWidth;if(nIE==6||(nIE==7&&document.compatMode=="BackCompat")){oConfig=this.cfg;sOriginalWidth=oConfig.getProperty("width");if(!sOriginalWidth||sOriginalWidth=="auto"){sNewWidth=(this.element.offsetWidth+"px");oConfig.setProperty("width",sNewWidth);this.subscribe("hide",restoreOriginalWidth,[(sOriginalWidth||""),sNewWidth]);}}}function onElementFocus(){this.blur();}function addFocusEventHandlers(p_sType,p_aArgs){var me=this;function isFocusable(el){var sTagName=el.tagName.toUpperCase(),bFocusable=false;switch(sTagName){case"A":case"BUTTON":case"SELECT":case"TEXTAREA":if(!Dom.isAncestor(me.element,el)){Event.on(el,"focus",onElementFocus,el,true);bFocusable=true;}break;case"INPUT":if(el.type!="hidden"&&!Dom.isAncestor(me.element,el)){Event.on(el,"focus",onElementFocus,el,true);bFocusable=true;}break;}return bFocusable;}this.focusableElements=Dom.getElementsBy(isFocusable);}function removeFocusEventHandlers(p_sType,p_aArgs){var aElements=this.focusableElements,nElements=aElements.length,el2,i;for(i=0;i<nElements;i++){el2=aElements[i];Event.removeListener(el2,"focus",onElementFocus);}}YAHOO.extend(Panel,Overlay,{init:function(el,userConfig){Panel.superclass.init.call(this,el);this.beforeInitEvent.fire(Panel);Dom.addClass(this.element,Panel.CSS_PANEL);this.buildWrapper();if(userConfig){this.cfg.applyConfig(userConfig,true);}this.subscribe("showMask",addFocusEventHandlers);this.subscribe("hideMask",removeFocusEventHandlers);if(this.cfg.getProperty("draggable")){this.subscribe("beforeRender",createHeader);}this.initEvent.fire(Panel);},initEvents:function(){Panel.superclass.initEvents.call(this);var SIGNATURE=CustomEvent.LIST;this.showMaskEvent=this.createEvent(EVENT_TYPES.SHOW_MASK);this.showMaskEvent.signature=SIGNATURE;this.hideMaskEvent=this.createEvent(EVENT_TYPES.HIDE_MASK);this.hideMaskEvent.signature=SIGNATURE;this.dragEvent=this.createEvent(EVENT_TYPES.DRAG);this.dragEvent.signature=SIGNATURE;},initDefaultConfig:function(){Panel.superclass.initDefaultConfig.call(this);this.cfg.addProperty(DEFAULT_CONFIG.CLOSE.key,{handler:this.configClose,value:DEFAULT_CONFIG.CLOSE.value,validator:DEFAULT_CONFIG.CLOSE.validator,supercedes:DEFAULT_CONFIG.CLOSE.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.DRAGGABLE.key,{handler:this.configDraggable,value:DEFAULT_CONFIG.DRAGGABLE.value,validator:DEFAULT_CONFIG.DRAGGABLE.validator,supercedes:DEFAULT_CONFIG.DRAGGABLE.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.UNDERLAY.key,{handler:this.configUnderlay,value:DEFAULT_CONFIG.UNDERLAY.value,supercedes:DEFAULT_CONFIG.UNDERLAY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MODAL.key,{handler:this.configModal,value:DEFAULT_CONFIG.MODAL.value,validator:DEFAULT_CONFIG.MODAL.validator,supercedes:DEFAULT_CONFIG.MODAL.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:DEFAULT_CONFIG.KEY_LISTENERS.suppressEvent,supercedes:DEFAULT_CONFIG.KEY_LISTENERS.supercedes});},configClose:function(type,args,obj){var val=args[0],oClose=this.close;function doHide(e,obj){obj.hide();}if(val){if(!oClose){if(!m_oCloseIconTemplate){m_oCloseIconTemplate=document.createElement("span");m_oCloseIconTemplate.innerHTML="&#160;";m_oCloseIconTemplate.className="container-close";}oClose=m_oCloseIconTemplate.cloneNode(true);this.innerElement.appendChild(oClose);Event.on(oClose,"click",doHide,this);this.close=oClose;}else{oClose.style.display="block";}}else{if(oClose){oClose.style.display="none";}}},configDraggable:function(type,args,obj){var val=args[0];if(val){if(!DD){this.cfg.setProperty("draggable",false);return;}if(this.header){Dom.setStyle(this.header,"cursor","move");this.registerDragDrop();}if(!Config.alreadySubscribed(this.beforeRenderEvent,createHeader,null)){this.subscribe("beforeRender",createHeader);}this.subscribe("beforeShow",setWidthToOffsetWidth);}else{if(this.dd){this.dd.unreg();}if(this.header){Dom.setStyle(this.header,"cursor","auto");}this.unsubscribe("beforeRender",createHeader);this.unsubscribe("beforeShow",setWidthToOffsetWidth);}},configUnderlay:function(type,args,obj){var UA=YAHOO.env.ua,bMacGecko=(this.platform=="mac"&&UA.gecko),sUnderlay=args[0].toLowerCase(),oUnderlay=this.underlay,oElement=this.element;function createUnderlay(){var nIE;if(!oUnderlay){if(!m_oUnderlayTemplate){m_oUnderlayTemplate=document.createElement("div");m_oUnderlayTemplate.className="underlay";}oUnderlay=m_oUnderlayTemplate.cloneNode(false);this.element.appendChild(oUnderlay);this.underlay=oUnderlay;nIE=UA.ie;if(nIE==6||(nIE==7&&document.compatMode=="BackCompat")){this.sizeUnderlay();this.cfg.subscribeToConfigEvent("width",this.sizeUnderlay);this.cfg.subscribeToConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.subscribe(this.sizeUnderlay);YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay,this,true);}}}function onBeforeShow(){createUnderlay.call(this);this._underlayDeferred=false;this.beforeShowEvent.unsubscribe(onBeforeShow);}function destroyUnderlay(){if(this._underlayDeferred){this.beforeShowEvent.unsubscribe(onBeforeShow);this._underlayDeferred=false;}if(oUnderlay){this.cfg.unsubscribeFromConfigEvent("width",this.sizeUnderlay);this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.unsubscribe(this.sizeUnderlay);YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay,this,true);this.element.removeChild(oUnderlay);this.underlay=null;}}switch(sUnderlay){case"shadow":Dom.removeClass(oElement,"matte");Dom.addClass(oElement,"shadow");break;case"matte":if(!bMacGecko){destroyUnderlay.call(this);}Dom.removeClass(oElement,"shadow");Dom.addClass(oElement,"matte");break;default:if(!bMacGecko){destroyUnderlay.call(this);}Dom.removeClass(oElement,"shadow");Dom.removeClass(oElement,"matte");break;}if((sUnderlay=="shadow")||(bMacGecko&&!oUnderlay)){if(this.cfg.getProperty("visible")){createUnderlay.call(this);}else{if(!this._underlayDeferred){this.beforeShowEvent.subscribe(onBeforeShow);this._underlayDeferred=true;}}}},configModal:function(type,args,obj){var modal=args[0];if(modal){if(!this._hasModalityEventListeners){this.subscribe("beforeShow",this.buildMask);this.subscribe("beforeShow",this.bringToTop);this.subscribe("beforeShow",this.showMask);this.subscribe("hide",this.hideMask);Overlay.windowResizeEvent.subscribe(this.sizeMask,this,true);this._hasModalityEventListeners=true;}}else{if(this._hasModalityEventListeners){if(this.cfg.getProperty("visible")){this.hideMask();this.removeMask();}this.unsubscribe("beforeShow",this.buildMask);this.unsubscribe("beforeShow",this.bringToTop);this.unsubscribe("beforeShow",this.showMask);this.unsubscribe("hide",this.hideMask);Overlay.windowResizeEvent.unsubscribe(this.sizeMask,this);this._hasModalityEventListeners=false;}}},removeMask:function(){var oMask=this.mask,oParentNode;if(oMask){this.hideMask();oParentNode=oMask.parentNode;if(oParentNode){oParentNode.removeChild(oMask);}this.mask=null;}},configKeyListeners:function(type,args,obj){var listeners=args[0],listener,nListeners,i;if(listeners){if(listeners instanceof Array){nListeners=listeners.length;for(i=0;i<nListeners;i++){listener=listeners[i];if(!Config.alreadySubscribed(this.showEvent,listener.enable,listener)){this.showEvent.subscribe(listener.enable,listener,true);}if(!Config.alreadySubscribed(this.hideEvent,listener.disable,listener)){this.hideEvent.subscribe(listener.disable,listener,true);this.destroyEvent.subscribe(listener.disable,listener,true);}}}else{if(!Config.alreadySubscribed(this.showEvent,listeners.enable,listeners)){this.showEvent.subscribe(listeners.enable,listeners,true);}if(!Config.alreadySubscribed(this.hideEvent,listeners.disable,listeners)){this.hideEvent.subscribe(listeners.disable,listeners,true);this.destroyEvent.subscribe(listeners.disable,listeners,true);}}}},configHeight:function(type,args,obj){var height=args[0],el=this.innerElement;Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");},configWidth:function(type,args,obj){var width=args[0],el=this.innerElement;Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");},configzIndex:function(type,args,obj){Panel.superclass.configzIndex.call(this,type,args,obj);if(this.mask||this.cfg.getProperty("modal")===true){var panelZ=Dom.getStyle(this.element,"zIndex");if(!panelZ||isNaN(panelZ)){panelZ=0;}if(panelZ===0){this.cfg.setProperty("zIndex",1);}else{this.stackMask();}}},buildWrapper:function(){var elementParent=this.element.parentNode,originalElement=this.element,wrapper=document.createElement("div");wrapper.className=Panel.CSS_PANEL_CONTAINER;wrapper.id=originalElement.id+"_c";if(elementParent){elementParent.insertBefore(wrapper,originalElement);}wrapper.appendChild(originalElement);this.element=wrapper;this.innerElement=originalElement;Dom.setStyle(this.innerElement,"visibility","inherit");},sizeUnderlay:function(){var oUnderlay=this.underlay,oElement;if(oUnderlay){oElement=this.element;oUnderlay.style.width=oElement.offsetWidth+"px";oUnderlay.style.height=oElement.offsetHeight+"px";}},registerDragDrop:function(){var me=this;if(this.header){if(!DD){return;}this.dd=new DD(this.element.id,this.id);if(!this.header.id){this.header.id=this.id+"_h";}this.dd.startDrag=function(){var offsetHeight,offsetWidth,viewPortWidth,viewPortHeight,scrollX,scrollY,topConstraint,leftConstraint,bottomConstraint,rightConstraint;if(YAHOO.env.ua.ie==6){Dom.addClass(me.element,"drag");}if(me.cfg.getProperty("constraintoviewport")){offsetHeight=me.element.offsetHeight;offsetWidth=me.element.offsetWidth;viewPortWidth=Dom.getViewportWidth();viewPortHeight=Dom.getViewportHeight();scrollX=Dom.getDocumentScrollLeft();scrollY=Dom.getDocumentScrollTop();topConstraint=scrollY+10;leftConstraint=scrollX+10;bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;rightConstraint=scrollX+viewPortWidth-offsetWidth-10;this.minX=leftConstraint;this.maxX=rightConstraint;this.constrainX=true;this.minY=topConstraint;this.maxY=bottomConstraint;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}me.dragEvent.fire("startDrag",arguments);};this.dd.onDrag=function(){me.syncPosition();me.cfg.refireEvent("iframe");if(this.platform=="mac"&&YAHOO.env.ua.gecko){this.showMacGeckoScrollbars();}me.dragEvent.fire("onDrag",arguments);};this.dd.endDrag=function(){if(YAHOO.env.ua.ie==6){Dom.removeClass(me.element,"drag");}me.dragEvent.fire("endDrag",arguments);me.moveEvent.fire(me.cfg.getProperty("xy"));};this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}},buildMask:function(){var oMask=this.mask;if(!oMask){if(!m_oMaskTemplate){m_oMaskTemplate=document.createElement("div");m_oMaskTemplate.className="mask";m_oMaskTemplate.innerHTML="&#160;";}oMask=m_oMaskTemplate.cloneNode(true);oMask.id=this.id+"_mask";document.body.insertBefore(oMask,document.body.firstChild);this.mask=oMask;this.stackMask();}},hideMask:function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";this.hideMaskEvent.fire();Dom.removeClass(document.body,"masked");}},showMask:function(){if(this.cfg.getProperty("modal")&&this.mask){Dom.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}},sizeMask:function(){if(this.mask){this.mask.style.height=Dom.getDocumentHeight()+"px";this.mask.style.width=Dom.getDocumentWidth()+"px";}},stackMask:function(){if(this.mask){var panelZ=Dom.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(panelZ)&&!isNaN(panelZ)){Dom.setStyle(this.mask,"zIndex",panelZ-1);}}},render:function(appendToNode){return Panel.superclass.render.call(this,appendToNode,this.innerElement);},destroy:function(){Overlay.windowResizeEvent.unsubscribe(this.sizeMask,this);this.removeMask();if(this.close){Event.purgeElement(this.close);}Panel.superclass.destroy.call(this);},toString:function(){return"Panel "+this.id;}});}());(function(){YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};var Dom=YAHOO.util.Dom,CustomEvent=YAHOO.util.CustomEvent,Easing=YAHOO.util.Easing,ContainerEffect=YAHOO.widget.ContainerEffect;ContainerEffect.FADE=function(overlay,dur){var fade=new ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}if(obj.overlay.underlay){obj.initialUnderlayOpacity=Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}Dom.setStyle(obj.overlay.element,"visibility","visible");Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}if(obj.overlay.underlay){Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}Dom.setStyle(obj.overlay.element,"visibility","hidden");Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||Dom.getX(overlay.element),y=overlay.cfg.getProperty("y")||Dom.getY(overlay.element),clientWidth=Dom.getClientWidth(),offsetWidth=overlay.element.offsetWidth,slide=new ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=((-25)-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=Dom.getXY(obj.overlay.element),currentX=pos[0],currentY=pos[1];if(Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&&currentX<x){Dom.setStyle(obj.overlay.element,"visibility","visible");}obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};slide.handleStartAnimateOut=function(type,args,obj){var vw=Dom.getViewportWidth(),pos=Dom.getXY(obj.overlay.element),yso=pos[1],currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(vw+25),yso];};slide.handleTweenAnimateOut=function(type,args,obj){var pos=Dom.getXY(obj.overlay.element),xto=pos[0],yto=pos[1];obj.overlay.cfg.setProperty("xy",[xto,yto],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateOut=function(type,args,obj){Dom.setStyle(obj.overlay.element,"visibility","hidden");obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init();return slide;};ContainerEffect.prototype={init:function(){this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn");this.beforeAnimateInEvent.signature=CustomEvent.LIST;this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut");this.beforeAnimateOutEvent.signature=CustomEvent.LIST;this.animateInCompleteEvent=this.createEvent("animateInComplete");this.animateInCompleteEvent.signature=CustomEvent.LIST;this.animateOutCompleteEvent=this.createEvent("animateOutComplete");this.animateOutCompleteEvent.signature=CustomEvent.LIST;this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);},animateIn:function(){this.beforeAnimateInEvent.fire();this.animIn.animate();},animateOut:function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();},handleStartAnimateIn:function(type,args,obj){},handleTweenAnimateIn:function(type,args,obj){},handleCompleteAnimateIn:function(type,args,obj){},handleStartAnimateOut:function(type,args,obj){},handleTweenAnimateOut:function(type,args,obj){},handleCompleteAnimateOut:function(type,args,obj){},toString:function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}return output;}};YAHOO.lang.augmentProto(ContainerEffect,YAHOO.util.EventProvider);})();YAHOO.register("container",YAHOO.widget.Module,{version:"2.3.1",build:"541"});
(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}if(!D){}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F,E;for(F in this.config){E=this.config[F];if(E&&E.event){D[F]=E.value;}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(E,H){var G,D,F;if(H){F={};for(G in E){if(B.hasOwnProperty(E,G)){F[G.toLowerCase()]=E[G];}}this.initialConfig=F;}for(G in E){if(B.hasOwnProperty(E,G)){this.queueProperty(G,E[G]);}}},refresh:function(){var D;for(D in this.config){this.refireEvent(D);}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(E,F,H,D){var G=this.config[E.toLowerCase()];if(G&&G.event){if(!A.alreadySubscribed(G.event,F,H)){G.event.subscribe(F,H,D);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,add:function(A,D,C){var F=new Date(A.getTime());switch(D){case this.MONTH:var E=A.getMonth()+C;var B=0;if(E<0){while(E<0){E+=12;B-=1;}}else{if(E>11){while(E>11){E-=12;B+=1;}}}F.setMonth(E);F.setFullYear(A.getFullYear()+B);break;case this.DAY:F.setDate(A.getDate()+C);break;case this.YEAR:F.setFullYear(A.getFullYear()+C);break;case this.WEEK:F.setDate(A.getDate()+(C*7));break;}return F;},subtract:function(A,C,B){return this.add(A,C,(B*-1));},before:function(C,B){var A=B.getTime();if(C.getTime()<A){return true;}else{return false;}},after:function(C,B){var A=B.getTime();if(C.getTime()>A){return true;}else{return false;}},between:function(B,A,C){if(this.after(B,A)&&this.before(B,C)){return true;}else{return false;}},getJan1:function(A){return new Date(A,0,1);},getDayOffset:function(B,D){var C=this.getJan1(D);var A=Math.ceil((B.getTime()-C.getTime())/this.ONE_DAY_MS);return A;},getWeekNumber:function(C,F){C=this.clearTime(C);var E=new Date(C.getTime()+(4*this.ONE_DAY_MS)-((C.getDay())*this.ONE_DAY_MS));var B=new Date(E.getFullYear(),0,1);var A=((E.getTime()-B.getTime())/this.ONE_DAY_MS)-1;var D=Math.ceil((A)/7);return D;},isYearOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getFullYear()!=A.getFullYear()){C=true;}return C;},isMonthOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getMonth()!=A.getMonth()){C=true;}return C;},findMonthStart:function(A){var B=new Date(A.getFullYear(),A.getMonth(),1);return B;},findMonthEnd:function(B){var D=this.findMonthStart(B);var C=this.add(D,this.MONTH,1);var A=this.subtract(C,this.DAY,1);return A;},clearTime:function(A){A.setHours(12,0,0,0);
return A;}};YAHOO.widget.Calendar=function(C,A,B){this.init(C,A,B);};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(C,A,B){this.initEvents();this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);this.id=C;this.oDomContainer=document.getElementById(A);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(B){this.cfg.applyConfig(B,true);}this.cfg.fireQueue();};YAHOO.widget.Calendar.prototype.configIframe=function(C,B,D){var A=B[0];if(!this.parent){if(YAHOO.util.Dom.inDocument(this.oDomContainer)){if(A){var E=YAHOO.util.Dom.getStyle(this.oDomContainer,"position");if(E=="absolute"||E=="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(B,A,C){var E=A[0],F;if(E){this.createTitleBar(E);}else{var D=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);if(!D){this.removeTitleBar();}else{this.createTitleBar("&#160;");}}};YAHOO.widget.Calendar.prototype.configClose=function(B,A,C){var E=A[0],D=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);if(E){if(!D){this.createTitleBar("&#160;");}this.createCloseButton();}else{this.removeCloseButton();if(!D){this.removeTitleBar();}}};YAHOO.widget.Calendar.prototype.initEvents=function(){var A=YAHOO.widget.Calendar._EVENT_TYPES;this.beforeSelectEvent=new YAHOO.util.CustomEvent(A.BEFORE_SELECT);this.selectEvent=new YAHOO.util.CustomEvent(A.SELECT);
this.beforeDeselectEvent=new YAHOO.util.CustomEvent(A.BEFORE_DESELECT);this.deselectEvent=new YAHOO.util.CustomEvent(A.DESELECT);this.changePageEvent=new YAHOO.util.CustomEvent(A.CHANGE_PAGE);this.beforeRenderEvent=new YAHOO.util.CustomEvent(A.BEFORE_RENDER);this.renderEvent=new YAHOO.util.CustomEvent(A.RENDER);this.resetEvent=new YAHOO.util.CustomEvent(A.RESET);this.clearEvent=new YAHOO.util.CustomEvent(A.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(G,A){var L,F,I,C;var H=YAHOO.util.Event.getTarget(G);var B=H.tagName.toLowerCase();var E=false;while(B!="td"&&!YAHOO.util.Dom.hasClass(H,A.Style.CSS_CELL_SELECTABLE)){if(!E&&B=="a"&&YAHOO.util.Dom.hasClass(H,A.Style.CSS_CELL_SELECTOR)){E=true;}H=H.parentNode;B=H.tagName.toLowerCase();if(B=="html"){return ;}}if(E){YAHOO.util.Event.preventDefault(G);}L=H;if(YAHOO.util.Dom.hasClass(L,A.Style.CSS_CELL_SELECTABLE)){F=L.id.split("cell")[1];I=A.cellDates[F];C=new Date(I[0],I[1]-1,I[2]);var K;if(A.Options.MULTI_SELECT){K=L.getElementsByTagName("a")[0];if(K){K.blur();}var D=A.cellDates[F];var J=A._indexOfSelectedFieldArray(D);if(J>-1){A.deselectCell(F);}else{A.selectCell(F);}}else{K=L.getElementsByTagName("a")[0];if(K){K.blur();}A.selectCell(F);}}};YAHOO.widget.Calendar.prototype.doCellMouseOver=function(C,B){var A;if(C){A=YAHOO.util.Event.getTarget(C);}else{A=this;}while(A.tagName.toLowerCase()!="td"){A=A.parentNode;if(A.tagName.toLowerCase()=="html"){return ;}}if(YAHOO.util.Dom.hasClass(A,B.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.addClass(A,B.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.doCellMouseOut=function(C,B){var A;if(C){A=YAHOO.util.Event.getTarget(C);}else{A=this;}while(A.tagName.toLowerCase()!="td"){A=A.parentNode;if(A.tagName.toLowerCase()=="html"){return ;}}if(YAHOO.util.Dom.hasClass(A,B.Style.CSS_CELL_SELECTABLE)){YAHOO.util.Dom.removeClass(A,B.Style.CSS_CELL_HOVER);}};YAHOO.widget.Calendar.prototype.setupConfig=function(){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.addProperty(A.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});this.cfg.addProperty(A.SELECTED.key,{value:[],handler:this.configSelected});this.cfg.addProperty(A.TITLE.key,{value:A.TITLE.value,handler:this.configTitle});this.cfg.addProperty(A.CLOSE.key,{value:A.CLOSE.value,handler:this.configClose});this.cfg.addProperty(A.IFRAME.key,{value:A.IFRAME.value,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.MINDATE.key,{value:A.MINDATE.value,handler:this.configMinDate});this.cfg.addProperty(A.MAXDATE.key,{value:A.MAXDATE.value,handler:this.configMaxDate});this.cfg.addProperty(A.MULTI_SELECT.key,{value:A.MULTI_SELECT.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.START_WEEKDAY.key,{value:A.START_WEEKDAY.value,handler:this.configOptions,validator:this.cfg.checkNumber});this.cfg.addProperty(A.SHOW_WEEKDAYS.key,{value:A.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_HEADER.key,{value:A.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_FOOTER.key,{value:A.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.HIDE_BLANK_WEEKS.key,{value:A.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.NAV_ARROW_LEFT.key,{value:A.NAV_ARROW_LEFT.value,handler:this.configOptions});this.cfg.addProperty(A.NAV_ARROW_RIGHT.key,{value:A.NAV_ARROW_RIGHT.value,handler:this.configOptions});this.cfg.addProperty(A.MONTHS_SHORT.key,{value:A.MONTHS_SHORT.value,handler:this.configLocale});this.cfg.addProperty(A.MONTHS_LONG.key,{value:A.MONTHS_LONG.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_1CHAR.key,{value:A.WEEKDAYS_1CHAR.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_SHORT.key,{value:A.WEEKDAYS_SHORT.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_MEDIUM.key,{value:A.WEEKDAYS_MEDIUM.value,handler:this.configLocale});this.cfg.addProperty(A.WEEKDAYS_LONG.key,{value:A.WEEKDAYS_LONG.value,handler:this.configLocale});var B=function(){this.cfg.refireEvent(A.LOCALE_MONTHS.key);this.cfg.refireEvent(A.LOCALE_WEEKDAYS.key);};this.cfg.subscribeToConfigEvent(A.START_WEEKDAY.key,B,this,true);this.cfg.subscribeToConfigEvent(A.MONTHS_SHORT.key,B,this,true);this.cfg.subscribeToConfigEvent(A.MONTHS_LONG.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_1CHAR.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_SHORT.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_MEDIUM.key,B,this,true);this.cfg.subscribeToConfigEvent(A.WEEKDAYS_LONG.key,B,this,true);this.cfg.addProperty(A.LOCALE_MONTHS.key,{value:A.LOCALE_MONTHS.value,handler:this.configLocaleValues});this.cfg.addProperty(A.LOCALE_WEEKDAYS.key,{value:A.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});this.cfg.addProperty(A.DATE_DELIMITER.key,{value:A.DATE_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(A.DATE_FIELD_DELIMITER.key,{value:A.DATE_FIELD_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(A.DATE_RANGE_DELIMITER.key,{value:A.DATE_RANGE_DELIMITER.value,handler:this.configLocale});this.cfg.addProperty(A.MY_MONTH_POSITION.key,{value:A.MY_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_YEAR_POSITION.key,{value:A.MY_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});
this.cfg.addProperty(A.MD_MONTH_POSITION.key,{value:A.MD_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_DAY_POSITION.key,{value:A.MD_DAY_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_MONTH_POSITION.key,{value:A.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_DAY_POSITION.key,{value:A.MDY_DAY_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_YEAR_POSITION.key,{value:A.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_POSITION.key,{value:A.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_YEAR_POSITION.key,{value:A.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_SUFFIX.key,{value:A.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});this.cfg.addProperty(A.MY_LABEL_YEAR_SUFFIX.key,{value:A.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});};YAHOO.widget.Calendar.prototype.configPageDate=function(B,A,C){this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key,this._parsePageDate(A[0]),true);};YAHOO.widget.Calendar.prototype.configMinDate=function(B,A,C){var D=A[0];if(YAHOO.lang.isString(D)){D=this._parseDate(D);this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key,new Date(D[0],(D[1]-1),D[2]));}};YAHOO.widget.Calendar.prototype.configMaxDate=function(B,A,C){var D=A[0];if(YAHOO.lang.isString(D)){D=this._parseDate(D);this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key,new Date(D[0],(D[1]-1),D[2]));}};YAHOO.widget.Calendar.prototype.configSelected=function(C,A,E){var B=A[0];var D=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;if(B){if(YAHOO.lang.isString(B)){this.cfg.setProperty(D,this._parseDates(B),true);}}if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(D);}};YAHOO.widget.Calendar.prototype.configOptions=function(B,A,C){this.Options[B.toUpperCase()]=A[0];};YAHOO.widget.Calendar.prototype.configLocale=function(C,B,D){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.Locale[C.toUpperCase()]=B[0];this.cfg.refireEvent(A.LOCALE_MONTHS.key);this.cfg.refireEvent(A.LOCALE_WEEKDAYS.key);};YAHOO.widget.Calendar.prototype.configLocaleValues=function(D,C,E){var B=YAHOO.widget.Calendar._DEFAULT_CONFIG;D=D.toLowerCase();var G=C[0];switch(D){case B.LOCALE_MONTHS.key:switch(G){case YAHOO.widget.Calendar.SHORT:this.Locale.LOCALE_MONTHS=this.cfg.getProperty(B.MONTHS_SHORT.key).concat();break;case YAHOO.widget.Calendar.LONG:this.Locale.LOCALE_MONTHS=this.cfg.getProperty(B.MONTHS_LONG.key).concat();break;}break;case B.LOCALE_WEEKDAYS.key:switch(G){case YAHOO.widget.Calendar.ONE_CHAR:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_1CHAR.key).concat();break;case YAHOO.widget.Calendar.SHORT:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_SHORT.key).concat();break;case YAHOO.widget.Calendar.MEDIUM:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_MEDIUM.key).concat();break;case YAHOO.widget.Calendar.LONG:this.Locale.LOCALE_WEEKDAYS=this.cfg.getProperty(B.WEEKDAYS_LONG.key).concat();break;}var F=this.cfg.getProperty(B.START_WEEKDAY.key);if(F>0){for(var A=0;A<F;++A){this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());}}break;}};YAHOO.widget.Calendar.prototype.initStyles=function(){var A=YAHOO.widget.Calendar._STYLES;this.Style={CSS_ROW_HEADER:A.CSS_ROW_HEADER,CSS_ROW_FOOTER:A.CSS_ROW_FOOTER,CSS_CELL:A.CSS_CELL,CSS_CELL_SELECTOR:A.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:A.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:A.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:A.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:A.CSS_CELL_TODAY,CSS_CELL_OOM:A.CSS_CELL_OOM,CSS_CELL_OOB:A.CSS_CELL_OOB,CSS_HEADER:A.CSS_HEADER,CSS_HEADER_TEXT:A.CSS_HEADER_TEXT,CSS_BODY:A.CSS_BODY,CSS_WEEKDAY_CELL:A.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:A.CSS_WEEKDAY_ROW,CSS_FOOTER:A.CSS_FOOTER,CSS_CALENDAR:A.CSS_CALENDAR,CSS_SINGLE:A.CSS_SINGLE,CSS_CONTAINER:A.CSS_CONTAINER,CSS_NAV_LEFT:A.CSS_NAV_LEFT,CSS_NAV_RIGHT:A.CSS_NAV_RIGHT,CSS_CLOSE:A.CSS_CLOSE,CSS_CELL_TOP:A.CSS_CELL_TOP,CSS_CELL_LEFT:A.CSS_CELL_LEFT,CSS_CELL_RIGHT:A.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:A.CSS_CELL_BOTTOM,CSS_CELL_HOVER:A.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:A.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:A.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:A.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:A.CSS_CELL_HIGHLIGHT4};};YAHOO.widget.Calendar.prototype.buildMonthLabel=function(){var A=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);var C=this.Locale.LOCALE_MONTHS[A.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX;var B=A.getFullYear()+this.Locale.MY_LABEL_YEAR_SUFFIX;if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return B+C;}else{return C+B;}};YAHOO.widget.Calendar.prototype.buildDayLabel=function(A){return A.getDate();};YAHOO.widget.Calendar.prototype.createTitleBar=function(A){var B=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");B.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;B.innerHTML=A;this.oDomContainer.insertBefore(B,this.oDomContainer.firstChild);YAHOO.util.Dom.addClass(this.oDomContainer,"withtitle");return B;};YAHOO.widget.Calendar.prototype.removeTitleBar=function(){var A=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(A){YAHOO.util.Event.purgeElement(A);this.oDomContainer.removeChild(A);}YAHOO.util.Dom.removeClass(this.oDomContainer,"withtitle");};YAHOO.widget.Calendar.prototype.createCloseButton=function(){var D=YAHOO.util.Dom,A=YAHOO.util.Event,C=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,F="us/my/bn/x_d.gif";var E=D.getElementsByClassName("link-close","a",this.oDomContainer)[0];
if(!E){E=document.createElement("a");A.addListener(E,"click",function(H,G){G.hide();A.preventDefault(H);},this);}E.href="#";E.className="link-close";if(YAHOO.widget.Calendar.IMG_ROOT!==null){var B=D.getElementsByClassName(C,"img",E)[0]||document.createElement("img");B.src=YAHOO.widget.Calendar.IMG_ROOT+F;B.className=C;E.appendChild(B);}else{E.innerHTML="<span class=\""+C+" "+this.Style.CSS_CLOSE+"\"></span>";}this.oDomContainer.appendChild(E);return E;};YAHOO.widget.Calendar.prototype.removeCloseButton=function(){var A=YAHOO.util.Dom.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(A){YAHOO.util.Event.purgeElement(A);this.oDomContainer.removeChild(A);}};YAHOO.widget.Calendar.prototype.renderHeader=function(E){var H=7;var F="us/tr/callt.gif";var G="us/tr/calrt.gif";var L=YAHOO.widget.Calendar._DEFAULT_CONFIG;if(this.cfg.getProperty(L.SHOW_WEEK_HEADER.key)){H+=1;}if(this.cfg.getProperty(L.SHOW_WEEK_FOOTER.key)){H+=1;}E[E.length]="<thead>";E[E.length]="<tr>";E[E.length]="<th colspan=\""+H+"\" class=\""+this.Style.CSS_HEADER_TEXT+"\">";E[E.length]="<div class=\""+this.Style.CSS_HEADER+"\">";var J,K=false;if(this.parent){if(this.index===0){J=true;}if(this.index==(this.parent.cfg.getProperty("pages")-1)){K=true;}}else{J=true;K=true;}var B=this.parent||this;if(J){var A=this.cfg.getProperty(L.NAV_ARROW_LEFT.key);if(A===null&&YAHOO.widget.Calendar.IMG_ROOT!==null){A=YAHOO.widget.Calendar.IMG_ROOT+F;}var C=(A===null)?"":" style=\"background-image:url("+A+")\"";E[E.length]="<a class=\""+this.Style.CSS_NAV_LEFT+"\""+C+" >&#160;</a>";}E[E.length]=this.buildMonthLabel();if(K){var D=this.cfg.getProperty(L.NAV_ARROW_RIGHT.key);if(D===null&&YAHOO.widget.Calendar.IMG_ROOT!==null){D=YAHOO.widget.Calendar.IMG_ROOT+G;}var I=(D===null)?"":" style=\"background-image:url("+D+")\"";E[E.length]="<a class=\""+this.Style.CSS_NAV_RIGHT+"\""+I+" >&#160;</a>";}E[E.length]="</div>\n</th>\n</tr>";if(this.cfg.getProperty(L.SHOW_WEEKDAYS.key)){E=this.buildWeekdays(E);}E[E.length]="</thead>";return E;};YAHOO.widget.Calendar.prototype.buildWeekdays=function(C){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;C[C.length]="<tr class=\""+this.Style.CSS_WEEKDAY_ROW+"\">";if(this.cfg.getProperty(A.SHOW_WEEK_HEADER.key)){C[C.length]="<th>&#160;</th>";}for(var B=0;B<this.Locale.LOCALE_WEEKDAYS.length;++B){C[C.length]="<th class=\"calweekdaycell\">"+this.Locale.LOCALE_WEEKDAYS[B]+"</th>";}if(this.cfg.getProperty(A.SHOW_WEEK_FOOTER.key)){C[C.length]="<th>&#160;</th>";}C[C.length]="</tr>";return C;};YAHOO.widget.Calendar.prototype.renderBody=function(c,a){var m=YAHOO.widget.Calendar._DEFAULT_CONFIG;var AC=this.cfg.getProperty(m.START_WEEKDAY.key);this.preMonthDays=c.getDay();if(AC>0){this.preMonthDays-=AC;}if(this.preMonthDays<0){this.preMonthDays+=7;}this.monthDays=YAHOO.widget.DateMath.findMonthEnd(c).getDate();this.postMonthDays=YAHOO.widget.Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;c=YAHOO.widget.DateMath.subtract(c,YAHOO.widget.DateMath.DAY,this.preMonthDays);var Q,H;var G="w";var W="_cell";var U="wd";var k="d";var I;var h;var O=this.today.getFullYear();var j=this.today.getMonth();var D=this.today.getDate();var q=this.cfg.getProperty(m.PAGEDATE.key);var C=this.cfg.getProperty(m.HIDE_BLANK_WEEKS.key);var Z=this.cfg.getProperty(m.SHOW_WEEK_FOOTER.key);var T=this.cfg.getProperty(m.SHOW_WEEK_HEADER.key);var M=this.cfg.getProperty(m.MINDATE.key);var S=this.cfg.getProperty(m.MAXDATE.key);if(M){M=YAHOO.widget.DateMath.clearTime(M);}if(S){S=YAHOO.widget.DateMath.clearTime(S);}a[a.length]="<tbody class=\"m"+(q.getMonth()+1)+" "+this.Style.CSS_BODY+"\">";var AA=0;var J=document.createElement("div");var b=document.createElement("td");J.appendChild(b);var z=new Date(q.getFullYear(),0,1);var o=this.parent||this;for(var u=0;u<6;u++){Q=YAHOO.widget.DateMath.getWeekNumber(c,q.getFullYear(),AC);H=G+Q;if(u!==0&&C===true&&c.getMonth()!=q.getMonth()){break;}else{a[a.length]="<tr class=\""+H+"\">";if(T){a=this.renderRowHeader(Q,a);}for(var AB=0;AB<7;AB++){I=[];h=null;this.clearElement(b);b.className=this.Style.CSS_CELL;b.id=this.id+W+AA;if(c.getDate()==D&&c.getMonth()==j&&c.getFullYear()==O){I[I.length]=o.renderCellStyleToday;}var R=[c.getFullYear(),c.getMonth()+1,c.getDate()];this.cellDates[this.cellDates.length]=R;if(c.getMonth()!=q.getMonth()){I[I.length]=o.renderCellNotThisMonth;}else{YAHOO.util.Dom.addClass(b,U+c.getDay());YAHOO.util.Dom.addClass(b,k+c.getDate());for(var t=0;t<this.renderStack.length;++t){var l=this.renderStack[t];var AD=l[0];var B;var V;var F;switch(AD){case YAHOO.widget.Calendar.DATE:B=l[1][1];V=l[1][2];F=l[1][0];if(c.getMonth()+1==B&&c.getDate()==V&&c.getFullYear()==F){h=l[2];this.renderStack.splice(t,1);}break;case YAHOO.widget.Calendar.MONTH_DAY:B=l[1][0];V=l[1][1];if(c.getMonth()+1==B&&c.getDate()==V){h=l[2];this.renderStack.splice(t,1);}break;case YAHOO.widget.Calendar.RANGE:var Y=l[1][0];var X=l[1][1];var e=Y[1];var L=Y[2];var P=Y[0];var y=new Date(P,e-1,L);var E=X[1];var g=X[2];var A=X[0];var w=new Date(A,E-1,g);if(c.getTime()>=y.getTime()&&c.getTime()<=w.getTime()){h=l[2];if(c.getTime()==w.getTime()){this.renderStack.splice(t,1);}}break;case YAHOO.widget.Calendar.WEEKDAY:var K=l[1][0];if(c.getDay()+1==K){h=l[2];}break;case YAHOO.widget.Calendar.MONTH:B=l[1][0];if(c.getMonth()+1==B){h=l[2];}break;}if(h){I[I.length]=h;}}}if(this._indexOfSelectedFieldArray(R)>-1){I[I.length]=o.renderCellStyleSelected;}if((M&&(c.getTime()<M.getTime()))||(S&&(c.getTime()>S.getTime()))){I[I.length]=o.renderOutOfBoundsDate;}else{I[I.length]=o.styleCellDefault;I[I.length]=o.renderCellDefault;}for(var n=0;n<I.length;++n){if(I[n].call(o,c,b)==YAHOO.widget.Calendar.STOP_RENDER){break;}}c.setTime(c.getTime()+YAHOO.widget.DateMath.ONE_DAY_MS);if(AA>=0&&AA<=6){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_TOP);}if((AA%7)===0){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_LEFT);}if(((AA+1)%7)===0){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_RIGHT);}var f=this.postMonthDays;if(C&&f>=7){var N=Math.floor(f/7);for(var v=0;
v<N;++v){f-=7;}}if(AA>=((this.preMonthDays+f+this.monthDays)-7)){YAHOO.util.Dom.addClass(b,this.Style.CSS_CELL_BOTTOM);}a[a.length]=J.innerHTML;AA++;}if(Z){a=this.renderRowFooter(Q,a);}a[a.length]="</tr>";}}a[a.length]="</tbody>";return a;};YAHOO.widget.Calendar.prototype.renderFooter=function(A){return A;};YAHOO.widget.Calendar.prototype.render=function(){this.beforeRenderEvent.fire();var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;var C=YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(A.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;YAHOO.util.Event.purgeElement(this.oDomContainer,true);var B=[];B[B.length]="<table cellSpacing=\"0\" class=\""+this.Style.CSS_CALENDAR+" y"+C.getFullYear()+"\" id=\""+this.id+"\">";B=this.renderHeader(B);B=this.renderBody(C,B);B=this.renderFooter(B);B[B.length]="</table>";this.oDomContainer.innerHTML=B.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent(A.TITLE.key);this.cfg.refireEvent(A.CLOSE.key);this.cfg.refireEvent(A.IFRAME.key);this.renderEvent.fire();};YAHOO.widget.Calendar.prototype.applyListeners=function(){var K=this.oDomContainer;var B=this.parent||this;var G="a";var D="mousedown";var H=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT,G,K);var C=YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT,G,K);if(H&&H.length>0){this.linkLeft=H[0];YAHOO.util.Event.addListener(this.linkLeft,D,B.previousMonth,B,true);}if(C&&C.length>0){this.linkRight=C[0];YAHOO.util.Event.addListener(this.linkRight,D,B.nextMonth,B,true);}if(this.domEventMap){var E,A;for(var M in this.domEventMap){if(YAHOO.lang.hasOwnProperty(this.domEventMap,M)){var I=this.domEventMap[M];if(!(I instanceof Array)){I=[I];}for(var F=0;F<I.length;F++){var L=I[F];A=YAHOO.util.Dom.getElementsByClassName(M,L.tag,this.oDomContainer);for(var J=0;J<A.length;J++){E=A[J];YAHOO.util.Event.addListener(E,L.event,L.handler,L.scope,L.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(B){var A=this.getDateFieldsByCellId(B);return new Date(A[0],A[1]-1,A[2]);};YAHOO.widget.Calendar.prototype.getDateFieldsByCellId=function(A){A=A.toLowerCase().split("_cell")[1];A=parseInt(A,10);return this.cellDates[A];};YAHOO.widget.Calendar.prototype.renderOutOfBoundsDate=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_OOB);A.innerHTML=B.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.renderRowHeader=function(B,A){A[A.length]="<th class=\"calrowhead\">"+B+"</th>";return A;};YAHOO.widget.Calendar.prototype.renderRowFooter=function(B,A){A[A.length]="<th class=\"calrowfoot\">"+B+"</th>";return A;};YAHOO.widget.Calendar.prototype.renderCellDefault=function(B,A){A.innerHTML="<a href=\"#\" class=\""+this.Style.CSS_CELL_SELECTOR+"\">"+this.buildDayLabel(B)+"</a>";};YAHOO.widget.Calendar.prototype.styleCellDefault=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_SELECTABLE);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight1=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight2=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight3=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar.prototype.renderCellStyleHighlight4=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar.prototype.renderCellStyleToday=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar.prototype.renderCellStyleSelected=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar.prototype.renderCellNotThisMonth=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_OOM);A.innerHTML=B.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.renderBodyCellRestricted=function(B,A){YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL);YAHOO.util.Dom.addClass(A,this.Style.CSS_CELL_RESTRICTED);A.innerHTML=B.getDate();return YAHOO.widget.Calendar.STOP_RENDER;};YAHOO.widget.Calendar.prototype.addMonths=function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.add(this.cfg.getProperty(A),YAHOO.widget.DateMath.MONTH,B));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractMonths=function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.subtract(this.cfg.getProperty(A),YAHOO.widget.DateMath.MONTH,B));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.addYears=function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.add(this.cfg.getProperty(A),YAHOO.widget.DateMath.YEAR,B));this.resetRenderers();this.changePageEvent.fire();};YAHOO.widget.Calendar.prototype.subtractYears=function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;this.cfg.setProperty(A,YAHOO.widget.DateMath.subtract(this.cfg.getProperty(A),YAHOO.widget.DateMath.YEAR,B));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 A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.resetProperty(A.SELECTED.key);this.cfg.resetProperty(A.PAGEDATE.key);this.resetEvent.fire();
};YAHOO.widget.Calendar.prototype.clear=function(){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;this.cfg.setProperty(A.SELECTED.key,[]);this.cfg.setProperty(A.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();};YAHOO.widget.Calendar.prototype.select=function(C){var F=this._toFieldArray(C);var B=[];var E=[];var G=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;for(var A=0;A<F.length;++A){var D=F[A];if(!this.isDateOOB(this._toDate(D))){if(B.length===0){this.beforeSelectEvent.fire();E=this.cfg.getProperty(G);}B.push(D);if(this._indexOfSelectedFieldArray(D)==-1){E[E.length]=D;}}}if(B.length>0){if(this.parent){this.parent.cfg.setProperty(G,E);}else{this.cfg.setProperty(G,E);}this.selectEvent.fire(B);}return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.selectCell=function(D){var B=this.cells[D];var H=this.cellDates[D];var G=this._toDate(H);var C=YAHOO.util.Dom.hasClass(B,this.Style.CSS_CELL_SELECTABLE);if(C){this.beforeSelectEvent.fire();var F=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;var E=this.cfg.getProperty(F);var A=H.concat();if(this._indexOfSelectedFieldArray(A)==-1){E[E.length]=A;}if(this.parent){this.parent.cfg.setProperty(F,E);}else{this.cfg.setProperty(F,E);}this.renderCellStyleSelected(G,B);this.selectEvent.fire([A]);this.doCellMouseOut.call(B,null,this);}return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselect=function(E){var A=this._toFieldArray(E);var D=[];var G=[];var H=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;for(var B=0;B<A.length;++B){var F=A[B];if(!this.isDateOOB(this._toDate(F))){if(D.length===0){this.beforeDeselectEvent.fire();G=this.cfg.getProperty(H);}D.push(F);var C=this._indexOfSelectedFieldArray(F);if(C!=-1){G.splice(C,1);}}}if(D.length>0){if(this.parent){this.parent.cfg.setProperty(H,G);}else{this.cfg.setProperty(H,G);}this.deselectEvent.fire(D);}return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselectCell=function(E){var H=this.cells[E];var B=this.cellDates[E];var F=this._indexOfSelectedFieldArray(B);var G=YAHOO.util.Dom.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(G){this.beforeDeselectEvent.fire();var I=YAHOO.widget.Calendar._DEFAULT_CONFIG;var D=this.cfg.getProperty(I.SELECTED.key);var C=this._toDate(B);var A=B.concat();if(F>-1){if(this.cfg.getProperty(I.PAGEDATE.key).getMonth()==C.getMonth()&&this.cfg.getProperty(I.PAGEDATE.key).getFullYear()==C.getFullYear()){YAHOO.util.Dom.removeClass(H,this.Style.CSS_CELL_SELECTED);}D.splice(F,1);}if(this.parent){this.parent.cfg.setProperty(I.SELECTED.key,D);}else{this.cfg.setProperty(I.SELECTED.key,D);}this.deselectEvent.fire(A);}return this.getSelectedDates();};YAHOO.widget.Calendar.prototype.deselectAll=function(){this.beforeDeselectEvent.fire();var D=YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;var A=this.cfg.getProperty(D);var B=A.length;var C=A.concat();if(this.parent){this.parent.cfg.setProperty(D,[]);}else{this.cfg.setProperty(D,[]);}if(B>0){this.deselectEvent.fire(C);}return this.getSelectedDates();};YAHOO.widget.Calendar.prototype._toFieldArray=function(B){var A=[];if(B instanceof Date){A=[[B.getFullYear(),B.getMonth()+1,B.getDate()]];}else{if(YAHOO.lang.isString(B)){A=this._parseDates(B);}else{if(YAHOO.lang.isArray(B)){for(var C=0;C<B.length;++C){var D=B[C];A[A.length]=[D.getFullYear(),D.getMonth()+1,D.getDate()];}}}}return A;};YAHOO.widget.Calendar.prototype._toDate=function(A){if(A instanceof Date){return A;}else{return new Date(A[0],A[1]-1,A[2]);}};YAHOO.widget.Calendar.prototype._fieldArraysAreEqual=function(C,B){var A=false;if(C[0]==B[0]&&C[1]==B[1]&&C[2]==B[2]){A=true;}return A;};YAHOO.widget.Calendar.prototype._indexOfSelectedFieldArray=function(E){var D=-1;var A=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);for(var C=0;C<A.length;++C){var B=A[C];if(E[0]==B[0]&&E[1]==B[1]&&E[2]==B[2]){D=C;break;}}return D;};YAHOO.widget.Calendar.prototype.isDateOOM=function(A){return(A.getMonth()!=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());};YAHOO.widget.Calendar.prototype.isDateOOB=function(D){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;var E=this.cfg.getProperty(A.MINDATE.key);var F=this.cfg.getProperty(A.MAXDATE.key);var C=YAHOO.widget.DateMath;if(E){E=C.clearTime(E);}if(F){F=C.clearTime(F);}var B=new Date(D.getTime());B=C.clearTime(B);return((E&&B.getTime()<E.getTime())||(F&&B.getTime()>F.getTime()));};YAHOO.widget.Calendar.prototype._parsePageDate=function(B){var E;var A=YAHOO.widget.Calendar._DEFAULT_CONFIG;if(B){if(B instanceof Date){E=YAHOO.widget.DateMath.findMonthStart(B);}else{var F,D,C;C=B.split(this.cfg.getProperty(A.DATE_FIELD_DELIMITER.key));F=parseInt(C[this.cfg.getProperty(A.MY_MONTH_POSITION.key)-1],10)-1;D=parseInt(C[this.cfg.getProperty(A.MY_YEAR_POSITION.key)-1],10);E=new Date(D,F,1);}}else{E=new Date(this.today.getFullYear(),this.today.getMonth(),1);}return E;};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(A){};YAHOO.widget.Calendar.prototype.onBeforeDeselect=function(){};YAHOO.widget.Calendar.prototype.onDeselect=function(A){};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(C){var D=C.split(this.Locale.DATE_FIELD_DELIMITER);var A;if(D.length==2){A=[D[this.Locale.MD_MONTH_POSITION-1],D[this.Locale.MD_DAY_POSITION-1]];A.type=YAHOO.widget.Calendar.MONTH_DAY;}else{A=[D[this.Locale.MDY_YEAR_POSITION-1],D[this.Locale.MDY_MONTH_POSITION-1],D[this.Locale.MDY_DAY_POSITION-1]];
A.type=YAHOO.widget.Calendar.DATE;}for(var B=0;B<A.length;B++){A[B]=parseInt(A[B],10);}return A;};YAHOO.widget.Calendar.prototype._parseDates=function(B){var I=[];var H=B.split(this.Locale.DATE_DELIMITER);for(var G=0;G<H.length;++G){var F=H[G];if(F.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var A=F.split(this.Locale.DATE_RANGE_DELIMITER);var E=this._parseDate(A[0]);var J=this._parseDate(A[1]);var D=this._parseRange(E,J);I=I.concat(D);}else{var C=this._parseDate(F);I.push(C);}}return I;};YAHOO.widget.Calendar.prototype._parseRange=function(A,F){var E=new Date(A[0],A[1]-1,A[2]);var B=YAHOO.widget.DateMath.add(new Date(A[0],A[1]-1,A[2]),YAHOO.widget.DateMath.DAY,1);var D=new Date(F[0],F[1]-1,F[2]);var C=[];C.push(A);while(B.getTime()<=D.getTime()){C.push([B.getFullYear(),B.getMonth()+1,B.getDate()]);B=YAHOO.widget.DateMath.add(B,YAHOO.widget.DateMath.DAY,1);}return C;};YAHOO.widget.Calendar.prototype.resetRenderers=function(){this.renderStack=this._renderStack.concat();};YAHOO.widget.Calendar.prototype.clearElement=function(A){A.innerHTML="&#160;";A.className="";};YAHOO.widget.Calendar.prototype.addRenderer=function(A,B){var D=this._parseDates(A);for(var C=0;C<D.length;++C){var E=D[C];if(E.length==2){if(E[0] instanceof Array){this._addRenderer(YAHOO.widget.Calendar.RANGE,E,B);}else{this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY,E,B);}}else{if(E.length==3){this._addRenderer(YAHOO.widget.Calendar.DATE,E,B);}}}};YAHOO.widget.Calendar.prototype._addRenderer=function(B,C,A){var D=[B,C,A];this.renderStack.unshift(D);this._renderStack=this.renderStack.concat();};YAHOO.widget.Calendar.prototype.addMonthRenderer=function(B,A){this._addRenderer(YAHOO.widget.Calendar.MONTH,[B],A);};YAHOO.widget.Calendar.prototype.addWeekdayRenderer=function(B,A){this._addRenderer(YAHOO.widget.Calendar.WEEKDAY,[B],A);};YAHOO.widget.Calendar.prototype.clearAllBodyCellStyles=function(A){for(var B=0;B<this.cells.length;++B){YAHOO.util.Dom.removeClass(this.cells[B],A);}};YAHOO.widget.Calendar.prototype.setMonth=function(C){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;var B=this.cfg.getProperty(A);B.setMonth(parseInt(C,10));this.cfg.setProperty(A,B);};YAHOO.widget.Calendar.prototype.setYear=function(B){var A=YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;var C=this.cfg.getProperty(A);C.setFullYear(parseInt(B,10));this.cfg.setProperty(A,C);};YAHOO.widget.Calendar.prototype.getSelectedDates=function(){var C=[];var B=this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);for(var E=0;E<B.length;++E){var D=B[E];var A=new Date(D[0],D[1]-1,D[2]);C.push(A);}C.sort(function(G,F){return G-F;});return C;};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 A=navigator.userAgent.toLowerCase();if(A.indexOf("opera")!=-1){return"opera";}else{if(A.indexOf("msie 7")!=-1){return"ie7";}else{if(A.indexOf("msie")!=-1){return"ie";}else{if(A.indexOf("safari")!=-1){return"safari";}else{if(A.indexOf("gecko")!=-1){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(C,A,B){if(arguments.length>0){this.init(C,A,B);}};YAHOO.widget.CalendarGroup.prototype.init=function(C,A,B){this.initEvents();this.initStyles();this.pages=[];this.id=C;this.containerId=A;this.oDomContainer=document.getElementById(A);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(B){this.cfg.applyConfig(B,true);}this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);}};YAHOO.widget.CalendarGroup.prototype.setupConfig=function(){var A=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;this.cfg.addProperty(A.PAGES.key,{value:A.PAGES.value,validator:this.cfg.checkNumber,handler:this.configPages});this.cfg.addProperty(A.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});this.cfg.addProperty(A.SELECTED.key,{value:[],handler:this.configSelected});this.cfg.addProperty(A.TITLE.key,{value:A.TITLE.value,handler:this.configTitle});this.cfg.addProperty(A.CLOSE.key,{value:A.CLOSE.value,handler:this.configClose});this.cfg.addProperty(A.IFRAME.key,{value:A.IFRAME.value,handler:this.configIframe,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.MINDATE.key,{value:A.MINDATE.value,handler:this.delegateConfig});this.cfg.addProperty(A.MAXDATE.key,{value:A.MAXDATE.value,handler:this.delegateConfig});this.cfg.addProperty(A.MULTI_SELECT.key,{value:A.MULTI_SELECT.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.START_WEEKDAY.key,{value:A.START_WEEKDAY.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.SHOW_WEEKDAYS.key,{value:A.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_HEADER.key,{value:A.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.SHOW_WEEK_FOOTER.key,{value:A.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.HIDE_BLANK_WEEKS.key,{value:A.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:this.cfg.checkBoolean});this.cfg.addProperty(A.NAV_ARROW_LEFT.key,{value:A.NAV_ARROW_LEFT.value,handler:this.delegateConfig});this.cfg.addProperty(A.NAV_ARROW_RIGHT.key,{value:A.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});this.cfg.addProperty(A.MONTHS_SHORT.key,{value:A.MONTHS_SHORT.value,handler:this.delegateConfig});this.cfg.addProperty(A.MONTHS_LONG.key,{value:A.MONTHS_LONG.value,handler:this.delegateConfig});
this.cfg.addProperty(A.WEEKDAYS_1CHAR.key,{value:A.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_SHORT.key,{value:A.WEEKDAYS_SHORT.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_MEDIUM.key,{value:A.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});this.cfg.addProperty(A.WEEKDAYS_LONG.key,{value:A.WEEKDAYS_LONG.value,handler:this.delegateConfig});this.cfg.addProperty(A.LOCALE_MONTHS.key,{value:A.LOCALE_MONTHS.value,handler:this.delegateConfig});this.cfg.addProperty(A.LOCALE_WEEKDAYS.key,{value:A.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});this.cfg.addProperty(A.DATE_DELIMITER.key,{value:A.DATE_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(A.DATE_FIELD_DELIMITER.key,{value:A.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(A.DATE_RANGE_DELIMITER.key,{value:A.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});this.cfg.addProperty(A.MY_MONTH_POSITION.key,{value:A.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_YEAR_POSITION.key,{value:A.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_MONTH_POSITION.key,{value:A.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MD_DAY_POSITION.key,{value:A.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_MONTH_POSITION.key,{value:A.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_DAY_POSITION.key,{value:A.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MDY_YEAR_POSITION.key,{value:A.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_POSITION.key,{value:A.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_YEAR_POSITION.key,{value:A.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:this.cfg.checkNumber});this.cfg.addProperty(A.MY_LABEL_MONTH_SUFFIX.key,{value:A.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});this.cfg.addProperty(A.MY_LABEL_YEAR_SUFFIX.key,{value:A.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});};YAHOO.widget.CalendarGroup.prototype.initEvents=function(){var C=this;var E="Event";var B=function(G,J,F){for(var I=0;I<C.pages.length;++I){var H=C.pages[I];H[this.type+E].subscribe(G,J,F);}};var A=function(F,I){for(var H=0;H<C.pages.length;++H){var G=C.pages[H];G[this.type+E].unsubscribe(F,I);}};var D=YAHOO.widget.Calendar._EVENT_TYPES;this.beforeSelectEvent=new YAHOO.util.CustomEvent(D.BEFORE_SELECT);this.beforeSelectEvent.subscribe=B;this.beforeSelectEvent.unsubscribe=A;this.selectEvent=new YAHOO.util.CustomEvent(D.SELECT);this.selectEvent.subscribe=B;this.selectEvent.unsubscribe=A;this.beforeDeselectEvent=new YAHOO.util.CustomEvent(D.BEFORE_DESELECT);this.beforeDeselectEvent.subscribe=B;this.beforeDeselectEvent.unsubscribe=A;this.deselectEvent=new YAHOO.util.CustomEvent(D.DESELECT);this.deselectEvent.subscribe=B;this.deselectEvent.unsubscribe=A;this.changePageEvent=new YAHOO.util.CustomEvent(D.CHANGE_PAGE);this.changePageEvent.subscribe=B;this.changePageEvent.unsubscribe=A;this.beforeRenderEvent=new YAHOO.util.CustomEvent(D.BEFORE_RENDER);this.beforeRenderEvent.subscribe=B;this.beforeRenderEvent.unsubscribe=A;this.renderEvent=new YAHOO.util.CustomEvent(D.RENDER);this.renderEvent.subscribe=B;this.renderEvent.unsubscribe=A;this.resetEvent=new YAHOO.util.CustomEvent(D.RESET);this.resetEvent.subscribe=B;this.resetEvent.unsubscribe=A;this.clearEvent=new YAHOO.util.CustomEvent(D.CLEAR);this.clearEvent.subscribe=B;this.clearEvent.unsubscribe=A;};YAHOO.widget.CalendarGroup.prototype.configPages=function(K,J,G){var E=J[0];var C=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;var O="_";var L="groupcal";var N="first-of-type";var D="last-of-type";for(var B=0;B<E;++B){var M=this.id+O+B;var I=this.containerId+O+B;var H=this.cfg.getConfig();H.close=false;H.title=false;var A=this.constructChild(M,I,H);var F=A.cfg.getProperty(C);this._setMonthOnDate(F,F.getMonth()+B);A.cfg.setProperty(C,F);YAHOO.util.Dom.removeClass(A.oDomContainer,this.Style.CSS_SINGLE);YAHOO.util.Dom.addClass(A.oDomContainer,L);if(B===0){YAHOO.util.Dom.addClass(A.oDomContainer,N);}if(B==(E-1)){YAHOO.util.Dom.addClass(A.oDomContainer,D);}A.parent=this;A.index=B;this.pages[this.pages.length]=A;}};YAHOO.widget.CalendarGroup.prototype.configPageDate=function(H,G,E){var C=G[0];var F;var D=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;for(var B=0;B<this.pages.length;++B){var A=this.pages[B];if(B===0){F=A._parsePageDate(C);A.cfg.setProperty(D,F);}else{var I=new Date(F);this._setMonthOnDate(I,I.getMonth()+B);A.cfg.setProperty(D,I);}}};YAHOO.widget.CalendarGroup.prototype.configSelected=function(C,A,E){var D=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;this.delegateConfig(C,A,E);var B=(this.pages.length>0)?this.pages[0].cfg.getProperty(D):[];this.cfg.setProperty(D,B,true);};YAHOO.widget.CalendarGroup.prototype.delegateConfig=function(B,A,E){var F=A[0];var D;for(var C=0;C<this.pages.length;C++){D=this.pages[C];D.cfg.setProperty(B,F);}};YAHOO.widget.CalendarGroup.prototype.setChildFunction=function(D,B){var A=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);for(var C=0;C<A;++C){this.pages[C][D]=B;}};YAHOO.widget.CalendarGroup.prototype.callChildFunction=function(F,B){var A=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);for(var E=0;E<A;++E){var D=this.pages[E];if(D[F]){var C=D[F];C.call(D,B);}}};YAHOO.widget.CalendarGroup.prototype.constructChild=function(D,B,C){var A=document.getElementById(B);if(!A){A=document.createElement("div");A.id=B;this.oDomContainer.appendChild(A);
}return new YAHOO.widget.Calendar(D,B,C);};YAHOO.widget.CalendarGroup.prototype.setMonth=function(E){E=parseInt(E,10);var F;var B=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;for(var D=0;D<this.pages.length;++D){var C=this.pages[D];var A=C.cfg.getProperty(B);if(D===0){F=A.getFullYear();}else{A.setYear(F);}this._setMonthOnDate(A,E+D);C.cfg.setProperty(B,A);}};YAHOO.widget.CalendarGroup.prototype.setYear=function(C){var B=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;C=parseInt(C,10);for(var E=0;E<this.pages.length;++E){var D=this.pages[E];var A=D.cfg.getProperty(B);if((A.getMonth()+1)==1&&E>0){C+=1;}D.setYear(C);}};YAHOO.widget.CalendarGroup.prototype.render=function(){this.renderHeader();for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.render();}this.renderFooter();};YAHOO.widget.CalendarGroup.prototype.select=function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.select(A);}return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.selectCell=function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.selectCell(A);}return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.deselect=function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.deselect(A);}return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.deselectAll=function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.deselectAll();}return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.deselectCell=function(A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.deselectCell(A);}return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.reset=function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.reset();}};YAHOO.widget.CalendarGroup.prototype.clear=function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.clear();}};YAHOO.widget.CalendarGroup.prototype.nextMonth=function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.nextMonth();}};YAHOO.widget.CalendarGroup.prototype.previousMonth=function(){for(var B=this.pages.length-1;B>=0;--B){var A=this.pages[B];A.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.nextYear();}};YAHOO.widget.CalendarGroup.prototype.previousYear=function(){for(var B=0;B<this.pages.length;++B){var A=this.pages[B];A.previousYear();}};YAHOO.widget.CalendarGroup.prototype.getSelectedDates=function(){var C=[];var B=this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);for(var E=0;E<B.length;++E){var D=B[E];var A=new Date(D[0],D[1]-1,D[2]);C.push(A);}C.sort(function(G,F){return G-F;});return C;};YAHOO.widget.CalendarGroup.prototype.addRenderer=function(A,B){for(var D=0;D<this.pages.length;++D){var C=this.pages[D];C.addRenderer(A,B);}};YAHOO.widget.CalendarGroup.prototype.addMonthRenderer=function(D,A){for(var C=0;C<this.pages.length;++C){var B=this.pages[C];B.addMonthRenderer(D,A);}};YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer=function(B,A){for(var D=0;D<this.pages.length;++D){var C=this.pages[D];C.addWeekdayRenderer(B,A);}};YAHOO.widget.CalendarGroup.prototype.renderHeader=function(){};YAHOO.widget.CalendarGroup.prototype.renderFooter=function(){};YAHOO.widget.CalendarGroup.prototype.addMonths=function(A){this.callChildFunction("addMonths",A);};YAHOO.widget.CalendarGroup.prototype.subtractMonths=function(A){this.callChildFunction("subtractMonths",A);};YAHOO.widget.CalendarGroup.prototype.addYears=function(A){this.callChildFunction("addYears",A);};YAHOO.widget.CalendarGroup.prototype.subtractYears=function(A){this.callChildFunction("subtractYears",A);};YAHOO.widget.CalendarGroup.prototype.show=function(){this.oDomContainer.style.display="block";if(YAHOO.env.ua.opera){this._fixWidth();}};YAHOO.widget.CalendarGroup.prototype._setMonthOnDate=function(C,D){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(D<0||D>11)){var B=YAHOO.widget.DateMath;var A=B.add(C,B.MONTH,D-C.getMonth());C.setTime(A.getTime());}else{C.setMonth(D);}};YAHOO.widget.CalendarGroup.prototype._fixWidth=function(){var B=this.oDomContainer.offsetWidth;var A=0;for(var D=0;D<this.pages.length;++D){var C=this.pages[D];A+=C.oDomContainer.offsetWidth;}if(A>0){this.oDomContainer.style.width=A+"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(C,A,B){this.init(C,A,B);};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"});	

var w3c = (typeof window.XMLHttpRequest != 'undefined');
var ie = (typeof window.ActiveXObject != 'undefined');
var UseInfoDiv = true;
var ignoreSession = 0;
var XMLRequests = new Array();
var XMLRequestID = 0;

// Yui gobal settings
var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;

YAHOO.namespace ("flexvoetbal"); 

function GetXMLObject()
{
	var XMLObject = null;
	try {
		XMLObject = new XMLHttpRequest();
	} catch (e) {
		var MSXML_XMLHTTP_PROGIDS = new Array(
			'MSXML2.XMLHTTP.5.0',
			'MSXML2.XMLHTTP.4.0',
			'MSXML2.XMLHTTP.3.0',
			'MSXML2.XMLHTTP',
			'Microsoft.XMLHTTP'
			);
		
		XMLObject = null;
		var success = false;
		for (var i=0;i < MSXML_XMLHTTP_PROGIDS.length && !success; i++) {
			try {
				XMLObject = new ActiveXObject(MSXML_XMLHTTP_PROGIDS[i]);
				success = true;
			} catch (e) {}
		}
	}
	
	return XMLObject;
}

function CreateURLFromValues(ValuesArray, fromStart)
{
	if (typeof fromStart == 'undefined') fromStart = false;
	var URL = '';
	var j = 0;
	
	//for(var i in ValuesArray) alert(i + ' - ' + ValuesArray[i]);
	for(var i in ValuesArray){
		URL += (j == 0 && fromStart ? '?' : '&') + escapeURL(i) + '=';
		//check if array
		if(typeof ValuesArray[i][0] !== 'object'){
			URL += escapeURL(ValuesArray[i]);
		}else{
			for(j = 0; j < ValuesArray[i].length; j++) {
				if (j > 0) URL += ',';
				URL += escapeURL(ValuesArray[i][j]);
			}
		}
		j++
	}
	
	return URL;
}

function checkForm(message)
{
	aInput = document.getElementsByName('score1[]');
	bInput = document.getElementsByName('score2[]');
	
	tmp1 = false;
	tmp2 = false;
	
	for (var i = 0; i < aInput.length; i++) {
		if (aInput[i].value != '-1') {
			if (!aInput[i].value) {
				tmp1 = true;
				break;
			}
		}
	}
	
	for (var i = 0; i < bInput.length; i++) {
		if (bInput[i].value != '-1') {
			if (!bInput[i].value) {
				tmp2 = true;
				break;
			}
		}
	}
	
	if (tmp2 || tmp1) {
		alert(message);
		return false;
	} else {
		return true;
	}
}

function checkFormButSubmit(message)
{
	aInput = document.getElementsByName('score1[]');
	bInput = document.getElementsByName('score2[]');
	
	tmp1 = false;
	tmp2 = false;
	
	for (var i = 0; i < aInput.length; i++) {
		if (aInput[i].value != '-1') {
			if (!aInput[i].value) {
				tmp1 = true;
				break;
			}
		}
	}
	
	for (var i = 0; i < bInput.length; i++) {
		if (bInput[i].value != '-1') {
			if (!bInput[i].value) {
				tmp2 = true;
				break;
			}
		}
	}
	
	if (tmp2 || tmp1) {
		var agree = confirm(message);
		if (agree) {
			return true;
		} else {
			return false;
		}
	} else {
		return true;
	}
}

function GiveWarning(message, formname)
{
	var agree = confirm(message);
	if (agree) {
		document.formname[0].submit;
		//document.predictionform.submit();
		return true;
	} else {
		return false;
	}
}

function disableForminput(inputid, fvalue)
{
	if (fvalue > 0 || fvalue == -1 || fvalue == -2 || fvalue == '') {
		Dom.get(inputid).disabled=true;
		Dom.get(inputid).style.background = '#D4D0C8';
	} else {
		Dom.get(inputid).disabled=false;
		Dom.get(inputid).style.background = '#FFFFFF';
	}
}

function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
 	var IsNumber = true;
 	var Char;
	
	for (i = 0; i < sText.length && IsNumber == true; i++) 
  { 
  	Char = sText.charAt(i); 
  	if (ValidChars.indexOf(Char) == -1) {
    	IsNumber = false;
    }
	}
 	return IsNumber;
}

function checkStats()
{
	goalsInput = document.getElementsByName('goals');
	yellowInput = document.getElementsByName('yellow');
	redInput = document.getElementsByName('red');
	goals = false;
	yellow = false;
	red = false;
	
	if (goalsInput.value) {
		if (IsNumeric(goalsInput.value)) {
			alert('Please fill in a numeric value for the Total Goals');
			goals = true;
			return true;
		}
	} 
	if (yellowInput.value) {
		if (IsNumeric(yellowInput.value)) {
			alert('Please fill in a numeric value for the Yellow Cards');
			yellow = true;
			return true;
		}
	}
	if (redInput.value) {
		if (IsNumeric(redInput.value)) {
			alert('Please fill in a numeric value for Red Cards');
			red = true;
			return true;
		}
	}
	
	return false;
}

function CheckDelete(message) {
	if (!message) message = 'Are you sure you want to delete this?';
	if (confirm(message)) {
		return true;
	} else {
		return false;
	}
}

function ToggleDiv(Name, RoundID)
{
	if (typeof RoundID !== 'string') RoundID = 0;
	
	//close all other div's
	var oSel = document.getElementsByTagName('FORM');  if (!oSel.length) return false;
	
	var countRounds = 0;
	for (var i = 0; i < oSel.length; i++) {
		if (oSel[i].name == 'predictionform')	 {
			aDiv = oSel[i].getElementsByTagName('DIV'); if (!aDiv.length) return false;
			for (j = 0; j < aDiv.length; j++) {
				if (aDiv[j].className == 'rounddiv') {
					countRounds++;
					//close all
					aDiv[j].style.display = 'none';
				}
			}
			aSpan = oSel[i].getElementsByTagName('A'); if (!aSpan.length) return false;
			for (j = 0; j < aSpan.length; j++) {
				if (aSpan[j].title == 'roundnumbers')	 {
					//close all
					aSpan[j].className = '';
				}
			}
			//open right one
			if (Dom.get(Name)) {
				Dom.get(Name).style.display = 'inline';
				if (RoundID > 0) {
					if (Dom.get('headertitleround')) {
						Dom.get('headertitleround').innerHTML = '';
						Dom.get('headertitleround').innerHTML = RoundID;
					}
				}
			}
		}
	}
	
	//add class to span of roundid
	if (Dom.get('span_'+RoundID)) {
		Dom.get('span_'+RoundID).className = 'red';
	}
	
	if (Dom.get('headertitleround')) {
		var headertitle = Dom.get('headertitleround').innerHTML;
	} else {
		var headertitle = '';
	}
	var headertitlestripped = headertitle.replace(/(<([^>]+)>)/ig,"");
	if (headertitlestripped.length > 2) {
		tmpArray = headertitlestripped.split(' ');
		nbr = tmpArray[0];
		if (nbr == 1) {
			if (Dom.get('prevlink')) {
				Dom.get('prevlink').className = 'hide';
			}
		} else if (nbr == countRounds) {
			if (Dom.get('nextlink')) {
				Dom.get('nextlink').className = 'hide';
			}
		} else {
			if (Dom.get('prevlink')) {
				Dom.get('prevlink').className = 'pround';
			}
			if (Dom.get('nextlink')) {
				Dom.get('nextlink').className = 'nround';
			}
		}
	} else {
		nbr = headertitlestripped;
		if (nbr == 1) {
			if (Dom.get('prevlink')) {
				Dom.get('prevlink').className = 'hide';
			}
			if (Dom.get('nextlink')) {
				Dom.get('nextlink').className = 'nround';
			}
		} else if (nbr == countRounds) {
			if (Dom.get('prevlink')) {
				Dom.get('prevlink').className = 'pround';
			}
			if (Dom.get('nextlink')) {
				Dom.get('nextlink').className = 'hide';
			}
		} else {
			if (Dom.get('prevlink')) {
				Dom.get('prevlink').className = 'pround';
			}
			if (Dom.get('nextlink')) {
				Dom.get('nextlink').className = 'nround';
			}
		}
	}
}

function TogglePrevDiv(roundID)
{
	if (Dom.get('headertitleround')) {
		var headertitle = Dom.get('headertitleround').innerHTML;
	} else {
		var headertitle = '';
	}
	var headertitlestripped = headertitle.replace(/(<([^>]+)>)/ig,""); 
	
	//create array if there are spaces
	if (headertitlestripped.length > 2) {
		tmpArray = headertitlestripped.split(' ');
		nbr = tmpArray[tmpArray.length];
	} else {
		nbr = headertitlestripped;
	}
	//get last one
	newRound = 'round_'+(Math.round(nbr) - 1);

	ToggleDiv(newRound, ''+(Math.round(nbr) - 1)+'');
}

function ToggleTodoItem(TodoItem)
{
	if (Dom.get('TodoExtra_'+TodoItem)) {
		if (Dom.get('TodoExtra_'+TodoItem).style.display == 'none') {
			Dom.get('TodoExtraImage_'+TodoItem).src = '/gfx/icons/fold_up.gif';
			if (ie) {
				Dom.get('TodoExtra_'+TodoItem).style.display = 'inline';
				Dom.get('TodoExtra_'+TodoItem+'_td').style.display = 'inline';
			} else {
				Dom.get('TodoExtra_'+TodoItem).style.display = 'table-row';
				Dom.get('TodoExtra_'+TodoItem+'_td').style.display = 'table-cell';
				Dom.get('TodoExtra_'+TodoItem+'_td').setAttribute('colspan','8');
			}
		} else {
			Dom.get('TodoExtraImage_'+TodoItem).src = '/gfx/icons/fold_down.gif';
			if (ie) {
				Dom.get('TodoExtra_'+TodoItem).style.display = 'none';
				Dom.get('TodoExtra_'+TodoItem+'_td').style.display = 'none';
			} else {
				Dom.get('TodoExtra_'+TodoItem).style.display = 'none';
			}
		}
	}
}

function ToggleNextDiv(roundID)
{
	if (Dom.get('headertitleround')) {
		var headertitle = Dom.get('headertitleround').innerHTML;
	} else {
		var headertitle = '';
	}
	var headertitlestripped = headertitle.replace(/(<([^>]+)>)/ig,""); 
	
	//create array if there are spaces
	if (headertitlestripped.length > 2) {
		tmpArray = headertitlestripped.split(' ');
		nbr = tmpArray[tmpArray.length-1];
	} else {
		nbr = headertitlestripped;
	}
	//get last one
	newRound = 'round_'+(Math.round(nbr) + 1);

	ToggleDiv(newRound, ''+(Math.round(nbr) + 1)+'');
}

function ToggleStats(divID)
{
	if (Dom.get(divID).style.display == 'inline') {
		Dom.get(divID).style.display = 'none';
		Dom.get('statsround').className = '';
	} else {
		Dom.get(divID).style.display = 'inline';
		Dom.get('statsround').className = 'red';
	}
}

function AutoOpenDiv(roundID)
{
	if (Dom.get('round_'+roundID)) {
		//open div of this round
		Dom.get('round_'+roundID).style.display = 'inline';
		if (Dom.get('span_'+roundID)) {
			Dom.get('span_'+roundID).className = 'red';
		}
	}
	//open next div as well
	if (Dom.get('round_'+(roundID+1))) {
		Dom.get('round_'+(roundID+1)).style.display = 'inline';
		if (Dom.get('span_'+(roundID+1))) {
			Dom.get('span_'+(roundID+1)).className = 'red';
		}
		if (Dom.get('headertitleround')) {
			Dom.get('headertitleround').innerHTML = roundID+' & '+(roundID+1);
		}
	}
	if (Dom.get('headertitleround')) {
		var headertitle = Dom.get('headertitleround').innerHTML;
	} else {
		var headertitle = '';
	}
	var headertitlestripped = headertitle.replace(/(<([^>]+)>)/ig,""); 
	if (headertitlestripped.length > 2) {
		tmpArray = headertitlestripped.split(' ');
		nbr = tmpArray[0];
		if (nbr == 1) {
			if (Dom.get('prevlink')) {
				Dom.get('prevlink').className = 'hide';
			}
		} else if (nbr == 34) {
			if (Dom.get('nextlink')) {
				Dom.get('nextlink').className = 'hide';
			}
		}
	} 
	//toggle images as well
	//Dom.get('image_round_'+roundID).className = 'foldy_up';
	//Dom.get('image_round_'+(roundID+1)).className = 'foldy_up';
}

function checkKeyForm(evt)
{
	if (evt.keyCode == 13) {
		return false;
	} else {
		return true;
	}
}

function checkKeyCommunity(evt, page, CID, profileID, gameID, Lan) 
{
	//check if event is passed (has to in FireFox, does not in IE)
	//if (!evt) var evt = window.event;
	
	if (evt.keyCode == 13) {
		SearchCommunityIndex(page, CID, profileID, gameID, Lan);
		return false;
	} else {
		return true;
	}
}

function checkKeyCommunityAdmin(evt, page, profileID, gameID, Lan)
{
	//check if event is passed (has to in FireFox, does not in IE)
	//if (!evt) var evt = window.event;
	
	if (evt.keyCode == 13) {
		SearchCommunity(page, profileID, gameID, Lan)
		return false;
	} else {
		return true;
	}
}

function checkKeyFaq(evt, gameID, Lan) 
{
	//check if event is passed (has to in FireFox, does not in IE)
	//if (!evt) var evt = window.event;
	
	if (evt.keyCode == 13) {
		SearchMember(page, CID, profileID, gameID, Lan);
		return false;
	} else {
		return true;
	}
}

function SetLanguage(redirecturl, lan)
{
	var URLe = '&language='+lan;
	
	getContentXML('index', 'setLanguage', '', URLe);
}

function drawContentXML(XMLObject)
{
	var dataXML = false;
	var DataDivContent = false;
	if (XMLObject.responseXML) {
		dataXML = XMLObject.responseXML.getElementsByTagName('Data');
	}
		
	if (dataXML.length > 0) {
		for (i = 0; i < dataXML.length; i++) {
			DataContent = unescape(dataXML.item(i).attributes.getNamedItem('Content').value);
			drawContent = DataContent;
			if (dataXML.item(i).attributes.getNamedItem('DivID')) {
				DivID = dataXML.item(i).attributes.getNamedItem('DivID').value;
				DataContent = unescape(dataXML.item(i).attributes.getNamedItem('DivContent').value);
				//draw the content in the appropiate div
				if (Dom.get(DivID)) {
					Dom.get(DivID).innerHTML = '';
					Dom.get(DivID).innerHTML = DataContent;
				}
				DataDivContent = true;
			}
			if (dataXML.item(i).attributes.getNamedItem('RunScript')) {
				DataScript = unescape(dataXML.item(i).attributes.getNamedItem('RunScript').value);
				//eval the script action
				eval(DataScript);
				
				//if no DivID is passed through
				if (!dataXML.item(i).attributes.getNamedItem('DivID')) {
					DataDivContent = true;
				}
			}
			
		}
	}

	if (!DataDivContent) {
		if (Dom.get('datadiv')) {
			Dom.get('datadiv').innerHTML = '';
			Dom.get('datadiv').innerHTML = drawContent;	
		}
	}
}

function getContentXML(module, submodule, server, URLe, CallWhenDone, refreshBanner)
{
	if (typeof server == 'undefined') server = '';
	if (typeof URLe == 'undefined') URLe = '';
	if (typeof CallWhenDone == 'undefined') CallWhenDone = false;
	if (typeof refreshBanner == 'undefined') refreshBanner = true;
	
	if (URLe.length > 0) {
		URL = '/custom/getContentXML.php?A=S&module=' + module + '&submodule=' + submodule + URLe + '';
	} else {
		URL = '/custom/getContentXML.php?A=S&module=' + module + '&submodule=' + submodule +'';
	}
	
	if (URL.length > 20) {
		urlSplit = URL.split('?');
		URL = urlSplit[0];
		if (typeof PostString !== 'string') PostString = '';
		PostString = urlSplit[1];
	}
	
	var XMLObject = GetXMLObject();
	XMLObject.open('POST', URL, true);
	XMLObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	XMLObject.onreadystatechange = function() {
		if (XMLObject.readyState == 4) {
			drawContentXML(XMLObject);
			//run callwhendone
			if (CallWhenDone && CallWhenDone.length > 0) {
				eval(CallWhenDone);
			}
		}
	}
	
	XMLObject.send(PostString);
	
	refreshBanner = false; //turned off now
	if (refreshBanner) {
		//reload banners
		refreshAd('topbanner');
		refreshAd('hpbanner_rect');
	}
	
	//set google analytics
	if (typeof urchinTracker == 'function') {
		if (typeof googleAnalyticsMapping[submodule+'_'+module] !== 'undefined') { //if mapping is defined use it for google analytics
			urchinTracker(googleAnalyticsMapping[submodule+'_'+module]);
		} else {
			urchinTracker("ContentXML: "+submodule+" ("+module+")");	
		}
	}
}

function refreshAd(iframeID) 
{
	if (iframeID == 'topbanner') {
		if (Dom.get('topbanner')) {
			topbanner.location.reload(true);
		}
	} else if (iframeID == 'hpbanner_rect') {
		if (Dom.get('hpbanner_rect')) {
			hpbanner_rect.location.reload(true);	
		}
	}
	
	return true;
}

//returns the array number of the selected radio button or -1 if no button is selected
function getSelectedRadio(buttonGroup) 
{
  if (buttonGroup[0]) { //if the button group is an array (one button is not an array)
  	for (var i=0; i<buttonGroup.length; i++) {
    	if (buttonGroup[i].checked) {
      	return i;
      }
    }
  } else {
  	if (buttonGroup.checked) { //if the one button is checked, return zero
  		return 0; 
  	}
  }
  //if we get to this point, no radio button is selected
	return -1;
}

//returns the value of the selected radio button or "" if no button is selected
function getSelectedRadioValue(buttonGroup) 
{
	var i = getSelectedRadio(buttonGroup);
  if (i == -1) {
  	return "";
  } else {
  	if (buttonGroup[i]) { //Make sure the button group is an array (not just one button)
    	return buttonGroup[i].value;
    } else { //The button group is just the one button, and it is checked
    	return buttonGroup.value;
    }
	}
}

//Go through all the check boxes. return an array of all the ones
//that are selected (their position numbers). if no boxes were checked,
//returned array will be empty (length will be zero)
function getSelectedCheckbox(buttonGroup) 
{
	var retArr = new Array();
  var lastElement = 0;
  if (buttonGroup[0]) { //if the button group is an array (one check box is not an array)
	  for (var i=0; i<buttonGroup.length; i++) {
  		if (buttonGroup[i].checked) {
      	retArr.length = lastElement;
        retArr[lastElement] = i;
        lastElement++;
      }
   	}
	} else { //There is only one check box (it's not an array)
  	if (buttonGroup.checked) { //if the one check box is checked
    	retArr.length = lastElement;
      retArr[lastElement] = 0; //return zero as the only array value
    }
  }
  
  return retArr;
}

//return an array of values selected in the check box group. if no boxes
//were checked, returned array will be empty (length will be zero)
function getSelectedCheckboxValue(buttonGroup) 
{
	var retArr = new Array(); // set up empty array for the return values
  var selectedItems = getSelectedCheckbox(buttonGroup);
  if (selectedItems.length != 0) { // if there was something selected
  	retArr.length = selectedItems.length;
    for (var i=0; i<selectedItems.length; i++) {
    	if (buttonGroup[selectedItems[i]]) { // Make sure it's an array
      	retArr[i] = buttonGroup[selectedItems[i]].value;
      } else { // It's not an array (there's just one check box and it's selected)
      	retArr[i] = buttonGroup.value;// return that value
      }
    }
	}
	
	return retArr;
}

function generalToggle(ID, Setting)
{
	if (typeof Setting === 'undefined')	Setting = false;
	
	if (Setting) {
		if (Dom.get(ID)) {
			if (Dom.get(ID).style.display == Setting) {
				Dom.get(ID).style.display = Setting;
			} else {
				Dom.get(ID).style.display = Setting;
			}
		}
	} else {
		if (Dom.get(ID)) {
			if (Dom.get(ID).style.display == 'inline') {
				Dom.get(ID).style.display = 'none';
			} else {
				Dom.get(ID).style.display = 'inline';
			}
		}
	}
}

function generalToggleRows(ID)
{
	if (document.getElementsByName(ID)) {
		var rows = document.getElementsByName(ID);
		for (var i=0; i<rows.length; i++) {
			if (rows[i].style.display == 'inline') {
				rows[i].style.display = 'none';	
			} else {
				rows[i].style.display = 'inline';	
			}
		}
	}
}

function ToggleTodo(idname)
{
	if (Dom.get(idname)) {
		if (Dom.get(idname).style.display == 'none') {
			Dom.get(idname).style.display = 'inline';
		} else {
			Dom.get(idname).style.display = 'none';
		}
	}
}

//The Javascript escape and unescape functions do not correspond
//with what browsers actually do...
function URLEncode(plaintext)
{
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()€";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	}

	return encoded;
};

// Replace + with ' '
// Replace %xx with equivalent character
// Put [ERROR] in output if %xx is invalid.
function URLDecode(encoded)
{
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	}
   
   return plaintext;
};

function centerElement(elementID, centerHorizontal, centerVertical, scrollToTop, centerOnParent, extraVer, extraHor)
{
	if (Dom.get(elementID)) {
		if (typeof centerHorizontal === 'undefined' ||  centerHorizontal === false)	centerHorizontal = true;
		if (typeof centerVertical === 'undefined' ||  centerVertical === false)		centerVertical = true;
		if (typeof scrollToTop === 'undefined' ||  scrollToTop === false)				scrollToTop = true;
		if (typeof centerOnParent === 'undefined' ||  centerOnParent === false)		centerOnParent = false;
		if (typeof extraHor === 'undefined')		extraHor = 0;
		if (typeof extraVer === 'undefined')		extraVer = 0;
		
		theElement = Dom.get(elementID);
		if (scrollToTop) window.scrollTo(0,0);
		if (theElement) {
			if (!scrollToTop) {
				var scrollPositions = getWindowScrollPositions();
			}
			
			if (centerHorizontal) {
				var screenW = (centerOnParent ? theElement.parentNode.clientWidth : document.body.clientWidth);
				var pixelLeft = (screenW / 2) - (getDivWidth(elementID) / 2);
				if (!scrollToTop) pixelLeft += scrollPositions['Left'];
				pixelLeft = pixelLeft + extraHor;
				theElement.style.left = pixelLeft + 'px';
			}
			
			if (centerVertical) {
				var screenH = (centerOnParent ? theElement.parentNode.clientHeight : document.body.clientHeight);
				var pixelTop = (screenH / 2) - (getDivHeight(elementID) / 2);
				if (!scrollToTop) pixelTop += scrollPositions['Top'];
				//we have to take of 250 because of the top menu
				pixelTop = 250 + extraVer;
				theElement.style.top = pixelTop + 'px';
			}
		}
	}
}

function getWindowScrollPositions()
{
	var scrollPositions = new Array();
	
	var scrollX = 0, scrollY = 0;
	if (document.all) {
		if (!document.documentElement.scrollLeft) {
			scrollX = document.body.scrollLeft;
		} else {
			scrollX = document.documentElement.scrollLeft;
		}
		
		if (!document.documentElement.scrollTop) {
			scrollY = document.body.scrollTop;
		} else {
			scrollY = document.documentElement.scrollTop;
		}
	} else {
		scrollX = window.pageXOffset;
		scrollY = window.pageYOffset;
	}

	scrollPositions['X'] = scrollX;
	scrollPositions['Y'] = scrollY;
	scrollPositions['Left'] = scrollX;
	scrollPositions['Top'] = scrollY;
	
	return scrollPositions;
}

function GetScrollbarWidth()
{
	var rv = document.body.offsetWidth - document.body.clientWidth - (2 * document.body.clientLeft);
	/*
	if (ie) {
		var rv = document.body.offsetWidth - document.body.clientWidth - (2 * document.body.clientLeft);
	} else {
		document.body.style.overflow = 'hidden';
		var BodyWidth = cssToNumber(document.body.offsetWidth);
		document.body.style.overflow = 'scroll';
		var rv = BodyWidth - cssToNumber(document.body.offsetWidth);
		document.body.style.overflow = 'auto';
	}
	*/
	return rv;
}

// Should return the div actual width.
function getDivWidth(divId)
{
	return cssToNumber(Dom.get(divId).offsetWidth);
}

// Should return the div actual height.
function getDivHeight(divId)
{
	return cssToNumber(Dom.get(divId).offsetHeight);
}

function cssToNumber(cssString)
{
	if(typeof cssString == 'number') {
		return cssString;
	} else {
		if (cssString.substr(cssString.length - 2) == 'px') {
			return Math.round(cssString.substr(0, cssString.length - 2));
		} else {
			return Math.round(cssString);
		}
	}
}

function ClearAndCloseDiv(formElement, divID, exeptions)
{
	if (typeof exeptions === 'undefined') exeptions = false;
	
	if (Dom.get(divID)) {
		var oSel = document.getElementsByTagName(formElement);  if (!oSel.length) return false;
		for (var i = 0; i < oSel.length; i++) {
			if (oSel[i].id == divID)	 {
				//clear inputs
				var oInput = document.getElementsByTagName('INPUT');
				for (var j = 0; j < oInput.length; j++) {
					//only clear the text
					if (oInput[j].type == 'text') { 
						oInput[j].value = '';	
					}
				}
				//todo, clear more like radio, select
			}
		}
		//set display on none of div
		Dom.get(divID).style.display = 'none';
	}
}

function clearDiv(divID)
{
	if (Dom.get(divID)) {
		Dom.get(divID).innerHTML = '';
	}
}

function in_array(needle, haystack) {
	var found = false;
	var i = 0;
	while (i<haystack.length) {
		if (needle == haystack[i]) {
			found=true;
		}
		i++;
	}
	return found;
}

function trim(value) {
  if(!value || value.length == 0) {
  	return "";
  }
  else {
  	value = value.replace(/^\s+/,'');
  	value = value.replace(/\s+$/,'');
  	return value;
  }
}

function isOdd(num){
	return(num%2)==1;
}

function isEven(num){
	return(num%2)==0;
}

function leftTrim(sString) 
{
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	return sString;
}

function addsplittoarray(a, s)
{
	newArray = new Array();
	for (i = 0; i < a.length; i++) {
		tmp = a[i];
		tmp += s;
		//alert('tmp => ' + tmp);
		newArray[i] = tmp;
	}
	
	return newArray;
}

function createUrlFromMultipleInput(inputName, typeIDs, addDisabled, setValue)
{
	if (typeof addDisabled === 'undefined')	addDisabled = false;
	if (typeof setValue === 'undefined')	setValue = false;
	
	var rv = '';
	var idvalues = '';
	var iValues = document.getElementsByName(inputName);
	
	for (i = 0; i < iValues.length; i++) {
		if (addDisabled) {
			if (setValue) {
				if (iValues[i].value.length) {
					rv+= '&'+iValues[i].name+'_'+iValues[i].id+'='+escape(iValues[i].value)
					idvalues+= iValues[i].id+',';
				}
			} else {
				rv+= '&'+iValues[i].name+'_'+iValues[i].id+'='+escape(iValues[i].value)
				idvalues+= iValues[i].id+',';
			}
		} else {
			if (!iValues[i].disabled) {
				if (setValue) {
					if (iValues[i].value.length) {
						rv+= '&'+iValues[i].name+'_'+iValues[i].id+'='+escape(iValues[i].value)
						idvalues+= iValues[i].id+',';
					}
				} else {
					rv+= '&'+iValues[i].name+'_'+iValues[i].id+'='+escape(iValues[i].value)
					idvalues+= iValues[i].id+',';
				}
			}
		}
	}

	
	rv+= '&'+typeIDs+'='+idvalues;
	
	return rv;
}

function createUrlFromMultipleInputCheckbox(inputName, typeIDs, addDisabled)
{
	if (typeof addDisabled === 'undefined')	addDisabled = false;
	
	var rv = '';
	var idvalues = '';
	var iValues = document.getElementsByName(inputName);
	
	for (i = 0; i < iValues.length; i++) {
		if (addDisabled) {
			if (iValues[i].checked == true) {
				rv+= '&'+iValues[i].name+'_'+iValues[i].id+'='+escape(iValues[i].value)
				idvalues+= iValues[i].id+',';	
			}
		} else {
			if (!iValues[i].disabled) {
				if (iValues[i].checked == true) {
					rv+= '&'+iValues[i].name+'_'+iValues[i].id+'='+escape(iValues[i].value)
					idvalues+= iValues[i].id+',';
				}
			}
		}
	}
	
	rv+= '&'+typeIDs+'='+idvalues;
	
	return rv;
}

var CLIFinished = false;
function CLIProgress(subDir, CLISettings)
{
	if (CLIFinished === false) {
		CLIFinished = setTimeout("StartCLIProgress(\"" + subDir + "\", \"" + CLISettings + "\");", 100); // pause for 100 ms
	} else {
		return false;		
	}
}

function StartCLIProgress(subDir, CLISettings)
{
	var URLe = '&subDir='+subDir+'&CLISettings='+CLISettings;
	
	getContentXML('index', 'getCLIProgress', '', URLe, 'CLIProgress(\'' + subDir + '\', \'' + CLISettings + '\');');
}

function AddStyleSheet(siteURL)
{
	if (siteURL.indexOf('ere') === 0) {
		Dom.get('stylesheetID').href = '/css/ere.css';
	} else if (siteURL.indexOf('champions') === 0) {
		Dom.get('stylesheetID').href = '/css/cl.css';
	} else {
		Dom.get('stylesheetID').href = '/css/ere.css';
	}
}

/////////////////////////////////////////////////////
// Ajax IMG Uploader											         //
// Version 2.0                             				 //		
// Author: Arjen Weeber													   // 
// Usage: YAHOO.flexvoetbal.imgUploader.init({     //
//		 targetObj:['userpic'],											 //			
//		 targetSize:[150],													 //
//		 uploadType:'profile',											 //
//		 userId:4}																	 //		
//		 );																					 //	
/////////////////////////////////////////////////////

YAHOO.flexvoetbal.imgUploader = {
	
	config: {
		targetObj				: [],
		uploadTemplate	: "/custom/getContentXML.php?A=S&module=index&submodule=getUploadForm",
		rawHTMLTemplate	: "",
		targetSize			: [],
		imageScaler			: "/custom/show_image.php?filename=",
		uploadlayerId		: "iUploadLayer",
		uploadContainer : "overlayContent",
		uploadType			: null,
		uploadUrl				: "/custom/upload_handler.php",
		uploadFolder		: "",
		tempFileName		: "",
		formId					: "iUploader",
		formStatusId		: "uStatus",
		formFileInputId	: "iFilename",
		formUserId			: "userID",
		formCommunityId	: "communityID",
		formUdpId			  : "udpID",
		formPrizeId			: "prizeID",
		formPrizeInput	: "prizeImage",
		formSubmitButton: "upbutton",
		formModuleId		: "uploadModule",
		userId					: "",
		udpId						: "",
		communityId			: "",
		useOverlay			: true
	},
	
	init: function(config) {
		this.config.targetObj			= config.targetObj;
		this.config.targetSize 		= config.targetSize;
		this.config.uploadType		= config.uploadType;
		this.config.uploadFolder 	= this.getUploadFolder();
		this.config.userId 				= config.userId;
		this.config.udpId 				= config.udpId;
		this.config.communityId 	= config.communityId;
		
		drawOverlay(false,"400px","160px", "image uploader");
		
		// create upload container & append it to #sitebox
		//var uploadFormContainer = document.createElement("div");
		//uploadFormContainer.setAttribute("id", this.config.uploadContainer);
		//Dom.get("sitebox").appendChild(uploadFormContainer);
		
		this.getUploadForm();
		
	},
	
	getUploadFolder: function() {
		var rv;
		switch(this.config.uploadType) {
			case "profile":
				rv = "upload";
			break;
			
			case "udp":
				rv = "upload/udp"
			break
			
			case "community":
				rv = "upload/community"
			break;
			case "prize":
				rv = "prizes"
			break;
		}	
		return rv;
	},
	
	getUploadForm: function() {
		
			var callback = { 
				success: function(o) {
					var uploadFormHTML = o.responseXML.getElementsByTagName("Data")[0].getAttribute("DivContent");
					o.argument[0].config.rawHTMLTemplate = uploadFormHTML;
					o.argument[0].drawUploadForm();
				}, 
			  failure: function(o) {
			  	// could not load template
			
			 	},
			 	argument: [this]
			};
			var transaction = YAHOO.util.Connect.asyncRequest('GET', this.config.uploadTemplate, callback,null);	
		
	},
	
	setUploadForm: function() {
		// set form inputs
	
		switch(this.config.uploadType) {
			case "profile":
				Dom.get(this.config.formUserId).value = this.config.userId;
			break;
				
			case "udp":
				Dom.get(this.config.formUdpId).value = this.config.udpId;
			break
			
			case "community":
				Dom.get(this.config.formCommunityId).value = this.config.communityId;
			break;
			
			case "prize":		
			break;	
		}
		
		// set form upload controls
		//var closeControl = Dom.getElementsByClassName("close", "img", this.config.uploadlayerId)[0];
		//Event.addListener(closeControl, "click", this.closeUploadForm,this.config);
		
		// set upload type (module)
		var formModule = Dom.get(this.config.formModuleId);
		formModule.value = this.config.uploadType;
		
		// disable default form behaviour
		var uploadForm = Dom.get(this.config.formId);
		Event.addListener(uploadForm, "submit", function(e) { Event.preventDefault(e);});
		
		// attach upload event handler
		var uploadButton = Dom.get(this.config.formSubmitButton);
		Event.addListener(uploadButton, "click", this.uploadImage, this);
		
	},
	
	drawUploadForm: function() {
		Dom.get(this.config.uploadContainer).innerHTML = unescape(this.config.rawHTMLTemplate);
		this.setUploadForm();
	},
	
	uploadImage : function(ev,uObj) {

		if(Dom.get(uObj.config.formFileInputId).value == "") {
				var statusDiv = Dom.get(uObj.config.formStatusId);
				statusDiv.innerHTML = "Selecteer eerst een bestand";
				statusDiv.style.color = "red";
		}
		else {
				
			var callback = 
			{ 
				upload: function(o) {
					var statusDiv = Dom.get(o.argument[0].config.formStatusId);
					statusDiv.innerHTML = "Upload succesvol voltooid";
					statusDiv.style.color = "green";
					
					// set new image(s)
					var urlString = Dom.get(o.argument[0].config.formFileInputId).value.split('\\');
					o.argument[0].config.tempFileName = urlString[urlString.length -1];
					o.argument[0].setNewImage();
				
					// close uploadForm
					if(o.argument[0].config.useOverlay) {
						YAHOO.flexvoetbal.overlayPanel.close();
					}
					else {
						o.argument[0].closeUploadForm();
					}
					
					}, 
			  failure: function(o) {
			  	var statusDiv = Dom.get(o.argument[0].formStatusId);
					statusDiv.innerHTML = "Upload mislukt";
					statusDiv.style.color = "red";
			 	},
			 	
			 	argument:[uObj] 
			 
			 }
			YAHOO.util.Connect.setForm(Dom.get("iUploader"), true);
			var transaction = YAHOO.util.Connect.asyncRequest('POST', uObj.config.uploadUrl, callback);  
		}
	},
	
	setNewImage : function() {
			switch(this.config.uploadType) {
				case "profile":
					var nFile = this.config.userId + "." + this.config.tempFileName.split(".")[1];
					var profileImage = Dom.get(this.config.targetObj[0]);
					var personalStatsImage = Dom.get(this.config.targetObj[1]);
					if(profileImage) {
							profileImage.setAttribute("src", this.config.imageScaler + this.config.uploadFolder + "/" + nFile + "&width=" + this.config.targetSize[0]);
					}
					if(personalStatsImage) {
						Dom.setStyle(personalStatsImage, "background-image", "url(" + this.config.imageScaler + this.config.uploadFolder + "/" + nFile + "&width=" + this.config.targetSize[1] + ")");
					}
				break;
					
				case "udp":
					var nFile = this.config.udpId +  "." + this.config.tempFileName.split(".")[1];
					var updImage = Dom.get(this.config.targetObj[0]);
					var udpSettingImage = Dom.get(this.config.targetObj[1]);
					if(updImage) {
							updImage.setAttribute("src", this.config.imageScaler + this.config.uploadFolder + "/" + nFile + "&width=" + this.config.targetSize[0]);
					}
					if(udpSettingImage) {
							udpSettingImage.setAttribute("src", this.config.imageScaler + this.config.uploadFolder + "/" + nFile + "&width=" + this.config.targetSize[1]);
					}	
				break
				
				case "community":
					var nFile = this.config.communityId + "." + this.config.tempFileName.split(".")[1];
					var communityImage = Dom.get(this.config.targetObj[0]);
					var communitySettingImage = Dom.get(this.config.targetObj[1]);
					if(communityImage) {
							communityImage.setAttribute("src", this.config.imageScaler + this.config.uploadFolder + "/" + nFile + "&width=" + this.config.targetSize[0]);
					}
					if(communitySettingImage) {
							communitySettingImage.setAttribute("src", this.config.imageScaler + this.config.uploadFolder + "/" + nFile + "&width=" + this.config.targetSize[1]);
					}	
				break;
				case "prize":
					var nFile = this.config.tempFileName;
					var prizeInput = Dom.get(this.config.formPrizeInput);
					if(prizeInput) {
						prizeInput.value = 	this.config.uploadFolder + "/" + nFile;
					}
				break;	
			};
	},
	
	closeUploadForm : function(ev, uConfig) {
		
		// remove uploadform from DOM
		if(this.config) {
			uConfig = this.config;	
		}
		var uploadContainer = Dom.get(uConfig.uploadContainer);
		uploadContainer.parentNode.removeChild(uploadContainer);
	}

}

/////////////////////////////////////////////////////
// END Ajax IMG Uploader											     //	
/////////////////////////////////////////////////////

/////////////////////////////////////////////////////
// HTML TABS                                       //
// Version: 2.0                                    //
/////////////////////////////////////////////////////

var mpTabInit = function() {	
		var tabcontrols = Dom.getElementsByClassName("tabcontrol", "a", "mp_tabs");
		var disableLink =  function(e) {
			Event.preventDefault(e);
		}
		for(var i=0; i<tabcontrols.length; i++) {
		// set tabswitch controls
		Event.addListener(tabcontrols[i], "click", switchMpTab, tabcontrols);
		Event.addListener(tabcontrols[i], "click", disableLink);
		}	
}

var hpTabInit = function() {
	var tabSets = Dom.getElementsByClassName("tabSet", "ul");
	var disableLink =  function(e) {
			Event.preventDefault(e);
		}
		for(var y=0; y<tabSets.length; y++) {
			var tabcontrols = Dom.getElementsByClassName("tabcontrol", "a", tabSets[y].id);
			for(var i=0; i<tabcontrols.length; i++) {
				// set tabswitch controls
				Event.addListener(tabcontrols[i], "click", switchMpTab, tabcontrols);
				Event.addListener(tabcontrols[i], "click", disableLink);
			}	
		}
}

// add onload init
Event.addListener(window, "load", hpTabInit);

var switchMpTab = function(t,tabcontrols) {
		
		for(var i=0; i<tabcontrols.length; i++) {
			// reset tabs
			Dom.removeClass(tabcontrols[i].parentNode, "selected");
			Dom.get(tabcontrols[i].rel).className = "hidetab"
		}
		// highlight selected tab
		Dom.addClass(this.parentNode, "selected");
		Dom.get(this.rel).className = "showtab"
}

var switchMpTabLite = function(el) {
 var tabcontrols = Dom.getElementsByClassName("tabcontrol", "a", "mp_tabs");
 var targetEl = Dom.get(el);
 var disableLink =  function(e) {
			Event.preventDefault(e);
 }
 for(var i=0; i<tabcontrols.length; i++) {
 	Dom.removeClass(tabcontrols[i].parentNode, "selected");
 		
 }
 if(targetEl) {
  Event.addListener(targetEl, "click", disableLink);
  Dom.addClass(targetEl.parentNode, "selected");
 }
 
}

var switchMpTabLiteOptionsRanking = function(el) {
 var tabcontrols = Dom.getElementsByClassName("tabOption");
 var targetEl = Dom.get(el);
 var disableLink =  function(e) {
			Event.preventDefault(e);
 }
 for(var i=0; i<tabcontrols.length; i++) {
 	Dom.get(tabcontrols[i]).className = '';
 		
 }
 if (targetEl) {
  Event.addListener(targetEl, "click", disableLink);
  Dom.get(el).className = 'tabOption active';
 }
 
}
/////////////////////////////////////////////////////
// END HTML TABS                                   //
/////////////////////////////////////////////////////


/////////////////////////////////////////////
// HEADER Slideshow INIT                   //
/////////////////////////////////////////////
var initSlideshow = function() {
	YAHOO.flexvoetbal.slideshow.init({rootId:"slideshowModule",autoStart:true,slideSpeed:16000,preloadImages:true,frameContainer:"slideshowFrameContainer"});
}

Event.addListener(window, "load", initSlideshow);

/////////////////////////////////////////////
// JS SELECTBOX V1                         //
/////////////////////////////////////////////

var jsSelectOpen = function(refObj) {

	// show or hide reference option list
	var refOptionList = Dom.get(refObj.rel);
	if(Dom.getStyle(refOptionList, "display") == "block") {
		Dom.setStyle(refOptionList, "display", "none");
	}
	else {
		Dom.setStyle(refOptionList, "display", "block");
	}
	
	// set mouse out hide event on refOptionList
	var timedClearing;
	Event.removeListener(refOptionList.parentNode, "mouseout", jsSelectTimedClose);
	Event.addListener(refOptionList.parentNode, "mouseout", jsSelectTimedClose,timedClearing);
	
}	

var jsSelectSelect = function(refObj,selectedId) {
	// set selected value in jsSelectControl
	var selectTarget = Dom.get(selectedId);
	selectTarget.innerHTML = refObj.innerHTML;
	
	// re-assign selected class
	var optionList = Dom.get(refObj.rel).getElementsByTagName("a");
	for(var i=0; i<optionList.length; i++) {
		Dom.removeClass(optionList[i].parentNode, "selected");
		if(optionList[i].innerHTML == selectTarget.innerHTML) {
			Dom.addClass(optionList[i].parentNode, "selected");
		}
	}
	
	// close jsSelectBox
	Dom.setStyle(refObj.rel, "display", "none");
}

var jsSelectTimedClose = function(ev, timedClearing) {
	var optionList = this;
	var hideOptionList = function(refObj) {
		Dom.setStyle(refObj, "display", "none");
	}
	timedClearing = window.setTimeout(function() {hideOptionList(optionList.getElementsByTagName("ul")[0]);}, 1000);
	
	// set undo timed clearing
	Event.removeListener(optionList, "mouseover", jsSelectClearTimedClose);
	Event.addListener(optionList, "mouseover", jsSelectClearTimedClose,timedClearing);
}

var jsSelectClearTimedClose = function(ev, timedClearing) {
		window.clearTimeout(timedClearing);
}

/////////////////////////////////////////////
// LIVE score timed updater                //
/////////////////////////////////////////////

var timedLiveScoreUpdate = function() {
	if(Dom.get("hp_resultmatches")) {
		// get open tab
		
		var startUpdate = function() {
			var activeResultTab = Dom.getElementsByClassName("showtab", "div", "hp_resultmatches")[0];
					if(activeResultTab) {
						var gameId = activeResultTab.id.split("_")[1];
					}
					else {
						var gameId = 0;
					}
				updateResultsHomepage(gameId)	
		}
		var liveScoreUpdate = window.setTimeout(function(){startUpdate();}, 240000);
	}
}

Event.addListener(window, "load", timedLiveScoreUpdate);


/*******************************************************************************/
/* YUI colorfade
/*******************************************************************************/

var colorHighlightPm = function() {
	var PmRow = Dom.get("pmDisplayRow");
	if(PmRow && Dom.hasClass(PmRow, "newPm")) {
		
		var highlightAnim = new YAHOO.util.ColorAnim(PmRow, {backgroundColor: { to: "#FFFF00" }});
		var rollBackHighlight = function() {
			var rollBackHighlightAnim = new YAHOO.util.ColorAnim(PmRow, {backgroundColor: { to: "#FFFFFF" }});
			rollBackHighlightAnim.duration = 0.7;
			rollBackHighlightAnim.animate();	
		}
		highlightAnim.duration = 0.7;
		highlightAnim.onComplete.subscribe(rollBackHighlight);
		highlightAnim.animate(); 
	}

}; 

Event.addListener(window, "load", colorHighlightPm);

/*******************************************************************************/
/* YUI based overlay
/*******************************************************************************/

YAHOO.flexvoetbal.overlayPanel = { 
	config  : {
		overlayPanel : null,
		overlayTitle : null,
		overlayBody  : "",
		overlayWidth : "",
		overlayContentUrl : "",
		overlayClose : false,
		overlayEffects : null,
		overlayHeight: "auto",
		overlayContentCache : null
	},
	
	init : function(overlayConfig) {
		
		if(overlayConfig.url) {
			this.config.overlayContentUrl 	= overlayConfig.url;
		}
		if(overlayConfig.cachedContent) {
			this.config.overlayContentCache  = overlayConfig.cachedContent
		}
		this.config.overlayWidth 				= overlayConfig.width;
		this.config.overlayHeight 			= overlayConfig.height;
		this.config.overlayTitle 				= overlayConfig.title;
		this.config.overlayClose 				= overlayConfig.close;
		this.config.overlayEffects 			= overlayConfig.effects;
		
		this.draw();
		
		if(this.config.overlayContentUrl) {
			this.getXHRContent();
		}
		else {
				if(this.config.overlayContentCache) {
					this.config.overlayBody = this.config.overlayContentCache;
				}
				else {
					this.config.overlayBody = " ";
				}
				this.formatContent();
		}
	},
	
	draw : function() {
		
		this.config.overlayPanel = new YAHOO.widget.Panel("overlayPanel", { width:this.config.overlayWidth, height:this.config.overlayHeight, modal:true, visible:true,underlay:"shadow",draggable:false, close:this.config.overlayClose, fixedcenter: true,effect:this.config.overlayEffects} );
		if(this.config.overlayTitle) {
			this.config.overlayPanel.setHeader(this.config.overlayTitle);
		}
		
		this.config.overlayPanel.render(document.body);
		
		// using timed clearing to avoid timing problems
		var timedClearing = function(dialog) {
			var tC = window.setTimeout(function(){
				dialog.destroy();
				},50);
		}

		this.config.overlayPanel.hideEvent.subscribe(function(){timedClearing(this)});


	},
	
	runAfterEffects : function() {
		// custom js calls executed after overlay is loaded
	},
	formatContent : function() {
		
		var overlayFrame = document.createElement("div");
		overlayFrame.setAttribute("id", "overlay");

		var contentPlaceHolder = document.createElement("div");
		contentPlaceHolder.setAttribute("id", "overlayContent");
		contentPlaceHolder.innerHTML = this.config.overlayBody;
		overlayFrame.appendChild(contentPlaceHolder);
		
		this.config.overlayBody = overlayFrame;
		this.appendContent();
	},

	appendContent : function() {

		this.config.overlayPanel.setBody(this.config.overlayBody);
		this.config.overlayPanel.render();
		
		// run afterEffects
		this.runAfterEffects();

	},

	getXHRContent : function() {
		
		var callback =  {   
			
			success: function(o) {
				// set content in overlay panel object
				o.argument.config.overlayPanel.overlayBody = o.responseText;
				o.argument.config.overlayPanel.formatContent();
			},
				
			failure: function(o) { 
				
			}, 
			
			argument : {overlayPanel: this}
		}	
		var transaction = YAHOO.util.Connect.asyncRequest('GET', this.config.overlayContentUrl, callback, null);  
		
	},

	close : function() {
    	this.config.overlayPanel.hide();
    }
}

function drawOverlay(url,width,height,title) {
	
	YAHOO.flexvoetbal.overlayPanel.init({
		url: url,
		title: title,
		width: width,
		height: height,
		close: true,
		effects: {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}}
	);
}



/*******************************************************************************/
/* END YUI based overlay
/*******************************************************************************/

YAHOO.flexvoetbal.toggleTaf = { 
	config : {
		tafTemplate : "/custom/getContentXML.php?A=S&module=index&submodule=getTafForm",
		rawHTMLTemplate : "",
		statusMsgId			: "tafStatusMsg",
		tafToId					: "taf_to_home",
		tafFromId				: "taf_from_home",
		tafEmailId			: "taf_toe_home"
	},
	
	init : function(el) {
		drawOverlay(false,"400px","160px", el.title);
		this.getTafForm();
	},
	getTafForm: function() {
		var callback = { 
				success: function(o) {
					var tafFormHTML = o.responseXML.getElementsByTagName("Data")[0].getAttribute("DivContent");
					o.argument[0].config.rawHTMLTemplate = tafFormHTML;
					o.argument[0].drawTafForm();
				}, 
			  failure: function(o) {
			  	// could not load template
			
			 	},
			 	argument: [this]
			};
			var transaction = YAHOO.util.Connect.asyncRequest('GET', this.config.tafTemplate, callback,null);	
	},
	checkForm : function() {
		var isValid = true;
		if(!this.validateTextInput(Dom.get(this.config.tafFromId))) {
			isValid = false;
		}
		else if(!this.validateTextInput(Dom.get(this.config.tafToId))) {
			isValid = false;
		}
		else if(!this.validateEmailAddress(Dom.get(this.config.tafEmailId).value)) {
			this.drawError("Voer een geldig e-mailadres in");
			isValid = false;
		}
		if(isValid) {
			TellAFriend();
		}
	},
	validateTextInput : function(refObj) {
		var isValid = true;
		var inputStr = refObj.value;
		if(inputStr.length <= 0) {
			this.drawError("Vul een naam in.");
			Dom.addClass(refObj, "formError");
			isValid = false;
		} else if(inputStr.length > 25) {
			isValid = false;
			this.drawError("Vul een naam in van maximaal 25 tekens");
			Dom.addClass(refObj, "formError");
		} else {
			Dom.removeClass(refObj, "formError");
		}
			
		return isValid;	
	},
	validateEmailAddress : function(emailStr) {
	  var emailReg  = /^([a-zA-Z0-9+_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	  if (!emailReg.test(emailStr)) {
	    return false;         
	  } else {
	    return true;
	  }
	},
	drawError : function(errorMsg) {
		var statusPlaceHolder = Dom.get(this.config.statusMsgId);
		Dom.removeClass(statusPlaceHolder, "error");
		Dom.addClass(statusPlaceHolder, "error");
		statusPlaceHolder.innerHTML = errorMsg;
	},
	drawTafForm: function() {
			Dom.get("overlayContent").innerHTML = unescape(this.config.rawHTMLTemplate);
	},
	closeTafForm : function() {
		var statusMsg = "E-mail verzonden, dit venster wordt automatisch gesloten.";
		var statusPlaceHolder = Dom.get(this.config.statusMsgId);
		Dom.removeClass(statusPlaceHolder, "error");
		Dom.addClass(statusPlaceHolder, "ok");
		statusPlaceHolder.innerHTML = statusMsg;
		var timedClose = window.setTimeout(function(){YAHOO.flexvoetbal.overlayPanel.close();}, 3000);
	}
};

YAHOO.flexvoetbal.toggleProfile = {
	config: {
		profileTemplate : "/custom/getContentXML.php?A=S&module=member&submodule=getViewProfile",
		profileId: null,
		rawHTMLTemplate : ""
	},
	init : function(el) {
		this.config.profileId = el.rel;
		drawOverlay(false,"600px","355px", el.title);
		this.getProfile();
	},
	getProfile: function() {
		var callback = { 
				success: function(o) {
					var profileHTML = o.responseXML.getElementsByTagName("Data")[0].getAttribute("DivContent");
					o.argument[0].config.rawHTMLTemplate = profileHTML;
					o.argument[0].drawProfile();
				}, 
			  failure: function(o) {
			  	// could not load template
			
			 	},
			 	argument: [this]
			};
			var transaction = YAHOO.util.Connect.asyncRequest('GET', this.config.profileTemplate + '&profileID=' + this.config.profileId, callback,null);	
	},
	drawProfile: function() {
		Dom.get("overlayContent").innerHTML = unescape(this.config.rawHTMLTemplate);
	}
	
}

YAHOO.flexvoetbal.toggleTabOptions = function(tabOptionClass, selectedTabOption) {
	
	var allOptionTabs = Dom.getElementsByClassName(tabOptionClass);
	// remove active class
	for(var i=0; i<allOptionTabs.length; i++) {
		Dom.removeClass(allOptionTabs[i], "active");
	}
	
	// set current active stats
	Dom.addClass(selectedTabOption, "active");
 
}

YAHOO.flexvoetbal.matchPredictionStats = {
	settings : {
		matchListId		: "mpList",
		matchRow			: null,
		matchItems		: null,
		matchIndex		: 0,
		matchTotal		: 0,
		matchTime			: 8000,
		matchEndPos		: 448,
		matchRowPos		: 0,
		originalPos		: false
	},
	
	init : function(matches) {
		this.settings.matchItems = matches;
		this.settings.matchRow = Dom.get(this.settings.matchListId);
		this.settings.matchTotal = matches.length;
		if(!this.settings.originalPos) {
			this.settings.originalPos = YAHOO.util.Dom.getXY(this.settings.matchRow)[0];
		}
		this.settings.matchRowPos = this.settings.originalPos - (this.settings.matchTotal * this.settings.matchEndPos);
		Dom.setStyle(this.settings.matchRow, "left", this.settings.matchRowPos + "px");
		Dom.setStyle(this.settings.matchRow, "width", (this.settings.matchTotal * this.settings.matchEndPos) + 100 + "px");
		this.settings.matchIndex = 1;
		this.animateMatch(this.settings.matchIndex);
	},
	
	showMatches : function() {
		if(Dom.get(this.settings.matchListId)) {
			var allMatches = Dom.get(this.settings.matchListId).getElementsByTagName("li");
			if(allMatches.length > 1) {
				this.init(allMatches);
			}
		}
	},
	
	animateMatch : function(matchIndex) {
		if(matchIndex > this.settings.matchTotal) {
				this.showMatches();
				return false;
		}
	
		var movePoint = this.settings.matchRowPos + (matchIndex  * this.settings.matchEndPos);
		var nextAction = window.setTimeout(function() {
				var refObj = YAHOO.flexvoetbal.matchPredictionStats;
				refObj.settings.matchIndex ++;
				refObj.animateMatch(refObj.settings.matchIndex)
			}, this.settings.matchTime);
		var animSettings = {
			points: { to: [movePoint] }
		};
		var anim = new YAHOO.util.Motion(this.settings.matchRow,animSettings );
		anim.useSeconds = false;
		anim.method = YAHOO.util.Easing.easeOutStrong;
		anim.onComplete.subscribe(nextAction); 
		anim.duration = 50;
		anim.animate();
	},
	
	animateStats : function() {
		
	}
}
var initMatchCarousel = function() {
	YAHOO.flexvoetbal.matchPredictionStats.showMatches();
}
Event.addListener(window, "load",initMatchCarousel );
	

function filterTextInput(i) {
	var re = /^[a-zA-Z0-9,\s]*$/;
	if (!re.test(i.value)) {
		i.value = i.value.replace(/[^a-zA-Z0-9,\s]/g,"");
	}
}


var googleAnalyticsMapping = new Array();
googleAnalyticsMapping['updateResultsHomepage_index'] 					= 'AJAX_live scores';
googleAnalyticsMapping['getGeneralPool_index'] 									= 'AJAX_pool overzicht';
googleAnalyticsMapping['savePrediction_game'] 									= 'AJAX_voorspelling opslaan';
googleAnalyticsMapping['getPredictionGeneralGame_index'] 				= 'AJAX_voorspelling invullen';
googleAnalyticsMapping['viewPredictionGeneralGame_index'] 			= 'AJAX_voorspelling bekijken';
googleAnalyticsMapping['comparePredictionsCommunity_community'] = 'AJAX_voorspelling vergelijken';
googleAnalyticsMapping['getNormalRanking_ranking'] 							= 'AJAX_rankingoverzicht';
googleAnalyticsMapping['rankingCommunity_community'] 						= 'AJAX_community rankingoverzicht';
googleAnalyticsMapping['getViewProfile_member'] 								= 'AJAX_profiel bekijken';
googleAnalyticsMapping['CheckUrl_cp'] 													= 'AJAX_URL controleren';
googleAnalyticsMapping['getRankingGeneralGame_index'] 					= 'AJAX_rankingoverzicht';
googleAnalyticsMapping['getEndPrediction_game'] 								= 'AJAX_eindvoorspelling';
googleAnalyticsMapping['getResultList_cp'] 											= 'AJAX_resultaten bekijken';
googleAnalyticsMapping['getResultEdit_cp'] 											= 'AJAX_resultaten aanpassen';
googleAnalyticsMapping['getSettingsCommunity_community'] 				= 'AJAX_community instellingen';
googleAnalyticsMapping['getDrawGeneralGame_index'] 							= 'AJAX_pool overzicht';
googleAnalyticsMapping['saveCommunitySettings_community'] 			= 'AJAX_community instellingen opslaan';
googleAnalyticsMapping['saveResult_cp'] 												= 'AJAX_resultaten opslaan';
googleAnalyticsMapping['getOwnRanking_ranking'] 								= 'AJAX_ranking eigen positie';
googleAnalyticsMapping['memberListCommunity_community'] 				= 'AJAX_spelerslijst community';
googleAnalyticsMapping['searchForCommunity_community'] 					= 'AJAX_zoeken community';
googleAnalyticsMapping['updateTeamSelectboxes_game'] 						= 'AJAX_opslaan eindranking';
googleAnalyticsMapping['getAnnouncement_index'] 								= 'AJAX_notificatie';
googleAnalyticsMapping['addPollVote_index'] 										= 'AJAX_poll stem';
googleAnalyticsMapping['saveShout_index'] 											= 'AJAX_shout opslaan';
googleAnalyticsMapping['getFindUserForPersonalMessage_pm'] 			= 'AJAX_PM ontvanger zoeken';
googleAnalyticsMapping['requestCommunityHomepage_member'] 			= 'AJAX_community aanvraag homepage';
googleAnalyticsMapping['getTodoEdit_cp'] 												= 'AJAX_todo aanpassen';
googleAnalyticsMapping['saveTodo_cp'] 													= 'AJAX_todo opslaan';
googleAnalyticsMapping['viewPersonalMessage_pm'] 								= 'AJAX_PM bekijken';
googleAnalyticsMapping['requestCommunity_member'] 							= 'AJAX_community aanvragen';


YAHOO.flexvoetbal.slideshow = {
	
	// slideshow variable declarations

	slideshowAutoStart: false,
	slideshowPreload: false,
	slideshowSpeed: 2000,
	slideshowRootNode: null,
	slideshowListItems: null,
	slideshowFrames: null,
  slideshowFrameContainerId: null,
	slideshowIsAnimating: false,
	slideshowFadeInObject: null,
	slideshowFadeOutObject: null,
	isActve: null,
	isNext: null,
	usePagination: false, 

	disableDefaultBehaviour : function(e) {
		 Event.preventDefault(e);
	},
	
	init : function(slideshowProperties){

		// set properties
		this.slideshowAutoStart = slideshowProperties.autoStart;
		this.slideshowPreload = slideshowProperties.slideshowPreload;
		this.slideshowSpeed = slideshowProperties.slideSpeed;
		this.slideshowRootNode =  document.getElementById(slideshowProperties.rootId);
		this.slideshowFrameContainerId =  slideshowProperties.frameContainer;
	
		if(this.slideshowRootNode) {
			
			var slideshowList = this.slideshowRootNode.getElementsByTagName("ul")[0];
			this.slideshowListItems = slideshowList.getElementsByTagName("li");
			this.slideshowFrames = Dom.getElementsByClassName("frame", "li", slideshowList);
			this.isActive = this.getCurrent();

			this.buildContainer();
		
			// set initial slide objects
			this.slideshowFadeInObject = Dom.get("slide2");
			this.slideshowFadeOutObject = Dom.get("slide1");

			// init pagination controls
			if(this.usePagination) {
				this.initPagination();
			}
			
			if(this.slideshowAutoStart) {
				this.isNext = this.getNext();
				this.slideshowIsAnimating = true;
				this.startTimer();
			}
			
			if(this.slideshowPreload) {
				this.preloadImages();
			}
		}
	},
	
	initPagination : function() {
		for(var i=0; i<this.slideshowListItems.length; i++) {
			var controlNode = this.slideshowListItems[i].firstChild;
			Event.addListener(controlNode,"click", this.disableDefaultBehaviour);
			
			switch(true) {
				case Dom.hasClass(this.slideshowListItems[i], "navPrev"):	
					var slideTarget = -1;
				break;
				
				case Dom.hasClass(this.slideshowListItems[i], "navNext"):
					var slideTarget = 1;
				break;
				
				default:
					var slideTarget = 0;
				break;
			}
			
			Event.addListener(controlNode, "click", this.slideTo, {slidePosition:slideTarget,slideshowObject:this});			
		}
	},
	
	slideTo : function(e,slideProperties,refObj) {
		
		var slideshowObject = slideProperties.slideshowObject;
		
		// turn off autostart	
		slideshowObject.slideshowAutoStart = false;
		
		if(!refObj) {
			refObj = this;
		}
		
		if(slideshowObject.slideshowIsAnimating) {
			var timedAnim = window.setTimeout(function() { slideshowObject.slideTo(null,slideProperties,refObj);}, 1000);
			return false;
		}
	
		// set frame
		
		if(slideProperties.slidePosition == 1) {
			 slideshowObject.isNext = slideshowObject.getNext();
		} 
		else if(slideProperties.slidePosition == -1) {
			 slideshowObject.isNext = slideshowObject.getPrevious();
		}
		else {
			 slideshowObject.isNext = slideshowObject.getSelected(refObj);
		}	
		
		// set slideTo img object source
		slideshowObject.slideshowFadeInObject.src = slideshowObject.slideshowFrames[slideshowObject.isNext].firstChild.getAttribute("href");

		// animate to slideTo image
		slideshowObject.startAnimate(slideshowObject);	
	},
	
	getCurrent : function() {
		if(this.slideshowFrames.length > 0){
			for(var i=0; i<this.slideshowFrames.length; i++) {
				if(Dom.hasClass(this.slideshowFrames[i],"isActive")) {
					return i;
				}
			}
		}
	},
	getSelected : function(refObject) {
		// remove prev active class
		Dom.removeClass(this.slideshowFrames[this.isActive], "isActive");
		
		// set new active class
		Dom.addClass(refObject.parentNode, "isActive");
		
		return this.getCurrent();
	},
	
	getNext : function() {
		if(this.isActive == this.slideshowFrames.length -1) {
			return 0;
		} else {
			return this.isActive + 1;
		}
	},

	getPrevious : function() {
		if(this.isActive == 0) {
			return this.slideshowFrames.length -1;
		} else {
			return this.isActive - 1;
		}
	},
	
	buildContainer : function() {
		if(!document.getElementById(this.slideshowFrameContainerId)) {
			var frameContainer = document.createElement("div");
			var imgA = document.createElement("img");
			var imgB = document.createElement("img");

			imgA.setAttribute("src",this.slideshowFrames[this.isActive].childNodes[0].getAttribute("href"));
			imgB.setAttribute("src",this.slideshowFrames[this.isNext].childNodes[0].getAttribute("href"));

			Dom.addClass(imgA,"slide1");
			Dom.addClass(imgB,"slide2");


			frameContainer.id = this.slideshowFrameContainerId;
			imgA.id = "slide1"; // starts as back image
			imgB.id = "slide2"; // starts as front image
			
			frameContainer.appendChild(imgA);
			frameContainer.appendChild(imgB);
			this.slideshowRootNode.appendChild(frameContainer);
		}
	},

	startTimer : function() {
		var slideShowObject = this;
		var animationTimer = window.setTimeout(function() { slideShowObject.startAnimate(slideShowObject); } ,this.slideshowSpeed);
	},

	startAnimate : function(slideShowObject) {
		// fade out current slide
		fadeOutAnimation = new YAHOO.util.Anim(slideShowObject.slideshowFadeOutObject, {opacity: { to:0 }});
		fadeOutAnimation.animate();
		slideShowObject.slideshowIsAnimating = true;

		// fade in new slide
		fadeInAnimation = new YAHOO.util.Anim(slideShowObject.slideshowFadeInObject, {opacity: { to:.999 }});
		fadeInEnd = function() {
			Dom.removeClass(slideShowObject.slideshowFrames[slideShowObject.isActive],"isActive");
			Dom.addClass(slideShowObject.slideshowFrames[slideShowObject.isNext],"isActive");
			slideShowObject.slideshowFadeOutObject.src = slideShowObject.slideshowFrames[slideShowObject.isActive].firstChild.getAttribute("href");

			slideShowObject.isActive = slideShowObject.isNext;
			
			// replace classes
			Dom.replaceClass(slideShowObject.slideshowFadeInObject,"slide2","slide1");
			Dom.replaceClass(slideShowObject.slideshowFadeOutObject,"slide1","slide2");
				
			// set new fadeIn & fadeOut object references
			slideShowObject.slideshowFadeInObject = Dom.getElementsByClassName("slide2","img",slideShowObject.slideshowRootNode)[0];
			slideShowObject.slideshowFadeOutObject = Dom.getElementsByClassName("slide1","img",slideShowObject.slidsShowRootNode)[0];
			
			// remove any inline styling
			slideShowObject.slideshowFadeInObject.removeAttribute("style");
			slideShowObject.slideshowFadeOutObject.removeAttribute("style");

			slideShowObject.slideshowIsAnimating = false;
			if(slideShowObject.slideshowAutoStart) {		
				slideShowObject.isNext = slideShowObject.getNext();
				slideShowObject.slideshowFadeInObject.src = slideShowObject.slideshowFrames[slideShowObject.isNext].childNodes[0].getAttribute("href");
				slideShowObject.startTimer();
			}
		}
		fadeInAnimation.onComplete.subscribe(fadeInEnd);
		fadeInAnimation.animate();

	},
	
	preloadImages : function() {
		for(var i=2; i<slideshowFrames.length; i++) {
			var preLoadImage = document.createElement("img");
			preLoadImage.src = this.slideshowFrames[i].firstChild.getAttribute("href");
		}
	}
};

function MemberListCommunity(communityID)
{
	clearDiv('memberinvitediv');
	
	var URLe = '&communityID='+communityID;
	
	getContentXML('community', 'memberListCommunity', '', URLe);
}

function HelpCommunity(communityID)
{
	clearDiv('memberinvitediv');
	
	var URLe = '&communityID='+communityID;
	
	getContentXML('community', 'getHelpCommunity', '', URLe);
}
			
function SettingsCommunity(communityID)
{
	clearDiv('memberinvitediv');
	
	var URLe = '&communityID='+communityID;
	
	getContentXML('community', 'getSettingsCommunity', '', URLe);
}

function loadPollForCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	getContentXML('community', 'loadPollForCommunity', '', URLe);
}

newPollRowID = 1;
function AddPollRowCommunity()
{
	var oTBODY = Dom.get('pollTBODY');
	//initial row
	var newTR1 = document.createElement('TR');
	newTR1.id = 'PollRow_' + newPollRowID;
	
	var newTD = document.createElement('TD');
	newTD.innerHTML = "<input type='text' name='PollAnswers' id='" + newPollRowID + "' style='width: 200px;' value='' />&nbsp;";
	newTD.innerHTML+= "<img src='/gfx/icons/group_delete.png' border='0' onclick='DeletePollRowCommunity(" + newPollRowID + "); return false;' />";
	newTR1.appendChild(newTD);
	
	oTBODY.appendChild(newTR1);
	
	newPollRowID++;
}

function DeletePollRowCommunity(PollRowID)
{
	var oTR = Dom.get('PollRow_' + PollRowID);
	Dom.get('pollTBODY').removeChild(oTR);
}

function SavePollCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	//get name and id
	if (Dom.get('pollID')) {
		var pollID = Dom.get('pollID').value;
		URLe+= '&pollID='+pollID;
	}
	if (Dom.get('pollName')) {
		var pollName = escape(Dom.get('pollName').value);
		URLe+= '&pollName='+pollName;
	}
	
	//get answers
	if (document.getElementsByName('PollAnswers')) {
		var pollAnswers = document.getElementsByName('PollAnswers');
		var answers = '';
		for (var i=0; i<pollAnswers.length; i++) {
			answers+= pollAnswers[i].id+'##'+escape(pollAnswers[i].value)+'|';
		}
		URLe+= '&answers='+answers;
	}
	
	getContentXML('community', 'savePollOfCommunity', '', URLe);
}

function DeletePollCommunity(pollID, communityID)
{
	var URLe = '&pollID='+pollID+'&communityID='+communityID;
	
	getContentXML('community', 'deletePollOfCommunity', '', URLe);
}

function AddExtraRankingRowCommunity()
{
	newExtraRankingRowID = Dom.get('extraRankingsCount').value;
	roundIDs = 34; //get from template
	
	var oTBODY = Dom.get('extraRankingTBODY');
	var numActiveRows = oTBODY.getElementsByTagName("tr").length;
	
	if (numActiveRows == 0) { //add header if 1
		var newTR0 = document.createElement('TR');
		Dom.addClass(newTR0, "tableSubHeader");
		var newTD0_1 = document.createElement('TD');
		newTD0_1.innerHTML+= "&nbsp;";
		newTR0.appendChild(newTD0_1);
		var newTD0_2 = document.createElement('TD');
		newTD0_2.innerHTML+= "<strong>naam</strong>";
		newTR0.appendChild(newTD0_2);
		var newTD0_3 = document.createElement('TD');
		newTD0_3.innerHTML+= "<strong>van speelronde</strong>";
		newTR0.appendChild(newTD0_3);
		var newTD0_4 = document.createElement('TD');
		newTD0_4.innerHTML+= "<strong>t/m speelronde</strong>";
		newTR0.appendChild(newTD0_4);
		var newTD0_5 = document.createElement('TD');
		newTD0_5.innerHTML+= "&nbsp;";
		newTR0.appendChild(newTD0_5);
		
		oTBODY.appendChild(newTR0);
	}
	
	//initial row
	var newTR1 = document.createElement('TR');
	if(isEven(numActiveRows)) {
		Dom.addClass(newTR1, "even");
	}
	
	newTR1.id = 'ExtraRankingRow_' + newExtraRankingRowID;
	
	var newTD0 = document.createElement('TD');
	newTD0.innerHTML = "&nbsp;";
	newTR1.appendChild(newTD0);
	
	var newTD1 = document.createElement('TD');
	newTD1.innerHTML = "<input type=\"hidden\" id=\"extraRankingID_"+newExtraRankingRowID+"\" value=\"New_"+newExtraRankingRowID+"\" />";
	newTD1.innerHTML+= "<input type=\"text\" class=\"xxlarge\" id=\"extraRankingName_"+newExtraRankingRowID+"\" value=\"\" />&nbsp;";
	newTR1.appendChild(newTD1);
	
	var newTD2 = document.createElement('TD');
	var newSelect1 = document.createElement('SELECT');
	newSelect1.id = 'eRankingRoundIDStart_' + newExtraRankingRowID;
	for (var i=1; i<=roundIDs; i++) {
		var theOption = document.createElement("OPTION");
		var theText = document.createTextNode(i);
		theOption.appendChild(theText);
		theOption.setAttribute("value",i);
		newSelect1.appendChild(theOption);
	}
	
	newTD2.appendChild(newSelect1);
	newTR1.appendChild(newTD2);
	
	var newTD3 = document.createElement('TD');
	var newSelect2 = document.createElement('SELECT');
	newSelect2.id = 'eRankingRoundIDEnd_' + newExtraRankingRowID;
	for (var i=1; i<=roundIDs; i++) {
		var theOption = document.createElement("OPTION");
		var theText = document.createTextNode(i);
		theOption.appendChild(theText);
		theOption.setAttribute("value",i);
		newSelect2.appendChild(theOption);
	}
	
	newTD3.appendChild(newSelect2);
	newTR1.appendChild(newTD3);
	
	var newTD4 = document.createElement('TD');
	newTD4.innerHTML = "<input type=\"checkbox\" class=\"checkbox\" id=\"extraRankingActive_"+newExtraRankingRowID+"\" value=\"1\" checked=\"checked\" /> Actief&nbsp;";
	newTD4.innerHTML+= "<img class=\"clickable\" src='/gfx/icons/group_delete.png' border='0' onclick='DeleteExtraRankingRowCommunity("+newExtraRankingRowID+"); return false;' />";
	newTR1.appendChild(newTD4);
	
	oTBODY.appendChild(newTR1);
	
	newExtraRankingRowID++;
	
	//set new hidden
	Dom.get('extraRankingsCount').value = newExtraRankingRowID;
}

function DeleteExtraRankingRowCommunity(ExtraRankingRowID, communityID)
{
	if (typeof communityID == 'undefined') communityID = 0;
	
	if (communityID) {
		var URLe = '&communityID='+communityID+'&communityRankingID='+ExtraRankingRowID;
	
		getContentXML('community', 'deleteExtraRankingOfCommunity', '', URLe);		
	} else {
		var oTR = Dom.get('ExtraRankingRow_' + ExtraRankingRowID);
		Dom.get('extraRankingTBODY').removeChild(oTR);
		
		newExtraRankingRowID--;
		Dom.get('extraRankingsCount').value = newExtraRankingRowID;
	}
}

function SaveCommunitySettings(communityID)
{
	var URLe = '&communityID='+communityID;
	
	var communityName = escape(Dom.get('communityName').value);
	URLe+= '&communityName='+communityName;
	
	var communityDisplayName = escape(Dom.get('communityDisplayName').value);
	URLe+= '&communityDisplayName='+communityDisplayName;
	
	var communityText = Dom.get('communityText').value;
	URLe+= '&communityText='+escape(communityText);
	
	URLe+= '&communityPrivate='+escape(getSelectedRadioValue(document.getElementsByName('communityPrivate')));
	URLe+= '&communityNameSelection='+escape(getSelectedRadioValue(document.getElementsByName('communityNameSelection')));
	URLe+= '&communityNameSelectionFull='+escape(getSelectedRadioValue(document.getElementsByName('communityNameSelectionFull')));
	URLe+= '&communityAllowAccess='+escape(getSelectedRadioValue(document.getElementsByName('communityAllowAccess')));
	URLe+= '&communityViewPredictionRequired='+escape(getSelectedRadioValue(document.getElementsByName('communityViewPredictionRequired')));
	
	if (Dom.get('community_showNewsLeft')) {
		if (Dom.get('community_showNewsLeft').checked) {
			URLe+= '&community_showNewsLeft=0';
		} else {
			URLe+= '&community_showNewsLeft=1';
		}
	}
	if (Dom.get('community_showNewsGenLeft')) {
		if (Dom.get('community_showNewsGenLeft').checked) {
			URLe+= '&community_showNewsGenLeft=0';
		} else {
			URLe+= '&community_showNewsGenLeft=1';
		}
	}
	if (Dom.get('community_showTop5Left')) {
		if (Dom.get('community_showTop5Left').checked) {
			URLe+= '&community_showTop5Left=0';
		} else {
			URLe+= '&community_showTop5Left=1';
		}
	}
	if (Dom.get('community_showShoutLeft')) {
		if (Dom.get('community_showShoutLeft').checked) {
			URLe+= '&community_showShoutLeft=0';
		} else {
			URLe+= '&community_showShoutLeft=1';
		}
	}
	
	//get extra rankings
	eRankingNames = '';
	eRankingRoundIDStart = '';
	eRankingRoundIDEnd = '';
	//eRankingRoundIDs = '';
	eRankingActives = '';
	eRankingIDs = '';
	if (Dom.get('extraRankingsCount')) {
		var totalRankings = Dom.get('extraRankingsCount').value;
		
		for (var i=1; i<totalRankings; i++) {
			eRankingNames+= escape(Dom.get('extraRankingName_'+i).value)+'|';
			eRankingRoundIDStart+= escape(Dom.get('eRankingRoundIDStart_'+i).options[Dom.get('eRankingRoundIDStart_'+i).selectedIndex].value)+'|';
			eRankingRoundIDEnd+= escape(Dom.get('eRankingRoundIDEnd_'+i).options[Dom.get('eRankingRoundIDEnd_'+i).selectedIndex].value)+'|';
			if (Dom.get('extraRankingActive_'+i).checked) {
				eRankingActives+= '1|';
			} else {
				eRankingActives+= '0|';
			}
			eRankingIDs+= escape(Dom.get('extraRankingID_'+i).value)+'|';
		}
	}
	
	if (eRankingNames.length && eRankingRoundIDStart.length && eRankingRoundIDEnd.length && eRankingIDs.length) {
		URLe+= '&eRankingNames='+eRankingNames+'&eRankingRoundIDStart='+eRankingRoundIDStart+'&eRankingRoundIDEnd='+eRankingRoundIDEnd+'&eRankingActives='+eRankingActives+'&eRankingIDs='+eRankingIDs;
	}
	
	getContentXML('community', 'saveCommunitySettings', '', URLe);
}

function SaveCommunityExtraRankings(communityID)
{
	var URLe = '&communityID='+communityID;
	
	//get extra rankings
	eRankingNames = '';
	eRankingRoundIDStart = '';
	eRankingRoundIDEnd = '';
	//eRankingRoundIDs = '';
	eRankingActives = '';
	eRankingIDs = '';
	if (Dom.get('extraRankingsCount')) {
		var totalRankings = Dom.get('extraRankingsCount').value;
		
		for (var i=1; i<totalRankings; i++) {
			eRankingNames+= escape(Dom.get('extraRankingName_'+i).value)+'|';
			eRankingRoundIDStart+= escape(Dom.get('eRankingRoundIDStart_'+i).options[Dom.get('eRankingRoundIDStart_'+i).selectedIndex].value)+'|';
			eRankingRoundIDEnd+= escape(Dom.get('eRankingRoundIDEnd_'+i).options[Dom.get('eRankingRoundIDEnd_'+i).selectedIndex].value)+'|';
			if (Dom.get('extraRankingActive_'+i).checked) {
				eRankingActives+= '1|';
			} else {
				eRankingActives+= '0|';
			}
			eRankingIDs+= escape(Dom.get('extraRankingID_'+i).value)+'|';
		}
	}
	
	if (eRankingNames.length && eRankingRoundIDStart.length && eRankingRoundIDEnd.length && eRankingIDs.length) {
		URLe+= '&eRankingNames='+eRankingNames+'&eRankingRoundIDStart='+eRankingRoundIDStart+'&eRankingRoundIDEnd='+eRankingRoundIDEnd+'&eRankingActives='+eRankingActives+'&eRankingIDs='+eRankingIDs;
	}
	
	getContentXML('community', 'saveCommunityExtraRankings', '', URLe);
}

function UpdateMemberOfCommunity(communityID, profileID, updateStatus)
{
	var URLe = '&communityID='+communityID;
	
	URLe+= '&profileID='+profileID;
	if (updateStatus == 'isaccept') {
		URLe+= '&updateValue=1';
	} else {
		if (Dom.get(updateStatus+'_'+profileID).checked) {
			URLe+= '&updateValue=1';
		} else {
			URLe+= '&updateValue=0';
		}
	}

	URLe+= '&updateStatus='+updateStatus;
		
	getContentXML('community', 'updateMemberOfCommunity', '', URLe);
}

function SendInviteToMember(communityID, profileID)
{
	var URLe = '&communityID='+communityID+'&profileID='+profileID;
	
	getContentXML('community', 'sendInviteToMember', '', URLe);
}

function DeleteMemberOfCommunity(communityID, profileID, Language)
{
	if (Language == 'eng') {
		var agree = confirm('Are you sure you want to delete this member?');
	} else {
		var agree = confirm('Weet je zeker dat je deze speler wilt verwijderen?');
	}
	if (agree) {
		var URLe = '&communityID='+communityID;
		URLe+= '&profileID='+profileID;
		
		getContentXML('community', 'deleteMemberOfCommunity', '', URLe);
	}
}

function checkKeySearchMemberForCommunity(evt)
{
	if (evt.keyCode == 13) {
		SearchMemberForCommunity();
		return false;
	} else {
		return true;
	}
}

function SearchMemberForCommunity()
{
	var URLe = '';
	
	if (Dom.get('communityInviteSearchPlayerInput')) {
		var searchString = Dom.get('communityInviteSearchPlayerInput').value;
	} else {
		searchString = '';
	}
	
	//only do a search when length is more then 1
	if (searchString.length > 1) {
		URLe+= '&searchString='+searchString;
		
		getContentXML('community', 'searchMemberForCommunity', '', URLe);
	} else {
		return false;
	}
}

function InviteMemberForCommunity(communityID, profileID)
{
	var URLe = '&communityID='+communityID+'&profileID='+profileID;
	
	getContentXML('community', 'inviteMemberForCommunity', '', URLe);
}

function InviteNonMemberForCommunity(communityID)
{
	clearDiv('memberinvitediv');
	
	taftoFound = false;
	taftoeFound = false;
	
	var URLe = '&communityID='+communityID;
	
	//get email and username
	if (Dom.get('taf_to')) {
		URLe+= '&taf_to='+escape(Dom.get('taf_to').value);
	}
	
	if (Dom.get('taf_toe')) {
		URLe+= '&taf_toe='+escape(Dom.get('taf_toe').value);
	}
	
	getContentXML('community', 'inviteNonMemberForCommunity', '', URLe);
}

function RankingCommunity(page, communityID, predictedState, hideShoutbox, rankingCommunityID)
{
	clearDiv('memberinvitediv');
	
	if (typeof page == 'undefined') page = 1;
	if (typeof hideShoutbox == 'undefined') hideShoutbox = 0;
	if (typeof rankingCommunityID == 'undefined') rankingCommunityID = 0;
	
	var URLe = '&communityID='+communityID+'&hideShoutbox='+hideShoutbox;
	
	if (predictedState) {
		URLe+= '&predictionState=1';
	} else {
		URLe+= '&predictionState=0';
	}
	
	URLe+= '&rankingpage='+page+'&rankingCommunityID='+rankingCommunityID;
	
	getContentXML('community', 'rankingCommunity', '', URLe, 'animatePollResults(\'pollre\');', false);
}

function ComparePredictionsCommunity(communityID, memberOfCommunity)
{
	if (typeof memberOfCommunity == 'undefined') memberOfCommunity = 0;
	
	clearDiv('memberinvitediv');
	
	var URLe = '&communityID='+communityID+'&memberOfCommunity='+memberOfCommunity;
	
	getContentXML('community', 'comparePredictionsCommunity', '', URLe);
}

function checkKeySearchForCommunity(evt)
{
	if (evt.keyCode == 13) {
		SearchForCommunity();
		return false;
	} else {
		return true;
	}
}

function SearchForCommunity()
{
	var URLe = '';
	
	if (Dom.get('search_community')) {
		var searchString = Dom.get('search_community').value;
	} else {
		searchString = '';
	}
	
	if (searchString.length > 1) {
		URLe+= '&searchString='+searchString;
		
		getContentXML('community', 'searchForCommunity', '', URLe);
	} else {
		return false;
	}
}

function InviteForCommunity(communityID, Language)
{
	if (Language == 'eng') {
		var agree = confirm('Are you sure you want to join this community?');
	} else {
		var agree = confirm('Weet je zeker dat je lid wilt worden van deze community?');
	}
	
	if (agree) {
		var URLe = '&communityID='+communityID;
		
		getContentXML('community', 'inviteForCommunity', '', URLe);
	} else {
		return false;
	}
}

function redrawMenuForCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	getContentXML('community', 'redrawMenuForCommunity', '', URLe);
}

function StatsCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	getContentXML('community', 'statsCommunity', '', URLe);
}

function CalculateExtraRankingCommunity(communityID, communityRankingID)
{
	CLIFinished = false;
	if (Dom.get('Progress')) {
		Dom.get('Progress').style.width = '0px';
		Dom.get('ProgressText').innerHTML = '';
	}
	showLoadingDiv();
	
	var URLe = '&communityID='+communityID+'&communityRankingID='+communityRankingID;
	
	getContentXML('community', 'calculateExtraRankingCommunity', '', URLe, 'hideLoadingDiv();');
}

function customCompareAmount(communityID)
{
	showLoadingDiv();
	
	var URLe = '&communityID='+communityID;
	
	if (Dom.get('customCompareAmount')) {
		URLe+= '&customCompareAmount='+escape(Dom.get('customCompareAmount').value);
	}
	
	getContentXML('community', 'comparePredictionsCommunity', '', URLe, 'hideLoadingDiv();');
}

YAHOO.flexvoetbal.communityInvite = {
	settings : {
		inviteForm 										: "",
		inviteFormId									: "communityInviteForm",
		intviteFormTemplateUrl				: "/custom/getContentXML.php?A=S&module=community&submodule=getInviteForm",
		intviteFormSearchUrl					: "/custom/getContentXML.php?A=S&module=community&submodule=searchMemberForCommunity",
		intviteFormPostUrl						: "/custom/getContentXML.php",
		communityId										: null,
		communityInputId							: "communityID",
		sendInviteScript							: "",
		sendInviteButton							: "communityInviteSend",
		addEmailButtonId							: "communityInviteAddEmail",
		removeEmailButtonId						: "communityInviteRemoveRecipient",
		emailInputId									: "communityInviteEmailInput",
		msgInputId										: "communityInviteMessage",
		fromNameInputId								: "communityInviteFromName",
		recipientListId								: "communityInviteRecipientList",
		searchResultListId						: "communityInviteSearchResult",
		addSearchPlayerButtonId				: "communityInviteAddSearchRecipient",
		searchPlayerInputId						: "communityInviteSearchPlayerInput",
		errorMsgId										: "communityInviteError",
		searchPlayerButtonId					: "communityInviteSearchPlayers",
		communityEmailRecipients			: "communityEmailRecipients",
		communityPlayerIdRecipients		: "communityPlayerIdRecipients",
		searchResultPlaceholder				: "communityInviteResultPlaceholder"
		
	},
	init : function(communityId) {
		// clear some data fields
		this.settings.inviteForm = "";
		this.settings.communityId = null;
	
		if(Dom.get(this.settings.inviteFormId)) {
			return false; // duplicate
		}
		// set community ID
		this.settings.communityId = communityId;
		
		var callback =  {   
			
			success: function(o) {
				// set content in overlay panel object
				var dataNode = o.responseXML.getElementsByTagName("Data");
				if(dataNode && dataNode[0]) {
						o.argument.communityInvite.settings.inviteForm = unescape(dataNode[0].getAttribute("DivContent"));
						o.argument.communityInvite.drawForm();
						
						// init the form
						o.argument.communityInvite.initForm();
				}
				else {
					// template could not be loaded			
						
				}

			},
				
			failure: function(o) { 
				
			}, 
			
			argument : {communityInvite: this}
		}
		YAHOO.util.Connect.setForm(false);	
		var transaction = YAHOO.util.Connect.asyncRequest('GET', this.settings.intviteFormTemplateUrl, callback, null);	
	},
	drawForm : function(){
		YAHOO.flexvoetbal.overlayPanel.init({
			url: false,
			cachedContent : this.settings.inviteForm,	
			title: '<span>nodig spelers uit</span>',
			width: "550px",
			height: "490px",
			close: true,
			effects: {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}}
		);
	},
	initForm: function() {
		// init add email button
		Event.addListener(this.settings.inviteFormId, "submit", function(e) { Event.preventDefault(e);});
		Event.addListener(this.settings.sendInviteButton, "click", function(e) { Event.preventDefault(e);});
		Event.addListener(this.settings.addEmailButtonId, "click", this.addEmailAddress,this);
		Event.addListener(this.settings.removeEmailButtonId, "click", this.removeEmailAddress,this);
		Event.addListener(this.settings.sendInviteButton, "click", this.submitForm,this);
		Event.addListener(this.settings.searchPlayerButtonId, "click", this.searchPlayer,this);
		var searchOnEnter = function(e,communityInvite) {
			if(e.keyCode == 13) {
				communityInvite.searchPlayer(e,communityInvite);
			}
		}
		Event.addListener(this.settings.searchPlayerInputId, "keyup", searchOnEnter ,this);
		
		var addEmailOnEnter = function(e,communityInvite) {
				if(e.keyCode == 13) {
				communityInvite.addEmailAddress(e,communityInvite);
			}
		}
		Event.addListener(this.settings.emailInputId, "keyup", addEmailOnEnter,this);
		
		// update communityID inputfield
		var communityInputNode = Dom.get(this.settings.communityInputId);
		if(communityInputNode) {
			communityInputNode.setAttribute("value", this.settings.communityId);
		} else {
			return false;
		}
	
	},
	addUserId : function(e,communityInvite) {
		var resultList = Dom.get(communityInvite.settings.searchResultListId);
		var resultListSelectedItems = Dom.getElementsByClassName("selected", "li", resultList);
		var recipientList = Dom.get(communityInvite.settings.recipientListId);
		var recipientListItems = recipientList.getElementsByTagName("li");
		
		for(var i=0; i<resultListSelectedItems.length; i++) {
			
				var currentOption = resultListSelectedItems[i];
				var playerId = currentOption.getAttribute("title");;
				
				if(!communityInvite.duplicateRecipient(playerId)) {
					// purge current option
					Event.purgeElement(currentOption);
					Dom.removeClass(currentOption, "selected");
					// add new event handler
					Event.addListener(currentOption, "click", communityInvite.toggleListitem, communityInvite);
					Event.addListener(currentOption, "click", communityInvite.toggleEmailButton, communityInvite);
					recipientList.appendChild(currentOption);
				}
				else {
					// destroy the option
					currentOption.parentNode.removeChild(currentOption);
				}
		}
		communityInvite.togglePlayerButton(null,communityInvite);
	},
	addSingleUserId : function(e,communityInvite) {
			var recipientList = Dom.get(communityInvite.settings.recipientListId);	
			var currentOption = this;
			if(!communityInvite.duplicateRecipient(currentOption.getAttribute("title"))) {
					// purge current option
					Event.purgeElement(currentOption);
					Dom.removeClass(currentOption, "selected");
					// add new event handler
					Event.addListener(currentOption, "click", communityInvite.toggleListitem, communityInvite);
					Event.addListener(currentOption, "click", communityInvite.toggleEmailButton, communityInvite);
					recipientList.appendChild(currentOption);
				}
	},
	removeUserId : function() {
		
	},
	searchPlayer : function(e,communityInvite) {
		var searchQuery = Dom.get(communityInvite.settings.searchPlayerInputId).value;
		if(trim(searchQuery) == "") {
			communityInvite.drawFeedbackMessage("Vul een zoekterm in.", "error");
			return false;
		}
		var callback =  {   
			
			success: function(o) {
				// set content in overlay panel object
				var dataNode = o.responseXML.getElementsByTagName("Data");
				if(dataNode && dataNode[0]) {
						Dom.get(o.argument.communityInvite.settings.searchResultPlaceholder).innerHTML =  unescape(dataNode[0].getAttribute("DivContent"));
						// init result
						var timedInitObj = function() {
							if(Dom.get(o.argument.communityInvite.settings.searchResultListId)) {
								o.argument.communityInvite.initSearchResult();
							}
						}
						var timedInit = window.setTimeout(function(){timedInitObj();}, 200);
						
				}
				else {
					// template could not be loaded			
				}
			},
				
			failure: function(o) { 
				
			}, 
			
			argument : {communityInvite: communityInvite}
		}
		YAHOO.util.Connect.setForm(false); 	
		var transaction = YAHOO.util.Connect.asyncRequest('GET', communityInvite.settings.intviteFormSearchUrl + "&searchString=" + searchQuery , callback, null);
		
		// if results init selectbox (after DOM change)
		
	},
	initSearchResult : function() {
		// init add player button
		Event.addListener(this.settings.addSearchPlayerButtonId, "click", this.addUserId,this);
		
		// init search options
		var searchResultListItems = Dom.get(this.settings.searchResultListId).getElementsByTagName("li");
		for(var i=0; i<searchResultListItems.length; i++) {
				Event.addListener(searchResultListItems[i], "click", this.toggleListitem, this);
				Event.addListener(searchResultListItems[i], "click", this.togglePlayerButton, this);
				Event.addListener(searchResultListItems[i], "dblclick", this.addSingleUserId, this);
		}
		
	},
	addEmailAddress : function(e,communityInvite) {
		var emailAddress = Dom.get(communityInvite.settings.emailInputId).value;
		if(communityInvite.validateEmailAddress(emailAddress)) {
			if(!communityInvite.duplicateRecipient(emailAddress)) {
				// adding to recipientslist
				var recipientList = Dom.get(communityInvite.settings.recipientListId);
				var newOption = document.createElement("li");
				var newOptionText = document.createTextNode(emailAddress);
				newOption.appendChild(newOptionText);
				Dom.addClass(newOption, "email");
				newOption.setAttribute("title",emailAddress);
			  Event.addListener(newOption, "click", communityInvite.toggleListitem, communityInvite);
				Event.addListener(newOption, "click", communityInvite.toggleEmailButton, communityInvite);
				
				recipientList.appendChild(newOption);
				
				communityInvite.drawFeedbackMessage("","empty");
				Dom.removeClass(communityInvite.settings.recipientListId, "error");	
				Dom.removeClass(communityInvite.settings.emailInputId, "error");
				Dom.get(communityInvite.settings.emailInputId).value = "";
			}
			else {
				communityInvite.drawFeedbackMessage("Dit e-email adres staat al in de verzendlijst.", "error");
				Dom.addClass(communityInvite.settings.emailInputId, "error");
			}
			
		} else {
			communityInvite.drawFeedbackMessage("Ongeldig e-mailadres", "error");
			Dom.addClass(communityInvite.settings.emailInputId, "error");
		}
	},
	validateEmailAddress : function(emailStr) {
	  var emailReg  = /^([a-zA-Z0-9+_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	  if (!emailReg.test(emailStr)) {
	    return false;         
	  } else {
	    return true;
	  }
	},
	duplicateRecipient : function(emailAdress) {
		var recipientList = Dom.get(this.settings.recipientListId).getElementsByTagName("li");
		for(var i=0; i<recipientList.length; i++) {
			if(emailAdress == recipientList[i].getAttribute("title")) {
				return true
			}
		}
		return false;
	},
	removeEmailAddress : function(e,communityInvite) {
		var recipientList = Dom.get(communityInvite.settings.recipientListId);
		var recipientListSelectedItems = Dom.getElementsByClassName("selected", "li", recipientList);
		var listLength = recipientListSelectedItems.length;
		for(var i=0; i<listLength; i++) {
				recipientList.removeChild(recipientListSelectedItems[i]);
		}
		communityInvite.toggleEmailButton(null,communityInvite);
		
	},
	toggleEmailButton : function(e,communityInvite) {
		var timedButton = function() {
			var recipientList = Dom.get(communityInvite.settings.recipientListId);
			var selectedInList = Dom.getElementsByClassName("selected", "li", recipientList).length;
			var removeEmailButton = Dom.get(communityInvite.settings.removeEmailButtonId);
			if(Dom.hasClass(removeEmailButton, "disabled")) {
				
				Dom.removeClass(removeEmailButton, "disabled");
				removeEmailButton.removeAttribute("disabled");
			} else {
				if(selectedInList == 0) {
					Dom.addClass(removeEmailButton, "disabled");
					removeEmailButton.setAttribute("disabled", "disabled");
				}
			}
		}
		var timedButtonSet = window.setTimeout(function(){timedButton();},50);
	},
	togglePlayerButton : function(e,communityInvite) {
		var resultList = Dom.get(communityInvite.settings.searchResultListId);
		var addPlayerButton = Dom.get(communityInvite.settings.addSearchPlayerButtonId);
		var selectedInList = Dom.getElementsByClassName("selected", "li", resultList).length;
		if(Dom.hasClass(addPlayerButton, "disabled")) {
			Dom.removeClass(addPlayerButton, "disabled");
			addPlayerButton.removeAttribute("disabled");
		} else {
			if(selectedInList == 0) {
				Dom.addClass(addPlayerButton, "disabled");
				addPlayerButton.setAttribute("disabled", "disabled");
			}
		}
	},
	toggleListitem : function() {
		if(Dom.hasClass(this, "selected")) {
			Dom.removeClass(this, "selected");
		} else {
			Dom.addClass(this, "selected");
		}
	},
	setFormValues : function() {
		var recipientList = Dom.get(this.settings.recipientListId);
		var recipientListItems = recipientList.getElementsByTagName("li");
		
		var emailList = Dom.get(this.settings.communityEmailRecipients);
		var playerList = Dom.get(this.settings.communityPlayerIdRecipients);
		playerList.value = "";
		emailList.value = "";
		
		for(var i=0; i<recipientListItems.length; i++) {
			if(Dom.hasClass(recipientListItems[i], "email")) {
				emailList.value += recipientListItems[i].getAttribute("title") + ";";
			}
			if(Dom.hasClass(recipientListItems[i], "player")) {
				playerList.value += recipientListItems[i].getAttribute("title") + ";";
			}
		}
		emailList.value = emailList.value.substring(0,emailList.value.length -1);
		playerList.value = playerList.value.substring(0,playerList.value.length -1);
			
	},
	submitForm : function(e,communityInvite) {

		if(communityInvite.validateForm()) {
			communityInvite.drawFeedbackMessage("Bezig met verzenden...", "notify");
			communityInvite.setFormValues();
			// submit	the form
			
			var callback =  {   
				success: function(o) {
					// close the lightbox form
					o.argument.communityInvite.drawFeedbackMessage("Spelers succesvol uitgenodigd, het formulier wordt automatisch afgesloten.", "ok");
					var timedCloseFunc = function() {
						o.argument.communityInvite.closeForm();
					}
					var timedClose = window.setTimeout(function() {timedCloseFunc();}, 2000);
				},
					
				failure: function(o) { 
					o.argument.communityInvite.drawFeedbackMessage("Er ging iets fout tijdens het verzenden probeer het nogmaals.", "error");
				}, 
				
				argument : {communityInvite: communityInvite}
		  }
		  YAHOO.util.Connect.setForm(Dom.get(communityInvite.settings.inviteFormId)); 
			var transaction = YAHOO.util.Connect.asyncRequest('POST', communityInvite.settings.intviteFormPostUrl, callback);
		}
	},
	validateForm : function() {
		var errorMsg = "";
		if(trim(Dom.get(this.settings.fromNameInputId).value) == "") {
			errorMsg += "<div>- Geen afzender ingevuld.</div>";
			Dom.addClass(this.settings.fromNameInputId, "error");
		} else {
			Dom.removeClass(this.settings.fromNameInputId, "error");
		}
		
		if(trim(Dom.get(this.settings.msgInputId).value) == "") {
			errorMsg += "<div>- Geen bericht ingevuld.</div>";
			Dom.addClass(this.settings.msgInputId, "error");
		} else {
			Dom.removeClass(this.settings.msgInputId, "error");
		}
		if(Dom.get(this.settings.recipientListId).getElementsByTagName("li").length == 0) {
			errorMsg += "<div>- Geen ontvangers geselecteerd.</div>";
			Dom.addClass(this.settings.recipientListId, "error");
		} else {
			Dom.removeClass(this.settings.recipientListId, "error");
		}
		
		if(errorMsg == "") {
			return true;
		} else {
			this.drawFeedbackMessage(errorMsg,"error");
		}
		
	},
	drawFeedbackMessage : function(errorMsg, msgType) {
		if(!Dom.get(this.settings.errorMsgId)) {
			var errorMsgContainer = document.createElement("div");
			var errorText = document.createTextNode("");
			errorMsgContainer.appendChild(errorText);
			errorMsgContainer.setAttribute("id", this.settings.errorMsgId);
			Dom.addClass(errorMsgContainer, msgType);
			errorMsgContainer.innerHTML = errorMsg;
			Dom.get(this.settings.inviteFormId).appendChild(errorMsgContainer);
			
		} else {
				var errorMsgContainer = Dom.get(this.settings.errorMsgId);
				
				// clean classes
				Dom.removeClass(errorMsgContainer, "error");
				Dom.removeClass(errorMsgContainer, "notify");
				Dom.removeClass(errorMsgContainer, "ok");
				Dom.removeClass(errorMsgContainer, "empty");
				
				// set new class
				Dom.addClass(errorMsgContainer, msgType);
				errorMsgContainer.innerHTML = errorMsg;
		}

	},
	closeForm : function() {
		// close lightbox callback
		YAHOO.flexvoetbal.overlayPanel.close();
	}
}

function AcceptInviteForCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	getContentXML('member', 'acceptInviteForCommunity', '', URLe);
}

function DeleteInviteForCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	getContentXML('member', 'deleteInviteForCommunity', '', URLe);
}

function DeleteInviteForCommunityOwn(communityID)
{
	var URLe = '&communityID='+communityID;
	
	getContentXML('member', 'deleteInviteForCommunityOwn', '', URLe);
}

function SaveProfile(profileID)
{
	var URLe = '&profileID='+profileID;
	
	if (Dom.get('username_input')) {
		URLe+= '&username='+escape(Dom.get('username_input').value);
	}
	if (Dom.get('firstname_input')) {
		URLe+= '&firstname='+escape(Dom.get('firstname_input').value);
	}
	if (Dom.get('lastname_input')) {
		URLe+= '&lastname='+escape(Dom.get('lastname_input').value);
	}
	if (Dom.get('email_input')) {
		URLe+= '&email='+escape(Dom.get('email_input').value);
	}
	if (Dom.get('interest_input')) {
		URLe+= '&interest='+escape(Dom.get('interest_input').value);
	}
	if (Dom.get('msn_input')) {
		URLe+= '&msn='+escape(Dom.get('msn_input').value);
	}
	if (Dom.get('icq_input')) {
		URLe+= '&icq='+escape(Dom.get('icq_input').value);
	}
	if (Dom.get('country_input')) {
		URLe+= '&country='+Dom.get('country_input').options[Dom.get('country_input').selectedIndex].innerHTML;
	}
	if (Dom.get('year_input')) {
		URLe+= '&year='+Dom.get('year_input').options[Dom.get('year_input').selectedIndex].value;
	}
	if (Dom.get('month_input')) {
		URLe+= '&month='+Dom.get('month_input').options[Dom.get('month_input').selectedIndex].value;
	}
	if (Dom.get('day_input')) {
		URLe+= '&day='+Dom.get('day_input').options[Dom.get('day_input').selectedIndex].value;
	}
	
	URLe+= '&getlanguage='+escape(getSelectedRadioValue(document.getElementsByName('getlanguage_input')));
	URLe+= '&viewprofile='+escape(getSelectedRadioValue(document.getElementsByName('viewprofile_input')));
	URLe+= '&getmailpm='+escape(getSelectedRadioValue(document.getElementsByName('getmailpm_input')));
	URLe+= '&getmailresults='+escape(getSelectedRadioValue(document.getElementsByName('getmailresults_input')));
	URLe+= '&getmailnotification='+escape(getSelectedRadioValue(document.getElementsByName('getmailnotification_input')));
	URLe+= '&getmailhtml='+escape(getSelectedRadioValue(document.getElementsByName('getmailhtml_input')));
	URLe+= '&getnewsletter='+escape(getSelectedRadioValue(document.getElementsByName('getnewsletter_input')));
	URLe+= '&getoffersponsors='+escape(getSelectedRadioValue(document.getElementsByName('getoffersponsors_input')));
	
	if (Dom.get('loginstack_input')) {
		URLe+= '&loginstack='+escape(Dom.get('loginstack_input').options[Dom.get('loginstack_input').selectedIndex].innerHTML);
	}
	
	if (Dom.get('password_old_input')) {
		URLe+= '&password_old='+Dom.get('password_old_input').value
	}
	if (Dom.get('password_new_input')) {
		URLe+= '&password_new='+Dom.get('password_new_input').value
	}
	if (Dom.get('password_new_input2')) {
		URLe+= '&password_new2='+Dom.get('password_new_input2').value
	}
	
	//extra details
	if (Dom.get('gender_input')) {
		URLe+= '&gender_input='+escape(getSelectedRadioValue(document.getElementsByName('gender_input')))
	}
	if (Dom.get('straat_input')) {
		URLe+= '&straat_input='+escape(Dom.get('straat_input').value);
	}
	if (Dom.get('huisnummer_input')) {
		URLe+= '&huisnummer_input='+escape(Dom.get('huisnummer_input').value);
	}
	if (Dom.get('postcode_input')) {
		URLe+= '&postcode_input='+escape(Dom.get('postcode_input').value);
	}
	if (Dom.get('woonplaats_input')) {
		URLe+= '&woonplaats_input='+escape(Dom.get('woonplaats_input').value);
	}
	if (Dom.get('telefoonnummer_input')) {
		URLe+= '&telefoonnummer_input='+escape(Dom.get('telefoonnummer_input').value);
	}
	if (Dom.get('mobielnummer_input')) {
		URLe+= '&mobielnummer_input='+escape(Dom.get('mobielnummer_input').value);
	}
	if (Dom.get('favo_input')) {
		URLe+= '&favo_input='+escape(Dom.get('favo_input').value);
	}
	
	getContentXML('member', 'saveProfile', '', URLe);
}

function DeleteProfile(profileID)
{
	var URLe = '&profileID='+profileID;
	
	getContentXML('member', 'deleteProfile', '', URLe);
}

function JoinCommunity(profileID)
{
	var URLe = '&profileID='+profileID;
	
	if (Dom.get('community_input')) {
		URLe+= '&communityID='+Dom.get('community_input').options[Dom.get('community_input').selectedIndex].value;
		URLe+= '&communityName='+Dom.get('community_input').options[Dom.get('community_input').selectedIndex].innerHTML;
		
		if (Dom.get('community_input').options[Dom.get('community_input').selectedIndex].value) {
			getContentXML('member', 'joinCommunity', '', URLe);
		}
	}
}

function RequestCommunity(profileID)
{
	var URLe = '&profileID='+profileID;
	
	if (Dom.get('com_name')) {
		URLe+= '&comName='+Dom.get('com_name').value;
	}
	
	URLe+= '&comPrivate='+escape(getSelectedRadioValue(document.getElementsByName('com_private')));
	
	getContentXML('member', 'requestCommunity', '', URLe);
}

function checkKeySearchMember(evt)
{
	//check if event is passed (has to in FireFox, does not in IE)
	//if (!evt) var evt = window.event;
	if (evt.keyCode == 13) {
		SearchMember();
		return false;
	} else {
		return true;
	}
}

function SearchMember()
{
	var memberName = '';
	
	if (Dom.get('search_member')) {
		memberName = Dom.get('search_member').value;
	}
	
	if (memberName.length) {
		var URLe = '&memberName='+memberName;
		
		getContentXML('member', 'searchMember', '', URLe);
	}
}

function displayCupRanking()
{
	getContentXML('game', 'completerankingprizes');
}

function updateTeamSelectboxes(activeBox, boxNumber, pouleId) {
	
	// reset previous selected teamId
	var pouleSelectBoxes = Dom.getElementsByClassName("teamStand_" + pouleId);
	var currentTeam = activeBox.options[activeBox.selectedIndex].value;
	
	for(var i=0; i< pouleSelectBoxes.length; i++) {
	var checkedTeam = pouleSelectBoxes[i].options[pouleSelectBoxes[i].selectedIndex].value;
	if(currentTeam == checkedTeam && pouleSelectBoxes[i].id != activeBox.id) {
		// reset box
		pouleSelectBoxes[i].selectedIndex = 0;
	}		
	}
}


function calculateEndPrediction(gameID, profileID)
{
	var URLe = '&gameID='+gameID+'&profileID='+profileID;
	
	URLe+= createUrlFromMultipleInput('drawscore1', 'drawIDs', false);
	URLe+= createUrlFromMultipleInput('drawscore2', 'drawIDs', false);
	
	getContentXML('game', 'calculateEndPrediction', '', URLe);
}

function savePredictionEndRanking(totalteams, gameID, profileID, poulsString)
{
	if (typeof gameID === 'undefined') gameID = false;
	if (typeof profileID === 'undefined') profileID = false;
	
	//save normal prediction as well
	if (gameID && profileID) {
		SavePrediction(gameID, profileID, true, totalteams, poulsString);
	}
	
	var selectedTeams = '';
	
	var poulsArray = poulsString.split(",");
	for (var p in poulsArray){
		//get selected teams
		for (i = 1; i <= totalteams; i++) {
			if (Dom.get('predictionteam'+i+'_'+poulsArray[p]).selectedIndex) {
				selectedTeams+= '&predictionteam_'+i+'_'+poulsArray[p]+'='+Dom.get('predictionteam'+i+'_'+poulsArray[p]).options[Dom.get('predictionteam'+i+'_'+poulsArray[p]).selectedIndex].innerHTML;
			} else {
				selectedTeams = '&predictionteam=1';
				break;
			}
		}
	}
	
	var URLe = selectedTeams+'&totalTeams='+totalteams+'&poulsString='+poulsString;

	getContentXML('game', 'savePredictionEndRanking', '', URLe);
}

function ClearCommunityRequest()
{
	Dom.get('mp_community').style.display = 'none';
	Dom.get('com_name').value = '';
	
	var privatebuttons = document.getElementsByTagName('com_private');
	
	for (i = 0; i < privatebuttons.length; i++) {
		privatebuttons.options[i].selected = false;
	}
}

function InboxPersonalMessage(state)
{
	var URLe = '&state='+state;
	
	getContentXML('pm', 'getPersonalMessages', '', URLe);
}

function OutboxPersonalMessage(state)
{
	var URLe = '&state='+state;
	
	getContentXML('pm', 'getPersonalMessages', '', URLe);
}

function NewPersonalMessage()
{
	//clear the user-array first
	userArray = new Array();
	
	var URLe = '';
	
	getContentXML('pm', 'getNewPersonalMessage', '', URLe);
}

function ReplyPersonalMessage(pmID, state)
{
	var URLe = '&pmID='+pmID+'&state='+state+'&replyMessage=1';
	
	getContentXML('pm', 'getNewPersonalMessage', '', URLe);
}

function SendPersonalMessage()
{
	var URLe = '';
	
	URLe+= '&receivers='+escape(Dom.get('receiver').value);
	URLe+= '&subject_input='+escape(Dom.get('subject_input').value);
	URLe+= '&message_input='+escape(Dom.get('message_input').value);
	if (Dom.get('com_input')) {
		URLe+= '&com_input='+Dom.get('com_input').options[Dom.get('com_input').selectedIndex].value;
	}
	
	if (Dom.get('usequote')) {
		if (Dom.get('usequote').checked) {
			URLe+= '&usequote=1';
		}
	}
	
	if (Dom.get('origpmID')) {
		URLe+= '&origpmID='+Dom.get('origpmID').value;
	}
	if (Dom.get('state')) {
		URLe+= '&state='+Dom.get('state').value;
	}
	
	getContentXML('pm', 'sendPersonalMessage', '', URLe);
}

function ClearPersonalMessage()
{
	Dom.get('receiver').value = '';
	Dom.get('subject_input').value = '';
	Dom.get('message_input').value = '';
	Dom.get('com_input').selectedIndex = 0;
	
	userArray = new Array();
}

function ViewPersonalMessage(pmID, state, page)
{
	if (typeof page === 'undefined') page = 1;
	
	var URLe = '&pmID='+pmID+'&state='+state+'&page='+page;
	
	//get page of message
	if (Dom.get('pmpage')) {
		URLe+= '&pmpage='+Dom.get('pmpage').value;
	}
	
	getContentXML('pm', 'viewPersonalMessage', '', URLe, '', false); //turn on refreshing banners??
}

function SetSelectedMessageRow(pmID)
{
	if (Dom.get('pm_'+pmID)) {
		Dom.get('pm_'+pmID).className = 'selected';
	}
}

function ToggleDeletePersonalMessagesButton()
{
	var oneSelected = false;
	//get all selected pm's
	var pmIDs = document.getElementsByName('pm_ids');
	var selectedPMids = ''
	for (var i=0; i < pmIDs.length; i++) {
		if (pmIDs[i].checked) {
			oneSelected = true;
			break;
		}
	}
	
	if (oneSelected) {
		Dom.get('deletePersonalMessage').style.display = 'inline';
	} else {
		Dom.get('deletePersonalMessage').style.display = 'none';
	}
}

function DeletePersonalMessage(pmID, state, Language)
{
	if (Language == 'eng') {
		var agree = confirm('Are you sure you want to delete this message(s)?');
	} else {
		var agree = confirm('Weet je zeker dat je deze bericht(en) wilt verwijderen?');
	}
	
	if (agree) {
		var URLe = '&pmID='+pmID+'&state='+state;
		
		getContentXML('pm', 'deletePersonalMessage', '', URLe, '', false);
	}
}

function DeletePersonalMessages(Language)
{
	if (Language == 'eng') {
		var agree = confirm('Are you sure you want to delete this message(s)?');
	} else {
		var agree = confirm('Weet je zeker dat je deze bericht(en) wilt verwijderen?');
	}
	
	if (agree) {
		var URLe = '&state='+Dom.get('state').value;
		
		//get all selected pm's
		var pmIDs = document.getElementsByName('pm_ids');
		var selectedPMids = ''
		for (var i=0; i < pmIDs.length; i++) {
			if (pmIDs[i].checked) {
				selectedPMids+= pmIDs[i].value+','
			}
		}

		URLe+= '&pmID='+selectedPMids;

		getContentXML('pm', 'deletePersonalMessage', '', URLe, '', false);
	}
}

function GetPersonalMessages(page)
{
	var URLe = '&pmpage='+page;
	
	state = Dom.get('state').value;
	URLe+= '&state='+state;
	
	getContentXML('pm', 'getPersonalMessages', '', URLe);
}

function GetUsersForPersonalMessage(evt)
{
	//x = evt.keyCode; alert("Keyboard Value: "+x);
  
  Dom.get('pmnameselect').style.display = 'inline';
	
	var URLe = '';
	
	//check on enter and fill in first name
	if (evt.keyCode == 13 || evt.keyCode == 35 || evt.keyCode == 37 || evt.keyCode == 38 || evt.keyCode == 39 || evt.keyCode == 40 || evt.keyCode == 46) { //enter, end, delete, and arrow keys
		//do not do anything (yet)
	} else if (evt.keyCode == 27) { //escape
		//close search window
		Dom.get('pmnameselect').innerHTML = '';
		Dom.get('pmnameselect').style.display = 'none';
	} else {
		if (evt.keyCode == 8) { //delete last user
			//copy array
			
			var tmpuserArray = new Array();
				
			for (i = 0; i < (userArray.length-1); i++) {
				tmpuserArray[tmpuserArray.length] = userArray[i];
			}		
			
			var recipients = '';
				
			for (i = 0; i < tmpuserArray.length; i++) {
				recipients+= tmpuserArray[i]+',';
			}
			//draw recipients again
			Dom.get('receiver').value = recipients;
			
			//empty array
			userArray = new Array();
			//and fill again
			for (i = 0; i < tmpuserArray.length; i++) {
				userArray[userArray.length]= tmpuserArray[i];
			}
			
			//empty and close foundmembers field
			Dom.get('pmnameselect').style.display = 'none';
			Dom.get('pmnameselect').innerHTML = '';
		} else {
		
			URLe+= '&nameValue='+escape(Dom.get('receiver').value);
		
			getContentXML('pm', 'getFindUserForPersonalMessage', '', URLe, '', false);
		}
	}
}

var userArray = new Array();
function GetUserForPersonalMessage(username)
{
	//put into js array
	userArray[userArray.length] = escape(username);
	
	var recipients = '';
	
	for (i = 0; i < userArray.length; i++) {
		recipients+= unescape(userArray[i])+',';
	}
	
	Dom.get('receiver').value = recipients;
	
	//focus receiver-field
	Dom.get('receiver').focus();
	
	//empty and close foundmembers field
	Dom.get('pmnameselect').style.display = 'none';
	Dom.get('pmnameselect').innerHTML = '';
}

function saveShout(gameID)
{
	var URLe = '&gameID='+gameID;
	
	if (Dom.get('shout_communityID')) {
		URLe+= '&shout_communityID='+Dom.get('shout_communityID').value
	}
	
	if (Dom.get('shout_udpGameID')) {
		URLe+= '&shout_udpGameID='+Dom.get('shout_udpGameID').value
	}
	
	URLe+= '&shout_hiddenusername='+escape(Dom.get('shout_hiddenusername').value);
	URLe+= '&shout_subject='+escape(Dom.get('shout_subject').value);
	URLe+= '&shout_message='+escape(Dom.get('shout_message').value);
	
	getContentXML('index', 'saveShout', '', URLe);
}

function deleteShout(shoutID)
{
	var agree = confirm('Weet je het zeker dat je deze shout wilt verwijderen?');
	if (agree) {
		var URLe = '&shoutID='+shoutID;
		
		if (Dom.get('shout_communityID')) {
			URLe+= '&shout_communityID='+Dom.get('shout_communityID').value
		}
		
		if (Dom.get('shout_udpGameID')) {
			URLe+= '&shout_udpGameID='+Dom.get('shout_udpGameID').value
		}
		
		getContentXML('index', 'deleteShout', '', URLe);
	} else {
		return false;
	}
}

function saveComment(newsID)
{
	var URLe = '&newsID='+newsID;
	
	URLe+= '&comment_message='+escape(Dom.get('comment_message').value);
	
	getContentXML('member', 'saveComment', '', URLe);
}

function showTRRegisterPage()
{
	if (Dom.get('vioffer_input')) {
		if (Dom.get('vioffer_input').checked) {
			Dom.get('extrainfo_register').style.display = 'block';
		} else {
			Dom.get('extrainfo_register').style.display = 'none';
		}
	}
}

function RecalculatePointsGraph(profileIDToUse, gameIDToUse, selectedGraph)
{
	var URLe = '&profileIDToUse='+profileIDToUse+'&gameIDToUse='+gameIDToUse+'&selectedGraph='+selectedGraph;
	
	getContentXML('graphstats', 'recalculatePointsGraph', '', URLe);
}

var initYuiCalendar = function(targetObj) {
   		var currentCal = Dom.get(targetObj.rel + "_cal");
   		
   		if(currentCal) {
   			if(currentCal.style.display == "inline") {
   				Dom.get(targetObj.rel + "_cal").style.display="none";
   			}
   			else {
   				Dom.get(targetObj.rel + "_cal").style.display="inline";
   			}
   		}
   		
   		var yuiCal = new YAHOO.widget.Calendar("yuical_" + targetObj.rel,targetObj.rel + "_cal");
   		yuiCal.cfg.setProperty("MONTHS_SHORT",   ["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]);
   		yuiCal.cfg.setProperty("MONTHS_LONG",    ["januari", "februari", "maart", "april", "mei", "juni", "juli", "agustus", "september", "oktober", "november", "december"]);
   		yuiCal.cfg.setProperty("WEEKDAYS_1CHAR", ["Z", "M", "D", "W", "D", "F", "Z"]);
  		yuiCal.cfg.setProperty ("WEEKDAYS_SHORT", ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"]);
   		yuiCal.cfg.setProperty("WEEKDAYS_MEDIUM",["zon", "maa", "din", "woe", "don", "vri", "zat"]);
   		yuiCal.cfg.setProperty("WEEKDAYS_LONG",  ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]);
   		yuiCal.cfg.setProperty("SHOW_WEEK_HEADER",true);
   		yuiCal.cfg.setProperty("mindate",new Date());
   		var storedDate = Dom.get(targetObj.rel).value;
   		var storedDateSplit = storedDate.split("-");
   		
   		if(storedDateSplit.length == 3) {
   			var storedDataConfig = storedDateSplit[1] + "/" + storedDateSplit[2] + "/" + storedDateSplit[0];
   			yuiCal.select(storedDataConfig);
   			yuiCal.cfg.setProperty("pagedate", storedDateSplit[1] + "/" + storedDateSplit[0]);
   		}
   		   		
			var selectDate = function(type,args,obj) {
				var dates = args[0];
				var date = dates[0];
				
				var sYear = date[0];
				var sMonth = date[1];
				var sDay = date[2];
	
				
				if(sDay.toString().length == 1) {
						sDay = "0" + sDay.toString();
				}
				if(sMonth.toString().length == 1) {
						sMonth = "0" + sMonth.toString();
				}
			
				var inputTarget = Dom.get(targetObj.rel);
				inputTarget.value = sYear + "-" + sMonth + "-" + sDay;
				yuiCal.hide();
			};
			yuiCal.selectEvent.subscribe(selectDate, yuiCal, true);
   		yuiCal.render();

   		return false;		
}

YAHOO.flexvoetbal.announcements = {
	settings : {
		announcmentData 							: "",
		announcementUrl 							: "/custom/getContentXML.php?A=S&module=index&submodule=getAnnouncement",
		closeAnnouncementUrl 					: "/custom/getContentXML.php?A=S&module=index&submodule=closeAnnouncement&announcementID=",
		staticAnnouncmentId						: "staticAnnouncement",
		staticAnnouncmentTitleClass		:	"announcementTitle",
		staticAnnouncmentContentClass	: "announcementContent"
	},
	getAnnouncement : function(isStatic) {
		
		var callback =  {   
			
			success: function(o) {
				// set content in overlay panel object
				var dataNode = o.responseXML.getElementsByTagName("Data");
				if(dataNode && dataNode[0]) {
					o.argument.announcements.settings.announcmentData = unescape(dataNode[0].getAttribute("Content"));
				}
				o.argument.announcements.checkAnnouncement(isStatic);
			},
				
			failure: function(o) { 
				
			}, 
			
			argument : {announcements: this}
		}	
		var transaction = YAHOO.util.Connect.asyncRequest('GET', this.settings.announcementUrl, callback, null);
		
	},
	
	checkAnnouncement : function(isStatic) {
		if(this.settings.announcmentData != "") {
			this.drawAnnouncement();
		}
		
		// check for static announcments
		if(Dom.get(this.settings.staticAnnouncmentId) && isStatic) {
			var staticAnnouncmentData = Dom.getElementsByClassName(this.settings.staticAnnouncmentContentClass, "span", this.settings.staticAnnouncmentId)[0];
			
			if(staticAnnouncmentData){
				this.settings.announcmentData =	staticAnnouncmentData.innerHTML;
			} else {
				this.settings.announcmentData = "Geen data gevonden"; 
			}
			this.drawAnnouncement(); 
		}
	},
	
	drawAnnouncement : function() {
		YAHOO.flexvoetbal.overlayPanel.init({
			url: false,
			cachedContent : this.settings.announcmentData,	
			title: '<span>mededeling</span><img src="/gfx/close3.gif" class="close" alt="close" onclick="YAHOO.flexvoetbal.announcements.closeAnnouncment(); return false;" />',
			width: "550px",
			height: "auto",
			close: false,
			effects: {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}}
		);
	},
	closeAnnouncment : function() {
		var callback =  {   
			
			success: function(o) {
				// do nothing
				
			},
				
			failure: function(o) { 
				
			}, 
			
			argument : {announcements: this}
		}	
		
		var announcementFormId = Dom.get("announcementID");
		if(announcementFormId) {
			var announcementID = announcementFormId.value;
		} 
		else {
			var announcementID = 0;
		}
		var transaction = YAHOO.util.Connect.asyncRequest('GET', this.settings.closeAnnouncementUrl + announcementID, callback, null);
		YAHOO.flexvoetbal.overlayPanel.close();
	}
	 
}
var initAnnouncement = function() {
	if(Dom.get("hp_content") && Dom.get("personalStats")) {
			YAHOO.flexvoetbal.announcements.getAnnouncement();
	}
	
}

var drawStaticAnnouncement = function() {
		YAHOO.flexvoetbal.announcements.getAnnouncement(true);
}

//Event.onDOMReady(initAnnouncment);
Event.addListener(window, "load", initAnnouncement);



function ActivateGame(GameID, formname)
{
	if (GameID.length == 0) return false;
	
	Dom.get('hiddengameID').value = GameID;
	
	//submit form
	document.selectmanager.submit();
}

function activateGeneralPool(gameID, redirectToRanking)
{
	if (typeof redirectToRanking == 'undefined') redirectToRanking = 0;
	
	var URLe = '&gameIDForActivation='+gameID+'&redirectToRanking='+redirectToRanking;
	
	getContentXML('index', 'activateGeneralPool', '', URLe);
}

function deactivateGeneralPool(gameID)
{
	var URLe = '&gameIDForActivation='+gameID;
	
	getContentXML('index', 'deactivateGeneralPool', '', URLe);
}

function getGeneralPool(gameName, gameID, communityName, directToCommunity, showLoader)
{
	if (typeof gameID == 'undefined') gameID = 0;
	if (typeof communityName == 'undefined') communityName = '';
	if (typeof directToCommunity == 'undefined') directToCommunity = 0;
	if (typeof showLoader == 'undefined') showLoader = false;
	
	var URLe = '&gameName='+escape(gameName)+'&showgameID='+gameID+'&communityName='+communityName+'&directToCommunity='+directToCommunity;
	
	if (showLoader) {
		//show loading
		showLoadingDiv();
		getContentXML('index', 'getGeneralPool', '', URLe, 'hideLoadingDiv();');
	} else {
		getContentXML('index', 'getGeneralPool', '', URLe);
	}
}

function selectGameCommunity(communityName, selectedGameName)
{
	getGeneralPool(selectedGameName, 0, communityName, 1, true);
}

function getRankingGeneralGame(gameID)
{
	var URLe = '&gameID='+gameID;
	
	if (Dom.get('myprediction')) {
		URLe+= '&myprediction='+Dom.get('myprediction').value;
	}
	
	showLoadingDiv();
	
	getContentXML('index', 'getRankingGeneralGame', '', URLe, 'hideLoadingDiv();');
}

function getDrawGeneralGame(gameID)
{
	var URLe = '&gameID='+gameID;
	
	if (Dom.get('myprediction')) {
		URLe+= '&myprediction='+Dom.get('myprediction').value;
	}
	
	showLoadingDiv();
	
	getContentXML('index', 'getDrawGeneralGame', '', URLe, 'hideLoadingDiv();');
}

function getPredictionGeneralGame(gameID, fromCommunity)
{
	if (typeof fromCommunity === 'undefined') fromCommunity = 0;
	
	var URLe = '&gameID='+gameID+'&useXML=1&fromCommunity='+fromCommunity;
	
	if (Dom.get('myprediction')) {
		URLe+= '&myprediction='+Dom.get('myprediction').value;
	}
	
	showLoadingDiv();
	
	getContentXML('index', 'getPredictionGeneralGame', '', URLe, 'hideLoadingDiv();');
}

function viewPredictionGeneralGame(gameID, profileID, fromCommunity)
{
	if (typeof fromCommunity === 'undefined') fromCommunity = 0;
	
	var URLe = '&gameID='+gameID+'&profileID='+profileID+'&fromCommunity='+fromCommunity;
	
	if (Dom.get('myprediction')) {
		URLe+= '&myprediction='+Dom.get('myprediction').value;
	}
	
	showLoadingDiv();
	
	getContentXML('index', 'viewPredictionGeneralGame', '', URLe, 'hideLoadingDiv();');
}

function GotoRankingGame(gameName, gameID)
{
	getGeneralPool(gameName, gameID);
}

function displayTextForSubscribe(part)
{
	var URLe = '&part='+part;
	
	getContentXML('index', 'displayTextForSubscribe', '', URLe, '', false);
}

function showLoadingDiv()
{
	if (Dom.get('loadingDiv')) {
		Dom.get('loadingDiv').style.display = 'inline';
	}
}

function hideLoadingDiv()
{
	if (Dom.get('loadingDiv')) {
		Dom.get('loadingDiv').style.display = 'none';
	}
}

function SavePrediction(gameID, profileID, byEndPrediction, totalteams, poulsString)
{
	if (typeof byEndPrediction === 'undefined') byEndPrediction = false;
	if (typeof totalteams === 'undefined') totalteams = 0;
	if (typeof poulsString === 'undefined') poulsString = 'a';
	
	//gather all not disabled predictions
	var URLe = '&gameID='+gameID+'&profileID='+profileID;
	
	if (byEndPrediction) {
		URLe+= '&byEndPrediction='+byEndPrediction; 	
	}
	
	if (Dom.get('newPrediction')) {
		URLe+= '&newPrediction='+Dom.get('newPrediction').value;
		URLe+= createUrlFromMultipleInput('drawscore1', 'drawIDs', true);
		URLe+= createUrlFromMultipleInput('drawscore2', 'drawIDs', true);
	} else {
		//URLe+= createUrlFromMultipleInput('drawscore1', 'drawIDs', false, true);
		//URLe+= createUrlFromMultipleInput('drawscore2', 'drawIDs', false, true);
		URLe+= createUrlFromMultipleInput('drawscore1', 'drawIDs', false, false);
		URLe+= createUrlFromMultipleInput('drawscore2', 'drawIDs', false, false);
	}
	
	var winner = Dom.get('winner').options[Dom.get('winner').selectedIndex].value;
	URLe+= '&winner='+winner;
		
	if (Dom.get('yellow')) {
		URLe+= '&yellow='+Dom.get('yellow').value;
	}
	
	if (Dom.get('red')) {
		URLe+= '&red='+Dom.get('red').value;
	}
	
	if (Dom.get('goals')) {
		URLe+= '&goals='+Dom.get('goals').value;
	}
	
	if (Dom.get('topscorer')) {
		URLe+= '&topscorer='+escape(Dom.get('topscorer').value);
	}
	
	URLe+= '&viewprediction='+escape(getSelectedRadioValue(document.getElementsByName('viewprediction')));
	if (Dom.get('oldviewprediction')) {
		URLe+= '&oldviewprediction='+Dom.get('oldviewprediction').value;
	}
	URLe+= '&mailprediction='+getSelectedRadioValue(document.getElementsByName('mailprediction'));
	
	if (!byEndPrediction) {
		showLoadingDiv();
	}
	
	//disable submit button to prevent double submitting
	Dom.get('savepredictionbutton').disabled = true;
	
	//remove newPrediction hidden variable
	if (Dom.get('newPrediction')) {
		Dom.get('newPrediction').value = 0;
	}
	
	//get end predictions as well for use in mail at first, maybe later save it as well
	var selectedTeams = '';
	
	var poulsArray = poulsString.split(",");
	for (var p in poulsArray){
		//get selected teams
		for (i = 1; i <= totalteams; i++) {
			if (Dom.get('predictionteam'+i+'_'+poulsArray[p]).selectedIndex) {
				selectedTeams+= '&predictionteam_'+i+'_'+poulsArray[p]+'='+Dom.get('predictionteam'+i+'_'+poulsArray[p]).options[Dom.get('predictionteam'+i+'_'+poulsArray[p]).selectedIndex].innerHTML;
			} else {
				selectedTeams = '&predictionteam=1';
				break;
			}
		}
	}
	
	URLe+= selectedTeams+'&totalTeams='+totalteams+'&poulsString='+poulsString;
	
	if (!byEndPrediction) {
		getContentXML('game', 'savePrediction', '', URLe, 'hideLoadingDiv(); Dom.get(\'savepredictionbutton\').disabled = false;');
	} else {
		getContentXML('game', 'savePrediction', '', URLe, 'Dom.get(\'savepredictionbutton\').disabled = false;');
	}
}

function GameEdit(gameID)
{
	if (GameID.length == 0) return false;
	
	var URLe = '&gameID='+gameID;
	
	getContentXML('index', 'getGameHistory', '', URLe);
}

function CompleteActionCommunityActivation()
{
	//clear community name
	Dom.get('com_name').value = '';
	
	//clear private selection
	privateRadio = document.getElementsByName('com_private');
		
	for (var i = 0; i < privateRadio.length; i++) {
		privateRadio[i].selected = false;
	}
	
	//do some menu things
	YAHOO.util.Event.onAvailable("mymenu", doInit);
	mpTabInit();
}

function DeleteNewsItem(newsID)
{
	var URLe = '&newsID='+newsID;
	
	getContentXML('index', 'deleteNewsItem', '', URLe);
}

function TellAFriend()
{
	var URLe = '';
	
	//get values and check if filled
	if (Dom.get('taf_to_home')) {
		URLe+= '&taf_to_home='+escape(Dom.get('taf_to_home').value);
	}
	
	if (Dom.get('taf_toe_home')) {
		URLe+= '&taf_toe_home='+escape(Dom.get('taf_toe_home').value);
	}
	
	if (Dom.get('taf_from_home')) {
		URLe+= '&taf_from_home='+escape(Dom.get('taf_from_home').value);
	}
	
	getContentXML('index', 'tellAFriend', '', URLe);
}

function EnterVote(answer, pollid, lan, pollQuestion)
{
	var URLe = '&answer='+answer+'&pollid='+pollid+'&lan='+lan+'&pollQuestion='+escape(pollQuestion);
	
	getContentXML('index', 'addPollVote', '', URLe);
	
	//TODO: why does the callwhendone do not work here???
	setTimeout("animatePollResults('pollre')", 1000);
}

function animatePollResults(prclass) 
{
	var pollResults = YAHOO.util.Dom.getElementsByClassName('pollre', 'img');
 	var pollAnim = Array();
 	
 	for(i=0; i<pollResults.length;i++) {
		pollAnim[i] = new YAHOO.util.Anim(pollResults[i]); 
		drawingWidth = pollResults[i].id;

		pollAnim[i].attributes.width = { to: drawingWidth }; 
		pollAnim[i].duration = 1; 
		pollAnim[i].method = YAHOO.util.Easing.easeOut; 
		pollAnim[i].animate(); 
 	}
}

function ShowHidePlayedMatches(displayProp)
{
	var idRegExp = /^PlayedMatch_/;
	var idRegExp2 = /^Header_PlayedMatch_/;
	var oSel = document.getElementsByTagName('TABLE');  if (!oSel.length) return false;
	for (var i = 0; i < oSel.length; i++) {
		if (oSel[i].id == 'fixtures')	 {
			aTr = oSel[i].getElementsByTagName('TR'); if (!aTr.length) return false;
			for (var j = 0; j < aTr.length; j++) {
				if (idRegExp.test(aTr[j].id)) {
					if (displayProp == 'inline') {
						if (aTr[j].style.display == 'none') {
							aTr[j].style.display = '';	
						}
					} else {
						aTr[j].style.display = displayProp;	
					}
				}
				//this is for the headers
				if (idRegExp2.test(aTr[j].id)) {
					if (displayProp == 'inline') {
						if (aTr[j].style.display == 'none') {
							aTr[j].style.display = '';	
						}
					} else {
						aTr[j].style.display = displayProp;	
					}
				}
			}
		}
	}
}

function loadCustomContent(mod, func, gameID)
{
	if (typeof gameID == 'undefined') {
		var URLe = '';
	} else {
		var URLe = '&gameID='+gameID;	
	}
	
	getContentXML(mod, func, '', URLe);
}

function updateResultsHomepage(activeResultTab)
{
	var URLe = '&activeTab='+activeResultTab;
	
	getContentXML('index', 'updateResultsHomepage', '', URLe);
	
	//loop this script
	timedLiveScoreUpdate(); //turned off for EK
}

function refreshResultsHomepage()
{
	var activeResultTab = Dom.getElementsByClassName("showtab", "div", "hp_resultmatches")[0];
	if (activeResultTab) {
		var activeTab = activeResultTab.id.split("_")[1];
	} else {
		var activeTab = 0;
	}
	
	var URLe = '&activeTab='+activeTab;
	
	getContentXML('index', 'updateResultsHomepage', '', URLe);
}

function getLinks()
{
	var URLe = '';
	
	getContentXML('index', 'linkslist', '', URLe);
}

function RequestCommunityOnHomepage()
{
	var URLe = '';
	
	if (Dom.get('hpcomm_name')) {
		URLe+= '&communityName='+escape(Dom.get('hpcomm_name').value);
	}
	
	if (document.getElementsByName('hpcom_setting')) {
		URLe+= '&communityPrivate='+getSelectedRadioValue(document.getElementsByName('hpcom_setting'));
	}
		
	getContentXML('member', 'requestCommunityHomepage', '', URLe);
}

function getCommunityPage(page)
{
	var URLe = '&communitypage='+page;
	
	URLe+= '&communityordering='+document.getElementById('OrderBy').value;
	URLe+= '&communityorderingorder='+document.getElementById('OrderingAmount').value;
	
	getContentXML('index', 'getCommunityPage', '', URLe);
}

function OrderCommunityList(ordering)
{
	var URLe = '&communityordering='+ordering;
	
	if (Dom.get('OrderingAmount').value == 'ASC') {
		Dom.removeClass("commSortLink", "asc");
		Dom.addClass("commSortLink", "desc");
		
		Dom.get('OrderingAmount').value = 'DESC';
		
	} else {
		Dom.removeClass("commSortLink", "desc");
		Dom.addClass("commSortLink", "asc");
		Dom.get('OrderingAmount').value = 'ASC';
	}
	
	URLe+= '&communityorderingorder='+ Dom.get('OrderingAmount').value;
	
	getContentXML('index', 'getCommunityPage', '', URLe);
}

function GatherUsernameForShoutbox()
{
	if (Dom.get('topmenu_username')) {
		usernameForShoutbox = Dom.get('topmenu_username').innerHTML;
		
		Dom.get('shout_username_td').innerHTML = '<span id="shout_username"></span><input type="hidden" id="shout_hiddenusername" value="" />';
		Dom.get('shout_hiddenusername').value = usernameForShoutbox;
		Dom.get('shout_username').innerHTML = usernameForShoutbox;
		
	} else {
		Dom.get('shout_username_td').innerHTML = '<input id="shout_hiddenusername" type="text">';
	}
}

function ActivateAccount(email_addressToUse)
{
	var URLe = '&email_addressToUse='+email_addressToUse;
	
	getContentXML('member', 'sendActivateAccountHash', '', URLe);
}

function ActivateAccountEmail()
{
	var email_addressToUse = document.getElementById('email_input').value;
	
	if (email_addressToUse.length) {
		var URLe = '&email_addressToUse='+email_addressToUse;
		
		getContentXML('member', 'sendActivateAccountHash', '', URLe);
	}
}

function ActivateAccountUsername()
{
	var usernameToUse = document.getElementById('username_input').value;
	
	if (usernameToUse.length) {
		var URLe = '&usernameToUse='+usernameToUse;
		
		getContentXML('member', 'sendActivateAccountHash', '', URLe);
	}
}

function getNormalRanking(page, useFirst, useSecond, rankingRound)
{
	if (typeof useFirst == 'undefined') useFirst = 0;
	if (typeof useSecond == 'undefined') useSecond = 0;
	if (typeof rankingRound == 'undefined') rankingRound = 0;
	
	var URLe = '&rankingpage='+page+'&useFirst='+useFirst+'&useSecond='+useSecond+'&rankingRound='+rankingRound;
	
	showLoadingDiv();
	
	getContentXML('ranking', 'getNormalRanking', '', URLe, 'hideLoadingDiv();');
}

function FindOwnRanking(gameID)
{
	if (Dom.get('hiddenroundranking1')) {
		var roundRanking1 = 1;
	} else {
		var roundRanking1 = 0;
	}
	if (Dom.get('hiddenroundranking2')) {
		var roundRanking2 = 1;
	} else {
		var roundRanking2 = 0;
	}
	if (Dom.get('rankingRound')) {
		var rankingRound = Dom.get('rankingRound').value;
	} else {
		var rankingRound = 0;
	}
	
	var URLe = '&gameID='+gameID+'&roundRanking1='+roundRanking1+'&roundRanking2='+roundRanking2+'&rankingRound='+rankingRound;
	
	showLoadingDiv();
	
	getContentXML('ranking', 'getOwnRanking', '', URLe, 'hideLoadingDiv();');
}

function FindMemberRanking(gameID)
{
	if (Dom.get('hiddenroundranking1')) {
		var roundRanking1 = 1;
	} else {
		var roundRanking1 = 0;
	}
	if (Dom.get('hiddenroundranking2')) {
		var roundRanking2 = 1;
	} else {
		var roundRanking2 = 0;
	}
	if (Dom.get('rankingRound')) {
		var rankingRound = Dom.get('rankingRound').value;
	} else {
		var rankingRound = 0;
	}
	
	if (Dom.get('search_member')) {
		var memberName = Dom.get('search_member').value;
	} else {
		var memberName = '';
	}
	
	if (memberName.length > 0) {
		var URLe = '&gameID='+gameID+'&memberName='+memberName+'&roundRanking1='+roundRanking1+'&roundRanking2='+roundRanking2+'&rankingRound='+rankingRound;
		
		showLoadingDiv();
		
		getContentXML('ranking', 'getMemberRanking', '', URLe, 'hideLoadingDiv();');
	} else {
		return false;
	}
}

function FindMemberRankingKey(evt, gameID)
{
	//check if event is passed (has to in FireFox, does not in IE)
	//if (!evt) var evt = window.event;
	if (evt.keyCode == 13) {
		FindMemberRanking(gameID);
		return false;
	} else {
		return true;
	}
}

function getRoundRanking(rankingNumber, gameID)
{
	var URLe = '&gameID='+gameID+'&rankingNumber='+rankingNumber;
	
	showLoadingDiv();
	
	getContentXML('ranking', 'getRoundRanking', '', URLe, 'hideLoadingDiv();');
}

function getExtraRoundRanking(rankingRound, gameID)
{
	var URLe = '&gameID='+gameID+'&rankingRound='+rankingRound;
	
	showLoadingDiv();
	
	getContentXML('ranking', 'getExtraRoundRanking', '', URLe, 'hideLoadingDiv();');
}

function ToggleOwnPosition(profileID)
{
	//set class if exist
	if (document.getElementById('profilerow_'+profileID)) {
		document.getElementById('profilerow_'+profileID).className = 'rankingHighlight';
	}
}

var cmenu

// hide a menu (timed by milliseconds)   
function hideMenuTimed(el, ms)
{
	cmenu = setTimeout('hideElement("'+ el + '" )', ms)
}
// hide an HTML element
function hideElement(el)
{
	var obj = Dom.get(el)
	obj.style.display = 'none'
}

// displays a menu
function showMenu(el)
{
	hideMenus()
	var obj = Dom.get(el)
	obj.style.display = 'block'
}

// hide all menu's
function hideMenus()
{
	window.clearTimeout(cmenu);
	Dom.get('gamemenu').style.display='none';
	Dom.get('mainmenu').style.display='none';
	try {
		Dom.get('mymenu').style.display='none';
		Dom.get('poolmenu').style.display='none';
		}
	catch(e) {}
}

// init comma separated menu's
function initMenus(menus)
{
	var m_array = menus.split(',')
	for(i=0;i< m_array.length;i++)
	{
		try {initMenu(m_array[i])}
		catch(e) {}
	}
}

// inits a menu (add controls)
function initMenu(m)
{
	// hide menudata
	hideElement(m)
	
	// adding controls
	Dom.get(m).onmouseover = function()
	{
	window.clearTimeout(cmenu)
	}
	Dom.get(m + '_link').onmouseover = function()
	{
		showMenu(m)
	}  
	Dom.get(m).onmouseout = function()
	{
	hideMenuTimed(this.id,500)
	}

	Dom.get(m + '_link').onmouseout = function()
	{
	hideMenuTimed(m,500)
	}
}

// onload init menu's & xml news
var doInit = function() {
	initMenus('gamemenu,mainmenu,mymenu,poolmenu');
}
YAHOO.util.Event.onAvailable("inner", doInit);

function ViewCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	getContentXML('custompool', 'getPoolContentView', '', URLe);
}

function EditCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	getContentXML('custompool', 'getPoolContentAdmin', '', URLe);
}

function getRankingCustomPool(page, gameID)
{
	var URLe = '&rankingpage='+page+'&udp_gameID='+gameID;
	
	showLoadingDiv();
	
	getContentXML('custompool', 'getRankingCustomPool', '', URLe, 'hideLoadingDiv();');
}

function getDrawCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	showLoadingDiv();
	
	getContentXML('custompool', 'getDrawCustomPool', '', URLe, 'hideLoadingDiv();');
}

function getCompareResultsCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	showLoadingDiv();
	
	getContentXML('custompool', 'getCompareResultsCustomPool', '', URLe, 'hideLoadingDiv();');
}

function getPredictionCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	showLoadingDiv();
	
	getContentXML('custompool', 'getPredictionCustomPool', '', URLe, 'hideLoadingDiv();');
}

function SaveCustomPrediction(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	URLe+= createUrlFromMultipleInput('drawscore1', 'drawIDs');
	URLe+= createUrlFromMultipleInput('drawscore2', 'drawIDs');
	
	if (Dom.get('useHalfscore')) {
		URLe+= createUrlFromMultipleInput('drawhalfscore1', 'drawIDs');
		URLe+= createUrlFromMultipleInput('drawhalfscore2', 'drawIDs');
	}
	
	if (Dom.get('useYellow')) {
		URLe+= '&yellow='+Dom.get('yellow').value;
	}
	
	if (Dom.get('useRed')) {
		URLe+= '&red='+Dom.get('red').value;
	}
	
	if (Dom.get('useGoal')) {
		URLe+= '&goal='+Dom.get('goal').value;
	}
	
	if (Dom.get('useTopscorer')) {
		URLe+= '&topscorer='+Dom.get('topscorer').value;
	}
	
	URLe+= '&viewprediction='+escape(getSelectedRadioValue(document.getElementsByName('viewprediction')));
	
	getContentXML('custompool', 'savePredictionCustomPool', '', URLe);
}

function MemberlistCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	getContentXML('custompool', 'getMemberlistCustomPool', '', URLe);
}

function UpdateCustomPoolMember(gameID, profileID, mValue, State)
{
	var URLe = '&udp_gameID='+gameID+'&udp_profileID='+profileID+'&value='+mValue+'&state='+State;
	
	getContentXML('custompool', 'updateCustomPoolMember', '', URLe);
}

function DeleteCustomPoolMember(gameID, profileID, Language)
{
	if (Language = 'eng') {
		var agree = confirm('Are you sure you want to delete this user?');
	} else {
		var agree = confirm('Weet je het zeker dat je deze gebruiker wilt verwijderen?');	
	}
	
	if (agree) {
		var URLe = '&udp_gameID='+gameID+'&udp_profileID='+profileID;
		
		getContentXML('custompool', 'deleteCustomPoolMember', '', URLe);
	}
}

function SearchMemberCustomPool(gameID)
{
	var member = Dom.get('search_member').value;
	
	var URLe = '&udp_gameID='+gameID+'&member='+member;
	
	getContentXML('custompool', 'searchCustomPoolMember', '', URLe);
}

function checkKeySearchMemberCustomPool(evt, gameID)
{
	//check if event is passed (has to in FireFox, does not in IE)
	//if (!evt) var evt = window.event;
	if (evt.keyCode == 13) {
		SearchMemberCustomPool(gameID);
		return false;
	} else {
		return true;
	}
}

function InviteCustomPoolMember(gameID, profileID)
{
	var URLe = '&udp_gameID='+gameID+'&udp_profileID='+profileID;
	
	getContentXML('custompool', 'inviteCustomPoolMember', '', URLe);
}

function InviteNonMember_Udp(gameID)
{
	var receiverName = Dom.get('taf_to_udp').value;
	var receiverEmail = Dom.get('taf_toe_udp').value;
	
	var URLe = '&udp_gameID='+gameID+'&receiverName='+receiverName+'&receiverEmail='+receiverEmail;
	
	getContentXML('custompool', 'inviteNonMemberUdp', '', URLe);
}

function MatchCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	getContentXML('custompool', 'matchCustomPool', '', URLe);
}

function SettingsCustomPool(gameID, profileID)
{
	var URLe = '&udp_gameID='+gameID+'&udp_profileID='+profileID;
	
	getContentXML('custompool', 'settingsCustomPool', '', URLe);
}

function SaveCustomPoolSettings(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	if (gameID == '0') {
		URLe+= '&udp_Name='+escape(Dom.get('udpName').value);
	}
		
	URLe+= '&udp_profileID='+Dom.get('udp_profileID').value;
	URLe+= '&gameText='+escape(Dom.get('gameText').value);
	URLe+= '&udpDisplayName='+escape(Dom.get('udpDisplayName').value);
	URLe+= '&gameDate='+escape(Dom.get('gameDate').value);
	URLe+= '&gameDateEnd='+escape(Dom.get('gameDateEnd').value);
		
	URLe+= '&gameType='+escape(getSelectedRadioValue(document.getElementsByName('gameType')));
	URLe+= '&udpPrivate='+getSelectedRadioValue(document.getElementsByName('udpPrivate'));
	URLe+= '&udpActive='+getSelectedRadioValue(document.getElementsByName('udpActive'));
	
	if (Dom.get('optionsUseHalf').checked) {
		URLe+= '&optionsUseHalf=1';
	} else {
		URLe+= '&optionsUseHalf=0';
	}
	if (Dom.get('optionsTopscorer')) {
		if (Dom.get('optionsTopscorer').checked) {
			URLe+= '&optionsTopscorer=1';
		} else {
			URLe+= '&optionsTopscorer=0';
		}
	}
	if (Dom.get('optionsYellowcards').checked) {
		URLe+= '&optionsYellowcards=1';
	} else {
		URLe+= '&optionsYellowcards=0';
	}
	if (Dom.get('optionsRedcards').checked) {
		URLe+= '&optionsRedcards=1';
	} else {
		URLe+= '&optionsRedcards=0';
	}
	if (Dom.get('optionsGoals').checked) {
		URLe+= '&optionsGoals=1';
	} else {
		URLe+= '&optionsGoals=0';
	}
	
	URLe+= '&rulesExact='+Dom.get('rulesExact').value;
	URLe+= '&rulesWin='+Dom.get('rulesWin').value;
	URLe+= '&rulesGoals='+Dom.get('rulesGoals').value;
	URLe+= '&rulesHalf='+Dom.get('rulesHalf').value;
	if (Dom.get('rulesTopscorer')) {
		if (Dom.get('rulesTopscorer').disabled === false) {
			URLe+= '&rulesTopscorer='+Dom.get('rulesTopscorer').value;
		}
	}
	if (Dom.get('rulesYellow').disabled === false) {
		URLe+= '&rulesYellow='+Dom.get('rulesYellow').value;
	}
	if (Dom.get('rulesYellowMinusoff').disabled === false) {
		URLe+= '&rulesYellowMinusoff='+Dom.get('rulesYellowMinusoff').value;
	}
	if (Dom.get('rulesRed').disabled === false) {
		URLe+= '&rulesRed='+Dom.get('rulesRed').value;
	}
	if (Dom.get('rulesRedMinusoff').disabled === false) {
		URLe+= '&rulesRedMinusoff='+Dom.get('rulesRedMinusoff').value;
	}
	if (Dom.get('rulesGoal').disabled === false) {
		URLe+= '&rulesGoal='+Dom.get('rulesGoal').value;
	}
	if (Dom.get('rulesGoalMinusoff').disabled === false) {
		URLe+= '&rulesGoalMinusoff='+Dom.get('rulesGoalMinusoff').value;
	}
	
	getContentXML('custompool', 'saveSettingsCustomPool', '', URLe);
}

function ToggleCustomPoolCheckboxSettings(idstring)
{
	if (idstring === 'optionsTopscorer') {
		if (Dom.get('optionsTopscorer').checked) {
			Dom.get('rulesTopscorer').disabled = false;	
		} else {
			Dom.get('rulesTopscorer').disabled = true;
		}
	} else if (idstring === 'optionsYellowcards') {
		if (Dom.get('optionsYellowcards').checked) {
			Dom.get('rulesYellow').disabled = false;
			Dom.get('rulesYellowMinusoff').disabled = false;
		} else {
			Dom.get('rulesYellow').disabled = true;
			Dom.get('rulesYellowMinusoff').disabled = true;
		}
	} else if (idstring === 'optionsRedcards') {
		if (Dom.get('optionsRedcards').checked) {
			Dom.get('rulesRed').disabled = false;
			Dom.get('rulesRedMinusoff').disabled = false;	
		} else {
			Dom.get('rulesRed').disabled = true;
			Dom.get('rulesRedMinusoff').disabled = true;
		}
	} else if (idstring === 'optionsGoals') {
		if (Dom.get('optionsGoals').checked) {
			Dom.get('rulesGoal').disabled = false;
			Dom.get('rulesGoalMinusoff').disabled = false;
		} else {
			Dom.get('rulesGoal').disabled = true;
			Dom.get('rulesGoalMinusoff').disabled = true;
		}
	} else if (idstring === 'optionsUseHalf') {
		if (Dom.get('optionsUseHalf').checked) {
			Dom.get('rulesHalf').disabled = false;
		} else {
			Dom.get('rulesHalf').disabled = true;
		}
	}
}

function DeleteMatchRow(gameID, matchID, Language)
{
	if (Language = 'eng') {
		var agree = confirm('Are you sure you want to delete this match?');
	} else {
		var agree = confirm('Weet je het zeker dat je deze wedstrijd wilt verwijderen?');	
	}
	
	if (agree) {
		var URLe = '&udp_gameID='+gameID+'&udp_matchID='+matchID;
		
		getContentXML('custompool', 'deleteMatchRowCustomPool', '', URLe);
	}
}

function ResultsCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	getContentXML('custompool', 'resultsCustomPool', '', URLe);
}

function CreateCustomPool(profileID)
{
	var URLe = '&profileID='+profileID;
	
	getContentXML('custompool', 'createCustomPool', '', URLe);
}

function ToggleCustomPoolSettings(typepool)
{
	if (typepool == 'single match') {
		Dom.get('optionsTopscorer').checked = false;
		Dom.get('optionsTopscorer').disabled = true;
		Dom.get('rulesTopscorer').disabled = true;
		Dom.get('optionsYellowcards').checked = false;
		Dom.get('optionsYellowcards').disabled = true;
		Dom.get('rulesYellow').disabled = true;
		Dom.get('rulesYellowMinusoff').disabled = true;
		Dom.get('optionsRedcards').checked = false;
		Dom.get('optionsRedcards').disabled = true;
		Dom.get('rulesRed').disabled = true;
		Dom.get('rulesRedMinusoff').disabled = true;	
		Dom.get('optionsGoals').checked = false;
		Dom.get('optionsGoals').disabled = true;
		Dom.get('rulesGoal').disabled = true;
		Dom.get('rulesGoalMinusoff').disabled = true;
	} else if (typepool == 'serial matches') {
		//do not disable anything here
	} else if (typepool == 'competition') {
		//do not disable anything here
	} else {
		
	}
}

function ToggleCustomPoolResultsSection(gameID, typeresult)
{
	var URLe = '&udp_gameID='+gameID+'&udp_resultsSection='+typeresult;
	
	getContentXML('custompool', 'toggleCustomPoolResultsSection', '', URLe);
}

function SaveResultsPoolSettings(gameID, typeresult)
{
	var URLe = '&udp_gameID='+gameID+'&udp_resultsSection='+typeresult;
	
	if (Dom.get('resultsYellowAmount')) {
		URLe+= '&resultsYellowAmount='+Dom.get('resultsYellowAmount').value;
	}
	if (Dom.get('resultsRedAmount')) {
		URLe+= '&resultsRedAmount='+Dom.get('resultsRedAmount').value;
	}
	if (Dom.get('resultsGoalsAmount')) {
		URLe+= '&resultsGoalsAmount='+Dom.get('resultsGoalsAmount').value;
	}
	
	if (Dom.get('calculateAgain')) {
		if (Dom.get('calculateAgain').checked) {
			URLe+= '&calculateAgain=1';
			if (Dom.get('resultsYellowAmountOld')) {
				URLe+= '&resultsYellowAmountOld='+Dom.get('resultsYellowAmountOld').value;
			}
			if (Dom.get('resultsRedAmountOld')) {
				URLe+= '&resultsRedAmountOld='+Dom.get('resultsRedAmountOld').value;
			}
			if (Dom.get('resultsGoalsAmountOld')) {
				URLe+= '&resultsGoalsAmountOld='+Dom.get('resultsGoalsAmountOld').value;
			}
		} else {
			URLe+= '&calculateAgain=0';
		}
	}
	
	getContentXML('custompool', 'saveResultsCustomPoolSettings', '', URLe);
}

function calculateRankingCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	if (Dom.get('updateposition').checked) {
		URLe+= '&updatePosition=1';
	} else {
		URLe+= '&updatePosition=0';
	}
	
	getContentXML('custompool', 'calculateRankingCustomPool', '', URLe);
}

function ToggleCustomPoolResultsPlayed(typetoggle)
{
	if (typetoggle == 'played') {
		Dom.get('played').style.display = 'block';
		Dom.get('notplayed').style.display = 'none';
	} else {
		Dom.get('played').style.display = 'none';
		Dom.get('notplayed').style.display = 'block';
	}
}

function AddResultCustomPool(gameID, drawID)
{
	var URLe = '&udp_gameID='+gameID+'&udp_drawID='+drawID;
	
	if (Dom.get('played').style.display == 'block') {
		URLe+= '&played=1';
	} else {
		URLe+= '&played=0';
	}
	
	getContentXML('custompool', 'addResultCustomPool', '', URLe);
}

function SaveResultCustomPool(gameID, drawID)
{
	var URLe = '&udp_gameID='+gameID+'&udp_drawID='+drawID;
	
	URLe+= '&resultTeam1='+Dom.get('resultTeam1').value;
	URLe+= '&resultTeam2='+Dom.get('resultTeam2').value;
	if (Dom.get('resulthalfTeam1')) {
		URLe+= '&resulthalfTeam1='+Dom.get('resulthalfTeam1').value;
		URLe+= '&resulthalfTeam2='+Dom.get('resulthalfTeam2').value;
	}
	if (Dom.get('played').value) {
		URLe+= '&resultOldTeam1='+Dom.get('resultOldTeam1').value;
		URLe+= '&resultOldTeam2='+Dom.get('resultOldTeam2').value;
		URLe+= '&resulthalfOldTeam1='+Dom.get('resulthalfOldTeam1').value;
		URLe+= '&resulthalfOldTeam2='+Dom.get('resulthalfOldTeam2').value;
	}
	
	if (Dom.get('resultYellow')) {
		URLe+= '&resultYellow='+Dom.get('resultYellow').value;
		if (Dom.get('played').value) {
			URLe+= '&yellowOld='+Dom.get('yellowOld').value;
		}
	}
	if (Dom.get('resultRed')) {
		URLe+= '&resultRed='+Dom.get('resultRed').value;
		if (Dom.get('played').value) {
			URLe+= '&redOld='+Dom.get('redOld').value;
		}
	}
	
	URLe+= '&played='+Dom.get('played').value;
	URLe+= '&calculatePlayers=1';
	
	getContentXML('custompool', 'saveResultCustomPool', '', URLe);
}

function drawBackgroundTD(tdid)
{
	Dom.get('matchrow_'+tdid).bgColor = 'red';
	//set back after 10 seconds
	setTimeout("drawBackgroundTDFunction('"+tdid+"')", 10000);
}

function drawBackgroundTDFunction(tdid)
{
	Dom.get('matchrow_'+tdid).bgColor = '';
}

function AcceptInviteCustomPool(profileID, gameID)
{
	var URLe = '&udp_gameID='+gameID+'&profileID='+profileID;
	
	getContentXML('custompool', 'acceptInviteCustomPool', '', URLe);
}

function ViewPredictionCustomPool(gameID, profileID)
{
	var URLe = '&udp_gameID='+gameID+'&profileID='+profileID;
	
	getContentXML('custompool', 'viewPredictionCustomPool', '', URLe);
}

newMatchRowID = 1;
function AddMatchRowCustomPool(Language)
{
	var oTR = Dom.get('matchTR');
	//initial row
	var newTABLE = document.createElement('TABLE');
	newTABLE.id = 'MatchRow_' + newMatchRowID;
	newTABLE.className = 'udpMatchrow';
	var newTR1 = document.createElement('TR');
	var newTD1 = document.createElement('TD');
	newTD1.innerHTML = "<img src='/gfx/famfam/cross.png' style='cursor:pointer' onclick='DeleteMatchRowCustomPool(" + newMatchRowID + "); return false;' />";
	
	newTR1.appendChild(newTD1);
	newTABLE.appendChild(newTR1);
	
	var newTR2 = document.createElement('TR');
	var newTD1 = document.createElement('TD');
	
	if (Language == 'eng') {
		newTD1.innerHTML = "Date:";
	} else {
		newTD1.innerHTML = "Datum:";
	}
	newTR2.appendChild(newTD1);
	
	var newTD1 = document.createElement('TD');
	if (Language == 'eng') {
		newTD1.innerHTML = "<input readOnly='readOnly' class='text small calDate' name='matchDate' id='New_"+newMatchRowID+"' value='' type='text' maxlength='10' />";
		newTD1.innerHTML+= "<span id='New_" + newMatchRowID + "_cal'></span><a class='yuiCalendar' onclick='return initYuiCalendar(this);' rel='New_" + newMatchRowID + "'></a>";
	} else {
		newTD1.innerHTML = "<input readOnly='readOnly' class='text small calDate' name='matchDate' id='New_"+newMatchRowID+"' value='' type='text' maxlength='10' />";
		newTD1.innerHTML+= "<span id='New_" + newMatchRowID + "_cal'></span><a class='yuiCalendar' onclick='return initYuiCalendar(this);' rel='New_" + newMatchRowID + "'></a>";
	}
	newTR2.appendChild(newTD1);
	
	var newTD1 = document.createElement('TD');
	if (Language == 'eng') {
		newTD1.innerHTML = "Time:";
	} else {
		newTD1.innerHTML = "Tijd:";
	}
	newTR2.appendChild(newTD1);
	
	var newTD1 = document.createElement('TD');
	if (Language == 'eng') {
		newTD1.innerHTML = "<input class='text' name='matchTime' id='New_"+newMatchRowID+"' value='HH:MM' type='text' maxlength='10' />";
	} else {
		newTD1.innerHTML = "<input class='text' name='matchTime' id='New_"+newMatchRowID+"' value='UU:MM' type='text' maxlength='10' />";
	}
	newTR2.appendChild(newTD1);
	newTABLE.appendChild(newTR2);
	
	var newTR3 = document.createElement('TR');

	var newTD1 = document.createElement('TD');
	newTD1.innerHTML = "Team 1:";
	newTR3.appendChild(newTD1);
	
	var newTD2 = document.createElement('TD');
	newTD2.innerHTML = "<input class='text' name='matchTeam1' id='New_"+newMatchRowID+"' value='' type='text' />";
	newTR3.appendChild(newTD2);
	
	var newTD3 = document.createElement('TD');
	newTD3.innerHTML = "Team 2:";
	newTR3.appendChild(newTD3);
	
	var newTD4 = document.createElement('TD');
	newTD4.innerHTML = "<input class='text' name='matchTeam2' id='New_"+newMatchRowID+"' value='' type='text' />";
	newTR3.appendChild(newTD4);
	newTABLE.appendChild(newTR3);
	
	oTR.appendChild(newTABLE);
	newMatchRowID++;
}

function DeleteMatchRowCustomPool(MatchRowID)
{
	var oTR = Dom.get('MatchRow_' + MatchRowID);
	Dom.get('matchTR').removeChild(oTR);
}

function SaveMatchCustomPool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	URLe+= createUrlFromMultipleInputCheckbox('matchPlayed', 'matchIDs', true);
	URLe+= createUrlFromMultipleInput('matchDate', 'matchIDs', true);
	URLe+= createUrlFromMultipleInput('matchTime', 'matchIDs', true);
	URLe+= createUrlFromMultipleInput('matchTeam1', 'matchIDs', true);
	URLe+= createUrlFromMultipleInput('matchTeam2', 'matchIDs', true);
		
	getContentXML('custompool', 'saveMatchCustomPool', '', URLe);
}

function ToggleDisableMatch(matchID)
{
	//disable
	var playedValues = document.getElementsByName('matchPlayed');
	for (i = 0; i < playedValues.length; i++) {
		if (playedValues[i].id == matchID) { //disable
			if (playedValues[i].checked) {
				var matchDisabled = true;
			}
			break;
		}	
	}
		
	var timeValues = document.getElementsByName('matchTime');
	for (i = 0; i < timeValues.length; i++) {
		if (timeValues[i].id == matchID) { //disable
			if (matchDisabled) {
				timeValues[i].disabled = true;
			} else {
				timeValues[i].disabled = false;
			}
		}	
	}
		
	var team1Values = document.getElementsByName('matchTeam1');
	for (i = 0; i < team1Values.length; i++) {
		if (team1Values[i].id == matchID) { //disable
			if (matchDisabled) {
				team1Values[i].disabled = true;
			} else {
				team1Values[i].disabled = false;
			}
		}	
	}
	
	var team2Values = document.getElementsByName('matchTeam2');
	for (i = 0; i < team2Values.length; i++) {
		if (team2Values[i].id == matchID) { //disable
			if (matchDisabled) {
				team2Values[i].disabled = true;
			} else {
				team2Values[i].disabled = false;
			}
		}	
	}
	
	if (Dom.get('yuiCalendar_'+matchID)) {
		if (Dom.get('yuiCalendar_'+matchID).style.display == 'none') {
			Dom.get('yuiCalendar_'+matchID).style.display = 'inline';
		} else {
			Dom.get('yuiCalendar_'+matchID).style.display = 'none';
		}
	}
	
	if (Dom.get('deleteImage_'+matchID)) {
		if (Dom.get('deleteImage_'+matchID).style.display == 'none') {
			Dom.get('deleteImage_'+matchID).style.display = 'inline';
		} else {
			Dom.get('deleteImage_'+matchID).style.display = 'none';
		}
	}
}

function ImportPoolCustompool(gameID)
{
	var URLe = '&udp_gameID='+gameID;
	
	var selectedGameID = Dom.get('importGame').options[Dom.get('importGame').selectedIndex].value;
	
	if (selectedGameID) {
		URLe+= '&selectedGameID='+selectedGameID;
		getContentXML('custompool', 'ImportPoolCustompool', '', URLe);
	}
}

function loadCpItem(cpItem)
{
	showLoadingDiv();
	getContentXML('cp', cpItem, '', '', 'hideLoadingDiv();');
}

function GetFaqEdit(faqID)
{
	var URLe = '&faqID='+faqID;
	
	showLoadingDiv();
	getContentXML('cp', 'getFaqEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveFaq(faqID)
{
	var URLe = '&faqID='+faqID;
	
	URLe+= '&question='+escape(Dom.get('question').value);
	URLe+= '&question_dutch='+escape(Dom.get('question_dutch').value);
	URLe+= '&answer='+escape(Dom.get('answer').value);
	URLe+= '&answer_dutch='+escape(Dom.get('answer_dutch').value);
	if (Dom.get('visible').checked) {
		URLe+= '&visible=1';
	} else {
		URLe+= '&visible=0';
	}
	
	showLoadingDiv();
	getContentXML('cp', 'saveFaq', '', URLe, 'hideLoadingDiv();');
}

function DeleteFaq(faqID)
{
	var URLe = '&faqID='+faqID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteFaq', '', URLe, 'hideLoadingDiv();');
}

function CreateNewFaq()
{
	var URLe = '&faqID=0';
	
	showLoadingDiv();
	getContentXML('cp', 'getFaqEdit', '', URLe, 'hideLoadingDiv();');
}

function GetTodoEdit(todoID)
{
	var URLe = '&todoID='+todoID;
	
	showLoadingDiv();
	getContentXML('cp', 'getTodoEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveTodo(todoID)
{
	var URLe = '&todoID='+todoID;
	
	URLe+= '&todoSubject='+escape(Dom.get('todoSubject').value);
	URLe+= '&todoDescription='+escape(Dom.get('todoDescription').value);
	URLe+= '&todoDescriptionExtra='+escape(Dom.get('todoDescriptionExtra').value);
	
	if (Dom.get('todoExecutor')) {
		URLe+= '&todoExecutor='+Dom.get('todoExecutor').options[Dom.get('todoExecutor').selectedIndex].value;
	}
	
	if (Dom.get('todoType')) {
		URLe+= '&todoType='+Dom.get('todoType').options[Dom.get('todoType').selectedIndex].value;
	}
	
	if (Dom.get('todoPrio')) {
		URLe+= '&todoPrio='+Dom.get('todoPrio').options[Dom.get('todoPrio').selectedIndex].value;
	}
	
	if (Dom.get('todoFinished').checked) {
		URLe+= '&todoFinished=1';
	} else {
		URLe+= '&todoFinished=0';
	}
	
	if (Dom.get('todoTesting').checked) {
		URLe+= '&todoTesting=1';
	} else {
		URLe+= '&todoTesting=0';
	}
	
	showLoadingDiv();
	getContentXML('cp', 'saveTodo', '', URLe, 'hideLoadingDiv();');
}

function CreateNewTodo()
{
	var URLe = '&todoID=0';
	
	showLoadingDiv();
	getContentXML('cp', 'getTodoEdit', '', URLe, 'hideLoadingDiv();');
}

function DeleteTodo(todoID)
{
	var URLe = '&todoID='+todoID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteTodo', '', URLe, 'hideLoadingDiv();');
}

function GetAnnouncementEdit(announcementID)
{
	var URLe = '&announcementID='+announcementID;
	
	showLoadingDiv();
	getContentXML('cp', 'getAnnouncementEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveAnnouncement(announcementID)
{
	var URLe = '&announcementID='+announcementID;
	
	URLe+= '&announcementName='+escape(Dom.get('announcementName').value);
	URLe+= '&announcementDateStart='+escape(Dom.get('announcementDateStart').value);
	URLe+= '&announcementDateTill='+escape(Dom.get('announcementDateTill').value);
	
	if (Dom.get('announcementActive').checked) {
		URLe+= '&announcementActive=1';
	} else {
		URLe+= '&announcementActive=0';
	}
	
	if (Dom.get('announcementNewsID')) {
		URLe+= '&announcementNewsID='+Dom.get('announcementNewsID').options[Dom.get('announcementNewsID').selectedIndex].value;
	}
	
	showLoadingDiv();
	getContentXML('cp', 'saveAnnouncement', '', URLe, 'hideLoadingDiv();');
}

function DeleteAnnouncement(announcementID)
{
	var URLe = '&announcementID='+announcementID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteAnnouncement', '', URLe, 'hideLoadingDiv();');
}

function CreateNewAnnouncement()
{
	var URLe = '&announcementID=0';
	
	showLoadingDiv();
	getContentXML('cp', 'getAnnouncementEdit', '', URLe, 'hideLoadingDiv();');
}

function ListGamePrizes(gameIDToUse)
{
	//get selectedgameID of selectbox
	if (Dom.get('game_input')) {
		var URLe = '&gameIDToUse='+Dom.get('game_input').options[Dom.get('game_input').selectedIndex].value;	
	} else {
		var URLe = '';
	}
	
	showLoadingDiv();
	getContentXML('cp', 'getGameInformationForPrizes', '', URLe, 'hideLoadingDiv();');
}

function getPrizeItem(gameIDToUse, prizeID)
{
	if (typeof gameIDToUse === 'undefined') gameIDToUse = '';
	if (typeof prizeID === 'undefined')	prizeID = '';
	
	var URLe = '&prizeID='+prizeID+'&gameIDToUse='+gameIDToUse;
	
	showLoadingDiv();
	getContentXML('cp', 'getPrizeInformation', '', URLe, 'hideLoadingDiv();');
}

function SavePrize(prizeID, deletePrize)
{
	var URLe = '&prizeID='+prizeID+'&deletePrize='+deletePrize;
	
	URLe+= '&prizeTitle='+escape(Dom.get('prizeTitle').value);
	URLe+= '&prizeImage='+Dom.get('prizeImage').value;
	URLe+= '&prizeDesc='+escape(Dom.get('prizeDesc').value);
	URLe+= '&prizeValue='+Dom.get('prizeValue').value;
	if (Dom.get('prizeSupplier')) {
		URLe+= '&supplierID='+Dom.get('prizeSupplier').options[Dom.get('prizeSupplier').selectedIndex].value;
	}
	if (Dom.get('prizeGameID')) {
		URLe+= '&prizeGameID='+Dom.get('prizeGameID').options[Dom.get('prizeGameID').selectedIndex].value;
	}
	
	showLoadingDiv();
	getContentXML('cp', 'savePrizeInformation', '', URLe, 'hideLoadingDiv();');
}

function AddSupplier()
{
	//retrieve selected supplier
	supplierID = Dom.get('prizeSupplier').value;
	
	if (Dom.get('SupplierDiv').style.display == 'none') {
		Dom.get('SupplierDiv').style.display = 'inline';
	} else {
		Dom.get('SupplierDiv').style.display = 'none';
	}
	
	var URLe = '&supplierID='+supplierID;
	
	showLoadingDiv();
	getContentXML('cp', 'getSupplierData', '', URLe, 'hideLoadingDiv();');
}

function SaveSupplier(supplierID, deleteSupplier)
{
	Dom.get('SupplierDiv').style.display = 'none';
	
	var URLe = '&supplierID='+supplierID+'&deleteSupplier='+deleteSupplier
	
	URLe+= '&supplierName='+escape(Dom.get('supplierName').value);
	URLe+= '&supplierContact='+escape(Dom.get('supplierContact').value);
	URLe+= '&supplierEmail='+escape(Dom.get('supplierEmail').value);
	URLe+= '&supplierUrl='+escape(Dom.get('supplierUrl').value);

	showLoadingDiv();
	getContentXML('cp', 'saveSupplier', '', URLe, 'hideLoadingDiv();');
}

function ListLinksOfCategory(categoryID)
{
	var URLe = '&categoryID='+categoryID;
	
	showLoadingDiv();
	getContentXML('cp', 'getLinkList', '', URLe, 'hideLoadingDiv();');
}

function getLinkItem(linkID, linkCategoryID)
{
	if (typeof linkID === 'undefined') linkID = '';
	if (typeof linkCategoryID === 'undefined') linkCategoryID = '';
	
	var URLe = '&linkID='+linkID+'&linkCategoryID='+linkCategoryID;
	
	showLoadingDiv();
	getContentXML('cp', 'getLinkInformation', '', URLe, 'hideLoadingDiv();');
}

function SaveLink(linkID, deleteLink)
{
	linkTitle = Dom.get('linkTitle').value;
	linkUrl = Dom.get('linkUrl').value;
	backlinkUrl = Dom.get('backlinkUrl').value;
	linkCategoryID2 = Dom.get('linkCategoryID2').value;

	var URLe = '&linkID='+linkID+'&linkTitle='+escape(linkTitle)+'&backlinkUrl='+escape(backlinkUrl)+'&linkUrl='+escape(linkUrl)+'&categoryID='+linkCategoryID2+'&deleteLink='+deleteLink;
	
	showLoadingDiv();
	getContentXML('cp', 'saveLinkInformation', '', URLe, 'hideLoadingDiv();');
}

function AddCategory()
{
	//retrieve selected category
	categoryID = Dom.get('linkCategoryID2').value;
	
	if (Dom.get('CategoryDiv').style.display == 'none') {
		Dom.get('CategoryDiv').style.display = 'inline';
	} else {
		Dom.get('CategoryDiv').style.display = 'none';
	}
	
	var URLe = '&categoryID='+categoryID;
	
	showLoadingDiv();
	getContentXML('cp', 'GetCategoryData', '', URLe, 'hideLoadingDiv();');
}

function AddSingleCategory()
{
	showLoadingDiv();
	getContentXML('cp', 'AddSingleCategory');
}

function SaveCategory(categoryID, deleteCategory)
{
	if (Dom.get('CategoryDiv')) {
		Dom.get('CategoryDiv').style.display = 'none';
	}
	
	if (Dom.get('drawSelection')) {
		var drawSelection = '&drawSelection='+Dom.get('drawSelection').value;
	} else {
		drawSelection = '';
	}
	
	//TODO: create function to gather all input fields from an html element (eg div or form)
	categoryTitle = Dom.get('categoryTitle').value;
	
	var URLe = '&categoryID='+categoryID+'&categoryTitle='+escape(categoryTitle)+'&deleteCategory='+deleteCategory+drawSelection;
	
	showLoadingDiv();
	getContentXML('cp', 'SaveCategory', '', URLe, 'hideLoadingDiv();');
}

function selectLinkCategory(catID)
{
	if (Dom.get('linkCategoryID2')) {
		var CategorySelect = Dom.get('linkCategoryID2');
	} else {
		var CategorySelect = Dom.get('linkCategoryID');
	}
	for (i = 0; i < CategorySelect.length; i++) {
		if (CategorySelect.item(i).value == catID) {
			CategorySelect.item(i).selected = true;
		} else {
			CategorySelect.item(i).selected = false;
		}
	}
}

function checkUrl(testurl, rowid)
{
	var URLe = '&backlinkurl='+escape(testurl)+'&rowid='+rowid;
	
	showLoadingDiv();
	getContentXML('cp', 'CheckUrl', '', URLe, 'hideLoadingDiv();');
}

function displayCheckUrl(checkStatus, rowid)
{
	if (checkStatus == '0') {
		Dom.get('urlCheckFalse_'+rowid).style.display = 'inline';
		Dom.get('urlCheckTrue_'+rowid).style.display = 'none';
	} else {
		Dom.get('urlCheckTrue_'+rowid).style.display = 'inline';
		Dom.get('urlCheckFalse_'+rowid).style.display = 'none';
	}
}

function getTitleItem(titleID)
{
	if (typeof titleID === 'undefined') titleID = '';
		
	var URLe = '&titleID='+titleID;
	
	showLoadingDiv();
	getContentXML('cp', 'getTitleInformation', '', URLe, 'hideLoadingDiv();');
}


function SaveTitle(titleID, deleteLink)
{
	titleTitle = Dom.get('titleTitle').value;
	titleMin = Dom.get('titleMin').value;
	titleMax = Dom.get('titleMax').value;

	var URLe = '&titleID='+titleID+'&titleTitle='+titleTitle+'&titleMin='+escape(titleMin)+'&titleMax='+escape(titleMax)+'&deleteLink='+deleteLink;
	
	showLoadingDiv();
	getContentXML('cp', 'saveTitleInformation', '', URLe, 'hideLoadingDiv();');
}

function calculateTitles()
{
	//diable button and show waiting div
	Dom.get('calculateTitles').disabled = true;
	Dom.get('calculateDiv').style.display = 'inline';
	
	showLoadingDiv();
	getContentXML('cp', 'calculateTitles');
}

function CalculateStats(gameID)
{
	var URLe = '&gameID='+gameID;
	
	URLe+= '&yellowCardsPoints='+Dom.get('yellowCardsPoints').value;
	URLe+= '&redCardsPoints='+Dom.get('redCardsPoints').value;
	URLe+= '&goalsPoints='+Dom.get('goalsPoints').value;
	URLe+= '&yellowCardsAmount='+Dom.get('yellowCardsAmount').value;
	URLe+= '&redCardsAmount='+Dom.get('redCardsAmount').value;
	URLe+= '&goalsAmount='+Dom.get('goalsAmount').value;
	
	showLoadingDiv();
	getContentXML('results', 'savestats', '', URLe, 'hideLoadingDiv();');
}

function GetPollContent(pollID)
{
	var URLe = '&pollID='+pollID;
	
	showLoadingDiv();
	getContentXML('cp', 'getPollContent', '', URLe, 'hideLoadingDiv();');
}

function SaveAllAnswersPoll(pollID)
{
	if (pollID == 'new') {
		var URLe = '&pollID='+pollID;
		URLe+= '&pollNew=1';
		URLe+= '&pollName='+escape(Dom.get('pollName').value);
		URLe+= '&question_en='+escape(Dom.get('question_en').value);
		URLe+= '&question_nl='+escape(Dom.get('question_nl').value);
		URLe+= '&date='+Dom.get('date').value;
		if (Dom.get('active').checked) {
			URLe+= '&active=1';
		} else {
			URLe+= '&active=0';
		}	
		
		showLoadingDiv();
		getContentXML('cp', 'savePoll', '', URLe, 'hideLoadingDiv();');
	} else {
		var URLe = '&pollID='+pollID;
		
		URLe+= createUrlFromMultipleInput('answer_nl', 'pollAnswerIDs');
		URLe+= createUrlFromMultipleInput('answer_en', 'pollAnswerIDs');
		
		showLoadingDiv();
		getContentXML('cp', 'saveAllAnswersPoll', '', URLe, 'hideLoadingDiv();');
	}
}

function DeletePollAnswer(pollID, pollAnswerID)
{
	var URLe = '&pollID='+pollID+'&pollAnswerID='+pollAnswerID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteAnswerPoll', '', URLe, 'hideLoadingDiv();');
}

function SavePoll(pollID)
{
	var URLe = '&pollID='+pollID;
	
	URLe+= '&pollName='+escape(Dom.get('pollName').value);
	URLe+= '&question_en='+escape(Dom.get('question_en').value);
	URLe+= '&question_nl='+escape(Dom.get('question_nl').value);
	URLe+= '&date='+Dom.get('date').value;
	if (Dom.get('active').checked) {
		URLe+= '&active=1';
	} else {
		URLe+= '&active=0';
	}
	
	//get answers
	URLe+= createUrlFromMultipleInput('answer_nl', 'pollAnswerIDs');
	URLe+= createUrlFromMultipleInput('answer_en', 'pollAnswerIDs');
	
	if (!Dom.get('deleteRow')) {
		URLe+= '&noAnswers=1';
	}
	
	showLoadingDiv();
	getContentXML('cp', 'savePoll', '', URLe, 'hideLoadingDiv();');
}

function DeletePoll(pollID)
{
	var URLe = '&pollID='+pollID;
	
	showLoadingDiv();
	getContentXML('cp', 'deletePoll', '', URLe, 'hideLoadingDiv();');
}

function CreateNewPoll(pollID)
{
	var URLe = '&pollID='+pollID;
	
	showLoadingDiv();
	getContentXML('cp', 'createPoll', '', URLe, 'hideLoadingDiv();');
}

function GetSecurityEdit(securityID)
{
	var URLe = '&securityID='+securityID;
	
	showLoadingDiv();
	getContentXML('cp', 'getSecurityEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveSecurity(securityID)
{
	alert('Todo');
}

function DeleteSecurity(securityID)
{
	alert('Todo');
}

function CreateNewSecurity()
{
	alert('Todo');
}

function GetCommunityEdit(communityName)
{
	var URLe = '&communityName='+escape(communityName);
	
	showLoadingDiv();
	getContentXML('cp', 'getCommunityEdit', '', URLe, 'hideLoadingDiv();');
}

function UpdateCommunity(communityID, updateValue, state)
{
	var URLe = '&communityID='+communityID+'&updateValue='+updateValue+'&state='+state;
	
	showLoadingDiv();
	getContentXML('cp', 'updateCommunity', '', URLe, 'hideLoadingDiv();');
}

function DeleteCommunity(communityID)
{
	var URLe = '&communityID='+communityID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteCommunity', '', URLe, 'hideLoadingDiv();');
}

function GetNewsEdit(newsID)
{
	var URLe = '&newsID='+newsID;
	
	showLoadingDiv();
	getContentXML('cp', 'getNewsEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveNews(newsID)
{
	try {
		if(typeof(Dom.get('xNewsEditorNL').EscapeUnicode) == 'undefined') {
			throw "Error"
		} else {
			Dom.get('xNewsEditorNL').EscapeUnicode = true;
			Dom.get('newsTextNL').value = Dom.get('xNewsEditorNL').value;
		}			
	}
	catch(er) {
		// setting alternative textfield
		Dom.get('newsTextNL').value = Dom.get('altNewsTextNL').value;
	}
	try {
		if(typeof(Dom.get('xNewsEditorENG').EscapeUnicode) == 'undefined') {
			throw "Error"
		} else {
			Dom.get('xNewsEditorENG').EscapeUnicode = true;
			Dom.get('newsTextENG').value = Dom.get('xNewsEditorENG').value;
		}			
	}
	catch(er) {
		// setting alternative textfield
	  Dom.get('newsTextENG').value = Dom.get('altNewsTextENG').value;
	}
	
	var URLe = '&newsID='+newsID;
	
	URLe+= '&subject='+escape(Dom.get('newsSubjectENG').value);
	URLe+= '&subject_dutch='+escape(Dom.get('newsSubjectNL').value);
	URLe+= '&message='+escape(Dom.get('newsTextENG').value);
	URLe+= '&message_dutch='+escape(Dom.get('newsTextNL').value);
	URLe+= '&newsimage='+escape(Dom.get('newsImage').value);
	if (Dom.get('newsGameID')) {
		URLe+= '&newsGameID='+Dom.get('newsGameID').options[Dom.get('newsGameID').selectedIndex].value;
	}
	
	if (Dom.get('twitterAccountID')) {
		URLe+= '&twitterAccountID='+Dom.get('twitterAccountID').options[Dom.get('twitterAccountID').selectedIndex].value;
	}
	
	if (Dom.get('newsSticky').checked) {
		URLe+= '&sticky=1';
	} else {
		URLe+= '&sticky=0';
	}
	
	if (Dom.get('newsVisible').checked) {
		URLe+= '&visible=1';
	} else {
		URLe+= '&visible=0';
	}
	
	showLoadingDiv();
	getContentXML('cp', 'saveNews', '', URLe, 'hideLoadingDiv();');
}

function DeleteNews(newsID)
{
	var URLe = '&newsID='+newsID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteNews', '', URLe, 'hideLoadingDiv();');
}

function CreateNewNews()
{
	var URLe = '&newsID=0';
	
	showLoadingDiv();
	getContentXML('cp', 'getNewsEdit', '', URLe, 'hideLoadingDiv();');
}

function GetTwitterEdit(twitterID)
{
	var URLe = '&twitterID='+twitterID;
	
	showLoadingDiv();
	getContentXML('cp', 'getTwitterEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveTwitter(twitterID)
{
	var URLe = '&twitterID='+twitterID;
	
	URLe+= '&twitterMessage='+escape(Dom.get('twitterMessage').value);
	
	if (Dom.get('twitterAccountID')) {
		URLe+= '&twitterAccountID='+Dom.get('twitterAccountID').options[Dom.get('twitterAccountID').selectedIndex].value;
	}
	
	showLoadingDiv();
	getContentXML('cp', 'saveTwitter', '', URLe, 'hideLoadingDiv();');
}

function DeleteTwitter(twitterID)
{
	var URLe = '&twitterID='+twitterID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteTwitter', '', URLe, 'hideLoadingDiv();');
}

function CreateNewTwitter()
{
	var URLe = '&twitterID=0';
	
	showLoadingDiv();
	getContentXML('cp', 'getTwitterEdit', '', URLe, 'hideLoadingDiv();');
}

function GetMatchEdit(matchID)
{
	var URLe = '&matchID='+matchID;
	
	showLoadingDiv();
	getContentXML('cp', 'getMatchEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveMatch(matchID)
{
	var URLe = '&matchID='+matchID;
	
	//retrieve selectboxvalue if exist otherwise just the hidden value
	if (Dom.get('land1_select') && Dom.get('land2_select')) {
		URLe+= '&land1='+Dom.get('land1_select').options[Dom.get('land1_select').selectedIndex].value;
		URLe+= '&land2='+Dom.get('land2_select').options[Dom.get('land2_select').selectedIndex].value;
		URLe+= '&typematch='+Dom.get('matchTypeMatch_select').options[Dom.get('matchTypeMatch_select').selectedIndex].value;
	} else {
		URLe+= '&land1='+Dom.get('land1').value;
		URLe+= '&land2='+Dom.get('land2').value;
		URLe+= '&typematch='+Dom.get('matchTypeMatch').value;

	}
	
	URLe+= '&poul='+Dom.get('matchPoul').value;
	URLe+= '&place='+escape(Dom.get('matchPlace').value);
	URLe+= '&roundID='+Dom.get('matchRoundID').value;
	URLe+= '&date='+escape(Dom.get('matchDate').value);
	URLe+= '&time='+escape(Dom.get('matchTime').value);
	
	showLoadingDiv();
	getContentXML('cp', 'saveMatch', '', URLe, 'hideLoadingDiv();');
}

function DeleteMatch(matchID)
{
	var URLe = '&matchID='+matchID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteMatch', '', URLe, 'hideLoadingDiv();');
}

function CreateNewMatch()
{
	var URLe = '&matchID=0';
	
	showLoadingDiv();	
	getContentXML('cp', 'getMatchEdit', '', URLe, 'hideLoadingDiv();');
}

function CalculateRanking(gameID)
{
	CLIFinished = false;
	if (Dom.get('Progress')) {
		Dom.get('Progress').style.width = '0px';
		Dom.get('ProgressText').innerHTML = '';
	}
	
	var URLe = '&gameID='+gameID;
	
	//disable calc button
	Dom.get('calcranking').disabled = true;
	
	//get updateposition value
	if (Dom.get('updateposition').checked) {
		URLe+= '&UpdatePosition=1';
	} else {
		URLe+= '&UpdatePosition=0';
	}
	
	if (Dom.get('useroundcalculation')) {
		if (Dom.get('useroundcalculation').checked) {
			URLe+= '&useRoundCalculation=1';
		} else {
			URLe+= '&useRoundCalculation=0';
		}
	}
	
	showLoadingDiv();
	getContentXML('cp', 'calculateRanking', '', URLe, 'hideLoadingDiv();');
}

function GetResultEdit(drawID)
{
	var URLe = '&drawID='+drawID;
	
	showLoadingDiv();
	getContentXML('cp', 'getResultEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveResult(drawID, gameID)
{
	var URLe = '&drawID='+drawID+'&gameID='+gameID;
	
	URLe+= '&scoreteam1='+Dom.get('scoreteam1').value;
	URLe+= '&scoreteam2='+Dom.get('scoreteam2').value;
	URLe+= '&yellowteam1='+Dom.get('yellowteam1').value;
	URLe+= '&yellowteam2='+Dom.get('yellowteam2').value;
	URLe+= '&redteam1='+Dom.get('redteam1').value;
	URLe+= '&redteam2='+Dom.get('redteam2').value;
	URLe+= '&oldscoreteam1='+Dom.get('oldscoreteam1').value;
	URLe+= '&oldscoreteam2='+Dom.get('oldscoreteam2').value;
	URLe+= '&team1='+Dom.get('team1id').value;
	URLe+= '&team2='+Dom.get('team2id').value;
	URLe+= '&played='+Dom.get('played').value;
	URLe+= '&rankingRound='+Dom.get('rankinground').value;
	
	if (Dom.get('updatescores').checked) {
		URLe+= '&updatescores=1';
	} else {
		URLe+= '&updatescores=0';
	}
	if (Dom.get('updateposteams').checked) {
		URLe+= '&updateposteams=1';
	} else {
		URLe+= '&updateposteams=0';
	}
	if (Dom.get('onlyNew')) {
		if (Dom.get('onlyNew').checked) {
			URLe+= '&onlyNew=1';
		} else {
			URLe+= '&onlyNew=0';
		}
	}
	
	showLoadingDiv();
	getContentXML('cp', 'saveResult', '', URLe, 'hideLoadingDiv();');	
}

function SaveStats(gameID)
{
	var URLe = '&gameID='+gameID;
	
	URLe+= '&yellowCardsPoints='+Dom.get('yellowCardsPoints').value;
	URLe+= '&redCardsPoints='+Dom.get('redCardsPoints').value;
	URLe+= '&goalsPoints='+Dom.get('goalsPoints').value;
	URLe+= '&yellowCardsAmount='+Dom.get('yellowCardsAmount').value;
	URLe+= '&redCardsAmount='+Dom.get('redCardsAmount').value;
	URLe+= '&goalsAmount='+Dom.get('goalsAmount').value;
	
	showLoadingDiv();
	getContentXML('cp', 'saveStats', '', URLe, 'hideLoadingDiv();');	
}

function mailForm(gameID)
{
	var URLe = '&gameID='+gameID;
	
	URLe+= '&titleNl='+escape(Dom.get('infoTitleNL').value);
	URLe+= '&titleEng='+escape(Dom.get('infoTitleENG').value);
	URLe+= '&contentEng='+escape(Dom.get('contentENG').value);
	URLe+= '&contentNl='+escape(Dom.get('contentNL').value);
	
	URLe+= '&memberSelect='+getSelectedRadioValue(document.getElementsByName('members'));
	
	showLoadingDiv();
	getContentXML('cp', 'sendMail', '', URLe, 'hideLoadingDiv();');
}

function SearchMemberScoreAdmin(checkPredictions)
{
	if (typeof checkPredictions === 'undefined') var checkPredictions = '';
	var memberName = '';
	
	if (Dom.get('search_member')) {
		memberName = Dom.get('search_member').value;
	}
	
	if (memberName.length) {
		var URLe = '&memberName='+memberName;
		
		URLe+= '&checkPredictions='+checkPredictions;
		
		showLoadingDiv();
		getContentXML('cp', 'getMemberScoreEditListMembers', '', URLe, 'hideLoadingDiv();');
	}
}

function checkKeySearchMemberScoreAdmin(evt, checkPredictions)
{
	if (typeof checkPredictions === 'undefined') var checkPredictions = '';
	
	if (evt.keyCode == 13) {
		SearchMemberScoreAdmin(checkPredictions);
		return false;
	} else {
		return true;
	}
}

function GetMemberScoreEditListGames(profileID, checkPredictions)
{
	var URLe = '&profileID='+profileID;
	if (typeof checkPredictions === 'undefined') var checkPredictions = '';
	
	URLe+= '&checkPredictions='+checkPredictions;
	
	showLoadingDiv();
	getContentXML('cp', 'getMemberScoreEditListGames', '', URLe, 'hideLoadingDiv();');
}

function GetListMemberScoreOfGames(gameID, profileID)
{
	var URLe = '&gameIDToUse='+gameID+'&profileIDToUse='+profileID;
	
	showLoadingDiv();
	getContentXML('cp', 'getListMemberScoreOfGames', '', URLe, 'hideLoadingDiv();');
}

function EditMemberPredictionOfGame(predictionID)
{
	var URLe = '&predictionID='+predictionID;
	
	showLoadingDiv();
	getContentXML('cp', 'editMemberPredictionOfGame', '', URLe, 'hideLoadingDiv();');
}

function SavePredictionOfMember(predictionID)
{
	var URLe = '&predictionID='+predictionID;
	
	URLe+= '&score1='+Dom.get('score1').value;
	URLe+= '&score2='+Dom.get('score2').value;
	URLe+= '&points='+Dom.get('points').value;
	URLe+= '&oldpoints='+Dom.get('oldpoints').value;
	URLe+= '&profileIDToUse='+Dom.get('profileIDToUse').value;
	URLe+= '&gameIDToUse='+Dom.get('gameIDToUse').value;
	
	showLoadingDiv();
	getContentXML('cp', 'saveMemberPredictionOfGame', '', URLe, 'hideLoadingDiv();');
}

function DeletePredictionOfMember(predictionID)
{
	var URLe = '&predictionID='+predictionID;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteMemberPredictionOfGame', '', URLe, 'hideLoadingDiv();');
}

function GetPredictionsOfPlayer(gameID, profileID)
{
	var URLe = '&gameIDToUse='+gameID+'&profileIDToUse='+profileID;
	
	showLoadingDiv();
	getContentXML('cp', 'getPredictionsOfPlayer', '', URLe, 'hideLoadingDiv();');
}

function ClearCaches()
{
	var URLe = '';
	
	showLoadingDiv();
	getContentXML('cp', 'clearCaches', '', URLe, 'hideLoadingDiv();');
}

function GetGameSettingsEdit(gameID)
{
	var URLe = '&gameIDToUse='+gameID;
	
	showLoadingDiv();
	getContentXML('cp', 'getGameSettingsEdit', '', URLe, 'hideLoadingDiv();');
}

function SaveGameSettings(gameID)
{
	var URLe = '&gameIDToUse='+gameID;
	
	URLe+= '&gameName='+escape(Dom.get('gameName').value);
	URLe+= '&gameTitle='+escape(Dom.get('gameTitle').value);
	URLe+= '&gameBanner='+escape(Dom.get('gameBanner').value);
	URLe+= '&gameBanner_small='+escape(Dom.get('gameBanner_small').value);
	URLe+= '&gamePredictionDate='+escape(Dom.get('gamePredictionDate').value);
	URLe+= '&gameStartDate='+escape(Dom.get('gameStartDate').value);
	URLe+= '&sitename='+escape(Dom.get('sitename').value);
	URLe+= '&sitename_short='+escape(Dom.get('sitename_short').value);
	URLe+= '&sitename_header='+escape(Dom.get('sitename_header').value);
	URLe+= '&url='+escape(Dom.get('url').value);
	URLe+= '&adminemail='+escape(Dom.get('adminemail').value);
	URLe+= '&site_url='+escape(Dom.get('site_url').value);
	URLe+= '&site_url_long='+escape(Dom.get('site_url_long').value);
	URLe+= '&seasonID='+escape(Dom.get('seasonID').value);
	URLe+= '&leagueID='+escape(Dom.get('leagueID').value);
	URLe+= '&gameNameShort='+escape(Dom.get('gameNameShort').value);
	URLe+= '&gameOrder='+escape(Dom.get('gameOrder').value);
	
	URLe+= '&gameStatus='+getSelectedRadioValue(document.getElementsByName('gameStatus'));
	URLe+= '&gameVisible='+getSelectedRadioValue(document.getElementsByName('gameVisible'));
	URLe+= '&gamePrediction='+getSelectedRadioValue(document.getElementsByName('gamePrediction'));
	URLe+= '&gameSeperatePredictions='+getSelectedRadioValue(document.getElementsByName('gameSeperatePredictions'));
	URLe+= '&gameCardStatus='+getSelectedRadioValue(document.getElementsByName('gameCardStatus'));
	URLe+= '&gameUsePools='+getSelectedRadioValue(document.getElementsByName('gameUsePools'));
	URLe+= '&gameNoTeamPrediction='+getSelectedRadioValue(document.getElementsByName('gameNoTeamPrediction'));
	URLe+= '&gamePredictionRanking='+getSelectedRadioValue(document.getElementsByName('gamePredictionRanking'));
	URLe+= '&gameSendMailPredictionInGroups='+getSelectedRadioValue(document.getElementsByName('gameSendMailPredictionInGroups'));
	URLe+= '&gameUseFirstRanking='+getSelectedRadioValue(document.getElementsByName('gameUseFirstRanking'));
	URLe+= '&gameUseSecondRanking='+getSelectedRadioValue(document.getElementsByName('gameUseSecondRanking'));
	
	URLe+= '&showAdLeft='+getSelectedRadioValue(document.getElementsByName('showAdLeft'));
	URLe+= '&showPollLeft='+getSelectedRadioValue(document.getElementsByName('showPollLeft'));
	URLe+= '&showTop5Left='+getSelectedRadioValue(document.getElementsByName('showTop5Left'));
	URLe+= '&showNewsGenLeft='+getSelectedRadioValue(document.getElementsByName('showNewsGenLeft'));
	URLe+= '&showNewsLeft='+getSelectedRadioValue(document.getElementsByName('showNewsLeft'));
	URLe+= '&showShoutLeft='+getSelectedRadioValue(document.getElementsByName('showShoutLeft'));
	URLe+= '&showStatHp='+getSelectedRadioValue(document.getElementsByName('showStatHp'));
	URLe+= '&showNextHp='+getSelectedRadioValue(document.getElementsByName('showNextHp'));
	URLe+= '&showLatestHp='+getSelectedRadioValue(document.getElementsByName('showLatestHp'));
	URLe+= '&showNewsHp='+getSelectedRadioValue(document.getElementsByName('showNewsHp'));
	URLe+= '&showIntroHp='+getSelectedRadioValue(document.getElementsByName('showIntroHp'));
	URLe+= '&showComHp='+getSelectedRadioValue(document.getElementsByName('showComHp'));
	
	showLoadingDiv();
	getContentXML('cp', 'saveGameSettings', '', URLe, 'hideLoadingDiv();');
}

function GetUserrightsEdit(gameID)
{
	var URLe = '&gameIDToUse='+gameID;
	
	showLoadingDiv();
	getContentXML('cp', 'getUserrightsEdit', '', URLe, 'hideLoadingDiv();');
}

function LoadUserrightsData(profileID)
{
	if (Dom.get('editrightsrows_'+profileID)) {
		if (Dom.get('editrightsrows_'+profileID).style.display == 'block') {
			Dom.get('editrightsrows_'+profileID).style.display = 'none';	
		} else {
			Dom.get('editrightsrows_'+profileID).style.display = 'block';	
		}
	}
}

function AddUserrightsItem(profileID, gameIDToUse)
{
	var URLe = '&profileID='+profileID+'&gameIDToUse='+gameIDToUse;
	
	URLe+= '&itemValue='+escape(Dom.get('userrightsitems_'+profileID).options[Dom.get('userrightsitems_'+profileID).selectedIndex].value);
	
	showLoadingDiv();
	getContentXML('cp', 'addUserrightsItem', '', URLe, 'hideLoadingDiv();');
}

function DeleteUserrightsItem(itemValue, profileID, gameIDToUse)
{
	var URLe = '&itemValue='+escape(itemValue)+'&profileID='+profileID+'&gameIDToUse='+gameIDToUse;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteUserrightsItem', '', URLe, 'hideLoadingDiv();');
}

function DeleteUserrightsUser(profileID, gameIDToUse)
{
	var URLe = '&profileID='+profileID+'&gameIDToUse='+gameIDToUse;
	
	showLoadingDiv();
	getContentXML('cp', 'deleteUserrightsUser', '', URLe, 'hideLoadingDiv();');
}

function SaveUserrightsNewuser(gameID)
{
	var URLe = '&gameIDToUse='+gameID;
	
	URLe+= '&profileID='+escape(Dom.get('newuser').options[Dom.get('newuser').selectedIndex].value);
	
	showLoadingDiv();
	getContentXML('cp', 'saveUserrightsNewuser', '', URLe, 'hideLoadingDiv();');
}

function savePredictionEndRankingAdmin(totalteams, gameID, poulsString)
{
	var selectedTeams = '';
	
	var poulsArray = poulsString.split(",");
	for (var p in poulsArray){
		//get selected teams
		for (i = 1; i <= totalteams; i++) {
			if (Dom.get('predictionteam'+i+'_'+poulsArray[p]).selectedIndex) {
				selectedTeams+= '&predictionteam_'+i+'_'+poulsArray[p]+'='+Dom.get('predictionteam'+i+'_'+poulsArray[p]).options[Dom.get('predictionteam'+i+'_'+poulsArray[p]).selectedIndex].innerHTML;
			} else {
				selectedTeams = '&predictionteam=1';
				break;
			}
		}
	}
	
	var URLe = selectedTeams+'&totalTeams='+totalteams+'&poulsString='+poulsString+'&includeLatestPoints='+Dom.get('includeLatestPoints').value;

	getContentXML('cp', 'savePredictionEndRankingAdmin', '', URLe);
}

function OrderTodoList(ordering)
{
	var URLe = '&todoordering='+ordering;
	
	if (Dom.get('OrderingAmount').value == 'ASC') {
		Dom.removeClass("commSortLink_"+ordering, "asc");
		Dom.addClass("commSortLink_"+ordering, "desc");
		
		Dom.get('OrderingAmount').value = 'DESC';
		
	} else {
		Dom.removeClass("commSortLink_"+ordering, "desc");
		Dom.addClass("commSortLink_"+ordering, "asc");
		Dom.get('OrderingAmount').value = 'ASC';
	}
	
	URLe+= '&todoorderingorder='+Dom.get('OrderingAmount').value+'&Listing='+Dom.get('OrderType').value+'&searchString='+Dom.get('searchString').value;
	
	getContentXML('cp', 'drawTodoRow', '', URLe);
}

function getTodoListing(listing)
{
	if (typeof listing === 'undefined') listing = '';
	
	var URLe = '&Listing='+listing;
	
	getContentXML('cp', 'getTodoList', '', URLe);
}

function checkKeySearchTodo(evt)
{
	if (evt.keyCode == 13) {
		SearchTodo();
		return false;
	} else {
		return true;
	}
}

function SearchTodo()
{
	var URLe = '&todoordering='+Dom.get('OrderBy').value+'&todoorderingorder='+Dom.get('OrderingAmount').value+'&Listing='+Dom.get('OrderType').value+'&searchString='+Dom.get('searchString').value;
	
	getContentXML('cp', 'drawTodoRow', '', URLe);
}

function getRoundWinners()
{
	var URLe = '&amountWinners='+Dom.get('amountWinners').value;
	URLe+= '&roundID='+Dom.get('roundID').value;
	
	showLoadingDiv();
	getContentXML('cp', 'getRoundWinners', '', URLe, 'hideLoadingDiv();');
}

function sendRoundWinners(state, roundID)
{
	if (state == 'test') {
		var URLe = '&testWinners=1';
		URLe+= '&testEmail='+escape(Dom.get('testEmail').value);
	} else {
		var URLe = '&testWinners=0';
		URLe+= '&realEmail='+escape(Dom.get('realEmail').value);
	}
	
	URLe+= '&roundID='+roundID;
	URLe+= '&messageContent='+escape(Dom.get('messageContent').value);
	
	showLoadingDiv();
	getContentXML('cp', 'sendRoundWinners', '', URLe, 'hideLoadingDiv();');
}