var ar_g_MonthD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); var ar_g_MonthN = C_LRSMounths.split(','); var _Today=new Date(),iDD_Today=_Today.getDate(),iMM_Today=_Today.getMonth(),iYY_Today=_Today.getFullYear(), sToday=FormatDate(iDD_Today,iMM_Today+1,iYY_Today); var aCL='actdate'; var iMinYear=1900,iMaxYear=iYY_Today+15; function IsToday(Y,M,D){return((Y==iYY_Today)&&(M==iMM_Today)&&(D==iDD_Today));} function getDaysInYear(iY){ var iL=0; for(var i=0;i<12;i++){ iL+=getMonthLength(i,iY); } return iL; } function getMonthLength(iM,iY){ var iL=ar_g_MonthD[iM]; if(iL&&(iM==1)&&(iY%4==0))iL++; return iL; } function makeTBody(w,T){ var oB=w.document.createElement('TBODY'),oTR,oTD; T.appendChild(oB); oB=T.tBodies[0]; for(var i=0;i<6;i++){ oTR=isIE?oB.insertRow():window.document.createElement('TR'); for(var j=0;j<7;j++){ oTD=isIE?oTR.insertCell():window.document.createElement('TD'); oTD.innerHTML='!'; if(!isIE)oTR.appendChild(oTD); } if(!isIE)oB.appendChild(oTR); } } function RD(i){return (i<10)?('0'+i):i;} function FormatDate(iD,iM,iY){ return (RD(iD)+'.'+RD(iM)+'.'+iY)} function Calendar(w,e,inp){ this.position = function(){ cl.style.position='absolute'; var el=this.ClBtn; var oP=el.offsetParent, bH=(window.innerHeight||window.document.body.clientHeight), bW=(window.innerWidth||window.document.body.clientWidth), y=getTopOffset(el)+el.offsetTop+el.offsetHeight, x=getLeftOffset(el)-el.offsetWidth-170, clW=180,clH=232, iHgh=((parseInt(y,10)+clH)0)?(((parseInt(x,10)+clW)>bW)?(parseInt(x,10)-clW-el.offsetWidth):x):10; } } this.fill = function(dt){ if(!dt){ re=new RegExp('(\\d{2})\\.(\\d{2})\\.(\\d{4})','ig'); r=re.exec(this.input.value); var _b= r==null; dt=_b?(new Date()):(new Date(parseInt(RegExp.$3,10),parseInt(RegExp.$2,10)-1,parseInt(RegExp.$1,10))); iActD=_b?iDD_Today:parseInt(RegExp.$1,10); } window.cl_win.d.all.TodayLnk.innerHTML=C_LRSToday+': '+sToday; iDD=dt.getDate(); iMM=dt.getMonth(); iYY=dt.getFullYear(); window.cl_win.d.all.MNT.innerHTML=ar_g_MonthN[iMM]; window.cl_win.d.all.MNT.setAttribute('I',iMM); window.cl_win.d.all.YEAR.innerHTML=iYY; window.cl_win.d.all.btnin.innerHTML=C_LRSIns; window.cl_win.d.all.btnclose.innerHTML=C_LRSCls; dy=new Date(iYY,iMM,1); var oT=window.cl_win.d.all.DayTbl; if((!oT.tBodies[0]) || (oT.tBodies[0].rows.length==0))makeTBody(window.cl_win,oT); var rs=oT.tBodies[0].rows,r,oc,d=0,d_=1,ds=getMonthLength(iMM,iYY),dc=dy.getDay(),b,xitemN; dc=((dc==0)?7:dc)-1; if(iActD>ds)iActD=ds; for(var i=0;i=dc)&&(d_<=ds); oc.innerHTML=(b)?(d_):' '; oc.className=b?'insdate':''; if((d_==iActD) && b)this.setActD(oc) d++; if(b)d_++; } } with(cl.style){ height='250px'; width=window.cl_win.d.all.DayTbl.scrollWidth+10; } } this.hide = function(){ cl.style.visibility='hidden'; window._calendar_.show=false; } this.show = function(){ try{_l=window.cl_win.c_loaded}catch(e){_l=false} if(!_l){ if(!window.TClnd)window.TClnd=window.setInterval("window._calendar_.show();",100); return; } window.clearInterval(window.TClnd); window.cl_win.mwin=w; this.fill(); cl.style.visibility='visible'; window._calendar_.show=true; _attachEvents(w); try{elementMsgErrHide();}catch(e){} } this.setActD=function(o){ try{this.actDay.className='';}catch(e){} this.actDay=o; window.cl_win.d.all.CLTbl.setAttribute("ovr",'1'); this.actDay.className=aCL; iActD=parseInt(this.actDay.innerHTML,10); } this.insDate=function(bToday){ var newVal=bToday? sToday : FormatDate(iActD,iMM+1,iYY); this.input.value=newVal; this.hide(); if(this.input.getAttribute('DTYPE')=='Date'){ this.input.setAttribute('_VALUE',newVal); this.input.setAttribute('err','0'); elementMsgErrHide(); this.input.className=this.input.className.replace(/[ ]?incorrectValue/,''); } } var id='calendar'; try{this.input=$(window,inp)}catch(e){this.input=null} this.ClBtn=e.target||e.srcElement; try{cl=$(w,id);}catch(e){cl=null} if(!cl){ cl = window.document.createElement('IFRAME'); cl.style.visibility='hidden'; cl.frameBorder = '0'; cl.marginWidth = '0'; cl.scrolling = 'no'; cl.setAttribute('NAME',id); cl.setAttribute('id',id); cl.src = '../calendar.htm'; this.position(); isIE?window.document.body.insertAdjacentHTML('beforeEnd',cl.outerHTML):window.document.body.appendChild(cl); cl = $(w,id); window.cl_win=window.frames[window.frames.length-1]; }else this.position(); } function ShowCalendar(w,e,inp){ window._calendar_=new Calendar(w,e,inp); window._calendar_.show(); } function HideCalendar(w){try{window._calendar_.hide()}catch(e){}} function PrevNextClnd(w,iT){ if(!window._calendar_)return; var iY=parseInt(w.document.all.YEAR.innerHTML,10), iM=parseInt(w.document.all.MNT.getAttribute('I'),10); switch(iT){ case 1:iM--;break; case 2:iM++;break; case 3: if(iY<=iMinYear)return; iY--; break; case 4: if(iY>=iMaxYear)return; iY++; break; } if(iM<0){iM=11;iY--} if(iM==12){iM=0;iY++} var dt=new Date(iY,iM,1); window._calendar_.fill(dt); } function SelectDay(w,e){ var o=e.target||e.srcElement; if(!window._calendar_)return; if(parseInt('0'+o.innerHTML,10)<=0)return; window._calendar_.setActD(o); } function InsDate(w,today){window._calendar_.insDate(today);} function ClickHideClnd(w,e){ try{ if(!window._calendar_.show)return; if(!e)HideCalendar(w) else{ var o=e.target||e.srcElement; if(o!=window._calendar_.ClBtn)HideCalendar(w); } }catch(e){} } c_calendar_js=true;