var CB=function(){return{Tally:function(c,f,b,a){var e="tallyObject="+c+"&tallyMethod="+f+"&tallyTask="+b;if(a){e+="&tallyNumThings="+a}var d="tally.aspx";CB.AJAX.submitCallback(e,d,function(){})},Timing:function(c,e,a,d){var b="timingPage="+c+"&timingMethod="+e+"&timingTask="+a+"&timingDuration="+d;CB.AJAX.submitCallback(b,"timing.aspx",function(){})},IsValidEmail:function(f,h,j,c){var l=new RegExp("^([-A-Za-z0-9._'&+])+@[-A-Za-z0-9._'+]+[.][A-Za-z]{2,}$","g");var e=new RegExp(",|,,|;|\r|\n|,\r","g");var a="";var b,k,g,d;if(typeof l=="undefined"||typeof e=="undefined"||l===null||e===null){alert("Error: Email validator is not available at the moment or is corrupted. Please contact technology");return false}if(h===null){h=false}if(j===null){j=true}if(f.length>0){if((f.indexOf(",")>0||f.indexOf(";")>0)&&h===true){f=f.emailtrim();b=f.replace(e,",");k=b.split(",");g="";for(d=0;d<k.length;d++){g=k[d];g=g.emailtrim();if(g===""||g===" "){continue}if(g.match(l)===null){if(j===true){alert("Please correct the following invalid email address, and try again.\n"+g)}return false}if(a!==""){a+=";"}a+=g}}else{f=f.emailtrim();bool=f.match(l);if(bool===null){if(j){alert("Your email address is invalid. Please correct it and try again.")}return false}else{a=f}}}else{a=f}if(typeof c!="undefined"){c.value=a}return true},CrossPagePostTo:function(c,b){var a;if(theForm){a=theForm}else{a=c.form}a.action=b;a.submit()},object:function(b){function a(){}a.prototype=b;return new a()},e:function(a){return document.getElementById(a)}}}();String.prototype.emailtrim=function(){var a=this;a=a.replace(/^\s*(.*)/,"$1");a=a.replace(/(.*?)\s*$/,"$1");a=a.replace(/(.*?),*$/,"$1");return a};CB.Window=function(){function a(b){document.documentElement.scrollTop=b;document.body.scrollTop=b}return{getWidth:function(){if(CB.Window.khtml){return window.innerWidth}else{if(window.opera){return document.body.clientWidth}else{if(document.documentElement.clientWidth!==0){return document.documentElement.clientWidth}else{return document.body.clientWidth}}}},getHeight:function(){if(CB.Window.khtml){return window.innerHeight}else{if(window.opera){return document.body.clientHeight}else{if(CB.Window.gecko){return Math.min(document.documentElement.clientHeight,document.body.clientHeight)}else{if(document.documentElement.clientHeight!==0){return document.documentElement.clientHeight}else{return document.body.clientHeight}}}}},getScrollWidth:function(){if(CB.Window.ie){return Math.max(Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth),document.body.scrollWidth)}else{if(CB.Window.khtml){return document.body.scrollWidth}else{return document.documentElement.scrollWidth}}},getScrollHeight:function(){if(CB.Window.ie){return Math.max(Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight),Math.max(document.body.offsetHeight,document.body.scrollHeight))}else{if(CB.Window.khtml){return document.body.scrollHeight}else{return document.documentElement.scrollHeight}}},getScrollLeft:function(){return window.pageXOffset||document.documentElement.scrollLeft},getScrollTop:function(){return Math.max(document.documentElement.scrollTop,document.body.scrollTop)},getSize:function(){return{size:{x:CB.getWidth(),y:CB.getHeight()},scrollSize:{x:CB.getScrollWidth(),y:CB.getScrollHeight()},scroll:{x:CB.getScrollLeft(),y:CB.getScrollTop()}}},scrollDown:function(c,b){for(i=0;i<c;i+=b){a(CB.Window.getScrollTop()+b)}}}}();if(window.ActiveXObject){CB.Window.ie=window[window.XMLHttpRequest?"ie7":"ie6"]=true;CB.Window.ie7=(navigator.userAgent.indexOf("MSIE 7")>-1);CB.Window.ie6=(navigator.userAgent.indexOf("MSIE 6")>-1)}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){CB.Window.khtml=true}else{if(document.getBoxObjectFor!==null){CB.Window.gecko=true}}}CB.EventUtils=function(){function a(g){var f=true;if(!g){g=b(event)}var c=this.eventHandlers[g.type];for(var d=0;d<c.length;d++){if(c[d]&&typeof c[d]=="function"){if(g.target){f=!((f&&c[d](g,g.target))===false)}else{if(g.srcElement){f=!((f&&c[d](g,g.srcElement))===false)}else{f=!((f&&c[d](g))===false)}}}}return f}function b(c){c.preventDefault=b.preventDefault;c.stopPropagation=b.stopPropagation;return c}b.preventDefault=function(){this.returnValue=false};b.stopPropagation=function(){this.cancelBubble=true};return{addEventListener:function(e,c,d){if(!e.eventHandlers){e.eventHandlers=[]}if(!e.eventHandlers[c]){e.eventHandlers[c]=[];if(e["on"+c]){e.eventHandlers[c].push(e["on"+c])}e["on"+c]=a}e.eventHandlers[c].push(d)},removeEventListener:function(g,e,f){var c=g.eventHandlers[e];for(var d in c){if(c[d]==f){delete c[d]}}},addLoadEvent:function(c){this.addEventListener(window,"load",c)},addResizeEvent:function(c){this.addEventListener(window,"resize",c)}}}();CB.SuggestionTextbox=function(){function b(d){if(d.value.length===0||d.value==d.suggestionText){d.style.color="gray";d.value=d.suggestionText}else{d.style.color=""}}function a(d){if(d.value==d.suggestionText){d.value=""}d.style.color=""}function c(d){a(d)}return{setupTextbox:function(d,e,f){CB.EventUtils.addEventListener(d,"blur",function(g,h){b(d)});CB.EventUtils.addEventListener(d,"focus",function(g,h){a(d)});CB.EventUtils.addEventListener(f,"click",function(g,h){c(d)});d.suggestionText=e;b(d)}}}();CB.Textbox=function(){function a(b,c){if((b.which&&b.which==13)||(b.keyCode&&b.keyCode==13)){if(c.cbEnterPressAction){c.cbEnterPressAction()}}}return{setupTextbox:function(b,c){b.cbEnterPressAction=c;CB.EventUtils.addEventListener(b,"keydown",a)}}}();if(window.XMLHttpRequest||window.ActiveXObject){if(window.ActiveXObject){var lib=/MSIE 5/.test(navigator.userAgent)?"Microsoft":"Msxml2";window.XMLHttpRequest=function(){return new ActiveXObject(lib+".XMLHTTP")}}}CB.AJAX=function(){return{currentVisiblePopup:null,isPopupLocked:false,createRequest:function(){var b;try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{b=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){b=null}}if(!b&&typeof XMLHttpRequest!="undefined"){b=new XMLHttpRequest()}return b},submitCallback:function(f,e,c,b){var d=this.createRequest();if(d){var a="";if(ScriptVariables.Contains("sAjaxRelativePrefix")){a=ScriptVariables.Get("sAjaxRelativePrefix")}else{a=ajaxRelativePrefix}if(typeof a!="undefined"){e=a+e;d.open("POST",e,true);d.setRequestHeader("Content-Type","application/x-www-form-urlencoded");d.onreadystatechange=function(){CB.AJAX.relayResponse(d,c)};CB.AJAX.isPopupLocked=b;d.send(f)}else{c(false,"Relative prefix not found (be sure to use Page.HasAjax).")}}else{c(false,"Unable to create request object.")}},relayResponse:function(c,b){var d;var a;if(c.readyState==4){try{if(c.status==200){d=c.responseText;a=d.indexOf("<!DOCTYPE");if(a!=-1){d=d.substring(0,a)}CB.AJAX.isPopupLocked=false;b(true,d)}else{CB.AJAX.isPopupLocked=false;b(false,"Ajax page returned error code "+c.status+".")}}catch(f){}}},hidePopups:function(){if(CB.AJAX.currentVisiblePopup&&!CB.AJAX.isPopupLocked){CB.AJAX.currentVisiblePopup.hide()}if(window.hideCurrentPopup){hideCurrentPopup()}}}}();CB.AJAX.Popup=function(){function c(d,f){var e;if(CB.AJAX.currentVisiblePopup.documentClickCloses){if(!CB.AJAX.currentVisiblePopup.isModal){if(f){e=CB.e("shadowAJAX");if(!e||!e.lastAnchor||e.lastAnchor.id!=f.id){CB.AJAX.hidePopups()}}}}}function b(f,g,h){var j=0;var d=f.offsetWidth/3;var e=f.offsetWidth-d;if(f.offsetParent){while(f.offsetParent){j+=f.offsetLeft;f=f.offsetParent}}else{if(f.x){j+=f.x}}if(h&&h==="flush"){if(j>CB.Window.getWidth()/2){return(j+(d*3))-g.scrollWidth}else{return j}}else{if(j>CB.Window.getWidth()/2){return(j+e)-(g.scrollWidth)}else{return j+d}}}function a(d,e){var f=0;if(d.offsetParent){while(d.offsetParent){f+=d.offsetTop;d=d.offsetParent}}else{if(d.y){f+=d.y}}if(!CB.Window.ie){if(f+20+e.offsetHeight>CB.Window.getScrollHeight()){return CB.Window.getScrollHeight()-e.offsetHeight}else{return f+20}}else{if(f+15+e.offsetHeight>CB.Window.getScrollHeight()){return CB.Window.getScrollHeight()-e.offsetHeight}else{return f+15}}}return{containerElm:null,parentContainer:null,isModal:false,documentClickCloses:true,halign:null,initialize:function(d,e){this.containerElm=d;if(d){this.parentContainer=d.parentNode;this.containerElm.style.left="-3000px";this.containerElm.style.top="0px"}if(e){this.isModal=e.isModal;this.documentClickCloses=e.documentClickCloses;this.halign=e.halign}},show:function(f,n,l,j){var d=CB.e("shadowAJAX");var h=CB.e("popupIframe");var k,e;if(!h){h=document.createElement("iframe");h.id="popupIframe";CB.EventUtils.addEventListener(h,"click",function(o,p){o.cancelBubble=true});h.style.position="absolute";h.style.background=0;h.style.filter="chroma(color=#FFFFFF)";h.style.allowTransparency="true";h.style.frameborder="No";document.body.appendChild(h)}if(!d){d=document.createElement("div");d.className="cb_style shadowing";d.style.textAlign="left";d.id="shadowAJAX";CB.EventUtils.addEventListener(d,"click",function(o,p){o.cancelBubble=true});document.body.appendChild(d)}if(this.containerElm&&!CB.AJAX.isPopupLocked){CB.AJAX.hidePopups();if(this.isModal){var m=CB.e("modal_background");if(!m){m=document.createElement("div");m.id="modal_background";document.body.appendChild(m)}m.style.width=CB.Window.getScrollWidth()+"px";m.style.height=CB.Window.getScrollHeight()+"px";m.style.left="0px";d.x=((CB.Window.getWidth()/2)-(this.containerElm.scrollWidth/2));d.y=((CB.Window.getHeight()/2)-(this.containerElm.scrollHeight/2));d.style.left=d.x+"px";d.style.top=d.y+"px";if(CB.Window.ie7||CB.Window.gecko||CB.Window.khtml){d.style.position="fixed"}}else{if(f){f.blur();d.x=b(f,this.containerElm,this.halign);d.y=a(f,this.containerElm);if(arguments.length==4&&l!=null&&j!=null){d.x+=l;d.y+=j}d.style.left=d.x+"px";d.style.top=d.y+"px";d.lastAnchor=f;d.style.position="absolute"}}this.onShow(n);this.containerElm.style.left="0px";d.appendChild(this.containerElm);if(!CB.Window.ie){d.style.height=(this.containerElm.scrollHeight+1)+"px";d.style.width=(this.containerElm.scrollWidth+4)+"px"}else{d.style.height=(this.containerElm.scrollHeight+6)+"px";d.style.width=(this.containerElm.scrollWidth+6)+"px"}h.style.height=(this.containerElm.offsetHeight)+"px";h.style.width=(this.containerElm.offsetWidth)+"px";h.style.border=0;if(f){h.style.left=b(f,this.containerElm,this.halign)+"px";h.style.top=a(f,this.containerElm)+"px"}if(!CB.Window.ie){h.ownerDocument.body.style.border=0}else{document.frames[h.id].document.onreadystatechange=function(o){if((document.frames[h.id].document.readyState)=="complete"){document.frames[h.id].document.body.style.border=0}}}this.containerElm.style.visibility="visible";d.style.visibility="visible";h.style.visibility="visible";this.containerElm.focus();var g=this.containerElm.getElementsByTagName("input");if(g!==null&&g.length>0){if(g[0].style.visibility=="visible"){g[0].focus()}}CB.AJAX.currentVisiblePopup=this;CB.Window.scrollDown((d.offsetHeight+d.y-CB.Window.getScrollTop())-CB.Window.getHeight(),8);CB.EventUtils.addEventListener(document,"click",c)}},onShow:function(e,d){},hide:function(){var f=CB.e("shadowAJAX");if(f){f.style.visibility="hidden"}var e=CB.e("popupIframe");if(e){e.style.visibility="hidden"}if(this.isModal){var d=CB.e("modal_background");if(d){d.style.left="-3000px"}}if(this.containerElm.style.visibility!="hidden"){this.containerElm.style.visibility="hidden";this.containerElm.style.left="-3000px";this.parentContainer.appendChild(this.containerElm);this.onHide()}CB.EventUtils.removeEventListener(document,"click",c)},onHide:function(){}}}();function submitCallback(e,d,b,f){if(f){if(document.title&&document.title.indexOf("WAT")>-1&&document.title.indexOf("RunDeveloper")>-1){alert("You are using the old submitCallback method.  Please update your AJAX call to use CB.AJAX.submitCallback.  Callback sent to "+d)}}var c=CB.AJAX.createRequest();if(c){var a="";if(ScriptVariables.Contains("sAjaxRelativePrefix")){a=ScriptVariables.Get("sAjaxRelativePrefix")}else{a=ajaxRelativePrefix}if(typeof a!="undefined"){d=a+d;c.open("POST",d,true);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");c.onreadystatechange=function(){CB.AJAX.relayResponse(c,b)};c.send(e)}else{b(false,"Relative prefix not found (be sure to use Page.HasAjax).")}}else{b(false,"Unable to create request object.")}};