var DateTime={DAYS_SHORT:["Sun","Mon","Tue","Wed","Thur","Fri","Sat"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"]};var StringUtils={labelReplace:function(B,D){var A=String(B);for(var C=0;C<D.length;C++){A=A.replace("{"+C+"}",D[C])}return A},formatBR:function(A){return A.replace("\n","<br />\n")},shortenText:function(H,D,F){var J=0;var E=-1;var I=-1;var A=0;for(var C=0,B=H.length;C<B;C++){var G=H.charAt(C);A++;if(G=="/r"){continue}else{if(G=="/n"){J++;E=0;I=0}else{if(G==" "){I=E++}else{E++}}}if(E==D){if(G!=" "){E-=I}else{E=0}J++;if(F>1){I=0}}if(J==F){break}}if(A<H.length){A=A-(D-I);return H.substr(0,A)}else{return H}},isEmail:function(F){F=F.toLowerCase();var G="abcdefghijklmnopqrstuvwxyz-1234567890";var D=G+"_.";var C=D;var E=0;var A=0;for(var B=0,H=F.length;B<H;B++){if(C.indexOf(F.charAt(B))==-1){if(F.charAt(B)=="@"){C=G;E++}else{if((C==G)&&(F.charAt(B)==".")){if(B-A<2){return false}A=B}else{return false}}}}if(E==1){return true}return false},isExtendedEmail:function(F){if(StringUtils.isEmail(F)){return true}F=F.toLowerCase();var H='"abcdefghijklmnopqrstuvwxyz-1234567890 []';var E=false;var I=-1;var B;for(var D=0,A=F.length;D<A;D++){var G;if(H.indexOf(G=F.charAt(D))==-1){if(G=="<"){I=D;E=true;break}}}if(!E){return false}if(I>-1){var C=-1;B=F.substring(I+1,F.length);for(var D=B.length-1;D>-1;D--){if(B.charAt(D)==">"){C=D;break}else{if(B.charCodeAt(D)!=32){return false}}}return StringUtils.isEmail(B.substring(0,C-1))}else{return false}},isPhone:function(D){var A=7;var B=0;if(D.length<A){return false}for(var C=0;C<D.length;C++){if(!isNaN(D.charAt(C))){B++}}if(A<=B){return true}return false},isNumber:function(C,B,A){if((isNaN(C))||((B)&&(C<B))||((A)&&(C>A))){return false}return true},trim:function(A){var D=0;var C=0;for(var B=0;B<A.length;B++){if(A.charCodeAt(B)!=32){D=B;break}}for(var B=A.length;B>-1;B--){if(A.charCodeAt(B)!=32){C=B;break}}if(D!=C){return A.substr(D,C-D)}else{return""}},getFilename:function(A){return A.substring(A.lastIndexOf("/")+1,A.length)}};var ImageUtils={newImage:function(B){var A=document.createElement("img");A.setAttribute("src",B.filename);A.setAttribute("height",B.height);A.setAttribute("width",B.width);A.setAttribute("alt",B.alt);return A},centre:function(D,B,A){function C(F,G){return Math.floor((G-F)/2)}var E=0;if(D.height<A){E=C(D.height,A)}D.style.marginTop=E+"px";E=0;if(D.width<B){E=C(D.width,B)}D.style.marginLeft=E+"px"}};var FormUtils={findDataSelect:function(A,B){var C=A.options[A.options.selectedIndex].value;return this.findDataId(C,B)},findDataId:function(C,B){if(B==null){return null}for(var A=B.length-1;A>-1;A--){if(C==B[A]["id"]){return B[A]}}return null},selectById:function(D,A){var B=A.options;for(var C=B.length-1;C>-1;C--){if(B[C].value==D){B.selectedIndex=C;return }}},populateSelect:function(A,F,E){var B,H;if(E){B=E.name;H=E.id}else{B="name";H="id"}for(var D=0,G=F.length;D<G;D++){try{A.add(new Option(F[D][B],F[D][H]),null)}catch(C){A.add(new Option(F[D][B],F[D][H]))}}},newOption:function(C,D,B){var A=new Option(D,C);if(B){A.className=B}return A},select:function(D,A){var B=A.options.length-1;for(var C=B;C>-1;C--){if(A.options[C].value==D){A.selectedIndex=C;return }}},isEmail:function(A){return StringUtils.isEmail(document.getElementById(A).value)},isPhone:function(A){return StringUtils.isPhone(document.getElementById(A).value)},hasString:function(A){return((StringUtils.trim(document.getElementById(A).value).length)!==0)},clearDefault:function(B){var A=document.getElementById(B);if(A.defaultValue==A.value){A.value=""}},isChecked:function(A){return document.getElementById(A).checked==true},doHidden:function(A,C){for(name in A){var B=document.createElement("input");B.setAttribute("type","hidden");B.setAttribute("name",name);B.setAttribute("value",A[name]);C.appendChild(B)}},getCookie:function(A){var B=document.cookie.match("(^|;) ?"+A+"=([^;]*)(;|$)");if(B){return(unescape(B[2]))}else{return null}}};function FormValidator(){this.criteria=[];this.messages=""}FormValidator.prototype.valid=true;FormValidator.prototype.addCriteria=function(B,A){this.criteria[this.criteria.length]={message:B,isValid:A}};FormValidator.prototype.validate=function(){this.messages="";this.valid=true;for(var A=0;A<this.criteria.length;A++){if(!this.criteria[A].isValid()){this.valid=false;this._addMessage(this.criteria[A].message)}}};FormValidator.prototype._addMessage=function(A){this.messages+="*   "+A+"\n"};BasicValidator.prototype=new FormValidator();BasicValidator.prototype.constructor=BasicValidator;function BasicValidator(A){if(A){this.errorTitle=A}}BasicValidator.prototype.errorTitle=null;BasicValidator.prototype.validate=function(){FormValidator.prototype.validate.call(this);if(!this.valid){alert(this.errorTitle+"\r\n"+this.messages);return false}else{return true}};function DomValidator(B,D,C,A){this.errorDivs=[];this.criteria=[];this.parentClassName=B;this.parentErrClassName=D;this.errClassName=C;this.errNodeType=A||"div"}DomValidator.prototype.addCriteria=function(B,A,C){this.criteria[this.criteria.length]={message:C,validator:B,input:null,inputId:A}};DomValidator.prototype.removeCriteria=function(B){var D=this.criteria.length;var A=-1;for(var C=D;C>-1;C--){if(this.criteria[C].inputId==B){A=C;break}}if(A!=-1){this.criteria.splice(A,1)}};DomValidator.prototype.getParams=function(){var C=[];for(var A=0;A<this.criteria.length;A++){var B=this.criteria[A];if(B.input.nodeName=="INPUT"){C[B.input.id]=B.input.value}else{if(B.input.nodeName=="SELECT"){C[B.input.id]=B.input.options[B.input.selectedIndex].value}}}return C};DomValidator.prototype.validate=function(){var A=true;var I=[];for(var D=this.criteria.length-1,G=D;G>-1;G--){var J=this.criteria[G];if(!J.input){var B=document.getElementById(J.inputId);if(B==null){throw"div does not exist "+J.inputId}J.input=B}var K=false;var H=(I.length-1);for(var F=H;F>-1;F--){if(I[F]==J.inputId){K=true}}if(K){continue}var C;if((J.input.nodeName=="INPUT")||(J.input.nodeName=="TEXTAREA")){C=J.validator(J.input.value)}else{if(J.input.nodeName=="SELECT"){C=J.validator(J.input)}else{throw ("unsupported node type "+J.input.nodeName)}}var E=this.errorDivs[J.inputId];if(E){if(C){E.parentNode.className=this.parentClassName;E.parentNode.removeChild(E);this.errorDivs[J.inputId]=null;continue}else{E.parentNode.removeChild(E);this.errorDivs[J.inputId]=null}}else{if(C){continue}}E=document.createElement(this.errNodeType);E.className=this.errClassName;E.innerHTML=J.message;J.input.parentNode.appendChild(E);this.errorDivs[J.inputId]=E;I.push(J.inputId);A=false;E.parentNode.className=this.parentErrClassName}return A};var DOMTools={getOffsetTop:function(C){var B=C.offsetTop;var A=C.offsetParent;while(A){B+=A.offsetTop;A=A.offsetParent}return B},getOffsetLeft:function(C){var B=C.offsetLeft;var A=C.offsetParent;while(A){B+=A.offsetLeft;A=A.offsetParent}return B},positionChild:function(B,A){parent=document.getElementById(B);document.getElementById(A).style.left=this.getOffsetLeft(parent)+"px";document.getElementById(A).style.top=(this.getOffsetTop(parent)+parent.offsetHeight)+"px"},showHide:function(C,A){var B=document.getElementById(A);if(B.display=="none"){B.display=((B.display=="none")?"inline":"none");this.positionChild(C,A)}else{B.display="none"}},centre:function(A){var H=A.parentNode;function E(J,K){return Math.floor((K-J)/2)}function I(J){return Number(J.replace("px",""))}var F=I(A.style.height);var C=I(A.style.width);var G=I(H.style.height);var B=I(H.style.width);var D=0;if(F<G){D=E(F,G)}A.style.marginTop=D+"px";D=0;if(C<B){D=E(C,B)}A.style.marginLeft=D+"px"}};var EventUtils={attachClick:function(A,B){if(A.addEventListener){A.addEventListener("click",B,false)}else{if(A.attachEvent){A.attachEvent("onclick",B)}}}};var AJAXHandler=function(B,A){this.http=null;this.url=A;this.post=B;this.params=null;this.multiParams=null;try{this.http=new XMLHttpRequest()}catch(C){try{this.http=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{this.http=new ActiveXObject("Microsoft.XMLHTTP")}catch(C){throw ("AJAX UNSUPPORTED")}}}};AJAXHandler.prototype.setStateChange=function(A){this.http.onreadystatechange=A};AJAXHandler.prototype.setParams=function(A){this.params=A};AJAXHandler.prototype.addParam=function(A,B){if(this.multiParams==null){this.multiParams=[]}this.multiParams.push(A+"="+encodeURIComponent(B))};AJAXHandler.prototype.doRequest=function(){var C="";if(this.params!=null){for(key in this.params){C+=((C.length==0)?"":"&")+key+"="+encodeURIComponent(this.params[key])}}if(this.multiParams!=null){var D=this.multiParams.length;for(var B=0;B<D;B++){C+=((C.length==0)?"":"&")+this.multiParams[B]}}var A=this.http;if(this.post){A.open("POST",this.url,true);A.setRequestHeader("Content-type","application/x-www-form-urlencoded");A.setRequestHeader("Content-length",C.length);A.setRequestHeader("Connection","close");A.send(C)}else{A.open("GET",this.url+"?"+C,true);A.send(null)}};var AJAXHelpers={formAssign:function(D){var E=new AJAXHandler((D.getAttribute("method")=="post"),D.getAttribute("action"));var A=D.elements.length-1;for(var C=A;C>-1;C--){var B=D.elements[C];var F;if(B.nodeName=="SELECT"){F=B.options[B.selectedIndex].value}else{if((B.nodeName=="INPUT")&&(B.type=="radio")){if(!B.checked){continue}F=B.value}else{if(B.nodeName=="INPUT"){F=B.value}else{throw"Unsupported node type: "+B.nodeName}}}E.addParam(B.name,F)}return E},stdRequestHandler:function(A){if(A.http.readyState==4){if((A.http.status!==200)||(A.http.responseText!="ok")){alert(A.http.responseText)}}}};