/*
 * Zedcore CMS javascript framework.
 * Copyright 2009-2010 Zedcore Systems Ltd
 */
if(typeof ZC==="undefined"||!ZC){var ZC={}}ZC.Namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=ZC;for(B=(D[0]=="ZC")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]]}}return E};(function(){var L=YAHOO.lang,Dom=YAHOO.util.Dom,Evt=YAHOO.util.Event;var _ForEachArray=function(aArray,fnCallback,oThis){if(Array.forEach){_ForEachArray=Array.forEach}else{_ForEachArray=function(aArray,fnCallback,oThis){if(!L.isFunction(fnCallback)){throw new TypeError()}for(var i=0,iMax=aArray.length;i<iMax;i++){if(i in aArray){fnCallback.call(oThis,aArray[i],i,aArray)}}}}_ForEachArray(aArray,fnCallback,oThis)};var extraNames,extraLen,empty={};for(var i in {toString:1}){extraNames=[];break}extraNames=extraNames||["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"];extraLen=extraNames.length;var iScrollbarWidth;var sprintfRegex=/%%|%(\d+\$)?([-+#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;ZC.Util={sCurrentDomain:"Core",sprintf:function(){function pad(str,len,chr,leftJustify){var padding=(str.length>=len)?"":Array(1+len-str.length>>>0).join(chr);return leftJustify?str+padding:padding+str}function justify(value,prefix,leftJustify,minWidth,zeroPad){var diff=minWidth-value.length;if(diff>0){if(leftJustify||!zeroPad){value=pad(value,minWidth," ",leftJustify)}else{value=value.slice(0,prefix.length)+pad("",diff,"0",true)+value.slice(prefix.length)}}return value}function formatBaseX(value,base,prefix,leftJustify,minWidth,precision,zeroPad){var number=value>>>0;prefix=prefix&&number&&{"2":"0b","8":"0","16":"0x"}[base]||"";value=prefix+pad(number.toString(base),precision||0,"0",false);return justify(value,prefix,leftJustify,minWidth,zeroPad)}function formatString(value,leftJustify,minWidth,precision,zeroPad){if(precision!=null){value=value.slice(0,precision)}return justify(value,"",leftJustify,minWidth,zeroPad)}var a=arguments,i=0,format=a[i++];return format.replace(sprintfRegex,function(substring,valueIndex,flags,minWidth,ignore,precision,type){if(substring=="%%"){return"%"}var leftJustify=false,positivePrefix="",zeroPad=false,prefixBaseX=false;for(var j=0;flags&&j<flags.length;j++){switch(flags.charAt(j)){case" ":positivePrefix=" ";break;case"+":positivePrefix="+";break;case"-":leftJustify=true;break;case"0":zeroPad=true;break;case"#":prefixBaseX=true;break}}if(!minWidth){minWidth=0}else{if(minWidth=="*"){minWidth=+a[i++]}else{if(minWidth.charAt(0)=="*"){minWidth=+a[minWidth.slice(1,-1)]}else{minWidth=+minWidth}}}if(minWidth<0){minWidth=-minWidth;leftJustify=true}if(!isFinite(minWidth)){throw new Error("sprintf: (minimum-)width must be finite")}if(!precision){precision="fFeE".indexOf(type)>-1?6:(type=="d")?0:void (0)}else{if(precision=="*"){precision=+a[i++]}else{if(precision.charAt(0)=="*"){precision=+a[precision.slice(1,-1)]}else{precision=+precision}}}var value=valueIndex?a[valueIndex.slice(0,-1)]:a[i++];switch(type){case"s":return formatString(String(value),leftJustify,minWidth,precision,zeroPad);case"c":return formatString(String.fromCharCode(+value),leftJustify,minWidth,precision,zeroPad);case"b":return formatBaseX(value,2,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"o":return formatBaseX(value,8,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"x":return formatBaseX(value,16,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"X":return formatBaseX(value,16,prefixBaseX,leftJustify,minWidth,precision,zeroPad).toUpperCase();case"u":return formatBaseX(value,10,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"i":case"d":var number=parseInt(+value);var prefix=number<0?"-":positivePrefix;value=prefix+pad(String(Math.abs(number)),precision,"0",false);return justify(value,prefix,leftJustify,minWidth,zeroPad);case"e":case"E":case"f":case"F":case"g":case"G":var number=+value;var prefix=number<0?"-":positivePrefix;var method=["toExponential","toFixed","toPrecision"]["efg".indexOf(type.toLowerCase())];var textTransform=["toString","toUpperCase"]["eEfFgG".indexOf(type)%2];value=prefix+Math.abs(number)[method](precision);return justify(value,prefix,leftJustify,minWidth,zeroPad)[textTransform]();default:return substring}})},StrRepeat:function(sStr,iMultiplier){if(iMultiplier<0){YAHOO.log("StrRepeat: iMultiplier should be positive","error")}return new Array(iMultiplier+1).join("*")},TextDomain:function(sTextDomain){if(!L.isUndefined(sTextDomain)){this.sCurrentDomain=sTextDomain}return this.sCurrentDomain},GetText:function(sStr){var sTextDomain=ZC.Util.TextDomain();if(!L.isUndefined(ZC.oTranslations)){try{if(!L.isUndefined(ZC.oTranslations[sTextDomain][sStr][1])&&ZC.oTranslations[sTextDomain][sStr][1]){sStr=ZC.oTranslations[sTextDomain][sStr][1]}}catch(e){if(!(e instanceof TypeError)){throw e}}}return sStr},NGetText:function(sSingStr,sPlurStr,iCount){var sString,nplurals,plural,n=iCount,sTextDomain=ZC.Util.TextDomain();if(!L.isUndefined(ZC.oTranslations)){try{eval(ZC.oTranslations[sTextDomain][""]["Plural-Forms"]);plural=Number(plural)}catch(e){}finally{if(!L.isNumber(nplurals)||!L.isNumber(plural)||plural>nplurals){nplurals=2;plural=(iCount==1)?0:1}}try{if(!L.isUndefined(ZC.oTranslations[sTextDomain][sSingStr][plural+1])&&ZC.oTranslations[sTextDomain][sSingStr][plural+1]){sString=ZC.oTranslations[sTextDomain][sSingStr][plural+1]}}catch(e){if(!(e instanceof TypeError)){throw e}}}if(!sString){if(iCount==1){sString=sSingStr}else{sString=sPlurStr}}return sString},DGetText:function(sDomain,sStr){var sOldDomain=ZC.Util.TextDomain(),sTranslatedStr;ZC.Util.TextDomain(sDomain);sTranslatedStr=ZC.Util.GetText(sStr);ZC.Util.TextDomain(sOldDomain);return sTranslatedStr},DNGetText:function(sDomain,sSingStr,sPlurStr,iCount){var sOldDomain=ZC.Util.TextDomain(),sTranslatedStr;ZC.Util.TextDomain(sDomain);sTranslatedStr=ZC.Util.NGetText(sSingStr,sPlurStr,iCount);ZC.Util.TextDomain(sOldDomain);return sTranslatedStr},ReplaceTags:function(sContent,aTags,bBlankUnknownTags){var fnReplace=function(sStr,sTagName){if(L.isUndefined(aTags[sTagName])){return bBlankUnknownTags?"":sStr}return aTags[sTagName]};sContent=sContent.replace(/\{(.*?)\}/gi,fnReplace);sContent=sContent.replace('"/http','"http');return sContent},WrapContents:function(elSrc){var aChildren=elSrc.childNodes,elDiv=document.createElement("div");while(aChildren.length){elDiv.appendChild(aChildren[0])}elSrc.appendChild(elDiv);return elDiv},ScrollPage:function(mTo,fDuration,fnEasing){var aToXY,oAnim;if(L.isArray(mTo)){aToXY=mTo}else{aToXY=Dom.getXY(mTo)}if(L.isUndefined(fDuration)){fDuration=1}if(L.isUndefined(fnEasing)){fnEasing=YAHOO.util.Easing.easeOut}if(aToXY){if(L.isUndefined(this.bUseDocumentElement)){var iExistingScrollTop=document.documentElement.scrollTop;document.documentElement.scrollTop=iExistingScrollTop+1;this.bUseDocumentElement=(document.documentElement.scrollTop==iExistingScrollTop+1);document.documentElement.scrollTop=iExistingScrollTop}oAnim=new YAHOO.util.Scroll(this.bUseDocumentElement?document.documentElement:document.body,{scroll:{to:aToXY}},fDuration,fnEasing);oAnim.animate()}},UpdateElement:function(sID,oAttribs){var el=Dom.get(sID),sAnimation,oAnimOut,oAnimIn;if(L.isUndefined(oAttribs.OnStart)){oAttribs.OnStart=function(){}}if(L.isUndefined(oAttribs.OnHalfway)){oAttribs.OnHalfway=function(){}}if(L.isUndefined(oAttribs.OnComplete)){oAttribs.OnComplete=function(){}}if(L.isUndefined(oAttribs.Scope)){oAttribs.Scope=el}if(el){sAnimation="fade";if(YAHOO.env.ua.ie||!YAHOO.env.getVersion("animation")||Dom.hasClass(el,"hidden")||Dom.hasClass(el,"hide")){sAnimation="none"}else{if(!L.isUndefined(oAttribs.Animation)){sAnimation=oAttribs.Animation}}switch(sAnimation){case"fade":oAnimIn=new YAHOO.util.Anim(el,{opacity:{to:1}},0.1);oAnimOut=new YAHOO.util.Anim(el,{opacity:{from:Dom.getStyle(el,"opacity"),to:0}},0.1);oAnimOut.onStart.subscribe(oAttribs.OnStart,oAttribs.Scope,true);oAnimOut.onComplete.subscribe(function(){if(!L.isUndefined(oAttribs.HTML)){el.innerHTML=oAttribs.HTML}oAttribs.OnHalfway.call(oAttribs.Scope);ZC.JSManager.AutoTooltips(el);oAnimIn.animate()});oAnimIn.onComplete.subscribe(function(){oAttribs.OnComplete.call(oAttribs.Scope);L.later(10,el,function(){Dom.setStyle(this,"opacity","")})},this,true);oAnimOut.animate();break;case"none":default:oAttribs.OnStart.call(oAttribs.Scope);oAttribs.OnHalfway.call(oAttribs.Scope);if(!L.isUndefined(oAttribs.HTML)){el.innerHTML=oAttribs.HTML}ZC.JSManager.AutoTooltips(el);oAttribs.OnComplete.call(oAttribs.Scope);break}}else{YAHOO.log("UpdateElement: unable to locate element with id "+sID,"warn","UpdateElement");oAttribs.OnStart.call(oAttribs.Scope);oAttribs.OnHalfway.call(oAttribs.Scope);oAttribs.OnComplete.call(oAttribs.Scope)}},InArray:function(Value,aSearch){return(this.IndexOf(aSearch,Value)>=0)},IndexOf:function(aSearch,SearchElement,iFrom){if(Array.indexOf){this.IndexOf=Array.indexOf}else{this.IndexOf=function(aSearch,SearchElement,iFrom){iFrom=Number(iFrom)||0;var iLen=aSearch.length;if(iFrom<0){iFrom+=iLen}for(;iFrom<iLen;iFrom++){if(iFrom in aSearch&&aSearch[iFrom]===SearchElement){return iFrom}}return -1}}return this.IndexOf(aSearch,SearchElement,iFrom)},LastIndexOf:function(aSearch,SearchElement,iFrom){if(Array.indexOf){this.LastIndexOf=Array.lastIndexOf}else{this.LastIndexOf=function(aSearch,SearchElement,iFrom){var iLen=aSearch.length;iFrom=Number(iFrom)||0;if(isNaN(iFrom)){iFrom=iLen-1}else{if(iFrom<0){iFrom+=iLen}else{if(iFrom>=iLen){iFrom=iLen-1}}}for(;iFrom>-1;iFrom--){if(iFrom in aSearch&&aSearch[iFrom]===SearchElement){return iFrom}}return -1}}return this.LastIndexOf(aSearch,SearchElement,iFrom)},ForEach:function(aArray,fnCallback,oThis){if(L.isUndefined(aArray)){return }if(!L.isFunction(fnCallback)){throw new TypeError()}if(L.isArray(aArray)){return _ForEachArray(aArray,fnCallback,oThis)}if(!L.isUndefined(aArray.length)){for(var i=0,iMax=aArray.length;i<iMax;i++){fnCallback.call(oThis,aArray[i],i,aArray)}}else{for(var Key in aArray){if(L.hasOwnProperty(aArray,Key)){fnCallback.call(oThis,aArray[Key],Key,aArray)}}}},Map:function(aArray,fnCallback,oThis){if(Array.map){this.Map=Array.map}else{this.Map=function(aArray,fnCallback,oThis){if(!L.isFunction(fnCallback)){throw new TypeError()}var iLen=aArray.length;var aResult=new Array(iLen);for(var i=0;i<iLen;i++){if(i in aArray){aResult[i]=fnCallback.call(oThis,aArray[i],i,aArray)}}return aResult}}return this.Map(aArray,fnCallback,oThis)},Filter:function(aArray,fnCallback,oThis){if(Array.filter){this.Filter=Array.filter}else{this.Filter=function(aArray,fnCallback,oThis){if(!L.isFunction(fnCallback)){throw new TypeError()}var iLen=aArray.length;var aResult=new Array();for(var i=0;i<iLen;i++){if(i in aArray){var Val=aArray[i];if(fnCallback.call(oThis,Val,i,aArray)){aResult.push(Val)}}}return aResult}}return this.Filter(aArray,fnCallback,oThis)},Some:function(aArray,fnCallback,oThis){if(Array.some){this.Some=Array.some}else{this.Some=function(aArray,fnCallback,oThis){if(!L.isFunction(fnCallback)){throw new TypeError()}var iLen=aArray.length;for(var i=0;i<iLen;i++){if(i in aArray&&fnCallback.call(oThis,aArray[i],i,aArray)){return true}}return false}}return this.Some(aArray,fnCallback,oThis)},Every:function(aArray,fnCallback,oThis){if(Array.every){this.Every=Array.every}else{this.Every=function(aArray,fnCallback,oThis){if(!L.isFunction(fnCallback)){throw new TypeError()}var iLen=aArray.length;for(var i=0;i<iLen;i++){if(i in aArray&&!fnCallback.call(oThis,aArray[i],i,aArray)){return false}}return true}}return this.Every(aArray,fnCallback,oThis)},Keys:function(o){var aKeys=[];this.ForEach(o,function(v,k){aKeys.push(k)});return aKeys},Flatten:function(aFlatten){var aResult=[];U.ForEach(aFlatten,function(mVal){if(L.isArray(mVal)){aResult.push.apply(aResult,this.Flatten(mVal))}else{aResult.push(mVal)}},this);return aResult},ObjectsEqual:function(oA,oB,bStrict,aSeen){if(!L.isArray(oA)&&!L.isObject(oA)&&!L.isArray(oB)&&!L.isObject(oB)){return bStrict?(oA===oB):(oA==oB)}if(L.isArray(oA)!=L.isArray(oB)||typeof oA!=typeof oB){return false}var aKeysA=this.Keys(oA),aKeysB=this.Keys(oB),i,iMax,k,iIndexB;if(aKeysA.length!=aKeysB.length){return false}for(i=0,iMax=aKeysA.length;i<iMax;i++){k=aKeysA[i];iIndexB=this.IndexOf(aKeysB,k);if(iIndexB==-1){return false}aKeysB.splice(iIndexB,1);if(bStrict&&typeof oA[k]!=typeof oB[k]){return false}if(typeof oA[k]=="object"){if(L.isUndefined(aSeen)||(!this.InArray(oA[k],aSeen)&&!this.InArray(oB[k],aSeen))){var aNewSeen=aSeen||[];aNewSeen.unshift(oA,oB);if(!this.ObjectsEqual(oA[k],oB[k],bStrict,aNewSeen)){return false}}}else{if(oA[k]!=oB[k]){return false}}}if(aKeysB.length>0){return false}return true},Clone:function(o){if(!o||typeof o!="object"||L.isFunction(o)){return o}if(o.nodeType&&"cloneNode" in o){return o.cloneNode(true)}if(o instanceof Date){return new Date(o.getTime())}var r,i,l,s,name;if(L.isArray(o)){r=[];for(i=0,l=o.length;i<l;++i){if(i in o){r.push(this.Clone(o[i]))}}}else{r=o.constructor?new o.constructor():{}}for(name in o){s=o[name];if(!(name in r)||(r[name]!==s&&(!(name in empty)||empty[name]!==s))){r[name]=this.Clone(s)}}if(extraLen){for(i=0;i<extraLen;++i){name=extraNames[i];s=o[name];if(!(name in r)||(r[name]!==s&&(!(name in empty)||empty[name]!==s))){r[name]=s}}}return r},InsertAtCursor:function(elInput,sText){var iScrollPos=elInput.scrollTop,iStrPos=0,bSelStart=!L.isUndefined(elInput.selectionStart),oRange,sStart,sEnd;if(bSelStart){iStrPos=elInput.selectionStart}else{elInput.focus();oRange=document.selection.createRange();oRange.moveStart("character",-elInput.value.length);iStrPos=oRange.text.length}sStart=elInput.value.substring(0,iStrPos);sEnd=elInput.value.substring(iStrPos);elInput.value=sStart+sText+sEnd;iStrPos+=sText.length;elInput.focus();if(bSelStart){elInput.selectionStart=iStrPos;elInput.selectionEnd=iStrPos}else{oRange=document.selection.createRange();oRange.moveStart("character",-elInput.value.length);oRange.moveStart("character",strPos);oRange.moveEnd("character",0);oRange.select()}elInput.scrollTop=iScrollPos},GetScrollbarWidth:function(){if(!L.isUndefined(iScrollbarWidth)){return iScrollbarWidth}var elScroll=null,elInner=null,iNoScroll=0,iScroll=0;elScroll=document.createElement("div");Dom.setStyle(elScroll,"position","absolute");Dom.setStyle(elScroll,"top","-1000px");Dom.setStyle(elScroll,"left","-1000px");Dom.setStyle(elScroll,"width","100px");Dom.setStyle(elScroll,"height","50px");Dom.setStyle(elScroll,"overflow","hidden");elInner=document.createElement("div");Dom.setStyle(elInner,"width","100%");Dom.setStyle(elInner,"height","200px");elScroll.appendChild(elInner);document.body.appendChild(elScroll);iNoScroll=elInner.offsetWidth;Dom.setStyle(elScroll,"overflow","scroll");iScroll=elInner.offsetWidth;if(iNoScroll==iScroll){iScroll=elScroll.clientWidth}document.body.removeChild(elScroll);iScrollbarWidth=(iNoScroll-iScroll);return iScrollbarWidth},Alert:function(sMessage,oParams){if(L.isUndefined(oParams)){oParams={}}else{if(L.isFunction(oParams)){oParams={OKHandler:oParams}}}if(L.isUndefined(oParams.OKHandler)){oParams.OKHandler=function(){}}if(L.isUndefined(oParams.Scope)){oParams.Scope=window}if(!L.isUndefined(YAHOO.widget.SimpleDialog)){var oPanelConfig,oPanel;oPanelConfig={width:oParams.width||"300px",fixedcenter:"contained",visible:false,draggable:false,close:false,modal:true,text:sMessage,icon:YAHOO.widget.SimpleDialog.ICON_ALARM,constraintoviewport:true,buttons:[{text:"OK",handler:function(){this.destroy();oParams.OKHandler.call(oParams.Scope)},isDefault:true}]};if(!L.isUndefined(YAHOO.widget.SimpleDialog["ICON_"+oParams.Icon])){oPanelConfig.icon=YAHOO.widget.SimpleDialog["ICON_"+oParams.Icon]}oPanel=new YAHOO.widget.SimpleDialog("alert"+Math.floor(Math.random()*1000),oPanelConfig);oPanel.render(document.body);oPanel.show()}else{alert(sMessage);oParams.OKHandler.call(oParams.Scope)}},Confirm:function(sMessage,oScope,fnOKHandler,fnCancelHandler){if(L.isUndefined(fnOKHandler)){fnOKHandler=function(){}}if(L.isUndefined(fnCancelHandler)){fnCancelHandler=function(){}}if(!L.isUndefined(YAHOO.widget.SimpleDialog)){if(L.isUndefined(this.oConfirmPanel)){this.oConfirmPanel=new YAHOO.widget.SimpleDialog("alert",{width:"300px",fixedcenter:true,visible:false,draggable:false,close:false,modal:true,icon:YAHOO.widget.SimpleDialog.ICON_HELP,constraintoviewport:true});this.oConfirmPanel.render(document.body)}this.oConfirmPanel.cfg.setProperty("text",sMessage);this.oConfirmPanel.cfg.setProperty("buttons",[{text:"Yes",handler:function(){this.hide();fnOKHandler.call(oScope)},isDefault:true},{text:"No",handler:function(){this.hide();fnCancelHandler.call(oScope)}}]);this.oConfirmPanel.show()}else{if(confirm(sMessage)){fnOKHandler()}else{fnCancelHandler()}}},DefaultLoadingIndicator:{Show:function(){if(L.isUndefined(this.elLoadingIndicator)){this.elLoadingIndicator=document.createElement("div");this.elLoadingIndicator.id="ajaxloading";this.elLoadingIndicator.className="hide";this.elLoadingIndicator.appendChild(document.createTextNode(ZC.Util.GetText("Please wait…")));Dom.setStyle(this.elLoadingIndicator,"opacity",0);document.body.appendChild(this.elLoadingIndicator);if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<7){var fnAlignDiv=function(){this.elLoadingIndicator.style.top=Dom.getClientRegion().top+"px"};fnAlignDiv.call(this);Evt.on(window,"resize",fnAlignDiv,this,true);Evt.on(window,"scroll",fnAlignDiv,this,true)}Evt.on(window,"unload",function(){this.elLoadingIndicator=null},this,true)}if(YAHOO.util.Anim){var oAnim=new YAHOO.util.Anim(this.elLoadingIndicator,{opacity:{from:0,to:0.75}},0.4);oAnim.onStart.subscribe(function(){Dom.removeClass(this.elLoadingIndicator,"hide")},this,true);oAnim.animate()}else{Dom.removeClass(this.elLoadingIndicator,"hide")}},Hide:function(){if(YAHOO.util.Anim){var oAnim=new YAHOO.util.Anim(this.elLoadingIndicator,{opacity:{from:0.75,to:0}},0.4);oAnim.onComplete.subscribe(function(){Dom.addClass(this.elLoadingIndicator,"hide")},this,true);oAnim.animate()}else{Dom.addClass(this.elLoadingIndicator,"hide")}}}};var U=ZC.Util,_GT=U.GetText;var AttribProvider=function(){};AttribProvider.prototype={GetAttrib:function(sName){if(this.AttribIsset(sName)){return this.aDef[sName]}else{YAHOO.log("Attrib "+sName+" is not set","error",this.sName+"::GetAttrib")}},GetAttribDefault:function(sName,mDefault){if(L.isUndefined(mDefault)){mDefault=false}return this.AttribIsset(sName)?this.GetAttrib(sName):mDefault},AttribIsset:function(sName){return !L.isUndefined(this.aDef[sName])},AttribsAreSet:function(aAttribs){return U.Every(aAttribs,_AttribIsset,this)},SetAttrib:function(sName,Value){var OldValue=this.aDef[sName];this.aDef[sName]=Value;if(OldValue!=Value&&L.isFunction(this["AttribMethod_"+sName])){this["AttribMethod_"+sName](Value,OldValue)}},SetAttribs:function(oAttribs){U.ForEach(oAttribs,function(Value,sName){this.SetAttrib(sName,Value)},this)},AttribProviderSetup:function(){this._bAttribProviderSetup=true;U.ForEach(this.aDef,function(Value,sKey){if(L.isFunction(this["AttribMethod_"+sKey])){this["AttribMethod_"+sKey](Value)}},this);this._bAttribProviderSetup=false}};var GetWidgetProvider=function(){};GetWidgetProvider.prototype={GetWidget:function(sSearch){var iNumSearchObjects,iDotPos,i,oSearchObject,sSearchPart,sSearchRest,sName,oChildSearch;if(L.isObject(sSearch)){if(sSearch instanceof ZC.Core.Widget){return sSearch}else{if(!L.isUndefined(sSearch.name)){sSearch=sSearch.name}else{if(!L.isUndefined(sSearch.id)){sSearch=sSearch.id}else{sSearch=sSearch.toString()}}}}iNumSearchObjects=this._aSearchObjects.length;iDotPos=sSearch.indexOf(".");if(iDotPos>-1){sSearchPart=sSearch.substr(0,iDotPos);sSearchRest=sSearch.substr(iDotPos+1);for(i=0;i<iNumSearchObjects;++i){oSearchObject=this[this._aSearchObjects[i]];if(!L.isUndefined(oSearchObject[sSearchPart])){return oSearchObject[sSearchPart].GetWidget(sSearchRest)}}return undefined}for(i=0;i<iNumSearchObjects;++i){oSearchObject=this[this._aSearchObjects[i]];if(!L.isUndefined(oSearchObject[sSearch])){return oSearchObject[sSearch]}for(sName in oSearchObject){if(L.hasOwnProperty(oSearchObject,sName)&&L.isObject(oSearchObject[sName])){oChildSearch=oSearchObject[sName].GetWidget(sSearch);if(!L.isUndefined(oChildSearch)){return oChildSearch}}}}return undefined},GetWidgetsBy:function(fnMethod,oScope){var iNumSearchObjects,i,oSearchObject,sSearchPart,sSearchRest,sName,oChildSearch,aResult=[];iNumSearchObjects=this._aSearchObjects.length;for(i=0;i<iNumSearchObjects;++i){oSearchObject=this[this._aSearchObjects[i]];U.ForEach(oSearchObject,function(oSearch){if(fnMethod.call(oScope,oSearch)){aResult.push(oSearch)}});for(sName in oSearchObject){if(L.hasOwnProperty(oSearchObject,sName)){aChildSearch=oSearchObject[sName].GetWidgetsBy(fnMethod,oScope);aResult.push.apply(aResult,aChildSearch)}}}return aResult}};var EventProvider=function(){};EventProvider.prototype={EventProviderDestruct:function(){if(!L.isUndefined(this.aEventListeners)){U.ForEach(this.aEventListeners,function(aELs){U.ForEach(aELs,function(oEventListener){try{oEventListener.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}})})}this.aEventListeners={};this.aEvents={}},AddEvent:function(EventNameOrFunction,aOn,oScope,iOrder,oObjectOverride){var elEvent=this.GetEventElement();if(!elEvent&&(L.isUndefined(this.HasChildWidgets)||!this.HasChildWidgets())){YAHOO.log("this.GetEventElement() is not valid, no child widgets and AddEvent is not overridden","error",this.sName+"#AddEvent");return undefined}if(L.isUndefined(oObjectOverride)){oObjectOverride=this}if(!(this instanceof ZC.Core.Form)&&!L.isUndefined(this.aChildWidgets)){U.ForEach(this.aChildWidgets,function(oWidget){oWidget.AddEvent(EventNameOrFunction,aOn,oScope,iOrder,oObjectOverride)},this)}if(!elEvent){return }if(L.isUndefined(iOrder)){if(L.isUndefined(this._iEventHandlerOrder)){this._iEventHandlerOrder=100}iOrder=this._iEventHandlerOrder++}if(!L.isArray(aOn)){aOn=[aOn]}U.ForEach(aOn,function(sEvent){var i,iMax,oEventDef,oCustomEvent;if(L.isUndefined(this.aEvents)){this.aEvents={}}if(L.isUndefined(this.aEvents[sEvent])){this.aEvents[sEvent]=[];this._WireUpEvent(sEvent)}oEventDef={Scope:oScope,ObjectOverride:oObjectOverride,Order:iOrder};if(typeof EventNameOrFunction=="function"){oEventDef.Func=EventNameOrFunction}else{if(EventNameOrFunction instanceof YAHOO.util.CustomEvent){oCustomEvent=EventNameOrFunction}else{EventNameOrFunction=this._InternalEventName(EventNameOrFunction);oCustomEvent=ZC.JSManager.GetEvent(EventNameOrFunction)}oEventDef.CustomEvent=oCustomEvent}for(i=0,iMax=this.aEvents.length;i<iMax;i++){if(U.ObjectsEqual(this.aEvents[i],oEventDef)){return }}this.aEvents[sEvent].push(oEventDef)},this)},AddEvents:function(aDef){U.ForEach(aDef,function(aOn,sEventName){this.AddEvent(sEventName,aOn)},this)},_WireUpEvent:function(sEvent){if(sEvent=="load"){ZC.JSManager.GetEvent("OnLoadEvent").subscribe(function(oEvent){this._EventDispatcher("load",oEvent)},this,true)}else{if(!Evt.addListener(this.GetEventElement(),sEvent,function(oEvent){this._EventDispatcher(sEvent,oEvent)},this,true)){YAHOO.log("addListener returned false for "+sEvent,"warn",this.sName+"._WireUpEvent")}}},_EventDispatcher:function(){var aArgs=[],sEvent=arguments[0],i,iMax;for(i=1,iMax=arguments.length;i<iMax;i++){aArgs.push(arguments[i])}if(L.isUndefined(this.aEvents[sEvent])){return }this.aEvents[sEvent].sort(function(a,b){return(a.Order-b.Order)});U.ForEach(this.aEvents[sEvent],function(oEventDef){var aThisArgs=[];if(oEventDef.Func){[].push.apply(aThisArgs,aArgs);aThisArgs.push(this);oEventDef.Func.apply(oEventDef.Scope,aThisArgs)}else{aThisArgs.push(oEventDef.ObjectOverride);[].push.apply(aThisArgs,aArgs);aThisArgs.push(this);oEventDef.CustomEvent.fire.apply(oEventDef.CustomEvent,aThisArgs)}},this)},_SubscribeEventHandler:function(sType,aArgs,oObj){var fnEventHandler=aArgs[0],aEHArgs=[oObj,aArgs[1]],oOverride=aArgs[2];if(oOverride===true){oOverride=aArgs[1]}fnEventHandler.call(oOverride,oEvent.type,aEHArgs)},AddEventListener:function(sEventName,aDef){sEventName=this._InternalEventName(sEventName);var oEvent=ZC.JSManager.GetEvent(sEventName),i,iMax,oEL,fnEventListenerConstructor=ZC.JSManager.GetComponent(aDef.EventListenerType,aDef.Module||"Core","EventListener");YAHOO.log("Adding event listener for "+sEventName+" ("+this._InternalEventName(sEventName)+") to "+this.sName,"debug","AddEventListener");if(fnEventListenerConstructor){if(L.isUndefined(this.aEventListeners)){this.aEventListeners={}}if(L.isUndefined(this.aEventListeners[sEventName])){this.aEventListeners[sEventName]=[]}else{for(i=0,iMax=this.aEventListeners[sEventName].length;i<iMax;++i){if(U.ObjectsEqual(this.aEventListeners[sEventName][i].aDef,aDef)){YAHOO.log("Listener already exists, not adding another.","debug","AddEventListener");return this.aEventListeners[sEventName][i]}}}oEL=new fnEventListenerConstructor(this,oEvent,aDef);this.aEventListeners[sEventName].push(oEL);return oEL}else{throw new Error("Unable to load event listener: "+(aDef.Module||"Core")+"/"+aDef.EventListenerType)}},AddEventListeners:function(aDef){U.ForEach(aDef,function(aELDefs,sEventName){U.ForEach(aELDefs,function(aELDef){try{this.AddEventListener(sEventName,aELDef)}catch(ex){YAHOO.log("Unable to add event listener "+aELDef.EventListenerType+" for event "+sEventName+" to "+this.sName+": "+ex.message+" ("+ex.fileName+":"+ex.lineNumber+")","error",this.sName)}},this)},this)},_InternalEventName:function(sEventName){if(this instanceof ZC.Core.Block){return sEventName.replace("BLOCK",this.UniqueID())}if(this instanceof ZC.Core.Widget){var oBlock=this.FindContainingBlock();return sEventName.replace("WIDGET",this._WidgetNameToID()).replace("FORM",this.oForm?this.oForm.sName:"NoForm").replace("BLOCK",oBlock?oBlock.sName:"NoBlock")}},_FireEventHandlers:function(sEvent){var elEvent=this.GetEventElement(),oDOMEvent,aHandlers,aEventArgs=[],i,iMax;if(L.isArray(elEvent)){elEvent=elEvent[0]}aHandlers=Evt.getListeners(elEvent,sEvent);if(aHandlers){for(i=1,iMax=arguments.length;i<iMax;i++){aEventArgs.push(arguments[i])}if(aEventArgs.length&&!L.isUndefined(aEventArgs[0].clientY)){oDOMEvent=aEventArgs.shift()}U.ForEach(aHandlers,function(aHandler){var oScope=aHandler.scope,fnHandler=aHandler.fn,oArg=aHandler.obj||oScope,mEvent=oDOMEvent||aHandler.type;fnHandler.call(oScope,mEvent,oArg,aEventArgs)})}}};ZC.Namespace("Core");ZC.JSManager={aClientSideObjects:{},aEvents:{},aForms:{},aBlocks:{},aValidators:{},aFormValidators:{},Init:function(oConfig,bIframeInit){Dom.addClass(document.documentElement,"yui-pe");if(document.compatMode=="CSS1Compat"){Dom.addClass(document.documentElement,"docmode-standard")}else{Dom.addClass(document.documentElement,"docmode-quirks")}this.oConfig=oConfig;if(this.oConfig.DEBUG){Evt.throwErrors=true;if(YAHOO.widget.Logger){if(window.console&&console.log){YAHOO.widget.Logger.enableBrowserConsole()}else{Evt.onDOMReady(function(){var myContainer=document.createElement("div");document.body.appendChild(myContainer);this.oYUILogReader=new YAHOO.widget.LogReader(myContainer,{width:"800px"})},null,this)}}}Evt.onDOMReady(function(){Dom.addClass(document.body,"yui-skin-sam");this.oOverlayManager=new YAHOO.widget.OverlayManager();if(!L.isUndefined(this.oConfig.ClientSideObjects)){U.ForEach(this.oConfig.ClientSideObjects,function(aDef,sName){var fnConstructor=ZC.JSManager.GetComponent(aDef.Type,aDef.Module||"Core","ClientSideObject");if(fnConstructor){this.aClientSideObjects[sName]=new fnConstructor(aDef)}},this)}if(!L.isUndefined(this.oConfig.Blocks)){U.ForEach(this.oConfig.Blocks,function(aDef,sName){this.aBlocks[sName]=ZC.Core.Block.NewFromDef(sName,aDef)},this)}if(!L.isUndefined(this.oConfig.Forms)){U.ForEach(this.oConfig.Forms,function(aDef,sName){this.RegisterForm(new ZC.Core.Form(sName,aDef,this))},this)}var oInitEvent=this.GetEvent("ManagerInit");oInitEvent.fireOnce=true;oInitEvent.subscribe(function(){this.AutoTooltips()},this,true);oInitEvent.subscribe(this._AutoPopups,this,true);oInitEvent.fire();var oAfterInitEvent=this.GetEvent("AfterManagerInit");oAfterInitEvent.fireOnce=true;oAfterInitEvent.fire();this.GetEvent("OnLoadEvent").fire();if(YAHOO.env.ua.ie){document.body.style.display="none";document.body.style.display=""}Dom.removeClass(document.documentElement,"yui-pe")},null,this);Evt.on(window,"unload",function(){U.ForEach(this.aBlocks,function(oBlock){try{oBlock.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}});U.ForEach(this.aClientSideObjects,function(oCSO){try{oCSO.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}});if(this.oOverlayManager){var aOverlays=this.oOverlayManager.cfg.getProperty("overlays");if(aOverlays){U.ForEach(aOverlays,function(oOverlay){oOverlay.destroy();oOverlay=null});aOverlays=null}this.oOverlayManager=null}this.aClientSideObjects={};this.aEvents={};this.aForms={};this.aBlocks={};this.aValidators={};this.aFormValidators={};this.oAutoTooltips=null;this.oYUILogReader=null;ZC.JSManager=null;ZC=null},this,true)},AutoTooltips:function(elScan){var aTooltips,oTTCfg,aContext;if(YAHOO.env.getVersion("container")){aTooltips=Dom.getElementsByClassName("tooltip",undefined,elScan);if(aTooltips.length){if(L.isUndefined(this.oAutoTooltips)){oTTCfg={context:aTooltips,autofillheight:false,autodismissdelay:120000,zIndex:45};if(!L.isUndefined(YAHOO.util.Anim)){oTTCfg.effect={effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}}this.oAutoTooltips=new YAHOO.widget.Tooltip("zcb_auto_tt",oTTCfg);this.oOverlayManager.register(this.oAutoTooltips);this.oAutoTooltips.beforeShowEvent.subscribe(function(){this.oOverlayManager.bringToTop(this.oAutoTooltips)},this,true)}else{aContext=this.oAutoTooltips.cfg.getProperty("context");aContext.push.apply(aContext,aTooltips);this.oAutoTooltips.cfg.setProperty("context",aContext)}}}},_AutoPopups:function(){var fnOpenPopup=function(elLink,sURL,iWidth,iHeight){var sOptions="status=1, resizable=1, scrollbars=yes";if(!L.isUndefined(iWidth)){sOptions+=", width = "+iWidth}if(!L.isUndefined(iHeight)){sOptions+=", height = "+iHeight}window.open(sURL,"_blank",sOptions)};var aPopups=Dom.getElementsByClassName("popup");if(aPopups.length){Evt.on("click",function(oEvent){var elLink=Evt.getTarget(oEvent);var aMatches=elLink.className.match(/(w(\d+))?(h(\d+))?/);var iWidth=aMatches[2];var iHeight=aMatches[4];fnOpenPopup(elLink,elLink.href,iWidth,iHeight)})}},RegisterForm:function(oForm){this.aForms[oForm.sName]=oForm;U.ForEach(oForm.aChildWidgets,function(oWidget){oWidget.oForm=oForm})},GetComponent:function(sCmpName,sModule,sType){var sFirstPart,sSecondPart,iFirstPos,iSecondPos,aTry=[],i,iMax;if(L.isUndefined(sCmpName)){return false}iFirstPos=sCmpName.indexOf("_");if(iFirstPos!=-1){sFirstPart=sCmpName.substring(0,iFirstPos)}iSecondPos=sCmpName.indexOf("_",iFirstPos+1);if(iSecondPos!=-1){sSecondPart=sCmpName.substring(iFirstPos+1,iSecondPos)}if(sFirstPart&&sSecondPart){aTry.push([sFirstPart,sSecondPart,sCmpName.substring(iSecondPos+1)])}if(sFirstPart){aTry.push([sModule||"Core",sFirstPart,sCmpName.substring(iFirstPos+1)]);aTry.push([sFirstPart,sCmpName.substring(iFirstPos+1),undefined])}aTry.push([sModule||"Core",sType,sCmpName]);for(i=0,iMax=aTry.length;i<iMax;i++){var sM=aTry[i][0];var sT=aTry[i][1];var sST=aTry[i][2];if(L.isUndefined(ZC[sM])){continue}if(L.isUndefined(ZC[sM][sT])){continue}if(L.isUndefined(sST)){return ZC[sM][sT]}if(L.isUndefined(ZC[sM][sT][sST])){continue}return ZC[sM][sT][sST]}YAHOO.log("Unable to load component ("+[sCmpName,sModule,sType].join(", ")+")","warn","ZC.JSManager#GetComponent");return undefined},LoadYUILib:function(oConfig){var oYUILoader=this.GetCSO("YUILoader"),fnConstructor;if(L.isUndefined(oYUILoader)){fnConstructor=ZC.JSManager.GetComponent("YUILoader","Core","ClientSideObject");if(!fnConstructor){YAHOO.log("Unable to locate YUILoader CSO","error","ZC.JSManager");return false}this.aClientSideObjects.YUILoader=new fnConstructor(aDef)}oYUILoader.LoadYUILib(oConfig)},GetBlockByUniqueID:function(sUniqueID){for(var sName in this.aBlocks){if(L.hasOwnProperty(this.aBlocks,sName)){if(this.aBlocks[sName].UniqueID()==sUniqueID){return this.aBlocks[sName]}var oChildBlock=this.aBlocks[sName].GetBlockByUniqueID(sUniqueID);if(oChildBlock){return oChildBlock}}}return undefined},GetBlocksBy:function(fnMethod,mRoot,oScope){var aBlocks=[],aRoot=false;if(!L.isUndefined(mRoot)){if(L.isString(mRoot)){mRoot=this.GetBlockByUniqueID(mRoot)}if(L.isObject(mRoot)){aRoot=mRoot.aChildBlocks}}else{aRoot=this.aBlocks}if(!aRoot){return[]}ZC.Util.ForEach(aRoot,function(oBlock){if(fnMethod.call(oScope,oBlock)){aBlocks.push(oBlock)}aBlocks=aBlocks.concat(ZC.JSManager.GetBlocksBy(fnMethod,oBlock,oScope))});return aBlocks},_aSearchObjects:["aForms","aBlocks"],GetCSO:function(sSearch){return this.aClientSideObjects[sSearch]},GetEvent:function(sName){if(L.isUndefined(this.aEvents[sName])){this.aEvents[sName]=new YAHOO.util.CustomEvent(sName)}return this.aEvents[sName]},GetValidator:function(sName){if(L.isUndefined(this.oValidatorRegex)){this.oValidatorRegex=/^(.*)_Validator_(.*)$/}return this._GetValidator(sName,this.aValidators,this.oValidatorRegex)},GetFormValidator:function(sName){if(L.isUndefined(this.oFormValidatorRegex)){this.oFormValidatorRegex=/^(.*)_FormValidator_(.*)$/}return this._GetValidator(sName,this.aFormValidators,this.oFormValidatorRegex)},_GetValidator:function(sName,aValidators,oValidatorRegex){if(!L.isUndefined(aValidators[sName])){return aValidators[sName]}var aMatches=oValidatorRegex.exec(sName);if(!aMatches){if(L.isUndefined(ZC.Core.Validator[sName])){return undefined}return(aValidators[sName]=new ZC.Core.Validator[sName]())}else{if(L.isUndefined(ZC[aMatches[1]])||L.isUndefined(ZC[aMatches[1]].Validator)||L.isUndefined(ZC[aMatches[1]].Validator[aMatches[2]])){return undefined}return(aValidators[sName]=new ZC[aMatches[1]].Validator[aMatches[2]]())}},URL:function(oParams,sURL){var iQSPos,fnURLArray,aParamParts;oParams=oParams||{};sURL=sURL||window.location.href.replace(/(\?|#).*/,"");if(L.isString(oParams)){oParams=this.ParseQueryString(oParams)}if(this.oConfig.StateID&&L.isUndefined(oParams._ts)){oParams._ts=this.oConfig.StateID}if(sURL.lastIndexOf("/")==(sURL.length-1)){sURL+="index"}iQSPos=sURL.indexOf("?");if(iQSPos>-1){oParams=L.merge(this.ParseQueryString(sURL.substr(iQSPos+1)),oParams);sURL=sURL.substr(0,iQSPos)}fnEncodeURLParams=function(mVar,sArg){if(mVar.length==0){return""}var aParamParts=[];U.ForEach(mVar,function(Value,Key){if(L.isObject(Value)&&Value.GetValue){Value=Value.GetValue()}var sQSVar=(sArg?sArg+"["+Key+"]":Key);if(L.isArray(Value)||L.isObject(Value)){aParamParts.push(fnEncodeURLParams(Value,sQSVar))}else{aParamParts.push(encodeURIComponent(sQSVar)+"="+encodeURIComponent(Value))}});return aParamParts.join("&")};sURL=sURL+"?"+fnEncodeURLParams(oParams);return sURL},ParseQueryString:function(sParamString){var aTmpParams=sParamString.split(/&/),oParams={};U.ForEach(aTmpParams,function(sParamPair){var aPair=U.Map(sParamPair.split(/=/,2),decodeURIComponent);if(!aPair[0].length||!L.isUndefined(oParams[aPair[0]])){return }oParams[aPair[0]]=aPair[1]||""});return oParams},Alert:U.Alert,CreateDialog:function(sCaption,elBody,elContainer,oConfig){var elDialogContainer=document.createElement("div"),elDialogHeader=document.createElement("div"),elDialogBody=document.createElement("div"),oDialog,fnConstructor;if(!elContainer.appendChild){throw new Error("Invalid elContainer: "+L.dump(elContainer))}elDialogHeader.className="hd";elDialogHeader.innerHTML=sCaption;elDialogBody.className="bd clearfix";if(L.isString(elBody)){elDialogBody.innerHTML=elBody}else{elDialogBody.appendChild(elBody)}elDialogContainer.appendChild(elDialogHeader);elDialogContainer.appendChild(elDialogBody);(elContainer||document.body).appendChild(elDialogContainer);oConfig=L.merge({close:true,draggable:true,visible:false},(oConfig||{}));if(L.isUndefined(oConfig.effect)&&YAHOO.env.getVersion("animation")){oConfig.effect={effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}}fnConstructor=YAHOO.widget.Panel;if(!L.isUndefined(oConfig.buttons)){fnConstructor=YAHOO.widget.Dialog}oDialog=new fnConstructor(elDialogContainer,oConfig);Dom.addClass(oDialog.element,YAHOO.widget.Dialog.CSS_DIALOG);Dom.addClass(oDialog.element,YAHOO.widget.Overlay.CSS_HIDDEN);this.oOverlayManager.register(oDialog);oDialog.render();oDialog.hide();return oDialog},DestroyDialog:function(oDialog){if(oDialog&&oDialog.element){this.oOverlayManager.remove(oDialog);oDialog.destroy()}}};L.augmentObject(ZC.JSManager,GetWidgetProvider.prototype);ZC.Core.Block=function(sName,aDef,oParent){this.sName=("_blk_name" in aDef)?aDef._blk_name:sName;this.aDef=aDef;this.oParent=oParent;this.aChildBlocks={};this.aWidgets={};this.aForms={};if(!this.CustomSetupStart()){throw new Error("CustomSetupStart returned false")}this.ProcessConfig(aDef,true);if(!this.CustomSetupEnd()){try{this.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}throw new Error("CustomSetupEnd returned false")}this.AttribProviderSetup()};ZC.Core.Block.NewFromDef=function(sName,aDef,oParent){var fnConstructor;if(!L.isUndefined(aDef.Type)){fnConstructor=ZC.JSManager.GetComponent(aDef.Type,aDef.Module||"Core","Block")}if(L.isUndefined(fnConstructor)){fnConstructor=ZC.Core.Block}return new fnConstructor(sName,aDef,oParent)};ZC.Core.Block.Create=function(sBlockClassName,sModule,oParentClass,sType){sModule=sModule||"Core";oParentClass=oParentClass||ZC.Core.Block;sType=sType||"Block";var oNS=ZC.Namespace(sModule+"."+sType);oNS[sBlockClassName]=function(sName,aDef,oForm,oParent){oNS[sBlockClassName].superclass.constructor.call(this,sName,aDef,oForm,oParent)};L.extend(oNS[sBlockClassName],oParentClass);return oNS[sBlockClassName]};ZC.Core.Block.prototype={CustomSetupStart:function(){return true},ProcessConfig:function(aDef,bConstructor){if(!L.isUndefined(aDef.Blocks)){YAHOO.log("Started initialising child blocks","debug",this.sName);U.ForEach(aDef.Blocks,function(aBlockDef,sBlockName){if(L.isUndefined(this.aChildBlocks[sBlockName])||!Dom.inDocument(this.aChildBlocks[sBlockName].GetElement())){if(!L.isUndefined(this.aChildBlocks[sBlockName])){try{this.aChildBlocks[sBlockName].Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}this.aChildBlocks[sBlockName]=null;delete this.aChildBlocks[sBlockName]}try{this.AddChildBlock(sBlockName,aBlockDef)}catch(ex){YAHOO.log("Unable to add block "+sBlockName+" to "+this.sName+": "+ex.message+" ("+ex.fileName+":"+ex.lineNumber+")","error",this.sName)}}else{this.aChildBlocks[sBlockName].ProcessConfig(aBlockDef)}},this);YAHOO.log("Finished initialising child blocks","debug",this.sName);delete aDef.Blocks}if(!L.isUndefined(aDef.Widgets)){YAHOO.log("Started initialising widgets","debug",this.sName);U.ForEach(aDef.Widgets,function(aWidgetDef,sWidgetName){if(L.isUndefined(this.aWidgets[sWidgetName])||!Dom.inDocument(this.aWidgets[sWidgetName]._elInput)){if(!L.isUndefined(this.aWidgets[sWidgetName])){try{this.aWidgets[sWidgetName].Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}this.aWidgets[sWidgetName]=null;delete this.aWidgets[sWidgetName]}try{this.aWidgets[sWidgetName]=ZC.Core.Widget.NewFromDef(sWidgetName,aWidgetDef,undefined,this)}catch(ex){YAHOO.log("Unable to add widget "+sWidgetName+" to "+this.sName+": "+ex.message+" ("+ex.fileName+":"+ex.lineNumber+")","error",this.sName)}}else{this.aWidgets[sWidgetName].ProcessConfig(aWidgetDef)}},this);YAHOO.log("Finished initialising widgets","debug",this.sName);delete aDef.Widgets}if(!L.isUndefined(aDef.Forms)){YAHOO.log("Started initialising forms","debug",this.sName);U.ForEach(aDef.Forms,function(aFormDef,sFormName){if(L.isUndefined(this.aForms[sFormName])||!this.aForms[sFormName]||!Dom.inDocument(this.aForms[sFormName]._elInput)){if(!L.isUndefined(this.aForms[sFormName])&&this.aForms[sFormName]){try{this.aForms[sFormName].Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}this.aForms[sFormName]=null;delete this.aForms[sFormName]}try{this.aForms[sFormName]=new ZC.Core.Form(sFormName,aFormDef,this);ZC.JSManager.RegisterForm(this.aForms[sFormName])}catch(ex){YAHOO.log("Unable to add form "+sFormName+" to "+this.sName+": "+ex.message+" ("+ex.fileName+":"+ex.lineNumber+")","error",this.sName)}}else{this.aForms[sFormName].ProcessConfig(aFormDef)}},this);YAHOO.log("Finished initialising forms","debug",this.sName);delete aDef.Forms}if(!L.isUndefined(aDef.EventListeners)){this.AddEventListeners(aDef.EventListeners);delete aDef.EventListeners}if(!L.isUndefined(aDef.Events)){this.AddEvents(aDef.Events);delete aDef.Events}if(!bConstructor){this.SetAttribs(aDef)}},AddChildBlock:function(sBlockName,aBlockDef){return(this.aChildBlocks[sBlockName]=ZC.Core.Block.NewFromDef(sBlockName,aBlockDef,this))},CustomSetupEnd:function(){return true},Destruct:function(){this.EventProviderDestruct();U.ForEach(this.aChildBlocks,function(oBlock){try{oBlock.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}});U.ForEach(this.aWidgets,function(oWidget){try{oWidget.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}});U.ForEach(this.aForms,function(oForm){try{oForm.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}});if(!L.isUndefined(this._ajaxDialog)){ZC.JSManager.DestroyDialog(this._ajaxDialog);this._ajaxDialog=undefined}this.oParent=null;this.aChildBlocks={};this.aWidgets={};this.aForms={};this.elBlock=null},_IDPrefix:"blk",GetElement:function(){if(L.isUndefined(this.elBlock)){this.elBlock=Dom.get(this._IDPrefix+this.UniqueID())}return this.elBlock},GetEventElement:function(){return this.GetElement()},UniqueID:function(){if(this.AttribIsset("BlockID")){return this.GetAttrib("BlockID").toString()}else{if(this.oParent){return this.oParent.UniqueID()+"_"+this.sName}else{return this.sName}}},GetBlockByUniqueID:function(sUniqueID){for(var sName in this.aChildBlocks){if(L.hasOwnProperty(this.aChildBlocks,sName)){if(this.aChildBlocks[sName].UniqueID()==sUniqueID){return this.aChildBlocks[sName]}var oChildBlock=this.aChildBlocks[sName].GetBlockByUniqueID(sUniqueID);if(oChildBlock){return oChildBlock}}}return undefined},AjaxRequest:function(oParams){var fnRequestSuccess,sServerError="",fnFormatErrors=function(oErr){sServerError+=oErr.Message;if(oErr.Backtrace){sServerError+=oErr.Backtrace}sServerError+="<br><br>"};if(L.isUndefined(oParams)){oParams={}}if(L.isString(oParams)){oParams={Transaction:oParams}}if(L.isUndefined(oParams.OnComplete)){oParams.OnComplete=function(){}}if(L.isUndefined(oParams.OnSuccess)){oParams.OnSuccess=function(){}}if(L.isUndefined(oParams.Scope)){oParams.Scope=this}if(L.isUndefined(oParams.LoadingIndicator)){oParams.LoadingIndicator=U.DefaultLoadingIndicator}if(L.isUndefined(oParams.OnFailure)){if(ZC.JSManager.oConfig.DEBUG){oParams.OnFailure=function(iCode,sStatus,oResp){if(iCode!=-2&&oResp&&oResp.responseText){try{oJSONResponse=YAHOO.lang.JSON.parse(oResp.responseText);if(oJSONResponse.Errors){U.ForEach(oJSONResponse.Errors,fnFormatErrors)}}catch(e){}}else{if(iCode==-2){sServerError=oResp.responseText}}U.Alert("AJAX processing error: "+iCode+" "+sStatus+"<br>"+sServerError+"<br>"+(oResp?oResp.responseXML:""),{width:"800px"})}}else{oParams.OnFailure=function(){}}}fnRequestSuccess=function(oResp){var Get=YAHOO.util.Get,oParams=oResp.argument,sResponseText,oJSONResponse,oOnLoadEvent=ZC.JSManager.GetEvent("OnLoadEvent"),fnLoadJS,fnLoadCSS,fnProcessBlocks;oOnLoadEvent.unsubscribeAll();fnLoadJS=function(){YAHOO.log("Loading JS..","debug","AjaxRequest");var aJS=U.Filter(oJSONResponse.LoadJS,function(sJS){if(!sJS.match(/^https?:\/\//)){sJS=window.location.protocol+"//"+window.location.hostname+sJS}return L.isArray(Dom.getElementBy(function(el){return(el.src==sJS)},"script",document.getElementsByTagName("head")[0]))});Get.script(aJS,{onSuccess:fnLoadCSS,onFailure:function(o){oParams.LoadingIndicator.Hide();oParams.OnComplete.call(oParams.Scope,oResp);oParams.OnFailure.call(oParams.Scope,-4,"JS loading error: "+o.msg,oResp)},scope:this})};fnLoadCSS=function(){YAHOO.log("Loading CSS..","debug","AjaxRequest");U.ForEach(oJSONResponse.LoadCSSMedia,function(sMedia,iIndex){var aCSS,elHead,oGetDef={attributes:{media:sMedia},onFailure:function(o){oParams.LoadingIndicator.Hide();oParams.OnComplete.call(oParams.Scope,oResp);oParams.OnFailure.call(oParams.Scope,-5,"CSS loading error: "+o.msg,oResp)},scope:this};if(iIndex==(oJSONResponse.LoadCSSMedia.length-1)){oGetDef.onSuccess=fnProcessBlocks}elHead=document.getElementsByTagName("head")[0];aCSS=U.Filter(oJSONResponse.LoadCSS[sMedia],function(sCSS){var iLen=sCSS.length;return L.isArray(Dom.getElementBy(function(el){var iLen2=el.href.length;if(iLen2<iLen){return false}return(el.href.substr(iLen2-iLen)==sCSS)},"link",elHead))});elHead=null;Get.css(aCSS,oGetDef)},this)};fnProcessBlocks=function(){YAHOO.log("Processing block updates","debug","AjaxRequest");var oFinishEvent=new YAHOO.util.CustomEvent(),oFinishTimer;oFinishEvent._updateAnimDone=true;U.ForEach(oJSONResponse.Blocks,function(aBlockData,sBlockUID){YAHOO.log("Processing updates for "+sBlockUID,"debug","AjaxRequest");var oBlock;if(L.isFunction(this.UniqueID)&&sBlockUID==this.UniqueID()){oBlock=this}else{oBlock=ZC.JSManager.GetBlockByUniqueID(sBlockUID)}if(oBlock){oBlock.ProcessAjaxResponse(aBlockData,oParams.CustomObj,oFinishEvent)}else{YAHOO.log("Unable to find block with ID "+sBlockUID,"error","ProcessAjaxResponse")}},this);oFinishTimer=L.later(100,this,function(){if(oFinishEvent._updateAnimDone){oFinishEvent.fire();oOnLoadEvent.fire();oParams.LoadingIndicator.Hide();oParams.OnComplete.call(oParams.Scope);oParams.OnSuccess.call(oParams.Scope);oFinishTimer.cancel()}},{},true)};try{YAHOO.log("Parsing JSON response","debug","AjaxRequest");oJSONResponse=YAHOO.lang.JSON.parse(oResp.responseText);YAHOO.log("Parsed OK","debug","AjaxRequest")}catch(e){oParams.LoadingIndicator.Hide();oParams.OnComplete.call(oParams.Scope,oResp);oParams.OnFailure.call(oParams.Scope,-2,"JSON parse error",oResp);return }if(oJSONResponse.GoToPage){YAHOO.log("Redirecting to "+oJSONResponse.GoToPage,"debug","AjaxRequest");window.location=oJSONResponse.GoToPage;return }if(ZC.JSManager.oConfig.DEBUG&&oJSONResponse.Errors){U.ForEach(oJSONResponse.Errors,fnFormatErrors);U.Alert(sServerError,{width:"800px"})}ZC.JSManager.LoadYUILib({require:U.Filter(oJSONResponse.LoadYUI,function(sReq){return(YAHOO.env.getVersion(sReq)==null)}),onSuccess:fnLoadJS,onFailure:function(o){oParams.LoadingIndicator.Hide();oParams.OnComplete.call(oParams.Scope,oResp);oParams.OnFailure.call(oParams.Scope,-3,"YUI loading error: "+o.msg,oResp)},scope:this})};oParams.LoadingIndicator.Show();ZC.JSManager.LoadYUILib({require:["connection","json"],scope:this,onFailure:function(o){U.Alert(o.msg)},onSuccess:function(){var Connect=YAHOO.util.Connect,bUseFileUpload,bSecure,aListeners,oGetPostVars=oParams.GetPostVars||{},oCallback={scope:this,argument:oParams,failure:function(o){oParams.LoadingIndicator.Hide();oParams.OnComplete.call(oParams.Scope,o);oParams.OnFailure.call(oParams.Scope,o.status,o.statusText,o)},upload:function(o){var b=o.responseXML.body;o.responseText=(b.textContent||b.innerText);fnRequestSuccess.call(this,o)},success:fnRequestSuccess};
/*@cc_on
					Connect.initHeader("X-IE-Version", YAHOO.env.ua.ie);
				@*/
if(L.isString(oGetPostVars)){oGetPostVars=ZC.JSManager.ParseQueryString(oGetPostVars)}if(!L.isUndefined(oParams.Form)){bUseFileUpload=(oParams.Form.enctype=="multipart/form-data");bSecure=(bUseFileUpload&&YAHOO.env.ua.ie&&window.location.protocol.toLowerCase()=="https:");Connect.setForm(oParams.Form,bUseFileUpload,bSecure);oParams.URL=oParams.URL||oParams.Form.action;oParams.Method=oParams.Method||oParams.Form.method}if(oParams.Transaction){oGetPostVars._ajaxTr=oParams.Transaction}if(oParams.Poll){oGetPostVars._ajaxPoll=1}else{oGetPostVars._ajaxBlk=this.UniqueID()}Connect.asyncRequest(oParams.Method||"POST",ZC.JSManager.URL(oGetPostVars,(oParams.URL||window.location.href.replace(/#.*$/,""))),oCallback)}})},AjaxPoll:function(){this.AjaxRequest({Poll:true})},ProcessAjaxResponse:function(oResponse,oCustom,oFinishEvent){U.ForEach(oResponse,function(oData,sAction){switch(sAction){case"UpdateElement":U.ForEach(oData,function(oContent,sID){oFinishEvent._updateAnimDone=false;oContent.OnComplete=function(){oFinishEvent._updateAnimDone=true};U.UpdateElement(sID,oContent)});break;case"Alert":U.Alert(oData.Message,oData);break;case"Dialog":if(!L.isUndefined(this._ajaxDialog)){ZC.JSManager.DestroyDialog(this._ajaxDialog)}this._ajaxDialog=ZC.JSManager.CreateDialog(oData.Header,oData.Body,document.body,oData);this._ajaxDialog.setFooter(oData.Footer);this._ajaxDialog.show();var aForms=this._ajaxDialog.element.getElementsByTagName("form");if(aForms){U.ForEach(aForms,function(elForm){elForm._ajaxDialog=this._ajaxDialog},this)}break;case"ProcessConfig":oFinishEvent.subscribe(function(){this.ProcessConfig(oData)},this,true);break;case"ScheduleRequest":if(L.isUndefined(this._aScheduledRequests)){this._aScheduledRequests=[]}U.ForEach(oData,function(mRequest){if(!U.Some(this._aScheduledRequests,function(o){return U.ObjectsEqual(o,mRequest)})){this._aScheduledRequests.push(mRequest)}},this);if(L.isUndefined(this._oScheduledRequestTimer)){this._oScheduledRequestTimer=oFinishEvent.subscribe(this._RunScheduledRequests,this,true)}break;case"FireEvent":U.ForEach(oData,function(aParamObjects,sEventName){var oEvent=ZC.JSManager.GetEvent(sEventName);U.ForEach(aParamObjects,oEvent.fire,oEvent)});break}},this)},_RunScheduledRequests:function(){var mRequest;while(mRequest=this._aScheduledRequests.shift()){this.AjaxRequest(mRequest)}this._oScheduledRequestTimer=undefined},_aSearchObjects:["aWidgets","aChildBlocks","aForms"]};L.augment(ZC.Core.Block,AttribProvider);L.augment(ZC.Core.Block,GetWidgetProvider);L.augment(ZC.Core.Block,EventProvider);ZC.Core.Layout=function(sName,aDef,oParent){ZC.Core.Layout.superclass.constructor.call(this,sName,aDef,oParent)};L.extend(ZC.Core.Layout,ZC.Core.Block);ZC.Core.Page=function(sName,aDef,oParent){ZC.Core.Page.superclass.constructor.call(this,sName,aDef,oParent)};L.extend(ZC.Core.Page,ZC.Core.Block);ZC.Core.Widget=function(sName,aDef,oForm,oParent){this.sName=sName;this.aDef=aDef;this.oParent=oParent;this.oForm=oForm;this.aChildWidgets={};this._FindElements();if(!this.CustomSetupStart()){throw new Error("CustomSetupStart returned false")}this.ProcessConfig(this.aDef,true);if(!L.isUndefined(aDef.ValidateOnEvents)){this.AddEvent(this.Validate,aDef.ValidateOnEvents,this)}if(!this.CustomSetupEnd()){throw new Error("CustomSetupEnd returned false")}this.AttribProviderSetup()};ZC.Core.Widget.Create=function(sWidgetClassName,sModule,oParentClass){sModule=sModule||"Core";oParentClass=oParentClass||ZC.Core.Widget;var oNS=ZC.Namespace(sModule+".Widget");oNS[sWidgetClassName]=function(){oNS[sWidgetClassName].superclass.constructor.apply(this,arguments)};L.extend(oNS[sWidgetClassName],oParentClass);return oNS[sWidgetClassName]};ZC.Core.Widget.NewFromDef=function(sName,aDef,oForm,oParent){var fnConstructor=ZC.JSManager.GetComponent(aDef.WidgetType||aDef.Type,aDef.Module,"Widget");if(L.isUndefined(fnConstructor)){fnConstructor=ZC.Core.Widget}return new fnConstructor(sName,aDef,oForm,oParent)};ZC.Core.Widget.prototype={CustomSetupStart:function(){return true},ProcessConfig:function(aDef,bConstructor){if(!L.isUndefined(aDef.Widgets)){U.ForEach(aDef.Widgets,function(aWidgetDef,sWidgetName){if(L.isUndefined(this.aChildWidgets[sWidgetName])||!Dom.inDocument(this.aChildWidgets[sWidgetName]._elInput)){if(!L.isUndefined(this.aChildWidgets[sWidgetName])){try{this.aChildWidgets[sWidgetName].Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}this.aChildWidgets[sWidgetName]=null;delete this.aChildWidgets[sWidgetName]}try{this.AddChildWidget(sWidgetName,aWidgetDef)}catch(ex){YAHOO.log("Unable to add widget "+sWidgetName+" to "+this.sName+": "+ex.message+" ("+ex.fileName+":"+ex.lineNumber+")","error",this.sName)}}else{this.aChildWidgets[sWidgetName].ProcessConfig(aWidgetDef)}},this);delete aDef.Widgets}if((!this._elInput||(L.isArray(this._elInput)&&this._elInput.length==0))&&!this.HasChildWidgets()){throw new Error("No input element or child widgets")}if(!L.isUndefined(aDef.EventListeners)){this.AddEventListeners(aDef.EventListeners);delete aDef.EventListeners}if(L.isUndefined(aDef.Validation)){aDef.Validation={}}else{if(L.isString(aDef.Validation)){var sValidator=aDef.Validation;aDef.Validation={};aDef.Validation[sValidator]=null}else{var oNumberRegex=/^\d+$/;U.ForEach(aDef.Validation,function(sValidator,Key,aValidation){if(oNumberRegex.test(Key)){aValidation[sValidator]=null;delete aValidation[Key]}})}}this.aDef.Validation=L.merge(this.aDef.Validation||{},aDef.Validation);if(!L.isUndefined(aDef.Events)){this.AddEvents(aDef.Events);delete aDef.Events}},CustomSetupEnd:function(){return true},Destruct:function(){U.ForEach(this.aChildWidgets,function(oWidget){try{oWidget.Destruct()}catch(e){YAHOO.log("Error during destruction: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}});this.EventProviderDestruct();this.oParent=null;this.oForm=null;this.aChildWidgets={};this._elInput=null;this.elContainer=null;this.elValidationContainer=null;this.elRODisplay=null},ID:function(){var aArgs=arguments;var sID="";if(!L.isUndefined(this.aDef.ID)){sID=this.aDef.ID}else{if(!L.isUndefined(this.oForm)){sID+=this.oForm.sName+"."}if(this.AttribIsset("HTMLNamePrefix")){sID+=this.GetAttrib("HTMLNamePrefix")}sID+=this.sName}if(!L.isUndefined(aArgs[0])){sID+=aArgs[0]}return sID.replace(/[ ,()/]/g,"")},_WidgetNameToID:function(){var aArgs=arguments;if(!L.isUndefined(aArgs[0])){return this.ID(aArgs[0])}else{return this.ID()}},_FindElements:function(){var sID=this._WidgetNameToID();this._elInput=Dom.get(sID);if(this._elInput){this._FindContainers()}},bChangeRODisplay:true,_FindContainers:function(){var elInput;if(L.isArray(this._elInput)){if(this._elInput.length&&this._elInput[0]){elInput=this._elInput[0]}else{return }}else{if(this._elInput){elInput=this._elInput}else{return }}if(this.oParent&&this.oParent instanceof ZC.Core.Widget.Group&&this.oParent._elInput){this.elContainer=this.oParent._elInput}else{this.elContainer=Dom.getAncestorByClassName(elInput,"form_field")||Dom.get("tr_"+elInput.id)||elInput.parentNode}if(this.elContainer){if(L.isUndefined(this.elContainer._zcRefCount)){this.elContainer._zcRefCount=1}else{++this.elContainer._zcRefCount}var aValContainers=Dom.getElementsByClassName("form_validation",null,this.elContainer);if(!aValContainers.length){aValContainers=Dom.getElementsByClassName("validation",null,this.elContainer)}if(aValContainers.length){this.elValidationContainer=aValContainers[0]}else{if(!this.aDef.NoCreateValidation){this.elValidationContainer=document.createElement("span");this.elValidationContainer.className="form_validation hide";elInput.parentNode.appendChild(this.elValidationContainer)}}}this.elRODisplay=Dom.get(elInput.id+"_rodisplay");if(this.elRODisplay&&this.bChangeRODisplay){this.AddEvent(function(){this.elRODisplay.innerHTML=this.GetHTMLValue()},"change",this)}},GetValue:function(){if(!this._elInput||L.isUndefined(this._elInput.value)){return undefined}return this._elInput.value},HasValue:function(){var mValue=this.GetValue();if(L.isString(mValue)){mValue=mValue.replace(/(^\s*|\s*$)/g,"")}else{if(mValue===0){return true}}return Boolean(mValue)},SetValue:function(Value){if(!this._elInput||L.isUndefined(this._elInput.value)){return undefined}if(Value==this._elInput.value){return }this._elInput.value=Value;this._bIsValid=undefined;this._FireEventHandlers("change")},GetTextValue:function(){return this.GetValue()},GetHTMLValue:function(){return this.GetTextValue()},GetCaption:function(){if(this.aDef.Caption){return this.aDef.Caption}if(this._elInput){var elLabel=this.GetLabelEl();return L.isUndefined(elLabel)?undefined:(elLabel.innerText||elLabel.textContent)}return undefined},GetLabelEl:function(){var sInputId;if(this._elInput&&(sInputId=this._elInput.id)){return Dom.getElementBy(function(el){return Dom.getAttribute(el,"for")==sInputId},"label")}return undefined},IsReadOnly:function(){return(this.GetAttribDefault("DisplayAs","").toLowerCase()=="readonly")},Clear:function(){if(!this._elInput&&!this.HasChildWidgets()){return }if(this._elInput&&this._elInput.type){var sInputType=L.isArray(this._elInput)?"array":this._elInput.type.toLowerCase();if(sInputType!="button"&&sInputType!="submit"){this.SetValue("")}}U.ForEach(this.aChildWidgets,function(oWidget){oWidget.Clear()})},Enable:function(bEnable,sEnableClass,sDisableClass){if(!this._elInput&&!this.HasChildWidgets()){return undefined}if(L.isUndefined(bEnable)){bEnable=true}if(this._elInput){Dom.batch(this._elInput,function(el){if(L.isUndefined(el.parentNode)||!el.parentNode){return }if(L.isUndefined(el.parentNode.tagName)||!el.parentNode.tagName){return }if(!bEnable){el.blur()}el.disabled=!bEnable})}var sAddClass=bEnable?sEnableClass:sDisableClass;var sRemoveClass=bEnable?sDisableClass:sEnableClass;this.ReplaceClass(sRemoveClass,sAddClass)},Disable:function(sEnableClass,sDisableClass){this.Enable(false,sEnableClass,sDisableClass)},AttribMethod_Disabled:function(bValue){this.Enable(!bValue)},Show:function(bShow){if(L.isUndefined(bShow)){bShow=true}if(bShow){Dom.removeClass(this.elContainer,"hide");if(this.GetAttribDefault("Overlabel")){this._ShowOverlabel(this.GetValue()==="")}}else{Dom.batch(this.elContainer,function(el){el.blur();Dom.addClass(el,"hide")});this._ShowOverlabel(false)}U.ForEach(this.aChildWidgets,function(oWidget){oWidget.Show(bShow)})},Hide:function(){this.Show(false)},AttribMethod_Overlabel:function(bEnabled){var elLabel,bShow;if(bEnabled){if(this._elInput&&!L.isArray(this._elInput)&&(elLabel=this.GetLabelEl())){Dom.addClass(elLabel,"zcOverlabel");this._ShowOverlabel(this.GetValue()===""&&this.IsVisible());this.AddEvent(function(){this._ShowOverlabel(false)},"focus",this);this.AddEvent(function(){if(this.GetValue()===""){this._ShowOverlabel(true)}},"blur",this);if(YAHOO.env.ua.webkit){Evt.on(elLabel,"click",function(){this.focus()},this._elInput,true)}}else{this.SetAttrib("Overlabel",false)}}else{Dom.removeClass(elLabel,"zcOverlabel");Dom.setStyle(elLabel,"text-indent","0px")}},_ShowOverlabel:function(bShow){var elLabel=this.GetLabelEl(),oRegion,aXY;if(L.isUndefined(bShow)){bShow=true}if(bShow){oRegion=Dom.getRegion(this._elInput);aXY=[oRegion.x+5,oRegion.y];if(!YAHOO.env.ua.ie){aXY[1]+=5}Dom.setXY(elLabel,aXY)}Dom.setStyle(elLabel,"text-indent",(bShow)?"0px":"-4000px")},IsVisible:function(){return !(Dom.hasClass(this._elInput,"hide")||Dom.hasClass(this.elContainer,"hide"))},AddClass:function(sClassName){if(this.elContainer._zcRefCount==1){Dom.addClass(this.elContainer,sClassName)}if(this._elInput){Dom.addClass(this._elInput,sClassName)}},RemoveClass:function(sClassName){if(this.elContainer._zcRefCount==1){Dom.removeClass(this.elContainer,sClassName)}if(this._elInput){Dom.removeClass(this._elInput,sClassName)}},ReplaceClass:function(sOldClass,sNewClass){if(sNewClass){if(this.elContainer._zcRefCount==1){Dom.replaceClass(this.elContainer,sOldClass,sNewClass)}if(this._elInput){Dom.replaceClass(this._elInput,sOldClass,sNewClass)}}else{if(this.elContainer._zcRefCount==1){Dom.removeClass(this.elContainer,sOldClass)}if(this._elInput){Dom.removeClass(this._elInput,sOldClass)}}},Validate:function(){for(var sName in this.aDef.Validation){if(L.hasOwnProperty(this.aDef.Validation,sName)){var oValidator=ZC.JSManager.GetValidator(sName);if(!L.isUndefined(oValidator)&&!oValidator.Validate(this.GetValue(),this)){this.SetValid(false,this.aDef.Validation[sName]||oValidator.GetDefaultValidationMsg());return false}}}try{var bValid=true;U.ForEach(this.aChildWidgets,function(oWidget){if(!oWidget.GetAttribDefault("SkipValidation")){bValid=oWidget.Validate()&&bValid}});this.SetValid(bValid);return bValid}catch(e){YAHOO.log("Error during validation: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName)}},IsValid:function(){if(L.isUndefined(this._bIsValid)){return this.Validate()}return this._bIsValid},SetValid:function(bIsValid,sValMsg){var sOldClass,sNewClass,elValMsg;this._bIsValid=bIsValid;this.sValidationMessage=sValMsg;if(L.isUndefined(this.aDef.ShowValidationStatus)||this.aDef.ShowValidationStatus){if(this.elContainer){var sOldClass=bIsValid?"invalid":"valid";var sNewClass=bIsValid?"valid":"invalid";Dom.replaceClass(this.elContainer,sOldClass,sNewClass)}if(this.elValidationContainer){if(!bIsValid&&sValMsg){elValMsg=document.createTextNode(sValMsg);if(this.elValidationContainer.firstChild){this.elValidationContainer.replaceChild(elValMsg,this.elValidationContainer.firstChild)}else{this.elValidationContainer.appendChild(elValMsg)}Dom.removeClass(this.elValidationContainer,"hide")}else{Dom.addClass(this.elValidationContainer,"hide")}}}},GetValidationMsg:function(){return this.sValidationMessage},GetEventElement:function(){return this._elInput},AddChildWidget:function(sName,aDef){this.aChildWidgets[sName]=ZC.Core.Widget.NewFromDef(sName,aDef,this.oForm,this)},RemoveChildWidget:function(sName){this.aChildWidgets[sName].Destruct();delete (this.aChildWidgets[sName])},HasChildWidgets:function(){for(var sName in this.aChildWidgets){if(L.hasOwnProperty(this.aChildWidgets,sName)){return true}}return false},FindContainingBlock:function(){if(this.oParent instanceof ZC.Core.Block){return this.oParent}else{if(!L.isUndefined(this.oForm)){return this.oForm.FindContainingBlock()}else{if(!L.isUndefined(this.oParent)){return this.oParent.FindContainingBlock()}else{return undefined}}}},HasValidator:function(sName){return !L.isUndefined((this.GetAttribDefault("Validation",{}))[sName])},_aSearchObjects:["aChildWidgets"]};L.augment(ZC.Core.Widget,AttribProvider);L.augment(ZC.Core.Widget,GetWidgetProvider);L.augment(ZC.Core.Widget,EventProvider);ZC.Core.Form=function(sName,aDef,oParent){if(L.isUndefined(aDef.ShowValidationStatus)){aDef.ShowValidationStatus=false}ZC.Core.Form.superclass.constructor.call(this,sName,aDef,this,oParent);var fnSubmitHandler=function(oEvent){var oSelectedEndWidget=this.GetSelectedEndWidget();if(this.GetAttribDefault("ValidateOnSubmit")&&(!oSelectedEndWidget||!oSelectedEndWidget.GetAttribDefault("SkipValidation"))&&!this.IsValid()){this.SetSelectedEndWidget(undefined);Evt.stopEvent(oEvent);ZC.JSManager.Alert(_GT("There are still some errors on the form. Please check and re-submit."));return false}if(this.GetAttribDefault("SubmitWithAJAX")){Evt.preventDefault(oEvent);L.later(0,this,"AjaxSubmit");this.SetAttrib("SubmitWithAJAX",false)}return true};this.AddEvent(fnSubmitHandler,"submit",this,500)};L.extend(ZC.Core.Form,ZC.Core.Widget);ZC.Core.Form.prototype.Destruct=function(){this.CloseAjaxDialog();ZC.Core.Form.superclass.Destruct.apply(this,arguments)};ZC.Core.Form.prototype.CloseAjaxDialog=function(){if(this._elInput&&this._elInput._ajaxDialog){ZC.JSManager.DestroyDialog(this._elInput._ajaxDialog);this._elInput._ajaxDialog=null}};ZC.Core.Form.prototype._WidgetNameToID=function(){return this.aDef.ID||this.sName};ZC.Core.Form.prototype.Enable=function(){var aArgs=arguments;U.ForEach(this.aChildWidgets,function(oWidget){oWidget.Enable.apply(oWidget,aArgs)})};ZC.Core.Form.prototype.Clear=function(){var aArgs=arguments;U.ForEach(this.aChildWidgets,function(oWidget){oWidget.Clear.apply(oWidget,aArgs)})};ZC.Core.Form.prototype.IsValid=function(){return this.Validate()};ZC.Core.Form.prototype.Validate=function(){try{var aValidation=this.GetAttribDefault("FormValidation",{}),bValid=true,sValidationMessage;U.ForEach(aValidation,function(oFormValParams,sName){var oValidator=ZC.JSManager.GetFormValidator(sName);if(!L.isUndefined(oValidator)&&!oValidator.Validate(oFormValParams,this)){bValid=false;sValidationMessage=this.GetAttribDefault("FormValidationMsg",oValidator.GetDefaultValidationMsg())}},this);U.ForEach(this.aChildWidgets,function(oWidget){if(oWidget.GetAttribDefault("__IsField",true)){bValid=oWidget.Validate()&&bValid}});this.SetValid(bValid,sValidationMessage);return bValid}catch(e){YAHOO.log("Error during validation: "+e.message+" ("+e.fileName+":"+e.lineNumber+")","warn",this.sName);return false}};ZC.Core.Form.prototype.AjaxSubmit=function(){if(!this.oParent||!this.oParent.AjaxRequest){return }var fnAjaxReset=function(){this.SetAttrib("SubmitWithAJAX",true)};this.oParent.AjaxRequest({Form:this._elInput,OnComplete:fnAjaxReset,Scope:this});this.CloseAjaxDialog()};ZC.Core.Form.prototype.AddHiddenField=function(sName,mValue){var aResult=[],fnAddHidden=function(sName,sValue){var elHidden=document.createElement("input");elHidden.type="hidden";elHidden.name=sName;elHidden.value=sValue;this.appendChild(elHidden);return elHidden};if(L.isArray(mValue)||L.isObject(mValue)){U.ForEach(mValue,function(sVal,sKey){aResult.push(fnAddHidden.call(this,sName+"["+sKey+"]",sVal))},this._elInput);return aResult}else{return fnAddHidden.call(this._elInput,sName,String(mValue))}return undefined};ZC.Core.Form.prototype.SetSelectedEndWidget=function(oSelectedEndWidget){this.oSelectedEndWidget=oSelectedEndWidget};ZC.Core.Form.prototype.GetSelectedEndWidget=function(){return this.oSelectedEndWidget};ZC.Core.Form.prototype.FocusFirstElement=function(){var fnFilter=function(el){return el.tagName&&U.InArray(el.tagName.toLowerCase(),["input","select","textarea"])&&el.type!="hidden"&&!el.disabled};var aChildNodes=Dom.getElementsBy(fnFilter,false,this._elInput);if(aChildNodes.length==0){return }if(U.Some(aChildNodes,function(elNode){return(elNode.tabIndex&&elNode.tabIndex>0)})){var elLowestTabIndex;U.ForEach(aChildNodes,function(elNode){if(!elLowestTabIndex||elLowestTabIndex.tabIndex>elNode.tabIndex){elLowestTabIndex=elNode}});elLowestTabIndex.focus()}else{aChildNodes[0].focus()}};ZC.Core.Validator=function(){this.AttribProviderSetup()};ZC.Core.Validator.Create=function(sName,sModule){sModule=sModule||"Core";var oNS=ZC.Namespace(sModule+".Validator");oNS[sName]=function(){};L.extend(oNS[sName],ZC.Core.Validator);oNS[sName].sClassName=sModule+"_Validator_"+sName;return oNS[sName]};ZC.Core.Validator.prototype={GetDefaultValidationMsg:function(){return this.sDefaultValidationMessage||_GT("Invalid value")},Validate:function(Value,oWidget){if(L.isUndefined(this.oValidationRegex)){return undefined}if(Value instanceof Array){for(var Key in Value){if(L.hasOwnProperty(Value,Key)&&!this.oValidationRegex.test(Value[Key])){return false}}return true}else{return this.oValidationRegex.test(Value)}}};L.augment(ZC.Core.Validator,AttribProvider);ZC.Core.EventListener=function(oDestination,oEvent,aDef){this.oDestination=oDestination;this.oDestWidget=this.oDestination;this.oEvent=oEvent;this.aDef=aDef;if(this.Setup()){oEvent.subscribe(this._EventHandler,this,this)}else{throw new Error("Setup returned false")}this.AttribProviderSetup()};ZC.Core.EventListener.Create=function(sName,sModule){sModule=sModule||"Core";var oNS=ZC.Namespace(sModule+".EventListener");oNS[sName]=function(oDestination,oEvent,aDef){oNS[sName].superclass.constructor.call(this,oDestination,oEvent,aDef)};L.extend(oNS[sName],ZC.Core.EventListener);return oNS[sName]};ZC.Core.EventListener.prototype={Setup:function(){return true},Destruct:function(){YAHOO.log("destructing eventlistener for "+(this.oEvent?this.oEvent.type:"(null event)")+" on "+(this.oDestination?this.oDestination.sName:"(null destination)"),"debug","EventListener::Destruct");if(this.oEvent){this.oEvent.unsubscribe(this._EventHandler,this)}this.sDestName=this.oDestination.sName;this.oDestination=null;this.oDestWidget=null;this.oEvent=null},_EventHandler:function(sEventName,aArgs){var oEvent=ZC.JSManager.GetEvent(sEventName),oWidget=aArgs[0],oSrcEvent=aArgs[1];if(this.oDestination&&this.oEvent){this.HandleEvent(oWidget,oEvent,oSrcEvent)}},_SearchLists:function(Value,sEqualsAttrib,sNotEqualsAttrib,sContainsAttrib,sNotContainsAttrib){var aVal,i,iMax,j,jMax,bResult=false,aContains,aNotContains,fnCompare=function(Value,CompareValues,bReturnIfMatch){if(L.isArray(CompareValues)){for(var mVal in CompareValues){if(L.hasOwnProperty(CompareValues,mVal)&&U.ObjectsEqual(Value,CompareValues[mVal])){return bReturnIfMatch}}return !bReturnIfMatch}else{return U.ObjectsEqual(Value,CompareValues)?bReturnIfMatch:!bReturnIfMatch}};if(this.AttribIsset(sEqualsAttrib)){bResult=fnCompare(Value,this.GetAttrib(sEqualsAttrib),true)}if(this.AttribIsset(sNotEqualsAttrib)){bResult=bResult||fnCompare(Value,this.GetAttrib(sNotEqualsAttrib),false)}if((this.AttribIsset(sContainsAttrib)||this.AttribIsset(sNotContainsAttrib))&&(L.isArray(Value)||L.isObject(Value))){aContains=this.GetAttribDefault(sContainsAttrib,[]);aNotContains=this.GetAttribDefault(sNotContainsAttrib,[]);if(!L.isArray(aContains)){aContains=[aContains]}if(!L.isArray(aNotContains)){aNotContains=[aNotContains]}if(L.isObject(Value)){aVal=[];U.ForEach(Value,function(o){aVal.push(o)})}else{aVal=Value}for(i=0,iMax=aVal.length;i<iMax;++i){for(j=0,jMax=aContains.length;j<jMax;++j){if(U.ObjectsEqual(aVal[i],aContains[j])){bResult=true;break}}for(j=0,jMax=aNotContains.length;j<jMax;++j){if(U.ObjectsEqual(aVal[i],aNotContains[j])){bResult=false;break}}}}return bResult},_GetWidgetValue:function(oWidget){return(oWidget[this.GetAttribDefault("GetValueMethod","GetValue")])()},HandleEvent:function(oWidget,oEvent,oSrcEvent){throw new Error("EventListener::HandleEvent is abstract and must be overridden")}};L.augment(ZC.Core.EventListener,AttribProvider);ZC.Core.ClientSideObject=function(aDef){this.aDef=aDef;this.Setup();this.AttribProviderSetup()};ZC.Core.ClientSideObject.Create=function(sName,sModule){sModule=sModule||"Core";var oNS=ZC.Namespace(sModule+".ClientSideObject");oNS[sName]=function(aDef){oNS[sName].superclass.constructor.call(this,aDef)};L.extend(oNS[sName],ZC.Core.ClientSideObject);return oNS[sName]};ZC.Core.ClientSideObject.prototype={Setup:function(){},Destruct:function(){}};L.augment(ZC.Core.ClientSideObject,AttribProvider)})();function showelementsofclass(A,B,C){root=document.getElementById(C);if(C&&root){classitems=YAHOO.util.Dom.getElementsByClassName(B,A,root)}else{classitems=YAHOO.util.Dom.getElementsByClassName(B,A)}for(i=0;i<classitems.length;i++){if(A.toLowerCase()=="tr"&&navigator.appName!="Microsoft Internet Explorer"){classitems[i].style.display="table-row"}else{if(A.toLowerCase()=="span"){classitems[i].style.display="inline"}else{classitems[i].style.display="block"}}}}function hideelementsofclass(A,B,C){root=document.getElementById(C);if(C&&root){classitems=YAHOO.util.Dom.getElementsByClassName(B,A,root)}else{classitems=YAHOO.util.Dom.getElementsByClassName(B,A)}for(i=0;i<classitems.length;i++){classitems[i].style.display="none"}}function showelementwithid(A){element=document.getElementById(A);if(element==null){return }type=element.tagName;if(type.toLowerCase()=="tr"&&navigator.appName!="Microsoft Internet Explorer"){element.style.display="table-row"}else{element.style.display="block"}}function hideelementwithid(A){element=document.getElementById(A);if(element!=undefined){element.style.display="none"}}function toggleelementwithid(A){element=document.getElementById(A);if(element!=undefined){if(element.style.display=="none"){showelementwithid(A)}else{hideelementwithid(A)}}}function toggledivbyclass(A){classitems=YAHOO.util.Dom.getElementsByClassName(A,"div");for(i=0;i<classitems.length;i++){if(classitems[i].style.display!="none"){classitems[i].style.display="none"}else{classitems[i].style.display="block"}}}var timeout=Array;function displaydiv(A){document.getElementById(A).style.display="block";window.clearTimeout(timeout[A]);timeout[A]=window.setTimeout("hidediv('"+A+"');",10000)}function displaydivinline(A){document.getElementById(A).style.display="inline";window.clearTimeout(timeout[A]);timeout[A]=window.setTimeout("hidediv('"+A+"');",10000)}function displayspan(A){document.getElementById(A).style.display="inline";window.clearTimeout(timeout[A]);timeout[A]=window.setTimeout("hidediv('"+A+"');",10000)}function hidediv(A){window.clearTimeout(timeout[A]);timeout[A]=window.setTimeout("document.getElementById('"+A+"').style.display='none'",100)}function showdiv(A){document.getElementById(A).style.display="block"}function togglediv(A){if(document.getElementById(A).style.display!="none"){document.getElementById(A).style.display="none"}else{document.getElementById(A).style.display="block"}}function togglelabel(A,C,B){if(document.getElementById(A).innerHTML==C){document.getElementById(A).innerHTML=B}else{document.getElementById(A).innerHTML=C}}function toggledivandlabel(D,A,C,B){if(document.getElementById(D).style.display!="none"){document.getElementById(D).style.display="none";document.getElementById(A).innerHTML=B}else{document.getElementById(D).style.display="block";document.getElementById(A).innerHTML=C}}function nse(B,A){document.location="mailto:"+B+"@"+A}function highlight(B){var A=document.getElementById(B);if(!A){return }A.style.background="rgb(230,240,255)"}function nohighlight(B){var A=document.getElementById(B);if(!A){return }A.style.background="transparent"}function MM_swapImgRestore(){var C,A,B=document.MM_sr;for(C=0;B&&C<B.length&&(A=B[C])&&A.oSrc;C++){A.src=A.oSrc}}function MM_preloadImages(){var D=document;if(D.images){if(!D.MM_p){D.MM_p=new Array()}var C,B=D.MM_p.length,A=MM_preloadImages.arguments;for(C=0;C<A.length;C++){if(A[C].indexOf("#")!=0){D.MM_p[B]=new Image;D.MM_p[B++].src=A[C]}}}}function MM_findObj(E,D){var C,B,A;if(!D){D=document}if((C=E.indexOf("?"))>0&&parent.frames.length){D=parent.frames[E.substring(C+1)].document;E=E.substring(0,C)}if(!(A=D[E])&&D.all){A=D.all[E]}for(B=0;!A&&B<D.forms.length;B++){A=D.forms[B][E]}for(B=0;!A&&D.layers&&B<D.layers.length;B++){A=MM_findObj(E,D.layers[B].document)}if(!A&&document.getElementById){A=document.getElementById(E)}return A}function MM_swapImage(){var D,C=0,A,B=MM_swapImage.arguments;document.MM_sr=new Array;for(D=0;D<(B.length-2);D+=3){if((A=MM_findObj(B[D]))!=null){document.MM_sr[C++]=A;if(!A.oSrc){A.oSrc=A.src}A.src=B[D+2]}}}function ConfirmBlockDelete(){return confirm("This will delete the block AND ALL CHILD BLOCKS it may contain.")}function ConfirmFolderDelete(){return confirm("=== CAUTION ===\n\nThis will delete the folder and ALL PAGES AND SUBFOLDERS\nit may contain.")}function ConfirmPageDelete(){return confirm("This will delete the page and any contents.")}function ConfirmDelete(){return confirm("Are you sure you want to delete?")}function NotNull(A){if(document.getElementById(A).value==""){alert("You must put a reason for deleting the items.")}return document.getElementById(A).value!=""}function SelectDivFromDropDown(A){for(i=0;i<A.options.length;i++){if(A.options[i].value&&document.getElementById(A.options[i].value)){document.getElementById(A.options[i].value).style.display="none"}}if(document.getElementById(A.value)){document.getElementById(A.value).style.display="block"}}function LoadIframeFromForm(E,B,C,D){var E="";E=SendAsGetToURL(E,B)+D;var A=getIframeDocument("frame."+B);if(document.getElementById(C).style.display!="none"){document.getElementById(C).style.display="none"}else{document.getElementById(C).style.display="block";A.body.innerHTML="<p>Loading</p>";A.location.replace(E)}}function DocumentLocationFromFormField(sURLPrefix,sFormName,sFieldName,sExtraGetOptions){sURL=eval("document."+sFormName+"."+sFieldName+".value");if(sURL==""){return false}if(sURL[0]=="#"){document.location=sURL;return false}sURL=sURLPrefix+sURL;if(document.location.href.replace(/[#|\?].*$/,"")==sURL.replace(/[#|\?].*$/,"")){document.location="#"+sURL.replace(/^.*#/,"");return false}if(sExtraGetOptions){sURL+="?"+sExtraGetOptions}document.location=sURL;return false}function OpenWindowFromForm(B,A,C){B=SendAsGetToURL(B,A)+C;window.open(B,"","width=200,height=200,location=yes,scrollbars")}function SendAsGetToURL(sURL,sFormName){var sGetString="";if(FormCollection[sFormName]){for(sFieldName in FormCollection[sFormName]){if(eval("document."+sFormName+"."+sFieldName+".type")=="checkbox"){if(eval("document."+sFormName+"."+sFieldName+".checked")){sGetString+=sFieldName+"="+eval("document."+sFormName+"."+sFieldName+".checked")+"&"}}else{sGetString+=sFieldName+"="+eval("document."+sFormName+"."+sFieldName+".value")+"&"}}}return sURL+"?"+sGetString}function getIframeDocument(B){if(document.frames){return document.frames[B].document}var A=getid(B);if(A.contentDocument){return A.contentDocument}else{if(A.contentWindow){return A.contentWindow.document}else{if(A.document){return A.document}}}}function getid(A){if(document.getElementById){return document.getElementById(A)}else{if(document.all){return document.all(A)}}return false}function PleaseWait(A){A.value="PLEASE WAIT";A.style.color="red";A.onclick=function(){alert("Please Wait");return false};return false}function SendFormValue(A,C,B){document.location.replace(A+"?"+B+"="+C.value)}function setIDHTMLToVal(A,B){span=getElementById(B);if(span){span.innerHTML=this.value}}function docnoperm(A){alert(A);return false}function PutFormHere(A,B){var C;C=document.getElementById(A);if(C){B.appendChild(C)}}function SetHiddenValue(A,B,D){var C;C=document.getElementById(A);if(C&&C.elements[B]){C.elements[B].value=D}else{alert("could not find element "+B)}}function MoveCommentFormHere(A,B){oElement=document.getElementById(A);SetHiddenValue("FrmComment","parentcommentid",B);PutFormHere("FrmComment",oElement);return false}function ConfirmRecursiveCommentDelete(){return confirm("Are you sure you want to delete this comment\nincluding all those comments made upon it?")}function ConfirmArticleDelete(){return confirm("Are you sure you want to delete this item\nincluding all those comments made upon it?")}function SetupCommentReply(B,A){fromdiv=document.getElementById(B);todiv=document.getElementById("contextcomment");jumptothread_div=document.getElementById("jumptothread");title=document.getElementById("formtitle");link=document.getElementById("comment_"+A);link.href="javascript:void(0);";todiv.innerHTML=fromdiv.innerHTML;todiv.style.display="block";jumptothread_div.innerHTML='<a class="link" href="#anchor_comment_'+A+'">Jump to thread</a>';jumptothread_div.style.display="block";title.innerHTML="<strong>Reply to comment</strong>";document.forms.FrmComment.parentcommentid.value=A;ScrollToElement(todiv);return false}function ScrollToElement(C){var A=C.offsetTop;var B=C;while(B.offsetParent&&(B.offsetParent!=document.body)){B=B.offsetParent;A+=B.offsetTop}window.scrollTo(0,A)}function ScrollToID(A){var A=document.getElementById(A);ScrollToElement(A)}function SetupNewComment(){title=document.getElementById("formtitle");title.innerHTML="<strong>Add a comment</strong>";document.forms.FrmComment.parentcommentid.value="";todiv=document.getElementById("contextcomment");jumptothread_div=document.getElementById("jumptothread");todiv.innerHTML="";jumptothread_div.innerHTML="";return false}function showDebugWindow(){window.top.debugWindow=window.open("","Debug","left=0,top=0,width=300,height=700,scrollbars=yes,status=yes,resizable=yes");window.top.debugWindow.opener=self;window.top.debugWindow.document.open();window.top.debugWindow.document.write("<HTML><HEAD><TITLE>Debug Window</TITLE></HEAD><BODY><PRE>\n")}function debugToWindow(A){if(window.top.debugWindow&&!window.top.debugWindow.closed){window.top.debugWindow.document.write(A+"\n")}else{showDebugWindow();window.top.debugWindow.document.write(A+"\n")}}function _builddebugstr(B){var A="";for(x in B){if(typeof (x)=="object"){A+=_builddebugstr(B[x])}else{A+=x+": "+B[x]+"\n"}}return A}function debugObject(B){if(B==undefined){debugToWindow("undefined")}else{var A="";A=_builddebugstr(B);debugToWindow(A)}}function ClearForm(A){for(n=0;n<A.elements.length;n++){switch(A.elements[n].type){case"hidden":case"button":case"submit":break;case"text":case"textarea":case"password":case"fileupload":case"radio":A.elements[n].value="";break;case"checkbox":A.elements[n].checked=false;break;case"select-one":case"select-multiple":if(A.elements[n].options[0].value=="Any"||A.elements[n].options[0].value=="__Any__"||A.elements[n].options[0].value==""){A.elements[n].selectedIndex=0}break;default:}if(A.elements[n].onchange!=undefined){A.elements[n].onchange({target:A.elements[n]})}}}function SetInitialI18NWidget(){HideNonPreferredI18NWidgets();ShowPreferredI18NWidget()}function HideNonPreferredI18NWidgets(){for(sWidgetID in aI18NWidgets){for(sLangID in aLangs){oWidget=document.getElementById(aI18NWidgets[sWidgetID]+aLangs[sLangID]);if(oWidget){if(aLangs[sLangID]!=sPreferredLang){oWidget.style.display="none";oFlag=document.getElementById(aI18NWidgets[sWidgetID]+aLangs[sLangID]+"_img");oFlag.style.border="0px solid black"}}}}}function ShowPreferredI18NWidget(){for(sWidgetID in aI18NWidgets){for(sLangID in aLangs){oWidget=document.getElementById(aI18NWidgets[sWidgetID]+aLangs[sLangID]);if(oWidget){if(aLangs[sLangID]==sPreferredLang){oWidget.style.display="inline";oFlag=document.getElementById(aI18NWidgets[sWidgetID]+aLangs[sLangID]+"_img");oFlag.style.border="1px solid black"}}}}}function SetPreferredI18NWidget(A){sPreferredLang=A}function SwapI18NWidget(A){SetPreferredI18NWidget(A);HideNonPreferredI18NWidgets();ShowPreferredI18NWidget()}function ChangeI18NWidgetsFromCheckBox(A,B){if(B.checked){for(sWidgetID in aI18NWidgets){oWidget=document.getElementById(aI18NWidgets[sWidgetID]+A);oWidget.style.display="inline";oImage=document.getElementById(aI18NWidgets[sWidgetID]+A+"_img");oImage.style.display="inline"}}else{for(sWidgetID in aI18NWidgets){oWidget=document.getElementById(aI18NWidgets[sWidgetID]+A);oWidget.style.display="none";oImage=document.getElementById(aI18NWidgets[sWidgetID]+A+"_img");oImage.style.display="none"}}}function PreventI18NFlagJS(){var A="";for(sWidgetID in aI18NWidgets){for(sLangID in aLangs){oImage=document.getElementById(aI18NWidgets[sWidgetID]+aLangs[sLangID]+"_img");if(oImage){oImage.onclick=function(){};if(aLangs[sLangID]!=sPreferredLang){oImage.style.display="none"}}}}}function moveElementToElement(A,D){var E=document.getElementById(D);var C=findPosX(E);var B=findPosY(E);moveObject(A,C,B)}function moveObject(D,A,C){var B=getStyleObject(D);if(B){B.left=A;B.top=C;return true}else{return false}}var xOffset=30;var yOffset=-5;function showPopupDiv(B,E){if(window.currentPopupID){var F=getStyleObject(currentPopupID);if(F){F.visibility="hidden";window.currentPopupID=false}}if(E){var D=(E.pageX)?E.pageX+xOffset:E.x+xOffset+((document.body.scrollLeft)?document.body.scrollLeft:0);var C=(E.pageY)?E.pageY+yOffset:E.y+yOffset+((document.body.scrollTop)?document.body.scrollTop:0);moveObject(B,D,C);var A=getStyleObject(B);if(A){A.visibility="visible";window.currentPopupID=B}}}function hidePopupDiv(B){var A=getStyleObject(B);if(A){A.visibility="hidden";window.currentPopupID=false}}function hidePopupDivDelay(A){window.setTimeout("hidePopupDiv('"+A+"')",20)}function getStyleObject(A){if(document.getElementById&&document.getElementById(A)){return document.getElementById(A).style}else{if(document.all&&document.all(A)){return document.all(A).style}else{if(document.layers&&document.layers[A]){return document.layers[A]}else{return false}}}}function createRequestObject(){var B;var A=navigator.appName;if(A=="Microsoft Internet Explorer"){B=new ActiveXObject("Microsoft.XMLHTTP")}else{B=new XMLHttpRequest()}return B}var http=createRequestObject();var logIdToUpdate="";function sndMenuReq(A,B){sndReq(A,"div"+B.id)}function sndReq(B,A){http.open("get",B);http.onreadystatechange=handleResponse;http.send(null);logIdToUpdate=A;element=document.getElementById(logIdToUpdate);if(element&&element.innerHTML==""){element.innerHTML="<em>Loading...</em>"}}function handleResponse(){if(http.readyState==4){var A=http.responseText;element=document.getElementById(logIdToUpdate);if(element){element.innerHTML=A}}}function createCMSFolder(D){var B=new Date();var C="?aj=1&folder="+D+"&_tr=FrmMakeCMSFolder&_ts="+Math.round(B.getTime()/1000);var A=document.getElementById("Main");A.innerHTML="<em>Loading ...</em>";http.open("get",C);http.onreadystatechange=handleResponseCreateCMSFolder;http.send(null);logIdToUpdate="Main";element=document.getElementById(logIdToUpdate);if(element&&element.innerHTML==""){element.innerHTML="<em>Loading...</em>"}window.scrollTo(0,0)}function handleResponseCreateCMSFolder(){if(http.readyState==4){var response=http.responseXML.documentElement;var innerHTML="";var js="";var bGotJS;var items;element=document.getElementById(logIdToUpdate);items=response.getElementsByTagName("content");for(i=0;i<items.length;i++){if(items[i].childNodes.length>1){innerHTML+=items[i].childNodes[1].nodeValue}else{innerHTML+=items[i].firstChild.nodeValue}}if(element){element.innerHTML=innerHTML}bGotJS=false;items=response.getElementsByTagName("jscript");for(i=0;i<items.length;i++){bGotJS=true;if(items[i].childNodes.length>1){js+=items[i].childNodes[1].nodeValue}else{js+=items[i].firstChild.nodeValue}}eval(js)}}function createCMSPage(D){var B=new Date();var C="?aj=1&page="+D+"&_tr=FrmMakeCMSPage&_ts="+Math.round(B.getTime()/1000);var A=document.getElementById("Main");A.innerHTML="<em>Loading ...</em>";sndReq(C,"Main");window.scrollTo(0,0)}function displayMap(C){var A;var B;for(i=0;i<20;i++){B=document.getElementById("map_"+i);if(B){B.style.display="none"}}A=document.getElementById(C);if(A){A.style.display="block"}}function CharsRemaining(B){var A=parseInt(B.getAttribute("maxlength"),10);var C=B.value.length;return A-C}function CharsRemaining(B){var A=parseInt(B.getAttribute("maxlength"),10);var C=expandNewlines(B.value).length;return A-C}function expandNewlines(A){var B=A.replace(/\n/g,"\r\n").replace(/\r\r\n/g,"\r\n");return B}function isMaxLength(B){var A=B.getAttribute?parseInt(B.getAttribute("maxlength")):"";if(B.getAttribute&&B.value.length>A){B.value=B.value.substring(0,A)}}function IsNumeric(B){var D="0123456789.";var C=true;var A;for(i=0;i<B.length&&C==true;i++){A=B.charAt(i);if(D.indexOf(A)==-1){C=false}}return C}function findPosX(A){var B=0;if(A.offsetParent){while(1){B+=A.offsetLeft;if(!A.offsetParent){break}A=A.offsetParent}}else{if(A.x){B+=A.x}}return B}function findPosY(B){var A=0;if(B.offsetParent){while(1){A+=B.offsetTop;if(!B.offsetParent){break}B=B.offsetParent}}else{if(B.y){A+=B.y}}return A}function coordsInElement(A,C,B){e=document.getElementById(B);x1pos=findPosX(e);x2pos=x1pos+e.offsetWidth;y1pos=findPosY(e);y2pos=y1pos+e.offsetHeight;if(A>=x1pos&&A<=x2pos&&C>=y1pos&&C<=y2pos){return true}return false}function stopEventPropagation(A){if(A.stopPropagation){A.stopPropagation()}else{window.event.cancelBubble=true}}function parentNodeOfType(A,C){var B=A.parentNode;while(B.tagName.toLowerCase()!=C.toLowerCase()&&B.parentNode){B=B.parentNode}if(B.tagName.toLowerCase()==C.toLowerCase()){return B}return undefined}function eventTarget(A){if(!A){A=window.event}if(A.target){element=A.target}if(A.srcElement){element=A.srcElement}if(element.nodeType==3){element=element.parentNode}return element}function showNextTableRow(B){var A=eventTarget(B);if(A.tagName=="TR"){tr=A}else{tr=parentNodeOfType(A,"TR")}if(!tr){return }nextIndex=tr.rowIndex+1;nextTr=tr.parentNode.parentNode.rows[nextIndex];nextTr.style.display=""}function hideThisTableRow(A){thisElement=eventTarget(A);if(thisElement.tagName=="TR"){tr=thisElement}else{tr=parentNodeOfType(thisElement,"TR")}if(!tr){return }tr.style.display="none"}function hideNextTableRow(B){var A=eventTarget(B);if(A.tagName=="TR"){tr=A}else{tr=parentNodeOfType(A,"TR")}if(!tr){return }nextIndex=tr.rowIndex+1;nextTr=tr.parentNode.parentNode.rows[nextIndex];nextTr.style.display="none"}function hidePrevTableRow(B){var A=eventTarget(B);if(A.tagName=="TR"){tr=A}else{tr=parentNodeOfType(A,"TR")}if(!tr){return }prevIndex=tr.rowIndex-1;prevTr=tr.parentNode.parentNode.rows[prevIndex];prevTr.style.display="none"}function showPrevTableRow(B){var A=eventTarget(B);if(A.tagName=="TR"){tr=A}else{tr=parentNodeOfType(A,"TR")}if(!tr){return }prevIndex=tr.rowIndex-1;prevTr=tr.parentNode.parentNode.rows[prevIndex];prevTr.style.display=""}function addClass(A,B){if(!hasClass(A,B)){A.className+=(A.className?" ":"")+B;return true}return false}function hasClass(A,B){if(A.className==""){return false}return new RegExp("\\b"+B+"\\b").test(A.className)}function removeClass(A,B){if(hasClass(A,B)){A.className=A.className.replace(A.className.indexOf(" "+B)>=0?" "+B:B)}}(function(){var A=YAHOO.lang,C=ZC.Util,E=YAHOO.util.Dom,F=YAHOO.util.Event,B="yui-pe-content";var D=ZC.Core.Block.Create("Menu_Menu");D.prototype.CustomSetupEnd=function(){var H,I,G;H=this.GetElement();if(!H){return false}E.removeClass(H,B);G=new YAHOO.widget.MenuBar(H,{zindex:5});G.render();G.show();C.ForEach(G.getSubmenus(),function(J){J.cfg.setProperty("zindex",5)});this.oYUIMenuBar=G;I=E.getElementsByClassName("menulink","a");if(I.length){F.on(I,"click",function(L){var O=F.getTarget(L),K=G.getSubmenus(),N=O.href.replace(/.*#/,""),M,J;for(M=0,J=K.length;M<J;M++){if(K[M].id==N){K[M].show();K[M].parent.cfg.setProperty("selected",true);K[M].focus();F.stopEvent(L);return }}},this,true)}return true};D.prototype.Destruct=function(){D.superclass.Destruct.apply(this,arguments);if(this.oYUIMenuBar){this.oYUIMenuBar.body.innerHTML="";this.oYUIMenuBar=null}};D.prototype._IDPrefix="menu-";D=ZC.Core.Block.Create("Accordion","Core",undefined,"Layout");D.prototype.CustomSetupEnd=function(){var G=this.GetElement();if(!G){return false}E.removeClass(G,B);this.oYUIAccordionView=new YAHOO.widget.AccordionView(G,{animationSpeed:this.GetAttribDefault("AnimSpeed",0.5),collapsible:this.GetAttribDefault("Collapsible",true),expandable:this.GetAttribDefault("Multiple",false),width:this.GetAttribDefault("Width","100%")});this._aAccordionBlocks=this.GetAttribDefault("AccordionBlocks");if(this._aAccordionBlocks){this.oYUIAccordionView.on("panelOpen",function(H){var I=H.index;return this.LoadPanel(I,false,H.panel)},this,true);ZC.JSManager.GetEvent("AfterManagerInit").subscribe(function(){C.ForEach(this._aAccordionBlocks,function(J,I){var H;if(J.StartOpen){this.LoadPanel(I,false)}},this)},this,true)}return true};D.prototype.Destruct=function(){D.superclass.Destruct.apply(this,arguments);if(this.oYUIAccordionView){this.oYUIAccordionView.destruct();this.oYUIAccordionView=null}};D.prototype._IDPrefix="accordion-";D.prototype.LoadPanel=function(J,I,L){var G,O,M="zc-accordion-loading",N={Show:function(){E.addClass(L,M)},Hide:function(){E.removeClass(L,M)}};if(A.isUndefined(L)){G=E.get("accordion-"+this.UniqueID()+"--"+J);L=G.parentNode}else{G=L.lastChild}if(G&&!A.isUndefined(this._aAccordionBlocks[J])&&(I||!this._aAccordionBlocks[J].Loaded)){O=function(){this._aAccordionBlocks[J].Loaded=true;this._aAccordionBlocks[J].ForceReload=false;if(this.oYUIAccordionView){this.oYUIAccordionView.openPanel(J)}};if(this._aAccordionBlocks[J].ContentURL){var K={customevents:{onStart:N.Show,onComplete:N.Hide},success:function(P){G.innerHTML=P.responseText;O.call(this)},failure:function(){C.Alert(_GT("The server was unable to retreive the data, please try again."))},scope:this};YAHOO.util.Connect.asyncRequest("GET",this._aAccordionBlocks[J].ContentURL,K,null)}else{var H={panelid:J};if(I||this._aAccordionBlocks[J].ForceReload){H.reloadPanel=1}this.AjaxRequest({Transaction:"FetchBlockSection",GetPostVars:H,OnSuccess:O,LoadingIndicator:N})}return false}return true};D.prototype.ReloadPanels=function(G){if(A.isNumber(G)){G=[G]}else{if(!A.isArray(G)){G=C.Keys(this._aAccordionBlocks)}}C.ForEach(G,function(H){if(this.oYUIAccordionView.isPanelOpen(H)){this.LoadPanel(H,true)}else{this._aAccordionBlocks[H].Loaded=false;this._aAccordionBlocks[H].ForceReload=true}},this)};D.prototype.ProcessAjaxResponse=function(G,I,H){D.superclass.ProcessAjaxResponse.apply(this,arguments);C.ForEach(G,function(K,J){switch(J){case"ReloadPanels":this.ReloadPanels(K);break;case"SetInPage":this.SetInPage(K);break}},this)};D.prototype.SetInPage=function(G){C.ForEach(G,function(H){if(!A.isUndefined(this._aAccordionBlocks[H])){this._aAccordionBlocks[H].Loaded=true}},this)};D.prototype.AttribMethod_AccordionBlocks=function(I){if(I.length==0||A.isUndefined(I[0].Header)||this._bAttribProviderSetup){return }var H,G,J;for(H=0,G=I.length;H<G;++H){elPanel=this.oYUIAccordionView.getPanel(H);this.oYUIAccordionView.setPanelHeader(H,I[H].Header,I[H].HeaderClass)}};D=ZC.Core.Block.Create("TabView");D.prototype.CustomSetupEnd=function(){var T,S,K,N=this.GetAttribDefault("Orientation","top"),Q=false,H,I,R,L,V,J,U,M,W,P,O,G;T=this.GetElement();if(!T){YAHOO.log("unable to find element with ID "+(this._IDPrefix+this.UniqueID()),"debug","TabView");return false}if(N=="top+bottom"){Q=true;N="top"}this.oYUITabView=new YAHOO.widget.TabView(T,{orientation:N});this.oTabs={};this.aTabIndices=[];O=G=0;C.ForEach(this.GetAttribDefault("Tabs",[]),function(Z,Y){var X,a;if(Z.Selected){G=O}if(Z.AjaxURL){var X={label:Z.Caption,dataSrc:Z.AjaxURL,cacheData:(A.isUndefined(Z.CacheData)?true:Z.CacheData),active:(G==O)};a=new YAHOO.widget.Tab(X);this.oYUITabView.addTab(a,O)}else{a=this.oYUITabView.getTab(O)}this.oTabs[Y]=a;this.aTabIndices[O]=Y;O++},this);if(Q){I=this.oYUITabView.getElementsByClassName("yui-nav","ul")[0];R=this.oYUITabView.getElementsByClassName("yui-content")[0];if(I&&R){H=document.createElement("div");H.className="yui-navset-bottom";H.appendChild(I.cloneNode(true));E.insertAfter(H,R);L=function(X,Y){F.stopEvent(X);this.oYUITabView.set("activeIndex",Y)};C.ForEach(E.getChildren(H.firstChild),function(a,Z){var b,Y,X;b=this.oYUITabView.getTab(Z);F.on(a,"click",L,Z,this);Y=b.addClass;b.addClass=function(c){E.addClass(a,c);Y.apply(this,arguments)};X=b.removeClass;b.removeClass=function(c){E.removeClass(a,c);X.apply(this,arguments)}},this)}}K=E.getElementsByClassName("tabviewlink","a");if(K.length){F.on(K,"click",function(X){var Z=F.getTarget(X),Y=Z.href.replace(/.*#/,"");if(!A.isUndefined(this.oTabs[Y])){this.oYUITabView.set("activeTab",this.oTabs[Y]);F.stopEvent(X)}},this,true)}U=this.GetAttribDefault("StoreSelectedTab");if(U){J=YAHOO.util.Cookie;M=J.getSub("TabViewSelectedTab",U,Number);if(M){this.oYUITabView.set("activeIndex",M)}this.oYUITabView.on("activeIndexChange",function(X){var Y=new Date();Y.setUTCFullYear(Y.getUTCFullYear()+1);J.setSub("TabViewSelectedTab",U,this.oYUITabView.get("activeIndex"),{expires:Y})},this,true)}W=this.GetAttribDefault("ChangeTabEvent");if(W){P=ZC.JSManager.GetEvent(W)}V=function(X,Y){C.ForEach(S,function(b,Z){var a=b.get("element").className.split(/\s/);C.ForEach(a,function(c){if(c=="selected"){return }if(c.substr(c.length-9)=="-selected"&&Z!=X){b.removeClass(c)}else{if(Z==X){b.addClass(c+"-selected")}}})});if(P){P.fire(this.aTabIndices[X],this.aTabIndices[Y])}};this.oYUITabView.on("activeIndexChange",function(X){V.call(this,X.newValue,X.prevValue)},this,true);ZC.JSManager.GetEvent("ManagerInit").subscribe(function(){V.call(this,this.oYUITabView.get("activeIndex"))},this,true);return true};D.prototype.Destruct=function(){D.superclass.Destruct.apply(this,arguments);this.oYUITabView=null;this.oTabs=null};D.prototype._IDPrefix="tabview-";D.prototype.EnableTab=function(H,G){if(A.isUndefined(G)){G=true}if(!A.isUndefined(this.oTabs[H])){this.oTabs[H].set("disabled",!G)}};D.prototype.DisableTab=function(G){this.EnableTab(G,false)};D.prototype.AddTabClass=function(G,H){if(!A.isUndefined(this.oTabs[G])){this.oTabs[G].addClass(H)}};D.prototype.RemoveTabClass=function(G,H){if(!A.isUndefined(this.oTabs[G])){this.oTabs[G].removeClass(H)}};var D=ZC.Core.Block.Create("Recordset_Load_Search");D.prototype.CustomSetupEnd=function(){var H=E.get("list-inner-"+this.UniqueID()),G="dbad-list-loading",I=E.get("frmSorter.rstsortby"),J;if(!H){return true}J=function(L,M,K){F.stopEvent(L);this.AjaxRequest({Transaction:"SortOrPageChange",URL:M.href})};F.delegate(H,"click",J,".caption a, .pager a",this,true);if(I){I.onchange="";F.on(I,"change",function(){this.AjaxRequest({Transaction:"SortOrPageChange",GetPostVars:I.value})},this,true)}return true}})();(function(){var A=YAHOO.lang,F=ZC.Util.GetText,H=ZC.Util.sprintf;var E;E=ZC.Core.Validator.Create("AlphaNumericNoSpace");E.prototype.sDefaultValidationMessage=F("Only A-Z a-z 0-9 _ and - are valid (no spaces)");E.prototype.oValidationRegex=/^([A-Za-z0-9_-])*$/;E=ZC.Core.Validator.Create("AlphaNumericSpace");E.prototype.sDefaultValidationMessage=F("Only A-Z a-z 0-9 _ - and spaces are valid");E.prototype.oValidationRegex=/^([A-Za-z0-9_ -])*$/;E=ZC.Core.Validator.Create("ArrayElementCount");E.prototype.sDefaultValidationMessage=F("Please select the appropriate number of elements.");E.prototype.Validate=function(K,J){var L=J.aDef.MinArrayElements||0;var I=J.aDef.MaxArrayElements||0;var M;if(A.isArray(K)){M=K.length}else{if(A.isString(K)&&K.length){M=1}else{M=0}}if(M==0){return true}return(!((L&&M<L)||(I&&M>I)))};E=ZC.Core.Validator.Create("CompareTo");E.prototype.sDefaultValidationMessage=F("The selection in this field must be greater than the value of the other field.");E.prototype.Validate=function(K,J){if(A.isUndefined(J.aDef.GreaterThanField)&&A.isUndefined(J.aDef.LessThanField)){return true}var M=[];var L=true;if(J.aDef.GreaterThanField){var I=J.aDef.GreaterThanField;if(A.isString(I)){I=[I]}ZC.Util.ForEach(I,function(O){var N=ZC.JSManager.GetWidget(O);L=L&&(K>N.GetValue());M.push(H(F("greater than the value in %s"),N.GetCaption()))})}if(J.aDef.LessThanField){var I=J.aDef.LessThanField;if(A.isString(I)){I=[I]}ZC.Util.ForEach(I,function(O){var N=ZC.JSManager.GetWidget(O);L=L&&(K<N.GetValue());M.push(H(F("less than the value in %s"),oGreaterThanWidget.GetCaption()))})}this.sDefaultValidationMessage=H(F("The selection must be %s"),M.join(F(" and ")));return L};E=ZC.Core.Validator.Create("DomainName");E.prototype.sDefaultValidationMessage=F("Please enter a valid domain name; e.g. www.google.com:%");E.prototype.oValidationRegex=/^[0-9a-zA-Z._-]*$/;var D="[a-zA-Z\\d!#$%&'*+\\\\/=?^_`{|}~\\s-]+",B="['A-Za-z0-9_.-]+@(['A-Za-z0-9_-]+\\.['A-Za-z0-9_.-]+)",C="(("+D+")?\\s*<"+B+">|"+B+")?";E=ZC.Core.Validator.Create("EmailAddress");E.prototype.sDefaultValidationMessage=F("Please enter a valid e-mail address");E.prototype.oValidationRegex=new RegExp("^("+C+")?$");E=ZC.Core.Validator.Create("EmailAddresses");E.prototype.sDefaultValidationMessage=F("Please enter a valid e-mail address[es] (separated with commas)");E.prototype.oValidationRegex=new RegExp("^(("+C+"\\s*,\\s*)*"+C+")?$","m");E=ZC.Core.Validator.Create("EmailAddressesNewLineSeperated");E.prototype.sDefaultValidationMessage=F("Please enter a valid e-mail address[es] (one per line)");E.prototype.oValidationRegex=new RegExp("^(("+C+"\\s*\\n\\s*)*"+C+")?$","m");E=ZC.Core.Validator.Create("HTMLColour");E.prototype.sDefaultValidationMessage=F("Please enter a valid HTML colour");E.prototype.oValidationRegex=/^(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|#[0-9A-F]{6})?$/i;E=ZC.Core.Validator.Create("Hex6Digits");E.prototype.sDefaultValidationMessage=F("Please ensure the data is of the format ff00aa (6 digits from 0-9 plus a,b,c,d,e and f)");E.prototype.oValidationRegex=/^([0-9A-F]{6})?$/i;E=ZC.Core.Validator.Create("HexHTMLColour");E.prototype.sDefaultValidationMessage=F("Please ensure the data is of the format #ff00aa (a hash followed by 6 digits from 0-9 plus a,b,c,d,e and f)");E.prototype.oValidationRegex=/^(#[0-9A-F]{6})?$/i;E=ZC.Core.Validator.Create("IsFutureDate");E.prototype.sDefaultValidationMessage=F("Please enter a date in the future.");E.prototype.Validate=function(J,I){if(!J){return true}var K=new Date();if(I.aDef.AllowToday){K.setHours(0);K.setMinutes(0);K.setSeconds(0)}else{K.setHours(23);K.setMinutes(59);K.setSeconds(59)}return J>K};E=ZC.Core.Validator.Create("IsHumanAge");E.prototype.sDefaultValidationMessage=F("Please enter a whole number less than 100.");E.prototype.oValidationRegex=/^\d{0,2}$/;E=ZC.Core.Validator.Create("IsInteger");E.prototype.sDefaultValidationMessage=F("Please enter a whole number.");E.prototype.oValidationRegex=/^-?\d*$/;E=ZC.Core.Validator.Create("IsNaturalNumber");E.prototype.sDefaultValidationMessage=F("Please enter a whole number greater than zero.");E.prototype.oValidationRegex=/^(\d*[1-9]\d*)*$/;E=ZC.Core.Validator.Create("IsNonNegativeInteger");E.prototype.sDefaultValidationMessage=F("Please enter a whole non-negative number.");E.prototype.oValidationRegex=/^\d*$/;E=ZC.Core.Validator.Create("IsPositive");E.prototype.sDefaultValidationMessage=F("Please enter a positive number.");E.prototype.oValidationRegex=/^\d*([,.]\d+)?$/;E=ZC.Core.Validator.Create("IsYear");E.prototype.sDefaultValidationMessage=F("Please enter a 4 digit year.");E.prototype.Validate=function(L,J){if(L==""){return true}var M=L.match(/^\d{4}$/);var K=J.aDef.MaxYear;var I=J.aDef.MinYear;if(I&&K){this.sDefaultValidationMessage=H(F("Please enter a 4 digit year between %d and %d."),I,K);M=M&&(L>=I&&L<=K)}else{if(K){this.sDefaultValidationMessage=H(F("Please enter a 4 digit year before %d."),K);M=M&&(L<=K)}else{if(I){this.sDefaultValidationMessage=H(F("Please enter a 4 digit year after %d."),I);M=M&&(L>=I)}}}return M};E=ZC.Core.Validator.Create("MassMail_AutomaticRecipients");E.prototype.sDefaultValidationMessage=F("The option you have selected is invalid");E.prototype.Validate=function(K,J){var I=J.oForm.GetWidget("MaxRecipients");var M=J.oForm.GetWidget("Role");var L=J.oForm.GetWidget("PresetEmailAddresses");switch(K){case 1:if(I.GetValue()==-1){this.sDefaultValidationMessage=F("This option is not valid when there are no manual recipients");return false}break;case 2:if(M.GetValue()==""){M.SetValid(false,F("You must specify a role"));this.sDefaultValidationMessage=F("You must specify a role below");return false}break;case 3:if(L.GetValue()==""){I.SetValid(false,F("You must specify at least one email address"));this.sDefaultValidationMessage=F("You must specify at least one preset email address below");return false}break}return true};E=ZC.Core.Validator.Create("MaxDecimalPlaces");E.prototype.Validate=function(J,I){this.sDefaultValidationMessage=H(F("Please specify this value using no more than %d decimal places."),I.aDef.MaxDP);var K=new RegExp("^\\d*([,.]\\d{1,"+I.aDef.MaxDP+"})?$");return K.test(J)};E=ZC.Core.Validator.Create("MaxLength");E.prototype.Validate=function(J,I){var K=I.aDef.MaxLength;this.sDefaultValidationMessage=H(F("Please reduce this to %d  characters, it is currently at %d."),K,J.length);return(J.length<=K)};E=ZC.Core.Validator.Create("NotBlank");E.prototype.sDefaultValidationMessage=F("Please complete this.");E.prototype.Validate=function(J,I){return(J.length>0)};E=ZC.Core.Validator.Create("PositiveCurrency");E.prototype.sDefaultValidationMessage=F("Please enter a number with no more than two decimal places.");E.prototype.oValidationRegex=/^\d*([.,]\d{1,2})?$/;E=ZC.Core.Validator.Create("Regex_Multiline");E.prototype.sDefaultValidationMessage=F("One or more lines are in an invalid format");E.prototype.Validate=function(L,J){var M=J.aDef.Validator_Regex_Multiline;if(!M){return true}var K=new RegExp(M);var I=L.split(/\n/);return !ZC.Util.Some(I,function(N){N=N.replace(/(^\s*|\s$)/g,"");return(N.length&&!K.test(N))})};var G="[1-9]\\d{8,15}";E=ZC.Core.Validator.Create("SMSNumber");E.prototype.sDefaultValidationMessage=F("Please enter a valid international number including the country code.  UK mobile numbers start with 44 and omit the first 0.");E.prototype.oValidationRegex=new RegExp("^("+G+")?$");E=ZC.Core.Validator.Create("SMSNumbers");E.prototype.sDefaultValidationMessage=F("Please enter valid international numbers including the country code, separated by commas or newlines.");E.prototype.oValidationRegex=new RegExp("^("+G+"([,\\n]"+G+")*)?$");E=ZC.Core.Validator.Create("SelectMinMax");E.prototype.sDefaultValidationMessage=F("You must select at least 1 and no more than 3 counties");E.prototype.Validate=function(K,J){if(K instanceof Array){var L=J.aDef.SelectMin||0;var I=J.aDef.SelectMax||0;if(I>0){this.sDefaultValidationMessage=H(F("You must select at least %d and no more than %d."),L,I)}else{this.sDefaultValidationMessage=H(F("You must select at least %d."),L)}if(K.length>=L&&(I==0||K.length<=I)){return true}}return false};E=ZC.Core.Validator.Create("TelephoneNumber");E.prototype.sDefaultValidationMessage=F("Please enter a valid telephone number excluding the country code.");E.prototype.oValidationRegex=/^[^a-zA-Z]*$/;E=ZC.Core.Validator.Create("TwoTokensValidator");E.prototype.sDefaultValidationMessage=F("A maximum of two words is allowed");E.prototype.oValidationRegex=/^(\S+( \S+)?)?$/;E=ZC.Core.Validator.Create("URL");E.prototype.sDefaultValidationMessage=F("Please enter a valid URL beginning http://");E.prototype.oValidationRegex=/^(https?:\/\/\S+)?$/;E=ZC.Core.Validator.Create("WhiteSpaceSeparatedIntegers");E.prototype.sDefaultValidationMessage=F('Please enter one or more whole numbers separated by a space e.g. "1 2 3".');E.prototype.oValidationRegex=/^(\d+\s+)*$/})();(function(){var L=YAHOO.lang,Dom=YAHOO.util.Dom,Evt=YAHOO.util.Event,U=ZC.Util,_GT=U.GetText,JSManager=ZC.JSManager;var oEL;oEL=ZC.Core.EventListener.Create("Alert");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){if(this.AttribIsset("Message")){JSManager.Alert(this.GetAttrib("Message"))}};oEL=ZC.Core.EventListener.Create("EnableDisable");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var bEnable,sEnabledClass,sDisabledClass,sPopulateWhenDisabledFrom,mValueWhenDisabled,oPopulateFromWidget;bEnable=this._SearchLists(this._GetWidgetValue(oWidget),"EnableWhenSrcEquals","EnableWhenSrcNotEquals","EnableWhenSrcContains","EnableWhenSrcNotContains");sEnabledClass=this.GetAttribDefault("EnabledClass","");sDisabledClass=this.GetAttribDefault("DisabledClass","disabled");this.oDestWidget.Enable(bEnable,sEnabledClass,sDisabledClass);if(bEnable){if(!L.isUndefined(this.ValueWhenEnabled)){this.oDestWidget.SetValue(this.ValueWhenEnabled);delete this.ValueWhenEnabled}return }if(this.AttribIsset("ValueWhenDisabled")){mValueWhenDisabled=this.GetAttrib("ValueWhenDisabled")}else{if(sPopulateWhenDisabledFrom=this.GetAttribDefault("PopulateWhenDisabledFrom")){oPopulateFromWidget=JSManager.GetWidget(sPopulateWhenDisabledFrom);if(oPopulateFromWidget){mValueWhenDisabled=oPopulateFromWidget.GetValue()}}}if(!L.isUndefined(mValueWhenDisabled)){this.ValueWhenEnabled=this.oDestWidget.GetValue();this.oDestWidget.SetValue(mValueWhenDisabled)}};oEL=ZC.Core.EventListener.Create("EnableDisableTab");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var oTabView=JSManager.GetWidget(this.GetAttrib("TabViewName")),bEnable;if(!L.isUndefined(oTabView)){bEnable=this._SearchLists(this._GetWidgetValue(oWidget),"EnableWhenSrcEquals","EnableWhenSrcNotEquals","EnableWhenSrcContains","EnableWhenSrcNotContains");oTabView.EnableTab(this.GetAttrib("TabID"),bEnable)}};oEL=ZC.Core.EventListener.Create("SelectOrUpload");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var sDestId=this.oDestWidget._elInput.id,eSelectDiv=Dom.get("div."+sDestId+".select"),eUploadDiv=Dom.get("div."+sDestId+".upload");if(oWidget.GetValue()==1){eSelectDiv.style.display="block";eUploadDiv.style.display="none"}else{eSelectDiv.style.display="none";eUploadDiv.style.display="block"}};oEL=ZC.Core.EventListener.Create("SetOptionsFromJSArray");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){if(!L.isUndefined(window[this.aDef.ArrayName])){var aNewOptions=window[this.aDef.ArrayName][this._GetWidgetValue(oWidget)];this.oDestWidget.SetAttrib("Options",aNewOptions)}};oEL=ZC.Core.EventListener.Create("SetOptionsFromAjax");oEL.prototype.Setup=function(){this.oSendFields={};JSManager.GetEvent("ManagerInit").subscribe(function(){U.ForEach(this.GetAttribDefault("SendFields",{}),function(sWidgetName,sQueryParam){var oWidget=this.oDestWidget.oForm.GetWidget(sWidgetName)||JSManager.GetWidget(sWidgetName);if(L.isNumber(sQueryParam)){sQueryParam=sWidgetName}if(oWidget){this.oSendFields[sQueryParam]=oWidget}},this)},this,true);return true};oEL.prototype.Destruct=function(){oEL.superclass.Destruct.apply(this,arguments);this.oSendFields={}};oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var oCallback={customevents:{onFailure:function(){JSManager.Alert(_GT("The server was unable to retrieve the data"))},onSuccess:function(sEventType,aArgs){var oResponse=YAHOO.lang.JSON.parse(aArgs[0].responseText);this.oDestWidget.SetAttrib("Options",oResponse)}},scope:this},sURL=JSManager.URL(this.oSendFields,this.GetAttrib("AjaxURL"));YAHOO.util.Connect.asyncRequest("GET",sURL,oCallback)};oEL=ZC.Core.EventListener.Create("SetValue_FromSource");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){oDestWidget.SetValue(this._GetWidgetValue(oWidget))};oEL=ZC.Core.EventListener.Create("ShowHideElements");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var Elements,bShow=this._SearchLists(this._GetWidgetValue(oWidget),"ShowWhenSrcEquals","ShowWhenSrcNotEquals","ShowWhenSrcContains","ShowWhenSrcNotContains");if(this.AttribIsset("ElementClass")){Elements=Dom.getElementsByClassName(this.GetAttrib("ElementClass"),this.GetAttribDefault("ElementType",undefined))}else{if(this.AttribIsset("ElementID")){Elements=this.GetAttrib("ElementID")}else{this.oDestWidget.Show(bShow);return }}if(bShow){Dom.removeClass(Elements,"hide")}else{Dom.batch(Elements,function(el){el.blur();Dom.addClass(el,"hide")})}};oEL=ZC.Core.EventListener.Create("CallJSFunction");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){if(this.aDef.JSArgs){eval(this.aDef.JSFunction+"("+this.aDef.JSArgs+");")}else{var fn=eval(this.aDef.JSFunction);if(L.isFunction(fn)){fn()}}};oEL=ZC.Core.EventListener.Create("CallObjectMethod");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var oObject=this.oDestination,sWidget=this.GetAttribDefault("Widget"),sBlockUID=this.GetAttribDefault("Block"),sMethod=this.GetAttrib("Method"),aArguments=this.GetAttribDefault("Arguments",[]);if(sWidget){oObject=JSManager.GetWidget(sWidget)}else{if(sBlockUID){oObject=JSManager.GetBlockByUniqueID(sBlockUID)}}if(oObject&&oObject[sMethod]){oObject[sMethod].apply(oObject,aArguments);if(this.GetAttribDefault("StopEvent")){Evt.stopEvent(oSrcEvent)}}};oEL=ZC.Core.EventListener.Create("SetRelatedOptions_FromSource");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var elDest=Dom.get(this.aDef.ID+".1");if(elDest){setOptionsRelatedTo(elDest,this._GetWidgetValue(oWidget))}};oEL=ZC.Core.EventListener.Create("SetRelatedOptions_FromInitialValue");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var sID=this.aDef.ID,elDest=Dom.get(sID+".1"),elInitial=Dom.get(sID+".initial"),opt=this._GetWidgetValue(oWidget)+"-"+elInitial.value;for(var i=0,iMax=elDest.length;i<iMax;i++){if(elDest.options[i].value==opt){elDest.value=(opt);return }}};oEL=ZC.Core.EventListener.Create("AutoPopulate");oEL.prototype.Setup=function(){this.aCache={};this.oLookupFields={};if(this.oDestWidget.oParent!=this.oDestWidget.oForm){this.oParent=this.oDestWidget.oParent}this.oForm=this.oDestWidget.oForm;JSManager.GetEvent("ManagerInit").subscribe(function(){U.ForEach(this.GetAttrib("LookupFields"),function(sField){var oWidget=(this.oParent&&this.oParent.GetWidget(sField))||this.oForm.GetWidget(sField)||JSManager.GetWidget(sField);if(oWidget){this.oLookupFields[sField]=oWidget}},this)},this,true);var sLoadingElementID=this.GetAttribDefault("LoadingElement"),elLoading;if(sLoadingElementID&&(elLoading=Dom.get(sLoadingElementID))){this.elLoading=elLoading}return true};oEL.prototype.Destruct=function(){oEL.superclass.Destruct.apply(this,arguments);this.oForm=null;this.aCache={};this.oLookupFields={};this.oParent=null};oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var oCallback={customevents:{onStart:function(){Dom.addClass(this.elLoading,"ap-loading")},onComplete:function(){Dom.removeClass(this.elLoading,"ap-loading")},onFailure:function(){JSManager.Alert(_GT("The server was unable to retrieve the data"))},onSuccess:function(sEventType,aArgs){var oResponse;if(sEventType=="fromcache"){oResponse=aArgs}else{oResponse=YAHOO.lang.JSON.parse(aArgs[0].responseText);this.aCache[sURL]=oResponse}U.ForEach(oResponse,function(sValue,sKey){var sFromColour=this.GetAttribDefault("AnimateFromColour","#0cf"),oWidget,oAnim,sBG;oWidget=(this.oParent&&this.oParent.GetWidget(sKey))||this.oForm.GetWidget(sKey)||JSManager.GetWidget(sKey);if(sValue&&oWidget){oWidget.SetValue(sValue);if(this.GetAttribDefault("AnimateWhenLoaded",true)){oAnim=new YAHOO.util.ColorAnim(oWidget._elInput);sBG=oAnim.getAttribute("backgroundColor");oAnim.attributes={backgroundColor:{from:sFromColour,to:sBG}};oAnim.duration=0.5;oAnim.animate()}}},this)}},scope:this},sURL=JSManager.URL(this.oLookupFields,this.GetAttrib("AjaxURL"));if(!L.isUndefined(this.aCache[sURL])){oCallback.customevents.onSuccess.call(this,"fromcache",this.aCache[sURL])}else{YAHOO.util.Connect.asyncRequest("GET",sURL,oCallback)}};oEL=ZC.Core.EventListener.Create("SetValue_ToValue");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){if(!this._SearchLists(this._GetWidgetValue(oWidget),"SetWhenSrcEquals","SetWhenSrcNotEquals","SetWhenSrcContains","SetWhenSrcNotContains")){return }this.oDestWidget.SetValue(this.GetAttrib("Value"))};oEL=ZC.Core.EventListener.Create("AddToGroupMatrix");oEL.prototype.Setup=function(){var aSrc=this.GetAttribDefault("SourceFields",[]);if(!L.isArray(aSrc)){aSrc=[aSrc]}this.SetAttrib("SourceFields",aSrc);return true};oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var oParams={},bFoundValue=false,sURL,oCallback={customevents:{onFailure:function(){JSManager.Alert(_GT("The server was unable to retrieve the data"))},onSuccess:function(sEventType,aArgs){var oResponse=YAHOO.lang.JSON.parse(aArgs[0].responseText),sTarget=oResponse.Target,oTargetWidget=this.oDestWidget,oConfig=oResponse.JSConfig,sWidgetName;if(sTarget&&sTarget!=oTargetWidget.sName){oTargetWidget=(this.oParent&&this.oParent.GetWidget(sTarget))||(this.oDestWidget.oForm&&this.oDestWidget.oForm.GetWidget(sTarget))||JSManager.GetWidget(sTarget)}if(oTargetWidget){oTargetWidget.AddRow(oResponse.RowID,oResponse.Caption,oResponse.Widgets,oResponse.JSConfig)}}},scope:this};U.ForEach(this.GetAttrib("SourceFields"),function(sWidgetName,sKey){var oSrcWidget=(this.oParent&&this.oParent.GetWidget(sWidgetName))||(this.oDestWidget.oForm&&this.oDestWidget.oForm.GetWidget(sWidgetName))||JSManager.GetWidget(sWidgetName);if(oSrcWidget){if(!L.isString(sKey)){sKey=oSrcWidget.sName}if(oSrcWidget.GetValue()){bFoundValue=true;oParams[sKey]=oSrcWidget.GetValue();oSrcWidget.Clear()}}},this);if(!bFoundValue){U.Alert("Please select something to add to the table.")}else{sURL=JSManager.URL(oParams,this.GetAttrib("AjaxURL"));YAHOO.util.Connect.asyncRequest("GET",sURL,oCallback)}};oEL=ZC.Core.EventListener.Create("RemoveFromGroupMatrix");oEL.prototype.Setup=function(){var sMatrixID=this.GetAttribDefault("MatrixID"),sRowID=this.GetAttribDefault("RowID"),oWidget=this.oDestWidget;if(!sMatrixID){while(oWidget&&!(oWidget instanceof ZC.Core.Widget.Group_Matrix)){oWidget=oWidget.oParent}}else{oWidget=oWidget.GetWidget(sMatrixID)||oWidget.oForm.GetWidget(sMatrixID)||JSManager.GetWidget(sMatrixID)}if(L.isUndefined(oWidget)){return false}if(!sRowID){sRowID=oWidget.FindRowIDWithElement(this.oDestWidget._elInput);if(sRowID){this.SetAttrib("RowID",sRowID)}}this.oMatrix=oWidget;return this.AttribIsset("RowID")};oEL.prototype.Destruct=function(){oEL.superclass.Destruct.apply(this,arguments);this.oMatrix=null};oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){U.Confirm("Are you sure you want to remove "+this.oMatrix.GetRowCaption(this.GetAttrib("RowID"))+"?",this,function(){this.oMatrix.RemoveRow(this.GetAttrib("RowID"))})};oEL=ZC.Core.EventListener.Create("SetAttribFromField");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){U.ForEach(this.GetAttrib("AttribsToSet"),function(mField,sAttrib){if(!L.isArray(mField)){mField=[mField]}for(var i=0,iMax=mField.length;i<iMax;i++){var oWidget=this.oDestWidget.oForm.GetWidget(mField[i])||JSManager.GetWidget(mField[i]);if(oWidget&&oWidget.HasValue()){this.oDestWidget.SetAttrib(sAttrib,oWidget.GetValue());return }}},this)};oEL=ZC.Core.EventListener.Create("MakeAjaxRequest");oEL.prototype.HandleEvent=function(oWidget,oEvent,oSrcEvent){var sBlockUID=this.GetAttribDefault("Block"),oBlock,aIncludeWidgetValues=this.GetAttribDefault("IncludeWidgetValues",{}),oGetPostVars={},oExtraRequestParams=this.GetAttribDefault("ExtraRequestParams",{}),sTransaction=this.GetAttrib("Transaction"),oParams;if((oSrcEvent.getPreventDefault&&oSrcEvent.getPreventDefault())||oSrcEvent.returnValue===false){return }if(this.oDestination instanceof ZC.Core.Block){oBlock=this.oDestination}else{if(sBlockUID){oBlock=JSManager.GetBlockByUniqueID(sBlockUID);if(!oBlock){oBlock=JSManager.GetWidget(sBlockUID)}}else{oBlock=this.oDestination.FindContainingBlock()}}if(!oBlock){YAHOO.log("Unable to find block"+(sBlockUID?(" with UniqueID "+sBlockUID):""),"warn","MakeAjaxRequest");return }Evt.stopEvent(oSrcEvent);U.ForEach(aIncludeWidgetValues,function(sWidgetName,sKey){var oWidget=this.oDestWidget.oForm.GetWidget(sWidgetName)||JSManager.GetWidget(sWidgetName);if(oWidget){if(L.isString(sKey)){oGetPostVars[sKey]=oWidget}else{oGetPostVars[sWidgetName]=oWidget}}},this);if(!L.isUndefined(oExtraRequestParams.GetPostVars)){oGetPostVars=L.merge(oExtraRequestParams.GetPostVars,oGetPostVars)}oParams=L.merge(oExtraRequestParams,{Transaction:sTransaction,GetPostVars:oGetPostVars});oBlock.AjaxRequest(oParams);return false}})();(function(){var L=YAHOO.lang,Dom=YAHOO.util.Dom,Evt=YAHOO.util.Event,U=ZC.Util,_GT=U.GetText,YUIPECONTENT="yui-pe-content",oWidget,oChildWidget;oWidget=ZC.Core.Widget.Create("Checkbox");oWidget.prototype.CustomSetupEnd=function(){var sCheckedClass=this.GetAttribDefault("CheckedClass","checked"),fnChangeHandler;if(!this._elInput||!this.elContainer||!sCheckedClass){return false}fnChangeHandler=function(){if(!this._elInput){return }Dom[this._elInput.checked?"addClass":"removeClass"](this.elContainer,sCheckedClass)};Evt.on(this._elInput,"change",fnChangeHandler,this,true);Evt.on(this._elInput,"click",fnChangeHandler,this,true);fnChangeHandler.call(this);return true};oWidget.prototype.GetValue=function(){if(!this._elInput){return undefined}return this._elInput.checked};oWidget.prototype.HasValue=function(){return true};oWidget.prototype.SetValue=function(bValue){this._elInput.checked=!!bValue;this._FireEventHandlers("change")};ZC.Core.Widget.Boolean=oWidget;var GroupedInputHelper=function(){};GroupedInputHelper.prototype={_FindElements:function(){var sID=this.ID();if(this.IsReadOnly()){this._elInput=Dom.get(sID);return }this.elContainer=Dom.get(sID);this._elInput=[];if(this.aDef.OptionKeys){this._elInput=U.Map(this.aDef.OptionKeys,function(sOptKey){return Dom.get(this.ID(sOptKey))},this);this._elInput=U.Filter(this._elInput,function(el){return L.isObject(el)});if(this._elInput.length==0){this._elInput=null}}if(!this.elContainer){this._FindContainers()}},GetLabelForElement:function(aInputs){var aLabels,bReturnArray=true;if(L.isUndefined(aInputs)){aInputs=this._elInput}else{if(!L.isArray(aInputs)){bReturnArray=false;aInputs=[aInputs]}}aLabels=U.Map(aInputs,function(elRadio){var sInputId=elRadio.id,aFindLabels=Dom.getElementsBy(function(el){return(el.htmlFor==sInputId)},"label");if(aFindLabels.length==0){return undefined}return aFindLabels[0]},this);return(bReturnArray)?aLabels:aLabels[0]}};oWidget=ZC.Core.Widget.Create("Radio");L.augment(oWidget,GroupedInputHelper,true);oWidget.prototype._GetSelectedInput=function(){if(!this._elInput){return undefined}for(var i=0,iMax=this._elInput.length;i<iMax;++i){if(this._elInput[i].checked){return this._elInput[i]}}return undefined};oWidget.prototype.GetValue=function(){if(this.IsReadOnly()){return this._elInput.value}var elSelected=this._GetSelectedInput();return elSelected?elSelected.value:undefined};oWidget.prototype.GetHTMLValue=function(){if(this.IsReadOnly()){return this._elInput.value}var elSelected=this._GetSelectedInput(),elLabel;if(!elSelected){return undefined}elLabel=this.GetLabelForElement(elSelected);if(!elLabel){return undefined}return elLabel.innerHTML};oWidget.prototype.GetTextValue=function(){if(this.IsReadOnly()){return this._elInput.value}var elSelected=this._GetSelectedInput(),elLabel;if(!elSelected){return undefined}elLabel=this.GetLabelForElement(elSelected);if(!elLabel){return undefined}return(elLabel.textContent||elLabel.innerText)};oWidget.prototype.SetValue=function(Value){if(L.isUndefined(Value)){return this.Clear()}for(var i=0,iMax=this._elInput.length;i<iMax;++i){if(this._elInput[i].value==Value){this._elInput[i].checked=true;this._FireEventHandlers("change");return }}};oWidget.prototype.Clear=function(){if(!L.isUndefined(this.GetValue())){Dom.batch(this._elInput,function(el){el.checked=false});this._FireEventHandlers("change")}};oWidget=ZC.Core.Widget.Create("CheckboxGroup");L.augment(oWidget,GroupedInputHelper,true);oWidget.prototype.CustomSetupEnd=function(){var sSelectedClass=this.aDef.SelectedClass||"checked";var fnToggleSelectedClass=function(){var elAncestor=Dom.getAncestorByTagName(this,"tr");Dom[this.checked?"addClass":"removeClass"](elAncestor,sSelectedClass)};Evt.on(this._elInput,"change",fnToggleSelectedClass);if(YAHOO.env.ua.ie){Evt.on(this._elInput,"click",fnToggleSelectedClass)}U.ForEach(this._elInput,function(el){fnToggleSelectedClass.apply(el)});return true};oWidget.prototype._GetSelectedInputs=function(){return U.Filter(this._elInput,function(el){return el.checked})};oWidget.prototype.GetValue=function(){var elSelected=this._GetSelectedInputs();return U.Map(elSelected,function(el){return el.value})};oWidget.prototype.GetTextValue=function(){var elSelected=this._GetSelectedInputs(),aTextValues;if(!elSelected.length){return this.aDef.FormattedValueWhenEmpty||""}aTextValues=U.Map(this.GetLabelForElement(elSelected),function(el){return(el.textContent||el.innerText)});return aTextValues.join("\n")};oWidget.prototype.GetHTMLValue=function(){var elSelected=this._GetSelectedInputs(),aHTMLValues;if(!elSelected.length){return this.aDef.FormattedValueWhenEmpty||""}aHTMLValues=U.Map(this.GetLabelForElement(elSelected),function(el){return el.innerHTML});return aHTMLValues.join(this.aDef.HTMLValueSeparator||"<br />")};oWidget.prototype.SetValue=function(aValue){var bChanged=false;U.ForEach(this._elInput,function(el){if(U.InArray(el.value,aValue)){if(!el.checked){el.checked=true;bChanged=true}else{if(el.checked){el.checked=false;bChanged=true}}}});if(bChanged){this._FireEventHandlers("change")}};oWidget.prototype.EnableOption=function(Value,bEnable){if(!L.isArray(Value)){Value=[Value]}var sAddRemove=bEnable?"removeClass":"addClass";U.ForEach(this._elInput,function(el){if(U.InArray(el.value,Value)){el.disabled=!bEnable;var elTR=Dom.getAncestorByTagName(el,"tr");Dom[sAddRemove](elTR,"disabled")}})};oWidget=ZC.Core.Widget.Create("Select");var fnSetupCopyOptionClass=function(){var elSelectedOption,sCurrentOptionClass,fnChangeHandler;fnChangeHandler=function(elSelect){if(elSelect.target){elSelect=Evt.getTarget(elSelect)}if(this.sOldOptionClass){Dom.removeClass(elSelect,this.sOldOptionClass)}var elSelectedOption=elSelect.options[elSelect.selectedIndex],sNewClass=Dom.getAttribute(elSelectedOption,"class");if(sNewClass){Dom.addClass(elSelect,sNewClass);this.sOldOptionClass=sNewClass}};if(this.GetAttribDefault("CopyOptionClass")){Evt.on(this._elInput,"change",fnChangeHandler,this,true);Evt.on(this._elInput,"keydown",function(){this.oKeyInterval=L.later(10,this,function(){var elSelect;if(L.isArray(this._elInput)){elSelect=this._elInput[0]}else{elSelect=this._elInput}fnChangeHandler.call(this,elSelect)})},this,true);Evt.on(this._elInput,"keyup",function(){if(this.oKeyInterval){this.oKeyInterval.cancel()}},this,true);Dom.batch(this._elInput,fnChangeHandler,this,true)}return true};oWidget.prototype.CustomSetupEnd=fnSetupCopyOptionClass;oWidget.prototype.GetValue=function(bTextValue){if(!this._elInput||(this._elInput.type=="hidden"&&this._elInput.tagName.toLowerCase()=="input")){this.bHiddenField=true;this.GetValue=oWidget.superclass.GetValue}else{if(this._elInput.type=="select-one"){this.GetValue=function(bTextValue){if(!this._elInput){return undefined}var iIndex=this._elInput.selectedIndex;if(iIndex<0){return undefined}var oOpt=this._elInput.options[iIndex];return bTextValue?oOpt.text:oOpt.value}}else{this.GetValue=function(bTextValue){if(!this._elInput){return undefined}var aValues=[];U.ForEach(this._elInput.options,function(oOpt){if(oOpt.selected){aValues.push(bTextValue?oOpt.text:oOpt.value)}});return aValues}}}return this.GetValue(bTextValue)};oWidget.prototype.GetTextValue=function(){return this._GetFormattedValue("\n")};oWidget.prototype.GetHTMLValue=function(){return this._GetFormattedValue(this.aDef.HTMLValueSeparator||"<br />")};oWidget.prototype._GetFormattedValue=function(sSeparator){if(this.bHiddenField){return(this.elContainer.textContent||this.elContainer.innerText)}var Value=this.GetValue(true);if(Value.length==0){return(this.aDef.FormattedValueWhenEmpty||"")}if(!L.isArray(Value)){return Value}return Value.join(sSeparator)};oWidget.prototype.SetValue=function(Value){var bSingle=!L.isArray(Value),bChanged=false;if(this._elInput.type=="hidden"&&this._elInput.tagName.toLowerCase()=="input"){return oWidget.superclass.SetValue(Value)}for(var iOpt=0,iOptMax=this._elInput.length;iOpt<iOptMax;++iOpt){var oOpt=this._elInput.options[iOpt];if(bSingle){if(oOpt.value==Value){if(!oOpt.selected){oOpt.selected=true;this._FireEventHandlers("change")}return }}else{var bInArray=U.InArray(oOpt.value,Value);bChanged=bChanged||(oOpt.selected!=bInArray);oOpt.selected=bInArray}}if(bChanged){this._FireEventHandlers("change")}};oWidget.prototype.AttribMethod_Options=function(AttribValue){var aSelectedOptions=(this._elInput.type=="select-one")?[this.GetValue()]:this.GetValue();this._elInput.options.length=0;for(var sOptVal in AttribValue){if(L.hasOwnProperty(AttribValue,sOptVal)){var elOption=document.createElement("option");elOption.value=String(sOptVal);elOption.innerHTML=String(AttribValue[sOptVal]);elOption.selected=U.InArray(sOptVal,aSelectedOptions);this._elInput.appendChild(elOption)}}};oWidget.prototype.Clear=function(){if(this._elInput&&this._elInput.options){var sFirstOptVal=this._elInput.options[0].value;if(sFirstOptVal.match(/^(_?_?Any_?_?|)$/i)){this._elInput.selectedIndex=0}}};ZC.Core.Widget.Create("Reference","Core",oWidget);oWidget=ZC.Core.Widget.Create("Text");oWidget.prototype.InsertText=function(sText){U.InsertAtCursor(this._elInput,sText)};oWidget=ZC.Core.Widget.Create("TextArea");oWidget.prototype.CustomSetupEnd=function(){if(this.aDef.Size){this.AddEvent(this.UpdateNRemaining,["keyup","focus"],this);this.AddEvent(this.HideNRemaining,"blur",this)}return true};oWidget.prototype.UpdateNRemaining=function(event){if(L.isUndefined(this._elRemaining)){this._elRemaining=document.createElement("span");this._elRemaining.className="textarea-remainingchars";Dom.insertAfter(this._elRemaining,this._elInput)}var iUsed=this.GetValue().length,iMax=this.aDef.Size,sRemainingText="";var iRemaining=iMax-iUsed;if(iRemaining>=0){sRemainingText=U.sprintf(_GT("Used %1$d of %2$d characters, %3$d remaining."),iUsed,iMax,iRemaining)}else{sRemainingText=U.sprintf(_GT("Used %1$d of %2$d characters."),iUsed,iMax)}this._elRemaining.innerHTML=sRemainingText;var bOverLimit=iUsed>iMax;var sNewClass=bOverLimit?"invalid":"valid";var sOldClass=bOverLimit?"valid":"invalid";Dom.replaceClass(this._elRemaining,sOldClass,sNewClass);Dom.removeClass(this._elRemaining,"invisible")};oWidget.prototype.HideNRemaining=function(event){if(this._elRemaining){Dom.addClass(this._elRemaining,"invisible")}};oWidget.prototype.Validate=function(){var iUsed=this.GetValue().length,iMax=this.aDef.Size;var sValMsg=U.sprintf(_GT("Please reduce this to %d characters, it is currently at %d."),iMax,iUsed);if(iUsed>iMax){this.SetValid(false,sValMsg);return false}return oWidget.superclass.Validate.call(this)};oWidget.prototype.InsertText=function(sText){U.InsertAtCursor(this._elInput,sText)};oWidget=ZC.Core.Widget.Create("HTML");oWidget.prototype.CustomSetupEnd=function(){var iAttempts=0,fnInitMCE=function(){var oTinyMCE=this.GetTinyMCE(),oWidget=this,fnOldHandleEvent;if(!oTinyMCE){if(++iAttempts<10){window.setTimeout(function(){fnInitMCE.call(oWidget)},200)}return }fnOldHandleEvent=oTinyMCE.settings.handle_event_callback;oTinyMCE.settings.handle_event_callback=function(e){if(e.type=="blur"){oWidget.oSelectionBookmark=oTinyMCE.selection.getBookmark()}if(fnOldHandleEvent!=""&&!L.isUndefined(fnOldHandleEvent)){return tinyMCE.evalFunc(typeof (fnOldHandleEvent)=="function"?fnOldHandleEvent:eval(fnOldHandleEvent),0,arguments)}return true}};if(!this.IsReadOnly()){Evt.on(window,"load",fnInitMCE,this,true)}return true};oWidget.prototype.GetTinyMCE=function(){if(this._elInput&&!this.oTinyMCE){this.oTinyMCE=tinyMCE.getInstanceById(this._elInput.id)}return this.oTinyMCE};oWidget.prototype.GetValue=function(){if(this.GetTinyMCE()){return this.oTinyMCE.getBody().innerHTML}else{return oWidget.superclass.GetValue.apply(this,arguments)}};oWidget.prototype.SetValue=function(sValue){if(this.GetTinyMCE()){return this.oTinyMCE.getBody().innerHTML=sValue}else{return oWidget.superclass.SetValue.apply(this,arguments)}};oWidget.prototype.InsertText=function(sText){sText=sText.replace(/['"&<>\n]/g,function(sVal){switch(sVal){case"\n":return"<br>";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;"}});this.InsertHTML(sText)};oWidget.prototype.InsertHTML=function(sText){if(this.GetTinyMCE()){if(this.oSelectionBookmark){this.oTinyMCE.selection.moveToBookmark(this.oSelectionBookmark)}this.oTinyMCE.execCommand("mceInsertContent",false,sText)}else{U.InsertAtCursor(this._elInput,sText)}};oWidget=ZC.Core.Widget.Create("Group");oWidget.prototype.CustomSetupEnd=function(){if(this.aDef.HideFields){var sID,elPlaceholder,fnToggleVisible,elOpenCloseLink,sLabelShow,sLabelHide,sShowLinkTitle,sHideLinkTitle;sLabelShow=this.GetAttribDefault("LabelShow",_GT("Show"));sLabelHide=this.GetAttribDefault("LabelHide",_GT("Hide"));sShowLinkTooltip=this.GetAttribDefault("ShowLinkTooltip",_GT("Show this section"));sHideLinkTooltip=this.GetAttribDefault("HideLinkTooltip",_GT("Hide this section"));sID=this.aDef.ID;elPlaceholder=Dom.get(sID+"-toggle");this.elContainer=Dom.get(sID+"-hidediv");if(!elPlaceholder){return true}elOpenCloseLink=this.elOpenCloseLink=document.createElement("a");elOpenCloseLink.href="#";elOpenCloseLink.innerHTML=sLabelShow;this.oOpenCloseTooltip=new YAHOO.widget.Tooltip("grp-oc-tt-"+this.sName,{context:elOpenCloseLink,autofillheight:false,autodismissdelay:120000,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},text:sShowLinkTooltip});elPlaceholder.appendChild(elOpenCloseLink);var fnToggleVisible=function(event){if(event){Evt.stopEvent(event)}if(this.IsVisible()){this.Hide();this.elOpenCloseLink.innerHTML=sLabelShow;this.oOpenCloseTooltip.cfg.setProperty("text",sShowLinkTooltip)}else{this.Show();this.elOpenCloseLink.innerHTML=sLabelHide;this.oOpenCloseTooltip.cfg.setProperty("text",sHideLinkTooltip)}};Evt.on(elOpenCloseLink,"click",fnToggleVisible,this,true);if(this.IsVisible()){fnToggleVisible.call(this)}}return true};oWidget.prototype.GetTextValue=function(){var aResult=U.Map(this.aChildWidgets,function(oWidget){return oWidget.GetTextValue()});return aResult.join(this.aDef.TextValueSeparator||", ")};oWidget.prototype.GetHTMLValue=function(){var aResult=U.Map(this.aChildWidgets,function(oWidget){return oWidget.GetHTMLValue()});return aResult.join(this.aDef.HTMLValueSeparator||"<br />")};oWidget.prototype.GetValue=function(){var oValue={};U.ForEach(this.aChildWidgets,function(oWidget,sWidgetName){oValue[sWidgetName]=oWidget.GetValue()});return oValue};oWidget.prototype.Enable=function(bEnable,sEnableClass,sDisableClass){U.ForEach(this.aChildWidgets,function(oChild){oChild.Enable(bEnable,sEnableClass,sDisableClass)})};ZC.Core.Widget.Create("Document","Core",oWidget);ZC.Core.Widget.Create("Group_List","Core",oWidget);oWidget=ZC.Core.Widget.Create("Group_Matrix","Core",ZC.Core.Widget.Group);oWidget.prototype.CustomSetupEnd=function(){oWidget.superclass.CustomSetupEnd.call(this);this.elHeading=Dom.getFirstChildBy(this._elInput,function(el){return el.tagName.toLowerCase()=="thead"});this.elBody=Dom.getFirstChildBy(this._elInput,function(el){return el.tagName.toLowerCase()=="tbody"});var fnOnSubmit=function(){var aRows=Dom.getChildrenBy(this.elBody,function(el){return el.tagName.toLowerCase()=="tr"}),aRowIDs=U.Map(aRows,function(elRow){return Dom.getFirstChild(elRow).id.replace(this._elInput.id+"__","")},this);this.oForm.AddHiddenField(this.sName+"_rowvalues",aRowIDs)};this.oForm.AddEvent(fnOnSubmit,"submit",this);return true};oWidget.prototype.AddRow=function(sRowID,sCaption,aCells,oConfig){var elRow=document.createElement("tr"),elCaption=document.createElement("th"),sCaptionID=this._elInput.id+"__"+sRowID;if(Dom.get(sCaptionID)){return }elCaption.scope="row";elCaption.id=sCaptionID;elCaption.innerHTML=sCaption;elRow.appendChild(elCaption);U.ForEach(aCells,function(sCellHTML){var elCell=document.createElement("td");elCell.innerHTML=sCellHTML;elRow.appendChild(elCell)});this.elBody.appendChild(elRow);Dom.removeClass(this.elHeading,"hide");if(oConfig){this.AddChildWidget("gmrow_"+sRowID,oConfig)}};oWidget.prototype.RemoveRow=function(sRowID){var elTH,elRow,sPrefix=this._elInput.id+"__",oAnim,fnFinishAnim;if(sRowID.indexOf(sPrefix)==-1){sRowID=sPrefix+sRowID}elTH=Dom.get(sRowID);if(elTH){elRow=elTH.parentNode;fnFinishAnim=function(){elRow.parentNode.removeChild(elRow);if(!Dom.getFirstChildBy(this.elBody,function(el){return el.tagName.toLowerCase()=="tr"})){Dom.addClass(this.elHeading,"hide")}};if(YAHOO.util.Anim){oAnim=new YAHOO.util.Anim(elRow,{opacity:{from:100,to:0}},0.5);oAnim.onComplete.subscribe(fnFinishAnim,this,true);oAnim.animate()}else{fnFinishAnim.call(this)}}this.RemoveChildWidget("gmrow_"+sRowID.replace(sPrefix,""))};oWidget.prototype.FindRowIDWithElement=function(elFind){var elRow,sRowID,sPrefix=this._elInput.id+"__";while(Dom.isAncestor(this._elInput,elFind)){elRow=Dom.getAncestorByTagName(elFind,"tr");sRowID=Dom.getFirstChild(elRow).id;if(sRowID.indexOf(sPrefix)<0){elFind=elRow.parentNode}else{return sRowID.replace(sPrefix,"")}}return undefined};oWidget.prototype.GetRowCaption=function(sRowID){var elTH=Dom.get(this._elInput.id+"__"+sRowID);if(elTH){return(elTH.textContent||elTH.innerText)}else{return sRowID}};oWidget=ZC.Core.Widget.Create("TextInsertion","Core",oWidget);oWidget.prototype.CustomSetupEnd=function(){ZC.JSManager.GetEvent("ManagerInit").subscribe(function(){var sDestination,fnInsertClick;sDestination=this.GetAttrib("Destination");this.oDestWidget=this.oParent.GetWidget(sDestination)||((this.oParent!=this.oForm)&&this.oForm.GetWidget(sDestination))||ZC.JSManager.GetWidget(sDestination);if(!this.oDestWidget){return }var fnInsertClick=function(){this.oDestWidget.InsertText(decodeURIComponent(this.GetWidget("SelectTag").GetValue()))};this.GetWidget("Insert").AddEvent(fnInsertClick,"click",this);this.GetWidget("SelectTag").AddEvent(fnInsertClick,"dblclick",this)},this,true);return true};ZC.Util.YUIButtonWrapper=function(elSrc,aButtonDef,oWidget){var oYUIButton,elButton,oButtonConfig={},fnOnClick=false;if(aButtonDef.Type){oButtonConfig.type=aButtonDef.Type}Dom.removeClass(elSrc,YUIPECONTENT);if(elSrc.onclick){fnOnClick=elSrc.onclick}if(YAHOO.env.ua.gecko&&elSrc.getAttribute("type")=="submit"){elSrc.type="button";oButtonConfig.type="submit"}this.oWidget=oWidget;this.oYUIButton=oYUIButton=new YAHOO.widget.Button(elSrc,oButtonConfig);oYUIButton.zcWidget=oWidget;if(elSrc.className){oYUIButton.addClass(elSrc.className)}if(oWidget){oYUIButton.on("click",function(oEvent){this._EventDispatcher("click",oEvent)},oWidget,true);if(fnOnClick){oWidget.AddEvent(fnOnClick,"click",oWidget)}}if(L.isObject(aButtonDef)){if(aButtonDef.IconImage&&aButtonDef.IconWidth){elButton=(oYUIButton.getElementsByClassName("first-child"))[0].firstChild;Dom.setStyle(elButton,"background-image","url("+aButtonDef.IconImage+")");Dom.setStyle(elButton,"background-repeat","no-repeat");iPadding=Number(aButtonDef.IconWidth);if(aButtonDef.IconNoCaption){oYUIButton.set("label","");Dom.setStyle(elButton,"padding-left",iPadding+"px");Dom.setStyle(elButton,"padding-right","0px");Dom.setStyle(elButton,"background-position","50% 50%")}else{iPadding+=10;if(aButtonDef.IconPosition=="right"){Evt.onContentReady(Dom.generateId(elButton),function(){var oRegion=Dom.getRegion(elButton);Dom.setStyle(elButton,"padding-right",iPadding+"px");Dom.setStyle(elButton,"background-position",(oRegion.width-7)+"px 50%")})}else{Dom.setStyle(elButton,"padding-left",iPadding+"px");Dom.setStyle(elButton,"background-position","7px 50%")}}}}};ZC.Util.YUIButtonWrapper.prototype={Destruct:function(){this.oYUIButton=null}};oWidget=ZC.Core.Widget.Create("Submit");oWidget.prototype.CustomSetupEnd=function(){var oLoadingPanel,sLoadingMessage,aButtonDef,sConfirmMessage;if(!this._elInput){return false}if(aButtonDef=this.GetAttribDefault("YUIButtonDef")){this.oButtonWrapper=new U.YUIButtonWrapper(this._elInput,aButtonDef,this)}if(sLoadingMessage=this.GetAttribDefault("LoadingMessage")){oLoadingPanel=new YAHOO.widget.Panel(Dom.generateId(this._elInput)+"wait",{fixedcenter:true,close:false,draggable:false,zindex:40000,modal:true,visible:false});oLoadingPanel.setHeader(sLoadingMessage);oLoadingPanel.setBody('<img style="margin: 0 auto; display: block;" width="220" height="19" src="/zc/images/ajax-loader-bar.gif">');oLoadingPanel.render(document.body);Evt.on(this._elInput,"click",function(){oLoadingPanel.show()})}if(sConfirmMessage=this.GetAttribDefault("Confirm")){var fnSubmitHandler=function(oEvent){if(!confirm(sConfirmMessage)){Evt.stopEvent(oEvent)}};if(this.oButtonWrapper){Evt.on(this.oButtonWrapper.oYUIButton.getForm(),"submit",fnSubmitHandler)}else{Evt.on(this._elInput.form,"submit",fnSubmitHandler)}}this.AddEvent(function(){if(this.oForm){this.oForm.SetSelectedEndWidget(this)}},"click",this,50);return true};oWidget.prototype.Destruct=function(){oWidget.superclass.Destruct.apply(this,arguments);if(this.oButtonWrapper){this.oButtonWrapper.Destruct();this.oButtonWrapper=null}};oWidget.prototype.AttribMethod_value=function(AttribValue){this._elInput.value=AttribValue;if(this.oButtonWrapper){this.oButtonWrapper.oYUIButton.set("label",AttribValue)}};oWidget.prototype.Enable=function(bEnable,sEnableClass,sDisableClass){oWidget.superclass.Enable.apply(this,arguments);if(L.isUndefined(bEnable)){bEnable=true}if(this.oButtonWrapper){this.oButtonWrapper.oYUIButton.set("disabled",!bEnable)}};oWidget=ZC.Core.Widget.Create("Button");oWidget.prototype.CustomSetupEnd=function(){var aButtonDef;if(!this._elInput){return false}if(aButtonDef=this.GetAttribDefault("YUIButtonDef")){this.oButtonWrapper=new U.YUIButtonWrapper(this._elInput,aButtonDef,this)}this.AddEvent(function(){if(this.oForm){this.oForm.SetSelectedEndWidget(this)}},"click",this,50);return true};oWidget.prototype.Destruct=function(){oWidget.superclass.Destruct.apply(this,arguments);if(this.oButtonWrapper){this.oButtonWrapper.Destruct();this.oButtonWrapper=null}};oWidget.prototype.Enable=function(bEnable){oWidget.superclass.Enable.call(this,bEnable);if(this.oButtonWrapper){this.oButtonWrapper.oYUIButton.set("disabled",!bEnable)}};ZC.Core.Widget.Create("AutoPopulate","Core",oWidget);oWidget=ZC.Core.Widget.Create("Button_Clear");oWidget.prototype.CustomSetupStart=function(){var elButton,oAttribs,aButtonDef,fnButtonClickHandler,i,iMax;if(!this._elInput){return false}elButton=document.createElement("input");oAttribs=this._elInput.attributes;for(i=0,iMax=oAttribs.length;i<iMax;i++){Dom.setAttribute(elButton,oAttribs[i].nodeName,oAttribs[i].nodeValue)}elButton.type="button";elButton.value=this.aDef.Caption||"Clear";fnButtonClickHandler=function(event){if(this.oForm){this.oForm.Clear()}Evt.stopEvent(event)};Evt.on(elButton,"click",fnButtonClickHandler,this,true);this._elInput.parentNode.replaceChild(elButton,this._elInput);this._elInput=elButton;if(aButtonDef=this.GetAttribDefault("YUIButtonDef")){this.oButtonWrapper=new U.YUIButtonWrapper(this._elInput,aButtonDef,this)}this.AddEvent(function(){if(this.oForm){this.oForm.SetSelectedEndWidget(this)}},"click",this,50);return true};oWidget.prototype.Destruct=function(){oWidget.superclass.Destruct.apply(this,arguments);if(this.oButtonWrapper){this.oButtonWrapper.Destruct();this.oButtonWrapper=null}};oWidget.prototype.Enable=function(bEnable){oWidget.superclass.Enable.call(this,bEnable);if(this.oButtonWrapper){this.oButtonWrapper.oYUIButton.set("disabled",!bEnable)}};oWidget=ZC.Core.Widget.Create("Link");oWidget.prototype.CustomSetupEnd=function(){var aButtonDef,sConfirmMessage,fnClickHandler;if(!this._elInput){YAHOO.log("CustomSetupEnd: no _elInput","warn","Link "+this.sName);return false}if(aButtonDef=this.GetAttribDefault("YUIButtonDef")){this.oButtonWrapper=new U.YUIButtonWrapper(this._elInput,aButtonDef,this)}if(sConfirmMessage=this.GetAttribDefault("Confirm")){fnClickHandler=function(oEvent){if(!confirm(sConfirmMessage)){Evt.stopEvent(oEvent)}};this.AddEvent(fnClickHandler,"click",this,10)}this.AddEvent(function(){if(this.oForm){this.oForm.SetSelectedEndWidget(this)}},"click",this,50);return true};oWidget.prototype.Destruct=function(){oWidget.superclass.Destruct.apply(this,arguments);if(this.oButtonWrapper){this.oButtonWrapper.Destruct();this.oButtonWrapper=null}};oWidget.prototype.Enable=function(bEnable){oWidget.superclass.Enable.call(this,bEnable);if(this.oButtonWrapper){var oYUIButton=this.oButtonWrapper.oYUIButton;if(bEnable){oYUIButton.removeStateCSSClasses("disabled");oYUIButton.set("onclick",this._oldOnClick)}else{if(oYUIButton.hasFocus()){oYUIButton.blur()}oYUIButton.addStateCSSClasses("disabled");oYUIButton.removeStateCSSClasses("hover");oYUIButton.removeStateCSSClasses("active");oYUIButton.removeStateCSSClasses("focus");this._oldOnClick=oYUIButton.get("onclick");oYUIButton.set("onclick",{scope:oYUIButton,fn:function(oEvent){Evt.stopEvent(oEvent);this.blur()}})}}};oWidget.prototype.AttribMethod_href=function(sValue){if(this.oButtonWrapper){this.oButtonWrapper.oYUIButton.set("href",sValue)}else{this._elInput.href=sValue}};oWidget.prototype.PreventCaching=function(){var sURL=this.GetAttribDefault("href",this._elInput.href);sURL=ZC.JSManager.URL({nocache:(new Date()).getTime()},sURL);this.SetAttrib("href",sURL)};oWidget=ZC.Core.Widget.Create("Links_Button");oWidget.prototype.CustomSetupEnd=function(){var aButtonDef,elCaption,elMenu,elButton,sDefaultHREF,fnRenderToBody,sConfirmMessage;if(!this._elInput){return false}aButtonDef=this.GetAttribDefault("YUIButtonDef");elCaption=Dom.getFirstChild(this._elInput);if(elCaption.tagName.toLowerCase()=="a"){sDefaultHREF=elCaption.href}elButton=document.createElement("input");elButton.type="button";elButton.value=(elCaption.textContent||elCaption.innerText);elButton.className=elCaption.className;elButton.id=elCaption.id;elCaption.parentNode.replaceChild(elButton,elCaption);Dom.removeClass(this._elInput.id+"_menu",YUIPECONTENT);this.oYUIButton=new YAHOO.widget.Button(elButton,{type:(sDefaultHREF?"split":"menu"),menu:this._elInput.id+"_menu"});this.oYUIButton.getMenu().subscribe("render",function(){document.body.appendChild(this.element)});if(sConfirmMessage=this.GetAttribDefault("Confirm")){fnClickHandler=function(oEvent){if(!confirm(sConfirmMessage)){Evt.stopEvent(oEvent);this.bCancelled=true}else{this.bCancelled=false}};this.AddEvent(fnClickHandler,"click",this,10)}if(sDefaultHREF&&!this.GetAttribDefault("LinksDisabled")){this.AddEvent(function(oEvent){if(this.bCancelled){return }var sTarget=Dom.getAttribute(this._elInput,"target"),oNewWin;if(sTarget&&sTarget!="_self"){var oNewWin=window.open(sDefaultHREF,sTarget);if(oNewWin){return }YAHOO.log("window.open returned null, fallback to current window","debug","Links_Button")}window.location=sDefaultHREF},"DefaultLink",this,500)}else{if(this.GetAttribDefault("LinksDisabled")){this.oYUIButton.addClass("yui-button-disabled");this.oYUIButton.getMenu().cfg.setProperty("disabled",true)}}return true};oWidget.prototype._WireUpEvent=function(sEvent){switch(sEvent){case"click":this.oYUIButton.getMenu().subscribe(sEvent,function(sType,aArgs){this._EventDispatcher(sEvent,aArgs[0])},this,true);case"DefaultLink":if(this.oYUIButton.get("type")=="menu"){return }this.oYUIButton.on("click",function(oDOMEvent){this._EventDispatcher(sEvent,oDOMEvent)},this,true);break;default:this.oYUIButton.on(sEvent,function(oDOMEvent){this._EventDispatcher(sEvent,oDOMEvent)},this,true);break}};oWidget.prototype.Destruct=function(){oWidget.superclass.Destruct.apply(this,arguments);this.oYUIButton=null};oWidget=ZC.Core.Widget.Create("MenuButton");oWidget.prototype.CustomSetupStart=function(){if(this.GetAttribDefault("Widgets",[]).length<2){return false}var elSelect=Dom.get(this.aDef.Widgets.MenuOptions.ID),elSubmit=Dom.get(this.aDef.Widgets.MenuSubmit.ID),elNewSubmit,fnMenuItemHandler,fnMakeMenuItems,sLoadingMessage,oLoadingPanel,mMenu,aMenuGroupTitles=[];if(!elSelect||!elSubmit){return false}this._elInput=elSelect;var sType;if(!this.AttribIsset("Default")){sType="menu";for(var i=0,iMax=elSelect.options.length;i<iMax;i++){if(elSelect.options[i].value==""){elSelect.removeChild(elSelect.options[i]);break}}}else{sType="split"}if(!this.AttribIsset("Options")){mMenu=elSelect}else{elNewSubmit=document.createElement("input");elNewSubmit.type="button";elNewSubmit.id=elSubmit.id;elNewSubmit.name=elSubmit.name;elNewSubmit.value=elSubmit.value;elSubmit.parentNode.replaceChild(elNewSubmit,elSubmit);elSubmit=elNewSubmit;fnMenuItemHandler=function(sType,aArgs,oObj){var bResult=true,oButton=oObj.Widget.oYUIMenuButton,oHiddenField;elSelect.value=this.value;oObj.Widget.oForm.AddHiddenField(oButton.get("name"),oButton.get("value"));oObj.Widget._FireEventHandlers("click",this);if(oObj.Events){U.ForEach(oObj.Events,function(sEvent){bResult=bResult&&ZC.JSManager.GetEvent(oObj.Widget._InternalEventName(sEvent)).fire(this,oObj.Widget)},this)}if(oObj.Widget.GetAttribDefault("Submit",true)&&bResult&&oObj.Submit){oObj.Widget.bSubmitted=true;oButton.submitForm()}return bResult};fnMakeMenuItems=function(aOptions){var aMenu=[];U.ForEach(aOptions,function(mOption,mKey){var aSubMenu,aItemDef={value:mKey,onclick:{fn:fnMenuItemHandler,obj:{Widget:this,Submit:true}}};if(L.isObject(mOption)){aItemDef.onclick.obj.Submit=L.isUndefined(mOption.Submit)||mOption.Submit;aItemDef.onclick.obj.Events=!L.isUndefined(mOption.Events)?mOption.Events:false;if(!L.isUndefined(mOption.Group)){aItemDef=fnMakeMenuItems.call(this,mOption.Options);if(L.isString(aItemDef.Group)){aMenuGroupTitles.push(aItemDef.Group)}else{aMenuGroupTitles.push(false)}}else{aItemDef.text=mOption.Text;if(!L.isUndefined(mOption.Options)){if(!L.isUndefined(mOption.Selectable)&&!mOption.Selectable){delete aItemDef.onclick}aSubMenu=fnMakeMenuItems.call(this,mOption.Options);if(aSubMenu.length){aItemDef.submenu={id:Dom.generateId(),itemdata:aSubMenu}}}}}else{aItemDef.text=mOption}aMenu.push(aItemDef)},this);return aMenu};Dom.addClass(elSelect,"hide");mMenu=fnMakeMenuItems.call(this,this.GetAttrib("Options"))}if(YAHOO.env.ua.gecko){elSubmit.type="button"}this.oYUIMenuButton=new YAHOO.widget.Button(elSubmit,{type:sType,menu:mMenu});U.ForEach(aMenuGroupTitles,function(sTitle,iIndex){if(sTitle){this.oYUIMenuButton.setItemGroupTitle(sTitle,iIndex)}},this);if(this.AttribIsset("Default")){this.oYUIMenuButton.subscribe("click",function(oEvent){this.SetValue(this.GetAttrib("Default"));this._FireEventHandlers("click",oEvent)},this,true)}if(sLoadingMessage=this.GetAttribDefault("LoadingMessage")){oLoadingPanel=new YAHOO.widget.Panel(Dom.generateId(this._elInput)+"wait",{fixedcenter:true,close:false,draggable:false,zindex:40000,modal:true,visible:false});oLoadingPanel.setHeader(sLoadingMessage);oLoadingPanel.setBody('<img style="margin: 0 auto; display: block;" width="220" height="19" src="/zc/images/ajax-loader-bar.gif">');oLoadingPanel.render(document.body);this.oYUIMenuButton.getMenu().subscribe("click",function(){if(this.bSubmitted){oLoadingPanel.show()}},this,true)}this.AddEvent(function(){if(this.oForm){this.oForm.SetSelectedEndWidget(this)}if(YAHOO.env.ua.gecko){L.later(0,this.oYUIMenuButton,function(){this.get("srcelement").type="submit";this.submitForm();this.get("srcelement").type="button"})}},"click",this);this.aDef.Widgets=[];return true};oWidget.prototype.Destruct=function(){oWidget.superclass.Destruct.apply(this,arguments);this.oYUIMenuButton=null};oWidget.prototype._WireUpEvent=function(sEvent){switch(sEvent){case"click":this.oYUIMenuButton.getMenu().subscribe(sEvent,function(sType,aArgs){this._EventDispatcher(sEvent,aArgs[0])},this,true);case"DefaultLink":if(this.oYUIMenuButton.get("type")=="menu"){return }this.oYUIMenuButton.on("click",function(oDOMEvent){this._EventDispatcher(sEvent,oDOMEvent)},this,true);break;default:this.oYUIMenuButton.on(sEvent,function(oDOMEvent){this._EventDispatcher(sEvent,oDOMEvent)},this,true);break}};oWidget=ZC.Core.Widget.Create("Password");oWidget.prototype.GetValue=function(){return this._elInput[0].value};oWidget.prototype.GetTextValue=function(){return U.StrRepeat("*",this.GetValue().length)};oWidget=ZC.Core.Widget.Create("Password_Change","Core",oWidget);oWidget.prototype._FindElements=function(){var sName;sName=this._WidgetNameToID();this._elInput=[Dom.get(sName),Dom.get(sName+"_confirm")];this._FindContainers()};oWidget.prototype.Validate=function(){var sVal1,sVal2;sVal1=this._elInput[0].value;sVal2=this._elInput[1].value;if(sVal1&&sVal2&&sVal1!=sVal2){this.SetValid(false,_GT("The two passwords do not match"));return false}return oWidget.superclass.Validate.call(this)};oWidget=ZC.Core.Widget.Create("LinkedSelect");oWidget.prototype.bChangeRODisplay=false;oWidget.prototype.CustomSetupEnd=fnSetupCopyOptionClass;oWidget.prototype.CustomSetupStart=function(){if(this._elInput.length){initLinkedSelect(this._elInput);return true}return false};oWidget.prototype._FindElements=function(){var sBaseName,i,elInput;sBaseName=this._WidgetNameToID();i=this.GetAttribDefault("FirstVisibleLevel",0);this._elInput=[];do{elInput=Dom.get(sBaseName+"."+i);if(elInput){this._elInput.push(elInput)}i++}while(elInput);this._FindContainers()};oWidget.prototype.Clear=function(){U.ForEach(this._elInput,function(elSelect){if(U.InArray(elSelect.options[0].value,["Any","__Any__",""])){elSelect.selectedIndex=0}if(L.isFunction(elSelect.onchange)){elSelect.onchange()}})};oWidget.prototype.GetValue=function(){var mVal=this.GetCompoundValue();if(L.isUndefined(mVal)){return undefined}if(mVal.lastIndexOf("-")!=-1){mVal=mVal.substring(mVal.lastIndexOf("-")+1)}return mVal};oWidget.prototype.GetCompoundValue=function(){var mVal;if(L.isUndefined(this._elInput)||L.isUndefined(this._elInput[this._elInput.length-1])){return undefined}mVal=this._elInput[this._elInput.length-1].value;return mVal};oWidget.prototype.GetTextValue=function(){if(L.isUndefined(this._elInput)){return undefined}var i=0,sText="";while(i<this._elInput.length){if(L.isUndefined(this._elInput[i])){return undefined}sText+=this._elInput[i].options[this._elInput[i].selectedIndex].text+" ";i++}return sText};oChildWidget=ZC.Core.Widget.Create("LinkedSelect_AllWidgetValues","Core",oWidget);oChildWidget.prototype.GetValue=function(){var mValue=this.GetCompoundValue();if(!L.isUndefined(mValue)){mValue=mValue.split(/-/)}return mValue};ZC.Core.Widget.Create("LinkedSelect_AllowBlank","Core",oWidget);ZC.Core.Widget.Create("LinkedSelect_LinkedSearch","Core",oWidget);oChildWidget=ZC.Core.Widget.Create("LinkedSelect_Multiple","Core",oWidget);oChildWidget.prototype.CustomSetupStart=function(){if(!oChildWidget.superclass.CustomSetupStart.apply(this,arguments)){return false}var sFormAndName,sCollectionSelectName,elSelect,elDeselect,fnSelect,fnDeselect;sFormAndName=this.oForm.sName+"."+this.sName;sCollectionSelectName=sFormAndName+".collection";this.elCollection=Dom.get(sCollectionSelectName);LinkedMultipleSelect_SynchroniseHiddenField(sCollectionSelectName,sFormAndName);LinkedSelect_RegisterMultiple(sFormAndName+"."+this.GetAttrib("MaxLevel"),sCollectionSelectName);fnSelect=function(){LinkedMultipleSelect_AddSelected(this._elInput,sCollectionSelectName,sFormAndName);this._EventDispatcher("change")};fnDeselect=function(){LinkedMultipleSelect_RemoveSelected(this._elInput,sCollectionSelectName,sFormAndName);this._EventDispatcher("change")};Evt.on(this._WidgetNameToID()+"_Select","click",fnSelect,this,true);Evt.on(this._WidgetNameToID()+"_Deselect","click",fnDeselect,this,true);return true};oChildWidget.prototype._WireUpEvent=function(sEvent){if(sEvent=="change"){return }return oChildWidget.superclass._WireUpEvent.apply(this,arguments)};var fnLinkedSelectMultiple_GetValue=function(bTextValue){if(!this.elCollection){return undefined}var aValues=[];U.ForEach(this.elCollection.options,function(oOpt){aValues.push(bTextValue?oOpt.text:oOpt.value)});return aValues};oChildWidget.prototype.GetValue=function(){return U.Map(fnLinkedSelectMultiple_GetValue.call(this,false),function(sVal){return sVal.replace(/^.*-/,"")})};oChildWidget.prototype.GetTextValue=function(){return fnLinkedSelectMultiple_GetValue.call(this,true)};oChildWidget=ZC.Core.Widget.Create("SelectRelated","Core",oWidget);oChildWidget.prototype.CustomSetupStart=function(){if(this._elInput.length){initSelectRelated(this._elInput);return true}return false};oWidget=ZC.Core.Widget.Create("DateTime_FromRange");oWidget.prototype.CustomSetupStart=function(){U.ForEach(["FromDate","ToDate","FromTime","ToTime"],function(sAttrib){if(!this.AttribIsset(sAttrib)){oWidget.superclass.SetAttrib.call(this,sAttrib,new Date())}else{var mValue=this.GetAttrib(sAttrib);if(mValue.match(/^\d+$/)){oWidget.superclass.SetAttrib.call(this,sAttrib,new Date(mValue*1000))}else{oWidget.superclass.SetAttrib.call(this,sAttrib,new Date(mValue))}}},this);return true};oWidget.prototype.GetValue=function(){var oDateWidget=this.aChildWidgets.Date,oTimeWidget=this.aChildWidgets.Time,aDateValues=["1970-01-01"],aTimeValues=[""],aValues=[],sValue;if(!L.isUndefined(oDateWidget)&&!L.isUndefined(oDateWidget.GetValue())){aDateValues=oDateWidget.GetValue()}if(!L.isUndefined(oTimeWidget)&&!L.isUndefined(oTimeWidget.GetValue())){aTimeValues=oTimeWidget.GetValue()}U.ForEach(aDateValues,function(sDate){U.ForEach(aTimeValues,function(sTime){aValues.push(new Date(sDate+" "+sTime))})});if(this.GetAttribDefault("Multiple")){return aValues}else{return aValues[0]}};oWidget.prototype.GetTextValue=function(){var mValue=this.GetValue(),fnDateFormat=YAHOO.util.Date.format,sDisplayFormat=this.GetAttrib("DisplayFormat");if(L.isUndefined(mValue)){return this.GetAttribDefault("DisplayValueWhenNull","")}else{if(L.isArray(mValue)){return U.Map(mValue,function(oDate){return fnDateFormat(oDate,{format:sDisplayFormat})}).join(this.GetAttribDefault("ValueSeparator",", "))}else{return fnDateFormat(this.GetValue,{format:sDisplayFormat})}}};oWidget.prototype.SetValue=function(mValue){var oDateWidget=this.aChildWidgets.Date,oTimeWidget=this.aChildWidgets.Time,fnDateFormat=YAHOO.util.Date.format,aDateValues=[],aTimeValues=[];if(this.GetAttribDefault("Multiple")&&L.isArray(mValue)){if(oDateWidget){aDateValues=U.Map(mValue,function(oDate){fnDateFormat(oDate,"%Y-%m-%d")});oDateWidget.SetValue(aDateValues)}if(oTimeWidget){aTimeValues=U.Map(mValue,function(oDate){fnDateFormat(oDate,"%H:%M")});oTimeWidget.SetValue(aTimeValues)}}else{if(!(mValue instanceof Date)){if(L.isNumber(mValue)){mValue=new Date(mValue*1000)}else{mValue=new Date(mValue)}if(!mValue){return }}if(oDateWidget){oDateWidget.SetValue(fnDateFormat(mValue,"%Y-%m-%d"))}if(oTimeWidget){oTimeWidget.SetValue(fnDateFormat(mValue,"%H:%M"))}}};oWidget.prototype.SetAttrib=function(sAttrib,mValue){var oDateWidget=this.aChildWidgets.Date,oTimeWidget=this.aChildWidgets.Time,fnDateFormat=YAHOO.util.Date.format,oDateOptions={},oTimeOptions={},mCurrentValue;oWidget.superclass.SetAttrib.apply(this,arguments);mCurrentValue=this.GetValue();switch(sAttrib){case"DateOptions":if(oDateWidget){oDateWidget.SetAttrib("Options",mValue)}break;case"TimeOptions":if(oTimeWidget){oTimeWidget.SetAttrib("Options",mValue)}break;case"FromDate":case"ToDate":if(!oDateWidget){return }oFromDate=this.GetAttrib("FromDate");oToDate=this.GetAttrib("ToDate");for(var oDate=new Date(oFromDate.getTime());oDate<=oToDate;oDate.setTime(oDate.getTime()+86400000)){oDateOptions[fnDateFormat(oDate,{format:"%Y-%m-%d"})]=fnDateFormat(oDate,{format:this.GetAttrib("DateFormat")})}oDateWidget.SetAttrib("Options",oDateOptions);return ;case"FromTime":case"ToTime":if(!oTimeWidget){return }oFromTime=this.GetAttrib("FromTime");oToTime=this.GetAttrib("ToTime");for(var oDate=new Date(oFromTime.getTime());oDate<=oToTime;oDate.setTime(oDate.getTime()+86400000)){oTimeOptions[fnDateFormat(oDate,{format:"%H:%M"})]=fnDateFormat(oDate,{format:this.GetAttrib("TimeFormat")})}oTimeWidget.SetAttrib("Options",oTimeOptions);break;default:return }this.SetValue(mCurrentValue)};ZC.Core.Widget.Create("Date_FromRange","Core",oWidget);ZC.Core.Widget.Create("Time_FromRange","Core",oWidget)})();
