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