
var com_isMerged=true;var _InExecution=false;var com=new Object();com.cs=new Object();if(!_globalCS)
var _globalCS=this;com.cs.ajax=new Object();com.cs.CreditCard=new Object();com.cs.Gallery=new Object();com.cs.general=new Object();com.cs.util=new Object();com.cs.ui=new Object();com.cs.forms=new Object();com.cs.initClass=function(s)
{var tokens=s.split(".");var i;var curr=com;for(i=1;i<tokens.length;i++)
{if(curr[tokens[i]]==null)
curr[tokens[i]]=new Object();curr=curr[tokens[i]];}}
com.cs._baseUrl='/includes';com.cs._loadedModules=new Array();com.cs._loadedUrls=new Array();com.cs.getBaseUrl=function()
{var s=com.cs._baseUrl;if(s.substr(s.length-1,1)!="/")
s+="/";return s;}
com.cs.require=function(packageName,dontAddIfMerged){if(!dontAddIfMerged||dontAddIfMerged==null||dontAddIfMerged==undefined)
dontAddIfMerged=false;if(!dontAddIfMerged||(dontAddIfMerged&&!com_isMerged)){packageName=packageName.toLowerCase();var modules=com.cs._loadedModules;if(modules[packageName]!=null)
return packageName;var _packages=packageName.split(".");var i;var path=com.cs.getBaseUrl();for(i=0;i<_packages.length;i++){if(i>0)
path+="/";path+=_packages[i];}
path+=".js";var ok=false;ok=this._loadPath(path,null);if(ok)
modules[packageName]=packageName;else{}}}
com.cs._loadPath=function(relpath,module,cb){var uri=((relpath.charAt(0)=='/'||relpath.match(/^\w+:/))?"":this.baseUrl)+relpath;try{return!module?this._loadUri(uri,cb):this._loadUriAndCheck(uri,module,cb);}catch(e){console.error(e);return false;}}
com.cs._loadUriAndCheck=function(uri,moduleName,cb){var ok=false;try{ok=this._loadUri(uri,cb);}catch(e){console.error("failed loading "+uri+" with error: "+e);}
return!!(ok&&this._loadedModules[moduleName]);}
com.cs._loadUri=function(uri,cb){if(this._loadedUrls[uri]){return true;}
var contents=this._getText(uri,true);if(!contents){return false;}
this._loadedUrls[uri]=true;this._loadedUrls.push(uri);if(cb){contents='('+contents+')';}else{}
var value=eval(contents);if(cb){cb(value);}
return true;}
com.cs._isDocumentOk=function(http){var stat=http.status||0;return(stat>=200&&stat<300)||stat==304||stat==1223||(!stat&&(location.protocol=="file:"||location.protocol=="chrome:"));}
com.cs._getText=function(uri,fail_ok){var http=this._xhrObj();var owloc=window.location+"";var base=document.getElementsByTagName("base");var hasBase=(base&&base.length>0);if(!hasBase&&com.cs._Url){uri=(new com.cs._Url(owloc,uri)).toString();}
if(false){uri+="";uri+=(uri.indexOf("?")==-1?"?":"&")+String(d.config.cacheBust).replace(/\W+/g,"");}
http.open('GET',uri,false);try{http.send(null);if(!this._isDocumentOk(http)){var err=Error("Unable to load "+uri+" status:"+http.status);err.status=http.status;err.responseText=http.responseText;throw err;}}catch(e){if(fail_ok){return null;}
throw e;}
return http.responseText;}
com.cs._Url=function(){var ore=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$");var ire=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");var n=null;var d=com.cs;var _a=arguments;var uri=[_a[0]];for(var i=1;i<_a.length;i++){if(!_a[i]){continue;}
var relobj=new d._Url(_a[i]+"");var uriobj=new d._Url(uri[0]+"");if(relobj.path==""&&!relobj.scheme&&!relobj.authority&&!relobj.query){if(relobj.fragment!=n){uriobj.fragment=relobj.fragment;}
relobj=uriobj;}else if(!relobj.scheme){relobj.scheme=uriobj.scheme;if(!relobj.authority){relobj.authority=uriobj.authority;if(relobj.path.charAt(0)!="/"){var path=uriobj.path.substring(0,uriobj.path.lastIndexOf("/")+1)+relobj.path;var segs=path.split("/");for(var j=0;j<segs.length;j++){if(segs[j]=="."){if(j==segs.length-1){segs[j]="";}else{segs.splice(j,1);j--;}}else if(j>0&&!(j==1&&segs[0]=="")&&segs[j]==".."&&segs[j-1]!=".."){if(j==(segs.length-1)){segs.splice(j,1);segs[j-1]="";}else{segs.splice(j-1,2);j-=2;}}}
relobj.path=segs.join("/");}}}
uri=[];if(relobj.scheme){uri.push(relobj.scheme,":");}
if(relobj.authority){uri.push("//",relobj.authority);}
uri.push(relobj.path);if(relobj.query){uri.push("?",relobj.query);}
if(relobj.fragment){uri.push("#",relobj.fragment);}}
this.uri=uri.join("");var r=this.uri.match(ore);this.scheme=r[2]||(r[1]?"":n);this.authority=r[4]||(r[3]?"":n);this.path=r[5];this.query=r[7]||(r[6]?"":n);this.fragment=r[9]||(r[8]?"":n);if(this.authority!=n){r=this.authority.match(ire);this.user=r[3]||n;this.password=r[4]||n;this.host=r[6]||r[7];this.port=r[9]||n;}}
com.cs._Url.prototype.toString=function(){return this.uri;};com.cs._XMLHTTP_PROGIDS=['Msxml2.XMLHTTP','Microsoft.XMLHTTP','Msxml2.XMLHTTP.4.0'];com.cs._xhrObj=function(){var http=null;var last_e=null;try{http=new XMLHttpRequest();}catch(e){}
if(!http){for(var i=0;i<3;++i){var progid=this._XMLHTTP_PROGIDS[i];try{http=new ActiveXObject(progid);}catch(e){last_e=e;}
if(http){this._XMLHTTP_PROGIDS=[progid];break;}}}
if(!http){throw new Error("XMLHTTP not available: "+last_e);}
return http;}
com.cs.clear=function(node){if(dojo){node=dojo.byId(node);}
while(node.childNodes.length>0){node.removeChild(node.childNodes[0]);}}
com.cs.inspect=function(element){for(var x in element){console.log(x+":"+element);}}
com.cs.unescape=function(str){str=str.replace(/[+]/g," ");return unescape(str);}
if(!com.cs)com.cs=new Object();if(!com.cs.Class)com.cs.Class=new Object();if(!Class)var Class=new Object();Class=function(data){var classname=data.name;var superclass=data.extend||Object;var constructor=data.constructor||function(){};var methods=data.methods||{};var statics=data.statics||{};var borrows;var provides;if(!data.borrows)borrows=[];else if(data.borrows instanceof Array)borrows=data.borrows;else borrows=[data.borrows];if(!data.provides)provides=[];else if(data.provides instanceof Array)provides=data.provides;else provides=[data.provides];var proto=new superclass();for(var p in proto)
if(proto.hasOwnProperty(p))delete proto[p];for(var i=0;i<borrows.length;i++){var c=data.borrows[i];borrows[i]=c;for(var p in c.prototype){if(typeof c.prototype[p]!="function")continue;proto[p]=c.prototype[p];}}
for(var p in methods)proto[p]=methods[p];proto.constructor=constructor;proto.superclass=superclass;if(classname)proto.classname=classname;for(var i=0;i<provides.length;i++){var c=provides[i];for(var p in c.prototype){if(typeof c.prototype[p]!="function")continue;if(p=="constructor"||p=="superclass")continue;if(p in proto&&typeof proto[p]=="funciton"&&proto[p].length==c.prototype[p].length)continue;throw new Error("Class "+classname+" does not provide method "+c.classname+"."+p);}}
constructor.prototype=proto;for(var p in statics)constructor[p]=data.statics[p];return constructor;}
com.cs.initClass("com.cs.util.AnchorUtil");com.cs.util.AnchorUtil.initAnchorLink=function(a,anchorLinkID){dojo.addOnLoad(function(){a=dojo.byId(a);a.href="#"+anchorLinkID;});}
com.cs.initClass("com.cs.util.Cookies");if(!com.cs)com.cs=new Object();if(!com.cs.util)com.cs.util=new Object();if(!com.cs.util.Cookies)com.cs.util.Cookies=new Object();com.cs.util.Cookies.createCookie=function(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
com.cs.util.Cookies.readCookie=function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
com.cs.util.Cookies.eraseCookie=function(name){com.cs.util.Cookies.createCookie(name,"",-1);}
com.cs.initClass("com.cs.util");Date.prototype.test=function(fd)
{alert(fd);}
Date.prototype.HasTime=false;Date.prototype.ErrorTime=false;Date.prototype.ErrorDate=false;Date.prototype.ErrorDay=false;Date.prototype.ErrorMonth=false;Date.prototype.ErrorYear=false;Date.prototype.ErrorHour=false;Date.prototype.ErrorMinute=false;Date.prototype.ErrorSecond=false;Date.prototype.ObjectName='Date';Date.prototype.ParseString=function(str,hasTime)
{this.ErrorDate=this.ErrorDay=this.ErrorHour=this.ErrorMinute=this.ErrorMonth=this.ErrorSecond=this.ErrorTime=this.ErrorYear=false;var dd,mm,yyyy,HH,MM,SS;dd=mm=yyyy=HH=MM=SS=0;if(!hasTime)
hasTime=false;this.HasTime=hasTime;var dateDelimiter="/";var timeDelimiter=":";var date=str;if(date.indexOf(" ")!=-1)date=date.substring(0,date.indexOf(" "));var dateItems=date.split(dateDelimiter);dd=dateItems[0];mm=dateItems[1];yyyy=dateItems[2];if(dd==""||dd==null||!com.cs.forms.Validation.IsNumeric(dd)||dd.indexOf(".")!=-1){this.ErrorDay=true;}
if(mm==""||mm==null||!com.cs.forms.Validation.IsNumeric(mm)||mm.indexOf(".")!=-1){this.ErrorMonth=true;}
if(yyyy==""||yyyy==null||!com.cs.forms.Validation.IsNumeric(yyyy)||yyyy.indexOf(".")!=-1){this.ErrorYear=true;}
this.ErrorDate=this.ErrorDay||this.ErrorMonth||this.ErrorYear;if(!this.ErrorDate){if(this.HasTime&&str.indexOf(" ")!=-1){var time=str.substring(str.indexOf(" ")+1);if(time.indexOf(" ")!=-1)time=time.substring(0,time.indexOf(" "));var timeItems=time.split(timeDelimiter);HH=timeItems[0]||0;MM=timeItems[1]||0;SS=timeItems[2]||0;if(HH!=0&&(HH==""||HH==null||!com.cs.forms.Validation.IsNumeric(HH)||HH.indexOf(".")!=-1)){this.ErrorHour=true;}
if(MM!=0&&(MM==""||MM==null||!com.cs.forms.Validation.IsNumeric(MM)||MM.indexOf(".")!=-1)){this.ErrorMinute=true;}
if(SS!=0&&(SS==""||SS==null||!com.cs.forms.Validation.IsNumeric(SS)||SS.indexOf(".")!=-1)){this.ErrorSecond=true;}
this.ErrorTime=this.ErrorHour||this.ErrorMinute||this.ErrorSecond;if(!this.ErrorTime){HH=Number(HH);MM=Number(MM);SS=Number(SS);}}
if(!this.ErrorTime){dd=Number(dd);mm=Number(mm)-1;yyyy=Number(yyyy);var currYear=Number((new Date()).getFullYear().toString().substring(2));if(yyyy<100){if(yyyy<currYear+20){yyyy+=2000;}
else{yyyy+=1900;}}
var d=new Date();d.setFullYear(yyyy,mm,dd);d.setHours(HH,MM,SS,0);if(d.getDate()!=dd)this.ErrorDay=true;if(d.getMonth()!=mm)this.ErrorMonth=true;if(d.getFullYear()!=yyyy)this.ErrorYear=true;this.ErrorDate=this.ErrorDay||this.ErrorMonth||this.ErrorYear;if(d.getHours()!=HH)this.ErrorHour=true;if(d.getMinutes()!=MM)this.ErrorMinute=true;if(d.getSeconds()!=SS)this.ErrorSecond=true;this.ErrorTime=this.ErrorHour||this.ErrorMinute||this.ErrorSecond;}}
var ok=!this.ErrorDate&&!this.ErrorTime;if(ok){this.setFullYear(d.getFullYear(),d.getMonth(),d.getDate());this.setHours(d.getHours(),d.getMinutes(),d.getSeconds());}
return ok;}
Date.prototype.ParseValues=function(day,month,year,hour,minute,second)
{var _self=this;_self.HasTime=(hour!=null);_self.setFullYear(year,month,day);if(_self.HasTime)
{if(second==null)
second=0;_self.setHours(hour,minute,second,0);}}
Date.prototype.toString=function()
{var _self=this;var format="#DD#/#MM#/#YYYY#";if(_self.HasTime)
{format+=" "+"#hhh#:#mm#";}
return _self.CustomFormat(format);}
Date.prototype.CustomFormat=function(formatString)
{var YYYY,YY,MMMM,MMM,MM,M,DDDD,DDD,DD,D,hhh,hh,h,mm,m,ss,s,ampm,dMod,th;YY=((YYYY=this.getFullYear())+"").substr(2,2);MM=(M=this.getMonth()+1)<10?('0'+M):M;MMM=(MMMM=["January","February","March","April","May","June","July","August","September","October","November","December"][M-1]).substr(0,3);DD=(D=this.getDate())<10?('0'+D):D;DDD=(DDDD=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][this.getDay()]).substr(0,3);th=(D>=10&&D<=20)?'th':((dMod=D%10)==1)?'st':(dMod==2)?'nd':(dMod==3)?'rd':'th';formatString=formatString.replace("#YYYY#",YYYY).replace("#YY#",YY).replace("#MMMM#",MMMM).replace("#MMM#",MMM).replace("#MM#",MM).replace("#M#",M).replace("#DDDD#",DDDD).replace("#DDD#",DDD).replace("#DD#",DD).replace("#D#",D).replace("#th#",th);h=(hhh=this.getHours());if(h==0)h=24;if(h>12)h-=12;hh=h<10?('0'+h):h;if(hhh<10)hhh="0"+hhh;ampm=hhh<12?'am':'pm';mm=(m=this.getMinutes())<10?('0'+m):m;ss=(s=this.getSeconds())<10?('0'+s):s;return formatString.replace("#hhh#",hhh).replace("#hh#",hh).replace("#h#",h).replace("#mm#",mm).replace("#m#",m).replace("#ss#",ss).replace("#s#",s).replace("#ampm#",ampm);}
Date.prototype.CompareTo=function(cmpTo)
{var _self=this;if(cmpTo.ObjectName=="Date")
{if(_self.getFullYear()<cmpTo.getFullYear())
return-1;else if(_self.getFullYear()>cmpTo.getFullYear())
{return 1;}
else
{if(_self.getMonth()<cmpTo.getMonth())
return-1;else if(_self.getMonth()>cmpTo.getMonth())
return 1;else
{if(_self.getDate()<cmpTo.getDate())
return-1;else if(_self.getDate()>cmpTo.getDate())
return 1;else
{if(_self.HasTime&&cmpTo.HasTime)
{if(_self.getHours()>cmpTo.getHours())
return 1;else if(_self.getHours()<cmpTo.getHours())
return-1;else
{if(_self.getMinutes()<cmpTo.getMinutes())
return-1;else if(_self.getMinutes()>cmpTo.getMinutes())
return 1;else
{if(_self.getSeconds()<cmpTo.getSeconds())
return-1;else if(_self.getSeconds()>cmpTo.getSeconds())
return 1;else
return 0;}}}
else
{return 0;}}}}}
return null;}
com.cs.initClass("com.cs.util.event");if(!com.cs.util.event.EVENT_DISPATCHERS)com.cs.util.event.EVENT_DISPATCHERS=new Array();com.cs.util.event.AddEvent=function(elem,eventName,func){if(typeof(elem)=="string")
elem=document.getElementByID(elem);var newfunc=func;if(elem[eventName])
{var oldfunc=elem[eventName];newfunc=function(event)
{var ret1=oldfunc(event);var ret2=func(event);return ret1&&ret2;}}
elem[eventName]=newfunc;}
com.cs.util.event.EventHandler=function(eventName,handler){this._eventName=eventName;this._eventHandler=handler;var scope=this;this.call=function(arguments){scope._eventHandler.apply(this,arguments);}
this.getEventName=function(){return scope._eventName;}
this.getEventHandler=function(){return scope._eventHandler;}
this.toString=function(){return"[com.cs.util.event.EventHandler]";}}
com.cs.util.event.EventDispatcher=function(element){this._element=element;this._handlers=new Array();var scope=this;this._initDispatcherForEvent=function(eventName){scope._element[eventName]=function(event){for(var i=0;i<scope._handlers.length;i++){var handler=scope._handlers[i];if(handler.getEventName()==eventName){handler.call(arguments);}}}}
this.addEventObserver=function(eventName,handler){var handler=new com.cs.util.event.EventHandler(eventName,handler);scope._handlers.push(handler);scope._initDispatcherForEvent(eventName);}
this.removeEventObserver=function(eventName,handler){var removeIndex=-1;for(var i=0;i<scope._handlers.length;i++){var eh=scope._handlers[i];if(eh.getEventName()==eventName&&eh.getEventHandler()==handler){removeIndex=i;break;}}
if(removeIndex!=-1){var part1=scope._handlers.slice(0,removeIndex);var part2=scope._handlers.slice(removeIndex+1);scope._handlers=part1.concat(part2);}}
this.removeAllEventsFor=function(eventName){for(var i=0;i<scope._handlers.length;i++){var handler=scope._handlers[i];if(handler.getEventName()==eventName){scope.removeEventObserver(eventName,handler.getEventHandler());i--;}}}
this.removeAllHandlers=function(){scope._handlers=new Array();}
this.init=function(){}
this.init();this.getElement=function(){return scope._element;}
this.toString=function(){return"[com.cs.util.event.EventDispatcher]";}}
com.cs.util.event.getInstance=function(element){if(typeof(element)=="string")element=document.getElementById(element);for(var i=0;i<com.cs.util.event.EVENT_DISPATCHERS.length;i++){var eventDispatcher=com.cs.util.event.EVENT_DISPATCHERS[i];if(eventDispatcher.getElement()==element){return eventDispatcher;}}
var eventDispatcher=new com.cs.util.event.EventDispatcher(element);com.cs.util.event.EVENT_DISPATCHERS.push(eventDispatcher);return eventDispatcher;}
com.cs.util.event.AddEventObserver=function(element,eventName,handler){var eventDispatcher=com.cs.util.event.getInstance(element);eventDispatcher.addEventObserver(eventName,handler);}
com.cs.util.event.RemoveEventObserver=function(element,eventName,handler){if(!element&&!eventName&&!handler){com.cs.util.event.RemoveAllEventObservers();}
else if(!eventName&&!handler){com.cs.util.event.RemoveAllEventObserversFor(element);}
else if(!handler){com.cs.util.event.RemoveAllEventObserversForEvent(element,eventName);}
else{var eventDispatcher=com.cs.util.event.getInstance(element);eventDispatcher.removeEventObserver(eventName,handler);}}
com.cs.util.event.RemoveAllEventObserversForEvent=function(element,eventName){var eventDispatcher=com.cs.util.event.getInstance(element);eventDispatcher.removeAllEventsFor(eventName);}
com.cs.util.event.RemoveAllEventObserversFor=function(element){var eventDispatcher=com.cs.util.event.getInstance(element);eventDispatcher.removeAllHandlers();}
com.cs.util.event.RemoveAllEventObservers=function(){for(var i=0;i<com.cs.util.event.EVENT_DISPATCHERS.length;i++){var ed=com.cs.util.event.EVENT_DISPATCHERS[i];ed.removeAllHandlers();}}
com.cs.initClass("com.cs.util.FormUtil");com.cs.util.FormUtil.getSelectedRadioButtonFromGroup=function(groupID){var i=0;while(dojo.byId(groupID+"_"+i)){var rd=dojo.byId(groupID+"_"+i);if(rd.checked)return rd;i++;}
return null;}
com.cs.util.FormUtil.getSelectedRadioButtonValueFromGroup=function(groupID){var rd=com.cs.util.FormUtil.getSelectedRadioButtonFromGroup(groupID);if(rd!=null){return rd.value;}
return null;}
com.cs.util.FormUtil.initAllButtonsRolloverClasses=function(CSSClassUp,CSSClassOver){dojo.addOnLoad(function(){dojo.query("input[type='button']").forEach(function(btn){dojo.connect(btn,"mouseover",function(){btn.className=CSSClassOver;});dojo.connect(btn,"mouseout",function(){btn.className=CSSClassUp;});});});}
com.cs.initClass("com.cs.util.General");com.cs.util.General.getPageHeight=function(){if(window.innerHeight&&window.scrollMaxY){pageHeight=window.innerHeight+window.scrollMaxY;}
else if(document.body.scrollHeight>document.body.offsetHeight)
{pageHeight=document.body.scrollHeight;}
else
{pageHeight=document.body.offsetHeight+document.body.offsetTop;}
return pageHeight;}
com.cs.util.General.getPageWidth=function(){if(window.innerWidth&&window.scrollMaxX){pageWidth=window.innerWidth+window.scrollMaxX;}
else if(document.body.scrollWidth>document.body.offsetWidth)
{pageWidth=document.body.scrollWidth;}
else
{pageWidth=document.body.offsetWidth+document.body.offsetLeft;}
return pageWidth;}
com.cs.util.General.getScrollX=function(){if(window.pageXOffset)return window.pageXOffset;if(document.documentElement&&document.documentElement.scrollLeft)return document.documentElement.scrollLeft;if(document.body.scrollLeft)return document.body.scrollLeft;return 0;}
com.cs.util.General.getScrollY=function(){if(window.pageYOffset)return window.pageYOffset;if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;if(document.body.scrollTop)return document.body.scrollTop;return 0;}
com.cs.util.General.getWindowWidth=function(){if(document.documentElement&&document.documentElement.clientWidth)return document.documentElement.clientWidth;if(window.innerWidth)return window.innerWidth;if(document.body.clientWidth)return document.body.clientWidth;return 0;}
com.cs.util.General.getWindowHeight=function(){if(window.innerHeight)return window.innerHeight;if(document.documentElement&&document.documentElement.clientHeight)return document.documentElement.clientHeight;if(document.body.clientHeight)return document.body.clientHeight;return 0;}
com.cs.util.General.getWindowX=function(){if(window.screenLeft)return window.screenLeft;if(window.screenX)return window.screenX;return 0;}
com.cs.util.General.getWindowY=function(){if(window.screenTop)return window.screenTop;if(window.screenY)return window.screenY;return 0;}
com.cs.util.General.getMouseX=function(event){mouse=event||window.event;return(mouse.clientX+com.cs.util.General.getScrollX());}
com.cs.util.General.getMouseY=function(event){mouse=event||window.event;return(mouse.clientY+com.cs.util.General.getScrollY());}
com.cs.util.General.scrollWindowToCenterWidth=function(){var f=window.scroll||window.scrollTo;var windowWidth=com.cs.util.General.getWindowWidth();var pageWidth=com.cs.util.General.getPageWidth();if(pageWidth>windowWidth){var scrollOffset=(pageWidth-windowWidth)/2;f(scrollOffset,com.cs.util.General.getScrollY());}}
com.cs.util.General.scrollWindowToCenterHeight=function(){var f=window.scroll||window.scrollTo;var windowHeight=com.cs.util.General.getWindowHeight();var pageHeight=com.cs.util.General.getPageHeight();if(pageHeight>windowHeight){var scrollOffset=(pageHeight-windowHeight)/2;f(com.cs.util.General.getScrollX(),scrollOffset);}}
com.cs.util.General.scrollWindowToCenter=function(){com.cs.util.General.scrollWindowToCenterHeight();com.cs.util.General.scrollWindowToCenterWidth();}
com.cs.initClass("com.cs.util.LoadUtil");com.cs.util.LoadUtil=new Object();com.cs.util.LoadUtil.loadJSFile=function(path){var js=document.createElement('script');js.setAttribute('type','text/javascript');js.setAttribute('src',path);js.setAttribute('defer','defer');document.getElementsByTagName('HEAD')[0].appendChild(js);alert("Load: "+path);}
com.cs.initClass("com.cs.util");com.cs.util.Number=new Object();Number.prototype.toCurrency=function(currencySymbol,noFractions,thousandsSeparator){var n,startAt,intLen;var decimalSeparator=".";if(currencySymbol==null)currencySymbol='�';if(decimalSeparator==null)decimalSeparator=".";if(thousandsSeparator==null)thousandsSeparator=",";n=this.round(noFractions?0:2,true,decimalSeparator);intLen=n.length-(noFractions?0:3);if((startAt=intLen%3)==0)startAt=3;for(var i=0,len=Math.ceil(intLen/3)-1;i<len;i++)n=n.insertAt(i*4+startAt,thousandsSeparator);return currencySymbol+n;}
Number.prototype.toInteger=function(thousandsSeparator){var n,startAt,intLen;if(thousandsSeparator==null)thousandsSeparator="";n=this.round(0,true);intLen=n.length;if((startAt=intLen%3)==0)startAt=3;for(var i=0,len=Math.ceil(intLen/3)-1;i<len;i++)n=n.insertAt(i*4+startAt,thousandsSeparator);return n;}
Number.prototype.round=function(decimals,returnAsString,decimalSeparator){var n,factor,breakPoint,whole,frac;if(!decimals)decimals=0;factor=Math.pow(10,decimals);n=(this.valueOf()+"");if(!returnAsString)return Math.round(n*factor)/factor;if(!decimalSeparator)decimalSeparator=".";if(n==0)return"0."+((factor+"").substr(1));breakPoint=(n=Math.round(n*factor)+"").length-decimals;whole=n.substr(0,breakPoint);if(decimals>0){frac=n.substr(breakPoint);if(frac.length<decimals)frac=(Math.pow(10,decimals-frac.length)+"").substr(1)+frac;return whole+decimalSeparator+frac;}else return whole+((Math.pow(10,-decimals)+"").substr(1));}
Number.prototype.toString=function(decimalNum,bolLeadingZero,bolParens,bolCommas)
{if(com.cs.general==null||com.cs.general.Text==null)
{alert('Please include [com.cs.general.Text] for Number.toString() to work');}
else
{return com.cs.general.Text.FormatNumber(this.valueOf(),decimalNum,bolLeadingZero,bolParens,bolCommas);}}
com.cs.initClass("com.cs.util.String");String.prototype.insertAt=function(loc,strChunk){return(this.valueOf().substr(0,loc))+strChunk+(this.valueOf().substr(loc))}
com.cs.util.String.countWords=function(str){return com.cs.util.String.getWords(str).length;}
com.cs.util.String.getWords=function(str){var y=str;var r=0;a=y.replace(/\s/g,' ');a=a.split(' ');var words=new Array();for(z=0;z<a.length;z++){if(a[z].length>0){words.push(a[z]);}}
return words;}
com.cs.util.String.getWordIndex=function(str,wordIndex){var index=0;var isWhiteSpace=true;for(var i=0;i<str.length;i++){var chr=str.charAt(i);if(chr==" "||chr=="\r"||chr=="\n"||chr=="\t"){isWhiteSpace=true;}
else{if(isWhiteSpace){isWhiteSpace=false;if(index==wordIndex)return i;index++;}}}}
com.cs.initClass("com.cs.util.URLUtil");com.cs.util.URLUtil=function(url){url=url.toString();this.protocol="";this.hostName="";this.sections=new Array();this.queryString="";this.queryStringParams=new Object();if(url.indexOf("?")!=-1){this.queryString=url.substring(url.indexOf("?")+1);url=url.substring(0,url.indexOf("?"));}
var qParams=this.queryString.split("&");for(var i=0;i<qParams.length;i++){var value=qParams[i];var vals=value.split("=");var varName=vals[0];var varValue=vals[1];if(varName&&varValue){this.queryStringParams[varName]=varValue;}}
this.getLastSection=function(){return this.sections[this.sections.length-1];}
this._protocolArray=["http","https","ftp","mmc"];for(var i=0;i<this._protocolArray.length;i++){var prot=this._protocolArray[i]+"://";if(url.indexOf(prot)!=-1){this.protocol=prot;}}
if(this.protocol){this.hostName=url.substring(0,url.indexOf("/",this.protocol.length));}
this.sections=url.substring(this.hostName.length+1).split("/");var scope=this;this.setParameter=function(paramName,paramValue){scope.queryStringParams[paramName]=paramValue;}
this.getParameter=function(paramName){return scope.queryStringParams[paramName];}
this.removeParameter=function(paramName){scope.queryStringParams[paramName]=null;}
this.toString=function(){var s="";s=scope.hostName;for(var i=0;i<scope.sections.length;i++){s+="/"+scope.sections[i];}
var queryString="";for(var x in scope.queryStringParams){var value=scope.queryStringParams[x];if(value){if(queryString!="")queryString+="&";queryString+=x+"="+value;}}
if(queryString){s+="?"+queryString;}
return s;}}
com.cs.initClass("com.cs.url.QueryString");com.cs.url.QueryString=function(url){this.url=url;this.params=new Object();var scope=this;this.initQueryString=function(){var qs=scope.url;var index=qs.indexOf("?");if(index!=-1)qs=qs.substring(index+1);scope.params=dojo.queryToObject(qs);}
this.init=function(){scope.initQueryString();}
this.init();}
com.cs.initClass("com.cs.ui");com.cs.ui.Element=function(elementID)
{var scope=this;this.classRollover='';this.classNormal='';this.element=null;this.elementID=elementID;this.HelpMessage=new com.cs.ui.HelpMessage(null);this.onfocus=function()
{}
this.onmouseover=function()
{if(scope.classRollover!='')
{scope.element.className=scope.classRollover;}}
this.onmouseout=function()
{if(scope.classRollover!='')
{scope.element.className=scope.classNormal;}}
this.onload=function()
{scope.element=dojo.byId(scope.elementID);if(scope.element!=null)
{scope.element._element=scope;scope.classNormal=scope.element.className;scope.HelpMessage.mainElement=scope.element;dojo.connect(scope.element,"onfocus",scope,scope.onfocus);dojo.connect(scope.element,"onmouseover",scope,scope.onmouseover);dojo.connect(scope.element,"onmouseout",scope,scope.onmouseout);scope.HelpMessage.init();}}
dojo.addOnLoad(scope.onload);}
com.cs.initClass("com.cs.ui.form");com.cs.ui.form.FORM=null;if(com.cs.ui.form.defaultCSSClasses==null)
{com.cs.ui.form.defaultCSSClasses={CLASS_NOFOCUS:'field-nofocus',CLASS_NOFOCUS_OVER:'field-nofocus-over',CLASS_FOCUS:'field-focus',CLASS_ERROR:'field-error',CLASS_ERROR_OVER:'field-error-over',CLASS_ERROR_FOCUS:'field-errorfocus',CLASS_DISABLED:'field-disabled',CLASS_READONLY:'field-readonly',CLASS_REQUIRED:'required',CLASS_BUTTON_UP:'button',CLASS_BUTTON_OVER:'button_over',CLASS_BUTTON_DISABLED:'button_disabled',NotUsed:false}}
com.cs.ui.form.defaultFieldClasses=com.cs.ui.form.defaultCSSClasses;com.cs.ui.form.Forms=function(){this._forms=new Object();this._items=new Object();this._keyHandler=null;this._keyEnterEnabled=true;this._fieldFocus=null;this._currentForm=null;this.onPreValidation=function(form){return true;}
this.onPostValidation=function(form){return true;}
this.onPreValidation=this.onPostValidation=null;this.onSubmit=function(form){}
this._enterPressed=function(){if(this._keyEnterEnabled){this.clickCurrentFormDefaultButton();}}
this._keyUp=function(k){if(k.keyCode==dojo.keys.ENTER){if(this.focus().element().tagName.toLowerCase()!="textarea"){this._enterPressed();}}}
this._initKeyHandler=function(init){if(init){if(!this._keyHandler)
{this._keyHandler=dojo.connect(dojo.body(),"onkeyup",this,this._keyUp);}}
else{if(this._keyHandler){dojo.disconnect(this._keyHandler);this._keyHandler=null;}}}
this._getForm=function(groupID){if(!groupID)groupID="__MAIN";var f=this._forms[groupID];if(!f){f=new com.cs.ui.form.Form(groupID);this._forms[groupID]=f;}
return f;}
this.addField=function(field){var validationGroup=field.validationGroup();var form=this._getForm(validationGroup);var fieldID=field.id();this._items[fieldID]=field;form.addField(field);}
this.addGroup=function(group){var id=group.id();var validationGroup=group.validationGroup();var form=this._getForm(validationGroup);this._items[id]=group;form.addGroup(group);}
this.addButton=function(button){var id=button.id();var validationGroup=button.validationGroup();var form=this._getForm(validationGroup);this._items[id]=button;form.addButton(button);}
this.focus=function(value){if(arguments.length==0){return this._fieldFocus;}
else{this._fieldFocus=value;this._initKeyHandler(value!=null);if(value==null){}
else{this._currentForm=this._fieldFocus.form();}}}
this.clickCurrentFormDefaultButton=function(){var form=this.currentForm();if(form){if(form.defaultButton()==undefined){alert("No default button found for form: "+form._validationGroup);return;}
var keyBefore=this._keyEnterEnabled;this._keyEnterEnabled=false;if(form.defaultButton().element().onclick){com.cs.ui.form.CLICKED_BUTTON=true;form.defaultButton().element().onclick();com.cs.ui.form.CLICKED_BUTTON=false;}
else if(form.defaultButton().onClick){form.defaultButton().onClick();}
setTimeout(dojo.hitch(this,function(){this._keyEnterEnabled=keyBefore;}),250)}}
this.currentForm=function(value)
{if(arguments.length==0)
return this._currentForm;else
this._currentForm=value;}
this.validateCurrentForm=function(){var form=this.currentForm();if(form!=null){var errors=form.validate();if(errors==null||errors.length==0)
{if(com.cs.forms!=null&&com.cs.forms.FileUploader!=null&&com.cs.forms.FileUploader.instance!=null)
{if(com.cs.ui.form._hasFileUpload){com.cs.forms.FileUploader.instance.Start();}}}
return errors;}
else{console.log('No form found');return new Array();}}
this.init=function(){}
this.byId=function(id){return this._items[id];}
this.getFormById=function(id){return this._forms[id];}
this.clearForm=function(formValidationGroupID){this._forms[formValidationGroupID]=null;}
this.enterKeyEnabled=function(value){if(arguments.length){this._keyEnterEnabled=value==true;}
else{return this._keyEnterEnabled;}}
this.toString=function(){return"[com.cs.ui.form.Forms]"}}
com.cs.ui.form.Forms.instance=function(){return com.cs.ui.form.FORM;}
com.cs.ui.form.submitCurrentForm=function(){com.cs.ui.form.Forms.instance().currentForm().submit();}
com.cs.ui.form.FORM=new com.cs.ui.form.Forms();com.cs.ui.form.Form=function(validationGroup){this._validationGroup=validationGroup;this._fields=new Array();this._buttons=new Array();this._groups=new Array();this.onPreValidation=function(){return true;}
this.onPostValidation=function(){return true;}
this.onSubmit=function(){}
this.onPreValidation=this.onPostValidation=null;this.init=function(){}
this.submit=function(clickDefaultButton,doNotTriggerSubmitEvent){if((!this.onPreValidation&&(!com.cs.ui.form.Forms.instance().onPreValidation||com.cs.ui.form.Forms.instance().onPreValidation(this)))||(this.onPreValidation&&this.onPreValidation())){if(this.validate().length==0){if((!this.onPostValidation&&(!com.cs.ui.form.Forms.instance().onPostValidation||com.cs.ui.form.Forms.instance().onPostValidation(this)))||(this.onPostValidation&&this.onPostValidation())){if(!doNotTriggerSubmitEvent){this.onSubmit();com.cs.ui.form.Forms.instance().onSubmit(this);}
var defBtn=this.defaultButton();if(clickDefaultButton&&defBtn.onClick){this.defaultButton().onClick();}
return true;}}}
return false;}
this.validate=function(){var errors=new Array();var alertMsg="";var firstErrorField=null;for(var i=0;i<this._fields.length;i++){var f=this._fields[i];f.hasError(false);var errMsg=f.validate(true);if(errMsg){var e=new com.cs.ui.form.FormError(f,errMsg);errors.push(e);if(alertMsg)alertMsg+="\r\n";alertMsg+=e.errorMsg();if(!firstErrorField){firstErrorField=f;}}}
for(var i=0;i<this._groups.length;i++){var g=this._groups[i];var errs=g.validate(true,firstErrorField==null);if(errs){for(var j=0;j<errs.length;j++){var e=errs[j];errors.push(e);if(alertMsg)alertMsg+="\r\n";alertMsg+=e.errorMsg();}}}
if(alertMsg){alert(alertMsg);}
if(firstErrorField){firstErrorField.focus(true);}
return errors;}
this.addField=function(field){field.form(this);this._fields.push(field);}
this.addGroup=function(group){group.form(this);this._groups.push(group);}
this.addButton=function(button){button.form(this);this._buttons.push(button);}
this.groups=function(){return this._groups;}
this.buttons=function(){return this._buttons;}
this.defaultButton=function(){var b=this._buttons[0];for(var i=0;i<this._buttons.length;i++){var btn=this._buttons[i];if(btn._defaultButton){b=btn;break;}}
return b;}
this.toString=function(){return"[com.cs.ui.form.Form - "+this._validationGroup+"]";}
this.init();}
com.cs.ui.form.FormError=function(fieldOrGroup,errorMsg){this._item=fieldOrGroup;this._errorMsg=errorMsg;this.init=function(){}
this.item=function(){return this._item;}
this.errorMsg=function(){return this._errorMsg;}
this.toString=function(){return"[com.cs.ui.form.FieldError - "+item.id()+" - "+errorMsg+"]";}
this.init();}
com.cs.ui.form.FieldGroup=function(fieldIDs,groupParams,validationGroup,groupID){this._id=groupID;this._params=groupParams;this._validationGroup=validationGroup;this._groupID=groupID;this._error=false;this._form=null;this._fieldIDs=fieldIDs;this._fields=new Array();this._initGroupWithForm=function(){com.cs.ui.form.Forms.instance().addGroup(this);}
this._initFields=function(){for(var i=0;i<this._fieldIDs.length;i++){this.addFieldToGroup(this._fieldIDs[i]);}}
this._setError=function(value){for(var i=0;i<this._fields.length;i++){var f=this._fields[i];}}
this.init=function(){this._initFields();this._initGroupWithForm();}
this.validate=function(showError,focusOnFirstErrorField){var errs=new Array();var oneFieldFilled=false;var areFieldValuesSimilar=true;var lastValue=null;var allFieldsRequired=!this._params.sameValues&&!this._params.atLeastOneIsRequired;var firstErrorField=false;var fieldsStr="";for(var i=0;i<this._fields.length;i++){var f=this._fields[i];if(i>0){if(i==this._fields.length-1){fieldsStr+=" & ";}
else{fieldsStr+=", ";}}
if(!oneFieldFilled&&!f.empty()){oneFieldFilled=true;}
fieldsStr+=f.title();}
if(oneFieldFilled||this._params.atLeastOneIsRequired){var lastValue=null;var similar=true;for(var i=0;i<this._fields.length;i++){var f=this._fields[i];if(!oneFieldFilled&&this._params.atLeastOneIsRequired){if(!firstErrorField)firstErrorField=f;f.hasError(true);if(i==0){errs.push(new com.cs.ui.form.FormError(this,fieldsStr+" - At least one of the fields must be filled"));}}else if(f.required()&&f.empty()){if(!firstErrorField)firstErrorField=f;errs.push(new com.cs.ui.form.FormError(f,f.title()+" is required"));f.hasError(true);}
if(this._params.sameValues){var value=f.value();if(lastValue==null){lastValue=value;}
else{if(lastValue!=value){if(similar){similar=false;errs.push(new com.cs.ui.form.FormError(this,fieldsStr+" - Value does not match"));}
f.hasError(true);;}}}}}
if(focusOnFirstErrorField&&firstErrorField){firstErrorField.focus(true);}
return errs;}
this.validationGroup=function(){return this._validationGroup;}
this.addFieldToGroup=function(field){var fieldID=field;if(fieldID instanceof com.cs.ui.form.Field){fieldID=fieldID.id();}
else if(typeof(fieldID)=="object"){fieldID=fieldID.id;}
var field=com.cs.ui.form.Forms.instance().byId(fieldID);if(!field)throw new Error("com.cs.ui.form.FieldGroup: Field with id '"+fieldID+"' not found.");this._fields.push(field);field.groups().push(this);}
this.form=function(value){if(!arguments.length){return this._form;}
else{this._form=value;}}
this.hasError=function(value){if(!arguments.length){return this._error;}
else{this._error=value;}}
this.id=function(){return this._id;}
this.toString=function(){return"[com.cs.ui.form.FieldGroup - "+this._id+" ("+this._fields.length+" fields)]"}
this.init();}
com.cs.ui.form.Field=function(element,title,parameters,validationGroup,customCSSClasses,groupParams){if(title&&typeof(title)!="string")throw new Error("com.cs.ui.form.Field: Second parameter must be title {String}");this._element=dojo.byId(element);if(!this._element)throw new Error("com.cs.ui.form.Field: Element '"+element+"' not found in DOM.")
this._form=null;this._groups=new Array();this._title=title;this._error=false;this._focus=false;this._cssHandler=null;this._fieldValidator=null;this._inputConstraint=null;this._params=parameters;this._validationGroup=validationGroup;this._fieldFocus=function()
{this._focus=true;this._cssHandler.update();com.cs.ui.form.Forms.instance().focus(this);}
this._fieldBlur=function(){this._focus=false;this._cssHandler.update();com.cs.ui.form.Forms.instance().focus(null);if(!this._params.doNotValidateOnBlur){this.validate(true);}}
this._initHandlers=function(){dojo.connect(this._element,"focus",this,this._fieldFocus);dojo.connect(this._element,"blur",this,this._fieldBlur);}
this._initFieldWithForm=function(){com.cs.ui.form.Forms.instance().addField(this);}
this._initGroup=function(){if(groupParams){var groupID=groupParams.groupID;if(groupID){var g=com.cs.ui.form.Forms.instance().byId(groupID);if(g!=null&&!(g instanceof com.cs.ui.form.FieldGroup)){alert("An item with id '"+groupID+"' exists while it should be a group not a '"+g+"'.  Please change group id.")}
if(g){g.addFieldToGroup(this);}
else{new com.cs.ui.form.FieldGroup([this.id()],groupParams,validationGroup,groupID);}}}}
this.init=function(){this._initFieldWithForm();this._initHandlers();this._cssHandler=new com.cs.ui.form.FieldCSSHandler(this,customCSSClasses);this._inputConstraint=new com.cs.ui.form.FieldInputConstraint(this,this._params);this._fieldValidator=new com.cs.ui.form.FieldValidator(this,this._params);this._initGroup();}
this.validate=function(showError){var errorMsg=this._fieldValidator.validate();if(showError&&errorMsg){this.hasError(true);}
else{this.hasError(false);}
return errorMsg;}
this.element=function(){return this._element;}
this.validationGroup=function(){return this._validationGroup;}
this.requiredGroup=function(){return this._requiredGroup;}
this.requiredGroupOne=function(){return this._requiredGroupOne;}
this.form=function(value){if(!arguments.length){return this._form;}
else{this._form=value;}}
this.disabled=function(value){if(arguments.length){this._element.disabled=value;if(!value)this._focus=false;this._cssHandler.update();}
else{return this._element.disabled;}}
this.required=function(value){if(arguments.length){this._params.isRequired=value;this._cssHandler.update();}
else{return this._params.isRequired==true;}}
this.hasError=function(value){if(arguments.length){this._error=value;this._cssHandler.update();}
else{return this._error;}}
this.title=function(value)
{if(arguments.length){this._title=value;}
else{return this._title;}}
this.params=function(){return this._params;}
this.readOnly=function(value){if(arguments.length){this._element.readOnly=value;this._cssHandler.update();}
else{return this._element.readOnly;}}
this.value=function(value){if(arguments.length){switch(this._element.type.toLowerCase()){case"checkbox":case"radio":if(value==true||value==false){if(value=="")value=false;this._element.checked=value;}
else if(value==this._element.value){this._element.checked=true;}
else{this._element.checked=false;}
break;default:this._element.value=value;break;}}
else{switch(this._element.type.toLowerCase()){case"checkbox":case"radio":if(this._element.checked){if(this._element.value!="on"&&this._element.value){return this._element.value;}
else{return this._element.checked;}}
else{if(this._element.value!="on"&&this._element.value){return null;}
else{return this._element.checked;}}
break;default:return this._element.value;break;}}}
this.empty=function(){var val=this.value();return!val;}
this.words=function(){var val=this.value();val=dojo.trim(val);return val.split(" ");}
this.groups=function(){return this._groups;}
this.id=function(){return this._element.id;}
this.focus=function(value){if(arguments.length){if(value&&this.disabled())value=false;if(value){this._element.focus();}
else{this._element.blur();}
this._focus=value;}
else{return this._focus;}}
this.clear=function(){this.value("");}
this.toString=function(){return"[com.cs.ui.form.Field - "+this.id()+"]"}
this.init();}
com.cs.ui.form.FieldCSSHandler=function(field,customCSSClasses){if(!customCSSClasses)customCSSClasses=com.cs.ui.form.defaultCSSClasses;this._field=field;this._cssNoFocus=customCSSClasses.CLASS_NOFOCUS||com.cs.ui.form.defaultCSSClasses.CLASS_NOFOCUS;this._cssNoFocusOver=customCSSClasses.CLASS_NOFOCUS_OVER||com.cs.ui.form.defaultCSSClasses.CLASS_NOFOCUS_OVER;this._cssFocus=customCSSClasses.CLASS_FOCUS||com.cs.ui.form.defaultCSSClasses.CLASS_FOCUS;this._cssError=customCSSClasses.CLASS_ERROR||com.cs.ui.form.defaultCSSClasses.CLASS_ERROR;this._cssErrorOver=customCSSClasses.CLASS_ERROR_OVER||com.cs.ui.form.defaultCSSClasses.CLASS_ERROR_OVER;this._cssErrorFocus=customCSSClasses.CLASS_ERROR_FOCUS||com.cs.ui.form.defaultCSSClasses.CLASS_ERROR_FOCUS;this._cssDisabled=customCSSClasses.CLASS_DISABLED||com.cs.ui.form.defaultCSSClasses.CLASS_DISABLED;this._cssReadOnly=customCSSClasses.CLASS_READONLY||com.cs.ui.form.defaultCSSClasses.CLASS_READONLY;this._cssRequired=customCSSClasses.CLASS_REQUIRED||com.cs.ui.form.defaultCSSClasses.CLASS_REQUIRED;this._isMouseOver=false;this._mouseOver=function(){this._isMouseOver=true;this.update();}
this._mouseOut=function(){this._isMouseOver=false;this.update();}
this.updateCSS=function(css){if(css){this._field.element().className=css;}}
this.update=function(){if(this._field.element().type=="checkbox"||this._field.element().type=="radio")return;if(!this._field.disabled()&&!this._field.readOnly()){if(!this._field.focus()){if(this._field.hasError()){if(!this._isMouseOver){this.updateCSS(this._cssError);}
else{this.updateCSS(this._cssErrorOver);}}
else{if(!this._isMouseOver){this.updateCSS(this._cssNoFocus);}
else{this.updateCSS(this._cssNoFocusOver);}}}
else{if(this._field.hasError()){this.updateCSS(this._cssErrorFocus);}
else{this.updateCSS(this._cssFocus);}}}
else{if(this._field.disabled()){this.updateCSS(this._cssDisabled);}
else if(this._field.readOnly()){this.updateCSS(this._cssReadOnly);}}
if(this._field.required()){this._field.element().className+=" "+this._cssRequired;}}
this.init=function(){dojo.connect(this._field.element(),"onmouseover",this,this._mouseOver);dojo.connect(this._field.element(),"onmouseout",this,this._mouseOut);this.update();}
this.init();}
com.cs.ui.form.FieldInputConstraint=function(field,validationParams){this._field=field;this._params=validationParams;this._lastValue="";this._regExpUnAllowedChars=null;this._regExpAllowedPattern=null;this.MAX_INVALID_ATTEMPTS=5;this._invalidAttempt=0;this._onBlur=function(){if(this._params.isDate){var value=this._field.value();value=value.replace(/[-.]/g,"/");this._field.value(value);}}
this._initRegExp=function(){var allowedChars=null;var allowedPattern=null;if(this._params.isEmail){allowedChars="a-zA-Z0-9@._%+-"
allowedPattern="^[a-zA-Z0-9._%+-]*$";allowedPattern+="|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]*$";}
else if(this._params.isNumber){allowedChars="0-9";allowedPattern="^[-+0-9][0-9.]*$";if(!this._params.integersOnly){allowedChars+=".";}
if(!this._params.negativeOnly){allowedChars+="+";}
else{allowedPattern="^[-0-9][0-9.]*";}
if(!this._params.positiveOnly){allowedChars+="-";}
else{allowedPattern="^[+0-9][0-9.]*";}}
else if(this._params.isCurrency){}
else if(this._params.isCreditCardNumber){allowedChars="0-9";allowedPattern="^[0-9]{0,16}$";}
else if(this._params.isIPAddress){allowedChars="0-9.";allowedPattern="^[0-9]{0,3}$"
allowedPattern+="|^[0-9]{0,3}\\.[0-9]{0,3}$"
allowedPattern+="|^[0-9]{0,3}\\.[0-9]{0,3}\\.[0-9]{0,3}$"
allowedPattern+="|^[0-9]{0,3}\\.[0-9]{0,3}\\.[0-9]{0,3}\\.[0-9]{0,3}$";}
else if(this._params.isDate){allowedChars="0-9/ :.amAMPMpm-";allowedPattern="^[0-9]{0,2}$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}[/.-][0-9]{0,4}$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}[/.-][0-9]{0,4} [0-9]{0,2}$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}[/.-][0-9]{0,4} [0-9]{0,2}[:][0-9]{0,2}$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}[/.-][0-9]{0,4} [0-9]{0,2}[:][0-9]{0,2} ?(a|m|p|A|M|P|am|pm|AM|PM)?$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}[/.-][0-9]{0,4} [0-9]{0,2}[:][0-9]{0,2}[:][0-9]{0,2}$";allowedPattern+="|^[0-9]{0,2}[/.-][0-9]{0,2}[/.-][0-9]{0,4} [0-9]{0,2}[:][0-9]{0,2}[:][0-9]{0,2} ?(a|m|p|A|M|P|am|pm|AM|PM)?$";}
else if(this._params.isAlphaNumeric){allowedChars="a-zA-Z0-9_";}
if(allowedChars){this._regExpUnAllowedChars=new RegExp("[^"+allowedChars+"]+");}
if(allowedPattern){this._regExpAllowedPattern=new RegExp(allowedPattern);}}
this._showUnAllowedCharacters=function(exceedLength,exceedWords){var msg="The character you are trying to input in this field is not allowed.\r\n\r\n"
if(this._params.isEmail){msg+="Please enter a valid email address in this field, e.g. yourname@yourdomain.com.";}
else if(this._params.isNumber){if(this._params.positiveOnly){msg+="Please enter only valid positive ";if(this._params.integersOnly){msg+="whole ";}
msg+="numbers.";}
else
if(this._params.negativeOnly){msg+="Please enter only valid negative ";if(this._params.integersOnly){msg+="whole ";}
msg+="numbers.";}
else{msg+="Please enter a number.";}}else if(this._params.isDate){msg+="Please enter a valid date in this field, e.g. 16/04/2008 03:32."}
else if(this._params.isAlphaNumeric){msg+="Please enter only alpha numerical characters in this field.";}
else if(this._params.isIPAddress){msg+="Please enter a valid IP address in this field, e.g. 192.168.2.10";}
else if(this._params.isCreditCardNumber){msg+="Please enter a valid credit card number, e.g. 4552 7204 1234 5678"}
alert(msg);}
this._onChange=function(){var newValue=this._field.value();var isCharactersUnallowed=false;var isPatternAllowed=true;if(this._regExpUnAllowedChars){isCharactersUnallowed=this._regExpUnAllowedChars.test(newValue);}
if(this._regExpAllowedPattern){isPatternAllowed=this._regExpAllowedPattern.test(newValue);}
var ok=!isCharactersUnallowed&&isPatternAllowed;var exceedLength=false;var exceedWords=false;if(this._params.maxLength>0){exceedLength=newValue.length>this._params.maxLength;}
if(this._params.maxWords>0){exceedWords=this._field.words().length>this._params.maxWords;}
if(newValue&&!ok||exceedLength||exceedWords){this._field.value(this._lastValue);if(!ok){this._invalidAttempt++;if(this._invalidAttempt==this.MAX_INVALID_ATTEMPTS){this._invalidAttempt=0;this._showUnAllowedCharacters(exceedLength,exceedWords);}}
else if(exceedLength){alert("You cannot enter more than "+this._params.maxLength+" character"+(this._params.maxLength==1?"":"s")+" in this field.");}
else if(exceedWords){alert("You cannot enter more than "+this._params.maxWords+" word"+(this._params.maxLength==1?"":"s")+" in this field.");}}
else{this._lastValue=newValue;}}
this._initHandlers=function(){if(this._field.element().type!="checkbox"&&this._field.element().type!="radio"){dojo.connect(this._field.element(),"onkeyup",this,this._onChange);this._onChange();dojo.connect(this._field.element(),"onblur",this,this._onBlur);this._onBlur();}}
this.init=function(){this._initRegExp();this._initHandlers();}
this.init();}
com.cs.ui.form.FieldValidator=function(field,validationParams){this._field=field;this._params=validationParams;this.validate=function(){if(field.element().disabled)return null;var title=field.title();if(this._params.isRequired&&this._field.empty()){return title+" is required";}
if(!this._field.empty()){if(this._field.element().type!="checkbox"&&this._field.element().type!="radio"){var value=this._field.value();var objErr=new Object();if(this._params.isEmail){if(!com.cs.forms.validation.isEmail(value)){return title+" must be a valid email address";}}
else
if(this._params.isNumber){if(!com.cs.forms.validation.isNumber(value,this._params,objErr,title)){return objErr.errorMsg;}}
else
if(this._params.isAlphaNumeric){if(!com.cs.forms.validation.isAlphaNumeric(value)){return title+" must contain only alpha numerical characters i.e. letters, digits and underscore (_)"}}
else
if(this._params.isDate){if(!com.cs.forms.validation.isDate(value,this._params,objErr,title)){return objErr.errorMsg;}}
else
if(this._params.isIPAddress){if(!com.cs.forms.validation.isIPAddress(value)){return title+" must be a valid IP address, e.g. 192.168.210.123";}}
else
if(this._params.isCreditCardNumber){if(!com.cs.forms.validation.isCreditCardNumber(value)){return title+" must be a valid credit card number";}}
if(this._params.minLength>0||this._params.maxLength||this._params.maxWords){if(this._params.minLength&&value.length<this._params.minLength){return title+" cannot contain less than "+this._params.minLength+" character"+(this._params.minLength>1?"s":"");}
if(this._params.maxLength&&value.length>this._params.maxLength){return title+" cannot contain more than "+this._params.maxLength+" character"+(this._params.maxLength>1?"s":"");}
if(this._params.maxWords&&this._field.words().length>this._params.maxWords){return title+" cannot contain more than "+this._params.maxWords+" word"+(this._params.maxWords>1?"s":"");}}
if(this._params.fileExtensionsAllowed){var extensions='';if(this._params.fileExtensionsAllowed instanceof Array)
{for(var i=0;i<this._params.fileExtensionsAllowed.length;i++)
{if(i>0)
extensions+=',';extensions+=this._params.fileExtensionsAllowed[i];}}
else{extensions=this._params.fileExtensionsAllowed;}
extensions=extensions.replace(/[; |:-]/g,",");extensions=extensions.replace(/\./g,"");var aExtensions=extensions.split(",");var found=false;var allowedExtensions="";var many=false;for(var i=0;i<aExtensions.length;i++){var extension=dojo.trim(aExtensions[i]);if(extension){extension="."+extension.toLowerCase();var indexOf=value.toLowerCase().indexOf(extension);if(indexOf!=-1&&indexOf==value.length-extension.length){found=true;break;}
if(allowedExtensions){allowedExtensions+=", ";many=true;}
allowedExtensions+=extension;}}
if(!found){if(many){return title+" must be a file with one of the following extensions: "+allowedExtensions;}
else{return title+" must be a file with a "+allowedExtensions+" file extension";}}}
if(this._params.valueIn){var found=com.cs.forms.validation.isValueIn(value,this._params.valueIn,this._params.valueCaseSensitive);if(!found){var valuesAllowed=this._params.valueIn.join(", ");var msg=title+" must be ";if(this._params.valueIn.length>1){msg+="one of: "+valuesAllowed;}
else{msg+=valuesAllowed;}
if(this._params.valueCaseSensitive)
msg+=" (case-sensitive)";return msg;}}
if(this._params.regExpPattern){if(typeof(this._params.regExpPattern)=="string"){this._params.regExpPattern=new RegExp(this._params.regExpPattern);}
var regExp=this._params.regExpPattern;if(!this._params.regExpPattern.test(value)){return title+" - Invalid Value";}}}}}}
com.cs.ui.form.Button=function(element,validationGroup,defaultButton,confirmMessage){this._element=dojo.byId(element);this._defaultButton=defaultButton;this._validationGroup=validationGroup;this._confirmMessage=confirmMessage;this._form=null;this._element.Button=this;this._onClickFunction=null;this.onClick=function(){}
this._btnMouseDown=function(){com.cs.ui.form.Forms.instance().currentForm(this._form);}
this._btnFocus=function(){com.cs.ui.form.Forms.instance().currentForm(this._form);}
this._btnMouseUp=function()
{}
this._btnClick=function(){if(!this._confirmMessage||(this._confirmMessage&&confirm(this._confirmMessage))){com.cs.ui.form.CLICKED_BUTTON=true;if(this._onClickFunction){this._onClickFunction();}
com.cs.ui.form.Forms.instance().currentForm(this._form);this.onClick();com.cs.ui.form.CLICKED_BUTTON=false;}}
this._updateEnabledClass=function(){if(this._element.disabled&&!com.cs.ui.form.defaultCSSClasses.NotUsed&&com.cs.ui.form.defaultCSSClasses.CLASS_BUTTON_DISABLED!=null){this._element.className=com.cs.ui.form.defaultCSSClasses.CLASS_BUTTON_DISABLED;}
else{this._btnMouseOut();}}
this._btnMouseOver=function()
{if(!this._element.disabled&&!com.cs.ui.form.defaultCSSClasses.NotUsed&&com.cs.ui.form.defaultCSSClasses.CLASS_BUTTON_OVER!=null){this._element.className=com.cs.ui.form.defaultCSSClasses.CLASS_BUTTON_OVER;}}
this._btnMouseOut=function()
{if(!this._element.disabled&&!com.cs.ui.form.defaultCSSClasses.NotUsed&&com.cs.ui.form.defaultCSSClasses.CLASS_BUTTON_UP!=null)
{this._element.className=com.cs.ui.form.defaultCSSClasses.CLASS_BUTTON_UP;}}
this._initHandlers=function(){this._onClickFunction=this._element.onclick;this._element.onclick=dojo.hitch(this,this._btnClick);dojo.connect(this._element,"onmousedown",this,this._btnMouseDown);dojo.connect(this._element,"onmouseup",this,this._btnMouseUp);dojo.connect(this._element,"onmouseover",this,this._btnMouseOver);dojo.connect(this._element,"onmouseout",this,this._btnMouseOut);dojo.connect(this._element,"onfocus",this,this._btnFocus);this._btnMouseOut();}
this._initButtonWithForm=function(){com.cs.ui.form.Forms.instance().addButton(this);}
this.init=function(){this._initButtonWithForm();this._initHandlers();}
this.validationGroup=function(){return this._validationGroup;}
this.id=function()
{if(this._element==null)
{}
return this._element.id;}
this.form=function(value){if(!arguments.length){return this._form;}
else{this._form=value;}}
this.defaultButton=function(){if(this._defaultButton){return this._defaultButton;}
else{if(this._form.defaultButton()==this){return true;}}
return false;}
this.enabled=function(value){if(!arguments.length){return!this._element.disabled;}
else{this._element.disabled=!value;}
this._updateEnabledClass();}
this.disabled=function(value){if(!arguments.length){return!this.enabled();}
else{this.enabled(!value);}}
this.toString=function(){return"[com.cs.ui.form.Button]";}
this.element=function(){return this._element;}
this.init();}
com.cs.ui.form.CLICKED_BUTTON=false;com.cs.ui.form.FORM_SUBMIT=false;com.cs.ui.form.DojoComboBox=function(txt){this._combo=dijit.byId(txt);this._field=com.cs.ui.form.Forms.instance().byId(txt);this._showingResults=false;this._onChange=function(){this._showingResults=this._combo._isShowingNow||false;this._field.element().value=this._combo.getValue();}
this._onKeyPress=function(e){if(e.charOrCode==dojo.keys.ENTER){if(this._showingResults==false){this._field._fieldFocus();com.cs.ui.form.Forms.instance().clickCurrentFormDefaultButton();}
this._onChange();}}
this._focus=function(value){if(arguments.length){if(value){this._combo.focus();}
else{this._combo.blur();}}}
this._initHandlers=function(){dojo.connect(this._combo,"_onKeyPress",this,this._onKeyPress);dojo.connect(this._combo,"onKeyUp",this,this._onChange);dojo.connect(this._field,"focus",this,this._focus);dojo.connect(this._field.element(),"onfocus",this,this._focus);}
this._init=function(){this._initHandlers();}
this._init();}
function checkWebOnFormSubmit(){var forms=dojo.query("form");if(forms.length>0){var onSubmit=forms[0].onsubmit;if(!onSubmit||onSubmit.toString().indexOf("WebForm_OnSubmit")==-1){console.log("Please make sure you have run ProcessForm as WebForm_OnSubmit is not found!");}}}
dojo.addOnLoad(checkWebOnFormSubmit);com.cs.initClass("com.cs.ui.HelpMessage");com.cs.ui.HelpMessage=function(mainElement)
{var scope=this;this.mainElement=mainElement;this.message='';this.helpElementID='';this.helpElement=null;this.hasFocus=false;this.lastMessage=null;this.onmouseover=function()
{if(scope.lastMessage==null)
scope.lastMessage=scope.helpElement.innerHTML;scope.helpElement.innerHTML=scope.message;}
this.onmouseout=function()
{if(!scope.hasFocus)
{scope.helpElement.innerHTML=scope.lastMessage;}
scope.lastMessage=null;}
this.onfocus=function()
{scope.hasFocus=true;scope.onmouseover();}
this.onblur=function()
{scope.hasFocus=false;scope.onmouseout();}
this.init=function()
{if(scope.helpElementID!='')
{scope.helpElement=dojo.byId(scope.helpElementID);if(scope.helpElement==null)
alert("Element ID ['"+scope.helpElementID+"'] for help message of '"+scope.mainElement.id+"' button does not exist");dojo.connect(scope.mainElement,"onmouseover",scope,scope.onmouseover);dojo.connect(scope.mainElement,"onmouseout",scope,scope.onmouseout);dojo.connect(scope.mainElement,"onfocus",scope,scope.onfocus);dojo.connect(scope.mainElement,"onblur",scope,scope.onblur);}}}
com.cs.initClass("com.cs.ui.Image");com.cs.ui.Image=function(imageID){var scope=this;this.element=new com.cs.ui.Element(imageID);this.imageID=imageID;this.imageNormal='';this.imageRollover='';this.image=null;this.preloadImg=null;this.onClickClickButton='';this.imageClick=function(){if(scope.onClickClickButton!=''){var b=dojo.byId(scope.onClickClickButton);if(b){if(b.Button){b.Button._btnFocus();}
b.click();}}}
this.imageMouseOver=function(){if(scope.imageRollover!=''&&scope.imageRollover!=null&&scope.image.src!=scope.imageRollover){scope.image.src=scope.imageRollover;}}
this.imageMouseOut=function(){if(scope.imageRollover!=''&&scope.imageRollover!=null&&scope.image.src!=scope.imageNormal){scope.image.src=scope.imageNormal;}}
this.imageRolloverPreloaded=function(){scope.preloadImg=null;}
this.onload=function(){if(scope.imageRollover!=''&&scope.imageRollover!=null){scope.preloadImg=new Image();dojo.connect(scope.preloadImg,"onload",scope,scope.imageRolloverPreloaded);scope.preloadImg.src=scope.imageRollover;}
scope.image=dojo.byId(scope.imageID);if(scope.image){scope.image.imageElem=scope;scope.imageNormal=scope.image.src;dojo.connect(scope.image,"onclick",scope,scope.imageClick);dojo.connect(scope.image,"onmouseover",scope,scope.imageMouseOver);dojo.connect(scope.image,"onmouseout",scope,scope.imageMouseOut);}
else{dojo.addOnLoad(function(){scope.onload();});}}
this.changeImage=function(imgNormal,imgRollover){scope.imageNormal=imgNormal;if(imgRollover!=null&&imgRollover!=undefined)
scope.imageRollover=imgRollover;scope.image.src=scope.imageNormal;}
dojo.addOnLoad(scope.onload);}
com.cs.initClass("com.cs.ui.images");com.cs.ui.images.MediaItem=function(thumbURL,normalURL,largeURL,caption){this.thumbURL=thumbURL;this.normalURL=normalURL;this.largeURL=largeURL;this.caption=caption;this.toString=function(){return"[com.cs.ui.images.Image]";}}
com.cs.ui.images.ImagesPreloader=function(){this.onImageLoaded=function(imageIndex,imageURL,success){}
this.images=null;this.addToDOM=null;this.index=null;this.holder=null;this.imgProperties=null;var scope=this;this.loadingImage=null;this.loadingIndex=null;this.loadedImages=new Array();this.errorImages=new Array();this.imgs=new Array();this.getElemIndexInArray=function(a,elem){for(var i=0;i<a.length;i++){if(a[i]==elem)return i;}
return-1;}
this.preloadImages=function(images,imgTag,addToDOM,startIndex){startIndex=startIndex||0;scope.images=images;scope.imgs=new Array(scope.images.length);scope.loadedImages=new Array();scope.errorImages=new Array();if(imgTag!=undefined&&imgTag!=null){var img;if(typeof(imgTag)=="string"){img=document.getElementById(imgTag);if(!img){alert("com.cs.ui.images.ImagesPreloader: The image tag '"+imgTag+"' cannot be found");}}
else{img=imgTag;}
if(img){scope.holder=img.parentNode;scope.imgProperties=new Object();for(var x in img){switch(x.toLowerCase()){case"onload":case"onerror":continue;}
if(x.indexOf("on")==0){scope.imgProperties[x]=img[x];}}
scope.imgs[startIndex]=img;img.src=images[0];img.onload=function(){scope.loadedImages.push(img.src);img.onload=img.onerror=null;if(scope.onImageLoaded){scope.onImageLoaded(0,img.src,true);}}
img.onerror=function(){scope.errorImages.push(img.src);img.onload=img.onerror=null;if(scope.onImageLoaded){scope.onImageLoaded(0,img.src,false);}};if(img.complete&&img.onload){img.onload();}}}
scope.addToDOM=addToDOM;scope.index=startIndex;scope.loadNextImage();}
this.copyProperties=function(fromObj,toObj){for(var x in fromObj){try{toObj[x]=fromObj[x];}
catch(e){}}}
this.loadImage=function(index){var imageURL=scope.images[index];var img=new Image();scope.loadingImage=img;img.onload=function(){scope.loadedImages.push(imageURL);scope.loadNextImage();if(scope.onImageLoaded){scope.onImageLoaded(index,imageURL,true);}
scope.loadingImage=img.onload=img.onerror=null;scope.loadingIndex=null;}
img.onerror=function(){scope.errorImages.push(imageURL);scope.loadNextImage();if(scope.onImageLoaded){scope.onImageLoaded(index,imageURL,false);}
scope.loadingImage=img.onload=img.onerror=null;scope.loadingIndex=null;}
if(scope.addToDOM){img.style.display='none';scope.imgs[index]=img;scope.copyProperties(scope.imgProperties,img);scope.holder.appendChild(img);}
img.src=imageURL;}
this.skipLoadingTo=function(imageIndex){if(imageIndex==scope.loadingIndex)return;if(scope.loadingImage!=null){scope.loadingImage.onload=scope.loadingImage.onerror=null;scope.loadingImage=null;}
scope.index=imageIndex;scope.loadImage(imageIndex);}
this.loadNextImage=function(){a1=scope.loadedImages;for(var i=0;i<scope.images.length;i++){scope.index++;if(scope.index==scope.images.length)scope.index=0;var imgURL=scope.images[scope.index];if(scope.getElemIndexInArray(scope.loadedImages,imgURL)==-1&&scope.getElemIndexInArray(scope.errorImages,imgURL)==-1){scope.loadImage(scope.index);break;}}}
this.getImage=function(imageIndexOrURL){var imageURL=imageIndexOrURL;if(typeof(imageIndexOrURL)=="number"){imageURL=scope.images[imageIndexOrURL];}
if(scope.getElemIndexInArray(scope.loadedImages,imageURL)!=-1||scope.getElemIndexInArray(scope.errorImages,imageURL)!=-1){if(scope.addToDOM){var imageIndex=scope.getElemIndexInArray(scope.images,imageURL);return scope.imgs[imageIndex];}
else{return imageURL;}}
return null;}
this.toString=function(){return"[com.cs.ui.images.ImagesPreloader]";}}
com.cs.ui.images.SlideShow=function(){this.onImageChanged=function(currImage,newImage,caption,onReady){};this._index=null;this._imagesPreloader=new com.cs.ui.images.ImagesPreloader();this._imgTag=null;this._intervalID=null;this._stopped=true;this._captions=null;this._elemCaption=null;this.delay=null;this.useDojo=true;this.defaultDuration=500;var scope=this;this._delayAndShowNext=function(){clearTimeout(scope._intervalID);var callNext=function(){scope.nextImage(true);}
scope._intervalID=setTimeout(callNext,scope.delay);}
this._init=function(img,caption){img.onload=function(){scope._delayAndShowNext();img.onload=img.onerror=null;}
img.onerror=function(){scope._delayAndShowNext();img.onload=img.onerror=null;}
if(scope._elemCaption){scope._elemCaption.innerHTML=caption;}}
this.showImages=function(images,elemImage,addToDOM,startIndex,delay,elemCaption,captions){delay=delay||0;var img;if(typeof(elemImage)=="string"){img=document.getElementById(elemImage)
if(!img){alert("com.cs.ui.images.SlideShow: The image with id '"+elemImage+"' cannot be found.");}}
else{img=elemImage;}
if(typeof(elemCaption)=="string"){var elemCaptionID=elemCaption;elemCaption=document.getElementById(elemCaptionID);if(!elemCaption){alert("com.cs.ui.images.SlideShow: The image with id '"+elemCaptionID+"' cannot be found.");}}
scope._elemCaption=elemCaption;scope._imgTag=img;scope._index=startIndex;scope.delay=delay;scope._stopped=false;scope._imagesPreloader.preloadImages(images,elemImage,addToDOM,startIndex);scope._captions=captions;var caption="";if(captions)caption=captions[startIndex];scope._init(img,caption);}
this.changeImage=function(index,fromSlideShow){var img=scope._imagesPreloader.getImage(index);var caption="";if(scope._captions){caption=scope._captions[index];}
var f=function(){if(scope._imagesPreloader.addToDOM){scope._imgTag=img;}
if(fromSlideShow){scope._delayAndShowNext();}}
if(img==null){scope._imagesPreloader.onImageLoaded=function(loadedIndex,imageURL,success){if(loadedIndex==index){scope.changeImage(index,fromSlideShow);}}
scope._imagesPreloader.skipLoadingTo(index);}
else{com.cs.ui.images._changeImage(scope._imagesPreloader.addToDOM,scope._imgTag,img,scope._elemCaption,caption,scope.onImageChanged,scope.useDojo,scope.defaultDuration,f);}}
this.nextImage=function(fromSlideShow){scope._index++;if(scope._index==scope._imagesPreloader.images.length)scope._index=0;scope.changeImage(scope._index,fromSlideShow);}
this.prevImage=function(fromSlideShow){scope._index--;if(scope._index==-1)scope._index=scope._imagesPreloader.images.length-1;scope.changeImage(scope._index,fromSlideShow);}
this.stop=function(){if(!scope._stopped){clearTimeout(scope._intervalID);scope._stopped=true;}}
this.play=function(){if(scope._stopped){scope._stopped=false;clearTimeout(scope._intervalID);scope._delayAndShowNext();}}
this.toString=function(){return"[com.cs.ui.images.SlideShow]";}
this.onImageChanged=null;}
com.cs.ui.images.GalleryThumbnail=function(index,img,itemDetails,CSS_Up,CSS_Over,CSS_Selected,attachCSSToParent){this._cssUp=CSS_Up;this._cssOver=CSS_Over;this._cssSelected=CSS_Selected;this._attachCSSToParent=attachCSSToParent;this._selected=false;this._img=img;this._index=index;this._itemDetails=itemDetails;this.onClick=function(thumbnail){}
this._getCSSElement=function(){if(this._attachCSSToParent){return this._img.parentNode;}
else
{return this._img;}}
this._over=function(){if(!this._selected){this._getCSSElement().className=this._cssOver;}}
this._up=function(){if(!this._selected){this._getCSSElement().className=this._cssUp;}}
this._click=function(){console.log("CLICK");this.onClick(this);}
this.select=function(){if(!this._selected){this._selected=true;this._getCSSElement().className=this._cssSelected;}}
this.unSelect=function(){if(this._selected){this._selected=false;this.up();}}
this._initHandlers=function(){dojo.connect(this._getCSSElement(),"onmouseover",this,this._over);dojo.connect(this._getCSSElement(),"onmouseout",this,this._up);dojo.connect(this._getCSSElement(),"onclick",this,this._click);this._up();}
this._init=function(){this._initHandlers();}
this._init();this.toString=function(){return"[com.cs.ui.images.GalleryThumbnail]";}
this.itemDetails=function(){return this._itemDetails;}}
com.cs.ui.images.MediaGallery=function(){this.onItemChanged=function(currItem,newItem,caption,onReady){};this._thumbnails=null;this._elemCaption=null;this._shownFirstImage=false;this._mainItemContainer=null;this._currShownMainItem=null;this._initial=true;this.CSS_ThumbnailUp="gallery_thumb_up";this.CSS_ThumbnailOver="gallery_thumb_over";this.CSS_ThumbnailSelected="gallery_thumb_selected";this.attachCSSToParent=false;this._clearContainer=function(){if(this._currShownMainItem){this._mainItemContainer.removeChild(this._currShownMainItem);this._currShownMainItem=null;}
if(!this._initial){if(this._mainItemContainer.childNodes.length){while(this._mainItemContainer.childNodes.length){this._mainItemContainer.removeChild(this._mainItemContainer.firstChild);}}}
this._initial=false;}
this._thumbnailClick=function(thumbnail){this.selectThumbnail(thumbnail);}
this.selectThumbnail=function(thumb){var itemDetails=thumb.itemDetails();this._clearContainer();if(itemDetails.largeURL&&(itemDetails.largeURL.lastIndexOf(".flv")+4==itemDetails.largeURL.length)){var flvPlayer=new com.cs.ui.FLVPlayer.GeneralFLVPlayer();this._currShownMainItem=flvPlayer.div();this._mainItemContainer.appendChild(this._currShownMainItem);flvPlayer.play(itemDetails.largeURL);}
else{var img=document.createElement("img");img.src=itemDetails.normalURL;this._currShownMainItem=img;this._mainItemContainer.appendChild(img);}
com.cs.ui.images._changeCaption(this._elemCaption,itemDetails.caption);}
this.initThumbs=function(items,elemThumbs){this._thumbnails=new Array();for(var i=0;i<items.length;i++){var mediaItem=items[i];var imgThumb=elemThumbs[i];imgThumb=dojo.byId(imgThumb);var thumb=new com.cs.ui.images.GalleryThumbnail(i,imgThumb,mediaItem,this.CSS_ThumbnailUp,this.CSS_ThumbnailOver,this.CSS_ThumbnailSelected,this.attachCSSToParent);this._thumbnails.push(thumb);dojo.connect(thumb,"onClick",this,this._thumbnailClick);}}
this.init=function(items,mainItemContainer,elemThumbs,addToDOM,startIndex,elemCaption){mainItemContainer=dojo.byId(mainItemContainer);this._mainItemContainer=mainItemContainer;elemCaption=dojo.byId(elemCaption);this._elemCaption=elemCaption;this.initThumbs(items,elemThumbs);if(this._thumbnails[startIndex]){this.selectThumbnail(this._thumbnails[startIndex]);}}
this.onImageChanged=null;this.toString=function(){return"[com.cs.ui.images.Gallery]";}}
com.cs.ui.images._changeCaption=function(elemCaption,caption,useDojo,defaultDuration){if(caption==null||caption=="")caption="No Caption Available";if(elemCaption!=null){if(useDojo&&dojo){dojo.animateProperty({node:elemCaption,duration:defaultDuration,properties:{opacity:0},onEnd:function(){elemCaption.innerHTML=caption;dojo.animateProperty({node:elemCaption,duration:defaultDuration,properties:{opacity:1}}).play();}}).play();}
else{elemCaption.innerHTML=caption;}}}
com.cs.ui.images._changeImage=function(addToDOM,currImage,newImage,elemCaption,caption,onImageChanged,useDojo,defaultDuration,onReady,imageDetails){if(addToDOM){if(onImageChanged){onImageChanged(currImage,newImage,caption,onReady,imageDetails);}
else{if(useDojo&&dojo){dojo.animateProperty({node:currImage,duration:defaultDuration,properties:{opacity:0},onEnd:function(){newImage.style.display='';currImage.style.display='none';newImage.alt=caption;dojo.animateProperty({node:newImage,duration:defaultDuration,properties:{opacity:{start:0,end:1}},onEnd:function(){onReady();}}).play();}}).play();}
else{currImage.style.display='none';newImage.style.display='';newImage.alt=caption;}
com.cs.ui.images._changeCaption(elemCaption,caption,useDojo,defaultDuration);}}
else{if(onImageChanged){onImageChanged(currImage.src,newImage,caption,onReady,imageDetails);}
else{currImage.src=newImage;if(elemCaption!=null){elemCaption.innerHTML=caption;}
onReady();}}}
com.cs.initClass("com.cs.ui.slideshow");com.cs.ui.images.ImagesPreloader=function(){}
com.cs.ui.slideshow.ImageSlideShow=function(img,delay,createImgs){this.onImageChanged=null;this.onLoadingStart=function(img,imageURL){}
this.onLoadingComplete=function(img,imageURL){}
if(typeof(img)=="string")img=document.getElementById(img);this.img=img;this.delay=delay;this.imageURLs=null;this.loadedImages=null;this.errorImages=null;this.index=-1;this.waitingForImage=null;this.interval=null;this.stopped=true;this.shownImage=null;var scope=this;var loadingImage=new Image();this.loadImage=function(imageURL){loadingImage.onload=function(){scope.loadedImages.push(imageURL);if(imageURL==scope.waitingForImage){scope.onLoadingComplete(scope.img,imageURL);scope.showImage(imageURL);}
scope.loadNextImage();}
loadingImage.onerror=function(){scope.errorImages.push(imageURL);scope.loadNextImage();if(imageURL==scope.waitingForImage){scope.nextImage();}}
loadingImage.src=imageURL;}
this.loadNextImage=function(){for(var i=0;i<scope.imageURLs.length;i++){var imageURL=scope.imageURLs[i];var found=false;if(scope.isImageError(imageURL)){found=true;}
if(!found){for(var j=0;j<scope.loadedImages.length;j++){if(scope.loadedImages[j]==imageURL){found=true;break;}}}
if(!found){scope.loadImage(imageURL);break;}}}
this.showImages=function(images,randomize,initIndex){if(initIndex==undefined||initIndex==null)initIndex=0;scope.stopped=false;scope.imageURLs=images;scope.loadedImages=new Array();scope.errorImages=new Array();scope.waitingForImage=null;scope.index=initIndex-1;scope.nextImage();scope.loadNextImage();}
this.showImage=function(imageURL){var c=function(){scope.shownImage=imageURL;if(!scope.stopped){scope.interval=setTimeout(scope.nextImage,scope.delay);}}
if(!scope.onImageChanged){scope.img.src=imageURL;scope.waitingForImage=null;c();}
else{scope.onImageChanged(scope.img,scope.shownImage,imageURL,c);}}
this.isImageInList=function(imageURL,images){for(var i=0;i<images.length;i++){if(images[i]==imageURL){return true;}}
return false;}
this.isImageLoaded=function(imageURL){return scope.isImageInList(imageURL,scope.loadedImages);}
this.isImageError=function(imageURL){return scope.isImageInList(imageURL,scope.errorImages);}
this.nextImage=function(){scope.index++;if(scope.index==scope.imageURLs.length)scope.index=0;var imageURL=scope.imageURLs[scope.index];if(scope.isImageLoaded(imageURL)){scope.showImage(imageURL);}
else if(scope.isImageError(imageURL)){if(scope.errorImages.length<scope.imageURLs.length){scope.nextImage();}}
else{scope.onLoadingStart(scope.img,imageURL);scope.waitingForImage=imageURL;}}
this.stop=function(){scope.stopped=true;clearTimeout(scope.interval);}
this.resume=function(){scope.stopped=false;scope.nextImage();}
this.init=function(){}
this.init();}
com.cs.initClass("com.cs.ui");com.cs.ui.MultiList=function(list,btnMoveUp,btnMoveDown,btnRemove){this._list=list;this._btnMoveUp=btnMoveUp;this._btnMoveDown=btnMoveDown;this._btnRemove=btnRemove;if(!this._list)alert("Error: com.cs.ui.MultiList - List element not found")
var scope=this;this.addItem=function(text,value){if(!value)value=text;var opt=new Option(text,value);if(!scope.containsItem(opt)){list.options[list.options.length]=opt;}
if(scope.onAdd){scope.onAdd(opt);}}
this.containsItem=function(opt){var list=scope._list;for(var i=0;i<list.length;i++){var checkOpt=list.options[i];if(checkOpt.text==opt.text){return true;}}
return false;}
this.removeSelectedItem=function(){var list=scope._list;var index=list.selectedIndex;if(list.selectedIndex==-1)return;var opt=list.options[index];if(index!=-1){list.options[index]=null;}
if(scope.onRemove){scope.onRemove(opt);}}
this.moveSelectedItem=function(inc){var list=scope._list;if(list.options.length<=1)return;var index=list.selectedIndex;if(index+inc<0||index+inc>=list.options.length)return;var fromIndex=index;var toIndex=fromIndex+inc;var tmpValue=list.options[fromIndex].value;var tmpText=list.options[fromIndex].text;list[fromIndex].value=list.options[toIndex].value;list[fromIndex].text=list.options[toIndex].text;list[toIndex].value=tmpValue;list[toIndex].text=tmpText;list.selectedIndex=toIndex;if(scope.onMove){scope.onMove(fromIndex,toIndex);}}
if(this._btnMoveUp){this._btnMoveUp.onclick=function(){scope.moveSelectedItem(-1);}}
if(this._btnMoveDown){this._btnMoveDown.onclick=function(){scope.moveSelectedItem(1);}}
if(this._btnRemove){this._btnRemove.onclick=function(){scope.removeSelectedItem();}}
this._list.ondblclick=function(){scope.removeSelectedItem();}
this.list=this._list;}
com.cs.initClass("com.cs.ui");com.cs.ui.MyTableRow=function(elements,myTable){this._myTable=myTable;this._elements=elements;var scope=this;this.init=function(){}
this._setColumnHeight=function(element,height){var topPadding=parseInt(element.style.paddingTop)||0;var bottomPadding=parseInt(element.style.paddingBottom)||0;var borderHeight=element.offsetHeight-element.clientHeight;height-=topPadding+bottomPadding+borderHeight;element.style.height=height+"px";}
this._clearHeights=function(){for(var i=0;i<scope._elements.length;i++){var element=scope._elements[i];element.style.height="";}}
this.updateWidths=function(){for(var i=0;i<scope._elements.length;i++){var element=scope._elements[i];var colWidth=scope._myTable.getColumnInnerWidth(i);var borderWidth=element.offsetWidth-element.clientWidth;var paddingLeft=parseInt(element.style.paddingLeft)||0;var paddingRight=parseInt(element.style.paddingRight)||0;colWidth-=borderWidth+paddingLeft+paddingRight;element.style.width=colWidth+"px";}}
this.updateHeights=function(){scope._clearHeights();this.updateWidths();var maxHeight=0;for(var i=0;i<scope._elements.length;i++){var element=scope._elements[i];var height=element.offsetHeight;maxHeight=Math.max(maxHeight,height);}
for(var i=0;i<scope._elements.length;i++){var element=scope._elements[i];scope._setColumnHeight(element,maxHeight);}}
this.getElements=function(){return this._elements;}
this.getElementIndex=function(columnIndex){return this._elements[columnIndex];}
this.init();}
com.cs.ui.MyTableColumnDragger=function(element,myTableColumn,myTable){this._element=element;this._myTable=myTable;this._column=myTableColumn;var scope=this;this._isMouseOverElement=false;this._isDragging=false;this._initDragX=0;this._initColumnWidth=0;this._onMouseMove=function(event){var x=com.cs.util.General.getMouseX(event);var diffX=x-scope._initDragX;var newWidth=scope._initColumnWidth+diffX;scope._myTable.updateColumnWidths(scope._column,newWidth);}
this._stopDrag=function(){if(scope._isDragging){scope._isDragging=false;scope._myTable.getDiv().onmousemove=null;if(!scope._isMouseOverElement){document.body.style.cursor="auto";}
scope._myTable.saveColumns();scope._myTable.updateRowHeights();}}
this._startDrag=function(event){var x=com.cs.util.General.getMouseX(event);scope._initColumnWidth=scope._column.getWidth();scope._initDragX=x;scope._isDragging=true;scope._myTable.getDiv().onmousemove=scope._onMouseMove;}
this._initHandlers=function(){scope._element.onmousedown=function(event){scope._startDrag(event);}
scope._element.onmouseover=function(){scope._isMouseOverElement=true;document.body.style.cursor="w-resize";}
scope._element.onmouseout=function(){scope._isMouseOverElement=false;if(!scope._isDragging){document.body.style.cursor="auto";}}
com.cs.util.event.AddEvent(document.body,"onmouseup",scope._stopDrag);}
this.init=function(){scope._initHandlers();}
this.init();this.toString=function(){return"[com.cs.ui.MyTableColumnDragger]";}}
com.cs.ui.MyTableColumn=function(divColumn,index,initWidth,minWidth,myTable){this._div=divColumn;this._initWidth=initWidth;this._minWidth=minWidth||0;this._index=index;this._myTable=myTable;var scope=this;this.init=function(){scope._div.style.cssFloat=scope._div.style.styleFloat="left";scope._div.style.overflow="hidden";}
this.setWidth=function(value,suffix){if(!suffix)suffix="px";if(value<scope._minWidth)value=scope._minWidth;var borderWidth=scope._div.offsetWidth-scope._div.clientWidth;var leftPadding=parseInt(scope._div.style.paddingLeft)||0;var rightPadding=parseInt(scope._div.style.paddingRight)||0;value-=borderWidth;value-=leftPadding+rightPadding;scope._div.style.width=value+suffix;}
this.getIndex=function(){return scope._index;}
this.getDiv=function(){return this._div;}
this.getMinWidth=function(){return scope._minWidth;}
this.getWidth=function(){return scope._div.offsetWidth;}
this.getInnerWidth=function(){var width=scope._div.clientWidth;var paddingLeft=parseInt(scope._div.style.paddingLeft)||0;var paddingRight=parseInt(scope._div.style.paddingRight)||0;width-=paddingLeft+paddingRight;return width;}
this.getInitWidth=function(){return scope._initWidth||0;}
this.toString=function(){return"[com.cs.ui.MyTableColumn]";}}
com.cs.ui.MyTable=function(divTable){if(typeof(divTable)=="string")divTable=document.getElementById(divTable);if(divTable.tagName!="DIV")alert("com.cs.ui.MyTable: Element in constructor must be a DIV not "+divTable+".");this._cookieID=divTable.id;this._divTable=divTable;this._saveWidths=true;this._columns=new Array();this._rows=new Array();this._columnDraggers=new Array();var scope=this;this._getCookieName=function(columnIndex){return scope._cookieID+"_"+columnIndex;;}
this.clearCookies=function(){for(var i=0;i<scope._columns.length;i++){com.cs.util.Cookies.eraseCookie(scope._getCookieName(i));}}
this.getColumnWidth=function(columnIndex){return scope._columns[columnIndex].getWidth();}
this.getColumnInnerWidth=function(columnIndex){return scope._columns[columnIndex].getInnerWidth();}
this.saveColumns=function(){if(com.cs.util.Cookies&&scope._saveWidths){for(var i=0;i<scope._columns.length;i++){var cookieName=scope._getCookieName(i);com.cs.util.Cookies.createCookie(cookieName,scope.getColumnWidth(i),31);}}}
this.loadColumnWidth=function(columnIndex){if(com.cs.util.Cookies){var cookieName=scope._getCookieName(columnIndex);var width=parseInt(com.cs.util.Cookies.readCookie(cookieName));return width;}
return null;}
this.updateColumnWidths=function(column,width){var index=column.getIndex();width=Math.max(width,column.getMinWidth());var adjacentColumn=scope._columns[index+1];var currWidth=column.getWidth();var diffWidth=width-currWidth;if(adjacentColumn){var adjColNewWidth=adjacentColumn.getWidth()-diffWidth;var ajdColActualWidth=Math.max(adjColNewWidth,adjacentColumn.getMinWidth());width-=ajdColActualWidth-adjColNewWidth;adjacentColumn.setWidth(ajdColActualWidth,"px");}
column.setWidth(width,"px");scope._updateRowHeights();}
this.addRow=function(){if(arguments.length==scope._columns.length){var maxHeight=0;var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof(element)=="string")element=document.getElementById(element);elements.push(element);}
var row=new com.cs.ui.MyTableRow(elements,scope);scope._rows.push(row);}
else{alert("com.cs.ui.MyTable: addRow() - There are "+scope._columns.length+" columns, so pass "+scope._columns.length+" parameters not "+arguments.length+".");}}
this.addColumnDragger=function(item){if(typeof(item)=="string")item=document.getElementById(item);if(item){scope._columnDraggers.push(item);}
else{alert("com.cs.ui.MyTable: addColumnDragger() - Element with id '"+item+"' not found in DOM.");}}
this.addColumn=function(divElement,initWidth,minWidth){if(typeof(divElement)=="string")divElement=document.getElementById(divElement);if(divElement.tagName=="DIV"){if(initWidth){initWidth=Math.max(initWidth,minWidth);}
var column=new com.cs.ui.MyTableColumn(divElement,scope._columns.length,initWidth,minWidth,scope);scope._columns.push(column);}
else{alert("com.cs.ui.MyTable: addColumn() - Please only add <DIV> elements as columns.");}}
this._getParentColumn=function(element){while(element){for(var i=0;i<scope._columns.length;i++){var column=scope._columns[i];if(element==column.getDiv()){return column;}}
element=element.parentNode;}
return null;}
this._initColumnDraggers=function(){var a=new Array();for(var i=0;i<scope._columnDraggers.length;i++){var element=scope._columnDraggers[i];var column=scope._getParentColumn(element);var colDragger=new com.cs.ui.MyTableColumnDragger(element,column,scope);a.push(colDragger);}
scope._columnDraggers=a;}
this._initColumns=function(){var remainingWidth=scope._divTable.offsetWidth;var remainingColumns=scope._columns.length;var a=new Array();for(var i=0;i<scope._columns.length;i++){var column=scope._columns[i];column.init();var colInitWidth=column.getInitWidth();if(colInitWidth>0){remainingColumns--;remainingWidth-=colInitWidth;}}
var otherColumnsWidth=Math.floor(remainingWidth/remainingColumns);for(var i=0;i<scope._columns.length;i++){var col=scope._columns[i];var width=scope.loadColumnWidth(i)||col.getInitWidth()||otherColumnsWidth;scope.updateColumnWidths(col,width);}}
this._updateRowHeights=function(){for(var i=0;i<scope._rows.length;i++){var row=scope._rows[i];row.updateHeights();}}
this.getDiv=function(){return scope._divTable;}
this.getMaxWidth=function(){return scope._divTable.offsetWidth;}
this.getSaveWidths=function(){return scope._saveWidths;}
this.setSaveWidths=function(value){scope._saveWidths=value;}
this.updateRowHeights=function(){scope._updateRowHeights();}
this.init=function(){scope._initColumns();scope._initColumnDraggers();scope._updateRowHeights();}
this.toString=function(){return"[com.cs.ui.MyTable]";}}
com.cs.initClass("com.cs.ui");com.cs.ui.OrderingListRow=function(div,btnDragMe,btnFirst,btnUp,btnDown,btnLast,index,orderingList){this._div=div;this._btnDragMe=btnDragMe;this._btnFirst=btnFirst;this._btnUp=btnUp;this._btnDown=btnDown;this._btnLast=btnLast;this._initIndex=index;this._index=index;this._orderingList=orderingList;this._currentYPos=0;this._initDragCurrentYPos=0;this._initDragY=0;this._isOverDragMe=false;this._isDragging=false;var scope=this;this.resetPosition=function(){scope.setYPosition(true,scope._currentYPos);}
this._startDrag=function(event){scope._isDragging=true;var y=com.cs.util.General.getMouseY(event);scope._initDragY=y;scope._initDragCurrentYPos=scope._currentYPos;scope._orderingList.getDiv().onmousemove=scope._onMouseMove;document.body.style.cursor="move";}
this._stopDrag=function(){if(scope._isDragging){scope._isDragging=false;scope._orderingList.getDiv().onmousemove=null;scope.resetPosition();if(!scope._isOverDragMe){scope._btnDragMe.onmouseout();}}}
this.setYPosition=function(animations,newY){var from=parseInt(scope._div.style.top);if(animations&&scope._orderingList.getAnimations()&&_globalCS.Tween&&(from!=newY)){var t=new Tween(scope._div.style,'top',scope._orderingList.getAnimationEasing(),from,newY,scope._orderingList.getAnimationDuration(),'px');t.start();}
else{scope._div.style.top=newY+"px";}}
this._moveRowTo=function(newIndex){var fromIndex=scope._index;scope.setIndex(newIndex);scope._orderingList.moveRow(fromIndex,newIndex);}
this._updateButtons=function(){if(btnUp&&btnUp.disabled!=undefined){btnUp.disabled=(scope._index==0);}
if(btnFirst&&btnFirst.disabled!=undefined){btnFirst.disabled=(scope._index==0);}
if(btnDown&&btnDown.disabled!=undefined){btnDown.disabled=(scope._index==scope._orderingList.getAmtRows()-1);}
if(btnLast&&btnLast.disabled!=undefined){btnLast.disabled=(scope._index==scope._orderingList.getAmtRows()-1);}}
this._onMouseMove=function(event){if(scope._isDragging){var y=com.cs.util.General.getMouseY(event);var diffY=y-scope._initDragY;var newYPos=scope._initDragCurrentYPos+diffY;scope._div.style.top=newYPos+"px";var newIndex=scope._orderingList.getNewIndexFromY(newYPos,scope);if(newIndex!=scope._index){scope._moveRowTo(newIndex);}}}
this._initHandlers=function(){if(btnDragMe){btnDragMe.style.cursor="move";btnDragMe.onmouseover=function(){scope._isOverDragMe=true;}
btnDragMe.onmouseout=function(){scope._isOverDragMe=false;if(!scope._isDragging){document.body.style.cursor="auto";}}
btnDragMe.onmousedown=function(event){scope._startDrag(event);}
com.cs.util.event.AddEvent(document.body,"onmouseup",scope._stopDrag);}
if(btnUp){btnUp.onmousedown=function(){var newIndex=scope._index-1;if(newIndex>=0)scope._moveRowTo(newIndex);}}
if(btnDown){btnDown.onmousedown=function(){var newIndex=scope._index+1;if(newIndex<scope._orderingList.getAmtRows())scope._moveRowTo(newIndex);}}
if(btnFirst){btnFirst.onmousedown=function(){scope._moveRowTo(0);}}
if(btnLast){btnLast.onmousedown=function(){scope._moveRowTo(scope._orderingList.getAmtRows()-1);}}}
this.init=function(){scope._initHandlers();scope._updateButtons();}
this.setYPos=function(value){scope._currentYPos=value;}
this.getYPos=function(){return scope._currentYPos;}
this.getHeight=function(){return scope._div.offsetHeight;}
this.getDiv=function(){return scope._div;}
this.getInitIndex=function(){return scope._initIndex;}
this.getIndex=function(){return scope._index;}
this.getIsDragging=function(){return scope._isDragging;}
this.setIndex=function(value){scope._index=value;scope._updateButtons();}
this.toString=function(){return"[com.cs.ui.OrderingListRow]";}}
com.cs.ui.OrderingList=function(div,txtOrderNumbers){this._getElement=function(element){if(typeof(element)=="string"){return document.getElementById(element);}
else{return element;}}
div=this._getElement(div);txtOrderNumbers=this._getElement(txtOrderNumbers);this._div=div;this._txtOrderNumbers=txtOrderNumbers;this._animations=true;this._animationDuration=0.5;this._animationEasing=Tween.strongEaseOut;this._rows=new Array();var scope=this;this.moveRow=function(fromIndex,toIndex){var row=scope._rows[fromIndex];var part1=scope._rows.slice(0,fromIndex);var part2=scope._rows.slice(fromIndex+1);var newRows=part1.concat(part2);part1=newRows.slice(0,toIndex);part2=newRows.slice(toIndex);part1.push(row);newRows=part1.concat(part2);scope._rows=newRows;for(var i=0;i<scope._rows.length;i++){var r=scope._rows[i];r.setIndex(i);}
scope._updatePositions(true);scope._updateOrderNumbers();}
this.getNewIndexFromY=function(newY,row){var rowIndex=row.getIndex();var result=rowIndex;if(rowIndex>0){for(var i=rowIndex-1;i>=0;i--){var r=scope._rows[i];var yPos=r.getYPos();var middlePos=yPos+r.getHeight()/2;if(newY<=middlePos){result=i;}}}
if(rowIndex<scope._rows.length-1){for(var i=rowIndex+1;i<scope._rows.length;i++){var r=scope._rows[i];var yPos=r.getYPos();var middlePos=yPos+r.getHeight()/2-row.getHeight();if(newY>=middlePos){result=i;}}}
return result;}
this.addRow=function(div,btnDragMe,btnFirst,btnUp,btnDown,btnLast){div=scope._getElement(div);btnDragMe=scope._getElement(btnDragMe);btnFirst=scope._getElement(btnFirst);btnUp=scope._getElement(btnUp);btnDown=scope._getElement(btnDown);btnLast=scope._getElement(btnLast);if(div.tagName!="DIV")alert("com.cs.ui.OrderingList: addRow() First element must be a DIV not "+div+".");var row=new com.cs.ui.OrderingListRow(div,btnDragMe,btnFirst,btnUp,btnDown,btnLast,scope._rows.length,scope);scope._rows.push(row);}
this._updateOrderNumbers=function(){if(scope._txtOrderNumbers){scope._txtOrderNumbers.value="";for(var i=0;i<scope._rows.length;i++){var row=scope._rows[i];if(i>0)scope._txtOrderNumbers.value+=",";scope._txtOrderNumbers.value+=row.getInitIndex();}}}
this._initRows=function(){for(var i=0;i<scope._rows.length;i++){var row=scope._rows[i];row.init();}}
this._updatePositions=function(animations){var height=0;for(var i=0;i<scope._rows.length;i++){var row=scope._rows[i];var divRow=row.getDiv();divRow.style.position="absolute";if(!row.getIsDragging()){row.setYPosition(animations,height);}
row.setYPos(height);height+=row.getHeight();}
scope._div.style.height=height+"px";scope._div.style.position="relative";}
this.init=function(){scope._initRows();scope._updatePositions(false);scope._updateOrderNumbers();}
this.toString=function(){return"[com.cs.ui.OrderingList]";}
this.getDiv=function(){return scope._div;}
this.getRows=function(){return scope._rows;}
this.getAmtRows=function(){return scope._rows.length;}
this.setAnimations=function(value){scope._animations=value;}
this.getAnimations=function(){return scope._animations;}
this.setAnimationDuration=function(value){scope._animationDuration=value;}
this.getAnimationDuration=function(){return scope._animationDuration;}
this.setAnimationEasing=function(value){scope._animationEasing=value;}
this.getAnimationEasing=function(){return scope._animationEasing;}}
com.cs.initClass("com.cs.ui");com.cs.ui.PopUpMenu=function(div,closeTimeout,openLeft,openDelay){div=dojo.byId(div);this.openDelay=openDelay||100;this.openLeft=openLeft;this.closeTimeout=closeTimeout||50;this.onMenuOpen=function(div){};this.onMenuClose=function(){};if(!div){alert("ERROR: com.cs.ui.PopupMenu > Please pass root div element for menu.");return;}
if(div.tagName.toLowerCase()!="div"){alert("ERROR: com.cs.ui.PopupMenu > Root node must be a div element");}
this._callOutTimeoutID;this._callOut=false;this._rootMenuLevel=null;var scope=this;this.mouseOverDiv=function(menuItem){clearTimeout(scope._callOutTimeoutID);menuItem.menuLevel.hideSubMenu();if(menuItem.subMenu){if(this._openDelayTimeout)
{clearTimeout(this._openDelayTimeout);}
this._openDelayTimeout=setTimeout(function(){scope._openDelayTimeout=null;menuItem.subMenu.show();},scope.openDelay);}}
this.mouseOutDiv=function(menuItem){clearTimeout(scope._callOutTimeoutID);scope._callOutTimeoutID=setTimeout(scope.triggerOut,scope.closeTimeout);if(scope._openDelayTimeout){clearTimeout(scope._openDelayTimeout);}}
this.triggerOut=function(){scope._rootMenuLevel.hideSubMenu();}
this.init=function(){var prevDisplay=div.style.display;scope._rootMenuLevel=new com.cs.ui.PopUpMenu.MenuLevel(div,null,null,this);div.style.display=prevDisplay;}
this.init();}
com.cs.ui.PopUpMenu.getDivs=function(div){var obj=new Object();for(var i=0;i<div.childNodes.length;i++)
{var node=div.childNodes[i];if(node.tagName&&node.tagName.toLowerCase()=="div"){if(!obj.divTitle){obj.divTitle=node;}
else{obj.divSubMenu=node;break;}}}
if(!obj.divTitle&&!obj.divSubMenu){return null;}
else{if(!obj.divTitle||!obj.divSubMenu){var errMsg="Error: com.cs.ui.PopUpMenu\n\n";errMsg+="There is an error in the structure of one of the submenus.\n";errMsg+="You need to have the following structure for a submenu:\n";errMsg+="<div>\n\t<div>\n\t\tTITLE HERE\n\t</div>\n\t<div {MAIN MENU DIV}>\n\t</div>\n<div>";errMsg+="-----------------------------\n";errMsg+="Error found in the following div HTML code:\n";errMsg+=divItem.innerHTML;alert(errMsg);}
else{return obj;}}}
com.cs.ui.PopUpMenu.MenuLevel=function(divLevel,parentLevel,openOnMenuItem,popUpMenu){this._openOnMenuItem=openOnMenuItem;this._parentLevel=parentLevel;this._popUpMenu=popUpMenu;this._menuItems=new Array();this._div=divLevel;this._divs=new Array();this.div=this._div;this.menuItems=this._menuItems;var scope=this;this._makeSubMenusAbsolute=function(){for(var i=0;i<scope._div.childNodes.length;i++){var node=scope._div.childNodes[i];if(node.tagName&&node.tagName.toLowerCase()=="div"){var divItem=node;scope._divs.push(divItem);var objInnerDivs=com.cs.ui.PopUpMenu.getDivs(divItem);if(objInnerDivs){divItem.style.position="relative";objInnerDivs.divSubMenu.style.position="absolute";}}}}
this._parseChildDivs=function(){for(var i=0;i<scope._divs.length;i++){var div=scope._divs[i];scope._menuItems.push(new com.cs.ui.PopUpMenu.MenuItem(div,this,popUpMenu));}}
this.hideSubMenu=function(){if(scope.currOpenedLevel){scope.currOpenedLevel.hide();scope.currOpenedLevel=null;}}
this.show=function(){scope._openOnMenuItem.positionSubMenu();scope._parentLevel.currOpenedLevel=scope;scope._div.style.display="";if(scope._popUpMenu.onMenuOpen){scope._popUpMenu.onMenuOpen(scope._div);}}
this.hide=function(){scope.hideSubMenu();scope._div.style.display="none";if(scope._popUpMenu.onMenuClose){scope._popUpMenu.onMenuClose(scope._div);}}
this.init=function(){scope._makeSubMenusAbsolute();scope._parseChildDivs();scope.hide();}
this.init();}
com.cs.ui.PopUpMenu.MenuItem=function(divItem,menuLevel,popUpMenu){this._div=null;this._menuLevel=menuLevel;this._popUpMenu=popUpMenu;this._subMenu=null;var scope=this;this._initSubmenu=function(){divItem.style.position="relative";scope.positionSubMenu();}
this.positionSubMenu=function(){if(scope._subMenu){var div=scope._subMenu.div;var x=divItem.offsetWidth;if(scope._popUpMenu.openLeft)x=-x;div.style.left=x+"px";div.style.top="0px";}}
this._initHandlers=function(){scope._div.onmouseover=function(){scope._popUpMenu.mouseOverDiv(scope);}
scope._div.onmouseout=function(){scope._popUpMenu.mouseOutDiv(scope);}}
this.init=function(){var objDivs=com.cs.ui.PopUpMenu.getDivs(divItem);if(!objDivs){scope._div=divItem;}
else{scope._div=objDivs.divTitle;scope._subMenu=new com.cs.ui.PopUpMenu.MenuLevel(objDivs.divSubMenu,menuLevel,scope,popUpMenu);scope._initSubmenu();}
scope._initHandlers();}
this.init();this.subMenu=this._subMenu;this.menuLevel=this._menuLevel;}
com.cs.initClass("com.cs.ui.tabs");dojo.require("dojox.fx.easing");com.cs.ui.tabs.Tabs=function(){this.tabs=new Array();this.selectedTab=null;this.initial=true;this.currentTween=null;this.isCurrentlyShowing=false;this.changeAnchorLink=true;var scope=this;this.onChange=function(id,index){}
this.onContentChanged=null;this.onMouseOverTab=function(tab){}
this.onMouseOutTab=function(tab){}
this.onUnSelectTab=function(tab){}
this.onSelectTab=function(tab){}
this.useDefaultCSS=true;this.easingShow=null;this.easingHide=null;this.durationShow=0.5;this.durationHide=0.5;this.selectTab=function(tab){var onContentShown=function(){scope.currentTween=null;scope.isCurrentlyShowing=false;}
var onContentHidden=function(){scope.isCurrentlyShowing=true;scope.currentTween=scope.selectedTab.showContent(scope.initial!=true,onContentShown);scope.onChange(scope.selectedTab.id,scope.selectedTab.index);if(scope.changeAnchorLink){var url=window.location.toString();if(url.indexOf("#")!=-1){url=url.substring(0,url.indexOf("#"));}
window.location=url+"#"+scope.selectedTab.id;}}
var currentTab=scope.selectedTab;scope.selectedTab=tab;if(currentTab!=null){currentTab.select(false);scope.onUnSelectTab(currentTab);if(scope.onContentChanged){scope.onContentChanged(currentTab.id,tab.id,currentTab.content,tab.content);}
else{if(!scope.currentTween||scope.isCurrentlyShowing){if(scope.currentTween){scope.currentTween.stop();}
scope.currentTween=currentTab.hideContent(true,onContentHidden);}
scope.isCurrentlyShowing=false;}}
else{if(scope.onContentChanged){scope.onContentChanged(null,tab.id,null,tab.content);}
else{onContentHidden();}}
tab.select(true);scope.onSelectTab(tab);scope.selectedTab=tab;}
this.initTab=function(tab){scope.tabs.push(tab);tab.onClick=function(){scope.selectTab(tab);}
tab.onOver=function(){scope.onMouseOverTab(tab);}
tab.onUp=function(){scope.onMouseOutTab(tab);}}
this.addTab=function(tab){tab.tabs=scope;tab.index=scope.tabs.length;scope.initTab(tab);}
this.getTabFromID=function(id){for(var i=0;i<scope.tabs.length;i++){var t=scope.tabs[i];if(t.id==id){return t;}}
return null;}
this.getTabFromAnchor=function(){var anchor=scope.getAnchor();if(anchor!=null){for(var i=0;i<scope.tabs.length;i++){var t=scope.tabs[i];var id=t.id;if(anchor.indexOf(id)!=-1){return t;}}}
return null;}
this.getAnchor=function(){var url=window.location.toString();if(url.indexOf("#")!=-1){return url.substring(url.indexOf("#")+1);}
return null;}
this.hideAllContentExcept=function(content){for(var i=0;i<scope.tabs.length;i++){if(scope.tabs[i].content!=content){scope.tabs[i].hideContent(false);}}}
this.init=function(selectTabIndexOrId){var tabToSelectInitially=null;if(typeof(selectTabIndexOrId)=="number"){if(scope.tabs.length<selectTabIndexOrId){alert("com.cs.ui.Tabs: There is no initial tab with index "+selectTab);}
else{tabToSelectInitially=scope.tabs[selectTabIndexOrId];}}
else if(typeof(selectTabIndexOrId)=="string"){tabToSelectInitially=scope.getTabFromID(selectTabIndexOrId);}
else{if(scope.tabs.length>0){if(scope.changeAnchorLink){tabToSelectInitially=scope.getTabFromAnchor();}
if(tabToSelectInitially==null){tabToSelectInitially=scope.tabs[0];}}
else{alert("com.cs.ui.Tabs: There is no tabs specified in the tabs!");}}
scope.hideAllContentExcept(tabToSelectInitially.content);scope.selectTab(tabToSelectInitially);scope.initial=false;}}
com.cs.ui.tabs.Tab=function(tab,id,content){if(typeof(tab)=="string"){var t=tab;tab=document.getElementById(tab);if(!tab){alert("com.cs.ui.tabs.Tab: Tab Element '"+t+"' not found!");}}
if(typeof(content)=="string"){var c=content;content=document.getElementById(content);if(!content){alert("com.cs.ui.tabs.Tab: Content Element '"+c+"' not found!");}}
this.tabs=null;this.tab=tab;this.content=content;this.index=null;this.id=id;this.selected=false;var scope=this;this.onClick=function(){}
this.onOver=function(){}
this.onUp=function(){}
this.showContent=function(animations,onReady){if(animations==undefined)animations=true;if(scope.content){scope.content.style.display='';if(animations&&scope.tabs&&scope.tabs.durationShow>0){var anim=dojo.animateProperty({node:scope.content,easing:scope.tabs.easingShow,duration:scope.tabs.durationShow*1000,properties:{opacity:{start:'0',end:'1'}},onEnd:function(){onReady();}})
anim.play();return anim;}
else{onReady();}}}
this.hideContent=function(animations,onHidden){if(animations==undefined)animations=true;var onContentHidden=function(){if(scope.content){scope.content.style.display='none';}
if(onHidden){onHidden();}}
if(animations&&scope.tabs){if(scope.content&&scope.tabs.durationHide>0){var anim=dojo.animateProperty({node:scope.content,easing:scope.tabs.easingHide,duration:scope.tabs.durationHide*1000,properties:{opacity:{end:'0'}},onEnd:function(){onContentHidden();}})
anim.play();return anim;}
else{onContentHidden();}}
else{onContentHidden();}}
this.over=function(){if(!scope.selected){if(scope.tabs.useDefaultCSS){scope.tab.className='over';}
scope.onOver();}}
this.up=function(){if(!scope.selected){if(scope.tabs.useDefaultCSS){scope.tab.className='up';}
scope.onUp();}}
this.select=function(select){scope.selected=select;if(scope.tabs.useDefaultCSS){(select)?scope.tab.className='selected':scope.tab.className='up';}}
this.tab.onmouseover=function(){scope.over();}
this.tab.onmouseout=function(){scope.up();}
this.tab.onmousedown=function(){if(!scope.selected){scope.onClick();}}
this.init=function(){}
this.init();}
com.cs.initClass("com.cs.ui");com.cs.initClass("com.cs.json");com.cs.json.decode=function(str){str=str.replace(/#R#/g,"\r");str=str.replace(/#N#/g,"\n");str=str.replace(/#T#/g,"\t");return str;}
com.cs.json.encode=function(str){str=str.replace(/\r/g,"#R#");str=str.replace(/\n/g,"#N#");str=str.replace(/\t/g,"#T#");return str;}
com.cs.initClass("com.cs.gmap.CSMap");com.cs.gmap.CSMap=function(mapElement,params){this.onClickMap=function(latlng){}
this.onClickOverlay=function(overlay){}
this.onLoad=function(){}
this._mapElement=dojo.byId(mapElement);this._map=null;this._markers=new Array();this._cursor=params&&params.cursor!=undefined?params.cursor:null;this._mouseWheel=params&&params.mouseWheel!=undefined?params.mouseWheel:true;this._draggable=params&&params.draggable!=undefined?params.draggable:true;this._mapLoaded=false;this._initialInvisibleElement=null;this._gMapClick=function(overlay,latlng){if(!overlay){this.onClickMap(latlng);}
else{this.onClickOverlay(overlay,latlng);}}
this._gMapLoad=function(){this._mapLoaded=true;if(this._initialInvisibleElement){this._initialInvisibleElement.style.display="none";}
this.onLoad();}
this.initHandlers=function(){GEvent.addListener(this._map,"click",dojo.hitch(this,this._gMapClick));GEvent.addListener(this._map,"load",dojo.hitch(this,this._gMapLoad));if(this._map.isLoaded()){this._gMapLoad();}}
this.checkMarkerContent=function(csMarker,params){console.log(params);if(params.htmlContent){new com.cs.gmap.CSMarkerWithContent(csMarker,params.htmlContent,params.maxWidth,params.openByDefault,params.openOnMouseOver,params.closeOnMouseOut,params.doNotToggleOnClick);}}
this.addMarker=function(latlng,params){if(params.icon==undefined){params.icon=new GIcon(G_DEFAULT_ICON);}
else{if(params.icon.iconSize==null||params.icon.iconAnchor==null){alert("Please speficy GIcon iconSize / iconAnchor");}}
var marker=new GMarker(latlng,params);this._map.addOverlay(marker);var CSMarker=new com.cs.gmap.CSMarker(marker,this,params);this._markers.push(CSMarker);this.checkMarkerContent(CSMarker,params);return CSMarker;}
this.addMarkerAtAddress=function(address,params,keepChecking,gLatLngIfNotFound){if(keepChecking==undefined)keepChecking=true;var onAddressReceived=dojo.hitch(this,function(gLatLng){if(gLatLng){this.addMarker(gLatLng,params);}
else{}})
this.queryAddress(address,false,0,onAddressReceived,keepChecking);}
this.queryAddress=function(address,centerMapOnResult,zoomLevel,responseHandler,keepChecking,fullAddress){var addressHandler=dojo.hitch(this,function(gLatLng,matchedAddress,fullAddress){if(centerMapOnResult&&gLatLng){this.centerMap(gLatLng,zoomLevel);}
if(responseHandler){responseHandler(GLatLng,matchedAddress,fullAddress);}})
com.cs.gmap.GeocoderQueryAddress(address,addressHandler,keepChecking);}
this.centerMap=function(latlng,zoomLevel){this._map.setCenter(latlng,zoomLevel);}
this.centerMapOnAddress=function(address,zoomLevel,keepChecking){this.queryAddress(address,true,zoomLevel,null,keepChecking);}
this._checkInitialInvisible=function(){var parent=this._mapElement;while(parent){if(parent.style&&parent.style.display=="none"){this._initialInvisibleElement=parent;return;}
parent=parent.parentNode;}}
this._googleMapsAPILoaded=function(){if(GBrowserIsCompatible()){this._checkInitialInvisible();if(this._initialInvisibleElement){this._initialInvisibleElement.style.display="";}
this._map=new GMap2(this._mapElement,{draggableCursor:this._cursor});this.centerMap(new GLatLng(0,0),13);this._map.addControl(new GLargeMapControl());if(this._draggable)this._map.enableDragging();if(this._mouseWheel)this._map.enableScrollWheelZoom();this.initHandlers();}
else{this._mapElement.innerHTML="Browser does not support Google Maps";}}
this.init=function(){if(!google){alert("Please load google API loader by using <script type='text/javascript' src='http://www.google.com/jsapi?key=KEY'></script>")}
var mapsVersion=(params&&params.mapsVersion)||"2";google.load("maps",mapsVersion.toString());google.setOnLoadCallback(dojo.hitch(this,this._googleMapsAPILoaded));}
this.setCursor=function(cursor){this._cursor=cursor;}
this.isLoaded=function(){return this._mapLoaded;}}
com.cs.gmap.CSMarker=function(marker,map,params){this.onClick=function(latlng){}
this.onDrag=function(latlng){}
this.onDragStart=function(latlng){}
this.onDragEnd=function(latlng){}
this.onMouseOver=function(latlng){}
this.onMouseOut=function(latlng){}
this.onInfoWindowOpen=function(){}
this.onInfoWindowClose=function(){}
this.onMarkerMoved=function(latlng){}
this._marker=marker;this._CSMap=map;this._params=params;this._txtStorePosition=this._params&&this._params.txtStorePosition?dojo.byId(this._params.txtStorePosition):null;this._infoWindowOpened=false;this._gMarkerClick=function(latlng){this.onClick(latlng);};this._gMarkerDrag=function(latlng){this.onDrag(latlng);};this._gMarkerDragStart=function(latlng){this.onDragStart(latlng);};this._gMarkerDragEnd=function(latlng){this._txtUpdateValue();this.onDragEnd(latlng);this.onMarkerMoved(latlng);};this._gMarkerMouseOver=function(latlng){this.onMouseOver(latlng);};this._gMarkerMouseOut=function(latlng){this.onMouseOut(latlng);};this._gMarkerInfoWindowOpen=function(){this._infoWindowOpened=true;this.onInfoWindowOpen();};this._gMarkerInfoWindowClose=function(){this._infoWindowOpened=false;this.onInfoWindowClose();};this._moveOnMapClick=function(latlng){this._marker.setLatLng(latlng);this._txtUpdateValue();this.onMarkerMoved(latlng);}
this._initMoveOnMapClick=function(){dojo.connect(this._CSMap,"onClickMap",this,this._moveOnMapClick);}
this._txtUpdateValue=function(){if(this._txtStorePosition){var latLng=this._marker.getLatLng();this._txtStorePosition.value=latLng.lat()+","+latLng.lng();}}
this.initHandlers=function(){if(this._params.moveMarkerOnMapClick){this._initMoveOnMapClick();}
GEvent.addListener(this._marker,"click",dojo.hitch(this,this._gMarkerClick));GEvent.addListener(this._marker,"drag",dojo.hitch(this,this._gMarkerDrag));GEvent.addListener(this._marker,"dragstart",dojo.hitch(this,this._gMarkerDragStart));GEvent.addListener(this._marker,"mouseover",dojo.hitch(this,this._gMarkerMouseOver));GEvent.addListener(this._marker,"mouseout",dojo.hitch(this,this._gMarkerMouseOut));GEvent.addListener(this._marker,"dragend",dojo.hitch(this,this._gMarkerDragEnd));GEvent.addListener(this._marker,"infowindowopen",dojo.hitch(this,this._gMarkerInfoWindowOpen));GEvent.addListener(this._marker,"infowindowclose",dojo.hitch(this,this._gMarkerInfoWindowClose));this._txtUpdateValue();}
this.toggleInfoWindowHtml=function(HtmlContent,maxWidth){if(!this._infoWindowOpened){this.openInfoWindowHtml(HtmlContent,maxWidth);}
else{this.closeWindow();}}
this.openInfoWindowHtml=function(HtmlContent,maxWidth){if(!this._infoWindowOpened){this._marker.openInfoWindowHtml(HtmlContent,{maxWidth:maxWidth});this._infoWindowOpened=true;}}
this.closeWindow=function(){if(this._infoWindowOpened){this._marker.closeInfoWindow();this._infoWindowOpened=false;}}
this.init=function(){this.initHandlers();}
this.move=function(latlng){this._marker.setLatLng(latlng);}
this.remove=function(){this._CSMap._map.removeOverlay(this._marker);}
this.init();this.toString=function(){return"[com.cs.gmap.CSMarker]";}}
com.cs.gmap.CSMarkerWithContent=function(marker,htmlContent,maxWidth,openByDefault,openOnMouseOver,closeOnMouseOut,doNotToggleOnClick){this._CSMarker=marker;this._htmlContent=htmlContent;this._openByDefault=openByDefault;this._openOnMouseOver=openOnMouseOver;this._closeOnMouseOut=closeOnMouseOut;this._doNotToggleOnClick=doNotToggleOnClick;this._maxWidth=maxWidth;this.click=function(latlng){if(!this._doNotToggleOnClick){this._CSMarker.toggleInfoWindowHtml(this._htmlContent,this._maxWidth);}}
this.mouseOver=function(latlng){if(this._openOnMouseOver){this.openWindow();}}
this.mouseOut=function(latlng){if(this._closeOnMouseOut){this.closeWindow();}}
this._markerStartDrag=function(latlng){this.closeWindow();}
this._onMarkerMoved=function(latlng){if(this.isWindowAlwaysVisible()){this.openWindow();}}
this.openWindow=function(){this._CSMarker.openInfoWindowHtml(this._htmlContent,this._maxWidth);}
this.closeWindow=function(){this._CSMarker.closeWindow();}
this.init=function(){if(this._openByDefault){this.openWindow();}
if(!this._doNotToggleOnClick){dojo.connect(this._CSMarker,"onClick",this,this.click);}
if(this._openOnMouseOver){dojo.connect(this._CSMarker,"onMouseOver",this,this.mouseOver);}
if(this._openOnMouseOver){dojo.connect(this._CSMarker,"onMouseOut",this,this.mouseOut);}
dojo.connect(this._CSMarker,"onMarkerMoved",this,this._onMarkerMoved);dojo.connect(this._CSMarker,"onDragStart",this,this._markerStartDrag);}
this.isWindowAlwaysVisible=function(){if(this._openByDefault&&!this._closeOnMouseOut&&this._doNotToggleOnClick){return true;}
return false;}
this.init();}
com.cs.gmap.Test=function(){var map=new com.cs.gmap.CSMap("divGoogle");dojo.connect(map,"onLoad",function(){map.centerMap(new GLatLng(35.887242,14.464273),14);var marker=map.addMarker(new GLatLng(35.887242,14.464273),true,"Mark Cassar",null,{txtStorePosition:"txtValue"});new com.cs.gmap.CSMarkerWithContent(marker,"Html",200,false,true,true,true);});map.init();}
com.cs.gmap.GeocoderQueryAddress=function(address,responseHandler,keepChecking,fullAddress){if(keepChecking==undefined)keepChecking=true;var callBack=dojo.hitch(this,function(gLatLng){if(gLatLng){if(responseHandler){responseHandler(gLatLng,address,fullAddress);}}
else if(!gLatLng&&keepChecking&&address.indexOf(",")!=-1){var newAddress=address.substring(address.indexOf(",")+1);com.cs.gmap.GeocoderQueryAddress(newAddress,responseHandler,keepChecking,fullAddress||address);}
else if(responseHandler){responseHandler(gLatLng,address,fullAddress);}});var g=new GClientGeocoder();g.getLatLng(address,callBack)}
com.cs.initClass("com.cs.general.Align");com.cs.general.Align.alignToCenterH=function(target,itemWidth,offset){if(target==undefined){alert("Error: com.cs.general.Align - target must be defined");}
if(itemWidth==undefined){itemWidth=com.cs.general.Item.getOuterWidth(target);}
var screenWidth=com.cs.general.Window.getWidth();var xPos=(screenWidth-itemWidth)/2;xPos=Math.round(xPos);if(offset!=undefined){xPos+=offset;}
target.style.position="absolute";target.style.left=xPos+"px";}
com.cs.general.Align.alignToBottom=function(target,offset,itemHeight){if(target==undefined){alert("Error: com.cs.general.Align - target must be defined");}
if(itemHeight==undefined){itemHeight=com.cs.general.Item.getOuterHeight(target);}
if(offset==undefined){offset=0;}
offset+=itemHeight;var windowHeight=com.cs.general.Window.getHeight();var scrollY=com.cs.general.Window.getScrollY();var yPos=windowHeight+scrollY;yPos-=offset;target.style.position="absolute";target.style.top=yPos+"px";}
com.cs.general.Align.alignToMouse=function(target,offsetX,offsetY,showPos,scope){if(!offsetX)offsetX=0;if(!offsetY)offsetY=0;scope=scope||document;scope.com=com;var align=function(event){var com=this.com;var xPos=com.cs.general.Mouse.getX(event);var yPos=com.cs.general.Mouse.getY(event);var xOffsetMul,yOffsetMul;if(showPos==undefined){var middleX=com.cs.general.Window.getWidth()/2;var middleY=com.cs.general.Window.getHeight()/2;var X=xPos-com.cs.general.Window.getScrollX();var Y=yPos-com.cs.general.Window.getScrollY();if(X>=middleX&&Y<middleY){openPos="BL";}
else if(X>middleX&&Y>=middleY){openPos="TL";}
else if(X<=middleX&&Y>middleY){openPos="TR";}
else{openPos="BR";}}
else
{openPos=showPos;}
var itemWidth=com.cs.general.Item.getOuterWidth(target);var itemHeight=com.cs.general.Item.getOuterHeight(target);switch(openPos){case"TR":xOffsetMul=1;yOffsetMul=-1;yPos-=itemHeight;break;case"TL":xOffsetMul=-1;yOffsetMul=-1;xPos-=itemWidth;yPos-=itemHeight;break;case"BR":xOffsetMul=1;yOffsetMul=1;break;case"BL":xOffsetMul=-1;yOffsetMul=1;xPos-=itemWidth;break;}
xPos+=xOffsetMul*offsetX;yPos+=yOffsetMul*offsetY;target.style.left=xPos+"px";target.style.top=yPos+"px";}
target.style.display="";var funcName=target.id+"_onAlignToMouseHandler";var scopeName=target.id+"_alignToMouseScope";target[funcName]=align;target[scopeName]=scope;var f=target[funcName];com.cs.general.Listener.addEventListener(scope,"onmousemove",f,false)}
com.cs.general.Align.detachAlignToMouse=function(target,hide){if(hide==undefined){hide=true;}
var funcName=target.id+"_onAlignToMouseHandler";var scopeName=target.id+"_alignToMouseScope";var f=target[funcName];var scope=target[scopeName];com.cs.general.Listener.removeEventListener(scope,"onmousemove",f,false);if(hide){target.style.display="none";}}
com.cs.initClass("com.cs.general");com.cs.general.BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};com.cs.general.BrowserDetect.init();var isFirefox=com.cs.general.BrowserDetect.browser=='Firefox';var isFirefox2=com.cs.general.BrowserDetect.browser=='Firefox'&&com.cs.general.BrowserDetect.version=='2';;var isFirefox3=com.cs.general.BrowserDetect.browser=='Firefox'&&com.cs.general.BrowserDetect.version=='3';;var isExplorer=com.cs.general.BrowserDetect.browser=='Explorer';var isIE7=com.cs.general.BrowserDetect.browser=='Explorer'&&com.cs.general.BrowserDetect.version=='7';var isIE6=com.cs.general.BrowserDetect.browser=='Explorer'&&com.cs.general.BrowserDetect.version=='6';var isSafari=com.cs.general.BrowserDetect.browser=='Safari';com.cs.initClass("com.cs.general.DropDown");com.cs.general.DropDown.ClearCmb=function(cmb)
{if(cmb.id==null)
cmb=dojo.byId(cmb);while(cmb.options.length>0)
{cmb.remove(0);}}
com.cs.general.DropDown.CheckCmb=function(cmb,addValue,NoItemsFromEnd,NoItemsFromTop)
{if(!NoItemsFromEnd)NoItemsFromEnd=0;if(!NoItemsFromTop)NoItemsFromTop=0;if(cmb.value==addValue)
{var txt=prompt("Enter the new value:","");if(txt!=null&&txt!="")
{addToCmbInOrder(cmb,txt,txt,false,NoItemsFromEnd,NoItemsFromTop);cmb.valueOf=txt;}
else
{cmb.selectedIndex=-1;}}}
com.cs.general.DropDown.AddToCmb=function(cmb,txt,val)
{var opt=document.createElement("OPTION");opt.text=txt;opt.value=val;try
{cmb.add(opt);}
catch(ex)
{cmb.add(opt,null);}}
com.cs.general.DropDown.AddToCmbByIndex=function(cmb,txt,val,index)
{var opt=document.createElement("OPTION");opt.text=txt;opt.value=val;var nodeIndex;try
{cmb.add(opt,index);}
catch(ex)
{cmb.add(opt,cmb.options[index]);}}
com.cs.general.DropDown.AddToCmbInOrder=function(cmb,txt,val,addifexists,noitemsfromend,noitemsfromtop)
{if(noitemsfromend==""||noitemsfromend==null)noitemsfromend=0;if(noitemsfromtop==""||noitemsfromtop==null)noitemsfromtop=0;var opt=document.createElement("OPTION");var nodeIE,nodeMoz;var index;opt.text=txt;opt.value=val;var i,found;found=false;if(!addifexists)
{for(i=0;i<cmb.options.length-noitemsfromend;i++)
{if(cmb.options[i].value==val)
{found=true;break;}}}
if(!found)
{if(noitemsfromend>0)
{nodeMoz=cmb.options[cmb.options.length-noitemsfromend];nodeIE=cmb.options.length-noitemsfromend;}
else
{nodeMoz=null;nodeIE=-1;}
index=cmb.options.length-noitemsfromend;for(i=noitemsfromtop;i<cmb.options.length-noitemsfromend;i++)
{if(cmb.options[i].text.toLowerCase()>txt.toLowerCase())
{nodeIE=i;nodeMoz=cmb.options[i];index=i;break;}}
try
{cmb.add(opt,nodeIE);}
catch(ex)
{cmb.add(opt,nodeMoz);}
cmb.selectedIndex=index;}
return!found;}
com.cs.initClass("com.cs.general.Effects");com.cs.general.Effects.RollOverClass=function(element,rolloverClass)
{if(!element.id)
{element=document.getElementById(element);}
element.originalClass=element.className;element.rolloverClass=rolloverClass;com.cs.util.event.AddEvent(element,'onmouseover',com.cs.general.Effects.changeClass,element,'over');com.cs.util.event.AddEvent(element,'onmouseout',com.cs.general.Effects.changeClass,element,'out');}
com.cs.general.Effects.changeClass=function(event,element,type)
{}
com.cs.general.Effects.BlinkText=function(element,colors,interval){if(!element)alert("[com.cs.general.Effects.BlinkText] ERROR: Element is undefined");this._colors=colors;this._element=element;this._interval=interval;this._intervalID=null;var scope=this;var currColor=0;var nextBlink=function(){var color=scope._colors[currColor];scope._element.style.color=color;currColor++;if(currColor==scope._colors.length){currColor=0;}}
this.startBlinking=function(){setInterval(nextBlink,scope._interval);}
this.stopBlinking=function(){clearInterval(scope._intervalID);}
var init=function(){scope.startBlinking();}
init();}
com.cs.initClass("com.cs.general.Functions");com.cs.general.Functions.getElement=function(elem)
{if(typeof(elem)=="string")
return document.getElementById(elem);else
return elem;}
com.cs.general.Functions.bookmarkSite=function(title,url){if(window.sidebar){window.sidebar.addPanel(title,url,"");}
else if(window.opera&&window.print){var elem=document.createElement('a');elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');elem.click();}
else if(document.all){window.external.AddFavorite(url,title);}}
com.cs.initClass("com.cs.general.General");com.cs.general.General._gotoAnchor_onloadTimer=function(name)
{window.setTimeout('com.cs.general.General._gotoAnchor_onload("'+name+'");',250);}
com.cs.general.General._gotoAnchor_onload=function(name)
{var url=window.location.href;var hashPos=url.lastIndexOf('#');if(hashPos>-1)
{url=url.substr(0,hashPos);}
url+='#'+name;window.location=url;}
com.cs.general.General.gotoAnchor=function(name)
{dojo.addOnLoad(com.cs.general.General._gotoAnchor_onloadTimer(name));}
com.cs.initClass("com.cs.general.Item");com.cs.general.Item.getInnerWidth=function(element){return element.clientWidth;};com.cs.general.Item.getInnerHeight=function(element){return element.clientHeight;};com.cs.general.Item.getOuterWidth=function(element){return element.offsetWidth;};com.cs.general.Item.getOuterHeight=function(element){return element.offsetHeight;};com.cs.general.Item.centerItemInScreen=function(elem){var elemW=com.cs.general.Item.getOuterWidth(elem);var elemH=com.cs.general.Item.getOuterHeight(elem);var docW=com.cs.general.Window.getWidth();var docH=com.cs.general.Window.getHeight();var left=(docW-elemW)/2;var top=(docH-elemH)/2;left+=com.cs.general.Window.getScrollX();top+=com.cs.general.Window.getScrollY();elem.style.left=left+'px';elem.style.top=top+'px';};com.cs.general.Item.centerItemInItem=function(elemToCenterIn,elem){this.centerItemInItemH(elemToCenterIn,elem);this.centerItemInItemV(elemToCenterIn,elem);};com.cs.general.Item.centerItemInItemH=function(elemToCenterIn,elem){var totalWidth=com.cs.general.Item.getOuterWidth(elemToCenterIn);var elemW=com.cs.general.Item.getOuterWidth(elem);var left=(totalWidth-elemW)/2;elem.style.left=left+'px';};com.cs.general.Item.centerItemInItemV=function(elemToCenterIn,elem){var totalHeight=com.cs.general.Item.getOuterHeight(elemToCenterIn);var elemH=com.cs.general.Item.getOuterHeight(elem);var top=(totalHeight-elemH)/2;elem.style.top=top+'px';};dojo.require("dijit.dijit");com.cs.general.Item.centerItemInViewport=function(element,vertical,horizontal,attachToOnResize,attachToOnScroll){if(vertical==undefined)vertical=true;if(horizontal==undefined)horizontal=true;if(attachToOnResize==undefined)attachToOnResize=true;if(attachToOnScroll==undefined)attachToOnScroll=true;if(typeof(element)=="string")element=dojo.byId(element);if(!element){alert("com.cs.general.Item.centerItemInViewport: Element cannot be found");}
element.style.position="absolute";var centerItem=function(){var obj=dijit.getViewport();var screenWidth=obj.w;var screenHeight=obj.h;var scrollLeft=obj.l;var scrollTop=obj.t;var cb=dojo.marginBox(element);var itemWidth=cb.w;var itemHeight=cb.h;if(horizontal){element.style.left=(((screenWidth-itemWidth)/2)+scrollLeft)+"px";}
if(vertical){element.style.top=(((screenHeight-itemHeight)/2)+scrollTop)+"px";}}
if(attachToOnResize){dojo.connect(window,"onresize",function(){centerItem();});}
if(attachToOnScroll){dojo.connect(window,"onscroll",function(){centerItem();});}
centerItem();}
com.cs.initClass("com.cs.general.Key");com.cs.general.Key.captureKey=function(functionHandler,scope){if(!scope){scope=document;}
scope.onkeydown=function(e){var keyCode;if(e){keyCode=e.keyCode;}
else if(event){keyCode=event.keyCode;}
functionHandler(keyCode);}}
com.cs.initClass("com.cs.general.Listener");com.cs.general.Listener.addEventListener=function(target,eventName,eventHandler,direction){var shortEventName=eventName.substring(2);if(target.addEventListener){target.addEventListener(shortEventName,eventHandler,direction);}
else if(target.attachEvent){target.attachEvent(eventName,eventHandler);}
else
{target[eventName]=eventHandler;}}
com.cs.general.Listener.removeEventListener=function(target,eventName,eventHandler,direction){var shortEventName=eventName.substring(2);if(target.removeEventListener){target.removeEventListener(shortEventName,eventHandler,direction);}
else if(target.detachEvent){target.detachEvent(eventName,eventHandler);}
else{target[eventName]=null;}}
com.cs.initClass("com.cs.general.Mouse");com.cs.general.Mouse.getX=function(event){mouse=event||window.event;return(mouse.clientX+com.cs.general.Window.getScrollX());}
com.cs.general.Mouse.getY=function(event){mouse=event||window.event;return(mouse.clientY+com.cs.general.Window.getScrollY());}
com.cs.initClass("com.cs.general.Popup");com.cs.general.Popup.openPopup=function(url,params){var id;if(params==null){params=new Object();}
if(params.id){id=params.id;}
else{id="test";}
var paramList="";if(params.left!=null){paramList+="left="+params.left+",";}
if(params.top!=null){paramList+="top"+params.top+",";}
if(params.width!=null){paramList+="width="+params.width+",";}
if(params.height!=null){paramList+="height="+params.height+",";}
if(params.status==null){params.status=0;}
paramList+="status="+params.status+",";if(params.toolbar==null){params.toolbar=0;}
paramList+="toolbar="+params.toolbar+",";if(params.location==null){params.location=0;}
paramList+="location="+params.location+",";if(params.menubar==null){params.menubar=0;}
paramList+="menubar="+params.menubar+",";if(params.directories==null){params.directories=0;}
paramList+="directories="+params.directories+",";if(params.scrollbars==null){params.scrollbars=0;}
paramList+="scrollbars="+params.scrollbars+",";if(params.vAlign!=null){switch(params.vAlign){case"top":paramList+="top=0,";break;case"bottom":if(params.height){var newWindowHeight=params.height;var screenHeight=com.cs.general.Window.getScreenHeight();var top=screenHeight-newWindowHeight;var offsetTop=screen.availTop;if(offsetTop){top+=offsetTop;}
paramList+="top="+top+",";}
break;case"middle":if(params.height){var newWindowHeight=params.height;var screenHeight=com.cs.general.Window.getScreenHeight();var top=(screenHeight-newWindowHeight)/2;var offsetTop=screen.availTop;if(offsetTop){top+=offsetTop;}
paramList+="top="+top+",";}
break;}}
if(params.hAlign!=null&&params.height!=null){switch(params.hAlign){case"left":paramList+="left=0,";break;case"middle":if(params.width){var newWindowWidth=params.width;var screenWidth=com.cs.general.Window.getScreenWidth();var left=(screenWidth-newWindowWidth)/2;var offsetLeft=screen.availLeft;if(offsetLeft){left+=offsetLeft;}
paramList+="left="+left+",";}
break;case"right":if(params.width){var newWindowWidth=params.width;var screenWidth=com.cs.general.Window.getScreenWidth();var left=(screenWidth-newWindowWidth);var offsetLeft=screen.availLeft;if(offsetLeft){left+=offsetLeft;}
paramList+="left="+left+",";}
break;}}
paramList=paramList.substring(0,paramList.length-1);var windowPtr=window.open(url,id,paramList)
return windowPtr;}
com.cs.general.Popup.popupBlocker=function(){var checkPopup=com.cs.general.Popup.openPopup("",{width:1,height:1,left:0,top:0,scrollbars:0});var popupsBlocked;if(checkPopup){popupsBlocked=false;}
else
{popupsBlocked=true;}
checkPopup.close();return popupsBlocked;}
com.cs.general.Popup.hidePopup=function(){hidePopup_element.style.display='none';hidePopup_element.style.left='-2000px'}
com.cs.general.Popup.showPopup=function(showElem,closeElem){showElem.style.position='absolute';showElem.style.display='';var itemWidth=com.cs.general.Item.getOuterWidth(showElem);var itemHeight=com.cs.general.Item.getOuterHeight(showElem);var left,top;left=(com.cs.general.Window.getWidth()-itemWidth)/2;top=(com.cs.general.Window.getHeight()-itemHeight)/2;showElem.style.left=left+'px';showElem.style.top='100px';hidePopup_element=showElem;com.cs.general.Listener.addEventListener(closeElem,"onclick",this.hidePopup);closeElem.style.cursor='pointer';}
com.cs.initClass("com.cs.general.String");com.cs.general.String.escapeForJS=function(str){var s=new String(str);var escapeChars=new Array();escapeChars.push({findStr:"'",replaceStr:"/'"});for(var i=0;i<escapeChars.length;i++){var obj=escapeChars[i];s=s.replace(obj.findStr,obj.replaceStr);}
return s;}
com.cs.initClass("com.cs.general.Text");com.cs.general.Text.TextForHTML=function(txt)
{tmp=txt;tmp=replaceall(tmp,'<','&lt;');tmp=replaceall(tmp,'>','&gt;');tmp=replaceall(tmp,' ','&nbsp;');tmp=replaceall(tmp,'\n','<br>');return tmp;}
com.cs.general.Text.ReplaceAll=function(txt,from,to)
{tmp=txt;while(tmp.indexOf(from)!=-1)
{tmp=tmp.replace(from,to);}
return tmp;}
com.cs.general.Text.ForQueryString=function(str)
{var tmp=str;tmp=tmp.replace('%','%25');tmp=tmp.replace('&','%26');tmp=tmp.replace('=','%3D');tmp=tmp.replace('?','%3F');return tmp;}
com.cs.general.Text.PadNumber=function(num,digits)
{var tmp,snum,sret
snum=""+num;tmp=digits-snum.length;sret=num
for(k=1;k<=tmp;k++)
sret="0"+sret
return sret}
com.cs.general.Text.FormatNumber=function(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
{if(isNaN(parseInt(num)))return"NaN";var tmpNum=num;var iSign=num<0?-1:1;tmpNum*=Math.pow(10,decimalNum);tmpNum=Math.round(Math.abs(tmpNum))
tmpNum/=Math.pow(10,decimalNum);tmpNum*=iSign;var tmpNumStr=new String(tmpNum);tmpNumStr=tmpNum.toFixed(decimalNum);if(!bolLeadingZero&&num<1&&num>-1&&num!=0)
if(num>0)
tmpNumStr=tmpNumStr.substring(1,tmpNumStr.length);else
tmpNumStr="-"+tmpNumStr.substring(2,tmpNumStr.length);if(bolCommas&&(num>=1000||num<=-1000)){var iStart=tmpNumStr.indexOf(".");if(iStart<0)
iStart=tmpNumStr.length;iStart-=3;while(iStart>=1){tmpNumStr=tmpNumStr.substring(0,iStart)+","+tmpNumStr.substring(iStart,tmpNumStr.length)
iStart-=3;}}
if(bolParens&&num<0)
tmpNumStr="("+tmpNumStr.substring(1,tmpNumStr.length)+")";return tmpNumStr;}
com.cs.initClass("com.cs.general.UI");com.cs.general.UI.addToCmb=function(cmb,txt,val){var opt=document.createElement("OPTION");opt.text=txt;opt.value=val;try
{cmb.add(opt);}
catch(ex)
{cmb.add(opt,null);}}
com.cs.general.UI.addToCmbByIndex=function(cmb,txt,val,index){var opt=document.createElement("OPTION");opt.text=txt;opt.value=val;var nodeIndex;try
{cmb.add(opt,index);}
catch(ex){cmb.add(opt,cmb.options[index]);}}
com.cs.general.UI.addToCmbInOrder=function(cmb,txt,val,addifexists,noitemsfromend,noitemsfromtop)
{if(noitemsfromend==""||noitemsfromend==null)noitemsfromend=0;if(noitemsfromtop==""||noitemsfromtop==null)noitemsfromtop=0;var opt=document.createElement("OPTION");var nodeIE,nodeMoz;var index;opt.text=txt;opt.value=val;var i,found;found=false;if(!addifexists){for(i=0;i<cmb.options.length-noitemsfromend;i++){if(cmb.options[i].value==val){found=true;break;}}}
if(!found){if(noitemsfromend>0){nodeMoz=cmb.options[cmb.options.length-noitemsfromend];nodeIE=cmb.options.length-noitemsfromend;}
else{nodeMoz=null;nodeIE=-1;}
index=cmb.options.length-noitemsfromend;for(i=noitemsfromtop;i<cmb.options.length-noitemsfromend;i++){if(cmb.options[i].text.toLowerCase()>txt.toLowerCase()){nodeIE=i;nodeMoz=cmb.options[i];index=i;break;}}
try
{cmb.add(opt,nodeIE);}
catch(ex)
{cmb.add(opt,nodeMoz);}
cmb.selectedIndex=index;}
return!found;}
com.cs.general.UI.selectComboBoxValue=function(cmb,value){for(var i=0;i<cmb.options.length;i++){var opt=cmb.options[i];if(opt.value==value){cmb.selectedIndex=i;return true;}}
return false;}
com.cs.initClass("com.cs.general.URL");com.cs.general.URL.getHostName=function(url){url=url.toString();var host=url.substring(0,url.indexOf("/",7));return host;}
com.cs.initClass("com.cs.general.Window");com.cs.general.Window.getX=function(){if(window.screenLeft)return window.screenLeft;if(window.screenX)return window.screenX;return 0;}
com.cs.general.Window.getY=function(){if(window.screenTop)return window.screenTop;if(window.screenY)return window.screenY;return 0;}
com.cs.general.Window.getDocHeight=function()
{return document.height;}
com.cs.general.Window.getDocWidth=function(){alert(document+":"+document.width);return document.width;}
com.cs.general.Window.getWidth=function(){if(document.documentElement&&document.documentElement.clientWidth)return document.documentElement.clientWidth;if(window.innerWidth)return window.innerWidth;if(document.body.clientWidth)return document.body.clientWidth;return 0;}
com.cs.general.Window.getHeight=function(){if(window.innerHeight)return window.innerHeight;if(document.documentElement&&document.documentElement.clientHeight)return document.documentElement.clientHeight;if(document.body.clientHeight)return document.body.clientHeight;return 0;}
com.cs.general.Window.getScrollX=function(){if(window.pageXOffset)return window.pageXOffset;if(document.documentElement&&document.documentElement.scrollLeft)return document.documentElement.scrollLeft;if(document.body.scrollLeft)return document.body.scrollLeft;return 0;}
com.cs.general.Window.getScrollY=function()
{if(window.pageYOffset)return window.pageYOffset;if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;if(document.body.scrollTop)return document.body.scrollTop;return 0;}
com.cs.general.Window.resize=function(width,height)
{if(isExplorer)
{var cp=document.createElement("div");cp.style.position="absolute";cp.style.width="0px";cp.style.height="0px";cp.style.right="0px";cp.style.bottom="0px";document.body.appendChild(cp);var current_width=cp.offsetLeft;var current_height=cp.offsetTop;var dw=width-current_width;var dh=height-current_height+10;window.resizeBy(dw,dh);document.body.removeChild(cp);}
else
{window.innerHeight=height;window.innerWidth=width;}}
com.cs.general.Window.centerInScreen=function()
{var x,y,width,height;width=this.getWidth();height=this.getHeight();x=(screen.availWidth-width)/2;y=(screen.availHeight-height)/2;window.moveTo(x,y);}
com.cs.initClass("com.cs.Gallery");com.cs.Gallery=function(imgMain,mainCaption,captionTooltip,elemLoading,classNames){this.currentImageIndex=-1;this.imgMain=imgMain;this.mainCaption=mainCaption;this.captionTooltip=captionTooltip;this.listImages=new Array();this.classNames=classNames;this.elemLoading=elemLoading;var scope=this;if(this.mainCaption){mainCaption.innerHTML="";}
if(this.captionTooltip){captionTooltip.innerHTML="";}
this.init=function(imageIndex){if(!imageIndex)imageIndex=0;this.changeImage(this.listImages[imageIndex]);}
this.addImage=function(img,largeURL,caption){var image=new com.cs.GalleryImage(img,largeURL,caption,scope,this.listImages.length);this.listImages.push(image);}
this.changeImage=function(image){this.select(image,this.listImages[this.currentImageIndex]);this.imgMain.style.display="none";this.imgMain.alt=image.caption;if(this.elemLoading){this.elemLoading.style.display="";}
this.imgMain.src=image.largeURL;this.updateControls(image.index);if(this.mainCaption){this.mainCaption.innerHTML=image.caption;}
this.imgMain.onload=function(){scope.imgMain.style.display="";if(scope.elemLoading){scope.elemLoading.style.display="none";}}}
this.showCaptionTooltip=function(caption){if(this.captionTooltip){this.captionTooltip.innerHTML=caption;com.cs.general.Align.alignToMouse(this.captionTooltip,10,10);}}
this.hideCaption=function(){if(this.captionTooltip){com.cs.general.Align.detachAlignToMouse(this.captionTooltip);}}
this.updateControls=function(imageIndex){if(imageIndex==0){this.btnPrev.style.display="none";}
else{this.btnPrev.style.display="";}
if(imageIndex==(this.listImages.length-1)){this.btnNext.style.display="none";}
else{this.btnNext.style.display="";}}
this.setControls=function(btnFirst,btnPrev,btnNext,btnLast){this.btnFirst=btnFirst;this.btnPrev=btnPrev;this.btnNext=btnNext;this.btnLast=btnLast;if(this.btnFirst){this.btnFirst.onclick=function(){scope.changeImage(scope.listImages[0]);}}
if(this.btnPrev){this.btnPrev.onclick=function(){scope.changeImage(scope.listImages[(scope.currentImageIndex-1)]);}}
if(this.btnNext){this.btnNext.onclick=function(){scope.changeImage(scope.listImages[(scope.currentImageIndex+1)]);}}
if(this.btnLast){this.btnLast.onclick=function(){scope.changeImage(scope.listImages[scope.listImages[(scope.listImages.length-1)]]);}}}
this.select=function(galleryImage,prevImage){var img=galleryImage.image;var container=img.parentNode;if(scope.classNames.CSSImageSelected){img.className=scope.classNames.CSSImageSelected;}
if(scope.classNames.CSSContainerSelected){container.className=scope.classNames.CSSContainerSelected;}
scope.currentImageIndex=galleryImage.index;galleryImage.selected=true;if(prevImage){prevImage.selected=false;scope.rollOut(prevImage);}}
this.rollOver=function(galleryImage){if(!galleryImage.selected){var img=galleryImage.image;var container=img.parentNode;if(scope.classNames.CSSImageOver){img.className=scope.classNames.CSSImageOver;}
if(scope.classNames.CSSContainerOver){container.className=scope.classNames.CSSContainerOver;}}}
this.rollOut=function(galleryImage){if(!galleryImage.selected){var img=galleryImage.image;var container=img.parentNode;if(scope.classNames.CSSImageUp){img.className=scope.classNames.CSSImageUp;}
if(scope.classNames.CSSContainerUp){container.className=scope.classNames.CSSContainerUp;}}}
this.enableKeyboard=function(){var f=function(keyCode){if(keyCode==37&&scope.btnPrev.style.display!="none"){scope.btnPrev.onclick();}
else if(keyCode==39&&scope.btnNext.style.display!="none"){scope.btnNext.onclick();}}
com.cs.general.Key.captureKey(f);}
this.enableKeyboard();}
com.cs.GalleryImage=function(img,largeURL,caption,gallery,index,CSSClasses){this.index=index;this.gallery=gallery;this.image=img;var scope=this;this.largeURL=largeURL;this.caption=caption;this.selected=false;this.image.onclick=function(){scope.gallery.changeImage(scope);}
this.image.onmouseover=function(){this.style.cursor="pointer";if(scope.caption){scope.gallery.showCaptionTooltip(caption);}
scope.gallery.rollOver(scope);}
this.image.onmouseout=function(){if(scope.caption){scope.gallery.hideCaption();}
scope.gallery.rollOut(scope);}}
com.cs.initClass("com.cs.forms.FileUploader");dojo.require("dojox.fx.easing");com.cs.forms.FileUploader.UploadProgressBar=function(variableName)
{var scope=this;this.checkRequirements=function()
{if(scope.ShowProgressBar){if(scope.divMain==null||scope.divProgressBar==null){return false;}}
return true;}
this.centeredInWindow=true;this.ShowProgressBar=false;this.Started=false;this.divMain=null;this.divProgressBar=null;this.spanStatus=null;this.spanPercentage=null;this.spanBytesTx=null;this.spanFilename=null;this.centerInViewport=true;this.CheckProgressInterval=1000;this.variableName=variableName;if(this.variableName==null||this.variableName=='')
this.variableName='com.cs.forms.FileUploader.instance';this.progressBarFullWidth=380;this.baseURL='/uploadProgress.ashx';this.queryStringParameter='uploadID';this.progressIDElementName='uploadprogressbar_uploadid';this.FunctionToCallOnStart=null;this._progressBar=null;this.SetUIControls=function(divMain,divProgressBar,spanStatus,spanPercentage,spanBytesTx,spanFilename,funcToCallOnStart)
{scope.divMain=com.cs.general.Functions.getElement(divMain);scope.divProgressBar=com.cs.general.Functions.getElement(divProgressBar);scope.spanStatus=com.cs.general.Functions.getElement(spanStatus);scope.spanPercentage=com.cs.general.Functions.getElement(spanPercentage);scope.spanBytesTx=com.cs.general.Functions.getElement(spanBytesTx);scope.spanFilename=com.cs.general.Functions.getElement(spanFilename);scope.FunctionToCallOnStart=funcToCallOnStart;scope.hidePanel();if(scope.centerInViewport){com.cs.general.Item.centerItemInViewport(divMain);}
divMain.style.display='none';}
this.UpdateFormAction=function()
{var form=document.forms[0];var txt=dojo.byId(scope.progressIDElementName);if(txt!=null){var action=form.action;var re=new RegExp('&?'+scope.queryStringParameter+'=[^&]*');if(action.match(re))
action=action.replace(re,'');var delim;if(action.indexOf('?')==action.length-1){delim='';}
else{delim='?';if(action.indexOf('?')>-1)
delim='&';}
action+=delim+scope.queryStringParameter+'='+document.getElementById(scope.progressIDElementName).value;form.action=action}}
this.updateProgress=function(percentage,byteFrom,byteTotal,filename)
{if(scope.ShowProgressBar)
{var lastWidth=scope.progressBarFullWidth*lastPercentage/100;var currWidth=scope.progressBarFullWidth*percentage/100;var status='Uploading...';if(percentage>=100)
status='Completed.';var anim=dojo.animateProperty({node:scope.divProgressBar,easing:dojox.fx.easing.cubicOut,duration:300,properties:{width:currWidth}})
anim.play();if(scope.spanStatus!=null){scope.spanStatus.innerHTML=status;}
if(scope.spanPercentage!=null){scope.spanPercentage.innerHTML=com.cs.general.Text.FormatNumber(percentage,1,true,false,true)+'%';}
if(scope.spanBytesTx!=null){scope.spanBytesTx.innerHTML='('+com.cs.general.Text.FormatNumber(byteFrom,0,true,false,true)+' / '+com.cs.general.Text.FormatNumber(byteTotal,0,true,false,true)+' bytes)';}
if(scope.spanFilename!=null){scope.spanFilename.innerHTML=filename;}
lastPercentage=percentage;}
this._progressBar.update(percentage);}
this.getUploadProgressURL=function()
{var ts=new Date().getTime();var url=scope.baseURL+'?'+scope.queryStringParameter+'='+document.getElementById(scope.progressIDElementName).value+'&ts='+ts;return url;}
this.uploadProgress_GetStatus=function()
{var xhrArgs=new Object();xhrArgs.load=scope.uploadProgress_Status;xhrArgs.error=scope.uploadProgress_GetStatus;xhrArgs.handleAs='xml';xhrArgs.sync=false;xhrArgs.timeout=15000;xhrArgs.url=scope.getUploadProgressURL();dojo.xhrGet(xhrArgs);}
this.uploadProgress_Status=function(response,ioArgs)
{var res=response;var progress=0;var filename='';var byteFrom=0;var byteTotal=0;if(res.documentElement.getAttribute('empty')=='true')
{}
else
{progress=parseFloat(res.documentElement.getAttribute('progress'));filename=res.documentElement.getAttribute('file');byteFrom=parseInt(res.documentElement.getAttribute('bytes'));byteTotal=parseInt(res.documentElement.getAttribute('size'));scope.updateProgress(progress,byteFrom,byteTotal,filename);}
scope.uploadProgress_GetStatus();}
this.showPanel=function()
{scope.divMain.style.display='';var anim=dojo.animateProperty({node:scope.divMain,easing:dojox.fx.easing.cubicOut,duration:500,properties:{opacity:{start:'0',end:'1'}}})
anim.play();lastPercentage=0;scope.divProgressBar.style.width='0px';if(scope.spanPercentage!=null)
scope.spanPercentage.innerHTML='0%';}
this.hidePanel=function()
{}
this.Start=function()
{this._progressBar=new com.cs.forms.FileUploader.ProgressBar();if(scope.checkRequirements()){scope.Started=true;if(scope.ShowProgressBar){scope.showPanel();}
scope.uploadProgress_GetStatus();if(scope.FunctionToCallOnStart!=null){scope.FunctionToCallOnStart();}}}}
com.cs.forms.FileUploader.ProgressBar=function(){this._divDimmer=document.createElement("div");this._div=document.createElement("div");this._divBarHolder=document.createElement("div");this._divBar=document.createElement("div");this._divText=document.createElement("div");this.BACK_ALPHA=0.8;this._initControls=function(){this._divDimmer.className="cs-progressbar-dimmer";this._div.appendChild(this._divBarHolder);this._div.appendChild(this._divText);this._div.className="cs-progressbar";this._divBarHolder.appendChild(this._divBar);this._divBarHolder.className="cs-progressbar-barholder";this._divBar.className="cs-progressbar-bar";this._divText.className="cs-progressbar-text";dojo.connect(window,"onresize",this,this._updatePosition);dojo.connect(window,"onscroll",this,this._updatePosition);this._updatePosition();this._show();}
this._show=function(){dojo.animateProperty({node:this._divDimmer,properties:{opacity:{start:0,end:this.BACK_ALPHA}}}).play();}
this._updatePosition=function(){this._divDimmer.style.position="absolute";var viewPort=dijit.getViewport();this._divDimmer.style.left=viewPort.l+"px";this._divDimmer.style.top=viewPort.t+"px";this._divDimmer.style.width=viewPort.w+"px";this._divDimmer.style.height=viewPort.h+"px";dojo.style(this._div,"display","");var pbSize=dojo.marginBox(this._div);if(pbSize.w>0){var progressBarLeft=viewPort.l+(viewPort.w-pbSize.w)/2;var progressBarTop=viewPort.t+(viewPort.h-pbSize.h)/2;this._div.style.position="absolute";dojo.style(this._div,"left",progressBarLeft+"px");dojo.style(this._div,"top",progressBarTop+"px");}
else{dojo.style(this._div,"display","none");setTimeout(dojo.hitch(this,this._updatePosition),50);}}
this._init=function(){this._initControls();dojo.body().appendChild(this._divDimmer);dojo.body().appendChild(this._div);this.update(0);}
this.update=function(perc){this._divBar.style.width=perc+"%";this._divText.innerHTML=Math.round(perc)+"%";}
this._init();}
com.cs.forms.FileUploader.instance=new com.cs.forms.FileUploader.UploadProgressBar('com.cs.forms.FileUploader.instance');dojo.require("dijit.dijit");dojo.addOnLoad(com.cs.forms.FileUploader.instance.UpdateFormAction);dojo.addOnLoad(function(){});com.cs.initClass("com.cs.forms.LinkedMenu");com.cs.forms.LinkedMenu=function(){this._cmbs=new Array();this._root=null;this.CSSDisabled=null;var scope=this;this._parseCmbs=function(cmbs){for(var i=0;i<cmbs.length;i++){var cmb=cmbs[i];if(typeof(cmb)=="string"){var cmbID=cmb;cmb=document.getElementById(cmbID);if(!cmb)alert("com.cs.forms.LinkedMenu: The combo box with id '"+cmbID+"' cannot be found in DOM.");scope._cmbs.push(new com.cs.forms.LinkedMenuComboBox(cmb,i,scope));}}}
this._enableAllLevels=function(){for(var i=0;i<scope._cmbs.length;i++){var cmb=scope._cmbs[i];cmb.enable();}}
this.disableOtherLevels=function(levelIndex){for(var i=levelIndex+1;i<scope._cmbs.length;i++){var cmb=scope._cmbs[i];cmb.disable();}}
this.populateLevel=function(levelIndex,linkedMenuLevels){scope._enableAllLevels();if(levelIndex>=scope._cmbs.length){alert("com.cs.forms.LinkedMenu: Please specify a combo box for level "+(levelIndex+1)+" because at the moment only "+scope._cmbs.length+" level(s) are specified");}
var hasGotSubLevels=scope._cmbs[levelIndex].populate(linkedMenuLevels);if(!hasGotSubLevels){scope.disableOtherLevels(levelIndex);}}
this.init=function(rootLevel){scope._root=rootLevel;scope.populateLevel(0,rootLevel.children);}
this.addComboBox=function(cmb,disabledText){cmb=dojo.byId(cmb);var cmbBox=new com.cs.forms.LinkedMenuComboBox(cmb,scope._cmbs.length,scope,disabledText);scope._cmbs.push(cmbBox);}}
com.cs.forms.LinkedMenuLevel=function(title,value,selected){if(selected==undefined||selected==null)selected=false;this.option=new Option(title,value);this.selected=selected;this.children=new Array();var scope=this;this.addSubLevel=function(linkedMenuLevel){scope.children.push(linkedMenuLevel);}
this.addSubLevels=function(linkedMenuLevels){for(var i=0;i<linkedMenuLevels.length;i++){scope.addSubLevel(linkedMenuLevels[i]);}}}
com.cs.forms.LinkedMenuComboBox=function(cmb,levelIndex,linkedMenu,disabledText){this.cmb=cmb;this.levelIndex=levelIndex;this.linkedMenu=linkedMenu;this.disabledText=disabledText;this._currentOnChangeHandler=cmb.onchange;this._currentValue=null;this._initiallyDisabled=cmb.disabled;this.linkedMenuLevels=null;var scope=this;this._getLinkedMenuLevel=function(value){for(var i=0;i<scope._linkedMenuLevels.length;i++){var level=scope._linkedMenuLevels[i];if(level.option.value==value){return level;}}}
this._onChange=function(){var value=scope.cmb.value;if(value==scope._currentValue)return;scope._currentValue=value;if(scope._currentOnChangeHandler){scope._currentOnChangeHandler();}
var level=scope._getLinkedMenuLevel(value);if(level.children.length>0){scope.linkedMenu.populateLevel(scope.levelIndex+1,level.children);}
else{scope.linkedMenu.disableOtherLevels(scope.levelIndex);}}
this._initHandlers=function(){scope.cmb.onchange=scope.cmb.onkeyup=scope._onChange;}
this._clearItems=function(){while(scope.cmb.options.length){scope.cmb.remove(0);}}
this._init=function(){scope._clearItems();scope._initHandlers();}
this.enable=function(){if(scope._initiallyDisabled)return;scope.cmb.disabled=false;scope.cmb.style.backgroundColor=null;scope.cmb.className=null;}
this.disable=function(){if(scope._initiallyDisabled)return;scope.cmb.disabled=true;scope._clearItems();var opt=new Option();opt.text=scope.disabledText;scope.cmb.options.add(opt);scope.cmb.className=scope.linkedMenu.CSSDisabled;}
this.populate=function(linkedMenuLevels){scope._clearItems();scope._linkedMenuLevels=linkedMenuLevels;var selectedLevel=null;var selectedLevelIndex=-1;var hasGotSubLevels=false;for(var i=0;i<linkedMenuLevels.length;i++){var level=linkedMenuLevels[i];var opt=level.option;scope.cmb.options.add(opt);if(level.selected&&selectedLevel==null){selectedLevel=level;selectedLevelIndex=i;}}
if(selectedLevel==null&&linkedMenuLevels.length>0){selectedLevel=linkedMenuLevels[0];selectedLevelIndex=0;}
if(selectedLevel.children.length>0){scope._currentValue=selectedLevel.option.value;scope.linkedMenu.populateLevel(scope.levelIndex+1,selectedLevel.children);hasGotSubLevels=true;}
scope.cmb.selectedIndex=selectedLevelIndex;return hasGotSubLevels;}
this._init();}
com.cs.initClass("com.cs.forms.validation");dojo.require("dojo.date.locale");com.cs.forms.validation.containCharactersWhichAreNot=function(str,allowedCharsPattern){if(allowedCharsPattern){var r=new RegExp("[^"+allowedCharsPattern+"]*");return r.test(str);}
return true;}
com.cs.forms.validation.containOnlyCharacters=function(str,allowedCharsPattern){return!com.cs.forms.validation.containCharactersWhichAreNot(str,allowedCharsPattern);}
com.cs.forms.validation.isEmail=function(str){var regExp=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;var ok=regExp.test(str);if(ok&&/\.\./.test(str)){ok=false;}
return ok;}
com.cs.forms.validation.isNumber=function(str,params,outErrorMsg,itemTitle){if(!itemTitle)itemTitle="Number";var isNum=/^[-+]?[0-9]*$|^[-+]?[0-9]*\.[0-9]*$/.test(str);if(isNum){var num=parseFloat(str);if(params&&(params.numFrom||params.numTo)){params.numFrom=params.numFrom||Number.NEGATIVE_INFINITY;params.numTo=params.numTo||Number.POSITIVE_INFINITY;var from=Math.min(params.numFrom,params.numTo);var to=Math.max(params.numFrom,params.numTo);if(num<from||num>to){if(from==Number.NEGATIVE_INFINITY){if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" must be smaller than or equal to "+to;}
else if(to==Number.POSITIVE_INFINITY){if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" must be greater than or equal to "+from;}
else{if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" must be greater than or equal to "+from+" and smaller than or equal to "+to;}
return false;}}
if(params.positiveOnly&&num<0){if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" must be positive";return false;}
if(params.negativeOnly&&num>0){if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" must be negative";return false;}
if(params.integersOnly&&parseInt(num)!=num){if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" must be a whole number";return false;}}
else{if(outErrorMsg)outErrorMsg.errorMsg=itemTitle+" - Invalid number";return false;}
return true;}
com.cs.forms.validation.isAlphaNumeric=function(str){return com.cs.forms.validation.containOnlyCharacters(str,"a-zA-Z0-9_");}
com.cs.forms.validation.isCreditCardNumber=function(str){return/^[0-9]{15,16}$/.test(str);}
com.cs.forms.validation.isDate=function(str,params,outErrorMsg,itemTitle){if(!itemTitle)itemTitle="Date";var dateFormat=params.dateFormat||"dd/MM/yyyy";str=str.replace(/[-.]/g,"/");dateFormat=dateFormat.replace(/[-.]/g,"/");var selector=null;var d=dojo.date.locale.parse(str,{datePattern:dateFormat,selector:selector});if(!d){selector="date";d=dojo.date.locale.parse(str,{datePattern:dateFormat,selector:selector});}
if(d){if(params.dateFrom&&params.dateTo){if(params.dateFrom>params.dateTo){var tmp=params.dateFrom;params.dateFrom=params.dateTo;params.dateTo=tmp;}
if(d<params.dateFrom||d>params.dateTo){if(outErrorMsg){outErrorMsg.errorMsg=itemTitle+" must be between or equal to "+dojo.date.locale.format(params.dateFrom,{datePattern:dateFormat,selector:selector})+" and "+dojo.date.locale.format(params.dateTo,{datePattern:dateFormat,selector:selector});}
return false;}}
else
if(params.dateFrom&&d<params.dateFrom){if(outErrorMsg){outErrorMsg.errorMsg=itemTitle+" must be after or equal to "+dojo.date.locale.format(params.dateFrom,{datePattern:dateFormat,selector:selector});}
return false;}
else
if(params.dateTo&&d>params.dateTo){if(outErrorMsg){outErrorMsg.errorMsg=itemTitle+" must be before or equal to "+dojo.date.locale.format(params.dateTo,{datePattern:dateFormat,selector:selector});}
return false;}}
else{if(outErrorMsg)
outErrorMsg.errorMsg=itemTitle+" - Invalid Date";return false;}
return true;}
com.cs.forms.validation.isValueIn=function(item,values,caseSensitive){if(!caseSensitive&&typeof(item)=="string")item=item.toLowerCase();for(var i=0;i<values.length;i++){var val=values[i];if(item==val){return true;}}
return false;}
com.cs.forms.validation.isValueNotIn=function(item,values,caseSensitive){var valueIn=com.cs.forms.validation.isValueIn(item,values,caseSensitive);return!valueIn;}
com.cs.forms.validation.isIPAddress=function(str){return/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.test(str);}
com.cs.forms.validation.WordsLimit=function(txt,amtLimit,elemDisplayWordsRemaining){this._wordLimit=null;this.onChange=function(wordsRemaining){}
this._onChange=function(wordsRemaining){this.onChange(wordsRemaining);}
this._init=function(){this._wordLimit=new com.cs.forms.validation.WordsOrCharsLimit(txt,amtLimit,elemDisplayWordsRemaining,false);dojo.connect(this._wordLimit,"onChange",this,this._onChange);}
this._init();}
com.cs.forms.validation.WordsOrCharsLimit=function(txt,amtLimit,elemDisplayRemaining,limitCharacters){this.onChange=function(amtRemaining){}
this._txt=dojo.byId(txt);this._limitCharacters=limitCharacters;this._amtLimit=amtLimit;this._elemDisplayText=dojo.byId(elemDisplayRemaining);this._update=function(){var amt=0;var value=this._txt.value;if(this._limitCharacters){amt=value.length;}
else{amt=com.cs.util.String.getWords(value).length;}
var amtRemaining=this._amtLimit-amt;if(amtRemaining<0){var limitIndex=0;if(!this._limitCharacters){limitIndex=com.cs.util.String.getWordIndex(value,this._amtLimit);}
else{limitIndex=this._amtLimit;}
this._txt.value=value.substring(0,limitIndex);amtRemaining=0;}
var str="<strong>"+amtRemaining+"</strong> "+(this._limitCharacters?"characters":"word");if(amtRemaining!=1){str+="s";}
str+=" remaining.";if(this._elemDisplayText){this._elemDisplayText.innerHTML=str;}
this.onChange(amtRemaining);}
this._init=function(){dojo.connect(this._txt,"onkeyup",this,this._update);dojo.connect(this._txt,"onchange",this,this._update);this._update();}
this._init();}
com.cs.initClass("com.cs.dojo");com.cs.dojo.fade=function(node,duration,alphaFrom,alphaTo,hideOnEndIfFaded,startImmediately){if(duration==undefined||duration==null)duration=500;if(startImmediately==undefined||startImmediately==null)startImmediately=true;if(hideOnEndIfFaded==undefined||hideOnEndIfFaded==null)hideOnEndIfFaded=true;node=dojo.byId(node);node.style.display="";var opacityObj={end:alphaTo}
if(alphaFrom!=null){opacityObj.start=alphaFrom;}
var animation=dojo.animateProperty({node:node,duration:duration,properties:{opacity:opacityObj},onEnd:function(){if(alphaTo==0){node.style.display="none";}}});if(startImmediately)animation.play();return animation;}
com.cs.dojo.rolloverImage=function(img,rolloverImage,upImage){img=dojo.byId(img);var preLoadImg=new Image();preLoadImg.src=rolloverImage;if(!upImage)upImage=img.src;dojo.connect(img,"onmouseover",function(){img.src=rolloverImage;});dojo.connect(img,"onmouseout",function(){img.src=upImage;});}
com.cs.dojo.rolloverClass=function(node,rolloverClass,upClass){node=dojo.byId(node);if(!upClass){upClass=node.className;}
dojo.connect(node,"onmouseover",function(){node.className=rolloverClass;});dojo.connect(node,"onmouseout",function(){node.className=upClass;});}
com.cs.initClass("com.cs.dojo.dijit.layout");com.cs.dojo.dijit.layout.TabContainer=function(dijitTabContainerID,dontUseBackForward,dontFadeTransition,fadeDuration){if(dontUseBackForward==undefined)dontUseBackForward=false;if(dontFadeTransition==undefined)dontFadeTransition=false;this._tabContainer=dijit.byId(dijitTabContainerID);this._useBackForward=!dontUseBackForward;this._useFadeTransition=!dontFadeTransition;this._selectedTab=null;this._initialTab=null;this._anchorLinkPrefix="tab-";this._currFadingAnimation=null;this._isFading=false;this._showingContent=null;this._newContentToShow=null;this._shownContent=null;this.fadeDuration=fadeDuration||3000;var scope=this;this._getTabById=function(id){var tabs=scope._tabContainer.getChildren();for(var i=0;i<tabs.length;i++){var tab=tabs[i];if(tab.id==id){return tab;}}
return null;}
this._onURLChange=function(value,back){console.log("CHANGE: '"+value+"'");var selectTab=null;if(value!=""){if(value.length>scope._anchorLinkPrefix.length){value=value.substring(scope._anchorLinkPrefix.length);}
var newTab=scope._getTabById(value);if(newTab!=null&&newTab!=scope._selectedTab){selectTab=newTab;}
scope._selectedTab=newTab;if(scope._initialTab==null){scope._initialTab=scope._selectedTab;}}
else{selectTab=scope._initialTab;}
if(selectTab!=null){scope._tabContainer.selectChild(selectTab);scope._shownContent=scope._selectedTab.domNode;scope._selectedTab=selectTab;}}
this._initBackForward=function(){com.cs.back.Back.setOnChange(scope._onURLChange);}
this._onSelectChild=function(newChild){var id=scope._anchorLinkPrefix+newChild.id;if(scope._useBackForward){if(com.cs.back.Back.getValue()==""&&newChild==scope._initialTab){}
else{com.cs.back.Back.setValue(id);}}
scope.onChange(scope._selectedTab,newChild);scope._selectedTab=newChild;}
this._init=function(tabContainer){scope._selectedTab=scope._tabContainer.selectedChildWidget;scope._shownContent=scope._selectedTab.domNode;if(scope._useBackForward){scope._initBackForward();if(scope._initialTab==null){scope._initialTab=scope._selectedTab;}}
else{scope._initialTab=scope._selectedTab;}
dojo.subscribe(tabContainer.id+"-selectChild",scope,"_onSelectChild");}
this._init(this._tabContainer);this.getSelectedTab=function(){return scope._selectedTab;}
this.onChange=function(prevTab,newTab){var domPrev=null;var domNext=null;if(prevTab!=null){domPrev=prevTab.domNode;}
if(newTab!=null){domNext=newTab.domNode;}
scope.onChangeContent(domPrev,domNext);}
this.onChangeContent=function(prevTabContent,newTabContent){if(false&&scope._useFadeTransition){var contentToHide=scope._shownContent;newTabContent.style.display='none';contentToHide.style.display='';dojo.require("dojo.fx.easing");console.log(contentToHide);console.log(newTabContent);return;var showNewContent=function(){if(scope._newContentToShow!=null){scope._newContentToShow.style.display='';scope._currFadingAnimation=dojo.fadeIn({node:scope._newContentToShow,duration:scope.fadeDuration,onEnd:function(){scope._showingContent=null;},easing:dojo.fx.easing.cubicOut});scope._currFadingAnimation.play();scope._shownContent=scope._newContentToShow;}
scope._isFading=false;}
scope._newContentToShow=newTabContent;if(!scope._isFading){scope._isFading=true;if(scope._currFadingAnimation)scope._currFadingAnimation.stop();scope._currFadingAnimation=dojo.fadeOut({node:contentToHide,duration:scope.fadeDuration,onEnd:function(){contentToHide.style.display='none';scope._shownContent=null;showNewContent();},easing:dojo.fx.easing.cubicOut});scope._currFadingAnimation.play();}
dojo.fadeOut({node:scope._newContentToShow,duration:1}).play();}}}
com.cs.initClass("com.cs.CreditCard");com.cs.CreditCard=function(){}
com.cs.CreditCard.prefixMasterCardRegExp=/^5[1-5]/;com.cs.CreditCard.prefixVisaRegExp=/^4/;com.cs.CreditCard.prefixAmexRegExp=/^3(4|7)/;com.cs.CreditCard.prefixCashLinkRegExp=/^588731/;com.cs.CreditCard.prefixAPSPremierRegExp=/^589208/;com.cs.CreditCard.isValid=function(cardNumber,cardType)
{var isValid=false;var ccCheckRegExp=/[^\d ]/;isValid=!ccCheckRegExp.test(cardNumber);if(isValid)
{var cardNumbersOnly=cardNumber.replace(/ /g,"");var cardNumberLength=cardNumbersOnly.length;var lengthIsValid=false;var prefixIsValid=false;var prefixRegExp;switch(cardType.toLowerCase())
{case"mastercard":lengthIsValid=(cardNumberLength==16);prefixRegExp=com.cs.CreditCard.prefixMasterCardRegExp;break;case"visa":lengthIsValid=(cardNumberLength==16||cardNumberLength==13);prefixRegExp=com.cs.CreditCard.prefixVisaRegExp;break;case"amex":lengthIsValid=(cardNumberLength==15);prefixRegExp=com.cs.CreditCard.prefixAmexRegExp;break;case"cashlink":lengthIsValid=(cardNumberLength==17);prefixRegExp=com.cs.CreditCard.prefixCashLinkRegExp;break;case"apspremier":lengthIsValid=(cardNumberLength==15);prefixRegExp=com.cs.CreditCard.prefixAPSPremierRegExp;break;default:prefixRegExp=/^$/;alert("Card type not found");}
prefixIsValid=prefixRegExp.test(cardNumbersOnly);isValid=prefixIsValid&&lengthIsValid;}
if(isValid)
{var numberProduct;var numberProductDigitIndex;var checkSumTotal=0;for(digitCounter=cardNumberLength-1;digitCounter>=0;digitCounter--)
{checkSumTotal+=parseInt(cardNumbersOnly.charAt(digitCounter));digitCounter--;numberProduct=String((cardNumbersOnly.charAt(digitCounter)*2));for(var productDigitCounter=0;productDigitCounter<numberProduct.length;productDigitCounter++)
{checkSumTotal+=parseInt(numberProduct.charAt(productDigitCounter));}}
isValid=(checkSumTotal%10==0);}
return isValid;}
com.cs.CreditCard.getCardType=function(cardNumber){if(com.cs.CreditCard.prefixMasterCardRegExp.test(cardNumber)){if(com.cs.CreditCard.isValid(cardNumber,"mastercard")){return"mastercard";}}
if(com.cs.CreditCard.prefixVisaRegExp.test(cardNumber)){if(com.cs.CreditCard.isValid(cardNumber,"visa")){return"visa";}}
if(com.cs.CreditCard.prefixAmexRegExp.test(cardNumber)){if(com.cs.CreditCard.isValid(cardNumber,"amex")){return"amex";}}
if(com.cs.CreditCard.prefixCashLinkRegExp.test(cardNumber)){if(com.cs.CreditCard.isValid(cardNumber,"cashlink")){return"cashlink";}}
if(com.cs.CreditCard.prefixAPSPremierRegExp.test(cardNumber)){if(com.cs.CreditCard.isValid(cardNumber,"apspremier")){return"apspremier";}}
return"other";}
com.cs.CreditCard.cardTypeString=function(cardType){switch(cardType){case"visa":return"Visa";case"mastercard":return"MasterCard";case"amex":return"Amex";case"quikcash":return"HSBC Quikcash";case"cashlink":return"BOV CashLink";case"apspremier":return"APS Premier";}
return"";}
com.cs.initClass("com.cs.back.Back");com.cs.back.Back._value=null;com.cs.back.Back._firstOnChangeHandlerSet=false;console.log("Since you're using Back/Forward, make sure that you are including this file THE FIRST thing after <body> tag")
dojo.require("dojo.back");dojo.addOnLoad(function()
{});com.cs.back.Back._checkAnchorLinkInterval=0;com.cs.back.Back._checkAnchorLinkIntervalDelay=250;com.cs.back.Back._getAnchorLink=function(){var url=window.location.toString();var anchorLink="";if(url.indexOf("#")!=-1){anchorLink=url.substring(url.indexOf("#")+1);}
return anchorLink;}
com.cs.back.Back._checkAnchorLink=function(){var currValue=com.cs.back.Back._value;var currAnchorLink=com.cs.back.Back._getAnchorLink();currAnchorLink=com.cs.back.Back._normalizeStateID(currAnchorLink);if(currAnchorLink!=currValue){com.cs.back.Back.setValue(currAnchorLink);}}
com.cs.back.Back._normalizeStateID=function(stateID){if(stateID==null||stateID==undefined)stateID="";if(stateID.length>0&&stateID.charAt(0)=="/"){stateID=stateID.substring(1);}
return stateID;}
com.cs.back.Back._addState=function(stateID,initial){var state={back:function(){com.cs.back.Back._onchange(stateID,true);},forward:function(){com.cs.back.Back._onchange(stateID,false);},changeUrl:stateID}
if(initial){dojo.back.setInitialState(state);}
else{dojo.back.addToHistory(state);}
com.cs.back.Back._onchange(com.cs.back.Back._normalizeStateID(stateID),false);}
com.cs.back.Back._onchange=function(value,back){com.cs.back.Back._value=value;}
com.cs.back.Back._setInitialState=function(){var anchorLink=com.cs.back.Back._getAnchorLink();com.cs.back.Back._addState(anchorLink,true);com.cs.back.Back._onchange(anchorLink,false);}
com.cs.back.Back.setOnChange=function(scope,method){dojo.connect(com.cs.back.Back,"_onchange",scope,method);if(!com.cs.back.Back._firstOnChangeHandlerSet){com.cs.back.Back._firstOnChangeHandlerSet=true;com.cs.back.Back.initCheckInterval();com.cs.back.Back._onchange(com.cs.back.Back.getValue(),false);}}
com.cs.back.Back.setValue=function(value){if(com.cs.back.Back._value!=value){com.cs.back.Back._addState(value);}
else{}}
com.cs.back.Back.stopCheckInterval=function(){clearInterval(com.cs.back.Back._checkAnchorLinkInterval);}
com.cs.back.Back.initCheckInterval=function(){}
com.cs.back.Back.getValue=function(){return com.cs.back.Back._value;}
com.cs.back.Back._init=function(){com.cs.back.Back._setInitialState();}
dojo.addOnLoad(function(){com.cs.back.Back._init();});com.cs.initClass("com.cs.ajax");com.cs.ajax.AJAXCall=function(method,url,onLoad,sendContent){if(method!="GET"&&method!="POST"){method="GET";}
this.method=method;this.url=url;this.onLoad=onLoad;this.sendContent=sendContent;this.xmlHttp=null;this._aborted=false;this.params=new Array();var scope=this;this.getParameters=function(params){if(params.length>4){for(var i=4;i<params.length;i++){scope.params.push(params[i]);}}}
this.getXMLHttpRequest=function()
{if(window.ActiveXObject){scope.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
else if(window.XMLHttpRequest){scope.xmlHttp=new XMLHttpRequest();}}
this.callAJAX=function(){scope.xmlHttp.onreadystatechange=function(){if(scope._aborted)return;if(scope.xmlHttp.readyState==4){var result=scope.xmlHttp.responseText;var params=new Array();params.push(result);params=params.concat(scope.params);scope.onLoad.apply(scope,params);}}
scope.xmlHttp.open(scope.method,scope.url,true);scope.xmlHttp.send(scope.url);}
this.init=function(){scope.getXMLHttpRequest();scope.callAJAX();}
this.getParameters(arguments);this.init();this.destroy=function(){scope._aborted=true;scope.xmlHttp.abort();}
this.toString=function(){return"[com.cs.ajax.AJAXCall]";}}
com.cs.initClass("com.cs.ui.ImageElementToggler");com.cs.ui.ImageElementToggler=function(img,toggleElem,imgExpandUrl,imgUnexpandUrl)
{this._img=dojo.byId(img);this._toggleElem=dojo.byId(toggleElem);this._imgExpandUrl=imgExpandUrl;this._imgUnExpandUrl=imgUnexpandUrl;this._currState=false;this._imgOnClick=function()
{this.ChangeState();}
if(this._toggleElem==null)
throw new Error("com.cs.ui.ImageElementToggler: _toggleElem is not defined");if(this._img==null)
throw new Error("com.cs.ui.ImageElementToggler: _img is not defined");this._checkState=function()
{if(this._currState)
{this._img.src=this._imgUnExpandUrl;this._toggleElem.style.display='';}
else
{this._img.src=this._imgExpandUrl;this._toggleElem.style.display='none';}}
this.ChangeState=function()
{this._currState=!this._currState;this._checkState();}
if(this._toggleElem.style.display!='none')
this._currState=true;this._checkState();dojo.connect(this._img,"onclick",this,this._imgOnClick);}
com.cs.initClass("com.cs.ui.FLVPlayer");com.cs.ui.FLVPlayer.COUNT=0;com.cs.ui.FLVPlayer.GeneralFLVPlayer=function(){this.PLAYER_URL="/includes/com/flash/flv/player.swf";this.EXPRESS_INSTALL="/includes/com/flash/swfobject/expressInstall.swf";this._div=document.createElement("div");this._divVideo=null;this._removeCurrentDiv=function(){if(this._divVideo){this._div.removeChild(this._divVideo);}}
this._createDiv=function(width,height){this._removeCurrentDiv();this._divVideo=document.createElement("div");this._div.appendChild(this._divVideo);if(width.indexOf("%")==-1){width=parseInt(width)+"px";}
if(height.indexOf("%")==-1){height=parseInt(height)+"px";}
this._div.style.width=this._divVideo.style.width=width;this._div.style.height=this._divVideo.style.height=height;this._divVideo.id="FLV_PLAYER_"+com.cs.ui.FLVPlayer.COUNT;com.cs.ui.FLVPlayer.COUNT++;return this._divVideo;}
this._playVideo=function(flvURL,width,height){if(width==undefined)width="100%";if(height==undefined)height="100%";var div=this._createDiv(width,height);var flashvars={file:flvURL};var params={bgcolor:"#000000",allowFullScreen:"true",allowscriptaccess:"always"};var attributes={};attributes.id=div.id;attributes.name=div.id;if(!swfobject){alert("Please include SWF Object to play FLVs");}
swfobject.embedSWF(this.PLAYER_URL,div.id,width,height,"9.0.0",this.EXPRESS_INSTALL,flashvars,params,attributes);}
this._init=function(){}
this.play=function(url,width,height){this._playVideo(url,width,height);}
this.div=function(){return this._div;}}
com.cs.initClass("com.cs.util.ArrayUtil");com.cs.util.ArrayUtil._randomSortFunction=function(elem1,elem2){var r=Math.random();if(r<1/2){return-1;}
else{return 1;}}
com.cs.util.ArrayUtil.randomizeArray=function(a){if(!a instanceof Array){throw new Error("Please provide an array");}
else if(a.length<=1){return a;}
var lastElem=a[a.length-1];b=com.cs.util.ArrayUtil.clone(a);var r=b.sort(com.cs.util.ArrayUtil._randomSortFunction);if(r[0]==lastElem){return com.cs.util.ArrayUtil.randomizeArray(r);}
else{return r;}}
com.cs.util.ArrayUtil.clone=function(a){return a.slice(0);}