<!--

// Global JavaScript Library
// Copyright 2008 CSI Manchester Ltd - All Rights Reserved

//function clickIE() {if (document.all) {return false;}}
//
//function clickNS(e) {
//	if (document.layers||(document.getElementById&&!document.all)) {
//		if (e.which==2||e.which==3) {return false;}
//	}
//}
//
//if (document.layers) 
//{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
//else{document.onmouseup=clickIE;document.oncontextmenu=clickIE;}
//
//
//document.oncontextmenu=new Function("return false")

// Browser sniffer
var ns4 = (document.layers); 
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

var urlAddress = "http://www.travelandmore.co.uk";
var pageName = "TravelandMore.co.uk";
function addToFavorites(sOverideURL) {
	if (window.external) {
		//if(sOverideURL){
		//	window.external.AddFavorite(sOverideURL,pageName)
		//}else{
			window.external.AddFavorite(urlAddress,pageName)
		//}
		 
	}else{
		alert("Sorry! Your browser doesn't support this function."); 
	}
}

function GotoOffer(url) {
	writeInDiv('Searching offers','waitMessage');
	//document.getElementsByTagName("body")[0].style.background='none';
	div_switch('divWebsite',false,true);
	div_switch('divPleasewait',true,true);
	window.setInterval('scrollBar()', 40);
	location.href=url;
}

function OpenSearch() {
	if(document.getElementById('DivLocations')) {
		showhidechangeoptions('show');
	}
}

function showRoomPlan(idForm) {
	if (idForm == null) {
		formid = '';
	}else{
		formid = idForm;
	}
	vRooms = parseInt(document.getElementById('rooms'+formid).value);
	oDonePressed = document.getElementById('donePressed'+formid);
	if(document.getElementById('roomPlan'+formid)) {
		oRoomPlan = document.getElementById('roomPlan'+formid);
	}
	if (!vRooms == 0) {
		if(document.getElementById('roomPlan'+formid)) {
			div_switch('roomPlan'+formid, true, true);
		}
		if(document.getElementById('donePressed'+formid)) {
			document.getElementById('donePressed'+formid).value = '0';
		}
	} else {
		if (oRoomPlan.style.display == 'block') {
			if(document.getElementById('roomPlan'+formid)) {
				div_switch('roomPlan'+formid, false, true);
			}
		} else {
			if (parseInt(oDonePressed.value) == 0) {
				alert("Select the number of rooms before choosing passengers");	
			} else {
				if(document.getElementById('donePressed'+formid)) {
					document.getElementById('donePressed'+formid).value = '0';
				}
			}
		}
	}
}

/* Start functions relating to MultipleRoomTypes */
function updateRooms(control, maxRooms, idForm) {
	
	if (idForm == null) {
		formid = '';
	}else{
		formid = idForm;
	}
	
	if (control) {
		if(parseInt(control.selectedIndex)==4) {
			if(confirm('For more than 3 rooms please contact our groups department on 01733 324539\nand recive a groups discount, alternatively email your enquiry to us.\n\nDo you want to email us now?')){
				location.href='/contact.asp';
			}
		}else{
			var iRooms = parseInt(control.options[control.selectedIndex].value);
			if (!iRooms == 0) {
				
				for (var iRoom=1;iRoom<=maxRooms;iRoom++) {
					var obj = document.getElementById('trRoom'+iRoom+'Values'+formid)
					var obj2 = document.getElementById('trRoom'+iRoom+'Ages'+formid)
					vAgeControl = parseFloat(document.getElementById('ageControl'+iRoom+formid).value);
					if (obj) {
						if (iRoom > iRooms) {
							obj.style.display = 'none';
						} else {
							obj.style.display = 'block';
						}
					}			
					if (obj2) {
						if (iRoom > iRooms) {
							obj2.style.display = 'none';
						} else {
							if (!vAgeControl == 0) {
								obj2.style.display = 'block';
							}
						}
					}				
				}		
			}	
			showRoomPlan(formid);
		}
	}
}

