	/***************************************************
		Page Title functions
	***************************************************/
//	AddLoadEvent(PageTitle);

	function PageTitle() {
		var objPT;
		
		//use a pagetitleoverride hidden element to override any title inserted by content
		objPT = document.getElementById('pagetitleoverride');
		
		//this is the title inserted into xxPageTitlexx
		if (!objPT) objPT = document.getElementById('pagetitle');
		
		if (objPT) {
			//prepend any title to title already there (avoids claims of cloaking keywords)
			var strTitle = objPT.value;
			if (strTitle != '') document.title = strTitle + ' | ' + document.title;
		}
	}


	/***************************************************
		Region map functions
	***************************************************/
	function RegionHover(objLink, blnShow) {
		var strType, strID, re;

		re = /^([a-z]+)([0-9]+)$/gi;
		strType = objLink.id.replace(re, '$1');
		strID = objLink.id.replace(re, '$2');

		var objOtherLink;
		var astrTypes = ['target']; // 'link' and  'area' not required

		for (var i = 0; i < astrTypes.length; i++) {
			objOtherLink = document.getElementById(astrTypes[i] + strID);

			if (objOtherLink) {
				if (blnShow)   {  objOtherLink.style.visibility = "visible"; 	}
				else  { objOtherLink.style.visibility = "hidden"; 	}
				objOtherLink.className = AddRemoveClass(objOtherLink.className, 'region-over', blnShow)
			}
		}
	}

	function AddRemoveClass(strClassName, strClassToAdd, blnAdd) {
		if (blnAdd) {
			if (strClassName.indexOf(' ' + strClassToAdd) == -1) strClassName += ' ' + strClassToAdd;
		} else {
			strClassName = strClassName.replace(' ' + strClassToAdd, '');
		}
//alert(strClassName);


		return strClassName;
	}

	/***************************************************
		Weather popup functions
	***************************************************/
	function DayTxt (DayNumber) {
		var Day=new Array();
		Day[0]="sun";
		Day[1]="mon";
		Day[2]="tue";
		Day[3]="wed";
		Day[4]="thu";
		Day[5]="fri";
		Day[6]="sat";
		return Day[DayNumber];
	}

	function daypage() {
		var Today=new Date();
		var ThisDay=Today.getDay();

		var DayName=DayTxt(ThisDay);

		var dayurl="http://www.g-fisher.demon.co.uk/met/"+DayName+"frame.htm";

		//window.open(dayurl,"","height=450,width=623,scrollbars=yes");
		return popup(dayurl, 'WeatherPopup', 640, 400, 'yes');
	}


	/***************************************************
		Popup support functions
	***************************************************/
	function PopupClick() {
		var aClasses;
		aClasses = this.className.toString().split(' ');
		
		for (var i = 0; i < aClasses.length; i++) {
			switch(aClasses[i]) {
			case 'popupLogo':
				popupLogoInfo(aClasses[i]); break;
			default:
				return false;
			}
		}
	}

	function popup(url, title, width, height, scroll) {
		var s = 'menubar=no,toolbar=no,location=yes,resizable=yes,status=yes,dependent=yes'
		s += ',scrollbars=' + scroll
		s += ',width=' + width + ',height=' + height;
		s += ',top=' + (screen.availHeight - height) / 2 + ',left=' + (screen.availWidth - width) / 2;

		//close existing window
		try {
			if (navigator.newwindow && navigator.newwindow.close) navigator.newwindow.close();
		}
		catch(e) {}
		
		//save new window object in navigator object and activate
		navigator.newwindow = self.open(url, title, s);
		navigator.newwindow.focus();
		
		return false;
	}

	function popupLogoInfo(strTarget) {
		return popup('', strTarget, 600, 400, 'yes');
	}

	function popupWeatherInfo() {
		return popup('', 'WeatherPopup', 640, 480, 'yes');
	}

	function CloseWindow() {
		window.close();
		navigator.newwindow = null;
		if (window.opener)
			if (!window.opener.closed)
				window.opener.focus();
	}

	function addPopupEvents() {
		document.onkeydown = KeyDown;
		
		if (window.self.location != window.top.location) {
			addEvent(window, 'load', HideCloseLinks);
		}
	}

	function HideCloseLinks() {
		var objCloseLink;
		objCloseLink = document.getElementById('close-top');
		if (objCloseLink) objCloseLink.style.display = 'none';
		objCloseLink = document.getElementById('close-bottom');
		if (objCloseLink) objCloseLink.style.display = 'none';
	}

	function KeyDown(e) {
		if (e && e.which == 27) CloseWindow(); //Netscape
		else if (event && event.keyCode == 27) CloseWindow(); //IE
	}

	/***************************************************
		Refine search functions
	***************************************************/
