function Base(aa,ba){this.aLoadedImages=new Array();this.oPath=aa;this.lang=ba;this.ua=null;this.init();}
Base.prototype.init=function(){this.ua={sUserAgent:navigator.userAgent.toLowerCase()};this.ua.bIsOpera=this.ua.sUserAgent.indexOf('opera')>-1;this.ua.bIsSafari=this.ua.sUserAgent.indexOf('safari')>-1;this.ua.bIsGecko=!this.ua.bIsOpera&&!this.ua.bIsSafari&&this.ua.sUserAgent.indexOf('gecko')>-1;this.ua.bIsIE=!this.ua.bIsOpera&&this.ua.sUserAgent.indexOf('msie')>-1;this.ua.bIsIE6=this.ua.bIsIE&&(this.ua.sUserAgent.indexOf('msie 5')>-1||this.ua.sUserAgent.indexOf('msie 6')>-1);this.ua.bIsIE7=this.ua.bIsIE&&this.ua.sUserAgent.indexOf('msie 7')>-1;if(!window.XMLHttpRequest&&window.ActiveXObject)window.XMLHttpRequest=function(){return new ActiveXObject(oBase.ua.sUserAgent.indexOf('MSIE 5')>-1?'Microsoft.XMLHTTP':'MSXML2.XMLHTTP');};if(this.supportsXMLHTTP()&&document.cookie.indexOf('xmlhttp=')==-1)document.cookie='xmlhttp=1; path=/; domain='+this.oPath.cookieURL;};Base.prototype.supportsXMLHTTP=function(){if(!window.XMLHttpRequest)return false;if('opera' in window){var ca=new XMLHttpRequest();if(!('setRequestHeader' in ca))return false;}
return true;}
Base.prototype.confirmRedirect=function(da,ea){var fa=confirm(ea);if(fa)document.location=da;return false;};Base.prototype.loadImage=function(ga){if(!this.aLoadedImages[ga]){this.aLoadedImages[ga]=new Image;this.aLoadedImages[ga].src=ga;}
return this.aLoadedImages[ga];};Base.prototype.copyAddress=function(ha,ia){document.getElementById(ia+'Address').value=document.getElementById(ha+'Address').value;document.getElementById(ia+'Zipcode').value=document.getElementById(ha+'Zipcode').value;document.getElementById(ia+'City').value=document.getElementById(ha+'City').value;document.getElementById(ia+'Country').value=document.getElementById(ha+'Country').value;};Base.prototype.redirect=function(ja){document.location=ja;return false;};Base.prototype.setInnerHTML=function(ka,la){if('innerHTML' in ka)ka.innerHTML=la;else{var ma=document.createRange();ma.selectNodeContents(ka);ma.deleteContents();element.appendChild(ma.createContextualFragment(la));}};Base.prototype.getStyle=function(na,oa){if(document.defaultView&&document.defaultView.getComputedStyle){var pa=null;var qa=document.defaultView.getComputedStyle(na,'');if(qa)pa=qa[oa];return na.style[oa]||pa;}
else if(document.documentElement.currentStyle&&oBase.ua.bIsIE){if(oa=='opacity'){var ra=100;try{ra=na.filters['DXImageTransform.Microsoft.Alpha'].opacity;}
catch(e){try{ra=na.filters('alpha').opacity;}
catch(e){}}
return ra/100;}
else{var sa=na.currentStyle?na.currentStyle[oa]:null;return na.style[oa]||sa;}}
else return na.style[oa];};Base.prototype.setStyle=function(ta,va,wa){if(oBase.ua.bIsIE){if(va=='opacity'){if('filter' in ta.style){ta.style.filter='alpha(opacity='+wa*100+')';if(!ta.currentStyle||!ta.currentStyle.hasLayout)ta.style.zoom=1;}}
else ta.style[va]=wa;}
else ta.style[va]=wa;};Base.prototype.isAncestor=function(xa,ya){if(xa.contains&&!oBase.ua.bIsSafari)return xa.contains(ya);else if(xa.compareDocumentPosition)return!!(xa.compareDocumentPosition(ya)&16);else{var za=ya.parentNode;while(za){if(za==xa)return true;else if(!za.tagName||za.tagName.toUpperCase()=='HTML')return false;za=za.parentNode;}
return false;}};Base.prototype.getPos=function(Aa){if(Aa.parentNode==null||Aa.offsetParent==null||oBase.getStyle(Aa,'display')=='none')return false;var Ba=null;var Ca={x:0,y:0};var Da;if(Aa.getBoundingClientRect){Da=Aa.getBoundingClientRect();var Ea=document;if(!oBase.isAncestor(document.documentElement,Aa)&&parent.document!=document){Ea=parent.document;if(!oBase.isAncestor(Ea.documentElement,Aa))return false;}
var Fa=Math.max(Ea.documentElement.scrollTop,Ea.body.scrollTop);var Ga=Math.max(Ea.documentElement.scrollLeft,Ea.body.scrollLeft);Ca.x=Math.ceil(Da.left)+Ga;Ca.y=Math.ceil(Da.top)+Fa;return Ca;}
else{Ca.x=Aa.offsetLeft;Ca.y=Aa.offsetTop;Ba=Aa.offsetParent;if(Ba!=Aa){while(Ba){Ca.x+=Ba.offsetLeft;Ca.y+=Ba.offsetTop;Ba=Ba.offsetParent;}}
if(oBase.ua.bIsSafari&&oBase.getStyle(Aa,'position')=='absolute'){Ca.x-=document.body.offsetLeft;Ca.y-=document.body.offsetTop;}}
if(Aa.parentNode)Ba=Aa.parentNode;else Ba=null;while(Ba&&Ba.tagName.toUpperCase()!='BODY'&&Ba.tagName.toUpperCase()!='HTML'){if(oBase.getStyle(Ba,'display')!='inline'){Ca.x-=Ba.scrollLeft;Ca.y-=Ba.scrollTop;}
if(Ba.parentNode)Ba=Ba.parentNode;else Ba=null;}
return Ca;};Base.prototype.setPos=function(Ha,Ia){var Ja=oBase.getStyle(Ha,'position');if(Ja=='static'){this.setStyle(Ha,'position','relative');Ja='relative';}
var Ka=oBase.getPos(Ha);if(Ka==false)return false;var La={x:parseInt(oBase.getStyle(Ha,'left'),10),y:parseInt(oBase.getStyle(Ha,'top'),10)};if(isNaN(La.x))La.x=(Ja=='relative')?0:Ha.offsetLeft;if(isNaN(La.y))La.y=(Ja=='relative')?0:Ha.offsetTop;if(Ia.x!==null)Ha.style.left=(Ia.x-Ka.x+La.x)+'px';if(Ia.y!==null)Ha.style.top=(Ia.y-Ka.y+La.y)+'px';return true;};Base.prototype.getXMLDocument=function(Ma,Na){if(!window.XMLHttpRequest)return null;var Oa=new XMLHttpRequest();var Pa=typeof(Na)!='undefined';var Qa=this;if(Pa){Oa.onreadystatechange=function(){if(Oa.readyState!=4)return;if(Na.call){Na.call(Qa,Oa.responseXML!=null&&Oa.status==200?Oa.responseXML:false);}
else{Qa.tmpMethod=Na;Qa.tmpMethod(Oa.responseXML!=null&&Oa.status==200?Oa.responseXML:false);delete Qa.tmpMethod;}};}
Oa.open('GET',Ma+'&rand='+parseInt(Math.random()*99999999),Pa);Oa.send(null);return Oa;};Base.prototype.sendXMLDocument=function(Ra,Sa,Ta,Ua){if(!window.XMLHttpRequest)return false;var Va=new window.XMLHttpRequest();if(typeof(Ta)!='undefined'&&Ta!=null){Va.onreadystatechange=function(){if(Va.readyState!=4)return;if(Va.responseXML!=null&&Va.status==200)Ta(Va.responseXML);else Ta(false);};}
Va.open('POST',Ra,typeof(Ua)=='undefined'?true:Ua);if('setRequestHeader' in Va)Va.setRequestHeader('Content-Type','application/x-www-form-urlencoded');Va.send(Sa);return true;};Base.prototype.getPostXMLDocument=function(Wa,Xa,Ya,Za){if(!window.XMLHttpRequest)return false;var $a=new window.XMLHttpRequest();var ab=this;if(typeof(Ya)!='undefined'&&Ya!=null){$a.onreadystatechange=function(){if($a.readyState!=4)return;if($a.responseXML!=null&&$a.status==200)Ya.call(ab,$a.responseXML);else{ab.tmpMethod=Ya;ab.tmpMethod($a.responseXML!=null&&$a.status==200?$a.responseXML:false);delete ab.tmpMethod;Ya(false);}};}
$a.open('POST',Wa,typeof(Za)=='undefined'?true:Za);if('setRequestHeader' in $a)$a.setRequestHeader('Content-Type','application/x-www-form-urlencoded');$a.send(Xa);return true;};Base.prototype.in_array=function(bb,cb){for(var i=0,n=cb.length;i<n;i++){if(bb==cb[i])return true;}
return false;}
Base.prototype.addClass=function(db,eb){if(!('className' in db))return false;if(db.className.indexOf(eb)==-1){db.className+=' '+eb;return true;}
var fb=db.className==''?[]:db.className.split(/ /g);for(var i=0,n=fb.length;i<n;i++)if(fb[i]==eb)return true;fb[fb.length]=eb;db.className=fb.join(' ');return true;}
Base.prototype.removeClass=function(gb,hb){if(!('className' in gb)||gb.className==''||gb.className.indexOf(hb)==-1)return false;var ib=gb.className.split(/ /g);for(var i=0,n=ib.length;i<n;i++)if(ib[i]==hb)delete(ib[i]);gb.className=ib.join(' ');return true;}
Base.prototype.confirmAndGo=function(jb,kb,lb){this.sConfirmRedirect=jb;this.oCommonDialog=new CommonDialog({sSelf:'oBase.oCommonDialog',sConfirmation:kb.replace(/\\n/g,'<br />').replace(/\\r/g,''),sTitle:typeof(lb)=='undefined'?(document.title.indexOf(' - ')==-1?document.title:document.title.substr(0,document.title.indexOf(' - '))):lb,sType:'confirm',fCallback:'oBase.confirmAndGoDone'});return false;}
Base.prototype.confirmAndGoDone=function(mb){if(mb==true)location.href=this.sConfirmRedirect;}
Base.prototype.alert=function(nb,ob,pb){this.oCommonDialog=new CommonDialog({sSelf:'oBase.oCommonDialog',sAlert:nb.replace(/\\n/g,'<br />').replace(/\\r/g,''),sTitle:typeof(ob)=='undefined'?(document.title.indexOf(' - ')==-1?document.title:document.title.substr(0,document.title.indexOf(' - '))):ob,sType:'alert',bExtended:typeof(pb)=='undefined'?false:pb});return false;}
Base.prototype.includeJS=function(qb,rb){var sb=rb.createElement('script');sb.setAttribute('language','javascript');sb.setAttribute('type','text/javascript');sb.setAttribute('src',qb);rb.getElementsByTagName('head').item(0).appendChild(sb);};Base.prototype.changeSelection=function(tb){if('onselectstart' in document)document.onselectstart=tb?null:new Function('return false');else if('MozUserSelect' in document.body.style)document.body.style.MozUserSelect=tb?'text':'none';else if('KhtmlUserSelect' in document.body.style)document.body.style.KhtmlUserSelect=tb?'text':'none';else if('UserSelect' in document.body.style)document.body.style.UserSelect=tb?'text':'none';}
String.prototype.htmlspecialchars=function(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');}
String.prototype.php_to8bit=function(){if(smf_charset=='UTF-8')var n,sReturn='';for(var i=0,iTextLen=this.length;i<iTextLen;i++){n=this.charCodeAt(i);if(n<128)sReturn+=String.fromCharCode(n);else if(n<2048)sReturn+=String.fromCharCode(192|n>>6)+String.fromCharCode(128|n&63);else if(n<65536)sReturn+=String.fromCharCode(224|n>>12)+String.fromCharCode(128|n>>6&63)+String.fromCharCode(128|n&63);else sReturn+=String.fromCharCode(240|n>>18)+String.fromCharCode(128|n>>12&63)+String.fromCharCode(128|n>>6&63)+String.fromCharCode(128|n&63);}
return sReturn;}
String.prototype.preg_quote=function(){return this.replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g,'\\$1');}
Array.prototype.htmlspecialchars=function(){var ub=[];for(var i=0,n=this.length;i<n;i++)ub[i]=this[i].htmlspecialchars();return ub;}
var EventClass=new function(){};EventClass.addEventHandler=function(vb,wb,xb){if(vb.addEventListener)vb.addEventListener(wb,xb,false);else if(vb.attachEvent)vb.attachEvent('on'+wb,xb);else vb['on'+wb]=xb;};EventClass.removeEventHandler=function(yb,zb,Ab){if(yb.removeEventListener)yb.removeEventListener(zb,Ab,false);else if(yb.detachEvent)yb.detachEvent('on'+zb,Ab);else yb['on'+zb]=null;};function Overlay(Bb){this.oOverlay=null;this.opt=Bb;this.fnResizeEvent=null;this.init();}
Overlay.prototype.init=function(){this.oOverlay=document.createElement('div');this.oOverlay.style.display='none';this.oOverlay.style.backgroundColor='black';this.oOverlay.style.left='0px';this.oOverlay.style.top='0px';if(oBase.ua.bIsIE6){this.oOverlay.style.position='absolute';this.oOverlay.style.width=document.body.scrollWidth+'px';this.oOverlay.style.height=document.body.scrollHeight+'px';}
else{this.oOverlay.style.position='fixed';this.oOverlay.style.width='100%';this.oOverlay.style.height='100%';}
this.oOverlay.style.zIndex=99;document.body.appendChild(this.oOverlay);};Overlay.prototype.show=function(Cb){oBase.setStyle(this.oOverlay,'opacity',Cb);this.oOverlay.style.display='inline';if(oBase.ua.bIsIE6){window.oOverlayInstanceRef=this;this.fnResizeEvent=function(){this.oOverlayInstanceRef.handleWindowResize();};EventClass.addEventHandler(window,'resize',this.fnResizeEvent);}};Overlay.prototype.handleWindowResize=function(){this.oOverlay.style.position='absolute';this.oOverlay.style.width=document.body.scrollWidth+'px';this.oOverlay.style.height=document.body.scrollHeight+'px';};Overlay.prototype.moveTo=function(Db,Eb,Fb){var Gb=oBase.getStyle(this.oOverlay,'opacity');if(Math.abs(Gb-Db)>=Eb){oBase.setStyle(this.oOverlay,'opacity',Gb>Db?parseFloat(Gb)-parseFloat(Eb):parseFloat(Gb)+parseFloat(Eb));setTimeout(this.opt.sSelf+'.moveTo('+Db+', '+Eb+', '+Fb+');',Fb);}};Overlay.prototype.hide=function(){this.oOverlay.style.display='none';};Overlay.prototype.destroy=function(){if(oBase.ua.bIsIE6)EventClass.removeEventHandler(window,'resize',this.fnResizeEvent);this.oOverlay.parentNode.removeChild(this.oOverlay);};function Dialog(Hb){this.opt=Hb;this.oOverlay=null;this.oDialogDiv=null;this.oHeaderDiv=null;this.iRelMouseTop=0;this.iRelMouseLeft=0;this.oKeyEventObject=null;this.init();}
Dialog.prototype.init=function(){this.oKeyEventObject=oBase.ua.bIsIE||oBase.ua.bIsOpera?document.body:window;this.oKeyEventObject.dialogRef=this;}
Dialog.prototype.show=function(){if(oBase.ua.bIsIE6){var Ib=document.getElementsByTagName('select');for(var i=0,n=Ib.length;i<n;i++)Ib[i].style.visibility='hidden';}
this.oOverlay=new Overlay({sSelf:this.opt.sSelf+'.oOverlay'});this.oOverlay.show(0.30);this.oDialogDiv=document.createElement('div');this.oDialogDiv.className='dialog';if('sId' in this.opt)this.oDialogDiv.id=this.opt.sId;this.oDialogDiv.instanceRef=this;oBase.setInnerHTML(this.oDialogDiv,'<div class="dialog-header" id="dialog-header"><div class="button"><div class="close" onclick="'+this.opt.sSelf+'.close();" onmouseover="this.className=\'close-hover\';" onmouseout="this.className=\'close\';"></div></div>'+this.opt.sTitle.htmlspecialchars()+'</div><div class="dialog-content">'+this.opt.sContent+'</div><div class="dialog-buttons" id="dialog-buttons">'+this.opt.sButtons+'</div><div class="dialog-footer"></div>');document.body.appendChild(this.oDialogDiv);var Jb=0,iCurHeight=0,iOffsetX=0,iOffsetY=0;if('innerWidth' in window){Jb=window.innerWidth;iCurHeight=window.innerHeight;}
else if('documentElement' in document&&('clientWidth' in document.documentElement||'clientHeight' in document.documentElement)){Jb=document.documentElement.clientWidth;iCurHeight=document.documentElement.clientHeight;}
else if('body' in document&&('clientWidth' in document.body||'clientHeight' in document.body)){Jb=document.body.clientWidth;iCurHeight=document.body.clientHeight;}
if('pageXOffset' in window){iOffsetX=window.pageXOffset;iOffsetY=window.pageYOffset;}
else if('documentElement' in document&&'scrollLeft' in document.documentElement){iOffsetX=document.documentElement.scrollLeft;iOffsetY=document.documentElement.scrollTop;}
else if('body' in document&&'scrollLeft' in document.body){iOffsetX=document.body.scrollLeft;iOffsetY=document.body.scrollTop;}
oBase.setPos(this.oDialogDiv,{x:parseInt((Jb / 2) - (this.oDialogDiv.clientWidth / 2)),y:parseInt(iCurHeight / 2 - (this.oDialogDiv.clientHeight + 47) / 2)+('bFixedPosition' in this.opt&&this.opt.bFixedPosition?0:iOffsetY)});this.oHeaderDiv=document.getElementById('dialog-header');this.oHeaderDiv.style.cursor='move';this.oHeaderDiv.onmousedown=function(e){var Kb='event' in window?window.event:e;var Lb=this.parentNode.instanceRef;if('focus' in Lb.oDialogDiv)Lb.oDialogDiv.focus();document.onselectstart=new Function('return false');document.body.draggedDialog=Lb;EventClass.addEventHandler(document.body,'mousemove',eval(Lb.opt.sSelf+'.handleMouseMove'));EventClass.addEventHandler(document.body,'mouseup',eval(Lb.opt.sSelf+'.handleMouseUp'));var Mb=oBase.getPos(Lb.oDialogDiv);Lb.iRelMouseTop=Kb.clientY-Mb.y;Lb.iRelMouseLeft=Kb.clientX-Mb.x;}
this.oKeyEventObject.onkeydown=function(e){var Nb='event' in window?window.event:e;return this.dialogRef.handleKey(Nb);}
var Ob=document.getElementById('dialog-buttons').getElementsByTagName('input');if(Ob.length>0)Ob[0].focus();};Dialog.prototype.handleMouseMove=function(e){var Pb='event' in window?window.event:e;var Qb=document.body.draggedDialog;Qb.oDialogDiv.style.left=(Pb.clientX-Qb.iRelMouseLeft)+'px';Qb.oDialogDiv.style.top=(Pb.clientY-Qb.iRelMouseTop)+'px';if('focus' in Qb.oDialogDiv)Qb.oDialogDiv.focus();};Dialog.prototype.handleMouseUp=function(e){var Rb='event' in window?window.event:e;var Sb=document.body.draggedDialog;EventClass.removeEventHandler(document.body,'mousemove',eval(Sb.opt.sSelf+'.handleMouseMove'));EventClass.removeEventHandler(document.body,'mouseup',eval(Sb.opt.sSelf+'.handleMouseUp'));document.body.draggedDialog=null;document.onselectstart=null;};Dialog.prototype.handleKey=function(Tb){var Ub=Tb.keyCode;if('fOnEnter' in this.opt&&Ub==13)eval(this.opt.fOnEnter+'();');if(Ub==27)this.destroy();};Dialog.prototype.hide=function(){this.oOverlay.hide();};Dialog.prototype.destroy=function(){if(oBase.ua.bIsIE6){var Vb=document.getElementsByTagName('select');for(var i=0,n=Vb.length;i<n;i++)Vb[i].style.visibility='visible';}
this.oKeyEventObject.onkeydown=null;document.body.removeChild(this.oDialogDiv);this.oOverlay.destroy();this.oOverlay=null;if('fOnDestroy' in this.opt)eval(this.opt.fOnDestroy+'();');};Dialog.prototype.close=function(){this.destroy();};function CommonDialog(Wb){this.opt=Wb;this.oDialog=null;this.returnValue=null;this.sInputId=null;this.init();}
CommonDialog.prototype.init=function(){var Xb='';var Yb='';var Zb=false;this.sInputId='my-input-'+Math.floor(Math.random()*100000);var $b='bExtended' in this.opt&&this.opt.bExtended?'extended':'common';switch(this.opt.sType){case 'prompt':Xb='<div class="common-dialog-content"><p>'+this.opt.sQuestion+'</p></div><div class="common-dialog-content" id="'+this.sInputId+'-container"></div>';Yb='<input type="button" value="'+oBase.lang.buttonOk+'" onclick="return '+this.opt.sSelf+'.handleSubmit();" /><input type="button" value="'+oBase.lang.buttonCancel+'" onclick="return '+this.opt.sSelf+'.cancel();" />';Zb=oBase.ua.bIsGecko;break;case 'confirm':Xb='<div class="common-dialog-content">'+this.opt.sConfirmation+'</div>';Yb='<input type="button" value="'+oBase.lang.buttonYes+'" onclick="return '+this.opt.sSelf+'.handleConfirm(true);" /><input type="button" value="'+oBase.lang.buttonNo+'" onclick="return '+this.opt.sSelf+'.handleConfirm(false);" />';break;case 'alert':Xb='<div class="common-dialog-content">'+this.opt.sAlert+'</div>';Yb='<input type="button" value="'+oBase.lang.buttonOk+'" onclick="return '+this.opt.sSelf+'.handleConfirm(true);" />';break;}
this.oDialog=new Dialog({sSelf:this.opt.sSelf+'.oDialog',sTitle:this.opt.sTitle,sId:$b+'-dialog',sContent:Xb,sButtons:Yb,fOnDestroy:this.opt.sSelf+'.handleDestroy',fOnEnter:this.opt.sSelf+'.handleSubmit',bFixedPosition:Zb});this.oDialog.show();if(this.opt.sType=='prompt'){oBase.setInnerHTML(document.getElementById(this.sInputId+'-container'),'<form><input type="text" style="width: 280px;" id="'+this.sInputId+'" /></form>');if(oBase.ua.bIsGecko)document.getElementById('common-dialog').style.position='fixed';document.getElementById(this.sInputId).focus();}}
CommonDialog.prototype.handleDestroy=function(){if('fCallback' in this.opt){if(this.returnValue==null)this.returnValue=false;eval(this.opt.fCallback+'(this.returnValue);');}}
CommonDialog.prototype.handleSubmit=function(){this.returnValue=document.getElementById(this.sInputId).value;this.oDialog.close();}
CommonDialog.prototype.handleConfirm=function(ac){this.returnValue=ac;this.oDialog.close();}
CommonDialog.prototype.cancel=function(){this.returnValue=false;this.oDialog.close();}
function ExtendedSelection(bc){this.opt=bc;this.oDialog=null;this.iCurCompany=0;this.init();}
ExtendedSelection.prototype.init=function(){oBase.setInnerHTML(document.getElementById(this.opt.sId),'<a href="#" onclick="'+this.opt.sSelf+'.clickHandler();">'+this.opt.sLabel.htmlspecialchars()+'</a>');};ExtendedSelection.prototype.clickHandler=function(){var cc='';if(this.opt.aCompanies.length>1){var dc='';for(var i=0,n=this.opt.aCompanies.length;i<n;i++){dc+='<option value="'+this.opt.aCompanies[i].sId+'"'+(this.opt.sCurCompany==this.opt.aCompanies[i].sId?' selected="selected"':'')+'>'+this.opt.aCompanies[i].sName+'</option>';if(this.opt.sCurCompany==this.opt.aCompanies[i].sId)this.iCurCompany=i;}
cc+=this.opt.sCompanyTemplate.replace(/%companies%/,dc);}
cc+=this.opt.sTemplate.replace(/%customerSites%/,this._getCustomerSiteChecks(true));this.oDialog=new Dialog({sSelf:this.opt.sSelf+'.oDialog',sTitle:this.opt.sDialogTitle,sContent:cc,sButtons:this.opt.sButtonTemplate});this.oDialog.show();};ExtendedSelection.prototype.checkAll=function(){var ec=document.getElementById('checkAll').checked;for(var i=0,n=this.opt.aCompanies[this.iCurCompany].aCustomerSites.length;i<n;i++)document.getElementById('customerSite_'+this.opt.aCompanies[this.iCurCompany].aCustomerSites[i].sId).checked=ec;};ExtendedSelection.prototype.checkItem=function(){var fc=true;for(var i=0,n=this.opt.aCompanies[this.iCurCompany].aCustomerSites.length;i<n;i++)fc=fc&&document.getElementById('customerSite_'+this.opt.aCompanies[this.iCurCompany].aCustomerSites[i].sId).checked;document.getElementById('checkAll').checked=fc;};ExtendedSelection.prototype.changeCompany=function(gc){this.iCurCompany=gc.selectedIndex;oBase.setInnerHTML(document.getElementById('customerSiteList'),this._getCustomerSiteChecks());document.getElementById('checkAll').checked=false;};ExtendedSelection.prototype.cancel=function(){this.oDialog.close();};ExtendedSelection.prototype.doSelection=function(){var hc=new Array();for(var i=0,n=this.opt.aCompanies[this.iCurCompany].aCustomerSites.length;i<n;i++){if(document.getElementById('customerSite_'+this.opt.aCompanies[this.iCurCompany].aCustomerSites[i].sId).checked)hc[hc.length]=this.opt.aCompanies[this.iCurCompany].aCustomerSites[i].sId;}
if(hc.length>0)location.href=location.pathname+'?setCustomerSiteIDs='+hc.join(',')+'&setCompanyID='+this.opt.aCompanies[this.iCurCompany].sId;else this.oDialog.close();};ExtendedSelection.prototype._getCustomerSiteChecks=function(ic){var jc=this.opt.aCompanies[this.iCurCompany].aCustomerSites;var kc='';for(var i=0,n=jc.length;i<n;i++)kc+='<input type="checkbox" value="1" id="customerSite_'+jc[i].sId+'" onclick="'+this.opt.sSelf+'.checkItem();"'+(ic&&jc[i].bChecked?' checked="checked"':'')+' class="checkbox"> <label for="customerSite_'+jc[i].sId+'">'+jc[i].sName.htmlspecialchars()+'</label><br />';return kc;};function HelpDialog(lc){this.opt=lc;this.oDialog=null;this.init();}
HelpDialog.prototype.init=function(){var mc=document.getElementById(this.opt.sHelpButtonId);mc.style.display='block';document.getElementById(this.opt.sSeparatorId).style.display=document.getElementById(this.opt.sAddComponentsId).style.display;mc.oHelpDialogRef=this;mc.onclick=function(){this.oHelpDialogRef.show();};};HelpDialog.prototype.show=function(){this.oDialog=new Dialog({sSelf:this.opt.sSelf+'.oDialog',sTitle:this.opt.sTitle,sContent:this.opt.sContents,sButtons:this.opt.sButton});this.oDialog.show();};HelpDialog.prototype.close=function(){this.oDialog.close();};function ListView(nc){this.opt=nc;this.oForm=null;this.oAllCheck=null;this.oColumnPickerDialog=null;this.bMyReportCollapsed=true;this.iCurReport=null;this.oSaveButton=null;this.oRemoveButton=null;this.oSelect=null;this.init();};ListView.prototype.init=function(){var oc=document.getElementById(this.opt.sTableId);var pc=oc.getElementsByTagName('tr');for(var i=0,n=pc.length;i<n;i++){if(pc[i].childNodes==null||pc[i].childNodes.length<=1||pc[i].childNodes[1].nodeName.toLowerCase()=='th')continue;pc[i].instanceRef=this;pc[i].sBaseClass=pc[i].className;pc[i].sMarkedClass='';pc[i].sHighlightClass='';pc[i].onmouseover=function(){this.instanceRef.highlight(this,true);}
pc[i].onmouseout=function(){this.instanceRef.delight(this,true);}
if(this.opt.bEnableClickSupport)pc[i].onclick=function(){this.instanceRef.handleClick(this,true);}}
if(this.opt.sAllCheck!=null){this.oAllCheck=document.getElementById(this.opt.sAllCheck);this.oAllCheck.style.display='block';this.oAllCheck.instanceRef=this;this.oAllCheck.onclick=function(){this.instanceRef.checkAll();};var qc=oc.getElementsByTagName('input');for(var i=0,n=qc.length;i<n;i++){if('type' in qc[i]&&qc[i].type=='checkbox'&&qc[i].name==this.opt.sCheckName){qc[i].instanceRef=this;qc[i].onclick=function(){this.instanceRef.checkItem();};}}}
if('oColumnPicker' in this.opt){var rc=document.getElementById(this.opt.oColumnPicker.sId);oBase.setInnerHTML(rc,'<img src="'+oBase.oPath.imageURL+'/shared/icons/columnPicker.png" style="" alt="" />');rc.instanceRef=this;rc.onclick=function(){this.instanceRef.columnPickerShow();}}
if('oMyReport' in this.opt){oBase.setInnerHTML(document.getElementById(this.opt.oMyReport.sContainerId),this.opt.oMyReport.sTemplate);if(!this.opt.oMyReport.bCollapsed)this.myReportToggle();this.oSelect=document.getElementById(this.opt.oMyReport.sSelectId);this.oSelect.instanceRef=this;this.oSelect.onchange=function(){this.instanceRef.myReportChange();}
for(var i=0,n=this.opt.oMyReport.aReports.length;i<n;i++)this.myReportAddOption(i);this.oSaveButton=document.getElementById(this.opt.oMyReport.sSaveId);this.oRemoveButton=document.getElementById(this.opt.oMyReport.sRemoveId);this.myReportUpdateButtonStatus();}};ListView.prototype.myReportAddOption=function(sc){var tc=document.createElement('option');oBase.setInnerHTML(tc,this.opt.oMyReport.aReports[sc].sName+(this.opt.oMyReport.aReports[sc].bIsModified?' *':''));tc.value=this.opt.oMyReport.aReports[sc].sId;this.oSelect.appendChild(tc);if(this.opt.oMyReport.aReports[sc].bSelected){this.oSelect.selectedIndex=this.oSelect.options.length-1;this.iCurReport=sc;}};ListView.prototype.myReportChange=function(){var uc=this.oSelect.options[this.oSelect.selectedIndex].value;switch(uc){case '-1':location.href=this.opt.oMyReport.sBaseURL;break;case '0':this.iCurReport=null;this.myReportUpdateButtonStatus();return;break;default:for(var i=0,n=this.opt.oMyReport.aReports.length;i<n;i++)if(this.opt.oMyReport.aReports[i].sId==uc)location.href=this.opt.oMyReport.aReports[i].sURL+(this.opt.oMyReport.aReports[i].sURL.indexOf('?')==-1?'?':'&')+'r='+uc;break;}};ListView.prototype.myReportUpdateButtonStatus=function(){var vc=this.oSelect.options[this.oSelect.selectedIndex].value;var wc=vc=='0'||(this.iCurReport!=null&&this.opt.oMyReport.aReports[this.iCurReport].bIsModified);this.oSaveButton.src=this.oSaveButton.src.replace(/[a-zA-Z_]+\.png/,wc?'save.png':'save_off.png');this.oSaveButton.style.cursor=wc?'pointer':'auto';if(wc){this.oSaveButton.instanceRef=this;this.oSaveButton.onclick=function(){this.instanceRef.myReportSave();}}
else this.oSaveButton.onclick=null;var xc=this.iCurReport!=null;this.oRemoveButton.src=this.oRemoveButton.src.replace(/[a-zA-Z_]+\.png/,xc?'delete.png':'delete_off.png');this.oRemoveButton.style.cursor=xc?'pointer':'auto';if(xc){this.oRemoveButton.instanceRef=this;this.oRemoveButton.onclick=function(){this.instanceRef.myReportRemove();}}
else this.oRemoveButton.onclick=null;};ListView.prototype.myReportToggle=function(){var yc=document.getElementById(this.opt.oMyReport.sToggleId);var zc=document.getElementById(this.opt.oMyReport.sPanelId);if(this.bMyReportCollapsed){yc.src=yc.src.replace(/maximize/,'minimize');zc.style.display='block';oBase.getXMLDocument('/XMLHTTP/setMyReportToggle?collapse=0&listview='+this.opt.sId);}
else{yc.src=yc.src.replace(/minimize/,'maximize');zc.style.display='none';oBase.getXMLDocument('/XMLHTTP/setMyReportToggle?collapse=1&listview='+this.opt.sId);}
this.bMyReportCollapsed=!this.bMyReportCollapsed;};ListView.prototype.myReportAdd=function(){this.oCommonDialog=new CommonDialog({sSelf:this.opt.sSelf+'.oCommonDialog',sQuestion:this.opt.oMyReport.oLang.sAddReportQuestion,sTitle:this.opt.oMyReport.oLang.sAddReportTitle,sType:'prompt',fCallback:this.opt.sSelf+'.myReportAddDone'});};ListView.prototype.myReportAddDone=function(Ac){if(Ac!=false){var Bc=oBase.getXMLDocument(this.opt.oMyReport.sReportURL+'&saveReport='+escape(Ac));var Cc=Bc.responseText.substr(1);location.href=this.opt.oMyReport.sReportURL+'&r='+Cc;}};ListView.prototype.myReportSave=function(){if(this.iCurReport==null)return this.myReportAdd();oBase.getXMLDocument(this.opt.oMyReport.sReportURL+'&updateReport='+this.opt.oMyReport.aReports[this.iCurReport].sId);this.opt.oMyReport.aReports[this.iCurReport].bIsModified=false;oBase.setInnerHTML(this.oSelect.options[this.oSelect.selectedIndex],this.opt.oMyReport.aReports[this.iCurReport].sName);this.myReportUpdateButtonStatus();return null;};ListView.prototype.myReportRemove=function(){if(this.iCurReport!=null){this.oCommonDialog=new CommonDialog({sSelf:this.opt.sSelf+'.oCommonDialog',sConfirmation:this.opt.oMyReport.oLang.sConfirmDelete,sTitle:this.opt.oMyReport.oLang.sConfirmDeleteTitle,sType:'confirm',fCallback:this.opt.sSelf+'.myReportRemoveDone'});}};ListView.prototype.myReportRemoveDone=function(Dc){if(Dc!=false){oBase.getXMLDocument(this.opt.oMyReport.sReportURL+'&removeReport='+this.opt.oMyReport.aReports[this.iCurReport].sId);this.oSelect.removeChild(this.oSelect.options[this.oSelect.selectedIndex]);if(this.oSelect.options.length==1||this.oSelect.options[1].value!=0){var Ec=document.createElement('option');Ec.value='0';oBase.setInnerHTML(Ec,this.opt.oMyReport.oLang.sCustomOption);if(this.oSelect.options.length==1)this.oSelect.appendChild(Ec);else this.oSelect.insertBefore(Ec,this.oSelect.options[1]);}
this.oSelect.selectedIndex=1;this.iCurReport=null;this.myReportUpdateButtonStatus();}};ListView.prototype.columnPickerShow=function(){var Fc='';var Gc=[];for(var i=0,n=this.opt.oColumnPicker.aColumnGroups.length;i<n;i++){if(this.opt.oColumnPicker.aColumnGroups[i].sName!=null)Fc+='<h4>'+this.opt.oColumnPicker.aColumnGroups[i].sName+'</h4>';Fc+='<div style="clear: both; height:5px;"></div>';for(var j=0,m=this.opt.oColumnPicker.aColumnGroups[i].aColumns.length;j<m;j++){Fc+='<div class="column-picker-column" id="option_'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId+'"><input type="checkbox" name="c[]" id="column_'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId+'" value="'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId+'"'+(this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].bSelected?' checked="checked"':'')+' /> <label for="column_'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId+'" id="option-label-'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId+'">'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sName+'</label></div>';if(this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sDescription!=null)Gc[Gc.length]={sId:'option-label-'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId,sTitle:this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sTitle==null?this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sName:this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sTitle,sContent:this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sDescription};}
Fc+='<div style="clear: both; height:5px;"></div>';}
this.oColumnPickerDialog=new Dialog({sSelf:this.opt.sSelf+'.oColumnPickerDialog',sTitle:this.opt.oColumnPicker.sTitle,sContent:Fc,sButtons:this.opt.oColumnPicker.sButtonTemplate,fOnDestroy:this.opt.sSelf+'.columnPickerDestroy'});this.oColumnPickerDialog.show();if(Gc.length>0)this.oColumnPickerDialog.oHint=new Hint({sSelf:this.opt.sSelf+'.oColumnPickerDialog.oHint',aTargets:Gc});else this.oColumnPickerDialog.oHint=null;};ListView.prototype.columnPickerCancel=function(){this.oColumnPickerDialog.destroy();};ListView.prototype.columnPickerDestroy=function(){if(this.oColumnPickerDialog.oHint!=null)this.oColumnPickerDialog.oHint.destroy();};ListView.prototype.columnPickerSubmit=function(){var Hc=[];for(var i=0,n=this.opt.oColumnPicker.aColumnGroups.length;i<n;i++){for(var j=0,m=this.opt.oColumnPicker.aColumnGroups[i].aColumns.length;j<m;j++){this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].bSelected=document.getElementById('column_'+this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId).checked;if(this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].bSelected)Hc[Hc.length]=this.opt.oColumnPicker.aColumnGroups[i].aColumns[j].sId;}}
location.href=this.opt.oColumnPicker.sReportURL+'&c='+Hc.join(':');};ListView.prototype.checkAll=function(){if(this.oForm==null)this.oForm=document.getElementById(this.opt.sFormId);for(var i=0;i<this.oForm.elements.length;i++){var Ic=this.oForm.elements[i];if(Ic.name==this.opt.sCheckName&&Ic.type=='checkbox'&&Ic.disabled==false)Ic.checked=this.oAllCheck.checked;}};ListView.prototype.checkItem=function(){if(this.oForm==null)this.oForm=document.getElementById(this.opt.sFormId);var Jc=0;var Kc=0;for(var i=0;i<this.oForm.elements.length;i++){var Lc=this.oForm.elements[i];if(Lc.name==this.opt.sCheckName&&Lc.type=='checkbox'&&Lc.disabled==false){Jc++;if(Lc.checked)Kc++;}}
if(Kc==Jc)this.oAllCheck.checked=true;else this.oAllCheck.checked=false;};ListView.prototype.highlight=function(Mc,Nc){Mc.sHighlightClass=' highlight';Mc.className=Mc.sBaseClass+Mc.sMarkedClass+Mc.sHighlightClass;};ListView.prototype.delight=function(Oc,Pc){Oc.sHighlightClass='';Oc.className=Oc.sBaseClass+Oc.sMarkedClass+Oc.sHighlightClass;};ListView.prototype.handleClick=function(Qc,Rc){Qc.sMarkedClass=Qc.sMarkedClass==''?' marked':'';Qc.className=Qc.sBaseClass+Qc.sMarkedClass+Qc.sHighlightClass;}
ListView.prototype.changePeriodType=function(Sc){document.getElementById(this.opt.sViewDateOptionsId).style.display=Sc=='1'?'inline':'none';};function InlineListView(Tc){this.opt=Tc;this.init();};InlineListView.prototype.init=function(){this.tmpMethod=oBase.getXMLDocument;this.tmpMethod(this.opt.sUrl,this.handleInjectListView);delete this.tmpMethod;document.body.inlineListView_instanceRef=this;oBase.setInnerHTML(document.getElementById(this.opt.sTargetId),this.opt.sLoaderTemplate);}
InlineListView.prototype.handleInjectListView=function(Uc){if(typeof(Uc)=='boolean'&&Uc==false)return oBase.setInnerHTML(document.getElementById(this.opt.sTargetId),'<div class="loader">'+oBase.lang.errorLoadingData.htmlspecialchars()+'</div>');var Vc='';for(var i=0,n=Uc.getElementsByTagName('root')[0].childNodes.length;i<n;i++)Vc+=Uc.getElementsByTagName('root')[0].childNodes[i].nodeValue;oBase.setInnerHTML(document.getElementById(this.opt.sTargetId),Vc);window[this.opt.oListViewOptions.sSelf]=new ListView(this.opt.oListViewOptions);return null;}
function DateSelector(Wc){this.opt=Wc;this.oPeriodDiv=null;this.init();};DateSelector.prototype.init=function(){this.oPeriodDiv=document.getElementById(this.opt.sPeriodDivId);this.oPeriodDiv.name=this.opt.sField+'[t]';this.oPeriodDiv.style.display='inline';this.oPeriodDiv.form.instanceRef=this;this.oPeriodDiv.onchange=function(){this.form.instanceRef.selectPeriod(this.value);if(this.value!=1)this.form.submit();}
var Xc;for(var i=0,n=this.opt.aPeriods.length;i<n;i++){Xc=document.createElement('option');oBase.setInnerHTML(Xc,this.opt.aPeriods[i].sLabel.htmlspecialchars());Xc.value=this.opt.aPeriods[i].sName;this.oPeriodDiv.appendChild(Xc);if(this.opt.aPeriods[i].bSelected){this.oPeriodDiv.selectedIndex=this.oPeriodDiv.options.length-1;this.selectPeriod(Xc.value);}}
this.oPeriodDiv.form[this.opt.sField+'[fd]'].onchange=function(){this.form.instanceRef.resetPredefinedPeriod();};this.oPeriodDiv.form[this.opt.sField+'[fm]'].onchange=function(){this.form.instanceRef.resetPredefinedPeriod();};this.oPeriodDiv.form[this.opt.sField+'[fy]'].onchange=function(){this.form.instanceRef.resetPredefinedPeriod();};this.oPeriodDiv.form[this.opt.sField+'[td]'].onchange=function(){this.form.instanceRef.resetPredefinedPeriod();};this.oPeriodDiv.form[this.opt.sField+'[tm]'].onchange=function(){this.form.instanceRef.resetPredefinedPeriod();};this.oPeriodDiv.form[this.opt.sField+'[ty]'].onchange=function(){this.form.instanceRef.resetPredefinedPeriod();};if(this.opt.sUpdateGroupByButtonName in this.oPeriodDiv.form)this.oPeriodDiv.form[this.opt.sUpdateGroupByButtonName].style.display='none';if(this.opt.sField+'[gb]' in this.oPeriodDiv.form){this.oPeriodDiv.form[this.opt.sField+'[gb]'].onchange=function(){this.form.instanceRef.handleChangeGroupBy(true);}
this.handleChangeGroupBy(false);}
if('sMinDate' in this.opt){var Yc=this.oPeriodDiv.form[this.opt.sSubmitButtonName];Yc.instanceRef=this;Yc.onclick=function(){return this.instanceRef.handleSubmit();};}};DateSelector.prototype.handleSubmit=function(){if(!('sMinDate' in this.opt))return true;var Zc=this.opt.sMinDate.split('-');for(var i=0;i<3;i++)Zc[i]=parseInt(Zc[i]);var $c=this.oPeriodDiv.form[this.opt.sField+'[fd]'].display=='none'?1:parseInt(this.oPeriodDiv.form[this.opt.sField+'[fd]'].options[this.oPeriodDiv.form[this.opt.sField+'[fd]'].selectedIndex].value);var ad=this.oPeriodDiv.form[this.opt.sField+'[fm]'].display=='none'?1:parseInt(this.oPeriodDiv.form[this.opt.sField+'[fm]'].options[this.oPeriodDiv.form[this.opt.sField+'[fm]'].selectedIndex].value);var bd=parseInt(this.oPeriodDiv.form[this.opt.sField+'[fy]'].options[this.oPeriodDiv.form[this.opt.sField+'[fy]'].selectedIndex].value);if(bd<Zc[0]||(bd==Zc[0]&&ad<Zc[1])||(bd==Zc[0]&&ad==Zc[1]&&$c<=Zc[2])){this.oCommonDialog=new CommonDialog({sSelf:this.opt.sSelf+'.oCommonDialog',sTitle:typeof(sTitle)=='undefined'?(document.title.indexOf(' - ')==-1?document.title:document.title.substr(0,document.title.indexOf(' - '))):sTitle,sType:'alert',sAlert:this.opt.sOutOfBoundsError.replace(/%numDays%/g,this.opt.iMaxPeriodCovered),fCallback:this.opt.sSelf+'.confirmPeriodDone'});return false;}
return true;}
DateSelector.prototype.confirmPeriodDone=function(cd){if(cd!=false)this.oPeriodDiv.form.submit();}
DateSelector.prototype.selectPeriod=function(dd){for(var i=0,n=this.opt.aPeriods.length;i<n;i++){if(this.opt.aPeriods[i].sName==dd){if(this.opt.aPeriods[i].sBeginDate!=''){this.oPeriodDiv.form[this.opt.sField+'[fd]'].selectedIndex=parseInt(this.opt.aPeriods[i].sBeginDate.substr(8,2).replace(/^0/,''))-1;this.oPeriodDiv.form[this.opt.sField+'[fm]'].selectedIndex=parseInt(this.opt.aPeriods[i].sBeginDate.substr(5,2).replace(/^0/,''))-1;this.oPeriodDiv.form[this.opt.sField+'[fy]'].selectedIndex=parseInt(this.opt.aPeriods[i].sBeginDate.substr(0,4).replace(/^0/,''))-2000;this.oPeriodDiv.form[this.opt.sField+'[td]'].selectedIndex=parseInt(this.opt.aPeriods[i].sEndDate.substr(8,2).replace(/^0/,''))-1;this.oPeriodDiv.form[this.opt.sField+'[tm]'].selectedIndex=parseInt(this.opt.aPeriods[i].sEndDate.substr(5,2).replace(/^0/,''))-1;this.oPeriodDiv.form[this.opt.sField+'[ty]'].selectedIndex=parseInt(this.opt.aPeriods[i].sEndDate.substr(0,4).replace(/^0/,''))-2000;}
break;}}};DateSelector.prototype.resetPredefinedPeriod=function(){this.oPeriodDiv.selectedIndex=0;};DateSelector.prototype.handleChangeGroupBy=function(ed){switch(this.oPeriodDiv.form[this.opt.sField+'[gb]'].options[this.oPeriodDiv.form[this.opt.sField+'[gb]'].selectedIndex].value){case '1':var fd=this.oPeriodDiv.options[this.oPeriodDiv.selectedIndex].value;this.oPeriodDiv.form[this.opt.sField+'[fd]'].style.display='none';this.oPeriodDiv.form[this.opt.sField+'[fm]'].style.display='none';this.oPeriodDiv.form[this.opt.sField+'[td]'].style.display='none';this.oPeriodDiv.form[this.opt.sField+'[tm]'].style.display='none';this.oPeriodDiv.options[1].style.display='none';this.oPeriodDiv.options[2].style.display='none';this.oPeriodDiv.options[3].style.display='none';this.oPeriodDiv.options[4].style.display='none';if(fd=='2'||fd=='3'||fd=='4'||fd=='5'){for(var i=0,n=this.oPeriodDiv.options.length;i<n;i++){if(this.oPeriodDiv.options[i].value=='6'){this.oPeriodDiv.selectedIndex=i;this.selectPeriod(this.oPeriodDiv.options[i].value);break;}}}
break;case '2':this.oPeriodDiv.form[this.opt.sField+'[fd]'].style.display='none';this.oPeriodDiv.form[this.opt.sField+'[fm]'].style.display='inline';this.oPeriodDiv.form[this.opt.sField+'[td]'].style.display='none';this.oPeriodDiv.form[this.opt.sField+'[tm]'].style.display='inline';this.oPeriodDiv.options[1].style.display='none';this.oPeriodDiv.options[2].style.display='none';this.oPeriodDiv.options[3].style.display='block';this.oPeriodDiv.options[4].style.display='block';if(fd=='2'||fd=='3'){for(var i=0,n=this.oPeriodDiv.options.length;i<n;i++){if(this.oPeriodDiv.options[i].value=='4'){this.oPeriodDiv.selectedIndex=i;this.selectPeriod(this.oPeriodDiv.options[i].value);break;}}}
break;case '0':case '3':default:this.oPeriodDiv.form[this.opt.sField+'[fd]'].style.display='inline';this.oPeriodDiv.form[this.opt.sField+'[fm]'].style.display='inline';this.oPeriodDiv.form[this.opt.sField+'[td]'].style.display='inline';this.oPeriodDiv.form[this.opt.sField+'[tm]'].style.display='inline';this.oPeriodDiv.options[1].style.display='block';this.oPeriodDiv.options[2].style.display='block';this.oPeriodDiv.options[3].style.display='block';this.oPeriodDiv.options[4].style.display='block';break;}
if(ed)this.oPeriodDiv.form.submit();}
function Flash(gd){this.opt=gd;this.init();}
Flash.prototype.init=function(){document.write('<object type="application/x-shockwave-flash" data="'+oBase.oPath.imageURL+'/'+this.opt.sFile+'" width="'+this.opt.sWidth+'" height="'+this.opt.sHeight+'">');document.write('<param name="movie" value="'+oBase.oPath.imageURL+'/'+this.opt.sFile+'" />');if('sFlashVars' in this.opt)document.write('<param name="flashvars" value="'+this.opt.sFlashVars+'" />');document.write('<param name="quality" value="high" />');document.write('<param name="wmode" value="transparent" />');document.write('<param name="menu" value="false" />');document.write('<param name="loop" value="false" />');document.write('<param name="scale" value="noscale" />');document.write('<param name="allowScriptAccess" value="sameDomain" />');document.write('<img src="'+oBase.oPath.imageURL+'/'+this.opt.sAltImage+'" alt="" />');document.write('</object>');};function NavigationButtons(hd){this.opt=hd;this.init();}
NavigationButtons.prototype.init=function(){var jd=document.getElementById(this.opt.sListContainerId).getElementsByTagName('li');for(var i=0,n=jd.length;i<n;i++){if(!('className' in jd[i])||jd[i].className==null||jd[i].className.indexOf('selected')==-1){jd[i].instanceRef=this;jd[i].onmouseover=function(){this.instanceRef.handleMouseOverButton(this,true);}
jd[i].onmouseout=function(){this.instanceRef.handleMouseOverButton(this,false);}}}}
NavigationButtons.prototype.handleMouseOverButton=function(kd,ld){var md=!('className' in kd)||kd.className==null?'':kd.className;if(ld){if(md.indexOf('selected')!=-1)return;kd.className=md.indexOf('first')!=-1?'first selected':'selected';}
else kd.className=md.indexOf('first')!=-1?'first':'';}
function Hint(nd){this.opt=nd;this.oContainer=null;this.oBox=null;this.oTitleDiv=null;this.oContentDiv=null;this.oTarget=null;this.iTimeoutId=null;this.init();}
Hint.prototype.init=function(){for(var i=0,n=this.opt.aTargets.length;i<n;i++){var od=document.getElementById(this.opt.aTargets[i].sId);od.instanceRef=this;od.sHintTitle=this.opt.aTargets[i].sTitle;od.sHintContent=this.opt.aTargets[i].sContent;od.style.cursor='pointer';od.bTransparent='bTransparent' in this.opt.aTargets[i]&&this.opt.aTargets[i].bTransparent;od.onmouseover=function(){this.instanceRef.showHint(this.sHintTitle,this.sHintContent,this.bTransparent);};od.onmouseout=function(){this.instanceRef.hideHint();};}}
Hint.prototype.showHint=function(pd,qd,rd){if(this.iTimeoutId!=null){window.clearTimeout(this.iTimeoutId);this.iTimeoutId=null;}
if(this.oBox==null){this.oBox=document.createElement('div');document.body.appendChild(this.oBox);this.oContainer=document.createElement('div');this.oContainer.className='hint-container';this.oBox.appendChild(this.oContainer);this.oTitleDiv=document.createElement('div');this.oTitleDiv.style.display='none';this.oTitleDiv.style.fontWeight='bold';this.oTitleDiv.style.padding='2px';this.oTitleDiv.style.backgroundColor='#f6eeaa';this.oTitleDiv.style.borderBottom='1px solid #212121';this.oContainer.appendChild(this.oTitleDiv);this.oContentDiv=document.createElement('div');this.oContentDiv.style.padding='2px';this.oContainer.appendChild(this.oContentDiv);}
if(rd){this.oTitleDiv.style.display='none';this.oContentDiv.style.display='block';this.oBox.className='hint-transparent';}
else{this.oBox.className='hint-shade';oBase.setInnerHTML(this.oTitleDiv,pd.htmlspecialchars());this.oTitleDiv.style.display='block';this.oContentDiv.style.display=qd==''?'none':'block';this.oTitleDiv.style.borderBottom=qd==''?'0px solid black':'1px solid black';}
oBase.setInnerHTML(this.oContentDiv,qd);this.oBox.style.visibility='visible';document.MouseOver_instanceRef=this;document.onmousemove=function(sd){document.MouseOver_instanceRef.mouseMove(sd?sd:window.event);};}
Hint.prototype.hideHint=function(){if(this.iTimeoutId==null)this.iTimeoutId=setTimeout(this.opt.sSelf+'.hideHint2()',5);}
Hint.prototype.hideHint2=function(){this.oBox.style.visibility='hidden';document.onmousemove=null;this.iTimeoutId=null;}
Hint.prototype.mouseMove=function(td){if(td.pageX){this.oBox.style.left=(td.pageX+20)+'px';this.oBox.style.top=(td.pageY+20)+'px';}
else{this.oBox.style.left=td.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft)+10;this.oBox.style.top=td.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+10;}}
Hint.prototype.destroy=function(){document.onmousemove=null;this.oBox.parentNode.removeChild(this.oBox);}
function MaterialPreview(ud){this.opt=ud;this.oHint=null;this.oMaterialDone={};this.init();}
MaterialPreview.prototype.init=function(){this.oHint=new Hint({aTargets:[],sSelf:this.opt.sSelf+'.oHint'});}
MaterialPreview.prototype.initMaterial=function(vd,wd){if(vd.sMaterialId in this.oMaterialDone)return;wd.instanceRef=this.oHint;switch(vd.iType){case 1:wd.sHintTitle='';wd.sHintContent='<div style="background-color: white; border: 1px solid black; width: '+vd.sWidth+'px; height: '+vd.sHeight+'px;"><img src="'+oBase.oPath.currentURL+'/affiliateMaterial/getFile/materialID/'+vd.sMaterialId+'" alt="" width="'+vd.sWidth+'" height="'+vd.sHeight+'" /></div>';wd.bTransparent=true;break;case 2:wd.sHintTitle=vd.sLinkText;wd.sHintContent=vd.sLinkTextAdditional;wd.bTransparent=false;break;case 3:wd.sHintTitle='';wd.sHintContent='<div style="background-color: white; border: 1px solid black; width: '+vd.sWidth+'px; height: '+vd.sHeight+'px; position: absolute;"><object type="application/x-shockwave-flash" data="'+oBase.oPath.currentURL+'/affiliateMaterial/getFile/materialID/'+vd.sMaterialId+'" width="'+vd.sWidth+'" height="'+vd.sHeight+'"><param name="movie" value="'+oBase.oPath.currentURL+'/affiliateMaterial/getFile/materialID/'+vd.sMaterialId+'" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><param name="loop" value="true" /><param name="flashvars" value="campaignID=0&amp;materialID='+vd.sMaterialId+'&amp;affiliateID=0&amp;clickTAG=&amp;clickTag=" /></object></div>';wd.bTransparent=true;break;case 4:wd.sHintTitle='';wd.sHintContent='<div style="background-color: white; border: 1px solid black; width: '+vd.sWidth+'px; height: '+vd.sHeight+'px;"><img src="'+oBase.oPath.currentURL+'/affiliateMaterial/getFile/materialID/'+vd.sMaterialId+'" alt="" width="'+vd.sWidth+'" height="'+vd.sHeight+'" /></div>';wd.bTransparent=true;break;}
var xd=wd.getElementsByTagName('span');for(var i=0,n=xd.length;i<n;i++)if('title' in xd[i])xd[i].title='';wd.style.cursor='pointer';wd.onmouseover=function(){this.instanceRef.showHint(this.sHintTitle,this.sHintContent,this.bTransparent);};wd.onmouseout=function(){this.instanceRef.hideHint();};this.oHint.showHint(wd.sHintTitle,wd.sHintContent,wd.bTransparent);this.oMaterialDone[vd.sMaterialId]=true;}
MaterialPreview.handleMouseOver=function(yd,zd){if(yd.sMaterialId=='0')return;if(!('oMaterialPreview' in window))window.oMaterialPreview=new MaterialPreview({sSelf:'oMaterialPreview'});window.oMaterialPreview.initMaterial(yd,zd);}
function FormHelp(Ad){this.opt=Ad;this.init();}
FormHelp.prototype.init=function(){for(var i=0,n=this.opt.aControls.length;i<n;i++){var Bd=document.getElementById('form-field-description-'+this.opt.aControls[i]);if(typeof(Bd)!='object'||Bd==null)continue;Bd.style.display='none';var Cd=document.getElementById('form-field-'+this.opt.aControls[i]);Cd.className=Cd.className;var Dd=document.createElement('img');Dd.src=oBase.oPath.imageURL+'/shared/icons/form_help.png';Dd.style.paddingLeft='3px';Dd.alt=this.opt.sHintTitleLabel;var Ed=document.createElement('a');Ed.href='#';Ed.instanceRef=this;Ed.sControlName=this.opt.aControls[i];Ed.onclick=function(){return this.instanceRef.handleIconClick(this.sControlName,this);};Ed.title=this.opt.sHintTitleLabel;Ed.appendChild(Dd);var Fd=document.getElementById('form-field-title-'+this.opt.aControls[i]);Fd.appendChild(Ed);}}
FormHelp.prototype.handleIconClick=function(Gd,Hd){var Id=document.getElementById('form-field-description-'+Gd);Id.style.display=Id.style.display=='none'?'':'none';document.getElementById('form-field-'+Gd).className=document.getElementById('form-field-'+Gd).className;Hd.blur();}