function replaceImages() {
	document.getElementById('pleasewaitAnimation').src='/images/pleasewait/animation.gif';
	document.getElementById('pleasewaitAnimationLogos').src='/images/pleasewait/animationlogos.gif';
}
function frmBYOSubmit() {
	div_switch('websiteDiv',false,true);
	div_switch('pleasewaitDiv',true,true);
	document.frmResults.submit();
	setTimeout('replaceImages()',100);
}
function setLevel(fId) {document.frmResults.txtLevel.value=fId;}
function setParentID(fId){document.frmResults.ParentID.value=fId;}
function setShowDiv(fId){document.frmResults.ShowDiv.value=fId;}
function setProvider(fId){document.frmResults.Provider_Flight.value=fId;document.frmResults.txtIsPostBack.value="true";}
function setCarOptionEx(position,supplier){document.frmResults.car_position.value=position;document.frmResults.car_provider.value=supplier;}
function setHotelCacheKey(key) {
	el = document.frmResults.hotelCacheKey;
	if(el){el.value = key;}
}
function resultsTimeout() {}
/* START RESULTS JS */
	function EnquireFromNoResultsXSL() {
		document.frmResults.action = '/contact/default.asp';
		document.frmResults.method = 'post';
		document.frmResults.submit();
	}
	function ChangePageFlights(pagenumber) {
		document.frmResults.txtLevel.value='SEARCH';
		document.frmResults.txtIsPostBack.value="true";
		document.frmResults.pagenumberflights.value=pagenumber;
		document.frmResults.ShowDiv.value='flights';
		frmBYOSubmit();
	}
	function ChangePageHotels(pagenumber) {
		document.frmResults.txtLevel.value='SEARCH';
		document.frmResults.txtIsPostBack.value="true";
		document.frmResults.pagenumberhotels.value=pagenumber;
		document.frmResults.ShowDiv.value='accomm';
		frmBYOSubmit();
	}
	function ChangePagePackageHolidays(pagenumber) {
		document.frmResults.txtLevel.value='SEARCH';
		document.frmResults.txtIsPostBack.value="true";
		document.frmResults.pagenumberpackageholidays.value=pagenumber;
		document.frmResults.ShowDiv.value='accomm';
		frmBYOSubmit();
	}
	
	function setPackageHoliday(sProvider,sId) {
		document.frmResults.Provider_PackageHoliday.value=sProvider;
		document.frmResults.packageholiday_itineraryid.value=sId;
	}
	function setAccomm(fId, pId, sId, parentId, sessionId, expSupplier, expRoomCode, BoardCode) {
		if(BoardCode==null) BoardCode='';
		document.frmResults.accomm_id.value=fId;
		document.frmResults.Provider_Accomm.value=pId;
		document.frmResults.hrnQuoteKey.value=sId;
		document.frmResults.expRoomCode.value=expRoomCode;
		document.frmResults.ParentID.value=parentId;
		document.frmResults.exp_supplier.value=expSupplier;
		document.frmResults.BoardCode.value=BoardCode;
	}
	function setSortHotels(fId,datatype,order,sId){
		document.frmResults.txtIsPostBack.value="true";
		document.frmResults.SortHotels.value=fId + ";" + datatype + ";" + order + ";" + sId;
	}
	function setSortFlights(fId,datatype,order,sId){
		//alert(fId+','+datatype+','+order+','+sId)
		document.frmResults.txtIsPostBack.value="true";
		document.frmResults.SortFlights.value=fId + ";" + datatype + ";" + order + ";" + sId;
	}
	function setSortHotelsNEW(type, page) {
		document.frmResults.txtIsPostBack.value="true";
		if(type>0) {
			if(type==1) {
				setSortHotels("translate(PricedRooms/PricedRoom/TotalStdPrice,',','')",'number','ascending','3');
			}
			if(type==2)	{
				setSortHotels('AccommInfo/StarRating','number','descending','2');
			}
			if(type==3)	{
				setSortHotels('AccommInfo/AccommName','text','ascending','1');
			}
			if(type==4)	{
				setSortHotels('default','','','0');
			}
			ChangePageHotels(page);
		}
	}

	/* New function for flights by Casper Thun 10th August 2007 */
	function setFlight(fare_id, fId, provider, flightPos) {
		var sRouteOut = '';
		var sRouteIn = '';
		document.frmResults.txtIsPostBack.value="true";
		document.frmResults.FARE_PK.value=fId;
		document.frmResults.CSI_FAREID.value=fId;
		document.frmResults.fare_id.value=fare_id;
		document.frmResults.Provider_Flight.value=provider;
		radio = document.getElementsByTagName('input')
		for(x=0;x<radio.length-1;x++) {
			if(radio[x].type == 'radio') {
				if(radio[x].name=='tblOutbound_'+flightPos) {
					if(radio[x].checked==true) {
						sRouteOut = radio[x].value;
					}
				}
				if(radio[x].name=='tblInbound_'+flightPos) {
					if(radio[x].checked==true) {
						sRouteIn = radio[x].value;
					}
				}
			}
		}
		document.frmResults.route_out.value=sRouteOut;
		document.frmResults.CSI_ROUTEIDOUT.value=sRouteOut;
		document.frmResults.route_out_position.value=sRouteOut;
		document.frmResults.route_in.value=sRouteIn;
		document.frmResults.CSI_ROUTEIDIN.value=sRouteIn;
		document.frmResults.route_in_position.value=sRouteIn; 
		//alert(document.frmResults.txtIsPostBack.value+'\n'+document.frmResults.FARE_PK.value+'\n'+document.frmResults.CSI_FAREID.value+'\n'+document.frmResults.fare_id.value+'\n'+document.frmResults.Provider_Flight.value+'\n'+document.frmResults.route_out.value+'\n'+document.frmResults.CSI_ROUTEIDOUT.value+'\n'+document.frmResults.route_out_position.value+'\n'+document.frmResults.route_in_position.value+'\n')
	}
		
	function showHideResultItems(id, linkText ,type) {
		if(document.getElementById('_divHideShowFlights'+id+type)) {
			if(document.getElementById('_divHideShowFlights'+id+type).style.display=='none') {
				bDisplayMoreResult = false;
				sDisplay = '';
				sLinkText = 'Hide';
			}else{
				bDisplayMoreResult = true;
				sDisplay = 'none';
				sLinkText = 'Show';
			}
		}
		if(document.getElementById('_divHideShowFlights'+id+type)) {
			document.getElementById('_divHideShowFlights'+id+type).style.display = sDisplay;
		}
		
		
		radio = document.getElementsByTagName('input')
		
		bOutBoundSelected = false;
		bInBoundSelected = false;
		
		for(x=0;x<radio.length-1;x++) {
			if(radio[x].type == 'radio') {
				if(radio[x].name=='tbl'+type+'bound_'+id) {
					radio[x].style.display = sDisplay;
					if(bOutBoundSelected!=true) {
						radio[x].checked = true;
						bOutBoundSelected = true;
					}
				}
			}
		}
		linkText.innerHTML = sLinkText+Right(linkText.innerHTML, linkText.innerHTML.length-4);
	}
	/* START MORE INFO AJAX */
		var sCurrentPosition = '';
		function GetMoreHotelInfo(sLink, sPosition, sProvider, sAccommCode, sGABProvID, sMulticomFAB) {
			sCurrentPosition = sPosition
			if(document.getElementById('divHotelInfo'+sPosition).style.display=='none') {
				sURL = '/includes/hotelinfo.asp?provider='+sProvider+'&accommcode='+sAccommCode+'&gabprovid='+sGABProvID+'&multicomfab='+sMulticomFAB+'&cfa';
				if(sURL!='') {
					document.getElementById('divHotelInfo'+sPosition).style.display = '';
					document.getElementById('Description'+sCurrentPosition).innerHTML = '<div align="center"><img src="/images/animations/ajax-loader-white.gif" /><br /><br /><span class="resultPleaseWait">Loading... Please wait.</span></div>'
					if(bDebug) {
						if(confirm('Open '+ sURL)) {
							window.open(sURL);
						}
					}
					setTimeout("loadInfoXMLDoc('"+sURL+"')", 100);
					sLink.innerHTML = 'Click here to hide more hotel information';
				}else{
					alert('No url defined');	
				}
			}else{
				sLink.innerHTML = 'Click here for more hotel information';
				document.getElementById('divHotelInfo'+sPosition).style.display = 'none';
			}
		}
		function loadInfoXMLDoc(url) {
			// branch for native XMLHttpRequest object
			if (window.XMLHttpRequest) {
				req = new XMLHttpRequest();
				req.onreadystatechange = processInfoChange;
				req.open("GET", url, true);
				req.send(null);
			// branch for IE/Windows ActiveX version
			} else if (window.ActiveXObject) {
				req = new ActiveXObject("Microsoft.XMLHTTP");
				if (req) {
					req.onreadystatechange = processInfoChange;
					req.open("GET", url, true);
					req.send();
				}
			}
		}
		function processInfoChange() {
			if (req.readyState == 4) {
				if (req.status == 200){
					xmldoc = req.responseXML.documentElement;
					sDescription = xmldoc.getElementsByTagName('Description').item(0).childNodes.item(0).nodeValue;
					iGoogleLat = parseFloat(xmldoc.getElementsByTagName('GoogleLat').item(0).childNodes.item(0).nodeValue);
					iGoogleLng = parseFloat(xmldoc.getElementsByTagName('GoogleLng').item(0).childNodes.item(0).nodeValue);
					images = xmldoc.getElementsByTagName('Image');
					document.getElementById('IMGThumbs'+sCurrentPosition).innerHTML = ''
					if(images.length>0) {
						for(x=0;x<images.length;x++) {
							sImage = images.item(x).childNodes.item(0).nodeValue;
							if(x==0){
								document.getElementById('IMGPlaceHolder'+sCurrentPosition).innerHTML = '<img src="'+sImage+'" id="placeHolder'+sCurrentPosition+'" onerror="this.src=\'/images/general/_noimage.gif\'" />'	
							}
							if(images.length>1) {
								document.getElementById('IMGThumbs'+sCurrentPosition).innerHTML += '<img src='+sImage+' onclick=SwitchPhoto("placeHolder'+sCurrentPosition+'","'+sImage+'") onerror="this.src=\'/images/general/_noimage.gif\'" />'
								document.getElementById('IMGThumbsText'+sCurrentPosition).style.display = '';
							}else{
								document.getElementById('IMGThumbs'+sCurrentPosition).style.display = 'none';
								document.getElementById('IMGPlaceHolder'+sCurrentPosition).style.borderBottom = '1px';
								
							}
						}
						document.getElementById('MoreInfoIMG'+sCurrentPosition).style.display='';
					}
					if(iGoogleLat!=0 && iGoogleLng!=0) {
						document.getElementById('GoogleMapContainer'+sCurrentPosition).style.display='';
						LoadGoogleMap('GoogleMap'+sCurrentPosition,iGoogleLat,iGoogleLng);
					}
					document.getElementById('Description'+sCurrentPosition).innerHTML = sDescription;
				}else{
					alert('More hotel information is not available');
					document.getElementById('divHotelInfo'+sCurrentPosition).style.display = 'none';
				}
			}
		}
	/* END MORE INFO AJAX */
	
	/* START RESORT INFO AJAX */
		var currentSearchType = '';
		function GetResortInfo(sSearchType, sAirportTo) {
			currentSearchType = sSearchType;
			if(document.getElementById('divResortInfo')) {
				var sAddressURL='';
				sAddresses = document.getElementsByName('AddressForGoogle');
				for(x=0;x<sAddresses.length;x++) {
					if(sAddresses[x].value) {
						sAddressURL+=sAddresses[x].value.replace("'","");
						if(x<sAddresses.length-1) {
							sAddressURL+='||';
						}
					}
				}
				sLocation = document.getElementsByName('locationid')[0].value.replace("'","");
				sURL = '/includes/resortinfo.asp?location='+sLocation+'&search_type='+sSearchType+'&airportto='+sAirportTo+'&addresses='+sAddressURL+'&r';
				
				if(sURL!='') {
					sURL=sURL.replace("'","");
					if(bDebug) {
						if(confirm('Open '+ sURL)) {
							window.open(sURL);
						}
					}
					setTimeout("loadResortInfoXMLDoc('"+sURL+"')", 100);
				}else{
					alert('No url defined');	
				}
			}
		}
		
		function loadResortInfoXMLDoc(url) {
			// branch for native XMLHttpRequest object
			if (window.XMLHttpRequest) {
				reqResort = new XMLHttpRequest();
				reqResort.onreadystatechange = processResortInfoChange;
				reqResort.open("GET", url, true);
				reqResort.send(null);
			// branch for IE/Windows ActiveX version
			} else if (window.ActiveXObject) {
				reqResort = new ActiveXObject("Microsoft.XMLHTTP");
				if (reqResort) {
					reqResort.onreadystatechange = processResortInfoChange;
					reqResort.open("GET", url, true);
					reqResort.send();
				}
			}
		}
		function processResortInfoChange() {
			if (reqResort.readyState == 4) {
				if (reqResort.status == 200){
					document.getElementById('divResortInfoLoader').style.display='none';
					document.getElementById('divResortInfo').style.display='';
					
					var bGoogle = false;
					var bWeather = false;
					var bResort = false;
					var bRegion = false;
					//alert(req.responseXML.text);
					xmldoc = reqResort.responseXML.documentElement;
					//START GOOGLE MAP
					if (GBrowserIsCompatible()) {
						google = xmldoc.getElementsByTagName('Google');
						if(google.length>0) {
							// start fix to center map
							
							document.getElementById('divResortInfo_1').style.display='';
							// end fix to center map
							bGoogle = true;
							if(bGoogle) {
								divGoogle = document.getElementById("ResortGoogleMap");
								divGoogle.style.width='715px';
								divGoogle.style.height='230px';
								var hotelIcon = new GIcon();
								hotelIcon.image = "/images/icons/googlemap_hotel.png"
								hotelIcon.iconSize = new GSize(24, 25);
								hotelIcon.iconAnchor = new GPoint(9, 34);
								hotelIcon.infoWindowAnchor = new GPoint(9, 2);
								
								var airportIcon = new GIcon();
								airportIcon.image = "/images/icons/googlemap_airport.png"
								airportIcon.iconSize = new GSize(32, 32);
								airportIcon.iconAnchor = new GPoint(9, 34);
								airportIcon.infoWindowAnchor = new GPoint(11, 1);
								
								var interestIcon = new GIcon();
								interestIcon.image = "/images/icons/googlemap_interest.png"
								interestIcon.iconSize = new GSize(22, 22);
								interestIcon.iconAnchor = new GPoint(9, 34);
								interestIcon.infoWindowAnchor = new GPoint(11, 1);
								
								function createMarker(point, index, title, distance, type) {
									if(type=='hotel') {
										var marker = new GMarker(point, hotelIcon);
									}else if(type=='interest'){
										var marker = new GMarker(point, interestIcon);
									}else{
										var marker = new GMarker(point, airportIcon);
									}
									marker.image = "/images/icons/googlemap_"+type+".png";
									
									GEvent.addListener(marker, "click", function() {
										if(type=='hotel') {
											var image = '';
											var starrating = '';
											var price = '';
											var sHTML = '';
											if(document.getElementById('ImageForGoogle'+index)) {
												image = document.getElementById('ImageForGoogle'+index).value;	
											}
											if(document.getElementById('StarRatingForGoogle'+index)) {
												iStars = parseFloat(document.getElementById('StarRatingForGoogle'+index).value);
												if(typeof iStars=='number') {
													for(z=0;z<iStars;z++) {
														starrating+='<img src="/images/starrating/star_small.gif" align="absmiddle" />';
													}
												}
											}
											if(document.getElementById('PriceForGoogle'+index)) {
												price = document.getElementById('PriceForGoogle'+index).value;	
											}
											sHTML+='<table border="0" cellpadding="0" cellspacing="0"><tr>'
											if(image) {
												sHTML+='<td><div class="imageContainerGoogle"><img src="'+image+'" onerror="this.src=\'/images/general/_noimage.gif\'" /></div><td>';	
											}
											sHTML+='<td valign="top"><strong>'+title+'</strong>'
											if(starrating) {
												sHTML+='<br>'+starrating
											}
											if(price) {
												sHTML+='<br><span class="standoutText">'+price+'</span>'
											}
											if(distance) {
												sHTML+='<br>'+distance+' from airport';
											}
											
											sHTML+='<br/><br/><a href="#result'+index+'">Go to hotel</a></td>'
											sHTML+='</tr></table>'
										}else{
											sHTML = title;
										}
										marker.openInfoWindowHtml(sHTML);
									});
									return marker;
								}
								var map = new GMap2(divGoogle);
								map.addControl(new GSmallMapControl());
								map.addControl(new GMapTypeControl());
								for(x=0;x<google.length;x++) {
									sTitle = google.item(x).attributes.getNamedItem("Title").nodeValue
									sLat = google.item(x).attributes.getNamedItem("Lat").nodeValue
									sLng = google.item(x).attributes.getNamedItem("Lng").nodeValue
									sPosition = google.item(x).attributes.getNamedItem("Position").nodeValue
									sType = google.item(x).attributes.getNamedItem("Type").nodeValue
									sDistance = google.item(x).attributes.getNamedItem("Distance").nodeValue
									if(x==0) {
										map.setCenter(new GLatLng(sLat,sLng), 9);	
									}
									if(sType!='resort') {
										//alert(sLat+', '+sLng);
										var point = new GLatLng(sLat,sLng);
										if(sType=='hotel') {
											map.addOverlay(createMarker(point, sPosition, sTitle, sDistance, sType));
										}
										if(sType=='airport') {
											map.addOverlay(createMarker(point, '0', sTitle, '', sType));
										}
										if(sType=='interest') {
											sImage = google.item(x).attributes.getNamedItem("Image").nodeValue
											sDescription = google.item(x).attributes.getNamedItem("Description").nodeValue
											sHTML='';
											sHTML+='<table border="0" cellpadding="0" cellspacing="0"><tr>'
											if(sImage) {
												sHTML+='<td><div class="imageContainerGoogle"><img src="'+sImage+'" onerror="this.src=\'/images/general/_noimage.gif\'" /></div><td>';	
											}
											sHTML+='<td valign="top"><strong>'+sTitle+'</strong>'
											if(sDescription) {
												sHTML+='<br>'+sDescription;
											}
											
											sHTML+='<br/><br/><a href="javascript:ResortTab(\'tab_2\');showHideThing('+sPosition+',true);">More information</a></td>'
											sHTML+='</tr></table>'
											
											map.addOverlay(createMarker(point, '0', sHTML, '', sType));
										}
										if(document.getElementById('ResortGoogleMapBot')) {
											sIconHTML='';
											sIconHTML+='<img src="/images/icons/googlemap_hotel.png" align="absmiddle" style="margin:0px 5px 0px 0px;" />Hotel information';
											if(currentSearchType=='Flight_Hotel'||currentSearchType=='Flight_Car_Hotel') {
												sIconHTML+='<img src="/images/icons/googlemap_airport.png" align="absmiddle" style="margin:0px 5px 0px 15px;" />Airport';
											}
											sIconHTML+='<img src="/images/icons/googlemap_interest.png" align="absmiddle" style="margin:0px 5px 0px 15px;" />Places of interest';
											
											document.getElementById('ResortGoogleMapBot').innerHTML = '<div style="margin-top:6px;"><strong style="color:white;">'+sIconHTML+'</strong></div>';
											document.getElementById('ResortGoogleMapBot').style.display = '';
										}
									}
								}
							}
						}
					}
					//END GOOGLE MAP
					//START RESORT INFO
						var sResortInfo = '';
						var sVideoID = '';
						resort = xmldoc.getElementsByTagName('Resort');
						for(x=0;x<resort.length;x++) {
							bResort = true;
							sResortName = resort.item(x).attributes.getNamedItem("Name").nodeValue
							sVideoID = resort.item(x).attributes.getNamedItem("Video").nodeValue
							sVideoType = resort.item(x).attributes.getNamedItem("VideoType").nodeValue
							sResortDesc = resort.item(x).childNodes.item(0).childNodes.item(0).nodeValue
							sResortInfo+=sResortDesc;
						}
						thing = xmldoc.getElementsByTagName('ResortThing');
						if(thing.length>0) {
							sHTML = '<div class="thingsToSeeTitle">Things to see</div>'
							
							sHTML+='<div class="hr2" style="clear:left;"></div>'
							for(x=0;x<thing.length;x++) {
								iID = thing.item(x).attributes.getNamedItem("ID").nodeValue
								sTitle = thing.item(x).attributes.getNamedItem("Title").nodeValue
								sDescription = thing.item(x).childNodes.item(0).nodeValue
								sImg = thing.item(x).attributes.getNamedItem("Img").nodeValue
								sImgTitle = thing.item(x).attributes.getNamedItem("ImgTitle").nodeValue
								sURL = thing.item(x).attributes.getNamedItem("URL").nodeValue
								sURLTitle = thing.item(x).attributes.getNamedItem("URLTitle").nodeValue
								
								sHTML+='<div class="thingToSee">'
								sHTML+='<div class="thingTitle"><a href="javascript:showHideThing('+iID+');">'+sTitle+'</a></div>'
								sHTML+='<div id="thingtosee_'+iID+'" style="display:none">';
								if(sImg) {
									sHTML+='<div class="imageContainer" style="float:left; margin-bottom:7px;"><img src="http://www.travelmodule.co.uk/data/resort_images/'+sImg+'" /></div>'
								}
								sHTML+='<div class="thingDescription">'+sDescription
								if(sURL && sURL!='http://') {
									if(sURLTitle) {sLinkTitle = sURLTitle;}else{sLinkTitle = sURL;}
									sHTML+='<br/><br/>More info: <a href="'+sURL+'" target="_blank">'+sLinkTitle+'</a>'
								}
								sHTML+='</div>'
								sHTML+='</div>'
								sHTML+='<div class="hr2" style="clear:left;"></div>'
								sHTML+='</div>';
							}
							sResortInfo+=sHTML;
						}
						if(sVideoID&&document.getElementById('ResortVideo')) {
							if(sVideoType=='travelistic') {
								sVideoHTML='<embed type="application/x-shockwave-flash" src="http://media.travelistic.com/flash/diversionplayer.swf" id="diversionplayer" name="diversionplayer" bgcolor="#000000" quality="high" useexpressinstall="true" flashvars="vidID='+sVideoID+'&amp;remote=true" height="152" width="184" allowFullScreen="true" allowScriptAccess="always">';
							}else if(sVideoType=='youtube') {
								sVideoHTML='<embed src="http://www.youtube.com/v/'+sVideoID+'&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="184" height="152"></embed>';
							}
							if(sVideoHTML) {
								document.getElementById('ResortVideo').innerHTML = sVideoHTML;
								document.getElementById('ResortVideo').style.display = '';
							}
						}
						document.getElementById('ResortDescription').innerHTML = sResortInfo
						images = xmldoc.getElementsByTagName('ResortImage');
						if(images.length>0) {
							for(x=0;x<images.length;x++) {
								sImage = images.item(x).attributes.getNamedItem("URL").nodeValue
								if(x==0){
									document.getElementById('ResortIMGPlaceHolder').innerHTML = '<img src="'+sImage+'" id="placeHolderResort"/>'	
								}
								if(images.length>1) {
									document.getElementById('ResortIMGThumbs').innerHTML += '<img src='+sImage+' onclick=SwitchPhoto("placeHolderResort","'+sImage+'") />'
									document.getElementById('ResortIMGThumbsText').style.display = '';
								}else{
									document.getElementById('ResortIMGThumbs').style.display = 'none';
									document.getElementById('ResortIMGPlaceHolder').style.borderBottom = '1px';
									
								}
							}
							document.getElementById('ResortMoreInfoIMG'+sCurrentPosition).style.display='';
						}
					//END RESORT INFO
					//START REGION INFO
						region = xmldoc.getElementsByTagName('Region');
						for(x=0;x<region.length;x++) {
							bRegion = true;
							sRegionName = region.item(x).attributes.getNamedItem("Name").nodeValue
							sRegionDesc = region.item(x).childNodes.item(0).childNodes.item(0).nodeValue
							document.getElementById('RegionDescription').innerHTML = sRegionDesc;
						}
						
						images = xmldoc.getElementsByTagName('RegionImage');
						if(images.length>0) {
							for(x=0;x<images.length;x++) {
								sImage = images.item(x).attributes.getNamedItem("URL").nodeValue
								if(x==0){
									document.getElementById('RegionIMGPlaceHolder').innerHTML = '<img src="'+sImage+'" id="placeHolderRegion"/>'	
								}
								if(images.length>1) {
									document.getElementById('RegionIMGThumbs').innerHTML += '<img src='+sImage+' onclick=SwitchPhoto("placeHolderRegion","'+sImage+'") />'
									document.getElementById('RegionIMGThumbsText').style.display = '';
								}else{
									document.getElementById('RegionIMGThumbs').style.display = 'none';
									document.getElementById('RegionIMGPlaceHolder').style.borderBottom = '1px';
									
								}
							}
							document.getElementById('RegionMoreInfoIMG'+sCurrentPosition).style.display='';
						}
					//END REGION INFO
					//START WEATHER
						weather = xmldoc.getElementsByTagName('Weather');
						if(weather.length>0) {
							bWeather = true;
							var sHTML = '';
							sHTML+='<table border="0" cellpadding="0" cellspacing="0" width="100%" class="weatherTable"><tr>'
							for(x=0;x<weather.length;x++) {
								sLocation = weather.item(x).attributes.getNamedItem("Location").nodeValue
								sDate = weather.item(x).attributes.getNamedItem("Date").nodeValue
								sLargeIcon = weather.item(x).attributes.getNamedItem("LargeIcon").nodeValue
								sSmallIcon = weather.item(x).attributes.getNamedItem("SmallIcon").nodeValue
								sDescription = weather.item(x).attributes.getNamedItem("Description").nodeValue
								sLowestTemp = weather.item(x).attributes.getNamedItem("LowestTemp").nodeValue
								sHighestTemp = weather.item(x).attributes.getNamedItem("HighestTemp").nodeValue
								sAvgTemp =	weather.item(x).attributes.getNamedItem("AvgTemp").nodeValue
								sWindSpeed = weather.item(x).attributes.getNamedItem("WindSpeed").nodeValue
								sWindDirection = weather.item(x).attributes.getNamedItem("WindDirection").nodeValue
								if(x<4){sClass = 'rightBorder';}else{sClass = '';}
								sHTML+='<td class="'+sClass+'" width="20%">';
								sHTML+='<div class="date">'+sDate+'</div>';
								sHTML+='<div class="icon"><img src="'+sLargeIcon+'" /></div>';
								sHTML+='<div class="description">'+sDescription+'</div>';
								sHTML+='<div class="hilotemp">Lo: '+sLowestTemp+'<br>Hi: '+sHighestTemp+'</div>';
								sHTML+='<div class="wind">'+sWindSpeed+' '+sWindDirection+'</div>';
								sHTML+='<div class="avgtemp">'+sAvgTemp+'</div>';
								sHTML+='</td>';
								
							}
							sHTML+='</tr></table>'
							document.getElementById('divResortInfo_4').innerHTML = sHTML;
						}
					//END WEATHER
					
					
					//START SHOW
					if(bGoogle||bWeather||bResort||bRegion) {
						document.getElementById('divResortInfo').style.display='';	
					}
					if(bGoogle) {
						document.getElementById('tab_1').style.display='';
						document.getElementById('tab_1').className=document.getElementById('tab_1').className+'Over';
						document.getElementById('divResortInfo_1').style.display='';
					}
					if(bResort) {
						document.getElementById('tab_2').style.display='';
						document.getElementById('divResortInfoTab').innerHTML = 'Info on '+sResortName;
					}
					if(bRegion) {
						document.getElementById('tab_3').style.display='';
						document.getElementById('divRegionInfoTab').innerHTML = 'Info on '+sRegionName;
					}
					if(bWeather) {
						document.getElementById('tab_4').style.display='';
					}
					if(!bGoogle && bResort) {
						document.getElementById('tab_2').className=document.getElementById('tab_2').className+'Over';
						document.getElementById('divResortInfo_2').style.display='';
					}
					if(!bGoogle && !bResort && bRegion) {
						document.getElementById('tab_3').className=document.getElementById('tab_3').className+'Over';
						document.getElementById('divResortInfo_3').style.display='';
					}
					if(!bGoogle && !bResort && !bRegion && bWeather) {
						document.getElementById('tab_4').className=document.getElementById('tab_4').className+'Over';
						document.getElementById('divResortInfo_4').style.display='';
					}
					if(!bGoogle && !bResort && !bRegion && !bWeather) {
						document.getElementById('divResortInfoNoResults').style.display='';
						document.getElementById('divDestInfoTabHolder').style.height='0px';
						
					}
					// END SHOW
				}
			}
		}
		
		function showHideThing(id,bShow) {
			if(document.getElementById('thingtosee_'+id)) {
				if(document.getElementById('thingtosee_'+id).style.display=='none'||bShow==true) {
					document.getElementById('thingtosee_'+id).style.display='';
				}else{
					document.getElementById('thingtosee_'+id).style.display='none';									
				}
			}
		}
		
		function ResortTab(div) {
			for(x=1;x<10;x++) {
				if(document.getElementById('tab_'+x)) {
					document.getElementById('tab_'+x).className = Left(document.getElementById('tab_'+x).className,3);		   
				}
				if(document.getElementById('divResortInfo_'+x)) {
					document.getElementById('divResortInfo_'+x).style.display='none';
				}
			}
			if(document.getElementById('divResortInfo_'+Right(div,1))) {
				document.getElementById(div).className = document.getElementById(div).className+'Over';
				document.getElementById('divResortInfo_'+Right(div,1)).style.display='';
				SelectedSearchTab = div
			}
		}
	/* END RESORT INFO AJAX */
	
