String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")};String.prototype.startsWith=function(a,b){if(b)return this.match("^"+a)==a;else{a=a.toLowerCase();return this.toLowerCase().match("^"+a)==a}};String.prototype.endsWith=function(a,b){if(b)return this.match(a+"$")==a;else{a=a.toLowerCase();return this.toLowerCase().match(a+"$")==a}};String.prototype.format=function(){var a=/\{\d+\}/g,b=arguments;return this.replace(a,function(a){return b[a.match(/\d+/)]})};Array.prototype.remove=function(a,c){var b=this.slice((c||a)+1||this.length);this.length=a<0?this.length+a:a;return this.push.apply(this,b)};Array.prototype.removeValue=function(c){for(var a=0,b=this.length;a<b;a++)if(this[a]===c)return this.remove(a);return this};Array.prototype.toList=function(b){var c="";if(!b)b=",";for(var a=0,d=this.length;a<d;a++)if(a===0)c=this[a];else c+=b+this[a];return c};var NS_XHTML="http://www.w3.org/1999/xhtml",NS_STATE="http://www.w3.org/2005/07/aaa";if(typeof Dea==="undefined"||null===Dea)var Dea={};Dea.Keys={PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,SPACE:32,TAB:9,BACKSPACE:8,DELETE:46,ENTER:13,INSERT:45,ESCAPE:27};Dea.keyUpTypeVal=function(b,d){var a=b.target||b.srcElement,c=new RegExp(d);!c.test($(a).val())&&$(a).val("")};Dea.checkLength=function(b,c,d){if(Dea.Get(c).value.length<d)return true;else{var a=b.which||b.keyCode;return a===Dea.Keys.UP||a===Dea.Keys.RIGHT||a===Dea.Keys.LEFT||a===Dea.Keys.DOWN||a===Dea.Keys.BACKSPACE||a===Dea.Keys.DELETE?true:false}};Dea.isNumberKey=function(a){return a>47&&a<58?true:false};Dea.isNavKey=function(a){return a===Dea.Keys.LEFT||a===Dea.Keys.RIGHT||a===Dea.Keys.UP||a===Dea.Keys.DOWN||a===Dea.Keys.BACKSPACE||a===Dea.Keys.HOME||a===Dea.Keys.END||a===Dea.Keys.TAB?true:false};Dea.numberMask=function(a){var b=a.which||a.keyCode;(a.shiftKey&&b==35||a.shiftKey&&b==36||a.shiftKey&&b==37)&&Dea.preventDefault(a);if(Dea.isNumberKey(b)||Dea.isNavKey(b))return true;else Dea.preventDefault(a)};Dea.preventDefault=function(a){if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false;else return false};Dea.suppressSubmitOnReturn=function(a){var b=a.which||a.keyCode;if(b===Dea.Keys.ENTER)return false};Dea.Mouse={};Dea.matchEmsDataId=function(b,c){for(var a=0,e=b.length;a<e;a++){var d=b[a].emsDataId||b[a].getAttribute("emsDataId");if(d===c)return b[a];else if(b[a].name===c)return b[a]}return null};Dea.Get=function(c,b){var a=document.getElementById(c);if(a)return a;a=null;if(!b||b===null)b=document.getElementsByTagName("input");a=Dea.matchEmsDataId(b,c);if(a!==null)return a;b=document.getElementsByTagName("select");a=Dea.matchEmsDataId(b,c);if(a!==null)return a;b=document.getElementsByTagName("textarea");a=Dea.matchEmsDataId(b,c);return a!==null?a:null};Dea.setDisplay=function(a,c,e,f,b,d){if(typeof a==="string")a=Dea.Get(a);if(a){if(c==="none"||c==="hidden")a.setAttribute("aria-hidden","true");else a.setAttribute("aria-hidden","false");a.style.display=c;if(b&&b!==null)a.style.position=b;if(e&&e!==null)a.style.left=e;if(f&&f!==null)a.style.top=f;if(d&&d!==null)a.style.right=d}};Dea.Css={classExists:function(a,b){if(typeof a==="string")a=Dea.Get(a);return(new RegExp("\\b"+b+"\\b")).test(a.className)},swapClass:function(a,b,c){if(typeof a==="string")a=Dea.Get(a);a.className=!Dea.Css.classExists(a,b)?a.className.replace(c,b):a.className.replace(b,c)},addClass:function(a,b){if(typeof a==="string")a=Dea.Get(a);if(!Dea.Css.classExists(a,b))a.className+=a.className?" "+b:b},removeClass:function(a,b){if(typeof a==="string")a=Dea.Get(a);if(a.className){var c=a.className.match(" "+b)?" "+b:b;a.className=a.className.replace(c,"")}}};Dea.findPos=function(a){if(typeof a==="string")a=Dea.Get(a);if(a){var b=curtop=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;while(a=a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop}}}return[b,curtop]};Dea.emsData={};Dea.emptyToMinusOne=function(a){return a?a===""?"-1":a:"-1"};Dea.setEmsData=function(f){for(var b=document.getElementsByTagName("input"),a=0,h=b.length;a<h;a++){var d=b[a].emsDataId||b[a].getAttribute("emsDataId"),g=b[a].isRequired||b[a].getAttribute("isRequired");if(d){if(g)if(b[a].value===""&&f!==true){Dea.setAlert(b[a].errorMsg);return false}if(b[a].type==="checkbox"||b[a].type==="radio")if(b[a].checked)Dea.emsData[d]="1";else Dea.emsData[d]="0";else Dea.emsData[d]=b[a].value}else if(b[a].name.substring(0,4)==="ems_"||b[a].name.substring(0,3)==="mc_")if(b[a].type==="checkbox")if(b[a].checked)Dea.emsData[b[a].name]="1";else Dea.emsData[b[a].name]="0";else Dea.emsData[b[a].name]=b[a].value}for(var c=document.getElementsByTagName("select"),a=0,h=c.length;a<h;a++){var d=c[a].emsDataId||c[a].getAttribute("emsDataId"),g=c[a].isRequired||c[a].getAttribute("isRequired");if(d){if(g)if((c[a].value===""||c[a].options[c[a].selectedIndex].text==="")&&f!==true){Dea.setAlert(c[a].errorMsg);return false}Dea.emsData[d]=Dea.emptyToMinusOne(c[a].value)}}for(var e=document.getElementsByTagName("textarea"),a=0,h=e.length;a<h;a++){var d=e[a].emsDataId||e[a].getAttribute("emsDataId"),g=e[a].isRequired||e[a].getAttribute("isRequired");if(d){if(g)if(e[a].value===""&&f!==true){Dea.setAlert(e[a].errorMsg);return false}Dea.emsData[d]=e[a].value}}return true};Dea.getValue=function(a,c,b){if(typeof a==="string")a=Dea.Get(a,c);return a?a.value.trim():b?b:void 0};Dea.getText=function(a,c,b){if(typeof a==="string")a=Dea.Get(a,c);return a?a.text.trim():b?b:void 0};Dea.setValue=function(a,c,b){if(typeof a==="string")a=Dea.Get(a,b);if(a)a.value=c};Dea.setHtml=function(a,b){if(typeof a==="string")a=Dea.Get(a);if(a)a.innerHTML=b};Dea.showError=function(a,c,b){if(typeof a==="string")a=Dea.Get(a,c);if(a){if(b){if(typeof b==="string")b=Dea.Get(b,c);b!=null&&$(b).click()}var d=a.errorMsg||a.getAttribute("errorMsg");Dea.setAlert(d);a!=null&&a.focus()}};Dea.setDisabled=function(a,c,b){if(typeof a==="string")a=Dea.Get(a,b);if(a)a.disabled=c};Dea.hideSelectBoxes=function(){if(document.all)for(var b=document.getElementsByTagName("select"),a=0,c=b.length;a<c;a++)b[a].style.visibility="hidden"};Dea.displaySelectBoxes=function(){if(document.all)for(var b=document.getElementsByTagName("select"),a=0,c=b.length;a<c;a++)b[a].style.visibility="visible"};Dea.htmlDecode=function(a){if(a)if(a!=="undefined")return a.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,"'")};Dea.hideTimePicker=function(){var a=Dea.Get("timeDrop");if(a)if(!bLeaveTime){if(timeBuilt===true){Dea.setDisplay(a,"none");Dea.displaySelectBoxes();timeBuilt=false}}else timeBuilt===true&&Dea.hideSelectBoxes()};Dea.hidePickers=function(){if(Dea.Get("calendar")){!bShow&&hideCalendar();bShow=false}Dea.hideTimePicker()};Dea.validate=function(a,c,b){if(a.isRequired)if(c.trim()===""){Dea.ctsm(b,a.errorMsg,a);return false}return true};Dea.ctsm=function(a,c,b){if(a){if(typeof a==="string")a=Dea.Get(a);a!=null&&$(a).click()}var c=b.errorMsg||b.getAttribute("errorMsg");Dea.setAlert(c);b!=null&&b.focus()};Dea.isValidEmail=function(b,d,a){var e=/^([A-Za-z0-9_\-\.'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,c=Dea.getValue(b);if(e.test(c)==false){if(a){if(typeof a==="string")a=Dea.Get(a);a!=null&&$(a).click()}Dea.setAlert(d);b.focus();return false}return true};Dea.isValidEmailString=function(b,c,a){var d=/^([A-Za-z0-9_\-\.'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(d.test(b)==false){if(a){if(typeof a==="string")a=Dea.Get(a);a!=null&&$(a).click()}Dea.setAlert(c);return false}return true};$$=function(a){return $("#"+a)};Dea.anchorTimes=function(b,a){var c=$.timePicker("#"+b).getTime();$$(b).change(function(){if($$(b).val().length<ems_timeFormat.length)return;if($$(a).val()){var f=$.timePicker("#"+a).getTime()-c,d=$.timePicker("#"+b).getTime();$.timePicker("#"+a).setTime(new Date(new Date(d.getTime()+f)));c=d;$("#"+a).focus()}else{var d=$.timePicker("#"+b).getTime(),e=new Date(new Date(d.getTime()));e.setMinutes(e.getMinutes()+60);$.timePicker("#"+a).setTime(e);c=d;$("#"+a).focus()}})};Dea.moveSelectedOptions=function(a,c,f){for(var b=0;b<a.options.length;b++){var d=a.options[b];if(d.selected){for(var e=0;e<c.options.length;e++)if(d.value==c.options[e].value){Dea.setAlert(f);return false}c.options[c.options.length]=new Option(d.text,d.value,false,false)}}for(var b=a.options.length-1;b>=0;b--){var d=a.options[b];if(d.selected)a.options[b]=null}if(arguments.length<3||arguments[3]==true){Dea.sortSelect(a);Dea.sortSelect(c)}a.selectedIndex=-1;c.selectedIndex=-1;return false};Dea.moveAllOptions=function(a,c,f){for(var b=0;b<a.options.length;b++){for(var d=a.options[b],e=0;e<c.options.length;e++)if(d.value==c.options[e].value){Dea.setAlert(f);return false}c.options[c.options.length]=new Option(d.text,d.value,false,false)}for(var b=a.options.length-1;b>=0;b--){var d=a.options[b];a.options[b]=null}if(arguments.length<3||arguments[3]==true){Dea.sortSelect(a);Dea.sortSelect(c)}a.selectedIndex=-1;c.selectedIndex=-1;return false};Dea.sortSelect=function(c){var b=[];if(c.options==null)return;for(var a=0;a<c.options.length;a++)b[b.length]=new Option(c.options[a].text,c.options[a].value,c.options[a].defaultSelected,c.options[a].selected);if(b.length==0)return;b=b.sort(function(a,b){return a.text.toLowerCase()+""<b.text.toLowerCase()+""?-1:a.text.toLowerCase()+"">b.text.toLowerCase()+""?1:0});for(var a=0;a<b.length;a++)c.options[a]=new Option(b[a].text,b[a].value,b[a].defaultSelected,b[a].selected)};Dea.GetListitems=function(d){for(var e=document.getElementsByTagName("select"),c=Dea.Get(d).options,a="",b=0;b<c.length;b++){a=a+c[b].value;if(b<c.length-1)a=a+","}return a};Dea.ClearListItems=function(a){Dea.Get(a).length=0};Dea.moveUp=function(a){for(var c=false,b=0;b<=a.options.length-1;b++){if(!a[b].selected)c=true;a[b].selected&&c&&a.insertBefore(a[b],a[b-1])}return false};Dea.moveDown=function(a){for(var c=false,b=a.options.length-1;b>=0;b--){if(!a[b].selected)c=true;a[b].selected&&c&&a.insertBefore(a[b],a[b+2])}return false};Dea.getDateParts=function(g){var d=-1,e=-1,f=-1;try{var c=localizationDateFormat.split(localizationDateSeparator),a=g.split(localizationDateSeparator);if(a.length==3&&a[2].indexOf(" ")!==-1)try{a[2]=a[2].substr(0,a[2].length-a[2].indexOf(" ")+1)}catch(h){}for(var b=0;b<c.length;b++)if(c[b].indexOf("d")>=0){if(a.length>b)d=Number(a[b])}else if(c[b].indexOf("m")>=0){if(a.length>b)e=Number(a[b])}else if(c[b].indexOf("y")>=0)if(a.length>b)f=Number(a[b])}catch(i){}return[f,e,d]};Dea.clearLoading=function(){Dea.setDisplay("CallbackStatus","none")};Dea.errorCallback=function(b){try{var a=Dea.JSON.parse(b)}catch(c){a=b}if(typeof a.sendToPage!=="undefined"){window.location.href=a.sendToPage;return true}Dea.setAlert(b);Dea.clearLoading()};Dea.showLoading=function(){Dea.setDisplay("CallbackStatus","",null,"5px",null,"5px")};Dea.makeCallback=function(b,a){if(!a||a==="undefined")a=Dea.emsData;a.router=b;Dea.showLoading();Dea.pageCallback(a)};Dea.setPopup=function(){$("#FooterContainer").hide();$("#PageLinksContainer").hide();$("div[class*=master]").removeClass()};Dea.iDetailsDialog=function(c,a){a=eventDetailstxt+" - "+a;var b="EventDetailsIFrame"+c;$("#"+b).remove();var f=$(this),d=15,e=15;iFrameDiag=$('<iframe id="'+b+'" style="width:100%;height:100%;background-color:transparent;" frameborder="0" allowtransparency="true" class="'+b+'" src="'+c+'" />');iFrameDiag.dialog({modal:true,autoResize:true,width:850,height:500,title:a}).width(850-d).height(500-e);return false};Dea.iDialog=function(e,b,a){$("#"+b).remove();var f=$(this),c=15,d=15;iFrameDiag=$('<iframe id="'+b+'" style="width:100%;height:100%;background-color:transparent;" frameborder="0" allowtransparency="true" class="'+b+'" src="'+e+'" />');$.extend(a,{modal:true,autoResize:true,resizable:true});if(!a.width)a.width=500;if(!a.height)a.height=500;iFrameDiag.dialog(a).width(a.width-c).height(a.height-d);return false};Dea.iPopup=function(b,a){$.extend(a,{modal:true,resizable:true,autoResize:true,bgiframe:true,autoOpen:false});if(!a.width)a.width=500;if(!a.height)a.height=500;$("#"+b).dialog(a)};Dea.handleCallback=function(g,f){try{var a=Dea.JSON.parse(g)}catch(i){if(i.message==="script stack space quota is exhausted"){var a={},c=g.split('","'),d=c[0];d=d.substr(2,d.length-2);var b=d.split('":"');eval("emsResponse."+b[0]+' = "'+b[1]+'"');for(var h=1;h<c.length-1;h++){b=c[h].split('":"');eval("emsResponse."+b[0]+' = "'+b[1]+'"')}var e=c[c.length-1];e=e.substr(0,e.length-2);b=e.split('":"');eval("emsResponse."+b[0]+' = "'+b[1]+'"')}else a=g}if(typeof a.success!=="undefined")if(Number(a.success)===0)if(typeof a.msg!=="undefined"){Dea.setAlert(a.msg);if(typeof a.sendToPage!=="undefined"){window.location.href=a.sendToPage;return true}typeof Dea.pageHandleErrorCallback==="function"&&Dea.pageHandleErrorCallback(a,f);Dea.clearLoading();return true}if(typeof a.sendToPage!=="undefined"){window.location.href=a.sendToPage;return true}if(typeof a.isError!=="undefined")if(Number(a.isError)===1){Dea.setAlert(a.errorMsg);Dea.clearLoading();typeof Dea.pageHandleErrorCallback==="function"&&Dea.pageHandleErrorCallback(a,f);return true}!Dea.pageHandleCallback(a,f)&&Dea.setAlert("Unhandled callback "+f);Dea.clearLoading()};Dea.setAlert=function(a){try{alert(a)}catch(b){}};$.ctrl=function(c,b,a){$(document).keydown(function(d){if(!a)a=[];if(d.keyCode==c.charCodeAt(0)&&d.ctrlKey){b.apply(this,a);return false}})};$(document).mousemove(function(a){Dea.Mouse.X=a.pageX;Dea.Mouse.Y=a.pageY;try{Dea.Mouse.windowWidth=$(window).width()+$(window).scrollLeft();Dea.Mouse.windowHeight=$(window).height()+$(window).scrollTop()}catch(b){}});Dea.scrollLeft=function(){return window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0};Dea.scrollTop=function(){return window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0};$(document).ready(function(){if(mc_useHelpIcon===1){if($("#helpDialog").is(":empty")||$("#helpDialog").html()==null||$("#helpDialog").html().trim()==""){$("#helpIco").attr({alt:mc_Help,title:mc_Help}).bind("click",function(){$("#helpDialog2").dialog("open")});$("#helpDialog2").dialog({title:mc_Help,autoOpen:false,width:400,height:300,modal:false,resizable:true})}else{$("#helpIco").attr({alt:mc_Help,title:mc_Help}).bind("click",function(){$("#helpDialog").dialog("open")});$("#helpDialog").dialog({title:mc_Help,autoOpen:false,width:400,height:300,modal:false,resizable:true})}!($(".helpDialog").is(":empty")||$(".helpDialog").html()==null||$(".helpDialog").html().trim()=="<br>")&&$("#helpIco").show()}$(document).bind("click","",function(){if($("#timeDrop").length>0)if(timeBuilt)!bLeaveTime&&$("#timeDrop").hide()});$(document).keydown(function(a){var b=a.which||a.keyCode;if(a.ctrlKey&&a.shiftKey&&(b==21||b==85))window.location.href="systemcheck.aspx";if(a.ctrlKey&&a.shiftKey&&b==65)window.location.href="about.aspx"})})