function hideRoomPlan(idForm) {
	if (idForm == null) {
		formid = '';
	}else{
		formid = idForm;
	}
	vRooms = parseInt(document.getElementById('rooms'+formid).value);
	if(document.getElementById('roomPlan'+formid)) {
		div_switch('roomPlan'+formid, false, true);
	}
	if(document.getElementById('donePressed'+formid)) {
		document.getElementById('donePressed'+formid).value = '1';
	}
}




function updatePax2(id, type, idForm) {
	if (idForm == null) {
		formid = '';
	}else{
		formid = idForm;
	}
	vPerson = parseFloat(document.getElementById('r'+id+type+formid).value);
	vAgeControl = parseFloat(document.getElementById('ageControl'+id+formid).value);
	var objAges = document.getElementById('trRoom'+id+'Ages'+formid);
	for(i=1;i<10;i++) {
		if(document.getElementById('r'+id+type+'_ages'+i+formid)) {
			if(i>vPerson) {
				div_switch('r'+id+type+'_ages'+i+formid,false,true);
			}else{
				var personFound = 'yes'
				div_switch('r'+id+type+'_ages'+i+formid,true,true);
			}
		}
	}
	if (personFound == 'yes') {
		if (document.getElementById('s'+type.toUpperCase()+'Ages'+id+formid).style.display == "none") {
			vAgeControl = vAgeControl + 1
		}
		div_switch('s'+type.toUpperCase()+'Ages'+id+formid,true,true);
	}else{
		if (document.getElementById('s'+type.toUpperCase()+'Ages'+id+formid).style.display == "block") {
			vAgeControl = vAgeControl - 1
		}
		div_switch('s'+type.toUpperCase()+'Ages'+id+formid,false,true);
	}
	if ((vAgeControl == 0) && (objAges)) {		
		div_switch('trRoom'+id+'Ages'+formid,false,true);	
	} else {
		if (objAges) {
			div_switch('trRoom'+id+'Ages'+formid,true,true);		
		}
	}
	document.getElementById('ageControl'+id+formid).value = vAgeControl;
		
}


// Attaches objects dependent on browser
function object_attach(id)
{
	var obj;
	if(ns4) obj = document.layers[id];
	else if(ie4) obj = document.all[id];
	else if(ie5 || ns6) obj = document.getElementById(id);
	return obj;
}

function switchTab(tabid,type)
{
var seltab = document.getElementById('seltab').value;
	if(type=='on' && tabid!=seltab){
		document.getElementById('tabico'+tabid).src='/images/common/wsquare_ico.gif';
	}
	if(type=='off' && tabid!=seltab){
		document.getElementById('tabico'+tabid).src='/images/common/bsquare_ico.gif';
	}
	writeMenuText(tabid);
}

function CTOpenWindow(sURL,sName,sWidth,sHeight) { 
	newwindow = window.open(sURL, sName, "height="+sHeight+",width="+sWidth+",scrollbars=yes"); 
	if (window.focus) {newwindow.focus()}
}

function switchSearchForm(searchid)
{
	//hide all forms first
	div_switch('Search1', false, true)
	div_switch('Search2', false, true)
	div_switch('Search3', false, true)
	for(x=1;x<4;x++) {
		if(document.getElementById('searchChoice'+x)) {
			document.getElementById('searchChoice'+x).checked = '';						   
		}
	}
	if(document.getElementById('searchChoice'+searchid)) {
		document.getElementById('searchChoice'+searchid).checked = true;
	}
	//document.getElementById('searchTab1').className='searchNavOff';
	//document.getElementById('searchTab2').className='searchNavOff';
	//document.getElementById('searchTab3').className='searchNavOff';
	//show selected form
	div_switch('Search'+searchid, true, true)
	//document.getElementById('searchTab'+searchid).className='searchNavOn';
}