//	var objTimeout = null;
//	function RefineSearch(objElement) {
//		//if (objElement) objElement.form.submit();
//		if (objTimeout) window.clearTimeout(objTimeout);
//		objTimeout = window.setTimeout('SubmitRefineSearch()', 2000);
//	}

//	function SubmitRefineSearch() {
//		document.refinesearch.submit();
//	}

	/***************************************************
		Add onload function
	***************************************************/
	function AddLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
			} 
		else {
			window.onload = function() {
				oldonload();
				func();
				}
			}
		}

	function checkSForm(theform)   {
		var msg="";
		if (theform.area.selectedIndex==0)   {
			msg="Please select an Area..\n";
			}			
		if (theform.partysize.selectedIndex==0)   {
			msg=msg+"Please select a valid Party Size..\n";
			}			
		if (theform.duration.selectedIndex==0&&theform.week.selectedIndex>0)   {
			msg=msg+"You have selected a Start Week, you must also select a Duration..\n";
			}			
		if (theform.duration.selectedIndex>0&&theform.week.selectedIndex==0)   {
			msg=msg+"You have selected a Duration, you must also select a Start Week..\n";
			}			
		if (msg!="") { alert(msg); return false; }
		else   {
			showPleaseWaitB();
			return true; 
			}
		}

	function checkEnews(theform)   {
		var msg="";
		email=theform.emailaddress.value;
		if (email==""||((email.indexOf("@") == -1)||email.indexOf(".") == -1)) { 
			msg=msg+"Your Email Address is either missing or in an invalid format...\n"; 
			}
		if (msg!="") { alert(msg); return false; }
		else  { 
theform.action = document.getElementById('destination').value;
return true;
 }
		}

	// checks email-a-friend form filled out correctly
	function CheckEmailFriend(theform)   {
		var msg="";
		if (theform.yourname.value=="") { msg=msg+"Your Name is missing...\n";   }
		email=theform.email.value;
		if (email==""||((email.indexOf("@") == -1)||email.indexOf(".") == -1)) { 
			msg=msg+"Your Friend's Email Address is either missing or in an invalid format...\n"; 
			}
		if (msg!="") { alert(msg + "\nPlease enter the information"); return false; }
		else  { 
theform.action = document.getElementById('destination').value;
return true; 
}
		}


	// func to preset the a select box to the correct value
	function presetSearchBoxes()  {
		var strSearchConf="", objecttype, shortbreakflag;
		doc=document.parameterlist;
		if (location.href.indexOf('search-results',1) > -1)  {
			// only execute this if the form 'parameterlist' exists
			if (doc!=undefined)   {
				shortbreakflag=doc.shortbreaksearch.value
				// not displaying new cottages 
				if (doc.newcottage.value=="0")  { 
					if (shortbreakflag=="1")  { objecttype="SHORT BREAKS"; }
					else  { objecttype="PROPERTIES"; }
					if (doc.area.value=="0")  { 	
						strSearchConf = "<b>You searched for " + objecttype + "</b> in <b>All Areas</b>";	
						document.search.area.selectedIndex=0;
						}
					else   {  strSearchConf = setselectedvalue("area","<b>You searched for " + objecttype + "</b> in ",0); 	}
					}				
				switch (doc.partysize.value)   {
					case "8-10": strSearchConf = strSearchConf + " with a party size of <b>8 to 10 people</b>.";
								 break;
					case "10plus": strSearchConf = strSearchConf + " with a party size of <b>10 or more people</b>.";
								 break;
					default: strSearchConf = strSearchConf + setselectedvalue("partysize",", with a party size of ",1);
					}
				if (shortbreakflag=="1")  { strSearchConf = strSearchConf + ", for a duration of <b>" + doc.duration.value + " night(s)<b>"; }
				else   {  strSearchConf = strSearchConf + setselectedvalue("duration",", for a duration of ",1);  }
				strSearchConf = strSearchConf + setselecteddatevalue();
				if (doc.couples.value=="1")  { 	strSearchConf = strSearchConf + " which are suitable for couples.";  }
				if (doc.deluxe.value=="1")  { 	strSearchConf = strSearchConf + " which are Deluxe.";  }
				if (doc.twopersondiscount.value=="1")  { 	strSearchConf = strSearchConf + " which have a 2-person discount.";  }
				}
			if (location.href.indexOf('seasonalofferYN=1',1) == -1) document.getElementById("confidisplaytext").innerHTML=strSearchConf;
			}
		}

	function setselecteddatevalue()  {
		var selindex, strSearchConf;
		selvalue=document.parameterlist.week.value;
		if (selvalue=="00:00:00")   { strdisplaytext=""; }
		else   {
			felement=document.search.week;
			i=0, endloop=0;
			while (i<felement.length && endloop==0)   {
				if (felement.options[i].value==selvalue)  {  
					selindex=i, endloop=1;
					strSearchConf = felement.options[i].text;
					}
				i++;
				}
			felement.selectedIndex=selindex;
			if (strSearchConf!=undefined)   { 
				if (selvalue.substring(8,10)=='01')   {
					thisday=Number(selvalue.substring(8,10));
					prevmonth=monthName[Number(selvalue.substring(5,7)-1)-1];
					thismonth=monthName[Number(selvalue.substring(5,7))-1];
					switch (prevmonth)   {
						case "Jan":
						case "Mar":
						case "May":
						case "Jul":
						case "Aug":
						case "Oct":
						case "Dec":
								prevday = 31;
								break;
						case "Feb": prevday=28;
								break;
						case "Apr":
						case "Jun":
						case "Sep":
						case "Nov":
								prevday = 30;
								break;
						}

					if (strSearchConf.substring(0,3)=="Wed")   {
						strSearchConf="Weds " + thisday + " " + thismonth;
						}
                                        else if (strSearchConf.substring(0,3)=="Sun") {
						strSearchConf="Sunday " + thisday + " " + thismonth;

					} 
					else if (strSearchConf.substring(0,3)=="Mon") {
						strSearchConf="Monday " + thisday + " " + thismonth;

					} 
					else if (strSearchConf.substring(0,3)=="Tue") {
						strSearchConf="Tuesday " + thisday + " " + thismonth;

					} 
					else   {
						strSearchConf="Fri/Sat " + prevday + " " + prevmonth + "/" + thisday + " " + thismonth;
						}
					}
				else  {
					prevday=Number(selvalue.substring(8,10)) - 1;
					thisday=Number(selvalue.substring(8,10));
					thismonth=monthName[Number(selvalue.substring(5,7))-1];
					if (strSearchConf.substring(0,3)=="Wed")   {
						strSearchConf="Weds " + thisday + " " + thismonth;
						}
					else if (strSearchConf.substring(0,3)=="Sun") {
						strSearchConf="Sunday " + thisday + " " + thismonth;

					} 
					else if (strSearchConf.substring(0,3)=="Mon") {
						strSearchConf="Monday " + thisday + " " + thismonth;

					} 
					else if (strSearchConf.substring(0,3)=="Tue") {
						strSearchConf="Tuesday " + thisday + " " + thismonth;

					} 

					else   {
						strSearchConf="Fri/Sat " + prevday + "/" + thisday + " " + thismonth;
						}
					}
				strdisplaytext=", starting on <b>"+strSearchConf+"</b>";  
				}
			else {  
				// must be short break starting date
				strSearchConf=selvalue.substring(8,10)+" "+monthName[Number(selvalue.substring(5,7))-1]+" "+selvalue.substring(0,4);
				strdisplaytext=", starting on <b>"+strSearchConf+"</b>";
				}
			}
		return strdisplaytext;
		}

	function setselectedvalue(elementname,strdisplaytext,usevalue)  {
		var selindex, strSearchConf;
		eval("selvalue=document.parameterlist."+elementname+".value;");
		eval("felement=document.search."+elementname+";");
		i=0, endloop=0;
		if (usevalue==0)   {
			strSearchConf = selvalue;
			while (i<felement.length && endloop==0)   {
				if (felement.options[i].text==selvalue)  selindex=i, endloop=1;
				i++;
				}
			}
		else   {
			while (i<felement.length && endloop==0)   {
				if (felement.options[i].value==selvalue)  {  
					selindex=i, endloop=1;
					strSearchConf = felement.options[i].text;
					}
				i++;
				}
			}
		felement.selectedIndex=selindex;
		if (strSearchConf!=undefined)   { strdisplaytext=strdisplaytext+"<b>"+strSearchConf+"</b>";  }
		else { strdisplaytext=""; }
		return strdisplaytext;
		}

	function addAreaToRefineSearch(form_object, params_object) {
		var result = "";
		var noAreaRefinement = "&area="; //+ params_object.areaqstring.value
		if(form_object.area_52) {
			if(form_object.area_52.value != "" && form_object.area_52.value != "0") result = "&area=" + form_object.area_52.value;
			else result = noAreaRefinement;
		} else result = noAreaRefinement;
		return result;
	}
	
	function addAreaToRefineSearchBargain(form_object, params_object) {
		var result = "";
		var noAreaRefinement = "&area="; //+ params_object.areaqstring.value
		if(form_object.area) {
			if(form_object.area.value != "" && form_object.area.value != "0") result = "&area=" + form_object.area.value;
			else result = noAreaRefinement;
		} else result = noAreaRefinement;
		return result;
	}


	function addExtraFiltersToRefineSearch(form_object) {
		var result = "";
		var noExtraRefinement = "&lakeseaview=0&inetaccess=0";
		if(form_object.lakeseaview) {
			if(form_object.lakeseaview.checked == true) result += "&lakeseaview=1";
			else result += "&lakeseaview=0";
		}
		if(form_object.inetaccess) {
			if(form_object.inetaccess.checked == true) result += "&inetaccess=1";
			else result += "&inetaccess=0";
		}
		if(result == "") return noExtraRefinement;
		else return result;
	}

	// func to submit from the advanced search form
	function refinesearch()   {
		var qsadd="dorefined=1";
		docP=document.parameterlist;
		SBsearch=docP.shortbreaksearch.value;
		if (SBsearch=="1") showPleaseWaitB();
		else showPleaseWait(183,181);
		

		qsadd=qsadd+"&specialoffer="+docP.specialoffer.value;
		

		docA=document.advancedsearch;
		week=docA.week.value;
		qsadd=qsadd+"&week="+week;
		duration=docA.duration.value;
		qsadd=qsadd+"&duration="+duration;
		fromcottagessuitableforwithpets=docA.fromcottagessuitableforwithpets.value;
		qsadd=qsadd+"&fromcottagessuitableforwithpets="+fromcottagessuitableforwithpets;
		if (fromcottagessuitableforwithpets=="0") {  if (docA.petsallowed.checked==true) qsadd=qsadd+"&petsallowed=1";  }
		if (docA.enclosedgarden.checked==true)  qsadd=qsadd+"&enclosedgarden=1";
		if (docA.smokingallowed.checked==true)  qsadd=qsadd+"&smokingallowed=1";
		if (docA.openfire.checked==true)  qsadd=qsadd+"&openfire=1";
		if (docA.groundfloor.checked==true)  qsadd=qsadd+"&groundfloor=1";
		if (docA.pub1mile.checked==true)  qsadd=qsadd+"&pub1mile=1";
		qsadd=qsadd+"&minbathrooms="+docA.minbathrooms.options[docA.minbathrooms.selectedIndex].value;
		qsadd=qsadd+"&minbedrooms="+docA.minbedrooms.options[docA.minbedrooms.selectedIndex].text;
		// tests if partysize is showing in the advanced search
		//	- if not pass partysize1 through so we can eventually preselect the LH search box 
		if (docA.partysize!=undefined)  {
			partysize1="";
			partysize=docA.partysize.options[docA.partysize.selectedIndex].value;
			}
		else   {
			partysize="";
			partysize1=docA.partysizehidden.value;
			}
		qsadd=qsadd+"&partysize="+partysize;
		qsadd=qsadd+"&partysize1="+partysize1;
		if (document.orderbyform!=undefined)   {
			docO=document.orderbyform;
			if (docO.orderby!=undefined) qsadd=qsadd+"&orderby="+docO.orderby.options[docO.orderby.selectedIndex].text;
			}
		qsadd=qsadd+"&shortbreaksearch="+SBsearch;
		if (docP.couples.value=="1") qsadd=qsadd+"&couples=1";
		if (docP.deluxe.value=="1") qsadd=qsadd+"&deluxe=1";
		if (docP.twopersondiscount.value=="1") qsadd=qsadd+"&twopersondiscount=1";
		if (docP.newcottage.value=="1") qsadd=qsadd+"&newcottage=1";
		if (docP.seasonalofferYN.value=="1") qsadd=qsadd+"&seasonalofferYN=1";
		if (docP.initpageOverride.value=="1") qsadd=qsadd+"&initpageOverride=1";
//		if (docP.d_durationwindow.value!="0")  { qsadd=qsadd+"&d_durationwindow="+docP.d_durationwindow.value;  }
		qsadd += addExtraFiltersToRefineSearch(docA);

		if (window.location.href.indexOf('northumbrian-cottages.aspx')>0){
			URL="northumbrian-cottages.aspx?"+qsadd;
		}
		else{
			qsadd += addAreaToRefineSearch(docA, docP);
			URL="search-results.aspx?"+qsadd;
		}

		window.location=URL;
		}
		
		function refinesearch2()   {
		var qsadd="dorefined=1";
		docP=document.parameterlist;
		SBsearch=docP.shortbreaksearch.value;
		if (SBsearch=="1") showPleaseWaitB();
		else showPleaseWait(183,181);
		
		qsadd=qsadd+"&specialoffer="+docP.specialoffer.value;
		
		docA=document.advancedsearch;
		
		week=docA.week.value;
		
		qsadd=qsadd+"&week="+week;
		
		duration=docA.duration.value;
		qsadd=qsadd+"&duration="+duration;
		fromcottagessuitableforwithpets=docA.fromcottagessuitableforwithpets.value;
		qsadd=qsadd+"&fromcottagessuitableforwithpets="+fromcottagessuitableforwithpets;
		if (fromcottagessuitableforwithpets=="0") {  if (docA.petsallowed.checked==true) qsadd=qsadd+"&petsallowed=1";  }
		if (docA.enclosedgarden.checked==true)  qsadd=qsadd+"&enclosedgarden=1";
		if (docA.smokingallowed.checked==true)  qsadd=qsadd+"&smokingallowed=1";
		if (docA.openfire.checked==true)  qsadd=qsadd+"&openfire=1";
		if (docA.groundfloor.checked==true)  qsadd=qsadd+"&groundfloor=1";
		if (docA.pub1mile.checked==true)  qsadd=qsadd+"&pub1mile=1";
		qsadd=qsadd+"&minbathrooms="+docA.minbathrooms.options[docA.minbathrooms.selectedIndex].value;
		qsadd=qsadd+"&minbedrooms="+docA.minbedrooms.options[docA.minbedrooms.selectedIndex].text;
		// tests if partysize is showing in the advanced search
		//	- if not pass partysize1 through so we can eventually preselect the LH search box 
		if (docA.partysize!=undefined)  {
			partysize1="";
			partysize=docA.partysize.options[docA.partysize.selectedIndex].value;
			}
		else   {
			partysize="";
			partysize1=docA.partysizehidden.value;
			}
		qsadd=qsadd+"&partysize="+partysize;
		qsadd=qsadd+"&partysize1="+partysize1;
		if (document.orderbyform!=undefined)   {
			docO=document.orderbyform;
			if (docO.orderby!=undefined) qsadd=qsadd+"&orderby="+docO.orderby.options[docO.orderby.selectedIndex].text;
			}
		qsadd=qsadd+"&shortbreaksearch="+SBsearch;
		if (docP.couples.value=="1") qsadd=qsadd+"&couples=1";
		if (docP.deluxe.value=="1") qsadd=qsadd+"&deluxe=1";
		if (docP.twopersondiscount.value=="1") qsadd=qsadd+"&twopersondiscount=1";
		if (docP.newcottage.value=="1") qsadd=qsadd+"&newcottage=1";
		if (docP.seasonalofferYN.value=="1") qsadd=qsadd+"&seasonalofferYN=1";
		if (docP.initpageOverride.value=="1") qsadd=qsadd+"&initpageOverride=1";
//		if (docP.d_durationwindow.value!="0")  { qsadd=qsadd+"&d_durationwindow="+docP.d_durationwindow.value;  }
		qsadd += addExtraFiltersToRefineSearch(docA);

		if (window.location.href.indexOf('northumbrian-cottages.aspx')>0){
			URL="northumbrian-cottages.aspx?"+qsadd;
		}
		else{
			qsadd += addAreaToRefineSearch(docA, docP);
			URL="search-results.aspx?"+qsadd;
		}

		window.location=URL;
		}

	// func to submit from the advanced search form when in the Late Bargains page
	function refinesearchLB_SP()   {
		var qsadd="";
		showPleaseWait(183,221);
		docA=document.advancedsearch;
		if (docA.petsallowed.checked==true)  { qsadd=qsadd+"&petsallowed=1";  }
		if (docA.enclosedgarden.checked==true)  { qsadd=qsadd+"&enclosedgarden=1";  }
		if (docA.smokingallowed.checked==true)  { qsadd=qsadd+"&smokingallowed=1";  }
		if (docA.openfire.checked==true)  { qsadd=qsadd+"&openfire=1";  }
		if (docA.groundfloor.checked==true)  { qsadd=qsadd+"&groundfloor=1";  }
		if (docA.pub1mile.checked==true)  { qsadd=qsadd+"&pub1mile=1";  }
		qsadd=qsadd+"&minbathrooms="+docA.minbathrooms.options[docA.minbathrooms.selectedIndex].value;
		qsadd=qsadd+"&minbedrooms="+docA.minbedrooms.options[docA.minbedrooms.selectedIndex].text;
		partysize=docA.partysize.options[docA.partysize.selectedIndex].value;
		docO=document.orderbyform;
		qsadd=qsadd+"&orderby="+docO.orderby.options[docO.orderby.selectedIndex].text;
		qsadd=qsadd+"&numweeks="+docO.numweeks.value;
		docP=document.parameterlist;
		qsadd += addAreaToRefineSearch(docA, docP);
		qsadd += addExtraFiltersToRefineSearch(docA);		
		week=docP.week.value;
		weeknum=docP.weeknum.value;
//		durationwindow=docP.durationwindow.value;
		URL="late-bargains-results.aspx?dorefined=1&doLateBargainSearch=1&partysize="+partysize+"&week="+week+"&weeknum="+weeknum+qsadd;
		window.location=URL;
		}
		
		// func to submit from the advanced search form when in the Late Bargains page
	function refinesearchLB_SPBargain()   {
		var qsadd="";
		showPleaseWait(183,221);
		docA=document.advancedsearch;
		if (docA.petsallowed.checked==true)  { qsadd=qsadd+"&petsallowed=1";  }
		if (docA.enclosedgarden.checked==true)  { qsadd=qsadd+"&enclosedgarden=1";  }
		if (docA.smokingallowed.checked==true)  { qsadd=qsadd+"&smokingallowed=1";  }
		if (docA.openfire.checked==true)  { qsadd=qsadd+"&openfire=1";  }
		if (docA.groundfloor.checked==true)  { qsadd=qsadd+"&groundfloor=1";  }
		if (docA.pub1mile.checked==true)  { qsadd=qsadd+"&pub1mile=1";  }
		qsadd=qsadd+"&minbathrooms="+docA.minbathrooms.options[docA.minbathrooms.selectedIndex].value;
		qsadd=qsadd+"&minbedrooms="+docA.minbedrooms.options[docA.minbedrooms.selectedIndex].text;
		partysize=docA.partysize.options[docA.partysize.selectedIndex].value;
		docO=document.orderbyform;
		qsadd=qsadd+"&orderby="+docO.orderby.options[docO.orderby.selectedIndex].text;
		qsadd=qsadd+"&numweeks="+docO.numweeks.value;
		docP=document.parameterlist;
		qsadd += addAreaToRefineSearchBargain(docA, docP);
		qsadd += addExtraFiltersToRefineSearch(docA);		
		week=docP.week.value;
		weeknum=docP.weeknum.value;
//		durationwindow=docP.durationwindow.value;
		URL="late-bargains-results.aspx?dorefined=1&doLateBargainSearch=1&partysize="+partysize+"&week="+week+"&weeknum="+weeknum+qsadd;
		window.location=URL;
		}


	// func to submit from the advanced search form when in the Late Bargains page
	function refinesearchLB()   {
		var qsadd="";
		showPleaseWait(183,221);
		docA=document.advancedsearch;
		if (docA.petsallowed.checked==true)  { qsadd=qsadd+"&petsallowed=1";  }
		if (docA.enclosedgarden.checked==true)  { qsadd=qsadd+"&enclosedgarden=1";  }
		if (docA.smokingallowed.checked==true)  { qsadd=qsadd+"&smokingallowed=1";  }
		if (docA.openfire.checked==true)  { qsadd=qsadd+"&openfire=1";  }
		if (docA.groundfloor.checked==true)  { qsadd=qsadd+"&groundfloor=1";  }
		if (docA.pub1mile.checked==true)  { qsadd=qsadd+"&pub1mile=1";  }
		qsadd=qsadd+"&minbathrooms="+docA.minbathrooms.options[docA.minbathrooms.selectedIndex].value;
		qsadd=qsadd+"&minbedrooms="+docA.minbedrooms.options[docA.minbedrooms.selectedIndex].text;
		partysize=docA.partysize.options[docA.partysize.selectedIndex].value;
		docO=document.orderbyform;
		qsadd=qsadd+"&orderby="+docO.orderby.options[docO.orderby.selectedIndex].text;
		docP=document.parameterlist;
		weeknum=docP.weeknum.value;
//		durationwindow=docP.durationwindow.value;
		URL="late-bargains-results.aspx?dorefined=1&doLateBargainSearch=1&partysize="+partysize+"&weeknum="+weeknum+qsadd;
		window.location=URL;
		}


	// func to proceed from 'cottages suitable for' page to search-results.aspx
	function dosearch (checkbox)   {
		showPleaseWait(300,152);
		window.location="search-results.aspx?fromcottagessuitablefor=1&"+checkbox.name+"="+checkbox.value;
		}

	// email-friend popup
	function ef_popup(productID)  {
		URL = "email-friend.aspx?productid=" + productID;
		winwidth = 600;
		winheight = 425;
		day = new Date();
		id = day.getTime();
		pleft=(screen.width-winwidth)/2;
		ptop=(screen.height-winheight)/2;
		eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+winwidth+",height="+winheight+",left="+pleft+",top="+ptop+"');");
		}

	// general-purpose popup
	function gpopup(URL, winwidth, winheight, scroll) {
		day = new Date();
		id = day.getTime();
		pleft=(screen.width-winwidth)/2;
		ptop=(screen.height-winheight)/2;
		eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars="+scroll+",location=0,statusbar=0,menubar=0,resizable=1,width="+winwidth+",height="+winheight+",left="+pleft+",top="+ptop+"');");
		}

	// confirming user wishes to clear favs
	function checkClearFavs(hbid)   {
		if (confirm("Are you sure you want to clear all your Favourites?"))   {
			window.location="clear-favourites.aspx?cmd=clear&hbid="+hbid;
			}
		}

	// sets the querystring startdate param and appends to late-bargains-results.aspx link
