function QQ_changeByAirportGroup(formname,airportGroupId,airportId){if(airportGroupId==-1){window.location='/uk-quickquote.php';return;};var airportSelectList=eval('document.forms.'+formname+'.airportid');var resortSelectList=eval('document.forms.'+formname+'.resortid');var ss=false;for(var del in airportSelectList.options){airportSelectList.length=1;};for(var del in resortSelectList.options){resortSelectList.length=1;};if(airportGroupId!=''){var l;var f;for(var i in arrAirports){if(arrAirports[i][1]==airportGroupId){l=airportSelectList.length;if(arrAirports[i][0]==airportId){var ss=l;}
newElem=new Option(arrAirports[i][2],arrAirports[i][0],false,false);airportSelectList.options[l]=newElem;f=true;};};};resortSelectList.disabled=true;if(f){if(ss){airportSelectList.options[ss].selected=true;}
airportSelectList.disabled=false;}else{airportSelectList.disabled=true;}}
function QQ_changeByAirport(formname,airportId,resortId){var airportSelectList=eval('document.forms.'+formname+'.airportid');var resortSelectList=eval('document.forms.'+formname+'.resortid');var airportGroupId=eval('document.forms.'+formname+'.airportgroupid.value');var ss=false;if(airportId==-1){window.location='/uk-quickquote.php';return;};for(var del in resortSelectList.options){resortSelectList.length=1;};if(airportId!=''){var l;var f;for(var i in arrResorts){if(arrResorts[i][1]==airportId&&arrResorts[i][2]==airportGroupId){l=resortSelectList.length;if(arrResorts[i][0]==resortId){ss=l;}
newElem=new Option(arrResorts[i][3],arrResorts[i][0],false,false);resortSelectList.options[l]=newElem;f=true;};};};if(f){if(ss){resortSelectList.options[ss].selected=true;}
resortSelectList.disabled=false;}else{resortSelectList.disabled=true;}}
function QQ_populateLists()
{var objAirportGroups=document.forms.quickquoteform.airportgroupid;var objAirports=document.forms.quickquoteform.airportid;var objResorts=document.forms.quickquoteform.resortid;var objForm=document.forms.quickquoteform;for(var i=1;i<arrAirportGroups.length;i++)
{objAirportGroups.options[i]=new Option(arrAirportGroups[i][1],arrAirportGroups[i][0]);}
for(var i=1;i<arrAirports.length;i++)
{objAirports.options[i]=new Option(arrAirports[i][2],arrAirports[i][0]);}
for(var i=1;i<arrResorts.length;i++)
{objResorts.options[i]=new Option(arrResorts[i][3],arrResorts[i][0]);}
objForm.today.options[new Date().getDate()+1].selected=true;objForm.tomonth.options[new Date().getUTCMonth()].selected=true;}
function getBookingType(){var selectBookingType=true;if(document.getElementById("bookingtypeid1")){selectBookingType=false;}
if(selectBookingType)
{if(document.getElementById("bookingtypeid")){bookingTypeId=document.getElementById('bookingtypeid').value;}
else
{return false;}}
else
{for(i=0;i<document.quickquoteform.bookingtypeid.length;i++){if(document.quickquoteform.bookingtypeid[i].checked){bookingTypeId=document.quickquoteform.bookingtypeid[i].value;}}}
return bookingTypeId;}
function QQ_validateQuicksearchForm(objForm){var errMsg=quickQuoteErrorMessages['ERROR_MESSAGE']+"\n\n";var isErr=false;var defaultStyle=false;if(document.getElementsByName("today").length==0){defaultStyle=true;}
var availableDate=new Date();availableDate.setDate(availableDate.getDate()+1);var airportgroupid=objForm.airportgroupid.value;var airportid=objForm.airportid.value;var resortid=objForm.resortid.value;if(airportgroupid==""||airportid==""||resortid==""){errMsg+=quickQuoteErrorMessages['DEST_ERROR']+"\n";isErr=true;};if(defaultStyle)
{var bookingTypeId=getBookingType();if((bookingTypeId=='1')||(bookingTypeId=='2')){var arrivalmonthyear=objForm.arrivalmonthyear.value;var arrivalday=objForm.arrivalday.value;var arrivalmonth=arrivalmonthyear.substring(0,2);var arrivalyear=arrivalmonthyear.substring(2,6);var arrivalhours=objForm.arrivalhours.value;var arrivalminutes=objForm.arrivalminutes.value;var arrivalDateTime=new Date(arrivalyear,arrivalmonth-1,arrivalday,arrivalhours,arrivalminutes);if(arrivalDateTime<availableDate){isErr=true;errMsg+=quickQuoteErrorMessages['ARR_DATE_ERROR']+"\n";};if(!isValidDate(arrivalday,arrivalmonth,arrivalyear)){errMsg+=quickQuoteErrorMessages['VALID_DATE_ERROR']+"\n";isErr=true;};};if((bookingTypeId=='1')||(bookingTypeId=='3')){var departuremonthyear=objForm.departuremonthyear.value;var departureday=objForm.departureday.value;var departuremonth=departuremonthyear.substring(0,2);var departureyear=departuremonthyear.substring(2,6);var departurehours=objForm.departurehours.value;var departureminutes=objForm.departureminutes.value;var departureDateTime=new Date(departureyear,departuremonth-1,departureday,departurehours,departureminutes);if(departureDateTime<availableDate){isErr=true;errMsg+=quickQuoteErrorMessages['DEP_DATE_ERROR']+"\n";};if(!isValidDate(departureday,departuremonth,departureyear)){errMsg+=quickQuoteErrorMessages['VALID_DATE_ERROR']+"\n";isErr=true;};};if(bookingTypeId=='1'){if(arrivalDateTime>=departureDateTime)
{errMsg+=quickQuoteErrorMessages['DEP_DATE_FIRST_ERROR']+"\n";};};}else{var today=objForm.today.value;var tomonthyear=objForm.tomonthyear.value;var tomonth=tomonthyear.substring(0,2);var toyear=tomonthyear.substring(2,6);var toDateTime=new Date(toyear,tomonth-1,today,23,59);if(toDateTime<availableDate){isErr=true;errMsg+=quickQuoteErrorMessages['ARR_DATE_ERROR']+"\n";};if(!isValidDate(today,tomonth,toyear)){errMsg+=quickQuoteErrorMessages['VALID_DATE_ERROR']+"\n";isErr=true;};};if(isErr){alert(errMsg);return false;};return true;}
function QQ_changeBookingType(){var bookingTypeId=getBookingType();switch(bookingTypeId)
{case'1':document.getElementById('arrivalminutes').disabled='';document.getElementById('arrivalhours').disabled='';document.getElementById('arrivalday').disabled='';document.getElementById('arrivalmonthyear').disabled='';document.getElementById('frm_arrival_trigger').style.display='';document.getElementById('departureminutes').disabled='';document.getElementById('departurehours').disabled='';document.getElementById('departureday').disabled='';document.getElementById('departuremonthyear').disabled='';document.getElementById('frm_departure_trigger').style.display='';break;case'2':document.getElementById('arrivalminutes').disabled='';document.getElementById('arrivalhours').disabled='';document.getElementById('arrivalday').disabled='';document.getElementById('arrivalmonthyear').disabled='';document.getElementById('frm_arrival_trigger').style.display='';document.getElementById('departureminutes').disabled='disabled';document.getElementById('departurehours').disabled='disabled';document.getElementById('departureday').disabled='disabled';document.getElementById('departuremonthyear').disabled='disabled';document.getElementById('frm_departure_trigger').style.display='none';break;case'3':document.getElementById('arrivalminutes').disabled='disabled';document.getElementById('arrivalhours').disabled='disabled';document.getElementById('arrivalday').disabled='disabled';document.getElementById('arrivalmonthyear').disabled='disabled';document.getElementById('frm_arrival_trigger').style.display='none';document.getElementById('departureminutes').disabled='';document.getElementById('departurehours').disabled='';document.getElementById('departureday').disabled='';document.getElementById('departuremonthyear').disabled='';document.getElementById('frm_departure_trigger').style.display='';break;}}
function QQ_populateContent(elementName,selectedValue,highlight,anchorhighlight){var htmlStr='';if(!highlight)var highlight="#ffc000";if(!anchorhighlight)var anchorhighlight="#000";switch(elementName){case"airportgroups":htmlStr+='<table style="width: 100%" cellspacing="0" cellpadding="0">';var count=0;for(var i in arrAirportGroups){htmlStr+='<tr onmouseover="this.style.backgroundColor = \''+highlight+'\'; document.getElementById(\'airportgroupanchor'+count+'\').style.color = \''+anchorhighlight+'\';"';htmlStr+=' onmouseout="this.style.backgroundColor = \'\'; document.getElementById(\'airportgroupanchor'+count+'\').style.color = \'\';"';if(arrAirportGroups[i][0]==-1){htmlStr+='>';htmlStr+='<td><a id="airportgroupanchor'+count+'" href="/uk-quickquote.php">'+arrAirportGroups[i][1]+'</a></td>';}else{htmlStr+=' onclick="QQ_populateContent(\'airports\','+arrAirportGroups[i][0]+', \''+highlight+'\', \''+anchorhighlight+'\');">';htmlStr+='<td><a id="airportgroupanchor'+count+'" href="/resorts.php" onclick="return false;">'+arrAirportGroups[i][1]+'</a></td>';};htmlStr+='</tr>';count++;};htmlStr+='</table>';document.getElementById(elementName).innerHTML=htmlStr;break;case"airports":document.getElementById('resorts').innerHTML='';if(selectedValue!=''){htmlStr+='<table style="width: 100%" cellspacing="0" cellpadding="0">';var count=0;for(var i in arrAirports){if(selectedValue==9&&arrAirports[i][1]==selectedValue){htmlStr+='<tr onmouseover="this.style.backgroundColor = \''+highlight+'\'; document.getElementById(\'airportanchor'+count+'\').style.color = \''+anchorhighlight+'\';"';htmlStr+=' onmouseout="this.style.backgroundColor = \'\'; document.getElementById(\'airportanchor'+count+'\').style.color = \'\';"';htmlStr+=' onclick="displaySkiResortMap('+arrAirports[i][0]+', \''+highlight+'\', \''+anchorhighlight+'\');">';htmlStr+='<td><a id="airportanchor'+count+'" href="/resorts.php" onclick="return false;">'+arrAirports[i][2]+'</a></td>';htmlStr+='</tr>';}else if(arrAirports[i][1]==selectedValue){htmlStr+='<tr onmouseover="this.style.backgroundColor = \''+highlight+'\'; document.getElementById(\'airportanchor'+count+'\').style.color = \''+anchorhighlight+'\';"';htmlStr+=' onmouseout="this.style.backgroundColor = \'\'; document.getElementById(\'airportanchor'+count+'\').style.color = \'\';"';htmlStr+=' onclick="QQ_populateContent(\'resorts\','+arrAirports[i][0]+', \''+highlight+'\', \''+anchorhighlight+'\');">';htmlStr+='<td><a id="airportanchor'+count+'" href="/resorts.php" onclick="return false;">'+arrAirports[i][2]+'</a></td>';htmlStr+='</tr>';};count++;};htmlStr+='</table>';document.getElementById(elementName).innerHTML=htmlStr;window.scrollTo(0,0);}else{document.getElementById(elementName).innerHTML='';}
document.retainvalues.airportgroupid.value=selectedValue;break;case"resorts":if(selectedValue!=''){var airportGroupId=document.retainvalues.airportgroupid.value;htmlStr+='<table style="width: 100%" cellspacing="0" cellpadding="0">';var count=0;for(var i in arrResorts){if(arrResorts[i][1]==selectedValue&&arrResorts[i][2]==airportGroupId){htmlStr+='<tr onmouseover="this.style.backgroundColor = \''+highlight+'\'; document.getElementById(\'resortanchor'+count+'\').style.color = \''+anchorhighlight+'\';"';htmlStr+=' onmouseout="this.style.backgroundColor = \'\'; document.getElementById(\'resortanchor'+count+'\').style.color = \'\';"';htmlStr+=' onclick="window.location=\'/products.php?airportgroupid='+airportGroupId+'&airportid='+selectedValue+'&resortid='+arrResorts[i][0]+'\';">';htmlStr+='<td><a id="resortanchor'+count+'" href="/resorts.php" onclick="return false;">'+arrResorts[i][3]+'</a></td>';htmlStr+='</tr>';count++;};};htmlStr+='</table>';document.getElementById(elementName).innerHTML=htmlStr;window.scrollTo(0,0);}else{document.getElementById(elementName).innerHTML='';}
break;default:break;};}
function QQ_mouseoverAirportMap(default_map,airport)
{document.getElementById(default_map).style.display='none';document.getElementById(airport).style.position='relative';document.getElementById(airport).style.left='0';}
function QQ_mouseoutAirportMap(default_map,airport)
{document.getElementById(default_map).style.display='';document.getElementById(airport).style.position='absolute';document.getElementById(airport).style.left='-1000px';}
function displaySkiResortMap(airportId,highlight,anchorhighlight){if((typeof skiLanguageCode=="string")&&skiLanguageCode=='en'){window.location='/ski/?airportid='+airportId+'&redirect=\/\?airportgroupid\=9';}else{QQ_populateContent('resorts',airportId,highlight,anchorhighlight);}};function redirectTransferType(){len=document.quickquoteform.transfertype.length;for(i=0;i<len;i++)
{if(document.quickquoteform.transfertype[i].checked){chosen=document.quickquoteform.transfertype[i].value}}
url='';switch(chosen){case"HOL":url='http://www.holidaytaxis.com';break;case"SKI":url='http://www.skitaxis.com';break;case"BSI":url='http://www.businesstaxis.com';break;default:break;};if(url!='')
{newWindow=window.open(url,'_blank');newWindow.focus();}}