function switchSearchForm2(searchid)
{
	//hide all forms first
	div_switch('Search1', false, true)
	div_switch('Search2', false, true)
	div_switch('Search3', false, true)
	div_switch('Search4', false, true)
	div_switch('Search5', false, true)
	if(searchid==3||searchid==4||searchid==5) {
		div_switch('Search1Temp', false, true)
	}else{
		div_switch('Search1Temp', true, true)
	}
	document.getElementById('searchTab1').className='searchNavOff';
	document.getElementById('searchTab2').className='searchNavOff';
	document.getElementById('searchTab3').className='searchNavOff';
	document.getElementById('searchTab4').className='searchNavOff';
	document.getElementById('searchTab5').className='searchNavOff';
	//show selected form
	div_switch('Search'+searchid, true, true)
	document.getElementById('searchTab'+searchid).className='searchNavOn';
}

function switchsideSearchForm(searchid)
{
	//hide all forms first
	div_switch('Search1', false, true)
	div_switch('Search2', false, true)
	div_switch('Search3', false, true)
	document.getElementById('sidesearchTab1').className='sidesearchtab1off';
	document.getElementById('sidesearchTab2').className='sidesearchtab2off';
	document.getElementById('sidesearchTab3').className='sidesearchtab3off';
	//show selected form
	div_switch('Search'+searchid, true, true)
	document.getElementById('sidesearchTab'+searchid).className='sidesearchtab'+searchid+'on';
	//document.getElementById('selsearchtab').value == searchid
}

function validateEshoutz(fId) {
	lists = document.getElementsByName('listid');
	var bChecked = false;
	var m = '';
	
	if(!fId.name.value) {m+='- Please enter your name\n'}
	if(!/.+@[^.]+(\.[^.]+)+/.test(fId.email.value) || isValidField(fId.email.value,2) == false){m+='- Please enter a valid email address\n'}
	for(i=0;i<lists.length;i++) {
		if(lists[i].checked==true) {
			bChecked = true;	
		}
	}
	if(bChecked==false) {m+='- Please select at least 1 category\n'}
	
	if(m){
		alert(m);
		return false;		
	}else{
		return true;		
	}
}

