function checkform(elementID) { var monthyear = document.forms[elementID].depMY.options[document.forms[elementID].depMY.selectedIndex].value; var month = monthyear.substr(0,2); var year = monthyear.substr(2,4); var dateString = year+"/"+month+"/"+document.forms[elementID].depDay.value; var myDate = new Date(dateString); var weekday=new Array(7); weekday[0]="Sunday"; weekday[1]="Monday"; weekday[2]="Tuesday"; weekday[3]="Wednesday"; weekday[4]="Thursday"; weekday[5]="Friday"; weekday[6]="Saturday"; //alert(dateString); //alert(weekday[myDate.getDay()]); //alert(document.forms[elementID].destination.value); if(elementID==="pk"){ if(document.forms[elementID].destination.selectedIndex == 0){ alert("Please select a destination"); return(false); }else if(document.forms[elementID].from.selectedIndex == 0){ alert("Please select a departure airport"); return(false); }else if(document.forms[elementID].depDay.options[document.forms[elementID].depDay.selectedIndex].value <= "12" && month <= "03" && year <= "2010") { alert("Please select a date in the future"); return(false); } else if(weekday[myDate.getDay()]!="Tuesday" && document.forms[elementID].destination.value=="MLA" && (document.forms[elementID].from.value=="BRS" || document.forms[elementID].from.value=="EXT" || document.forms[elementID].from.value=="NWI" || document.forms[elementID].from.value=="CWL")){ alert("Your chosen airport only operates a chartered flight to Malta on a Tuesday\n\nPlease re-select"); return(false); } else if(document.forms[elementID].destination.value=="MLA" && (document.forms[elementID].from.value=="EMA")){ return confirm("PLEASE NOTE: This route operates every Tuesday and Saturday as of 29th May 2010\n\nTo confirm your selection, press OK or press Cancel to reselect using Birmingham or Luton instead."); } else if(weekday[myDate.getDay()]!="Monday" && document.forms[elementID].destination.value=="FNC" && document.forms[elementID].plusminus.value!=1 && (document.forms[elementID].from.value=="BHX" || document.forms[elementID].from.value=="BOH" || document.forms[elementID].from.value=="CWL" || document.forms[elementID].from.value=="EMA" || document.forms[elementID].from.value=="EDI" || document.forms[elementID].from.value=="EXT" || document.forms[elementID].from.value=="GLA" || document.forms[elementID].from.value=="LTN" || document.forms[elementID].from.value=="MAN")){ alert("Your chosen airport only operates a chartered flight to Madeira on a Monday\n\nPlease re-select"); return(false); } else if(weekday[myDate.getDay()]!="Tuesday" && document.forms[elementID].destination.value=="MLA" && (document.forms[elementID].from.value=="EMA")){ alert("Your chosen airport only operates a chartered flight to Malta on a Tuesday\n\nPlease re-select"); return(false); }else if(document.forms[elementID].r1ad.value == 1 & document.forms[elementID].r1ch.value > 0){ alert("Room 1: Occupancy rules restrict children from sharing with a single adult."); return(false); }else if(document.forms[elementID].r2ad.value == 1 & document.forms[elementID].r2ch.value > 0){ alert("Room 2: Occupancy rules restrict children from sharing with a single adult."); return(false); }else if(document.forms[elementID].r3ad.value == 1 & document.forms[elementID].r3ch.value > 0){ alert("Room 3: Occupancy rules restrict children from sharing with a single adult."); return(false); }else if(document.forms[elementID].optout.checked==true){ if(document.forms[elementID].semail.value.length==0 && echeck(document.forms[elementID].semail.value)==false){ alert("Please provide your email address to continue your availability search."); return(false); } } } if(elementID==="ao"){ if(document.forms[elementID].destination.selectedIndex == 0){ alert("Please select a destination"); return(false); }else if(document.forms[elementID].depDay.options[document.forms[elementID].depDay.selectedIndex].value <= "12" && month <= "03" && year <= "2010") { alert("Please select a date in the future"); return(false); }else if(document.forms[elementID].r1ad.value == 1 & document.forms[elementID].r1ch.value > 0){ alert("Room 1: Occupancy rules restrict children from sharing with a single adult."); return(false); }else if(document.forms[elementID].r2ad.value == 1 & document.forms[elementID].r2ch.value > 0){ alert("Room 2: Occupancy rules restrict children from sharing with a single adult."); return(false); }else if(document.forms[elementID].r3ad.value == 1 & document.forms[elementID].r3ch.value > 0){ alert("Room 3: Occupancy rules restrict children from sharing with a single adult."); return(false); }else if(document.forms[elementID].optout.checked==true){ if(document.forms[elementID].semail.value.length==0 && echeck(document.forms[elementID].semail.value)==false){ alert("Please provide your email address to continue your availability search."); return(false); } } } }