var NUM_CENTYEAR=30;var BUL_TIMECOMPONENT=false;var BUL_YEARSCROLL=true;var calendars=[];var RE_NUM=/^\-?\d+$/;function calendar2(_1){this.gen_date=cal_gen_date2;this.gen_time=cal_gen_time2;this.gen_tsmp=cal_gen_tsmp2;this.prs_date=cal_prs_date2;this.prs_time=cal_prs_time2;this.prs_tsmp=cal_prs_tsmp2;this.popup=cal_popup2;if(!_1){return cal_error("Error calling the calendar: no target control specified");}if(_1.value==null){return cal_error("Error calling the calendar: parameter specified is not valid target control");}this.target=_1;this.time_comp=BUL_TIMECOMPONENT;this.year_scroll=BUL_YEARSCROLL;this.id=calendars.length;calendars[this.id]=this;}function cal_popup2(_2){if(_2){this.dt_current=this.prs_tsmp(_2);}else{this.dt_current=this.prs_tsmp(this.target.value);this.dt_selected=this.dt_current;}if(!this.dt_current){return;}var _3=window.open("calendar.html?datetime="+this.dt_current.valueOf()+"&id="+this.id,"Calendar","width=200px,height="+(this.time_comp?215:190)+"px,status=no,resizable=no,top=200px,left=200px,dependent=yes,alwaysRaised=yes");_3.opener=window;_3.focus();}function cal_gen_tsmp2(_4){return (this.gen_date(_4)+" "+this.gen_time(_4));}function cal_gen_date2(_5){return ((_5.getMonth()<9?"0":"")+(_5.getMonth()+1)+"/"+(_5.getDate()<10?"0":"")+_5.getDate()+"/"+_5.getFullYear());}function cal_gen_time2(_6){return ((_6.getHours()<10?"0":"")+_6.getHours()+":"+(_6.getMinutes()<10?"0":"")+(_6.getMinutes())+":"+(_6.getSeconds()<10?"0":"")+(_6.getSeconds()));}function cal_prs_tsmp2(_7){if(!_7){return (new Date());}if(RE_NUM.exec(_7)){return new Date(_7);}var _8=_7.split(" ");return this.prs_time(_8[1],this.prs_date(_8[0]));}function cal_prs_date2(_9){var _a=_9.split("/");if(_a.length!=3){return alert("Invalid date format: '"+_9+"'.\nFormat accepted is dd-mm-yyyy.");}if(!_a[1]){return alert("Invalid date format: '"+_9+"'.\nNo day of month value can be found.");}if(!RE_NUM.exec(_a[1])){return alert("Invalid day of month value: '"+_a[1]+"'.\nAllowed values are unsigned integers.");}if(!_a[0]){return alert("Invalid date format: '"+_9+"'.\nNo month value can be found.");}if(!RE_NUM.exec(_a[0])){return alert("Invalid month value: '"+_a[0]+"'.\nAllowed values are unsigned integers.");}if(!_a[2]){return alert("Invalid date format: '"+_9+"'.\nNo year value can be found.");}if(!RE_NUM.exec(_a[2])){return alert("Invalid year value: '"+_a[2]+"'.\nAllowed values are unsigned integers.");}var _b=new Date();_b.setDate(1);if(_a[0]<1||_a[0]>12){return alert("Invalid month value: '"+_a[0]+"'.\nAllowed range is 01-12.");}_b.setMonth(_a[0]-1);if(_a[2]<100){_a[2]=Number(_a[2])+(_a[2]<NUM_CENTYEAR?2000:1900);}_b.setFullYear(_a[2]);var _c=new Date(_a[2],_a[0],0);_b.setDate(_a[1]);if(_b.getMonth()!=(_a[0]-1)){return alert("Invalid day of month value: '"+_a[1]+"'.\nAllowed range is 01-"+_c.getDate()+".");}return (_b);}function cal_prs_time2(_d,_e){if(!_e){return null;}var _f=String(_d?_d:"").split(":");if(!_f[0]){_e.setHours(0);}else{if(RE_NUM.exec(_f[0])){if(_f[0]<24){_e.setHours(_f[0]);}else{return cal_error("Invalid hours value: '"+_f[0]+"'.\nAllowed range is 00-23.");}}else{return cal_error("Invalid hours value: '"+_f[0]+"'.\nAllowed values are unsigned integers.");}}if(!_f[1]){_e.setMinutes(0);}else{if(RE_NUM.exec(_f[1])){if(_f[1]<60){_e.setMinutes(_f[1]);}else{return cal_error("Invalid minutes value: '"+_f[1]+"'.\nAllowed range is 00-59.");}}else{return cal_error("Invalid minutes value: '"+_f[1]+"'.\nAllowed values are unsigned integers.");}}if(!_f[2]){_e.setSeconds(0);}else{if(RE_NUM.exec(_f[2])){if(_f[2]<60){_e.setSeconds(_f[2]);}else{return cal_error("Invalid seconds value: '"+_f[2]+"'.\nAllowed range is 00-59.");}}else{return cal_error("Invalid seconds value: '"+_f[2]+"'.\nAllowed values are unsigned integers.");}}_e.setMilliseconds(0);return _e;}function cal_error(_10){alert(_10);return null;}