function date_stringHowManyDays(a,b){return date_howManyDays(a-1,b)}function date_howManyDays(a,b){if(!b){b=date_getCurrentYear();if(date_isItNextYear(a)){b++}}var c=new Array(31,28,31,30,31,30,31,31,30,31,30,31);if(a!=1){return c[a]}else{if(((b%400)==0)||(((b%100)!=0)&&((b%4)==0))){return 29}else{return 28}}}function date_isItNextYear(b){var d=false;var a=new Date();var c=a.getMonth();if(b<=c){d=true}return d}function date_getCurrentYear(){var a=new Date();var b=a.getFullYear();if(b<1000){b+=1900}return b}function duration_validate(f,ci,co){var msg;var err=0;msg="______________________________________________________\n\n";msg+="The form was not submitted because of the following error(s).\n";msg+="Please correct these error(s) and re-submit.\n";msg+="______________________________________________________\n\n";if(parseFloat(getDropDownValue(eval("f."+ci+"Mon")))>parseFloat(getDropDownValue(eval("f."+co+"Mon")))){msg+="The check-out date must be after the check-in date";err=1}if(parseFloat(getDropDownValue(eval("f."+ci+"Mon")))==parseFloat(getDropDownValue(eval("f."+co+"Mon")))){if(parseFloat(getDropDownValue(eval("f."+ci+"Day")))>parseFloat(getDropDownValue(eval("f."+co+"Day")))){msg+="The check-out date must be after the check-in date";err=1}}if(err==0){return true}alert(msg);return false}function setDays(direction){var currentYear=date_getCurrentYear();var yearField=eval("document.FSSform."+direction+"Year");if(typeof yearField=="object"){if(yearField.type=="text"){currentYear=yearField.value}else{currentYear=yearField.options[yearField.selectedIndex].value}}var month=eval("document.FSSform."+direction+"Mon.selectedIndex");var selIn=0;var currentDate=new Date();if(month!=currentDate.getMonth()){if((date_isItNextYear(1,month+1))&&(typeof yearField=="undefined")){currentYear++}}var monlen=date_howManyDays(month,currentYear);var datesel=eval("document.FSSform."+direction+"Day");selIn=datesel.selectedIndex;datesel.length=28;for(var i=datesel.length;i<monlen;i++){var optext=i+1;if(optext==29||optext==30){optext+="th"}else{optext+="st"}datesel.options[i]=new Option(optext,i+1,false,false)}if(datesel.length-1<selIn){selIn=datesel.length-1}datesel.selectedIndex=selIn}function expiry_validate(f,b){if(b==null){b=4}var c="";var g=new Date;var d;var h;var e;var a="";if(f.value.length!=b){a="1"}var i="01";if(b>5){i=f.value.substr(0,2)}if(parseFloat(i)<1||parseFloat(i)>31){a+="4"}c=f.value.substr((b-4),2);if(parseFloat(c)<1||(parseFloat(c)>12)){a+="2"}h=f.value.substr((b-2),2);if(b<5){if(parseFloat(c)==12){d=1;h=parseFloat(h)+1}if(parseFloat(c)!=12){d=parseFloat(c)+1}}else{d=c}if(parseFloat(h)<10){h="0"+parseFloat(h)}if(parseFloat(h)>89){h="19"+h}else{h="20"+h}if(i>date_howManyDays((parseFloat(c)-1),h)){a+="5"}if(parseFloat(i)<10){i="0"+parseFloat(i)}if(parseFloat(d)<10){d="0"+parseFloat(d)}e=i+(d+"")+h;if(parseFloat(e.substr(4,4))<parseFloat(g.getFullYear())){a+="3"}if(parseFloat(e.substr(4,4))==parseFloat(g.getFullYear())){if(parseFloat(e.substr(2,2))<parseFloat(g.getMonth()+1)){if(a.indexOf("3")==-1){a+="3"}}}if((parseFloat(e.substr(4,4))==parseFloat(g.getFullYear()))&&(parseFloat(e.substr(2,2))==parseFloat(g.getMonth()+1))){if(parseFloat(e.substr(0,2))<=parseFloat(g.getDate())){if(a.indexOf("3")==-1){a+="3"}}}return(a)}function dropdate_validate(f,d,j){var g=new Date;var e="";var h="";var b="";var a="";var i="";var c="";e=g.getFullYear();h=g.getMonth()+1;b=g.getDate()+1;a+=e;a+=h;a+=b;i+=getDropDownValue(j);c=i;i+=getDropDownValue(d);i+=getDropDownValue(f);if(parseFloat(i)<parseFloat(a)){c=(c-0)+1}return(c)}function dropDate_AfterToday(a,c,d){var b="";b=compare_date(a,c,d);if(b==1){return true}else{return false}}function is_DOB(c,a,d){var b="";b=compare_date(c,a,d);if(b=="-1"){return true}else{return false}}function compare_date(k,d,c){var g=new Date();var e="";var i="";var b="";var a="";var j="";var h="";var l="";var m="";var f="";e=g.getFullYear();i=g.getMonth()+1;if(parseFloat(i)<10){i="0"+i}b=g.getDate();if(parseFloat(b)<10){b="0"+b}a+=e;a+=i;a+=b;if(c.type=="text"){j=c.value;f=c.value}else{j=getDropDownValue(c);f=getDropDownValue(c)}if(d.type=="text"){j+=d.value;m=d.value}else{j+=getDropDownValue(d);m=getDropDownValue(d)}if(k.type=="text"){j+=k.value;l=k.value}else{j+=getDropDownValue(k);l=getDropDownValue(k)}if(parseFloat(m)<1||(parseFloat(m)>12)){return"9"}h=date_stringHowManyDays(m,f);if((l<1)||(l>h)){return"9"}if(j<a){return"-1"}if(j>a){return"1"}if(j==a){return"0"}}function comp_dropdates(b,d,e,a,c,f){if(parseFloat(getDropDownValue(f))<parseFloat(getDropDownValue(e))){return false}if(parseFloat(getDropDownValue(f))==parseFloat(getDropDownValue(e))){if((getDropDownValue(c))<(getDropDownValue(d))){return false}}if(parseFloat(getDropDownValue(f))==parseFloat(getDropDownValue(e))){if((getDropDownValue(c))==(getDropDownValue(d))){if(parseFloat(getDropDownValue(a))<parseFloat(getDropDownValue(b))){return false}}}return true}function comp_daterange(g,d,h,i,c){var b=getDropDownValue(g);var e=getDropDownValue(d);var f=getDropDownValue(h);f=(parseFloat(f))%100;var a=""+f+e+b;if(f<10){a="0"+a}return comp_daterange_date(a,i,c)}function comp_daterange_date(b,a,c){if((b<a)||(b>c)){return false}else{return true}}function compMMYYDate(b,a){if(parseFloat(b.substr(2,2))>parseFloat(a.substr(2,2))){return false}if(parseFloat(b.substr(2,2))==parseFloat(a.substr(2,2))){if(parseFloat(b.substr(0,2))>parseFloat(a.substr(0,2))){return false}}return true}function prepare_date(d,c,b){var f;var a=getDropDownValue(c);var e;if(b==null){f=date_getCurrentYear();if(date_isItNextYear(parseFloat(a)-1)){f++}f+=""}else{f=getDropDownValue(b)}if(f.length==4){f=f.substr(2,2)}e=f+a+getDropDownValue(d);return e}function addToDate(d,a){var e=d.getTime();var c=a*(24*60*60*1000);var b=new Date(e+c);return b}function longDate(c){var a=new Array("January","February","March","April","May","June","July","August","September","October","November","December");var b=c.getMonth();b=a[b];var d=c.getDate()+" "+b+" "+c.getFullYear();return d}function strLongDate(b){var a=createDate(b);var c=longDate(a);return c}function formatFSSDate(d){var e=d.getFullYear();e=(e%100)+"";if(e<10){e="0"+e}var b=d.getMonth();b++;if(b<10){b="0"+b}var c=d.getDate();if(c<10){c="0"+c}var a=e+b+c;return a}function formatDob(d){var e=d.getFullYear()+"";var b=d.getMonth();b++;if(b<10){b="0"+b}var c=d.getDate();if(c<10){c="0"+c}var a=e+b+c;return a}function createDate(d){var e=parseFloat(d.substr(0,2));if(e<46){e+=2000}else{e+=1900}var a=parseFloat(d.substr(2,2)-1);var c=parseFloat(d.substr(4,2));var b=new Date(e,a,c,12,0,0);return b}function setDateDDB(strDate,dateName){var theDate=createDate(strDate);var yrDDB=eval("document.FSSform."+dateName+"Year");var monDDB=eval("document.FSSform."+dateName+"Mon");var dayDDB=eval("document.FSSform."+dateName+"Day");setDropDown(yrDDB,theDate.getYear);setDropDown(monDDB,theDate.getMonth+1);setDays(dateName);setDropDown(dayDDB,theDate.getDay)}function calcDuration(a,b){return Math.round((b.getTime()-a.getTime())/(1000*24*60*60))}function createDateRange(b,c){var a=new Array();a[0]=b;for(var e=new Date(b.getTime());e.getTime()<c.getTime();e.setTime(e.getTime()+24*60*60*1000)){var d=a[a.length-1];if(formatFSSDate(d)!=formatFSSDate(e)){a[a.length]=new Date(e.getTime())}}return a};
