<!--
var disableOnEnter=false
var sSpecialType
var sCurForm
var sCurSearchType
var sFlasher
var bFirstTimer=false;var intervalAutoComplete;function submitSearchForm(sFrm){var m='';if(document.getElementById('idLocationto'+sFrm)){if(!document.getElementById('idLocationto'+sFrm).value||document.getElementById('idLocationto'+sFrm).value=='-'){m+='Please confirm your destination\n';}}
if(document.getElementById('idAirportto'+sFrm)){if(!document.getElementById('idAirportto'+sFrm).value||document.getElementById('idAirportto'+sFrm).value=='-'){m+='Please select your destination airport\n';}}
if(m){alert(m);}else{document.forms['frm'+sFrm].submit();}}
function DisableOnEnter(bValue){disableOnEnter=bValue;}
function OpenSearch(){if(document.getElementById('DivLocations')){showhidechangeoptions('show');}}
function checkAndRemoveReturnDate(sFrm){if(document.forms['frm'+sFrm].oneway){var sShow='';if(document.forms['frm'+sFrm].oneway.checked!=true){sShow='none';}
if(document.getElementById('idReturnDateText'+sFrm)){document.getElementById('idReturnDateText'+sFrm).style.display=sShow;}
if(document.getElementById('idReturnDateField'+sFrm)){document.getElementById('idReturnDateField'+sFrm).style.display=sShow;}}}
function changeCarInclude(sFrm,iType){var iFound=0;sList=sFrm.includecar;for(x=0;x<sList.length;x++){if(sList(x).checked==true&&sList(x).value=='yes'){iFound=1
sFrm.flexibility.disabled=true;if(sFrm.flexibility.value!='0'&&sFrm.flexibility.value!=''){alert('By including car hire, date flexibility has been disabled.');}
if(iType==1){sFrm.flexibility.selectedIndex=0;}else{sFrm.flexibility.selectedIndex=1;}}else{if(iFound==0){sFrm.flexibility.disabled='';if(iType==1){sFrm.flexibility.selectedIndex=3;}else{sFrm.flexibility.selectedIndex=4;}}}}}
function onEnterSearch(sFrmName,sSearchType){}
function showFullSearch(){if(document.getElementById('DivShow')){showhidechangeoptions('show');}}
function validateLocationForm(){var startdate_d='';var startdate_m='';var startdate_y='';sSubmitForm=document.getElementsByName('frm'+sCurForm);sLocationID=document.getElementById('idLocationto'+sCurForm);var e=sSubmitForm.elements,m='';if(sLocationID.value=='-'){m+='- Please select a destination.\n';}
arStartDate=document.getElementById('startdate'+sCurForm).value.split(' ');if(arStartDate.length!=3){m+='- Departure date is not valid.\n';}
if(document.getElementById('rooms'+sCurForm)){if(document.getElementById('rooms'+sCurForm).value=='0'){m+='- Please select no. of rooms\n';}}
if(m){showFullSearch();switchLocationDivs('divLocation'+sCurForm);alert('The following errors occurred:\n\n'+m);return false;}else{sSubmitForm[0].submit();}}
function locationGoBack(sForm){var sLocationID=document.getElementById('idLocationto'+sForm);var sFreetext=document.getElementById('idFreetext'+sForm);clearLocationList(sLocationID);div_switch('divLocationLoad'+sForm,false,true);div_switch('divLocation'+sForm,false,true);div_switch('divFreetext'+sForm,true,true);sFreetext.focus();sFreetext.select();if(document.getElementById('idConfirmedDestination'+sForm)){document.getElementById('idConfirmedDestination'+sForm).style.display='none';}
if(document.getElementById('idConfirmDestinationDDL'+sForm)){document.getElementById('idConfirmDestinationDDL'+sForm).style.display='';}
clearInterval(intervalAutoComplete);}
function switchLocationDivs(sDiv){div_switch('divFreetext'+sCurForm,false,true);div_switch('divLocationLoad'+sCurForm,false,true);div_switch('divLocation'+sCurForm,false,true);div_switch(sDiv,true,true);}
function clearLocationList(listElem){if(listElem!=0){while(listElem.options.length>0){listElem.options[0]=null;}
while(listElem.hasChildNodes()){listElem.removeChild(listElem.firstChild);}}}
function HideAutoCompleteDiv(id){if(document.getElementById(id)){document.getElementById(id).style.display='none';if(document.getElementById('DivShim')){document.getElementById('DivShim').style.display='none';document.getElementById("DivShim").parentNode.removeChild(document.getElementById("DivShim"));}
clearInterval(intervalAutoComplete);}}
function countPassengers(){var iNumPas=0
sSubmitForm=document.forms['frm'+sCurForm];if(sCurForm.indexOf('Flight')>-1||sCurForm.indexOf('Package')>-1){if(sCurSearchType=='Hotel'){for(x=1;x<parseFloat(sSubmitForm.rooms.value)+1;x++){if(sSubmitForm.elements['r'+x+'a']){iNumPas+=parseFloat(sSubmitForm.elements['r'+x+'a'].value);iNumPas+=parseFloat(sSubmitForm.elements['r'+x+'c'].value);iNumPas+=parseFloat(sSubmitForm.elements['r'+x+'i'].value);}}}else{if(sSubmitForm.elements['seats_adult']){iNumPas+=parseFloat(sSubmitForm.elements['seats_adult'].value);iNumPas+=parseFloat(sSubmitForm.elements['seats_child'].value);iNumPas+=parseFloat(sSubmitForm.elements['seats_infant'].value);}}}
return iNumPas;}
function getLocations(sLocation,sForm,sSearchType,sType){if(!disableOnEnter){sLocation=sLocation.replace("'","");sSpecialType=sType;sCurForm=sForm;sCurSearchType=sSearchType;var sLocationID=document.getElementById('idLocationto'+sCurForm);var sFreetextID=document.getElementById('idFreetext'+sCurForm);if(countPassengers()>9){alert('You can only search for a maximum of 9 passengers when your search includes a flight');}else if(sFreetextID.value.length<1||sFreetextID.value=="- type your destination -"){showFullSearch()
alert('Please type your destination');sFreetextID.focus();}else if(sLocationID.value==''){intervalAutoComplete=setInterval("HideAutoCompleteDiv('as_idFreetext"+sForm+"')",500);sURL="/includes/search/LookupXML.asp?searchtype="+sCurSearchType+"&location="+sLocation+"&hund"
if(sURL!=''){if(bDebug){if(confirm('Open '+sURL)){window.open(sURL);}}
clearLocationList(sLocationID);setTimeout("loadLocationXMLDoc('"+sURL+"')",100);}else{alert('No url defined');}}else{validateLocationForm();}}}
function loadLocationXMLDoc(url){var processChange=processLocationChange
if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=processChange;req.open("GET",url,true);req.send(null);}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=processChange;req.open("GET",url,true);req.send();}}}
function processLocationChange(){switchLocationDivs('divLocationLoad'+sCurForm);if(document.getElementById('idAirportto'+sCurForm)){sLocationList=document.getElementById('idAirportto'+sCurForm);sLocationList.disabled='true';}
var sLocationID=document.getElementById('idLocationto'+sCurForm);var sFreetext=document.getElementById('idFreetext'+sCurForm);if(req.readyState==4)
{if(req.status==200)
{xmldoc=req.responseXML.documentElement;nodes=xmldoc.getElementsByTagName('Location');sLocationID.options[0]=new Option('- Select a destination -','-');for(var i=0;i<nodes.length;i++){if(nodes.length!=0){var GroupName=nodes.item(i).attributes.getNamedItem("title").nodeValue
if(PreGroupName!=GroupName){var RegionName=document.createElement('optgroup');RegionName.label=GroupName;if(GroupName!='zzz'){sLocationID.appendChild(RegionName);}else if(i>0){RegionName.label='Others';sLocationID.appendChild(RegionName);}}
var PreGroupName=GroupName
sCode=nodes.item(i).attributes.getNamedItem("code").nodeValue;sName=nodes.item(i).childNodes.item(0).nodeValue;sLocationID.options[sLocationID.options.length]=new Option(sName,sCode);}}
if(nodes.length==1&&sSpecialType!='contact'){if(document.getElementById('idConfirmDestinationDDL'+sCurForm)){document.getElementById('idConfirmDestinationDDL'+sCurForm).style.display='none';}
if(document.getElementById('idConfirmedDestination'+sCurForm)){document.getElementById('idConfirmedDestination'+sCurForm).style.display='';document.getElementById('idConfirmedDestinationText'+sCurForm).innerHTML=sLocationID.options[1].innerHTML}
sLocationID.options[1].selected=true;findDestAirport(sCurForm,sLocationID.options[1].value)
bFirstTimer=true}else if(nodes.length<1){showFullSearch();var sConfirmText='No destinations found.\n\nClick OK to open the destination guide or cancel to go back and refine your search!';switch(sCurForm){case'FlightHotel':sConfirmText='No destinations found for your flight and hotel search.\nWe may only be able to provide you with a flight to this destination.\n\nClick OK to open the destination guide or cancel to go back and refine your search!';break;case'Hotel':sConfirmText='No destinations found for your hotel search.\n\nClick OK to open the destination guide or cancel to go back and refine your search!';break;case'Flight':sConfirmText='No destinations found for your flight search.\n\nClick OK to open the destination guide or cancel to go back and refine your search!';break;}
if(confirm(sConfirmText)){locationGoBack(sCurForm);openDestinationHelp(sCurSearchType.toLowerCase(),'frm'+sCurForm);}else{locationGoBack(sCurForm);sFreetext.focus();sFreetext.select();}}else{showFullSearch();switchLocationDivs('divLocation'+sCurForm);sFlasher=setInterval('selectFlash();',600);}}
else
{alert("There was a problem retrieving the XML data:\n"+req.statusText);}}}
var sCurrentFormID='';var sCurrentForm='';function findDestAirport(sFormID,sLocation){sCurrentForm=document.getElementsByName('frm'+sFormID)
sCurrentFormID=sFormID
if(document.getElementById('idAirportto'+sFormID)){sLocationList=document.getElementById('idAirportto'+sFormID);sLocationList.disabled='true';if(sLocation.length>0&&sLocation!='-'){sURL="/includes/search/LookupXML.asp?searchtype=findairports&location="+sLocation+"&c"
if(sURL!=''){if(bDebug){if(confirm('Open '+sURL)){window.open(sURL);}}
clearLocationList(sLocationList);sLocationList.options[0]=new Option('Loading... Plase wait','');setTimeout("loadServedAirportXMLDoc('"+sURL+"')",100);}else{alert('No url defined');}}else{sLocationList.options[0]=new Option('- Select destination airport -','');sLocationList.selectedIndex=0;sLocationList.disabled='true';}}else{sCurrentForm[0].submit();}}
function loadServedAirportXMLDoc(url){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=processServedAirportChange;req.open("GET",url,true);req.send(null);}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=processServedAirportChange;req.open("GET",url,true);req.send();}}}
function processServedAirportChange(){if(req.readyState==4){if(req.status==200){sLocationList=document.getElementById('idAirportto'+sCurrentFormID);xmldoc=req.responseXML.documentElement;nodes=xmldoc.getElementsByTagName('Location');sLocationList.options[0]=new Option('- Select destination airport -','');for(var i=0;i<nodes.length;i++){if(nodes.length!=0){sCode=nodes.item(i).attributes.getNamedItem("code").nodeValue;sName=nodes.item(i).childNodes.item(0).nodeValue;sLocationList.options[sLocationList.options.length]=new Option(sName,sCode);}}
sLocationList.disabled='';if(nodes.length==1){sLocationList.selectedIndex=1;sCurrentForm[0].submit();}else if(nodes.length==0&&bFirstTimer==true){alert('No airports found for this destination');locationGoBack(sCurrentFormID);}else{switchLocationDivs('divLocation'+sCurrentFormID);}}}}
function addDurationBYO(sform)
{var months=new Array('January','February','March','April','May','June','July','August','September','October','November','December');oSelect=document.getElementById('startdate_d'+sform);iDay=oSelect.options[oSelect.selectedIndex].value;oSelect=document.getElementById('startdate_m'+sform);iMonth=oSelect.options[oSelect.selectedIndex].value;oSelect=document.getElementById('startdate_y'+sform);iYear=oSelect.options[oSelect.selectedIndex].value;cindate=new Date(iYear,iMonth-1,iDay,0,0,0);oSelect=document.getElementById('duration'+sform);if(oSelect.options[oSelect.selectedIndex].value=='other')
{tmpDuration=prompt("Please enter the number of nights","")
if((tmpDuration==' ')||(tmpDuration==null)||(tmpDuration==''))
{iDuration=7
oSelect.options[0].selected='selected';}
else
{var stemp=tmpDuration
if(stemp<10)
{stemp="0"+stemp}
for(loop=0;loop<oSelect.options.length;loop++)
{if(oSelect.options[loop].value==stemp)
{oSelect.options[loop].selected='selected';iDuration=stemp}}
if(isNumeric(tmpDuration)==true)
{var opt=new Option(tmpDuration+' days',tmpDuration);insertOptionAt(oSelect,opt,oSelect.options.length);iDuration=oSelect.options[oSelect.options.length-1].value;oSelect.selectIndex=oSelect.options.length;oSelect.options[oSelect.options.length-1].selected='selected';}
else
{iDuration=7
oSelect.options[0].selected='selected';}}}
else
{iDuration=oSelect.options[oSelect.selectedIndex].value;}
days=1000*60*60*24*iDuration;newdate=new Date(cindate.valueOf()+days);if((newdate.getHours()!=0)||(newdate.getMinutes()!=0)||(newdate.getSeconds()!=0)){time=newdate.getHours()*60*60*1000;time+=newdate.getMinutes()*60*1000;time+=newdate.getSeconds()*1000;newdate=new Date(newdate.getTime()+time);}
if(newdate.getDate()+''!="NaN"){sArrDate=newdate.getDate()+' '+months[newdate.getMonth()]+' '+newdate.getFullYear();}else{sArrDate='Please select a departure date.';}
document.getElementById("arrdate"+sform).innerHTML='<b>'+sArrDate+'</b>'}
function GetElementWidth(sObject){var elem;if(typeof(sObject)=="object"){elem=sObject;}else{elem=document.getElementById(sObject);}
return parseInt(elem.offsetWidth);}
function clearFlash(){try{var sLocationID=document.getElementById('idLocationto'+sCurForm);clearInterval(sFlasher);sLocationID.className='redSelectBox';}catch(err){}}
function selectFlash(){var sLocationID=document.getElementById('idLocationto'+sCurForm);if(sLocationID.className=='redSelectBox'){sLocationID.className='redSelectBox_Switch';}else{sLocationID.className='redSelectBox';}}
function updateRooms(control,maxRooms,idForm){if(idForm==null){formid='';}else{formid=idForm;}
if(control){var iRooms=parseInt(control.options[control.selectedIndex].value);if(!iRooms==0){for(var iRoom=1;iRoom<=maxRooms;iRoom++){var obj=document.getElementById('trRoom'+iRoom+'Values'+formid)
var obj2=document.getElementById('trRoom'+iRoom+'Ages'+formid)
vAgeControl=parseFloat(document.getElementById('ageControl'+iRoom+formid).value);if(obj){if(iRoom>iRooms){obj.style.display='none';}else{obj.style.display='block';}}
if(obj2){if(iRoom>iRooms){obj2.style.display='none';}else{if(!vAgeControl==0){obj2.style.display='block';}}}}}}}
function updatePax(maxPax,maxAdults,maxChild,maxInfant){var oRooms=document.getElementById('rooms');var iPax=0,iAdults=0,iChildren=0,iInfants=0,iTotalAdults=0,iTotalChildren=0,iTotalInfants=0;var paxOkay=false;if(oRooms){paxOkay=true;var iRooms=parseInt(oRooms.options[oRooms.selectedIndex].value);for(var iRoom=1;iRoom<=iRooms;iRoom++){iAdults=0;iChildren=0;iInfants=0;var objAdult=document.getElementById('r'+iRoom+'a');if(objAdult){iAdults=parseInt(objAdult.options[objAdult.selectedIndex].value);}
var objChild=document.getElementById('r'+iRoom+'c');if(objChild){iChildren=parseInt(objChild.options[objChild.selectedIndex].value);}
var objInfant=document.getElementById('r'+iRoom+'i');if(objInfant){iInfants=parseInt(objInfant.options[objInfant.selectedIndex].value);}
iPax+=iAdults+iChildren+iInfants;if(maxPax!=-1){if(iPax>maxPax){alert('The maximum number of people allowed across all rooms is '+maxPax);paxOkay=false;}}
if(paxOkay&&maxAdults!=-1){if(iAdults>maxAdults){alert('The maximum number of adults allowed in room '+iRoom+' is '+maxAdults);paxOkay=false;}}
if(paxOkay&&maxChild!=-1){if(iChildren>maxChild){alert('The maximum number of children allowed in room '+iRoom+' is '+maxChild);paxOkay=false;}}
if(paxOkay&&maxInfant!=-1){if(iInfants>maxInfant){alert('The maximum number of infants allowed in room '+iRoom+' is '+maxInfant);paxOkay=false;}}
if(iChildren>0||iInfants>0){for(var iChild=1;iChild<=maxChild;iChild++){obj=document.getElementById('r'+iRoom+'c_ages'+iChild);if(obj){if(iChild<=iChildren){obj.style.display='block';}else{obj.style.display='none';}}}
obj=document.getElementById('sCAges'+iRoom);if(obj){if(iChildren<1){obj.style.display='none';}else{obj.style.display='block';}}
for(var iInfant=1;iInfant<=maxInfant;iInfant++){obj=document.getElementById('r'+iRoom+'i_ages'+iInfant);if(obj){if(iInfant<=iInfants){obj.style.display='block';}else{obj.style.display='none';}}}
obj=document.getElementById('sIAges'+iRoom);if(obj){if(iInfants<1){obj.style.display='none';}else{obj.style.display='block';}}}
if(iChildren<1){for(var iChild=1;iChild<=maxChild;iChild++){obj=document.getElementById('r'+iRoom+'c_ages'+iChild);if(obj){obj.style.display='none';}}
obj=document.getElementById('sCAges'+iRoom);if(obj){obj.style.display='none';}}
if(iInfants<1){for(var iInfant=1;iInfant<=maxInfant;iInfant++){obj=document.getElementById('r'+iRoom+'i_ages'+iInfant);if(obj){obj.style.display='none';}}
obj=document.getElementById('sIAges'+iRoom);if(obj){obj.style.display='none';}}
iTotalAdults+=iAdults
iTotalChildren+=iChildren
iTotalInfants+=iInfants}
var objSeats=document.getElementById('seats_adult')
if(objSeats&&iAdults<=objSeats.options.length){objSeats.options[iTotalAdults].selected=true;}
var objSeats=document.getElementById('seats_child')
if(objSeats&&iChildren<=objSeats.options.length){objSeats.options[iTotalChildren].selected=true;}
var objSeats=document.getElementById('seats_infant')
if(objSeats&&iInfants<=objSeats.options.length){objSeats.options[iTotalInfants].selected=true;}}
return paxOkay;}
function updatePax2(id,type,idForm){if(idForm==null){formid='';}else{formid=idForm;}
vPerson=parseFloat(document.getElementById('r'+id+type+formid).value);vAgeControl=parseFloat(document.getElementById('ageControl'+id+formid).value);var objAges=document.getElementById('trRoom'+id+'Ages'+formid);for(i=1;i<15;i++){if(i>vPerson){div_switch('r'+id+type+'_ages'+i+formid,false,true);}else{var personFound='yes'
div_switch('r'+id+type+'_ages'+i+formid,true,true);}}
if(personFound=='yes'){if(document.getElementById('s'+type.toUpperCase()+'Ages'+id+formid).style.display=="none"){vAgeControl=vAgeControl+1}
div_switch('s'+type.toUpperCase()+'Ages'+id+formid,true,true);}else{if(document.getElementById('s'+type.toUpperCase()+'Ages'+id+formid).style.display=="block"){vAgeControl=vAgeControl-1}
div_switch('s'+type.toUpperCase()+'Ages'+id+formid,false,true);}
if((vAgeControl==0)&&(objAges)){div_switch('trRoom'+id+'Ages'+formid,false,true);}else{if(objAges){div_switch('trRoom'+id+'Ages'+formid,true,true);}}
document.getElementById('ageControl'+id+formid).value=vAgeControl;}
-->