// Shows/hides div objects
function div_switch(id, bShow, bBlock)
{
	
	temp_Obj = object_attach(id);
	if(!document.getElementById(id)) { alert('CSI Temporary Test: '+id); }
	if(ns4)
	{
		if(bShow==true)
		{
			if(bBlock==true) { temp_Obj.display = "block"; }
			else { temp_Obj.visibility = "show"; }
		}
		else
		{
			if(bBlock==true) { temp_Obj.display = "none"; }
			else { temp_Obj.visibility = "hide"; }
		}
	}
	else
	{
		if(bShow==true)
		{
			if(bBlock==true) { temp_Obj.style.display = "block"; }
			else { temp_Obj.style.visibility = "visible"; }
		}
		else
		{
			if(bBlock==true) { temp_Obj.style.display = "none"; }
			else { temp_Obj.style.visibility = "hidden"; }
		}
	}
}
function div_switch_auto(id)
{
	temp_Obj = object_attach(id);
	if(!temp_Obj) return;
	temp_Obj.style.display=(temp_Obj.style.display=="none"?"block":"none");
}
function showHideResultItems(id,sHideText,sShowText,bFlash)
{
	var oObjLayer = object_attach("_divHideShow" + id);
	var oObjImg = object_attach("_imgHideShow" + id);
	var oObjHref = object_attach("_hrefHideShow" + id);
	if(!oObjLayer) return;
	if(oObjLayer.style.display == "none")
	{
		if(bFlash==null) { oObjImg.src = "/images/ico_minus.gif"; } else { oObjImg.src = "/images/ico_minusFlash.gif"; }
		oObjHref.innerText = sHideText;
	}
	else
	{
		if(bFlash==null) { oObjImg.src = "/images/ico_plus.gif"; } else { oObjImg.src = "/images/ico_plusFlash.gif"; }
		oObjHref.innerText = sShowText;
	}
	oObjLayer.style.display = (oObjLayer.style.display == "none"?"block":"none");
}
function tabMouseOver(id,className)
{
	temp_Obj = object_attach(id);
	temp_Obj.className = className;
	temp_Obj = object_attach(id+'a');
	if(Right(className, 2)=='00')
		temp_Obj.className = 'white00';
	else
		temp_Obj.className = 'white';
}
// Clears a text field only if the value matches what is passed in
function clearField(fId, sMatch, sChange)
{
	if(sChange == null) sChange = '';
	if(fId.value == sMatch)
	{ fId.value = sChange; }
}
// Similar functionality to ASP Left command
function Left(str, n)
{
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
// Similar functionality to ASP Right command
function Right(str, n)
{
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
// Cross-browser function to change the contents inside a DIV tag
function writeInDiv(text, id)
{
	//alert(text+', '+id);
	if (document.getElementById) { 
		x = document.getElementById(id); x.innerHTML = ''; x.innerHTML = text; 
	}
	else if (document.all) { 
		x = document.all[id]; x.innerHTML = text; 
	}
	else if (document.layers){ 
		x = document.layers[id]; text2 = '<p>' + text + '</p>'; x.document.open(); x.document.write(text2); x.document.close(); 
	}
}

// Shows popup calendar
function showCalendar3(calTitle,calTarget,calInit,calShowDOW)
{
	paramDOW = '';
	if(calShowDOW!=null)
	{ paramDOW = '&updateDOW='+calShowDOW; }
	if(calInit!=null)
	{ calendarWin=window.open("/includes/calendar.asp?initDate=" + eval("document." + calInit + "_d.value") + "/" + eval("document." + calInit + "_m.value") + "/" + eval("document." + calInit + "_y.value") + "&title=" + escape(calTitle) + "&field=" + escape(calTarget) + paramDOW,"calendarWin","width=220,height=200,left=" + ((screen.width-220)/2) + ",top=" + ((screen.height-200)/2) + ",status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no"); }
	else
	{ calendarWin=window.open("/includes/calendar.asp?initDate=" + eval("document." + calTarget + "_d.value") + "/" + eval("document." + calTarget + "_m.value") + "/" + eval("document." + calTarget + "_y.value") + "&title=" + escape(calTitle) + "&field=" + escape(calTarget) + paramDOW,"calendarWin","width=220,height=200,left=" + ((screen.width-220)/2) + ",top=" + ((screen.height-200)/2) + ",status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no"); }
	if(!calendarWin.opener) calendarWin.opener=self;
}

// Opens a popup window
function openPopupWin(popUrl, popWid, popHgt, popScroll, popResize)
{
	popupWin=window.open(popUrl,"popupWin","width=" + popWid + ",height=" + popHgt + ",left=" + ((screen.width-popWid)/2) + ",top=" + ((screen.height-popHgt)/2) + ",status=yes,toolbar=no,menubar=no,scrollbars=" + popScroll + ",resizable=" + popResize);
	if(!popupWin.opener) popupWin.opener=self;
	if (window.focus) {popupWin.focus()}
}

// Print page function
function printPage()
{
	if(window.print)
	{ window.print(); }
	else
	{ alert("Your browser does not support this feature!\nPlease try pressing CTRL + P to print this page."); }
}

// Bookmark page function
function bookmarkPage(url, title)
{
	if (document.all) { window.external.AddFavorite(url, title); } else if (window.sidebar) { window.sidebar.addPanel(title, url, ""); }
}

// Enquiry form validation
function checkEnquiryForm(fId)
{
	if(!/.+@[^.]+(\.[^.]+)+/.test(fId.enqEmail.value) || isValidField(fId.enqEmail.value,2) == false)
	{ alert("Please enter a valid email address before submitting your enquiry!"); fId.enqEmail.focus(); return false; }
	else if(fId.enqTitle.selectedIndex == 0)
	{ alert("Please select a title before submitting your enquiry!"); fId.enqTitle.focus(); return false; }
	else if(fId.enqFirstname.value == '' || fId.enqFirstname.value == '- Firstname -')
	{ alert("Please enter a firstname before submitting your enquiry!"); fId.enqFirstname.focus(); return false; }
	else if(fId.enqSurname.value == '' || fId.enqSurname.value == '- Surname -')
	{ alert("Please enter a surname before submitting your enquiry!"); fId.enqSurname.focus(); return false; }
	else if(fId.enqTelDay.value == '' && fId.enqTelEve.value == '' && fId.enqTelMob.value == '')
	{ alert("Please enter at least one contact telephone number!"); fId.enqTelDay.focus(); return false; }
	else if(fId.enqEnquiry.value == '')
	{ alert("Please enter a valid comment before submitting your enquiry!"); fId.enqEnquiry.focus(); return false; }
	else
	{ return true; }
}

// Checks if field contains valid characters
// 1 - Numeric Integer, 2 - Email, 3 - Numeric Decimals
function isValidField(sText, iType)
{
	if(iType==1)
	{ ValidChars = "0123456789"; }
	else if(iType==2)
	{ ValidChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-@"; }
	else if(iType==3)
	{ ValidChars = "0123456789."; }
	var isValid=true;
	var Char;
	for (i = 0; i < sText.length && isValid == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{ isValid = false; }
	}
	return isValid;
}
function formatCurrency(num)
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '&pound;' + num + '.' + cents);
}
function checkFormPaxTitles(sErrTxt)
{
	oTitleElements = document.getElementsByTagName("select")
	for (i = 0; i < oTitleElements.length; i++)
	{
		if(oTitleElements.item(i).id.indexOf("title") == 0)
		{
			if(oTitleElements.item(i).selectedIndex == 0)
			{ alert(sErrTxt); oTitleElements.item(i).focus(); return false; break; }
		}
	}
	return true;
}
function checkFormFieldSelectedIndex(sFieldName, sErrTxt)
{
	oTitleElements = document.getElementsByTagName("select")
	for (i = 0; i < oTitleElements.length; i++)
	{
		if(oTitleElements.item(i).id.indexOf(sFieldName) == 0)
		{
			if(oTitleElements.item(i).selectedIndex == 0)
			{ alert(sErrTxt); oTitleElements.item(i).focus(); return false; break; }
		}
	}
	return true;
}
function checkFormFieldValue(sFieldName, sDefaultVal, sErrTxt, iMinLen)
{
	if(iMinLen==undefined || iMinLen==null) { iMinLen = 1; }
	oFormElements = document.getElementsByTagName("input")
	for (i = 0; i < oFormElements.length; i++)
	{
		if(oFormElements.item(i).id.indexOf(sFieldName) == 0)
		{
			if(oFormElements.item(i).value == '' || oFormElements.item(i).value == sDefaultVal || oFormElements.item(i).value.length < iMinLen || (sFieldName == 'surname' && oFormElements.item(i).value.indexOf(' ') > -1))
			{ alert(sErrTxt); oFormElements.item(i).focus(); return false; break; }
		}
	}
	oFormElements = document.getElementsByTagName("textarea")
	for (i = 0; i < oFormElements.length; i++)
	{
		if(oFormElements.item(i).id.indexOf(sFieldName) == 0)
		{
			if(oFormElements.item(i).value == '' || oFormElements.item(i).value == sDefaultVal)
			{ alert(sErrTxt); oFormElements.item(i).focus(); return false; break; }
		}
	}
	return true;
}
function checkFormFieldAges(sErrTxt)
{
	oFormElements = document.getElementsByTagName("select")
	for (i = 0; i < oFormElements.length; i++)
	{
		if(oFormElements.item(i).id.indexOf("dob") == 0 && oFormElements.item(i).id.lastIndexOf("d") == 3)
		{
			temp_Obj1 = object_attach(oFormElements.item(i).id);
			temp_Obj1a = Math.abs(temp_Obj1.idmin);
			temp_Obj1b = Math.abs(temp_Obj1.idmax);
			temp_Obj2 = object_attach('dobm' + temp_Obj1.id.substr(4,temp_Obj1.id.length-4));
			temp_Obj3 = object_attach('doby' + temp_Obj1.id.substr(4,temp_Obj1.id.length-4));
			if(checkAge(temp_Obj1a, temp_Obj1b, temp_Obj1, temp_Obj2, temp_Obj3) == false)
			{ alert(sErrTxt + '\nPassenger ' + temp_Obj1.id.substr(4,temp_Obj1.id.length-4) + ' is out of the acceptable age range (' + temp_Obj1a + '-' + parseFloat(temp_Obj1b+1) + 'yrs).'); temp_Obj1.focus(); return false; break; }
		}
	}
	return true;
}

function checkRadio(sFieldName)
{
	oFormElements = document.getElementsByTagName("input")
	for (i = 0; i < oFormElements.length; i++)
	{
		if(oFormElements.item(i).type == "radio" && oFormElements.item(i).name == sFieldName)
		{
			if(oFormElements.item(i).checked)
			{ return oFormElements.item(i).value; break; }
		}
	}
	return '';
}

/* Start functions relating to MultipleRoomTypes */
//function updateRooms(control, maxRooms) {
//	if (control) {
//		var iRooms = parseInt(control.options[control.selectedIndex].value);
//		for (var iRoom=1;iRoom<=maxRooms;iRoom++) {
//			var obj = document.getElementById('trRoom'+iRoom)
//			if (obj) {
//					if (iRoom > iRooms) {
//						obj.style.display = 'none';
//					} else {
//						obj.style.display = 'block';
//					}
//			}
//			
//			var obj = document.getElementById('trRoom'+iRoom+'Values')
//			if (obj) {
//					if (iRoom > iRooms) {
//						obj.style.display = 'none';
//					} else {
//						obj.style.display = 'block';
//					}
//			}
//			
//			/*var obj = document.getElementById('trRoom'+iRoom+'Ages');
//			if (obj) {
//				var children = document.getElementById('r'+iRoom+'c');
//				if (children) {
//					if (children.selectedIndex > 0) {
//						// There are children so display the row
//						obj.style.display = 'block';
//					} else {
//						obj.style.display = 'none';
//					}
//				}
//			}*/
//		}		
//	}
//}

function updatePax(maxPax, maxAdults, maxChild, maxInfant) {
	var oRooms = document.getElementById('rooms');
	var iPax = 0, iAdults = 0, iChildren = 0, iInfants = 0, iTotalAdults = 0, iTotalChildren = 0, iTotalInfants = 0;
	var paxOkay =  false;

	if (oRooms) {
		paxOkay = true;
		var iRooms = parseInt(oRooms.options[oRooms.selectedIndex].value);
		for (var iRoom=1;iRoom<=iRooms;iRoom++) {
			iAdults = 0;
			iChildren = 0;
			iInfants = 0;
			
			var objAdult = document.getElementById('r'+iRoom+'a');
			if (objAdult) { iAdults = parseInt(objAdult.options[objAdult.selectedIndex].value); }

			var objChild = document.getElementById('r'+iRoom+'c');
			if (objChild) { iChildren = parseInt(objChild.options[objChild.selectedIndex].value); }	

			var objInfant = document.getElementById('r'+iRoom+'i');
			if (objInfant) { iInfants = parseInt(objInfant.options[objInfant.selectedIndex].value); }
			
			iPax += iAdults + iChildren + iInfants;

			if (maxPax != -1) {
				if (iPax > maxPax) { alert('The maximum number of people allowed across all rooms is ' + maxPax); paxOkay = false;}
			}

			if (paxOkay && maxAdults != -1) {
				if (iAdults > maxAdults) { alert('The maximum number of adults allowed in room ' + iRoom + ' is ' + maxAdults); paxOkay = false; }
			}

			if (paxOkay && maxChild != -1) {
				if (iChildren > maxChild) { alert('The maximum number of children allowed in room ' + iRoom + ' is ' + maxChild); paxOkay = false; }
			} 

			if (paxOkay && maxInfant != -1) {
				if (iInfants > maxInfant) { alert('The maximum number of infants allowed in room ' + iRoom + ' is ' + maxInfant); paxOkay = false; }
			}
			
			if (iChildren > 0 || iInfants > 0) {
				//var obj = document.getElementById('trRoom'+iRoom+'Ages');	
				//if (obj) { 
				//	obj.style.display = 'block'; 
					for (var iChild=1;iChild<=maxChild;iChild++) {
						obj = document.getElementById('r'+iRoom+'c_ages'+iChild);
						if (obj) {
							if (iChild <= iChildren) { obj.style.display = 'block'; } else { obj.style.display = 'none'; }
						}
					}	

					obj = document.getElementById('sCAges'+iRoom);
					if (obj) {
						if (iChildren < 1) { obj.style.display = 'none'; } else { obj.style.display = 'block'; }
					}
					
					for (var iInfant=1;iInfant<=maxInfant;iInfant++) {
						obj = document.getElementById('r'+iRoom+'i_ages'+iInfant);
						if (obj) {
							if (iInfant <= iInfants) { obj.style.display = 'block'; } else { obj.style.display = 'none'; }
						}
					}			
					
					obj = document.getElementById('sIAges'+iRoom);
					if (obj) {
						if (iInfants < 1) { obj.style.display = 'none'; } else { obj.style.display = 'block'; }
					}
				//}
			/*} else {
				var obj = document.getElementById('trRoom'+iRoom+'Ages');
				if (obj) { obj.style.display = 'none'; }*/
			}
			
			if (iChildren < 1) {
				// Hide children
				for (var iChild=1;iChild<=maxChild;iChild++) {
					obj = document.getElementById('r'+iRoom+'c_ages'+iChild);
					if (obj) { obj.style.display = 'none'; }
				}	

				obj = document.getElementById('sCAges'+iRoom);
				if (obj) { obj.style.display = 'none'; }		
			}

			if (iInfants < 1) {
				// Hide infants
				for (var iInfant=1;iInfant<=maxInfant;iInfant++) {
					obj = document.getElementById('r'+iRoom+'i_ages'+iInfant);
					if (obj) { obj.style.display = 'none'; }
				}	

				obj = document.getElementById('sIAges'+iRoom);
				if (obj) { obj.style.display = 'none'; }		
			}
			
			iTotalAdults += iAdults
			iTotalChildren += iChildren
			iTotalInfants += iInfants
		}

		var objSeats = document.getElementById('seats_adult')
		if (objSeats && iAdults <= objSeats.options.length) { objSeats.options[iTotalAdults].selected = true; }
		var objSeats = document.getElementById('seats_child')
		if (objSeats && iChildren <= objSeats.options.length) { objSeats.options[iTotalChildren].selected = true; }
		var objSeats = document.getElementById('seats_infant')
		if (objSeats && iInfants <= objSeats.options.length) { objSeats.options[iTotalInfants].selected = true; }
	}
	
	return paxOkay;
}

//topsearch
function showhidechangeoptions(type) {
	if(type == "show") {
		div_switch("DivLocations", true, true);
		div_switch("DivOptions", true, true);
		div_switch("DivShow", false, true);
		div_switch("DivHide", true, true);
	}
		if(type == "hide") {
		div_switch("DivLocations", false, true);
		div_switch("DivOptions", false, true);
		div_switch("DivShow", true, true);
		div_switch("DivHide", false, true);
	}
}

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {
	var x = Math.round(num * Math.pow(10,dec));
	if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');
	var z = y.length - dec;
	if (z<0) z--;
	for(var i = z; i < 0; i++) y.unshift('0');
	y.splice(z, 0, pnt);
	while (z > 3) {
		z-=3; y.splice(z,0,thou);
	}
	var r = curr1+n1+y.join('')+n2+curr2;
	return r;
}


// -->