/* END RESULTS JS */
/* START PRICING JS */

	function checkPaxForm(sBookLevel, sParentID,startdate,PAX) {
		if(checkFormValidateAttrib('input') == false)
		{ return false; }
		if(checkFormFieldSelectedIndex("title", "Please select a title for all passengers!") == false)
		{ return false; }
		if(checkFormFieldValue("firstname", "- Firstname -", "Please enter a first name for all passengers!") == false)
		{ return false; }
		if(checkFormFieldValue("surname", "- Surname -", "Please enter a surname for all passengers!") == false)
		{ return false; }
		if(checkAgeDOBMatch(parseInt(PAX),''+startdate+'') == false)
		{ return false; }
		if(document.frmResults.CarFlightNo != undefined && (document.frmResults.CarFlightNo.value == "" || document.frmResults.CarFlightNo.value == "Flight No.")){
			alert('Please enter your flight number!');
			document.frmResults.CarFlightNo.focus();
			return false;
		//}
		//else if(document.frmResults.CarFlightTime != undefined && (document.frmResults.CarFlightTime.value.length != 5 || document.frmResults.CarFlightTime.value == "hh:mm")){
		//	alert('Please enter your flight arrival time!\neg. 09:00');
		//	document.frmResults.CarFlightTime.focus();
		//	return false;
		//}
		//else if(!document.frmResults.acceptterms.checked){
		//	alert('Please confirm that you have read and understood any\nimportant information and\/or terms and conditions!'); document.frmResults.acceptterms.focus();
		//	return false;
		}else{
			setLevel(sBookLevel);
			if(sParentID!='') { setParentID(sParentID); }
			frmBYOSubmit();
		}
	}
	
	function checkFormValidateAttrib(type) {
		sObjects = document.getElementsByTagName(type);
		for(x=0;x<sObjects.length;x++) {
			if(sObjects[x].getAttribute('validateFId')=='true' || sObjects[x].getAttribute('validateFId')=='True') {
				if(!sObjects[x].value) {
					alert('Please fill in the following field: ' + sObjects[x].name);
					sObjects[x].focus();
					return false;
				}
			}
		}
	}
	
	function checkAdditinalPax() {
		if (document.getElementById('AddExtraDriver')){
			if(document.getElementById('AddExtraDriver').selectedIndex == 1){
				if(checkFormFieldSelectedIndex("CarDriverAddTitle1", "Please select a title for additional driver!") == false)
				{ return false; }
				else if(checkFormFieldValue("CarDriverAddFName1", "- Firstname -", "Please enter a first name for additional driver!",2) == false)
				{ return false; }
				else if(checkFormFieldValue("CarDriverAddSName1", "- Surname -", "Please enter a surname for additional driver!") == false)
				{ return false; }
				else if(checkFormAdditionalFieldAges("Please check the additional drivers date of birth!") == false)
				{ return false; }
			}
			else
			{ return true; }
		}else
		{ return true; }
	}
	function checkAdditinalsecondPax(){
		if (document.getElementById('AddSecondExtraDriver')){
			if(document.getElementById('AddSecondExtraDriver').selectedIndex == 1){
				if(checkFormFieldSelectedIndex("CarDriverAddTitle2", "Please select a title for second additional driver!") == false)
				{ return false; }
				else if(checkFormFieldValue("CarDriverAddFName2", "- Firstname -", "Please enter a first name for second additional driver!",2) == false)
				{ return false; }
				else if(checkFormFieldValue("CarDriverAddSName2", "- Surname -", "Please enter a surname for second additional driver!") == false)
				{ return false; }
				else if(checkFormSecondAdditionalFieldAges("Please check the second additional drivers date of birth!") == false)
				{ return false; }
			}
			else
			{ return true; }
		}
		else
		{ return true; }
	}
	
	function checkAgeDOBMatch(NumPAX, DepDate){
		var i, today, d, by, bm, bd, bday, age, dif, DOB
		//alert('Checking Ages');
		var ErrTxt = "Please ensure child ages and their date of births match! -\n\n"
		//alert('AgeChecking1');
		var ageLimit=0;
		var bAdultIncluded = false;
		for (i = 1; i < NumPAX+1; i++) {
			var sType = document.getElementById('type'+i).value;
			//get depdate in correct format
			d = DepDate.split('/'); 
			by = Number(d[2]); bm = Number(d[1])-1; bd = Number(d[0]); 
			today = new Date(by,bm,bd);
			
			//get childs DOB in correct format
			DOB = document.getElementById('dobd' + i).value + "/" + document.getElementById('dobm' + i).value + "/" + document.getElementById('doby' + i).value
			d =DOB.split('/'); 
			by = Number(d[2]); bm = Number(d[1])-1; bd = Number(d[0]); 
			bday = new Date(by,bm,bd) 
			age=0; dif=bday; 
			while(dif<today){ 
				dif = new Date(by+age,bm,parseInt(bd)-1); 
				age++; 
			} 
			age +=-2 ;
			if(DOB.length<10) {
				alert('Passenger '+i+': Please enter this passengers birthdate');
				return false;
			}else{
				if(sType == 'CHD' || sType == 'INF') {
					iMinAge = (sType == 'CHD') ? 2 : 0;
					iMaxAge = (sType == 'INF') ? 2 : 12;
		 
					//alert(age + ' passenger '+i);
					
					if(age < iMinAge || age >= iMaxAge) {
						if(age < iMinAge){
							alert('Passenger '+i+': This passenger is too young to be classed as a Child passenger');
						}
						if(age >= iMaxAge && sType == 'CHD'){
							alert('Passenger '+i+': This passenger is too old to be classed as a Child passenger');
						}else{
							alert('Passenger '+i+': This passenger is too old to be classed as an Infant passenger');
						}
						
						return false;	
					}	
					
				}
				if(age >= 16 || age < 0) {
					if(bAdultIncluded==false) {
						bAdultIncluded = true;
					}
				}
			}
		}
		if(bAdultIncluded!=true) {
			alert('A least one passenger must be 16 or over');
			return false;
		}
	}
	
	function Querystring(qs) { // optionally pass a querystring to parse
		this.params = new Object()
		this.get=Querystring_get
		
		if (qs == null)
			qs=location.search.substring(1,location.search.length)
	
		if (qs.length == 0) return
	
	// Turn <plus> back to <space>
	// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
		qs = qs.replace(/\+/g, ' ')
		var args = qs.split('&') // parse out name/value pairs separated via &
		
	// split out each name=value pair
		for (var i=0;i<args.length;i++) {
			var value;
			var pair = args[i].split('=')
			var name = unescape(pair[0])
	
			if (pair.length == 2)
				value = unescape(pair[1])
			else
				value = name
			
			this.params[name] = value
		}
	}
	
	function Querystring_get(key, default_) {
		// This silly looking line changes UNDEFINED to NULL
		if (default_ == null) default_ = null;
		
		var value=this.params[key]
		if (value==null) value=default_;
		
		return value
	}
	
	function getTotalPrice(sCode, sRate, sSymbol, bIsPerPerson) {
		iTotalPrice = 0
		iDepositPrice = 0
		var qs = new Querystring()
		var sDebug = qs.get("Debug")
		if(sDebug == 'true'){
			bDebug = true;
		}else{
			bDebug = false;
		}
		radio = document.getElementsByTagName('input')
		if(document.getElementById('numPax')) { 
			numPax = parseFloat(document.getElementById('numPax').value)
			for(x=0;x<radio.length;x++) {
				
				if(radio[x].getAttribute('itemValue')!=null && radio[x].getAttribute('itemValue')!='NaN') {
					if(bDebug){alert(radio[x].getAttribute('itemValue'))};
					if((radio[x].type=='radio' || radio[x].type=='checkbox') && radio[x].checked == true){
						iTotalPrice += parseFloat(radio[x].getAttribute('itemValue'))
						if(bDebug){alert('Added')};
					}
				}
				if(radio[x].getAttribute('depositValue')!=null && radio[x].getAttribute('depositValue')!='NaN') {
					if((radio[x].type=='radio' || radio[x].type=='checkbox') && radio[x].checked == true){
						iDepositPrice += parseFloat(radio[x].getAttribute('depositValue'))
						//break;
					}
				}
			}
			
			if(sCode && sRate) {
				sTotalPrice = formatCurrency(iTotalPrice/100*parseFloat(sRate),true);
				sPricePerPax = formatCurrency((iTotalPrice / numPax)/100*parseFloat(sRate),true);
				sTotalDeposit = formatCurrency(iDepositPrice/100*parseFloat(sRate),true);
				if(sSymbol) {
					sTotalPrice = sSymbol + sTotalPrice;
					sPricePerPax = sSymbol + sPricePerPax;
					sTotalDeposit = sSymbol + sTotalDeposit;
				}else{
					sTotalPrice += ' ' + sCode;
					sPricePerPax += ' ' + sCode;
					sTotalDeposit += ' ' + sCode;
				}
			}else{
				sTotalPrice = formatCurrencyBespoke(iTotalPrice);
				sPricePerPax = formatCurrencyBespoke(iTotalPrice / numPax);
				if(bIsPerPerson) {
					sTotalDeposit = formatCurrencyBespoke(iDepositPrice / numPax);
				}else{
					sTotalDeposit = formatCurrencyBespoke(iDepositPrice);
				}
			}
			if(document.getElementById('TotalPrice_Top')) {
				document.getElementById('TotalPrice_Top').innerHTML = sTotalPrice;
			}
			if(document.getElementById('TotalDeposit_Top')) {
				document.getElementById('TotalDeposit_Top').innerHTML = sTotalDeposit;
			}
			if(document.getElementById('PricePerPax_Top_Image')) {
				document.getElementById('PricePerPax_Top_Image').innerHTML = '<img src="/includes/textgen/?text='+sPricePerPax+'&amp;font=Tahoma&amp;size=18&amp;bold=true&amp;fontColor=%23f24508&amp;backColor=%23ccecff" />';					   
			}else{
				if(document.getElementById('PricePerPax_Top')) {
					document.getElementById('PricePerPax_Top').innerHTML = sPricePerPax;
				}
			}
		
		}
	}
	
	//Start Functions added by Casper Thun 2007/06/28 for multiple rooms on pricing
	var bTotalRoomPricesSet = 0;
	function changeBoardtype(id) {
		var iFoundSelected = 0;
		if(document.getElementById('available_boardtypes')) {
			sSelect = document.getElementById('available_boardtypes')
			for(x=0;x<sSelect.length;x++) {
				for(i=1;i<4;i++) {
					for(y=0;y<32;y++) {
						if(document.getElementById(sSelect[x].value+'_'+i+'_'+y)) {
							document.getElementById(sSelect[x].value+'_'+i+'_'+y).style.display='none';
						}
					}
				}
			}
		}
		for(i=1;i<4;i++) {
			iFoundSelected = 0;
			for(x=0;x<32;x++) {
				if(document.getElementById(id+'_'+i+'_'+x) && document.getElementById('RB_'+i+'_'+x)) {
					if(document.getElementById(id+'_'+i+'_'+x)) {
						document.getElementById(id+'_'+i+'_'+x).style.display='';
					}
					if(iFoundSelected==0 && document.getElementById('RB_'+i+'_'+x)) {
						iFoundSelected = 1;
						document.getElementById('RB_'+i+'_'+x).checked = true;
					}
				}
			}
		}
		bTotalRoomPricesSet = 1;
	}
	//End Functions added by Casper Thun 2007/06/28 for multiple rooms on pricing

/*END PRICING JS */