var iResultTimeout=1200000;var iFilter_MinPricePerPerson=0;var iFilter_MaxPricePerPerson=0;var sFilter_StarRating='';var sFilter_BoardTypes='';var sBYOSessionID='';var sBYOParentID='';var sViewState='';var AjaxResultsXMLDoc,iMaximumPricePerPerson,iMinimumPricePerPerson,sPagingData,iResultPageCount,sCurrentSearch;var iTotalNumPassengers=0;var sHTMLLoadTemplate='';var sHTMLTemplate='';var sHTMLPagingTemplate='';var sHTMLPagingTemplateBottom='';var sHTMLMoreInfoTemplate='';var sHTMLNoResults='';var iResultCount=0;var iTotalResultCount=0;var iMaximumNumberOfResults=12;var iCurrentPageNum=1;var sResultsSortBy;var bLoaderShowing=false;var sResultStyle='QC';var sFullDetailsURL='';var sBookButtonJS='';var sAddToShortlistButtonJS='';var bStillOnAccommTab=true;var bOpenFlightOptions=false;var sShortlistPositions='';var sOptionsText='';var bVirtualVisit=false;var dDays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];var iHotelCount=0;var dSearchDate=new Date();var iVVHeight_Temp=0;var iVVWidth_Temp=0;var iVVHeight=0;var iVVWidth=0;var sTransferIncludedPopup="A return transfer is included in this price!";var sTransferNotIncludedPopup="Don't worry, we can provide transfers to all of our sailing destinations. Please contact us for specific transfer information.";function LoadResults(bUseAsync){if(queryString('page')=='shortlist'){AROpenSearch();div_switch('pleasewaitDiv',false,true);div_switch('websiteDiv',true,true);SwitchResult('result_tab5');return false;}else{oResultTab1=document.getElementById('result_tab1');oResultTab2=document.getElementById('result_tab2');if(sResultStyle=='QC'){if(oResultTab1){oResultTab1.className='resulttabOver';}
if(oResultTab2){oResultTab2.className='resulttab';}}else{if(oResultTab1){oResultTab1.className='resulttab';}
if(oResultTab2){oResultTab2.className='resulttabOver';}}}
sHTMLPagingTemplate=readFileInAsync('/includes/ajaxresults/templates/paging.html');sHTMLPagingTemplateBottom=readFileInAsync('/includes/ajaxresults/templates/pagingbottom.html');sHTMLLoadTemplate=readFileInAsync('/includes/ajaxresults/templates/loader.html');sHTMLNoResults=readFileInAsync('/includes/ajaxresults/templates/noresults.html');var sURLExtra='';sURLExtra+='&slistid='+sShortlistUserID;if(sBYOSessionID){sURLExtra+='&sortby='+sResultsSortBy;}
var timestamp=new Date();sURL='/includes/ajaxresults/ajaxresults.asp'+window.location.search+'&sessionid='+sBYOSessionID+sURLExtra+'&ts='+timestamp;sURL=sURL.replace("'","");sAjaxResultsURL=sURL;if(bDebug){if(confirm('Open '+sURL)){window.open(sURL);}}
setTimeout("loadAjaxResultsXMLDoc('"+sURL+"')",100);}
function loadAjaxResultsXMLDoc(url){if(window.XMLHttpRequest){reqAR=new XMLHttpRequest();reqAR.onreadystatechange=processAjaxResults;reqAR.open("GET",url,true);reqAR.send(null);}else if(window.ActiveXObject){reqAR=new ActiveXObject("Microsoft.XMLHTTP");if(reqAR){reqAR.onreadystatechange=processAjaxResults;reqAR.open("GET",url,true);reqAR.send();}}}
function processAjaxResults(){if(reqAR.readyState==4){if(reqAR.status==200){AjaxResultsXMLDoc=reqAR.responseXML.documentElement;if(sBYOSessionID){RunResults();}else if(setFilter()){setFilterVariable_StarRating();setFilterVariable_BoardTypes();RunResults();div_switch('pleasewaitDiv',false,true);div_switch('websiteDiv',true,true);setResultTimer();}else{alert('Invalid XML');div_switch('pleasewaitDiv',false,true);div_switch('websiteDiv',true,true);showNoResults(queryString('search_type'));}}else{if(bDebug){alert('Timed out: '+reqAR.status);}
div_switch('pleasewaitDiv',false,true);div_switch('websiteDiv',true,true);showNoResults(queryString('search_type'));}}}
function resultTimeout(){alert('As this page has been open for more than '+Math.round(parseFloat(iResultTimeout/1000/60))+' minutes, we need to check availability again.\nPlease click OK and the page will refresh automatically');var sWindowLocation=window.location.toString();if(sWindowLocation.indexOf('#')>-1){sWindowLocation=sWindowLocation.split('#')[0];}
location.href=sWindowLocation+'&research=true';}
function setResultTimer(){setTimeout('resultTimeout()',iResultTimeout);}
function RunResults(bNotFirstTime,bDoNotRunPagingData){document.getElementById('SessionID').value=GetNode(AjaxResultsXMLDoc.getElementsByTagName('SESSIONID')[0].childNodes.item(0));document.getElementById('locationtoforenquiry').value=GetNode(AjaxResultsXMLDoc.getElementsByTagName('LOCATIONTO')[0].childNodes.item(0));div_switch('ResultContent',true,true);div_switch('OtherFullContent',false,true);bLoaderShowing=false;var oAvailable=AjaxResultsXMLDoc.getElementsByTagName('AVAILABLE');var oAvailableFlights=AjaxResultsXMLDoc.getElementsByTagName('AVAILABLEFLIGHTS');var iFlightResultCount=0;if(oAvailableFlights.length>0){iFlightResultCount=parseFloat(GetAttribute(oAvailableFlights.item(0).attributes.getNamedItem("ResultCount")));}
var iResultCount=parseFloat(GetAttribute(oAvailable.item(0).attributes.getNamedItem("ResultCount")));sCurrentSearch=queryString('search_type');if(((isNaN(iResultCount)||iResultCount>0)&&sCurrentSearch!='Flight_Hotel')||((isNaN(iResultCount)||iResultCount>0)&&iFlightResultCount>0&&sCurrentSearch=='Flight_Hotel')){if(!bNotFirstTime){sShortlistPositions=GetAttribute(oAvailable.item(0).attributes.getNamedItem("ShortlistPositions"));}
var oSearchXML=AjaxResultsXMLDoc.getElementsByTagName('SESSIONID');sBYOSessionID=GetNode(oSearchXML[0].childNodes.item(0));if(queryString('debugbyo')=='true'){window.open('/buildyourown/xml_avail/'+sBYOSessionID+'.xml');}
var oParentIDXML=AjaxResultsXMLDoc.getElementsByTagName('PARENTID');sBYOParentID=GetNode(oParentIDXML[0].childNodes.item(0));var oViewStateXML=AjaxResultsXMLDoc.getElementsByTagName('VIEWSTATE');if(oViewStateXML.length>0){sViewState=GetNode(oViewStateXML[0].childNodes.item(0));}
if(sCurrentSearch=='PackageHoliday'){RunResults_PackageHoliday(bNotFirstTime,bDoNotRunPagingData);}else if(sCurrentSearch=='Hotel'){RunResults_Hotel(bNotFirstTime,bDoNotRunPagingData);}else if(sCurrentSearch=='Flight_Hotel'){RunResults_FlightHotel(bNotFirstTime,bDoNotRunPagingData);}
LoadingAnimationStop();}else{showNoResults(sCurrentSearch);}}
function showNoResults(sSearchType,sQS){div=document.getElementById('ResultsPageOther');if(div&&sSearchType){sTempHTML=sHTMLNoResults;sTempHTML=sTempHTML.replace(/#search_type#/g,getProperSearchType(sSearchType).toLowerCase());div.innerHTML=sTempHTML;if(sSearchType.toLowerCase().indexOf('flight')>-1||sSearchType.toLowerCase().indexOf('package')>-1){divAirportInfo1=document.getElementById('NR_ReasonsAirport');if(divAirportInfo1){divAirportInfo1.style.display=''};divAirportInfo2=document.getElementById('NR_OptionsAirport');if(divAirportInfo2){divAirportInfo1.style.display=''};}
div_switch('ResultsPage',false,true);div_switch(div.id,true,true);}
if(sSearchType.toLowerCase().indexOf('package')==-1){flexiFlights(true);}}
function getProperSearchType(sSearchType){switch(sSearchType.toLowerCase()){case'packageholiday':return'Package holiday';break;case'hotel':return'Accommodation';break;case'flight_hotel':return'Skiing holiday';break;}}
function EnquireResultItem(id){document.forms['frmResults'].EnquireTextID.value=id;document.forms['frmResults'].action="/contact.asp";frmBYOSubmitBS();}
var iFlight_PricePerPerson=0;var iFlight_JSID=0;function GetFlightCount(oFlight,sCSIPEID){var iFCount=0;for(iF=0;iF<oFlight.length;iF++){sFDate=new Date(GetNode(oFlight[iF].getElementsByTagName('ROUTE')[0].getElementsByTagName('SEGMENT')[0].getElementsByTagName('DEP_DATE')[0].childNodes.item(0)));if(GetNode(oFlight[iF].getElementsByTagName('CSI_PEID')[0].childNodes.item(0))==sCSIPEID&&dSearchDate.toString()==sFDate.toString()){iFCount++;}}
return iFCount;}
function RunResults_FlightHotel(bNotFirstTime,bDoNotRunPagingData,bDontCheckFlightDate){dSearchDate=new Date(getSearchCriteria('DEP_DATE_Y'),(parseFloat(getSearchCriteria('DEP_DATE_M'))-1),getSearchCriteria('DEP_DATE_D'));if(!bNotFirstTime){div_switch('result_tab7',true,true);}
if(!sHTMLTemplate){sHTMLTemplate=readFileInAsync('/includes/ajaxresults/templates/flighthotel_qc.html');}
sHTML='';var oHotel=AjaxResultsXMLDoc.getElementsByTagName('Hotel');var oFlight=AjaxResultsXMLDoc.getElementsByTagName('FARE');sFABSession=GetNode(AjaxResultsXMLDoc.getElementsByTagName('FABSESSIONID')[0].childNodes.item(0));sPkgFABSession='';if(AjaxResultsXMLDoc.getElementsByTagName('PKGFABSESSIONID')){sPkgFABSession=GetNode(AjaxResultsXMLDoc.getElementsByTagName('PKGFABSESSIONID')[0].childNodes.item(0));}
iResultCount=0;iPageCount=0;if(!bDoNotRunPagingData){iResultPageCount=0;sPagingData='0';iTotalResultCount=0;iCurrentPageNum=1;}
if(iFlight_JSID==0&&!bDontCheckFlightDate){for(xF=0;xF<oFlight.length;xF++){oRoute=oFlight[xF].getElementsByTagName('ROUTE');oSegment=oRoute[0].getElementsByTagName('SEGMENT');dFlight_DepDate=new Date(GetNode(oSegment[0].getElementsByTagName('DEP_DATE')[0].childNodes.item(0)));dFlight_DepDate.setMonth(dFlight_DepDate.getMonth());if(dFlight_DepDate.toString()==dSearchDate.toString()&&GetAttribute(oFlight[iFlight_JSID].attributes.getNamedItem("Package"))=='false'){iFlight_JSID=xF;break;}}}
iFlight_PricePerPerson=GetNode(oFlight[iFlight_JSID].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0));iFlight_StdPrice=GetNode(oFlight[iFlight_JSID].getElementsByTagName('TotalStdPrice')[0].childNodes.item(0));sTransfer=GetNode(oFlight[iFlight_JSID].getElementsByTagName('TransferSearch')[0].childNodes.item(0));iTransfer_PricePerPerson=parseFloat(GetNode(oFlight[iFlight_JSID].getElementsByTagName('TransferPricePerPerson')[0].childNodes.item(0)));iTransfer_Price=parseFloat(GetNode(oFlight[iFlight_JSID].getElementsByTagName('TransferPrice')[0].childNodes.item(0)));iFlight_PricePerPerson=parseFloat(iFlight_PricePerPerson)+parseFloat(iTransfer_PricePerPerson);iFlight_StdPrice=parseFloat(iFlight_StdPrice)+iTransfer_Price;sFlight_FareID=GetNode(oFlight[iFlight_JSID].getElementsByTagName('FARE_ID')[0].childNodes.item(0));sFlight_Provider=GetNode(oFlight[iFlight_JSID].getElementsByTagName('PROVIDER')[0].childNodes.item(0));sFlight_CSIFareID=GetAttribute(oFlight[iFlight_JSID].attributes.getNamedItem("CSI_FAREID"));dCarHire_PricePerPerson=0;for(iH2=0;iH2<oHotel.length;iH2++){oCarHire2=oHotel[iH2].getElementsByTagName('CarHire');if(oCarHire2){sCarHire=GetNode(oCarHire2[0].childNodes.item(0));dCarHirePrice2=parseFloat(GetAttribute(oCarHire2[0].attributes.getNamedItem("Price")));if(sCarHire.toLowerCase()=='true'&&dCarHirePrice2>0){dCarHire_PricePerPerson=parseFloat(dCarHirePrice2);}}}
sFlight_DetailHTML='';sFlight_DepDate='';sFlight_ArrDate='';sFlight_ActualArrAirport='';sHotel_DepDate='';sHotel_ArrDate='';oRoute=oFlight[iFlight_JSID].getElementsByTagName('ROUTE');for(x=0;x<oRoute.length;x++){oSegment=oRoute[x].getElementsByTagName('SEGMENT');for(xy=0;xy<oSegment.length;xy++){sFlight_Num=GetNode(oSegment[xy].getElementsByTagName('FLIGHT_NUM')[0].childNodes.item(0));sFlight_DepDate=GetNode(oSegment[xy].getElementsByTagName('DEP_DATE')[0].childNodes.item(0));sFlight_ArrDate=GetNode(oSegment[xy].getElementsByTagName('ARR_DATE')[0].childNodes.item(0));sFlight_DepTime=GetNode(oSegment[xy].getElementsByTagName('DEP_TIME')[0].childNodes.item(0));sFlight_ArrTime=GetNode(oSegment[xy].getElementsByTagName('ARR_TIME')[0].childNodes.item(0));sFlight_DepAirport=GetNode(oSegment[xy].getElementsByTagName('ORIGIN')[0].childNodes.item(0));sFlight_ArrAirport=GetNode(oSegment[xy].getElementsByTagName('DESTINATION')[0].childNodes.item(0));sFlight_Info=sFlight_DepAirport+' - '+sFlight_ArrAirport+' | '+sFlight_DepTime+' - '+sFlight_ArrTime+' | '+sFlight_Num;if(xy==0&&x==0){sFlight_ActualDepAirport=sFlight_DepAirport;}
if(!sHotel_DepDate){sHotel_DepDate=sFlight_DepDate;}
if(!sHotel_ArrDate&&x==1){sHotel_ArrDate=sFlight_DepDate;}
sFlight_DetailHTML+='<tr>';sFlight_DetailHTML+='<td class="fitContent">'+sFlight_DepDate+'</td>';sFlight_DetailHTML+='<td class="fitContent">'+sFlight_ArrDate+'</td>';sFlight_DetailHTML+='<td class="fitContent">'+sFlight_Info+'</td>';sFlight_DetailHTML+='</tr>';}}
sFlight_DetailHTML+='<tr><td colspan="3" class="fitBotContent">*TBAs confirmed when you click "Book this holiday"</td></tr>';if(sResultsSortBy==null||sResultsSortBy==''||sResultsSortBy=='price'){oHotel=ReOrderHotels(oHotel,parseFloat(iFlight_PricePerPerson)+dCarHire_PricePerPerson);}
var iXStart=getPageStart(iCurrentPageNum);for(x=iXStart;x<oHotel.length;x++){var bPackage=GetAttribute(oHotel[x].attributes.getNamedItem("Package"));var sAccommCSIPEID=GetNode(oHotel[x].getElementsByTagName('CSI_PEID')[0].childNodes.item(0));var sFlight_PkgDetailHtml=''
var sPkgCSIPEID=''
if(bPackage=='true')
{sFlight_PkgDetailHtml=FoundPackageHolidayFlightInfo(oHotel[x],AjaxResultsXMLDoc)}
if((bPackage=='true'&&GetFlightCount(oFlight,sAccommCSIPEID)>0)||bPackage!='true'){var iTotalPricePerPerson=GetNode(oHotel[x].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0));var iTotalPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalStdPrice')[0].childNodes.item(0)));var iOriginalTotalPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalStdPriceWas')[0].childNodes.item(0)));var iOriginalTotalPricePerPerson=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalStdPricePerPersonWas')[0].childNodes.item(0)));var iTotalCostPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalCostPrice')[0].childNodes.item(0)));var iTotalDepPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalDepPrice')[0].childNodes.item(0)));var iTotalDepPricePerPerson=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalDepPricePerPerson')[0].childNodes.item(0)));sDepositPrice='';if(iTotalDepPrice>0&&iTotalPrice>iTotalDepPrice)
{if(bPackage=='true'){sDepositPrice+='Book today with a deposit of £'+Math.round(parseFloat(iTotalDepPricePerPerson))+'pp';}else{sDepositPrice+='Book today with a deposit of £'+Math.round(parseFloat(iTotalDepPricePerPerson)+parseFloat(iFlight_PricePerPerson))+'pp';}}
bShowDiscount=false;if((iOriginalTotalPrice>0)&&(iOriginalTotalPrice>iTotalCostPrice)&&(iOriginalTotalPrice>iTotalPrice))
{bShowDiscount=true;}
if(bPackage=='false')
{iTotalPricePerPerson=(parseFloat(iTotalPricePerPerson)+parseFloat(iFlight_PricePerPerson));iOriginalTotalPricePerPerson=parseFloat(iOriginalTotalPricePerPerson)+parseFloat(iFlight_PricePerPerson);}
else
{iTotalPricePerPerson=parseFloat(iTotalPricePerPerson);iOriginalTotalPricePerPerson=parseFloat(iOriginalTotalPricePerPerson);}
var sBoardType=getCSIBoardCode(GetNode(oHotel[x].getElementsByTagName('BoardBasis')[0].childNodes.item(0)));var sStarRating=getCSIStarRating(GetNode(oHotel[x].getElementsByTagName('StarRating')[0].childNodes.item(0)));oCarHire=oHotel[x].getElementsByTagName('CarHire');sCarHire=GetNode(oCarHire[0].childNodes.item(0));dCarHirePrice=parseFloat(GetAttribute(oCarHire[0].attributes.getNamedItem("Price")));if(sCarHire.toLowerCase()=='true'&&dCarHirePrice>0&&bPackage=='false'){iTotalPricePerPerson=iTotalPricePerPerson+(parseFloat(dCarHirePrice));iOriginalTotalPricePerPerson=iOriginalTotalPricePerPerson+(parseFloat(dCarHirePrice));}
sOriginalPrice='';if(bShowDiscount)
{sOriginalPrice='<span class="linethroughpricestyle"> £'+Math.round(iOriginalTotalPricePerPerson)+' (per person) </span>';}
if(iTotalPricePerPerson>=iFilter_MinPricePerPerson&&iTotalPricePerPerson<=iFilter_MaxPricePerPerson&&sFilter_BoardTypes.indexOf('|'+sBoardType+'|')>=0&&sFilter_StarRating.indexOf('|'+sStarRating+'|')>=0){iResultCount++;if(!bDoNotRunPagingData){iTotalResultCount++;iResultPageCount++;if(iResultPageCount>=iMaximumNumberOfResults){iResultPageCount=0;sPagingData+='|'+parseFloat(x+1);}}
if(iResultCount<=iMaximumNumberOfResults){sPosition=GetAttribute(oHotel[x].attributes.getNamedItem("Position"));sAccommodationName=GetNode(oHotel[x].getElementsByTagName('AccommName')[0].childNodes.item(0));sAccommodationCode=GetNode(oHotel[x].getElementsByTagName('AccommCode')[0].childNodes.item(0));sResortName=GetNode(oHotel[x].getElementsByTagName('ResortName')[0].childNodes.item(0));sImageUrl=GetNode(oHotel[x].getElementsByTagName('Image')[0].childNodes.item(0));sProvider=GetAttribute(oHotel[x].attributes.getNamedItem("Provider"));sAccommID=GetNode(oHotel[x].getElementsByTagName('AccommCode')[0].childNodes.item(0));csi_peid=GetNode(oHotel[x].getElementsByTagName('CSI_PEID')[0].childNodes.item(0));sResortID=GetAttribute(oHotel[x].getElementsByTagName('ResortName')[0].attributes.getNamedItem("Id"));sOrigName=GetAttribute(oHotel[x].getElementsByTagName('AccommName')[0].attributes.getNamedItem("Orig"));sOrigSWCode=GetAttribute(oHotel[x].attributes.getNamedItem("Code"));var sIncludedHTML='';if(sResultStyle=='DR')
{sIncludedHTML='<span title="header=[Flight] body=[Flights are included in this holiday.]"><img src="/images/icons/flight_small.gif" style="vertical-align:middle; margin-right:10px;" alt="" /></span>';sIncludedHTML+='Return flights included<br/>';if(bPackage=='true'){sIncludedHTML+='<span title="header=[Transfer] body=['+sTransferIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='Transfer included';}else if(sCarHire.toLowerCase()=='true'){if(dCarHirePrice>0){sIncludedHTML='<span title="header=[Car hire] body=[<div>Car hire for the length of your holiday has been added to your booking (pick up from the airport). You\'ll find it is often cheaper than a transfer, but if you wish to swap, please click on \'Change Search criteria\' above and search again with \'Transfer\' selected.</div><div style=clear:both></div>]"><img src="/images/icons/car_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='Car hire included';}else{sIncludedHTML='<span title="header=[Car hire] body=[<div>We could not find any car hire for your search</div><div style=clear:both></div>]"><img src="/images/icons/car_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='<strong>NO</strong> car hire found';}}else if(sTransfer.toLowerCase()=='true'){if(iTransfer_PricePerPerson>0){sIncludedHTML+='<span title="header=[Transfer] body=['+sTransferIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='Transfer included';}else{sIncludedHTML+='<span title="header=[Transfer] body=['+sTransferNotIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='<strong>NO</strong> transfer found';}}}
else
{sIncludedHTML='<table border="0">';sIncludedHTML+='<tr>';sIncludedHTML+='<td width="16px" valign="top"><span title="header=[Flight] body=[Flights are included in this holiday.]"><img src="/images/icons/flight_small.gif" style="vertical-align:middle; margin-right:10px;" alt="" /></span></td>';sIncludedHTML+='<td>Return flights included <a href="#" onclick="#fulldetailsflights_js#">view</a></td>';sIncludedHTML+='</td>'
if(bPackage=='true'){sIncludedHTML+='<tr><td width="16px" valign="top"><span title="header=[Transfer] body=['+sTransferIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span></td>';sIncludedHTML+='<td>Transfer included</td></tr>';}else if(sCarHire.toLowerCase()=='true'){if(dCarHirePrice>0){sIncludedHTML+='<tr><td width="16px" valign="top"><span title="header=[Car hire] body=[<div>Car hire for the length of your holiday has been added to your booking (pick up from the airport). You\'ll find it is often cheaper than a transfer, but if you wish to swap, please click on \'Change Search criteria\' above and search again with \'Transfer\' selected.</div><div style=clear:both></div>]"><img src="/images/icons/car_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span></td>';sIncludedHTML+='<td>Car hire included</td></tr>';}else{sIncludedHTML+='<tr><td width="16px" valign="top"><span title="header=[Car hire] body=[<div>We could not find any car hire for your search</div><div style=clear:both></div>]"><img src="/images/icons/car_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='<td><strong>NO</strong> car hire found</td></tr>';}}else if(sTransfer.toLowerCase()=='true'){if(iTransfer_PricePerPerson>0){sIncludedHTML+='<tr><td width="16px" valign="top"><span title="header=[Transfer] body=['+sTransferIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span></td>';sIncludedHTML+='<td>Transfer included</td></tr>';}else{sIncludedHTML+='<tr><td width="16px" valign="top"><span title="header=[Transfer] body=['+sTransferNotIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sIncludedHTML+='<td><strong>NO</strong> transfer included</td></tr>';}}
sIncludedHTML+='</table>';}
var sExtraText='';sProperBoardType=getBoardTypeFromCode(sBoardType);if(sProperBoardType.toLowerCase()!='other'){sExtraText+=sProperBoardType;}
var sStarHTML='';if(!isNaN(parseFloat(sStarRating))){sStarHTML=getStarRatingImages(parseFloat(sStarRating));}
switch(iResultCount){case 1:case 3:case 6:case 8:case 9:case 11:case 13:case 15:case 18:case 20:sClass='bg1';break;default:sClass='bg2';}
sTempHTML=sHTMLTemplate;sTempHTML=sTempHTML.replace(/#hotelname#/g,sAccommodationName);sTempHTML=sTempHTML.replace(/#image#/g,sImageUrl);sTempHTML=sTempHTML.replace(/#extratext#/g,sExtraText);sTempHTML=sTempHTML.replace(/#starrating#/g,sStarHTML);sTempHTML=sTempHTML.replace(/#resortinfo#/g,sResortName);sTempHTML=sTempHTML.replace(/#price#/g,'£'+Math.round(iTotalPricePerPerson));sTempHTML=sTempHTML.replace(/#depositprice#/g,sDepositPrice);sTempHTML=sTempHTML.replace(/#bgclass#/g,sClass);sTempHTML=sTempHTML.replace(/#position#/g,sPosition);sTempHTML=sTempHTML.replace(/#flying_from#/g,sFlight_ActualDepAirport);sTempHTML=sTempHTML.replace(/#supplier#/g,sProvider);sTempHTML=sTempHTML.replace(/#includedinfo#/g,sIncludedHTML);if(bPackage=='false'){sTempHTML=sTempHTML.replace(/#FABSession#/g,sFABSession);sTempHTML=sTempHTML.replace(/#accommid#/g,sAccommID);}else{if(sProvider.toLowerCase()=='skiworld'){sTempHTML=sTempHTML.replace(/#accommcode#/g,sOrigSWCode);sTempHTML=sTempHTML.replace(/#accommid#/g,'');}else{sTempHTML=sTempHTML.replace(/#accommid#/g,sResortID+'.'+sOrigName);sTempHTML=sTempHTML.replace(/#accommcode#/g,'');}
sTempHTML=sTempHTML.replace(/#FABSession#/g,sPkgFABSession);}
if(sShortlistPositions.replace(/ /g,'').indexOf('|'+sPosition+'-')>-1){bAddedToShortlist=true;sTempHTML=sTempHTML.replace(/#addedtoshortlist_display#/g,'');sTempHTML=sTempHTML.replace(/#addtoshortlist_display#/g,'none');}else{bAddedToShortlist=false;sTempHTML=sTempHTML.replace(/#addedtoshortlist_display#/g,'none');sTempHTML=sTempHTML.replace(/#addtoshortlist_display#/g,'');}
sAddtoShortlistJs='AddToShortlist(\'&provider='+sProvider+'&accommcode='+sAccommodationCode+'&fare_id='+sFlight_FareID+'&fare_provider='+sFlight_Provider+'&fare_csiid='+sFlight_CSIFareID+'\',\''+sPosition+'\');';sTempHTML=sTempHTML.replace(/#addtoshortlist_js#/g,sAddtoShortlistJs);sTempHTML=sTempHTML.replace(/#radiobuttons#/g,'<input type="radio" name="tblOutbound_'+sPosition+'" value="1" checked/><input type="radio" name="tblInbound_'+sPosition+'" value="2" checked/>');if(bPackage=='true'){sBookButtonJS='setLevel(\'PRICING\');setPackageHoliday(\''+sProvider+'\',\''+sAccommodationCode+'\');setViewState(\''+sViewState+'\');setSessionID(\''+sBYOSessionID+'\');setSearchType(\'PackageHoliday\');frmBYOSubmit();'
sTempHTML=sTempHTML.replace(/#fulldetailsflights_js#/g,'setFullDetailsURL(\''+sProvider+'\',\'PackageHoliday\',\'byosession='+sBYOSessionID+'&accommcode='+sAccommodationCode+'&fare_id='+sFlight_FareID+'&fare_provider='+sFlight_Provider+'&fare_csiid='+sFlight_CSIFareID+'&csi_peid='+encodeURIComponent(sAccommCSIPEID)+'\&resortid='+sResortID+'&originalaccommname='+sOrigName+'&multicomfab='+sPkgFABSession+'&acode='+sOrigSWCode+'\',\''+escape(sBookButtonJS)+'\',\''+escape(sAddtoShortlistJs)+'\',\'\',\'\',\'\',\''+sPosition+'\',true)');sTempHTML=sTempHTML.replace(/#fulldetails_js#/g,'setFullDetailsURL(\''+sProvider+'\',\'PackageHoliday\',\'byosession='+sBYOSessionID+'&accommcode='+sAccommodationCode+'&fare_id='+sFlight_FareID+'&fare_provider='+sFlight_Provider+'&fare_csiid='+sFlight_CSIFareID+'&csi_peid='+encodeURIComponent(sAccommCSIPEID)+'\&resortid='+sResortID+'&originalaccommname='+sOrigName+'&multicomfab='+sPkgFABSession+'&acode='+sOrigSWCode+'\',\''+escape(sBookButtonJS)+'\',\''+escape(sAddtoShortlistJs)+'\',\'\',\'\',\'\',\''+sPosition+'\')');}else{sBookButtonJS='setLevel(\'PRICING\');setFlight(\''+sFlight_FareID+'\',\''+sFlight_CSIFareID+'\',\''+sFlight_Provider+'\',\''+sPosition+'\');setAccomm(\''+sAccommodationCode+'\',\''+sProvider+'\',\'\',\''+sBYOParentID+'\',\''+sBYOSessionID+'\',\'Flight_Hotel\',\'\',\''+sBoardType+'\');setViewState(\''+sViewState+'\');setSessionID(\''+sBYOSessionID+'\');setSearchType(\''+sCurrentSearch+'\');frmBYOSubmitBS();'
sBookButtonJS3=sBookButtonJS.replace('setFlight(\''+sFlight_FareID+'\',\''+sFlight_CSIFareID+'\',\''+sFlight_Provider+'\',\''+sPosition+'\');','')
sTempHTML=sTempHTML.replace(/#fulldetailsflights_js#/g,'setFlight(\''+sFlight_FareID+'\',\''+sFlight_CSIFareID+'\',\''+sFlight_Provider+'\',\''+sPosition+'\');setFullDetailsURL(\''+sProvider+'\',\'Flight_Hotel\',\'byosession='+sBYOSessionID+'&accommcode='+sAccommodationCode+'&fare_id='+sFlight_FareID+'&fare_provider='+sFlight_Provider+'&fare_csiid='+sFlight_CSIFareID+'&csi_peid='+encodeURIComponent(sAccommCSIPEID)+'\',\''+escape(sBookButtonJS3)+'\',\''+escape(sAddtoShortlistJs)+'\',\'\',\'\',\'\',\''+sPosition+'\',true)');sTempHTML=sTempHTML.replace(/#fulldetails_js#/g,'setFlight(\''+sFlight_FareID+'\',\''+sFlight_CSIFareID+'\',\''+sFlight_Provider+'\',\''+sPosition+'\');setFullDetailsURL(\''+sProvider+'\',\'Flight_Hotel\',\'byosession='+sBYOSessionID+'&accommcode='+sAccommodationCode+'&fare_id='+sFlight_FareID+'&fare_provider='+sFlight_Provider+'&fare_csiid='+sFlight_CSIFareID+'&csi_peid='+encodeURIComponent(sAccommCSIPEID)+'\',\''+escape(sBookButtonJS3)+'\',\''+escape(sAddtoShortlistJs)+'\',\'\',\'\',\'\',\''+sPosition+'\')');}
sTempHTML=sTempHTML.replace(/#book_js#/g,sBookButtonJS);sTempHTML=sTempHTML.replace(/#extratext#/g,sExtraText);if(sResultStyle=='DR'){sShortDescription=GetNode(oHotel[x].getElementsByTagName('ShortDesc')[0].childNodes.item(0));sShortDescription=stripHTMLJS(sShortDescription);if(sShortDescription.length>300)
sShortDescription=sShortDescription.substring(0,300);sDepartureDate=GetNode(oHotel[x].getElementsByTagName('DepartureDate')[0].childNodes.item(0));sReturnDate=GetNode(oHotel[x].getElementsByTagName('ReturnDate')[0].childNodes.item(0));sTempHTML=sTempHTML.replace(/#description#/g,sShortDescription);sTempHTML=sTempHTML.replace(/#date_from#/g,sHotel_DepDate);sTempHTML=sTempHTML.replace(/#date_to#/g,sHotel_ArrDate);if(bPackage=='true')
{sTempHTML=sTempHTML.replace(/#flight_details#/g,sFlight_PkgDetailHtml);}
else
{sTempHTML=sTempHTML.replace(/#flight_details#/g,sFlight_DetailHTML);}}
sHTML+=sTempHTML;}}}}
if(iResultCount==0){showNoResults(queryString('search_type'));}else{oResultDiv=document.getElementById('ResultContent1');if(oResultDiv){sPagingHTML=setResultPaging();sPagingBottomHTML=setResultPaging('bot');oResultDiv.innerHTML=sPagingHTML+sHTML+sPagingBottomHTML;sQuery=GetNode(AjaxResultsXMLDoc.getElementsByTagName('QUERY')[0].childNodes.item(0));sQuery=sQuery.replace('?&','?');sQuery=sQuery.replace(/&xmlout=true/gi,'');if(sQuery){document.getElementById('frmResults').action='/buildyourown/Results/Results_xsl.aspx'+sQuery;}}
if(!bNotFirstTime){flexiFlights()};}}
function sortNumber(a,b)
{return a-b;}
function ReOrderHotels(oH,dD){var pArray=new Array();var oH2=new Array();for(x=0;x<oH.length;x++){sAccommCSIPEID=GetNode(oH[x].getElementsByTagName('CSI_PEID')[0].childNodes.item(0));if(sAccommCSIPEID.length==0){pArray[x]=(parseFloat(GetNode(oH[x].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0)))+parseFloat(dD)).toFixed(2)+padLeft(x.toString(),5,'0').toString();}else{pArray[x]=parseFloat(GetNode(oH[x].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0))).toFixed(2)+padLeft(x.toString(),5,'0').toString();}
sAccommCSIPEID=null;}
pArray.sort(sortNumber);for(x=0;x<pArray.length;x++){oH2[x]=null;var x2=parseFloat(pArray[x].toString().substring(pArray[x].toString().length-5,pArray[x].toString().length));oH2[x]=oH[x2];}
pArray=null;return oH2;}
function selectFlight(id,difference){iFlight_JSID=id;iMinimumPricePerPerson=iMinimumPricePerPerson+difference;iMaximumPricePerPerson=iMaximumPricePerPerson+difference;setTimeout('setFilter(true)',200);}
function DayPostText(iDay){iDay=iDay;if(iDay==1||iDay==21||iDay==31){return iDay+'st';}else if(iDay==2||iDay==22){return iDay+'nd';}else if(iDay==3||iDay==23){return iDay+'rd';}else{return iDay+'th';}}
function padLeft(sValue,iLength,sChar){var sPadTmp=sValue;var iLoop=iLength-sValue.length;if(iLoop>0){for(Pad=0;Pad<iLoop;Pad++){sPadTmp=sChar+sPadTmp;}}
return sPadTmp;}
function flexiFlights(bNoResults){var sDivText='';if(bNoResults){sDivText='-nr';}
if(!sHTMLTemplate){sHTMLTemplate=readFileInAsync('/includes/ajaxresults/templates/flighthotel_qc.html');}
if(document.getElementById('divFlightSelector')||document.getElementById('divFlightSelector_nr')){try{var oFlight=AjaxResultsXMLDoc.getElementsByTagName('FARE');}catch(ex){LoadResults()
var oFlight=AjaxResultsXMLDoc.getElementsByTagName('FARE');}
var dbTodayPrice=0;var sTempQS=queryString('startdate').replace(/ /gi,'+');var dActualStartDate=new Date(sTempQS.split('+')[2],getMonthNumber(sTempQS.split('+')[1]),sTempQS.split('+')[0]);var sDates=new String('|');if(oFlight.length>0){for(x=0;x<oFlight.length;x++){oRoute=oFlight[x].getElementsByTagName('ROUTE');oSegment=oRoute[0].getElementsByTagName('SEGMENT');sFlight_Num=GetNode(oSegment[0].getElementsByTagName('FLIGHT_NUM')[0].childNodes.item(0));sFlight_DepDate=GetNode(oSegment[0].getElementsByTagName('DEP_DATE')[0].childNodes.item(0));sFlight_ArrDate=GetNode(oSegment[0].getElementsByTagName('ARR_DATE')[0].childNodes.item(0));sFlight_DepTime=GetNode(oSegment[0].getElementsByTagName('DEP_TIME')[0].childNodes.item(0));sFlight_ArrTime=GetNode(oSegment[0].getElementsByTagName('ARR_TIME')[0].childNodes.item(0));sFlight_DepAirport=GetNode(oSegment[0].getElementsByTagName('ORIGIN')[0].childNodes.item(0));sFlight_ArrAirport=GetNode(oSegment[0].getElementsByTagName('DESTINATION')[0].childNodes.item(0));iFlightOptionPricePerPerson=GetNode(oFlight[x].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0));var dFlight_DepDate=new Date(sFlight_DepDate);var iMonth=new Number(dFlight_DepDate.getMonth())+1;var sFlight_DepDate_Temp=new String(sFlight_DepDate.split(' ')[2]+' '+iMonth+' '+sFlight_DepDate.split(' ')[0]);if(sDates.indexOf('|'+sFlight_DepDate_Temp+'_')==-1){sDates+=sFlight_DepDate_Temp+'_'+iFlightOptionPricePerPerson+'|';if(dActualStartDate.toString()==dFlight_DepDate.toString()){dbTodayPrice=iFlightOptionPricePerPerson;}}}}
var sLink=new String(window.location.search);var arQS=sLink.replace('\');','').split('?')[1].split('&');var sQS=new String();var sInclude=new String('|airportfrom|country|city|locationto|duration|r1a|r1c|r1i|flexibility|carhire|transfer|')
for(x=0;x<arQS.length;x++){if(sInclude.indexOf('|'+arQS[x].split('=')[0]+'|')>-1){sQS+='&'+arQS[x];}
if(arQS[x].split('=')[0]=='duration'){iDuration=arQS[x].split('=')[1];}}
sQS='search_type=Flight_Hotel&startdate=##startdate##&enddate=##enddate##'+sQS;var sFlexiFlightHTML=new String();sFlexiFlightHTML='';if(bNoResults){sTempHTML=sHTMLTemplate;var sImageUrl='/images/our holidays/stan_wi_197.jpg';sTempHTML=sTempHTML.replace(/#hotelname#/g,'Last Saturday');sTempHTML=sTempHTML.replace(/#image#/g,sImageUrl);sTempHTML=sTempHTML.replace(/#extratext#/g,'<div id="divDateOff_'+99+'" startdate="01/01/2001" enddate="01/01/2001" style="height:40px;"><strong>Live availability</strong></div>');sTempHTML=sTempHTML.replace(/#starrating#/g,'');sTempHTML=sTempHTML.replace(/#resortinfo#/g,'');sTempHTML=sTempHTML.replace(/#price#/g,'');sTempHTML=sTempHTML.replace(/<a href="#" onclick="#fulldetails_js#">/g,'<a href="javascript:void(0);" onclick="">');sTempHTML=sTempHTML.replace(/#position#/g,1);sTempHTML=sTempHTML.replace(/#supplier#/g,'');sTempHTML=sTempHTML.replace(/#accommid#/g,'');sTempHTML=sTempHTML.replace(/#accommcode#/g,'');sTempHTML=sTempHTML.replace('(per person)','');sTempHTML=sTempHTML.replace(/class="extratext"/g,'style="height:auto;" class="extratext"');sTempHTML=sTempHTML.replace(/class="starrating"/g,'style="height:auto;" class="starrating"');sTempHTML=sTempHTML.replace(/class="resortinfo"/g,'style="height:auto;" class="resortinfo"');sTempHTML=sTempHTML.replace(/<div class="#bgclass# FH">/g,'<div class="bg2" style="height:auto; width:150px !important;" id="divMainBox_99">');sTempHTML=sTempHTML.replace(/class="includedinfo"/g,'style="display:none;" class="starrating"');sTempHTML=sTempHTML.replace(/buttons/g,'buttons" style="display:none;');sTempHTML=sTempHTML.replace(/<div class="image">/g,'<div class="image" style="padding-left:0px;">');sTempHTML=sTempHTML.replace(/<div class="button_book" onclick="#book_js#">/g,'<div class="button_book" id="butBook_99" onclick="" style="background:url(/images/buttons/search_this_date.gif) no-repeat !important; margin-top:10px; width:130px;">');sTempHTML=sTempHTML.replace(/<div class="price">/g,'<div class="price" style="margin:0px;">');}
var arDates=sDates.split('|');var dbCheapestPrice=0;sLink="BSRefineSearch(1,'/results.asp?"+sQS+"');";arDates.sort();var iDateCount=0;for(xFF=0;xFF<arDates.length;xFF++){if(arDates[xFF]!=undefined&&arDates[xFF]!=''){var sStartDate_Main=new Date(arDates[xFF].split('_')[0]);var bToday=false;var sStartDate_Temp=arDates[xFF].split('_')[0];var sStartDate=new Date(sStartDate_Temp.split(" ")[0],parseInt(sStartDate_Temp.split(" ")[1])-1,sStartDate_Temp.split(" ")[2]);var sStartMonth='';var sBorder='';var sHoverText='';if(dActualStartDate.toString()==sStartDate.toString()){sBorder='border:solid 1px red;';sHoverText='This is the date you have searched on';bToday=true;}else{bToday=false;}
var sStartDay=new String(dDays[sStartDate.getDay()]);var sEndDate=new Date(sStartDate);sEndDate.setDate(sEndDate.getDate()+parseInt(iDuration));var iMonth=new Number(sStartDate.getMonth())+1;sStartDate=sStartDate.getDate()+' '+getProperMonth(iMonth)+' '+sStartDate.getFullYear();sStartMonth=getProperMonth(iMonth);var iMonth=new Number(dActualStartDate.getMonth())+1;sActualStartDate=dActualStartDate.getDate()+' '+getProperMonth(iMonth)+' '+dActualStartDate.getFullYear();iMonth=new Number(sEndDate.getMonth())+1;sEndDate=sEndDate.getDate()+' '+getProperMonth(iMonth)+' '+sEndDate.getFullYear();var sDay=DayPostText(sStartDate.toString().split(' ')[0]);var sPrice=arDates[xFF].split('_')[1];var sBG=new String('#FFFFFF');var sTempLink=sLink.replace('&','&').replace('##startdate##',sStartDate).replace('##enddate##',sEndDate);if(parseFloat(sPrice)<parseFloat(dbCheapestPrice)||dbCheapestPrice==0){dbCheapestPrice=sPrice;}
var sColor='';iPriceDifference=parseFloat(sPrice)-parseFloat(dbTodayPrice);if(parseInt(iPriceDifference)>0){sColor='#379300';sText='- £'+parseInt(iPriceDifference);if(sHoverText.length==0)sHoverText='There are available holidays on '+sStartDay.substring(0,3)+' the '+sDay+'. The accommodation may not be the same price, but the flight is £'+parseInt(iPriceDifference)+' less than the cheapest flight on '+sActualStartDate;}else if(parseInt(iPriceDifference)<0){sColor='#8C0606';var sPriceDifference=new String(parseInt(iPriceDifference)).replace('-','');sText='+ £'+sPriceDifference;if(sHoverText.length==0)sHoverText='There are available holidays on '+sStartDay.substring(0,3)+' the '+sDay+'. The accommodation may not be the same price, but the flight is £'+sPriceDifference+' more than the cheapest flight on '+sActualStartDate;}else{sText='Same price';if(sHoverText.length==0)sHoverText='There are available holidays on '+sStartDay.substring(0,3)+' the '+sDay+'. The accommodation may not be the same price, but the flight is the same price as the cheapest flight on '+sActualStartDate;}
if(sDay!='NaNth'){if(bNoResults){sText=sText.replace('+','Increase of ');sText=sText.replace('-','Decrease of ');sTempHTML=sHTMLTemplate;var sImageUrl='/images/our holidays/stan_wi_197.jpg';if(bToday){sTempHTML=sTempHTML.replace(/<div class="ResultTemplate_QCHolder">/g,'<div class="ResultTemplate_QCHolder" style="display:none; ">');}
sTempHTML=sTempHTML.replace(/#hotelname#/g,sStartDay+'<br />'+sDay+' '+sStartMonth);sTempHTML=sTempHTML.replace(/#image#/g,sImageUrl);sTempHTML=sTempHTML.replace(/#extratext#/g,'<div id="divDate'+sDivText+'_'+iDateCount+'" startdate="'+sStartDate+'" enddate="'+sEndDate+'" style="height:40px;"><strong>Live availability</strong></div>');sTempHTML=sTempHTML.replace(/#starrating#/g,'');sTempHTML=sTempHTML.replace(/#resortinfo#/g,'');sTempHTML=sTempHTML.replace(/#price#/g,'');sTempHTML=sTempHTML.replace(/<a href="#" onclick="#fulldetails_js#">/g,'<a href="javascript:void(0);" onclick="'+sTempLink+'">');sTempHTML=sTempHTML.replace(/#position#/g,1);sTempHTML=sTempHTML.replace(/#supplier#/g,'');sTempHTML=sTempHTML.replace(/#accommid#/g,'');sTempHTML=sTempHTML.replace(/#accommcode#/g,'');sTempHTML=sTempHTML.replace('(per person)','');sTempHTML=sTempHTML.replace(/class="extratext"/g,'style="height:auto;" class="extratext"');sTempHTML=sTempHTML.replace(/class="starrating"/g,'style="height:auto;" class="starrating"');sTempHTML=sTempHTML.replace(/class="resortinfo"/g,'style="height:auto;" class="resortinfo"');sTempHTML=sTempHTML.replace(/<div class="#bgclass# FH">/g,'<div class="bg2" style="height:auto; width:150px !important;" id="divMainBox_'+iDateCount+'">');sTempHTML=sTempHTML.replace(/class="includedinfo"/g,'style="display:none;" class="starrating"');sTempHTML=sTempHTML.replace(/buttons/g,'buttons" style="display:none;');sTempHTML=sTempHTML.replace(/<div class="image">/g,'<div class="image" style="padding-left:0px;">');sTempHTML=sTempHTML.replace(/<div class="button_book" onclick="#book_js#">/g,'<div class="button_book" id="butBook_'+iDateCount+'" onclick="'+sTempLink+'" style="background:url(/images/buttons/search_this_date.gif) no-repeat !important; margin-top:10px; width:130px;">');sTempHTML=sTempHTML.replace(/<div class="price">/g,'<div class="price" style="margin:0px;">');sFlexiFlightHTML+=sTempHTML.replace(/#/g,'');iDateCount+=1;}else if(!bToday){sFlexiFlightHTML+='<div style="padding:3px; padding-left:0px; float:left;" class="FF_Small" id="divContainer_'+iDateCount+'"><div class="FF_Box" onclick="'+sTempLink+'" id="divDate'+sDivText+'_'+iDateCount+'" startdate="'+sStartDate+'" enddate="'+sEndDate+'"><strong>'+sStartDay.substring(0,3)+' '+sDay+'</strong></div></div>';iDateCount+=1;}}}}
if(bNoResults){sTempHTML=sHTMLTemplate;var sImageUrl='/images/our holidays/stan_wi_197.jpg';sTempHTML=sTempHTML.replace(/#hotelname#/g,'Next Saturday');sTempHTML=sTempHTML.replace(/#image#/g,sImageUrl);sTempHTML=sTempHTML.replace(/#extratext#/g,'<div id="divDateOff_'+99+'" startdate="01/01/2001" enddate="01/01/2001" style="height:40px;"><strong>Live availability</strong></div>');sTempHTML=sTempHTML.replace(/#starrating#/g,'');sTempHTML=sTempHTML.replace(/#resortinfo#/g,'');sTempHTML=sTempHTML.replace(/#price#/g,'');sTempHTML=sTempHTML.replace(/<a href="#" onclick="#fulldetails_js#">/g,'<a href="javascript:void(0);" onclick="">');sTempHTML=sTempHTML.replace(/#position#/g,1);sTempHTML=sTempHTML.replace(/#supplier#/g,'');sTempHTML=sTempHTML.replace(/#accommid#/g,'');sTempHTML=sTempHTML.replace(/#accommcode#/g,'');sTempHTML=sTempHTML.replace('(per person)','');sTempHTML=sTempHTML.replace(/class="extratext"/g,'style="height:auto;" class="extratext"');sTempHTML=sTempHTML.replace(/class="starrating"/g,'style="height:auto;" class="starrating"');sTempHTML=sTempHTML.replace(/class="resortinfo"/g,'style="height:auto;" class="resortinfo"');sTempHTML=sTempHTML.replace(/<div class="#bgclass# FH">/g,'<div class="bg2" style="height:auto; width:150px !important;" id="divMainBox_99">');sTempHTML=sTempHTML.replace(/class="includedinfo"/g,'style="display:none;" class="starrating"');sTempHTML=sTempHTML.replace(/buttons/g,'buttons" style="display:none;');sTempHTML=sTempHTML.replace(/<div class="image">/g,'<div class="image" style="padding-left:0px;">');sTempHTML=sTempHTML.replace(/<div class="button_book" onclick="#book_js#">/g,'<div class="button_book" id="butBook_99" onclick="" style="background:url(/images/buttons/search_this_date.gif) no-repeat !important; margin-top:10px; width:130px;">');sTempHTML=sTempHTML.replace(/<div class="price">/g,'<div class="price" style="margin:0px;">');}
if(iDateCount>=1){if(!document.getElementById('divFlightSelector_nr'))
{document.getElementById('divFlightSelector').innerHTML='<div class="TitleWBorder2">Flexible holiday options</div>'+sFlexiFlightHTML+'<div style="clear:both;"></div>';}
if(document.getElementById('divFlightSelector_nr')&&sFlexiFlightHTML.length>0){document.getElementById('divFlightSelector_nr').innerHTML='<strong>What about similar start days?</strong><br><br><div align="center"><div style="width:700px;">'+sFlexiFlightHTML+'</div></div><div style="clear:both;"></div>';}}}
setTimeout("FlexiAccomm()",300);}
function showFlightSelector(){var dSearchDate=new Date(getSearchCriteria('DEP_DATE_Y'),getSearchCriteria('DEP_DATE_M'),getSearchCriteria('DEP_DATE_D'));sFlightSelHTMLTemplate=readFileInAsync('/includes/ajaxresults/templates/flightselector.html');try{var oFlight=AjaxResultsXMLDoc.getElementsByTagName('FARE');}catch(ex){LoadResults()
var oFlight=AjaxResultsXMLDoc.getElementsByTagName('FARE');}
sFlightSelHTML='';if(oFlight.length>0){sFlightSelHTML+='<div class="fsBox">';sFlightSelHTML+='<div class="fsBoxContent1">';sFlightSelHTML+='<table border="0" cellpadding="0" cellspacing="4">';sFlightSelHTML+='<tr>';sFlightSelHTML+='<td width="115">Departs</td>';sFlightSelHTML+='<td width="115">Arrives</td>';sFlightSelHTML+='<td width="565">Flight details</td>';sFlightSelHTML+='</tr>';sFlightSelHTML+='</table>';sFlightSelHTML+='</div>';sFlightSelHTML+='</div>';for(x=0;x<oFlight.length;x++){sFlight_DetailHTML='';oRoute=oFlight[x].getElementsByTagName('ROUTE');oSegment=oRoute[0].getElementsByTagName('SEGMENT');dFlight_DepDate=new Date(GetNode(oSegment[0].getElementsByTagName('DEP_DATE')[0].childNodes.item(0)));dFlight_DepDate.setMonth(dFlight_DepDate.getMonth()+1);if(dFlight_DepDate.toString()==dSearchDate.toString()){for(xz=0;xz<oRoute.length;xz++){oSegment=oRoute[xz].getElementsByTagName('SEGMENT');for(xy=0;xy<oSegment.length;xy++){sFlight_Num=GetNode(oSegment[xy].getElementsByTagName('FLIGHT_NUM')[0].childNodes.item(0));sFlight_DepDate=GetNode(oSegment[xy].getElementsByTagName('DEP_DATE')[0].childNodes.item(0));sFlight_ArrDate=GetNode(oSegment[xy].getElementsByTagName('ARR_DATE')[0].childNodes.item(0));sFlight_DepTime=GetNode(oSegment[xy].getElementsByTagName('DEP_TIME')[0].childNodes.item(0));sFlight_ArrTime=GetNode(oSegment[xy].getElementsByTagName('ARR_TIME')[0].childNodes.item(0));sFlight_DepAirport=GetNode(oSegment[xy].getElementsByTagName('ORIGIN')[0].childNodes.item(0));sFlight_ArrAirport=GetNode(oSegment[xy].getElementsByTagName('DESTINATION')[0].childNodes.item(0));sFlight_Info=sFlight_DepAirport+' - '+sFlight_ArrAirport+' | '+sFlight_DepTime+' - '+sFlight_ArrTime+' | '+sFlight_Num;sFlight_DetailHTML+='<tr>';sFlight_DetailHTML+='<td width="115">'+sFlight_DepDate+'</td>';sFlight_DetailHTML+='<td width="115">'+sFlight_ArrDate+'</td>';sFlight_DetailHTML+='<td width="530">'+sFlight_Info+'</td>';sFlight_DetailHTML+='</tr>';}}
iFlightOptionPricePerPerson=GetNode(oFlight[x].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0));sTransferSearch=GetNode(oFlight[x].getElementsByTagName('TransferSearch')[0].childNodes.item(0));var sTransferIncludedHTML='';if(sTransferSearch.toLowerCase()=='true'){iTransferOptionPricerPerPerson=GetNode(oFlight[x].getElementsByTagName('TransferPricePerPerson')[0].childNodes.item(0));iFlightOptionPricePerPerson=parseFloat(iFlightOptionPricePerPerson)+parseFloat(iTransferOptionPricerPerPerson);if(parseFloat(iTransferOptionPricerPerPerson)>0){sTransferIncludedHTML='<span title="header=[Transfer] body=[Transfer is included if you select this flight.]"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sTransferIncludedHTML+='Transfer included';}else{sTransferIncludedHTML='<img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/>';sTransferIncludedHTML+='<strong>NO</strong> transfer found';}}
iPriceDifference=parseFloat(iFlightOptionPricePerPerson)-parseFloat(iFlight_PricePerPerson);if(iPriceDifference==0){sPriceText='Price same as selected';}else if(iPriceDifference>0){sPriceText='Price increase of £'+Math.round(iPriceDifference);}else{sPriceText='<span style="color:green;">Price decrease of £'+Math.round(iPriceDifference)+'</span>';sPriceText=sPriceText.replace(/-/g,'');}
if(x==iFlight_JSID){sBoxClass='fsBoxContent3';sButtonDisplay='none';sPriceText='Currently selected';}else{sBoxClass='fsBoxContent2';sButtonDisplay='';}
sButtonSelect='selectFlight(\''+x+'\','+Math.round(iPriceDifference)+')';sTempHTML=sFlightSelHTMLTemplate;sTempHTML=sTempHTML.replace(/#price#/g,sPriceText);sTempHTML=sTempHTML.replace(/#transfertext#/g,sTransferIncludedHTML);sTempHTML=sTempHTML.replace(/#boxclass#/g,sBoxClass);sTempHTML=sTempHTML.replace(/#buttontbody#/g,sButtonDisplay);sTempHTML=sTempHTML.replace(/#flight_details#/g,sFlight_DetailHTML);sTempHTML=sTempHTML.replace(/#button_select#/g,sButtonSelect);sFlightSelHTML+=sTempHTML;}}}
oResultDiv=document.getElementById('ResultContent');oFlightSelDiv=document.getElementById('OtherFullContent');if(oResultDiv&&oFlightSelDiv){bLoaderShowing=false;oFlightSelDiv.innerHTML='<div class="FlightSelector">'+sFlightSelHTML+'</div>';div_switch(oResultDiv.id,false,true);div_switch(oFlightSelDiv.id,true,true);}}
function RunResults_Hotel(bNotFirstTime,bDoNotRunPagingData,bJustAvailability){iHotelCount=0;if(!sHTMLTemplate){sHTMLTemplate=readFileInAsync('/includes/ajaxresults/templates/hotel_qc.html');}
sHTML='';var oHotel=AjaxResultsXMLDoc.getElementsByTagName('Hotel');var oSessionInfo=AjaxResultsXMLDoc.getElementsByTagName('SessionInfo');iResultCount=0;iPageCount=0;if(!bDoNotRunPagingData){iResultPageCount=0;sPagingData='0';iTotalResultCount=0;iCurrentPageNum=1;}
iHotelCount=oHotel.length;if(!bJustAvailability){for(x=getPageStart(iCurrentPageNum);x<oHotel.length;x++){var iTotalPricePerPerson=GetNode(oHotel[x].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0));var sBoardType=getCSIBoardCode(GetNode(oHotel[x].getElementsByTagName('BoardBasis')[0].childNodes.item(0)));var sStarRating=getCSIStarRating(GetNode(oHotel[x].getElementsByTagName('StarRating')[0].childNodes.item(0)));var iTotalPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalStdPrice')[0].childNodes.item(0)));var iOriginalTotalPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalStdPriceWas')[0].childNodes.item(0)));var iOriginalTotalPricePerPerson=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalStdPricePerPersonWas')[0].childNodes.item(0)));var iTotalCostPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalCostPrice')[0].childNodes.item(0)));sOriginalPrice='';if(iOriginalTotalPrice>0&&iOriginalTotalPrice>iTotalCostPrice&&iOriginalTotalPrice>iTotalPrice)
{sOriginalPrice='<span class="linethroughpricestyle"> £'+Math.round(iOriginalTotalPricePerPerson)+'(per person) </span>';}
var iTotalDepPrice=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalDepPrice')[0].childNodes.item(0)));var iTotalDepPricePerPerson=Math.round(GetNode(oHotel[x].getElementsByTagName('TotalDepPricePerPerson')[0].childNodes.item(0)));sDepositPrice='';if((iTotalDepPrice>0)&&(iTotalDepPrice<iTotalPrice))
{sDepositPrice='Book today with a deposit of £'+Math.round(iTotalDepPricePerPerson)+'pp';}
if(iTotalPricePerPerson>=iFilter_MinPricePerPerson&&iTotalPricePerPerson<=iFilter_MaxPricePerPerson&&sFilter_BoardTypes.indexOf('|'+sBoardType+'|')>=0&&sFilter_StarRating.indexOf('|'+sStarRating+'|')>=0){iResultCount++;if(!bDoNotRunPagingData){iTotalResultCount++;iResultPageCount++;if(iResultPageCount>=iMaximumNumberOfResults){iResultPageCount=0;sPagingData+='|'+parseFloat(x+1);}}
if(iResultCount<=iMaximumNumberOfResults){sPosition=GetAttribute(oHotel[x].attributes.getNamedItem("Position"));sAccommodationName=GetNode(oHotel[x].getElementsByTagName('AccommName')[0].childNodes.item(0));sAccommodationCode=GetNode(oHotel[x].getElementsByTagName('AccommCode')[0].childNodes.item(0));sResortName=GetNode(oHotel[x].getElementsByTagName('ResortName')[0].childNodes.item(0));sImageUrl=GetNode(oHotel[x].getElementsByTagName('Image')[0].childNodes.item(0));sProvider=GetAttribute(oHotel[x].attributes.getNamedItem("Provider"));sAccommID=GetNode(oHotel[x].getElementsByTagName('AccommCode')[0].childNodes.item(0));var sExtraText='';sProperBoardType=getBoardTypeFromCode(sBoardType);if(sProperBoardType.toLowerCase()!='other'){sExtraText+=sProperBoardType;}
var sStarHTML='';if(!isNaN(parseFloat(sStarRating))){sStarHTML=getStarRatingImages(parseFloat(sStarRating));}
switch(iResultCount){case 1:case 3:case 6:case 8:case 9:case 11:case 13:case 15:case 18:case 20:sClass='bg1';break;default:sClass='bg2';}
sTempHTML=sHTMLTemplate;sTempHTML=sTempHTML.replace(/#hotelname#/g,sAccommodationName);sTempHTML=sTempHTML.replace(/#image#/g,sImageUrl);sTempHTML=sTempHTML.replace(/#extratext#/g,sExtraText);sTempHTML=sTempHTML.replace(/#starrating#/g,sStarHTML);sTempHTML=sTempHTML.replace(/#resortinfo#/g,sResortName);sTempHTML=sTempHTML.replace(/#price#/g,'£'+Math.round(iTotalPricePerPerson));sTempHTML=sTempHTML.replace(/#depositprice#/g,sDepositPrice);sTempHTML=sTempHTML.replace(/#bgclass#/g,sClass);sTempHTML=sTempHTML.replace(/#position#/g,sPosition);sTempHTML=sTempHTML.replace(/#supplier#/g,sProvider);sTempHTML=sTempHTML.replace(/#accommid#/g,sAccommID);if(sShortlistPositions.replace(/ /g,'').indexOf('|'+sPosition+'-')>-1){bAddedToShortlist=true;sTempHTML=sTempHTML.replace(/#addedtoshortlist_display#/g,'');sTempHTML=sTempHTML.replace(/#addtoshortlist_display#/g,'none');}else{bAddedToShortlist=false;sTempHTML=sTempHTML.replace(/#addedtoshortlist_display#/g,'none');sTempHTML=sTempHTML.replace(/#addtoshortlist_display#/g,'');}
sAddtoShortlistJs='AddToShortlist(\'&provider='+sProvider+'&accommcode='+sAccommodationCode+'\',\''+sPosition+'\');';sTempHTML=sTempHTML.replace('#addtoshortlist_js#',sAddtoShortlistJs);sBookButtonJS='setLevel(\'PRICING\');setAccomm(\''+sAccommodationCode+'\',\''+sProvider+'\',\'\',\''+sBYOParentID+'\',\''+sBYOSessionID+'\',\'Hotel\',\'\',\''+sBoardType+'\');setViewState(\''+sViewState+'\');setSessionID(\''+sBYOSessionID+'\');setSearchType(\''+sCurrentSearch+'\');frmBYOSubmitBS();'
sTempHTML=sTempHTML.replace(/#book_js#/g,sBookButtonJS);sTempHTML=sTempHTML.replace(/#fulldetails_js#/g,'setFullDetailsURL(\''+sProvider+'\',\'Hotel\',\'byosession='+sBYOSessionID+'&accommcode='+sAccommodationCode+'\',\''+escape(sBookButtonJS)+'\',\''+escape(sAddtoShortlistJs)+'\',\'\',\'\',\'\',\''+sPosition+'\')');if(sResultStyle=='DR'){sShortDescription=GetNode(oHotel[x].getElementsByTagName('ShortDesc')[0].childNodes.item(0));sShortDescription=stripHTMLJS(sShortDescription);if(sShortDescription.length>300)
sShortDescription=sShortDescription.substring(0,300);sDepartureDate=GetNode(oHotel[x].getElementsByTagName('DepartureDate')[0].childNodes.item(0));sReturnDate=GetNode(oHotel[x].getElementsByTagName('ReturnDate')[0].childNodes.item(0));sTempHTML=sTempHTML.replace(/#description#/g,sShortDescription);sTempHTML=sTempHTML.replace(/#date_from#/g,sDepartureDate);sTempHTML=sTempHTML.replace(/#date_to#/g,sReturnDate);}
sHTML+=sTempHTML;}}}
if(!bJustAvailability){oResultDiv=document.getElementById('ResultContent1');if(oResultDiv){sPagingHTML=setResultPaging();sPagingBottomHTML=setResultPaging('bot');oResultDiv.innerHTML=sPagingHTML+sHTML+sPagingBottomHTML;}}}}
function showHideFlightOptionsFromAvail(id,position,csi_peid,cost,bookbuttonjs){o1=document.getElementById('flightOptions_'+id);o2=document.getElementById('flightOptionsText_'+id);o5=document.getElementById('flightOptionsTextHolder_'+id);o8=document.getElementById('flightOptionsTBATextHolder_'+id);o6=document.getElementById('packageflights'+position);if(!o6){o6=document.getElementById('MI_FlightInfoItinerary');sPackageFlightsExtra='&fulldetails=true';}else{sPackageFlightsExtra='';}
if(csi_peid!=null){sPackageFlightsExtra+='&csi_peid='+encodeURIComponent(csi_peid)}
if(cost!=null){sPackageFlightsExtra+='&cost='+cost;}
o7=document.getElementById('packageflights'+position+'Loader');if(o1&&o2){o3=document.getElementsByName('flightSelector_'+id);o3[0].checked=true;o4=document.getElementById('flightSelectorHolder_'+id+'_0');if(o1.style.display==''){o1.style.display='none';o2.innerHTML=o2.innerHTML.replace('Hide','Show');o4.style.display='none';}else{o1.style.display='';o2.innerHTML=o2.innerHTML.replace('Show','Hide');o5.style.display='none';if(o7){o7.style.display='';}
sURL='/includes/ajaxresults/packageflights.asp?session='+sBYOSessionID+'&position='+position+sPackageFlightsExtra+"&bookjs="+encodeURI(bookbuttonjs.replace(/~/g,"'"));o6.innerHTML=readFileInAsync(sURL);o4.style.display='';if(o8){o8.style.display='none';}}}}
function showHideFlightOptions(id){o1=document.getElementById('flightOptions_'+id);o2=document.getElementById('flightOptionsText_'+id);o5=document.getElementById('flightOptionsTextHolder_'+id);o8=document.getElementById('flightOptionsTBATextHolder_'+id);if(o1&&o2){o3=document.getElementsByName('flightSelector_'+id);o3[0].checked=true;o4=document.getElementById('flightSelectorHolder_'+id+'_0');if(o1.style.display==''){o1.style.display='none';o2.innerHTML=o2.innerHTML.replace('Hide','Show');o4.style.display='none';}else{o1.style.display='';o2.innerHTML=o2.innerHTML.replace('Show','Hide');o5.style.display='none';o4.style.display='';if(o8){o8.style.display='none';}}}}
function GetPackageItinaryID(id){o1=document.getElementsByName('flightSelector_'+id);for(zzz=0;zzz<o1.length;zzz++){if(o1[zzz].checked){return o1[zzz].value;}}}
function selectPackageFlightOption(id,priceval,datefrom,dateto){o1=document.getElementById('dr_price'+id);o2=document.getElementById('dr_datefrom'+id);o3=document.getElementById('dr_dateto'+id);if(o1&&o2&&o3){o1.innerHTML=priceval;o2.innerHTML=datefrom;o3.innerHTML=dateto;}}
var PriceFromShortlist='0';var bComingFromShortlist=false;var bAlreadyAddedToShortlist=false;var bAddedToShortlistFromFullDetails=false;function setFullDetailsURL(sProvider,sSearchType,sExtra,sBBJS,sATSLJS,bFromShortlist,dFromShortlistPrice,bOpenFOptions,iPosition,expandFlights){bAlreadyAddedToShortlist=false;bAddedToShortlistFromFullDetails=false;o=document.getElementById('addtoshortlist'+iPosition);if(o){if(o.style.display=='none'){bAlreadyAddedToShortlist=true;}}
bOpenFlightOptions=bOpenFOptions;if(!bOpenFOptions){bOpenFlightOptions=false;}
goToTop();if(bFromShortlist){PriceFromShortlist=dFromShortlistPrice;bComingFromShortlist=true;if(!sHTMLLoadTemplate){sHTMLLoadTemplate=readFileInAsync('/includes/ajaxresults/templates/loader.html');}}else{bComingFromShortlist=false;}
sBookButtonJS=unescape(sBBJS);sAddToShortlistButtonJS=unescape(sATSLJS);sFullDetailsURL='/includes/hotelinfov2.asp?position='+iPosition+'&provider='+sProvider+'&search_type='+sSearchType+'&fromshortlist='+bComingFromShortlist+'&numberofpeople='+iTotalNumPassengers+'&'+sExtra;if(expandFlights==true){sFullDetailsURL+='&expandflights=true';}
oTabAccommDetails=document.getElementById('result_tab3');if(oTabAccommDetails){oTabAccommDetails.className=oTabAccommDetails.className.replace('Na','');handleSection('accommdetails');}}
function viewFullDetails(){bLoaderShowing=false;if(!sHTMLMoreInfoTemplate){sHTMLMoreInfoTemplate=readFileInAsync('/includes/ajaxresults/templates/moreinfo.html');}
sURL=sFullDetailsURL.replace("'","");if(bDebug){if(confirm('Open '+sURL)){window.open(sURL);}}
setTimeout("loadFullDetailsXMLDoc('"+sURL+"')",100);}
function loadFullDetailsXMLDoc(url){if(window.XMLHttpRequest){reqFD=new XMLHttpRequest();reqFD.onreadystatechange=processFullDetails;reqFD.open("GET",url,true);reqFD.send(null);}else if(window.ActiveXObject){reqFD=new ActiveXObject("Microsoft.XMLHTTP");if(reqFD){reqFD.onreadystatechange=processFullDetails;reqFD.open("GET",url,true);reqFD.send();}}}
function processFullDetails(){if(bStillOnAccommTab){if(reqFD.readyState==4){if(reqFD.status==200){bShowReviews=false;bShowFlightInfo=false;bShowMap=false;bShowPictures=false;var bVV='';FullDetailsXMLDoc=reqFD.responseXML.documentElement;var oResultDetails=FullDetailsXMLDoc.getElementsByTagName('ResultDetails');var sDetailsSearchType=GetAttribute(oResultDetails.item(0).attributes.getNamedItem("searchtype"));dCurrentPrice=GetNode(oResultDetails[0].getElementsByTagName('TotalPricePerPerson')[0].childNodes.item(0));dDepositPricePerPerson=GetNode(oResultDetails[0].getElementsByTagName('TotalDepPricePerPerson')[0].childNodes.item(0));sDepositPrice=''
if((Math.round(dDepositPricePerPerson)>0)&&(Math.round(dCurrentPrice)>Math.round(dDepositPricePerPerson)))
{sDepositPrice='Book today with a deposit of £'+Math.round(dDepositPricePerPerson)+'pp';}
var oAccommodation=oResultDetails[0].getElementsByTagName('AccommDetails');sAccommProvider=GetNode(oAccommodation[0].getElementsByTagName('Provider')[0].childNodes.item(0));sAccommodationName=GetNode(oAccommodation[0].getElementsByTagName('Name')[0].childNodes.item(0));sResortName=GetNode(oAccommodation[0].getElementsByTagName('Resort')[0].childNodes.item(0));sStarRating=GetNode(oAccommodation[0].getElementsByTagName('Rating')[0].childNodes.item(0));sCSI_PEID=GetNode(oAccommodation[0].getElementsByTagName('CSI_PEID')[0].childNodes.item(0));sAccommCode=GetNode(oAccommodation[0].getElementsByTagName('AccommCode')[0].childNodes.item(0));sBoardBasis=GetNode(oAccommodation[0].getElementsByTagName('BoardBasis')[0].childNodes.item(0));oCarHireNode=oAccommodation[0].getElementsByTagName('CarHire');stringCarHirePrice=GetAttribute(oCarHireNode.item(0).attributes.getNamedItem("price"));iCarHirePrice=0;if(stringCarHirePrice.length>0){iCarHirePrice=parseFloat(GetAttribute(oCarHireNode.item(0).attributes.getNamedItem("price")));}
sCarHire=GetNode(oAccommodation[0].getElementsByTagName('CarHire')[0].childNodes.item(0));oTransferNode=oAccommodation[0].getElementsByTagName('Transfer');stringTransferPrice=GetAttribute(oTransferNode.item(0).attributes.getNamedItem("price"));iTransferPrice=0;if(stringTransferPrice.length>0)
{iTransferPrice=parseFloat(stringTransferPrice);}
sTransfer='';if(sDetailsSearchType=='PackageHoliday'||sDetailsSearchType=='Flight_Hotel')
{sTransfer=GetNode(oAccommodation[0].getElementsByTagName('Transfer')[0].childNodes.item(0));}
sPosition=FullDetailsXMLDoc.getElementsByTagName('Position')[0].childNodes.item(0).nodeValue;try{bVV=FullDetailsXMLDoc.getElementsByTagName('VirtualVisit')[0].childNodes.item(0).nodeValue;iVVWidth=GetAttribute(FullDetailsXMLDoc.getElementsByTagName('VirtualVisit')[0].attributes.getNamedItem("width"));iVVHeight=GetAttribute(FullDetailsXMLDoc.getElementsByTagName('VirtualVisit')[0].attributes.getNamedItem("height"));}catch(ex){}
sExtraText='';if(sDetailsSearchType=='Flight_Hotel'){sExtraText+='<span title="header=[Flight] body=[Flights are included in this holiday.]"><img src="/images/icons/flight_small.gif" style="vertical-align:middle; margin-right:10px;" alt="" /></span>';sExtraText+='Return flights included<br>';if(sTransfer.toLowerCase()=='true'&&iTransferPrice>0)
{sExtraText+='<span title="header=[Transfer] body=['+sTransferIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sExtraText+='Transfer included';}
else{sExtraText+='<span title="header=[Transfer] body=['+sTransferNotIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sExtraText+='<strong>NO</strong> transfer included';}}
else if(sDetailsSearchType=='PackageHoliday')
{sExtraText+='<span title="header=[Transfer] body=['+sTransferIncludedPopup+']"><img src="/images/icons/transfer_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sExtraText+='Transfer included';}
if(sCarHire.toLowerCase()=='true'&&iCarHirePrice>0){sExtraText+='<br/><span title="header=[Car hire] body=[<div>We have added car hire to your price. We searched all availability for car hire in this area for the dates you have selected, and have added the price of the cheapest available car to your package prices. You will be able to choose the car you require further along the booking process, meaning your total price may change depending on the car you select.</div><div style=clear:both></div>]"><img src="/images/icons/car_small.gif" style="vertical-align:middle; margin-right:10px;" alt=""/></span>';sExtraText+='Car hire included';}
sExtraText+="<br />"+sBoardBasis;sDepartureDate=GetNode(oResultDetails[0].getElementsByTagName('DepDate')[0].childNodes.item(0));sReturnDate=GetNode(oResultDetails[0].getElementsByTagName('RetDate')[0].childNodes.item(0));if(bComingFromShortlist){dTotalPricePerPerson=PriceFromShortlist;}else{var dTotalPrice=parseFloat(GetNode(oResultDetails[0].getElementsByTagName('TotalPrice')[0].childNodes.item(0)))+iCarHirePrice;var dTotalPricePerPerson=(parseFloat(GetNode(oResultDetails[0].getElementsByTagName('TotalPricePerPerson')[0].childNodes.item(0)))+(parseFloat(iCarHirePrice)/parseFloat(iTotalNumPassengers)));}
var dProdMinusFlightPP=dTotalPricePerPerson;oDescription=FullDetailsXMLDoc.getElementsByTagName('Description')[0].childNodes;if(oDescription.length>0){sDescription='';for(xy=0;xy<oDescription.length;xy++){sDescription+=oDescription.item(xy).nodeValue;}}else{sDescription='Description is not available for the selected accommodation.';}
var sPictureURL_Main='';var sPictureThumbHTML='';var PVAccommID=''
var oImages=FullDetailsXMLDoc.getElementsByTagName('Images');var oImage=oImages[0].getElementsByTagName('Image');if(oImage.length>0){PVAccommID=GetAttribute(oImage[0].attributes.getNamedItem("id"));bShowPictures=true;for(xy=0;xy<oImage.length;xy++){sPictureURL=GetNode(oImage[xy].childNodes.item(0));if(xy==0){sPictureURL_Main=sPictureURL;}
sPictureThumbHTML+='<div class="picthumb"><img src="'+sPictureURL.replace('sw_images','sw_images/thumbs')+'" id="Pic'+xy+'" alt="" onclick="SwitchPhoto(\'MI_ImageHolder\',\''+sPictureURL+'\');" onerror="this.src=\'/images/general/_noimage.gif\'" /></div>';}}
if(FullDetailsXMLDoc.getElementsByTagName('GoogleLat')[0].childNodes.item(0)){sGoogleLat=FullDetailsXMLDoc.getElementsByTagName('GoogleLat')[0].childNodes.item(0).nodeValue;sGoogleLng=FullDetailsXMLDoc.getElementsByTagName('GoogleLng')[0].childNodes.item(0).nodeValue;sGoogleMaxZoom=FullDetailsXMLDoc.getElementsByTagName('GoogleMaxZoom')[0].childNodes.item(0).nodeValue;if(FullDetailsXMLDoc.getElementsByTagName('GoogleZoom')[0].childNodes.item(0)){sGoogleZoom=FullDetailsXMLDoc.getElementsByTagName('GoogleZoom')[0].childNodes.item(0).nodeValue;}
if(sGoogleLat.length>1&&sGoogleLng.length>1){bShowMap=true;}}
var sStarHTML='';if(!isNaN(parseFloat(sStarRating))){sStarHTML=getStarRatingImages(parseFloat(sStarRating));}
sTempHTML=sHTMLMoreInfoTemplate;sTempHTML=sTempHTML.replace(/#hotelname#/g,sAccommodationName);sTempHTML=sTempHTML.replace(/#price#/g,'£'+Math.round(dTotalPricePerPerson));sTempHTML=sTempHTML.replace(/#depositprice#/g,sDepositPrice);sTempHTML=sTempHTML.replace(/#starrating#/g,sStarHTML);sTempHTML=sTempHTML.replace(/#resortinfo#/g,sResortName);sTempHTML=sTempHTML.replace(/#description#/g,sDescription);sTempHTML=sTempHTML.replace(/#picture_main#/g,sPictureURL_Main);sTempHTML=sTempHTML.replace(/#picture_thumbs#/g,sPictureThumbHTML);sTempHTML=sTempHTML.replace(/#supplier#/g,sAccommProvider);sTempHTML=sTempHTML.replace(/#position#/g,sPosition);sTempHTML=sTempHTML.replace(/#radiobuttons#/g,'<input type="radio" name="tblOutbound_'+sPosition+'" value="1" checked/><input type="radio" name="tblInbound_'+sPosition+'" value="2" checked/>');if(bVV=='True'){sVirtualVisitURL='/includes/VirtualVisit.aspx?id='+PVAccommID
if(iVVHeight>0){iVVHeight_Temp=iVVHeight;iVVWidth_Temp=iVVWidth;}else{iVVHeight_Temp=285;iVVWidth_Temp=505;}
sVirtualVisit='<div id="divVV"><div style="cursor:pointer; width:180px; font-weight:bold;" onclick="LightBox(\'\', \'\',0,0, \'LightBox\', \''+sVirtualVisitURL+'\', '+iVVWidth_Temp+', '+iVVHeight_Temp+');"><img src="/images/general/eye.jpg" border="0" width="20" align="absmiddle" /> Take a virtual visit</div></div>';}else{sVirtualVisit='';}
sTempHTML=sTempHTML.replace(/#virtual_visit#/g,sVirtualVisit);try{sTempHTML=sTempHTML.replace(/#date_from#/g,sDepartureDate);sTempHTML=sTempHTML.replace(/#date_to#/g,sReturnDate);}catch(ex){sTempHTML=sTempHTML.replace(/#date_from#/g,sDepartureDate);sTempHTML=sTempHTML.replace(/#date_to#/g,sReturnDate);}
bLiveAvailable=true;if(sBookButtonJS.indexOf('Enquire')>-1){bLiveAvailable=false;}
var sTempVar='\''+sAccommCode+'\'';if(sCSI_PEID!=''){sBookButtonJS=sBookButtonJS.replace(sTempVar,'GetPackageItinaryID(0)');}
sTempHTML=sTempHTML.replace(/#book_js#/g,sBookButtonJS);sTempHTML=sTempHTML.replace(/#addtoshortlist_js#/g,sAddToShortlistButtonJS);var oReviews=FullDetailsXMLDoc.getElementsByTagName('Reviews');sAverageUserRating=GetAttribute(oReviews.item(0).attributes.getNamedItem("reviewrateavg"));var oReview=oReviews[0].getElementsByTagName('Review');if(oReview.length>0){bShowReviews=true;sReviewsHTML='';for(x=0;x<oReview.length;x++){sRev_Title=oReview[x].getElementsByTagName('Title')[0].childNodes.item(0).nodeValue;sRev_DateTime=oReview[x].getElementsByTagName('DateTime')[0].childNodes.item(0).nodeValue;sRev_Rating=oReview[x].getElementsByTagName('Rating')[0].childNodes.item(0).nodeValue;sRev_Description=oReview[x].getElementsByTagName('Description')[0].childNodes.item(0).nodeValue;sRev_Link=oReview[x].getElementsByTagName('Link')[0].childNodes.item(0).nodeValue;sReviewsHTML+='<div class="review">';sReviewsHTML+='<div class="r_title"><a href="'+sRev_Link+'" target="_blank">'+sRev_Title+'</a></div>';sReviewsHTML+='<div class="r_date">'+sRev_DateTime+'</div>';sReviewsHTML+='<div class="r_rating">Trip advisor traveler rating: '+getReviewRating(sRev_Rating)+'</div>';sReviewsHTML+='<div class="r_description">“'+sRev_Description+'”</div>'
sReviewsHTML+='</div>';}
sTempHTML=sTempHTML.replace('#reviews#',sReviewsHTML);sTempHTML=sTempHTML.replace('#userrating#',getReviewRating(sAverageUserRating));}
var sFirstFoundDepAirport='';var oFlightInfo=FullDetailsXMLDoc.getElementsByTagName('FlightDetails');if(oFlightInfo.length>0){bShowFlightInfo=true;if(sDetailsSearchType=='PackageHoliday'||sDetailsSearchType=='Flight_Hotel'){var oFlight=oFlightInfo[0].getElementsByTagName('Flight');sFlightHTML='';for(xy=0;xy<1;xy++){var iFlightResultID=xy+'_0';var iNewTotalPricePerPerson=parseFloat(oFlight[xy].attributes.getNamedItem("PricePerPerson").nodeValue);if(iNewTotalPricePerPerson==''){iNewTotalPricePerPerson=parseFloat(oFlight[xy].attributes.getNamedItem("PricePerPerson").nodeValue);}
if(sCSI_PEID==''){iNewTotalPricePerPerson+=parseFloat(iCarHirePrice);iNewTotalPricePerPerson+=parseFloat(oFlight[xy].attributes.getNamedItem("PricePerPerson").nodeValue);}
sNewDepartureDate=GetNode(oFlight[xy].getElementsByTagName('DepartureDate')[0].childNodes.item(0)).replace(/\n/g,' ');sNewArrivalDate=GetNode(oFlight[xy].getElementsByTagName('ArrivalDate')[0].childNodes.item(0)).replace(/\n/g,' ');sNewReturnDepartureDate=GetNode(oFlight[xy].getElementsByTagName('ReturnDepartureDate')[0].childNodes.item(0)).replace(/\n/g,' ');sNewReturnArrivalDate=GetNode(oFlight[xy].getElementsByTagName('ReturnHomeDate')[0].childNodes.item(0)).replace(/\n/g,' ');if(xy==0){sDepartureDate=sNewDepartureDate;sArrivalDate=sNewArrivalDate;sReturnDepartureDate=sNewReturnDepartureDate;sReturnArrivalDate=sNewReturnArrivalDate;iTotalPricePerPerson=iNewTotalPricePerPerson;}
var iPriceDifferencePerPerson=parseFloat(iNewTotalPricePerPerson-iTotalPricePerPerson);if(iPriceDifferencePerPerson>0){sPriceDifferencePerPerson='<span style="padding-right:10px; color:red;">+£'+Math.round(iPriceDifferencePerPerson)+'</span>';}else if(iPriceDifferencePerPerson<0){sPriceDifferencePerPerson='<span style="padding-right:10px; color:green;">-£'+Math.round(replace(iPriceDifferencePerPerson,'-',''))+'</span>';}else{sPriceDifferencePerPerson='<span style="padding-right:10px; color:green;">+£0</span>';}
sDepartureAirport=GetNode(oFlight[xy].getElementsByTagName('DepartureAirport')[0].childNodes.item(0));if(xy==0){sFirstFoundDepAirport=sDepartureAirport}
sDestinationAirport=GetNode(oFlight[xy].getElementsByTagName('DestinationAirport')[0].childNodes.item(0));sDepartureTime=GetNode(oFlight[xy].getElementsByTagName('DepartureTime')[0].childNodes.item(0));sArrivalTime=GetNode(oFlight[xy].getElementsByTagName('ArrivalTime')[0].childNodes.item(0));sReturnDepartureTime=GetNode(oFlight[xy].getElementsByTagName('ReturnDepartureTime')[0].childNodes.item(0));sReturnArrivalTime=GetNode(oFlight[xy].getElementsByTagName('ReturnHomeTime')[0].childNodes.item(0));sOutboundFlightNumber=GetNode(oFlight[xy].getElementsByTagName('OutboundFligthNumber')[0].childNodes.item(0));sInboundFlightNumber=GetNode(oFlight[xy].getElementsByTagName('InboundFligthNumber')[0].childNodes.item(0));sOutboundInfo=sDepartureAirport+' - '+sDestinationAirport+' | '+sDepartureTime+' - '+sArrivalTime+' | '+sOutboundFlightNumber
sInboundInfo=sDestinationAirport+' - '+sDepartureAirport+' | '+sReturnDepartureTime+' - '+sReturnArrivalTime+' | '+sInboundFlightNumber
sRoomType=GetNode(oFlight[xy].getElementsByTagName('RoomType')[0].childNodes.item(0));sNewItineraryId=GetAttribute(oFlight[xy].attributes.getNamedItem("ItineraryId"));if(xy>0){sFlightHTML+='<tr><td colspan="3" height="10"> </td></tr>';if(xy==1){sFlightHTML+='<tbody id="flightOptions_0" style="display:none;">';}}
sFlightHTML+='<tr>';sFlightHTML+='<td class="fitTitle" width="15%">Departs</td>';sFlightHTML+='<td class="fitTitle" width="15%">Arrives</td>';sFlightHTML+='<td class="fitTitle" colspan="2">';var sExtraRadio='';var sExtraSelector='';if(xy==0){sExtraRadio=' checked="checked"';sExtraSelector='display:none;';}
if(sAccommProvider=='SkiWorld'){sOptionsText=' and room';}else{sOptionsText='';}
sFlightHTML+='<div style="float:right; padding-right:5px;'+sExtraSelector+'"" id="flightSelectorHolder_'+iFlightResultID+'">'+sPriceDifferencePerPerson+'<label for="flightSelector_'+iFlightResultID+'">Select flight'+sOptionsText+':</label> <input type="radio" value="'+sNewItineraryId+'" name="flightSelector_0" id="flightSelector_'+iFlightResultID+'" style="vertical-align:middle"'+sExtraRadio+' onclick="selectPackageFlightOption(0,\'£'+iNewTotalPricePerPerson+'\',\''+sNewDepartureDate+'\',\''+sNewReturnArrivalDate+'\');" /></div>';sFlightHTML+='Flight details</td>';sFlightHTML+='</tr>';sFlightHTML+='<tr>';sFlightHTML+='<td class="fitContent">'+sDepartureDate+'</td>';sFlightHTML+='<td class="fitContent">'+sArrivalDate+'</td>';sFlightHTML+='<td class="fitContent">'+sOutboundInfo+'</td>';if(sAccommProvider=='SkiWorld'){sFlightHTML+='<td class="fitContent" rowSpan="2" style="background-color:#F3F3ED;border-left:solid 1px #e3dfdf;">'+sRoomType+'</td>';}
sFlightHTML+='</tr>';sFlightHTML+='<tr>';sFlightHTML+='<td class="fitContent">'+sReturnDepartureDate+'</td>';sFlightHTML+='<td class="fitContent">'+sReturnArrivalDate+'</td>';sFlightHTML+='<td class="fitContent">'+sInboundInfo+'</td>';sFlightHTML+='</tr>';if(oFlight.length>1){if(xy==0){var sOptionsText='';if(sAccommProvider=='SkiWorld'){sOptionsText=' and room';}else{sOptionsText='';}
sVarBookJS=sBookButtonJS.replace(/'/g,"~");sFlightHTML+='<tr><td colspan="4" align="right" id="flightOptionsTextHolder_0" class="fitFlightText"><a id="moreflightslnk" href="javascript:showFlights();showHideFlightOptionsFromAvail(\'0\', \''+sPosition+'\', \''+sCSI_PEID+'\', \''+Math.round(dProdMinusFlightPP)+'\', \''+sVarBookJS+'\');selectPackageFlightOption(0, \'£'+Math.round(dCurrentPrice)+'\', \''+sDepartureDate+'\', \''+sReturnArrivalDate+'\');"><span id="flightOptionsText_0"><div class="flightinfobutton"><img src="/images/buttons/chooseadifferentflight.gif" alt="" class="imgbutton" /></div></span></a></td></tr>';sFlightHTML+='<tbody id="flightOptions_0" style="display:none;"></tbody>';}
if(xy==oFlight.length-1){sFlightHTML+='<tr><td colspan="4" class="fitBotContent">*TBAs confirmed when you click "Book this holiday"</td></tr>';sFlightHTML+='</tbody>';}}}
sTempHTML=sTempHTML.replace('#flight_details#',sFlightHTML);}}
if(sDetailsSearchType.toLowerCase()=='hotel'){var sEnquireText='Search type: Hotel';if(sResortName){sEnquireText+='|Resort: '+sResortName;}
sEnquireText+='|Accommodation: '+sAccommodationName;sEnquireText+='|From: '+sDepartureDate;sEnquireText+='|To: '+sReturnDate;}else if(sDetailsSearchType.toLowerCase()=='flight_hotel'){var sEnquireText='Search type: Flight and accommodation';if(sResortName){sEnquireText+='|Resort: '+sResortName;}
sEnquireText+='|Accommodation: '+sAccommodationName;sEnquireText+='|From: '+sDepartureDate;sEnquireText+='|To: '+sReturnDate;if(sFirstFoundDepAirport){sEnquireText+='|Flying from: '+sFirstFoundDepAirport;}}else{var sEnquireText='Search type: Package holiday';if(sResortName){sEnquireText+='|Resort: '+sResortName;}
sEnquireText+='|Accommodation: '+sAccommodationName;sEnquireText+='|From: '+sDepartureDate;sEnquireText+='|To: '+sReturnDate;if(sFirstFoundDepAirport){sEnquireText+='|Flying from: '+sFirstFoundDepAirport;}}
sTempHTML=sTempHTML.replace(/#extratext#/g,sExtraText);sTempHTML=sTempHTML.replace(/#enquiretext#/g,sEnquireText);sHTML=sTempHTML;oResultDiv=document.getElementById('ResultContent1');if(oResultDiv){oResultDiv.innerHTML=sHTML;if(bAlreadyAddedToShortlist||bAddedToShortlistFromFullDetails){o1=document.getElementById('addtoshortlist0');o2=document.getElementById('addedtoshortlist0');o3=document.getElementById('addtoshortlist0-0');o4=document.getElementById('addedtoshortlist0-0');if(o1&&o2&&o3&&o4){o1.style.display='none';o3.style.display='none';o2.style.display='';o4.style.display='';}}
if(!bLiveAvailable){oButton1=document.getElementById('MI_IMGBookButton1');if(oButton1){oButton1.src='/images/buttons/enquire.gif';}
oButton2=document.getElementById('MI_IMGBookButton2');if(oButton2){oButton2.src='/images/buttons/enquire.gif';}
div_switch('MI_EnquireButton2',false,true);}
if(bComingFromShortlist){oAddToShortlist1=document.getElementById('MI_AddToShortlist1');oAddToShortlist2=document.getElementById('MI_AddToShortlist2');oBackToShortlist1=document.getElementById('MI_BackToShortlist1');oBackToShortlist2=document.getElementById('MI_BackToShortlist2');if(oAddToShortlist1&&oBackToShortlist1){oAddToShortlist1.style.display='none';oBackToShortlist1.style.display='';}
if(oAddToShortlist2&&oBackToShortlist2){oAddToShortlist2.style.display='none';oBackToShortlist2.style.display='';}}
if(bShowPictures){div_switch('MI_Pictures',true,true);}
if(bShowFlightInfo){div_switch('MI_FlightInfo',true,true);if(bOpenFlightOptions){div_switch('MI_FlightInfoItinerary',true,true);showHideFlightOptions('0');}}
if(bShowReviews){div_switch('MI_Reviews',true,true);div_switch('MI_UserRating',true,true);}
if(bShowMap){div_switch('MI_Map',true,true);if(sGoogleZoom.length>0){BSLoadGoogleMap('MI_MapDiv',sGoogleLat,sGoogleLng,parseFloat(sGoogleMaxZoom),parseFloat(sGoogleZoom));}else{BSLoadGoogleMap('MI_MapDiv',sGoogleLat,sGoogleLng,parseFloat(sGoogleMaxZoom));}}}
if(sFullDetailsURL.replace("'","").indexOf('expandflights=true')>-1){sCMD=document.getElementById('moreflightslnk').href.replace(/javascript:/g,"");sCMD=unescape(sCMD).replace("Â","");eval(sCMD);showFlights();}}}}}
function getReviewRating(iRating){sRetHTML='';if(!isNaN(parseFloat(iRating))){for(yyy=1;yyy<6;yyy++){if(yyy<=parseFloat(iRating)){sRetHTML+='<img src="/images/starrating/flake.gif" style="vertical-align:middle;" />';}else{sRetHTML+='<img src="/images/starrating/flake_none.gif" style="vertical-align:middle;" />';}}}
return sRetHTML;}
function GetNode(object){if(object){return object.nodeValue;}
return'';}
function GetAttribute(object){if(object){return object.nodeValue;}
return'';}
function showLoader(id){if(!id){oResultDiv=document.getElementById('ResultContent1');}else{oResultDiv=document.getElementById(id);}
if(oResultDiv&&!bLoaderShowing){bLoaderShowing=true;if(!sHTMLLoadTemplate){sHTMLLoadTemplate=readFileInAsync('/includes/ajaxresults/templates/loader.html');}
oResultDiv.innerHTML=sHTMLLoadTemplate;}}
function setSessionID(fId){document.frmResults.SessionID.value=fId;}
function setSearchType(fId){document.frmResults.search_type.value=fId;}
function setViewState(fId){document.frmResults.__VIEWSTATE.value=fId;}
function setResultPaging(type){var iSelectedPage=1
var sExtraJS='';if(type=='bot'){sHTMLPaging=sHTMLPagingTemplateBottom;sExtraJS='goToTop();';}else{sHTMLPaging=sHTMLPagingTemplate;}
sHTMLPaging=sHTMLPaging.replace(/#results_total#/g,iTotalResultCount);arPagingData=sPagingData.split('|');var sPageHTML='';var iNumberOfPages=0;for(xy=0;xy<arPagingData.length;xy++){iPageNum=parseFloat(xy)+1;if(xy==arPagingData.length-1){}
if(xy==arPagingData.length-1&&iResultPageCount>0||xy!=arPagingData.length-1){iNumberOfPages++;if(xy+1==iCurrentPageNum){iSelectedPage=iPageNum;sPageHTML+='[ '+iPageNum+' ]  ';}else{sPageHTML+='<a href="javascript:changeAjaxPage(\''+iPageNum+'\');'+sExtraJS+'">'+iPageNum+'</a>  ';}}}
if(iSelectedPage>1&&iNumberOfPages>1){sPageHTML='<a href="javascript:changeAjaxPage(\''+parseFloat(iSelectedPage-1)+'\');'+sExtraJS+'"><< previous</a>  '+sPageHTML;}
if(iNumberOfPages>1&&iSelectedPage<iNumberOfPages){sPageHTML+='<a href="javascript:changeAjaxPage(\''+parseFloat(iSelectedPage+1)+'\');'+sExtraJS+'">next >></a>';}
sHTMLPaging=sHTMLPaging.replace(/#pages#/g,sPageHTML);iResultFrom=parseFloat(((iCurrentPageNum-1)*iMaximumNumberOfResults)+1);iResultTo=iResultFrom+iMaximumNumberOfResults-1;if(iResultTo>iTotalResultCount){iResultTo=iTotalResultCount;}
if(iResultTo==0){iResultFrom=0;}
sHTMLPaging=sHTMLPaging.replace(/#result_from#/g,iResultFrom);sHTMLPaging=sHTMLPaging.replace(/#result_to#/g,iResultTo);sOption1='<option value="1">Price</option>';if(sResultsSortBy=='starrating'){sOption2='<option value="2" selected="selected">Star rating</option>';}else{sOption2='<option value="2">Star rating</option>';}
if(sResultsSortBy=='accomm'){sOption3='<option value="3" selected="selected">Hotel name</option>';}else{sOption3='<option value="3">Hotel name</option>';}
sHTMLPaging=sHTMLPaging.replace(/#sort_options#/g,sOption1+sOption2+sOption3);return sHTMLPaging;}
function changeAjaxPage(iPageNum){iCurrentPageNum=iPageNum;showLoader();setTimeout('RunResults(true,true)',200);}
function changeAjaxSortType(sType){switch(parseFloat(sType)){case 2:sResultsSortBy='starrating';break;case 3:sResultsSortBy='accomm';break;default:sResultsSortBy='price';}
showLoader();LoadResults();}
function getPageStart(iPageNum){if(sPagingData!=undefined){if(sPagingData.indexOf('|')>-1){arPagingData=sPagingData.split('|');if(arPagingData.length>=iPageNum-1){if(!isNaN(parseFloat(arPagingData[iPageNum-1]))){return parseFloat(arPagingData[iPageNum-1]);}}}}
return 0;}
function setFilter(bNotOnload){if(!AjaxResultsXMLDoc){return false;}
var oFilterData=AjaxResultsXMLDoc.getElementsByTagName('FILTERDATA');if(oFilterData.length>0){var oResortName=oFilterData[0].getElementsByTagName('ResortName');var oRegionName=oFilterData[0].getElementsByTagName('RegionName');var oMinFlight=oFilterData[0].getElementsByTagName('CheapestFlight');var oMinTransfer=oFilterData[0].getElementsByTagName('CheapestTransfer');var oMaxPrice=oFilterData[0].getElementsByTagName('MaxPrice');var oMinPrice=oFilterData[0].getElementsByTagName('MinPrice');var oBoardTypes=oFilterData[0].getElementsByTagName('AvailableBoardTypes');var oStarRatings=oFilterData[0].getElementsByTagName('AvailableStarRatings');var iNumAdults=parseFloat(getSearchCriteria('NO_ADULTS'));var iNumChildren=parseFloat(getSearchCriteria('NO_CHILDREN'));var iNumInfants=parseFloat(getSearchCriteria('NO_INFANTS'));iTotalNumPassengers=iNumAdults+iNumChildren+iNumInfants;if(oResortName.length>0){sResortName=oResortName[0].childNodes.item(0).nodeValue;if(sResortName.toLowerCase().indexOf(' All ')==-1){oResortTab=document.getElementById('result_tab4');oResortTabText=document.getElementById('ResortNameTab');if(oResortTab&&oResortTabText){oResortTabText.innerHTML=sResortName;oResortTab.style.display='';}}}
try{if(oRegionName.length>0){sRegionName=oRegionName[0].childNodes.item(0).nodeValue;oRegionTab=document.getElementById('result_tab6');oRegionTabText=document.getElementById('RegionNameTab');if(oRegionTab&&oRegionTabText){oRegionTabText.innerHTML=sRegionName;oRegionTab.style.display='';}}}catch(ex){}
if(oMinPrice.length>0){if(!bNotOnload){iMinimumPricePerPerson=parseFloat(oMinPrice[0].childNodes.item(0).nodeValue)-50;iMaximumPricePerPerson=parseFloat(oMaxPrice[0].childNodes.item(0).nodeValue)+50;}else{document.getElementById('filter_DragPriceFrom').style.left='0px';document.getElementById('filter_DragPriceTo').style.left='232px';}
iFilter_MinPricePerPerson=iMinimumPricePerPerson;iFilter_MaxPricePerPerson=iMaximumPricePerPerson;var oHotelS=AjaxResultsXMLDoc.getElementsByTagName('Hotel');var bFoundPkg=false;if(oHotelS.length>0){for(iH=0;iH<oHotelS.length;iH++){if(bFoundPkg==false&&GetAttribute(oHotelS[iH].attributes.getNamedItem("Package"))=='true'){iTemp=parseFloat(GetNode(oHotelS[iH].getElementsByTagName('TotalStdPricePerPerson')[0].childNodes.item(0)))-50;if(iTemp<iFilter_MinPricePerPerson){iFilter_MinPricePerPerson=iTemp;iMinimumPricePerPerson=iTemp;}}}}
iPriceFrom=Math.round(parseFloat(iMinimumPricePerPerson));iPriceTo=Math.round(parseFloat(iMaximumPricePerPerson));iPriceDifference=parseFloat(iPriceTo-iPriceFrom);var iStartPixel=Math.round(parseFloat((232/iPriceDifference)*50));document.getElementById('filter_PriceFrom').innerHTML=iPriceFrom+50;document.getElementById('filter_PriceTo').innerHTML=iPriceTo-50;Drag.init(document.getElementById("filter_DragPriceFrom"),null,0,parseFloat(232-iStartPixel),iStartPixel,0,0);Drag.init(document.getElementById("filter_DragPriceTo"),null,iStartPixel,232,parseFloat(232-iStartPixel),0,0);if(!setFilterBoardTypes(oBoardTypes)||!setFilterStarRating(oStarRatings)){return false;}else{return true;}}else{return true;}}else{return false;}}
function setFilterStarRating(oStarRatings){if(oStarRatings.length>0){sStarRatings=oStarRatings[0].childNodes.item(0).nodeValue;if(sStarRatings.length>0){sStarRatings=sStarRatings.substring(0,sStarRatings.length-1);arStarRatings=sStarRatings.split('|');arStarRatings=arStarRatings.sort();sCurrStartRating='';sHTML='';for(xxx=0;xxx<arStarRatings.length;xxx++){if(sCurrStartRating!=arStarRatings[xxx])
{if(arStarRatings.length>xxx+1){sHTML+='<div class="bg">'}else{sHTML+='<div>'}
sHTML+='<input type="checkbox" name="Filter_StarRating" id="Filter_StarRating'+arStarRatings[xxx]+'" value="'+arStarRatings[xxx]+'" checked="checked" onclick="filter_StarRating(\''+arStarRatings[xxx]+'\');" />'+getStarRatingText(arStarRatings[xxx])+' <span id="divStars'+arStarRatings[xxx]+'" class="Stars">'+getStarRatingImages(arStarRatings[xxx])+'</span></div>';sCurrStartRating=arStarRatings[xxx];}}
oStarRatingDiv=document.getElementById('filter_StarRatings');if(oStarRatingDiv){oStarRatingDiv.innerHTML=sHTML;return true;}}}}
function setFilterBoardTypes(oBoardTypes){if(oBoardTypes.length>0){sBoardTypes=GetNode(oBoardTypes[0].childNodes.item(0));if(sBoardTypes.length>0){sBoardTypes=sBoardTypes.substring(0,sBoardTypes.length-1);arBoardTypes=sBoardTypes.split('|');arBoardTypes=arBoardTypes.sort();sCurrBoardType='';sHTML='';for(xxx=0;xxx<arBoardTypes.length;xxx++){if(sCurrBoardType!=arBoardTypes[xxx])
{if(typeof(sProvider)=='undefined')
{if(arBoardTypes.length>xxx+1){sHTML+='<div class="bg">';}else{sHTML+='<div>';}
sHTML+='<input type="checkbox" name="Filter_BoardType" value="'+arBoardTypes[xxx]+'" checked="checked" onclick="filter_BoardType(this)" />'+getBoardTypeFromCode(arBoardTypes[xxx])+'</div>';}
else
{if((arBoardTypes[xxx]!='SC'&&sProvider.toLowerCase()=='multicom')||sProvider.toLowerCase()!='multicom'){if(arBoardTypes.length>xxx+1){sHTML+='<div class="bg">';}else{sHTML+='<div>';}
sHTML+='<input type="checkbox" name="Filter_BoardType" value="'+arBoardTypes[xxx]+'" checked="checked" onclick="filter_BoardType(this)" />'+getBoardTypeFromCode(arBoardTypes[xxx])+'</div>';}}
sCurrBoardType=arBoardTypes[xxx];}}
oBoardTypeDiv=document.getElementById('filter_BoardTypes');if(oBoardTypeDiv){oBoardTypeDiv.innerHTML=sHTML;return true;}}}}
function getCSIStarRating(sRating){switch(sRating.toLowerCase()){case'1*':return'1';break;case'2*':return'2';break;case'3*':return'3';break;case'4*':return'4';break;case'5*':return'5';break;case'1':return'1';break;case'2':return'2';break;case'3':return'3';break;case'4':return'4';break;case'5':return'5';break;default:return'OTHER';}}
function getCSIBoardCode(sCode){switch(sCode.toLowerCase()){case'ro':return'RO';break;case'sc':return'SC';break;case'bb':return'BB';break;case'hb':return'HB';break;case'fb':return'FB';break;case'ai':return'AI';break;case'cb':return'CB';break;case'ca':return'CB';break;case'ao':return'AO';break;case'bsb':return'BSB';break;case'ch':return'CH';break;case'cl':return'CL';break;case'fd':return'FD';break;case'so':return'SO';break;case'SS':return'SS';break;default:return'OTHER';}}
function getBoardTypeFromCode(sCode){switch(sCode.toLowerCase()){case'ro':return'Room only';break;case'sc':return'Self catering';break;case'bb':return'B&B';break;case'hb':return'Half board';break;case'fb':return'Full board';break;case'ai':return'All inclusive';break;case'cb':return'Chalet board';break;case'ca':return'Chalet board';break;case'ao':return'Accommodation only';break;case'bsb':return'Bed & Scottish Breakfast';break;case'ch':return'Car hire';break;case'cl':return'Champagne luncheon';break;case'fd':return'Fly drive';break;case'so':return'Seat only';break;case'SS':return'Special selection';break;default:return'Other';}}
function getStarRatingImages(sRating){sHTMLa='';if(!isNaN(parseFloat(sRating))){for(yyy=0;yyy<parseFloat(sRating);yyy++){sHTMLa+='<img src="/images/starrating/star1.gif" style="vertical-align:middle;" />';}}
return sHTMLa;}
function getStarRatingText(sRating){sHTML='Allocation on arrival';if(!isNaN(parseFloat(sRating))){sHTML=sRating+' star';}
return sHTML;}
function filter_BoardType(id){if(!setFilterVariable_BoardTypes()){id.checked=true;setFilterVariable_BoardTypes();alert('Please select at least one board type');return false;}
showLoader();setTimeout('RunResults(true)',200);}
function setFilterVariable_BoardTypes(){sFilter_BoardTypes='';oBoardType=document.getElementsByName('Filter_BoardType');for(zzz=0;zzz<oBoardType.length;zzz++){if(oBoardType[zzz].checked==true){sFilter_BoardTypes+=oBoardType[zzz].value+'|';}}
if(sFilter_BoardTypes.length>0){sFilter_BoardTypes='|'+sFilter_BoardTypes;return true;}}
function filter_StarRating(id){oRating=document.getElementById('Filter_StarRating'+id);oStarImages=document.getElementById('divStars'+id);if(!setFilterVariable_StarRating()){oRating.checked=true;setFilterVariable_StarRating();alert('Please select at least one star rating');return false;}
if(oRating&&oStarImages){if(oRating.checked){oStarImages.className='Stars';}else{oStarImages.className='StarsFaded';}}
showLoader();setTimeout('RunResults(true)',200);}
function setFilterVariable_StarRating(){sFilter_StarRating='';oStarRating=document.getElementsByName('Filter_StarRating');for(zzz=0;zzz<oStarRating.length;zzz++){if(oStarRating[zzz].checked==true){sFilter_StarRating+=oStarRating[zzz].value+'|';}}
if(sFilter_StarRating.length>0){sFilter_StarRating='|'+sFilter_StarRating;return true;}}
function getSearchCriteria(sNode){var oCriteriaData=AjaxResultsXMLDoc.getElementsByTagName('SEARCHCRITERIA');if(oCriteriaData.length>0){var oNode=oCriteriaData[0].getElementsByTagName(sNode);if(oNode.length>0){return oNode[0].childNodes.item(0).nodeValue;}}}
function getTemplate(type){if(type=='qc'){sResultStyle='QC';}else{sResultStyle='DR';}
if(sCurrentSearch=='PackageHoliday'){if(type=='qc'){return readFileInAsync('/includes/ajaxresults/templates/packageholiday_qc.html');}else{return readFileInAsync('/includes/ajaxresults/templates/packageholiday_dr.html');}}
if(sCurrentSearch=='Hotel'){if(type=='qc'){return readFileInAsync('/includes/ajaxresults/templates/hotel_qc.html');}else{return readFileInAsync('/includes/ajaxresults/templates/hotel_dr.html');}}
if(sCurrentSearch=='Flight_Hotel'){if(type=='qc'){return readFileInAsync('/includes/ajaxresults/templates/flighthotel_qc.html');}else{return readFileInAsync('/includes/ajaxresults/templates/flighthotel_dr.html');}}}
function showResortInfo(bRegion){oShortlistContent=document.getElementById('OtherFullContent');var timestamp=new Date();if(bRegion){sFilename='regioninfo.asp';}else{sFilename='resortinfov2.asp';}
sURL='/includes/'+sFilename+'?id='+queryString('locationto')+'&timestamp='+timestamp;if(bDebug){if(confirm('OPEN URL: '+sURL)){window.open(sURL);}}
oShortlistContent.innerHTML=readFileInAsync(sURL);div_switch('ResultContent',false,true);div_switch('OtherFullContent',true,true);bLoaderShowing=false;LoadDestinationGoogleMap();}
var SelectedResultTab='result_tab1';function SwitchResult(id,bIgnoreFunctions){bStillOnAccommTab=false;div=document.getElementById(id);if(div){if(Right(div.className,2)!='Na'){div_switch('ResultContent',true,true);div_switch('OtherFullContent',false,true);div_switch('PricingContent',false,true);for(x=1;x<10;x++){if(document.getElementById('result_tab'+x)){if(Right(document.getElementById('result_tab'+x).className,2)!='Na'){document.getElementById('result_tab'+x).className='resulttab';}}
if(document.getElementById('result_div'+x)){document.getElementById('result_div'+x).style.display='none';}}
SelectedResultTab=id;if(document.getElementById(id)){document.getElementById(id).className='resulttabOver';if(!bIgnoreFunctions){div_switch('ResultContent',true,true);div_switch('OtherFullContent',false,true);if(Right(id,1)=='1'){showLoader();sHTMLTemplate=getTemplate('qc');setTimeout('RunResults(true,true)',200);}else if(Right(id,1)=='2'){showLoader();sHTMLTemplate=getTemplate('dr');setTimeout('RunResults(true,true)',200);}else if(Right(id,1)=='3'){div_switch('PricingContent',true,true);div_switch('PricingContent1',false,true);div_switch('ResultContent1',true,true);showLoader();if(sFullDetailsURL){bStillOnAccommTab=true;viewFullDetails();}}else if(Right(id,1)=='4'){div_switch('ResultContent',false,true);div_switch('OtherFullContent',true,true);showLoader('OtherFullContent');setTimeout('showResortInfo()',500);}else if(Right(id,1)=='5'){div_switch('ResultContent',false,true);div_switch('OtherFullContent',true,true);showLoader('OtherFullContent');showShortlist();}else if(Right(id,1)=='6'){div_switch('ResultContent',false,true);div_switch('OtherFullContent',true,true);showLoader('OtherFullContent');setTimeout('showResortInfo(true)',500);}else if(Right(id,1)=='7'){div_switch('ResultContent',false,true);div_switch('OtherFullContent',true,true);showLoader('OtherFullContent');showFlightSelector();}else if(Right(id,1)=='8'){div_switch('PricingContent',true,true);div_switch('PricingContent1',true,true);div_switch('ResultContent',false,true);div_switch('ResultContent1',false,true);div_switch('OtherFullContent',false,true);}else if(Right(id,1)=='9'){div_switch('ResultContent',false,true);div_switch('OtherFullContent',true,true);showLoader('OtherFullContent');setTimeout('showSkiExtras()',500);}}}
if(document.getElementById('result_div'+Right(id,1))){document.getElementById('result_div'+Right(id,1)).style.display='';}}}}
function showSkiExtras(){oResultDiv=document.getElementById('OtherFullContent');if(oResultDiv){sURL='/ski-extras/include.asp?id='+queryString('locationto');oResultDiv.innerHTML=readFileInAsync(sURL);}}
function SwitchResultTabs(id,on,bShortlist){var sClass='';if(bShortlist==true){sClass='inShortlist';}
div=document.getElementById(id);if(SelectedResultTab!=id&&div){if(Right(div.className,2)!='Na'){sExtra='';if(on==1){if(div.className.indexOf('Over')<0){div.className=div.className.replace(' '+sClass,'')+'Over'+' '+sClass;}else{SelectedSearchTab=id;}}else{if(div.className.indexOf('Over')>-1){div.className=Left(div.className.replace(' '+sClass,''),div.className.replace(' '+sClass,'').length-4)+' '+sClass;}}}}}
function ShowHideHIInfo(id){div=document.getElementById(id);if(div){if(div.style.display=='none'){div.style.display='';}else{div.style.display='none';}}}
function AROpenSearch(){div_switch('SlimSearch_Closed',false,true);div_switch('SlimSearch_Open',true,true);}
function readFileInAsync(url,bPost,sPostValues){if(window.XMLHttpRequest){SyncDOMInAsync=new XMLHttpRequest();}else{SyncDOMInAsync=new ActiveXObject("Microsoft.XMLHTTP");}
if(SyncDOMInAsync){if(bDebug){var timestamp=new Date();if(url.indexOf('?')>-1){url=url+'&timestamp='+timestamp;}else{url=url+'?timestamp='+timestamp;}}
if(bPost){sMethod='POST';}else{sMethod='GET';}
SyncDOMInAsync.open(sMethod,url,false);if(bPost){SyncDOMInAsync.setRequestHeader("Content-type","application/x-www-form-urlencoded");SyncDOMInAsync.setRequestHeader("Content-length",sPostValues.length);SyncDOMInAsync.setRequestHeader("Connection","close");}
SyncDOMInAsync.send(sPostValues);return SyncDOMInAsync.responseText;}else{return false;}}
function readFile(url){if(window.XMLHttpRequest){SyncDOM=new XMLHttpRequest();}else{SyncDOM=new ActiveXObject("Microsoft.XMLHTTP");}
if(SyncDOM){if(bDebug){var timestamp=new Date();if(url.indexOf('?')>-1){url=url+'&'+timestamp.getFullYear()+'-'+timestamp.getMonth()+'-'+timestamp.getDate()+'-'+timestamp.getHours()+'-'+timestamp.getMinutes();}else{url=url+'?'+timestamp;}}
SyncDOM.open("GET",url,false);SyncDOM.send(null);return SyncDOM.responseText;}else{return false;}}
function goToTop(){scroll(0,124);}
function showFlights(){if(document.getElementById('accommDescLnk')){document.getElementById('accommDescLnk').style.display='';};if(document.getElementById('MI_FlightInfoItinerary_std')){document.getElementById('MI_FlightInfoItinerary_std').style.display='none';}
if(document.getElementById('MI_FlightInfoItinerary')){document.getElementById('MI_FlightInfoItinerary').style.display='';}
location.href='#flightItin';}
function collapseFlights(){if(document.getElementById('accommDescLnk')){document.getElementById('accommDescLnk').style.display='none';};if(document.getElementById('MI_FlightInfoItinerary')){document.getElementById('MI_FlightInfoItinerary').style.display='none';}
if(document.getElementById('flightSelectorHolder_0_0')){document.getElementById('flightSelectorHolder_0_0').style.display='none';}
var sDivs=new Array('MI_FlightInfoItinerary_std','flightOptionsText_0','flightOptionsTextHolder_0','flightOptionsTBATextHolder_0');for(iD=0;iD<sDivs.length;iD++){if(document.getElementById(sDivs[iD])){document.getElementById(sDivs[iD]).style.display='';}}
setTimeout('goToTop()',200);}
function stripHTMLJS(strtext)
{return strtext.replace(/(<.*?>)/ig,"");}
function SelectSingleNode(xmlDoc,elementPath)
{if(window.ActiveXObject)
{return xmlDoc.selectSingleNode(elementPath);}
else
{var xpe=new XPathEvaluator();var nsResolver=xpe.createNSResolver(xmlDoc.ownerDocument==null?xmlDoc.documentElement:xmlDoc.ownerDocument.documentElement);var results=xpe.evaluate(elementPath,xmlDoc,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return results.singleNodeValue;}}
function FoundPackageHolidayFlightInfo(oHotel,oAjaxResultsXMLDoc)
{var sPkgHotelCSIPEID=GetNode(oHotel.getElementsByTagName('CSI_PEID')[0].childNodes.item(0));var sFlight_PkgDetailHTML='';var oFlight=SelectSingleNode(oAjaxResultsXMLDoc,"//Flights/FARE[@Package='true' and CSI_PEID='"+sPkgHotelCSIPEID+"']");if(oFlight)
{var oRoute=oFlight.getElementsByTagName('ROUTE');var xx=0
var xxy=0
for(xx=0;xx<oRoute.length;xx++){var oSegment=oRoute[xx].getElementsByTagName('SEGMENT');for(xxy=0;xxy<oSegment.length;xxy++){var sFlight_Num=GetNode(oSegment[xxy].getElementsByTagName('FLIGHT_NUM')[0].childNodes.item(0));var sFlight_DepDate=GetNode(oSegment[xxy].getElementsByTagName('DEP_DATE')[0].childNodes.item(0));var sFlight_ArrDate=GetNode(oSegment[xxy].getElementsByTagName('ARR_DATE')[0].childNodes.item(0));var sFlight_DepTime=GetNode(oSegment[xxy].getElementsByTagName('DEP_TIME')[0].childNodes.item(0));var sFlight_ArrTime=GetNode(oSegment[xxy].getElementsByTagName('ARR_TIME')[0].childNodes.item(0));var sFlight_DepAirport=GetNode(oSegment[xxy].getElementsByTagName('ORIGIN')[0].childNodes.item(0));var sFlight_ArrAirport=GetNode(oSegment[xxy].getElementsByTagName('DESTINATION')[0].childNodes.item(0));var sFlight_Info=sFlight_DepAirport+' - '+sFlight_ArrAirport+' | '+sFlight_DepTime+' - '+sFlight_ArrTime+' | '+sFlight_Num;if(xxy==0&&xx==0){sFlight_ActualDepAirport=sFlight_DepAirport;}
if(!sHotel_DepDate){sHotel_DepDate=sFlight_DepDate;}
if(!sHotel_ArrDate&&xx==1){sHotel_ArrDate=sFlight_DepDate;}
sFlight_PkgDetailHTML+='<tr>';sFlight_PkgDetailHTML+='<td class="fitContent">'+sFlight_DepDate+'</td>';sFlight_PkgDetailHTML+='<td class="fitContent">'+sFlight_ArrDate+'</td>';sFlight_PkgDetailHTML+='<td class="fitContent">'+sFlight_Info+'</td>';sFlight_PkgDetailHTML+='</tr>';}}
sFlight_PkgDetailHTML+='<tr><td colspan="3" class="fitBotContent">*TBAs confirmed when you click "Book this holiday"</td></tr>';}
return sFlight_PkgDetailHTML;}
