// JavaScript Document
if(typeof jslang=="undefined"){LoadLangD("AU")}else{switch(jslang){case"AU":case"IS":case"JP":case"NO":case"CZ":case"FR":case"ES":case"DE":LoadLangD(jslang);break;default:LoadLangD("AU");break}}function LoadLangD(B){var A=document.createElement("script");A.setAttribute("src","/CatalystScripts/lang/"+B+"/Java_DatePicker_"+B+".js");A.setAttribute("charset",charsetD(B));A.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(A)}function charsetD(A){var B="";switch(A){case"JP":B="shift-jis";break;case"IS":case"CZ":case"FR":B="iso-8859-1";break;default:B="utf-8";break}return B}var datePickerDivID="datepicker";var iFrameDivID="datepickeriframe";var dayArrayShort;var monthArrayShort;var dateSeparator="-";var datePickerInit=0;function InitDatePicker(){dayArrayShort=new Array(dpicklang.Su,dpicklang.Mo,dpicklang.Tu,dpicklang.We,dpicklang.Th,dpicklang.Fr,dpicklang.Sa);monthArrayShort=new Array(dpicklang.Jan,dpicklang.Feb,dpicklang.Mar,dpicklang.Apr,dpicklang.May,dpicklang.Jun,dpicklang.Jul,dpicklang.Aug,dpicklang.Sep,dpicklang.Oct,dpicklang.Nov,dpicklang.Dec);datePickerInit=1}if(document.all){document.onmousedown=captureMousePosition}else{if(document.getElementById){document.onmousedown=captureMousePosition}}var mousex;var mousey;function captureMousePosition(A){if(document.all){mousex=window.event.x+document.body.scrollLeft;if(document.documentElement&&document.documentElement.scrollTop>0){mousey=window.event.y+document.documentElement.scrollTop}else{mousey=window.event.y+document.body.scrollTop}}else{if(document.getElementById){mousex=A.pageX;mousey=A.pageY}}}function displayDatePicker(B){if(datePickerInit==0){InitDatePicker()}var D=document.getElementById(B);var A=D.offsetLeft;var E=D.offsetTop+D.offsetHeight;var C=D;while(C.offsetParent){C=C.offsetParent;A+=C.offsetLeft;E+=C.offsetTop}if(mousex<A){A=mousex}if(mousey<E){E=mousey}drawDatePicker(D,A,E)}function drawDatePicker(D,A,F){var C=getFieldDate(D.value);if(!document.getElementById(datePickerDivID)){var B=document.createElement("div");B.setAttribute("id",datePickerDivID);B.setAttribute("class","dpDiv");B.setAttribute("style","visibility: hidden; padding: 9px; color: #666666");document.body.appendChild(B)}var E=document.getElementById(datePickerDivID);E.style.position="absolute";E.style.left=A+"px";E.style.top=F+"px";E.style.border="1px solid #999999";E.style.backgroundColor="#ffffff";E.style.visibility=(E.style.visibility=="visible"?"hidden":"visible");E.style.zIndex=900000000;refreshDatePicker(D.name,C.getFullYear(),C.getMonth(),C.getDate())}function refreshDatePicker(S,N,X,T){var E=new Date();if((X>=0)&&(N>0)){E=new Date(N,X,1)}else{T=E.getDate();E.setDate(1)}var I="\r\n";var H="<style>.text {font: 10px arial; color: #666666}</style>"+I;var J="<table class='date'>"+I;var C="</table>"+I;var V="<tr style='cursor:hand'>";var K="<tr>";var M="<tr>";var F="</tr>"+I;var A="<td>";var B="<td align='center' colspan='7' style='text-align: center'>";var U="<td>";var Z="<td align='center' colspan='7'>";var Q="<td style='border-bottom: 1px solid #f0f0f0; text-align: center; font-size: 9px; color: #999;'>";var Y="<td style='text-align: center; color: #666666; font-size: 10px; padding: 3px' ";var P="</td>"+I;var D="<div>";var R="<div style='background: #005ba7; color: #ffffff'>";var O="</div>";var L=H+J;L+=V+B;L+="<select id='ddMonth' style='font: 10px Arial;' onChange='refreshDatePicker(\""+S+'", document.getElementById("ddYear").value, this.options[this.selectedIndex].value);\'>';for(i=0;i<=11;i++){if(E.getMonth()==i){L+="<option selected value="+i+">"+monthArrayShort[i]+"</option>"}else{L+="<option value="+i+">"+monthArrayShort[i]+"</option>"}}L+="</select>";L+="<select id='ddYear' style='font: 10px Arial;' onChange='refreshDatePicker(\""+S+'", this.options[this.selectedIndex].value, document.getElementById("ddMonth").value);\'>';for(i=1920;i<=2020;i++){if(E.getFullYear()==i){L+="<option selected value="+i+">"+i+"</option>"}else{L+="<option value="+i+">"+i+"</option>"}}L+="</select>";L+=P+F;L+=K;for(i=0;i<dayArrayShort.length;i++){L+=Q+dayArrayShort[i]+P}L+=F;L+=V;for(i=0;i<E.getDay();i++){L+=A+"&nbsp;"+P}do{dayNum=E.getDate();TD_onclick=" onclick=\"updateDateField('"+S+"', '"+getDateString(E)+"');\">";if(dayNum==T){L+=Y+TD_onclick+R+dayNum+O+P}else{L+=Y+TD_onclick+dayNum+P}if(E.getDay()==6){L+=F+V}E.setDate(E.getDate()+1)}while(E.getDate()>1);if(E.getDay()>0){for(i=6;i>E.getDay();i--){L+=A+"&nbsp;"+P}}L+=F;var W=new Date();var G="Today is "+dayArrayShort[W.getDay()]+", "+monthArrayShort[W.getMonth()]+" "+W.getDate();L+=M+Z;L+="<button class='button' style='font: 10px arial;background-color:white;' onClick='refreshDatePicker(\""+S+"\");'>"+dpicklang.Today+"</button> ";L+="<button class='button' style='font: 10px arial;background-color:white;' onClick='clearDateField(\""+S+"\");'>"+dpicklang.Clear+"</button> ";L+="<button class='button' style='font: 10px arial;background-color:white;' onClick='updateDateField(\""+S+"\");'>"+dpicklang.Close+"</button>";L+=P+F;L+=C;document.getElementById(datePickerDivID).innerHTML=L;if(document.all){adjustiFrame()}}function getDateString(A){var C="00"+A.getDate();var B=monthArrayShort[A.getMonth()];C=C.substring(C.length-2);return C+dateSeparator+B+dateSeparator+A.getFullYear()}function getFieldDate(F){var B;if(F.length==0){B=new Date();return B}var G,A,H;var E=F.indexOf(dateSeparator);var D=F.indexOf(dateSeparator,E+1);G=F.substring(0,E);A=F.substring(E+1,D);for(var C=0;C<monthArrayShort.length;C++){if(monthArrayShort[C]==A){A=C}}H=F.substring(D+1);if(H>2020){G=31;A=11;H=2020}B=new Date(H,A,G);return B}function updateDateField(A,B){var C=document.getElementsByName(A).item(0);if(B){C.value=B}hideDatePicker();if((B)&&(typeof (datePickerClosed)=="function")){datePickerClosed(C)}}function hideDatePicker(){if(document.getElementById(datePickerDivID)){document.getElementById(datePickerDivID).style.visibility="hidden";adjustiFrame()}}function clearDateField(A){var B=document.getElementsByName(A).item(0);B.value=""}function adjustiFrame(D,A){if(!document.getElementById(iFrameDivID)){var B=document.createElement("iFrame");B.setAttribute("id",iFrameDivID);B.setAttribute("src","javascript:false;");B.setAttribute("scrolling","no");B.setAttribute("frameborder","0");document.body.appendChild(B)}if(!D){D=document.getElementById(datePickerDivID)}if(!A){A=document.getElementById(iFrameDivID)}try{A.style.position="absolute";A.style.width=D.offsetWidth;A.style.height=D.offsetHeight;A.style.top=D.style.top;A.style.left=D.style.left;A.style.zIndex=D.style.zIndex-1;A.style.visibility=D.style.visibility}catch(C){}};