// not used - CC now setting start date manually
/*
	function set_late_bargain_startdate()   {
		var Today=new Date();
		var intADay = 24 * 60 * 60 * 1000;
		var intCurrentMilliseconds = Today.getTime();
		var intSaturday = 6;
		var intDaysUntilSaturday= intSaturday - Today.getDay();
		intNextSaturday = intCurrentMilliseconds + (intDaysUntilSaturday * intADay);
		dtSaturday = new Date(intNextSaturday) ;
		strday=String(dtSaturday.getDate());
		if (strday.length==1) { strday="0" + strday; } 		
		strmonth=String(dtSaturday.getMonth()+1);
		if (strmonth.length==1) { strmonth="0" + strmonth; } 		
		theyear=dtSaturday.getFullYear();		
		window.location="late-bargains-results.aspx?week="+theyear+"-"+strmonth+"-"+strday;
		}
*/


// this function disabled - done this way to avoid removing func call from everywhere on site

	function showPleaseWait(leftpos, toppos)   {
//		strleft=leftpos.toString()+"px";
//		strtop=toppos.toString()+"px";
//		document.getElementById("pleaseWait").style.paddingLeft=strleft;
//		document.getElementById("pleaseWait").style.top=strtop;
//		document.getElementById("pleaseWait").className="show";


// yes, this is identical to the function below - don't ask why !
		strleft="320px";
		strtop="200px";
		document.getElementById("pleaseWait").style.paddingLeft=strleft;
		document.getElementById("pleaseWait").style.top=strtop;
		setTimeout("makeWaitVisible();",3000);
		}

	// this func called by short breaks search and late bargains
	function showPleaseWaitB()   {
		strleft="320px";
		strtop="200px";
		document.getElementById("pleaseWait").style.paddingLeft=strleft;
		document.getElementById("pleaseWait").style.top=strtop;
		setTimeout("makeWaitVisible();",3000);
		}

	function makeWaitVisible()   {
		document.getElementById("pleaseWait").className="show";
		}


function populateselectarea (selectedarea, options){
//alert(options);
//alert(options.length);
	for(i = 0; i < options.length; i++)	{
//	    alert("o" + i.toString()  + options[i].value);
//	    alert("s:" + selectedarea);
//	    alert(options[i].value == selectedarea);
		if (options[i].value == selectedarea) {
//		alert("found it");
			options.selectedIndex = i;    
		}   
	}
}

