function setupCalendar(){var a=document.getElementById("startdate");if(a!=null){Calendar.setup({inputField:"startdate",ifFormat:"%Y-%m-%d",button:"startdatebutton"});Calendar.setup({inputField:"enddate",ifFormat:"%Y-%m-%d",button:"enddatebutton"})}return true}function miniSetupCalendar(a,c){var b=document.getElementById(c);var d=document.getElementById(a);if(b!=null&&d!=null){Calendar.setup({inputField:a,ifFormat:"%Y-%m-%d",button:c})}return true}function setupHTML(a){if(a=="math"){var b=getElementByClass("AM");if(b!=undefined&&b.length>0){for(i in b){var e=b[i];var d=e.innerHTML;if(d.indexOf("mimetex")==-1||d.indexOf("cgi-bin")==-1){e.innerHTML="";d=d.replace("`","");var c=d.replace("`","");e.appendChild(AMTparseMath(c))}}}}if(a=="svg"){drawPics()}return true}function getElementByClass(d){var a=new Array();var c=new Array();var c=document.getElementsByTagName("*");if(c!=undefined&&c.length>0){var b=0;for(i=0;i<c.length;i++){if(c[i].className==d){a[b]=c[i];b++}}}return a}function ajaxRequest(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){var a=["Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(var b=0;b<a.length;b++){try{return new ActiveXObject(a[b])}catch(c){}}}else{return false}}}function ajaxGetpage(c,a,b){if(typeof b=="undefined"){b=true}return ajaxPostform(c,a,"",b)}function checkServerError(c,e){if(typeof c=="undefined"){return true}if(c==""){return true}if(typeof e=="undefined"){e=true}var d="<!---:ajproto_ERROR_TaG:--->";var b="<!---:ajproto_REDIRECTHOME_TaG:--->";if(!(typeof ajaxAppErrorTag=="undefined")&&ajaxAppErrorTag!=""){d=ajaxAppErrorTag}if(!(typeof ajaxAppNoSessionTag=="undefined")&&ajaxAppNoSessionTag!=""){b=ajaxAppNoSessionTag}var a=c.search(d);if(a==0||a==1){error_text=c.replace(d,"");if(e){printErrorWindow(error_text)}return false}var a=c.search(b);if(a==0||a==1){error_text=c.replace(b,"");if(e){printErrorWindow(error_text,"350","250",true)}return false}return true}var ajax_is_running=0;function ajaxPostform(h,a,f,c,d){if(ajax_is_running<0){ajax_is_running=0}ajax_is_running++;var k="";if(typeof c=="undefined"){c=true}if(h==""&&!d){c=false}if(typeof d=="undefined"){d=true}var l=new ajaxRequest();var b="An error has occured while accessing the server";if(!(typeof ajaxServerError=="undefined")&&ajaxServerError!=""){b=ajaxServerError}l.onreadystatechange=function(){if(c&&l.readyState==4){if(l.status==200){if(checkServerError(l.responseText,d)){if(h!=""){document.getElementById(h).innerHTML=l.responseText;doJscriptProcess(l.responseText)}}}else{if(d){printErrorWindow(b)}return false}}};if(f!=""){k=getPostQueryString(f)}if(k==""){k="bustcache="+new Date().getTime()}else{k+="&bustcache="+new Date().getTime()}try{l.open("POST",a,c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.setRequestHeader("X-Requested-With","XMLHttpRequest");l.send(k)}catch(g){if(d){printErrorWindow(b)}ajax_is_running--;return false}if(!c){if(l.status==200){var j=checkServerError(l.responseText,d);if(typeof h=="undefined"||h==""){ajax_is_running--;if(j){return l.responseText}else{return false}}else{if(j){if(h!=""){document.getElementById(h).innerHTML=l.responseText;doJscriptProcess(l.responseText)}ajax_is_running--;return true}else{ajax_is_running--;return false}}}else{if(d){printErrorWindow(b)}ajax_is_running--;return false}}ajax_is_running--;return true}function hideDiv(a){var c=document.getElementsByTagName("div");for(var b=0;b<c.length;b++){if(c[b].id.match(a)){if(document.getElementById){c[b].style.visibility="hidden"}else{if(document.layers){document.layers[c[b]].display="hidden"}else{document.all.hideShow.divs[b].visibility="hidden"}}}}}function showDiv(a){var c=document.getElementsByTagName("div");for(var b=0;b<c.length;b++){if(c[b].id.match(a)){if(document.getElementById){c[b].style.visibility="visible"}else{if(document.layers){document.layers[c[b]].display="visible"}else{document.all.hideShow.divs[b].visibility="visible"}}}}}function getDivobj(a){var b=document.getElementsByTagName("div");for(i=0;i<b.length;i++){if(b[i].id.match(a)){return b[i]}}return false}function getPostQueryString(g){var b=document.forms[g];var e="";var h="";var k="";var a;if(typeof(b)=="undefined"){return""}var d="";for(var f=0;f<b.elements.length;f++){h=b.elements[f].name;if(typeof(h)=="undefined"||h==""){h=b.elements[f].id}if(typeof(h)=="undefined"||h==""){continue}k=b.elements[f].tagName.toLowerCase();switch(k){case"input":switch(b.elements[f].type){case"text":case"hidden":e+=d+h+"="+encodeURIComponent(b.elements[f].value);break;case"checkbox":if(b.elements[f].checked){e+=d+h+"="+b.elements[f].value}else{e+=d+h+"="}break;case"radio":if(b.elements[f].checked){e+=d+h+"="+b.elements[f].value}}break;case"textarea":e+=d+h+"="+encodeURIComponent(b.elements[f].value);break;case"select":a=b.elements[f];for(var c=0;c<a.options.length;c++){if(a.options[c].selected){e+=d+h+"="+encodeURIComponent(a.options[c].value);d="&"}}break}if(e!=""){d="&"}}return e}function doJscriptProcess(b){if(b.search(/id=['"]datebutton["']/i)>0){miniSetupCalendar("fielddate","datebutton")}if(b.search(/id=['"]startdatebutton["']/i)>0){setupCalendar()}if(b.search(/<span class=['"]am["']>/i)>0){setupHTML("math")}if(b.search(/type=['"]image.svg.xml["']/i)>0){setupHTML("svg")}var c=1;var d="templatedatebutton";var a="templatedatetext";var e=new RegExp("id=['\"]"+d+c+"[\"']","i");while(true){if(b.search(e)>0){miniSetupCalendar(a+c,d+c)}else{break}c++;e=new RegExp("id=['\"]"+d+c+"[\"']","i")}}function closeDhtmlWindow(a){modDhtmlWindow(a,1)}function hideDhtmlWindow(a){modDhtmlWindow(a,2)}function showDhtmlWindow(a){modDhtmlWindow(a,3)}function printErrorWindow(b,c,a,d){if(typeof c=="undefined"){c="400";a="250"}if(typeof d=="undefined"){d=false}if(d){if(typeof appHomeUrl=="undefined"){appHomeUrl="/"}b='<br /><font color="red"><center>'+b+'<br /><br /><!-- input type="button" class="btn" value="Close" onClick="closeDhtmlWindow(\'errorwin_div\'); window.location="'+appHomeUrl+'"; return false;" onMouseover="if(this.className) this.className=\'btnhov\';" onMouseout="if(this.className) this.className=\'btn\'" / --></center></font>';setTimeout('window.location="'+appHomeUrl+'"',10000)}else{b='<br /><font color="red"><center>'+b+'<br /><br /><input type="button" class="btn" value="Close" onClick="closeDhtmlWindow(\'errorwin_div\'); return false;" onMouseover="if(this.className) this.className=\'btnhov\';" onMouseout="if(this.className) this.className=\'btn\'" /></center></font>'}newDhtmlWindow_text("Message",c,a,"errorwin_div",b)}function isObject(a){return(typeof a!="undefined"&&a!=null&&a!=false&&typeof a=="object")}function get_dhxWinsParentObj(){if(typeof get_dhxWinsParentObj.myobject=="undefined"){get_dhxWinsParentObj.myobject=new dhtmlXWindows();get_dhxWinsParentObj.myobject.setSkin(gDhtmlxwindowsSkin);get_dhxWinsParentObj.myobject.setImagePath(appIncludePath+"js/dhtmlxwindows/codebase/imgs/")}return get_dhxWinsParentObj.myobject}function window_size_array(){var b=0;var a=0;if(!window.innerWidth){if(!(document.documentElement.clientWidth==0)){b=document.documentElement.clientWidth;a=document.documentElement.clientHeight}else{b=document.body.clientWidth;a=document.body.clientHeight}}else{b=window.innerWidth;a=window.innerHeight}return{width:b,height:a}}function viewscreen_center(e,c){var d=0;var b=0;var a=0;var g=0;if(!window.pageYOffset){if(!(document.documentElement.scrollTop==0)){g=document.documentElement.scrollTop;a=document.documentElement.scrollLeft}else{g=document.body.scrollTop;a=document.body.scrollLeft}}else{a=window.pageXOffset;g=window.pageYOffset}var f=window_size_array();d=((f.width-e)/2)+a;b=((f.height-c)/2)+g;if(d<0){d=0}if(b<0){b=0}return{x:d,y:b}}function newDhtmlWindow(b,e,c,a,f){var d="dhtmlwin_"+f;if(typeof f=="undefined"){d="winid"+Math.random()}return create_dhtmlxwindow(d,e,c,a,b,true)}function newDhtmlWindowTop(b,d,c,a,e){return newDhtmlWindow(b,d,c,a,e)}function newDhtmlWindow_text(e,b,a,f,d){var c=newDhtmlWindow("",e,b,a,f);if(typeof c!="undefined"){c.attachHTMLString(d);doJscriptProcess(d);return c}}function newIframeWindow(b,e,c,a,f){var d="dhtmlwin_"+f;if(typeof f=="undefined"){d="winid"+Math.random()}return create_dhtmlxwindow(d,e,c,a,b,false)}function create_dhtmlxwindow(j,k,c,l,b,m){var a=parseInt(l)+gDhtmlxwindowsExtraheight;var d=get_dhxWinsParentObj();var h=d.window(j);var e=viewscreen_center(c,a);var f=false;if(typeof b!="undefined"&&b!=""&&m){f=ajaxGetpage("",b);if(f==false){return false}}if(!isDhtmlxObject(h)){h=d.createWindow(j,e.x,e.y,c,a)}else{h.setDimension(c,a);h.setPosition(e.x,e.y)}if(!isDhtmlxObject(h)){alert(gGeneralJavasriptError);exit}h.button("minmax1").hide();h.show();h.setText(k);if(f!=false){h.attachHTMLString(f);doJscriptProcess(f)}else{h.attachURL(b,false)}var g=d._engineGetWindowHeader(h);if(typeof g.ondblclick!="undefined"){g.ondblclick=null}return h}function modDhtmlWindow(d,c){var b=get_dhxWinsParentObj();var a=b.window("dhtmlwin_"+d);if(typeof a=="undefined"){return}if(c==1){a.close()}else{if(c==2){a.hide()}else{if(c==3){a.show()}}}}function getDhtmlWindowById(c){var a=get_dhxWinsParentObj();var b=a.window("dhtmlwin_"+c);if(typeof b!="undefined"&&b!=null){return b}return null}function isDhtmlxObject(a){return(isObject(a)&&typeof a.idd!="undefined")}function winobjAttachHtml(b,a){if(isDhtmlxObject(b)){b.attachHTMLString(a);doJscriptProcess(a);return true}return false};
