function CityList(Nstr,path)
{

var amp = ":";
//alert(Nstr);
//alert(path);
var string = Nstr;
var str = string.replace("&",amp);
//alert(str);
	document.getElementById("CityList").style.display = "none";
	document.getElementById("CityListD").style.display = "inline";


	var xmlreload = initxmlhttp() ;
	var url = path+str;
//alert(url);
	xmlreload.open( "GET", url, true ) ;
	xmlreload.onreadystatechange=function()
	{
		if (xmlreload.readyState==4)
		{
			CityID = xmlreload.responseText;
//alert(CityID);
			document.getElementById("CityList").innerHTML = " <select name='cboCity' id='cboCity' class='textbox-w' onChange=\"return LocationList(this.value,'includes/ajax/locationlist.php?location=');\">"+CityID+"</select>";
			document.getElementById("CityList").style.display = "inline";
			document.getElementById("CityListD").style.display = "none";
		}
	}
	xmlreload.send(null) ;
}
		function LocationList(str,path)
		{
			document.getElementById("LocationList").style.display = "none";
			document.getElementById("LocationListD").style.display = "inline";
			var xmlreload = initxmlhttp() ;
			var url = path+str;

			xmlreload.open( "GET", url, true ) ;

			xmlreload.onreadystatechange=function()
			{
				if (xmlreload.readyState==4)
				{
					LocationID = xmlreload.responseText;
					
					document.getElementById("LocationList").innerHTML = " <select name='cboLocation' id='cboLocation' class='textbox-w'><option value=''>All Locations</option>"+LocationID+"</select>";
					document.getElementById("LocationList").style.display = "inline";
					document.getElementById("LocationListD").style.display = "none";
				}
			}
			xmlreload.send(null) ;
		}


function searchRB(check)
{
	//alert(document.getElementById("searchhotel").style.display);
	//alert("Coming here");
	if(check=="hotel"){
		document.getElementById("searchhotel").style.display="";
		document.getElementById("searchdestination").style.display="none";
	}
	else if(check=="destination"){
		document.getElementById("searchhotel").style.display="none";
		document.getElementById("searchdestination").style.display="";
	}
}
function search()
{
	document.searchEngine.action="index.php";
document.searchEngine.submit();
}
function search(hsearch)
{
frm	=	document.searchEngine;
frm.action = "HotelResults.php?hname="+hsearch;
}
function finalurl(value)
{
//alert(value);
frm	=	document.searchEngine;
var hname=document.getElementById("txtHotelname").value;
//alert(star3);
//alert(star5);
//alert(hname.length);
if(frm.chkRating5.checked==true)
				var star5 = "&star5="+frm.chkRating5.value;
			else
				var star5 = "";
			if(frm.chkRating4.checked==true)
				var star4 = "&star4="+frm.chkRating4.value;
			else
				var star4 = "";
			if(frm.chkRating3.checked==true)
				var star3 = "&star3="+frm.chkRating3.value;
			else
				var star3 = "";

				var inYear = frm.inYear.value;
				var inMonth = frm.inMonth.value;
				var inDay = frm.inDay.value;
				var outYear = frm.outYear.value;
				var outMonth = frm.outMonth.value;
				var outDay = frm.outDay.value;
			var inMon=inMonth-1;
			var outMon=outMonth-1;
			today=new Date()
			var christmas=new Date(inYear, inMon, inDay) //Month is 0-11 in
			var chris=new Date(outYear, outMon, outDay) //Month is 0-11 in
			//JavaScript
			//Set 1 day in milliseconds
			var one_day=1000*60*60*24
			var checkinDate = new Date(parseDate(getDateString(inYear,inMonth,inDay)));
			var checkoutDate = new Date(parseDate(getDateString(outYear,outMonth,outDay)));
			if(checkinDate.getTime()< new Date().getTime() ){
				alert("Please enter a check-in date 1 day from now or later");
				return false;
			}
			if(checkinDate.getTime()>= checkoutDate.getTime() ){
				alert("Check-out date should be greater than check-in date");
				return false;
			}
			
//alert(inYear);
//alert(hname.length);
if(value=="Dest"){
		var country=document.searchEngine.cboCountry.value;
		if(country=="")
					{
						alert("Please select country to resume search");
						return false;
					}

					//alert(country);
					var city=document.getElementById("cboCity").value;
					var location=document.getElementById("cboLocation").value;
					//alert(city);

}
if(value=="Dest"){

var encode1 = "%3D";
var encode2 = "%26";
var newurl1 = "http://hotels.getaroom.com.au/enter.asp?id=7412&ru=/searchresults.asp";
var oldUrl = "%3Faffid%3D7412%26inDay%3D"+inDay+"&inMonth="+inMonth+"&inYear="+inYear+"&outDay="+outDay+"&outMonth="+outMonth+"&outYear="+outYear+"&searchBy=Criteria&country="+country+star5+star4+star3+"&city="+city+"&hotelName=&suburb="+location;
var url = oldUrl.replace(/=/g,encode1 );
var newurl = url.replace(/&/g,encode2 );
frm.action = newurl1+newurl;
//hotelBOX();
frm.submit();
}

if(value=="name"){

var encode1 = "%3D";
var encode2 = "%26";
var newurl1 = "http://hotels.getaroom.com.au/enter.asp?id=7412&ru=/searchresults.asp";
var oldUrl = "%3Faffid%3D7412%26inDay%3D"+inDay+"&inMonth="+inMonth+"&inYear="+inYear+"&outDay="+outDay+"&outMonth="+outMonth+"&outYear="+outYear+"&searchBy=Name&country=Australia&star5=ON&star4=ON&star3=ON&city=Sydney&hotelName="+hname+"&suburb="+location;
var url = oldUrl.replace(/=/g,encode1 );
var newurl = url.replace(/&/g,encode2 );
frm.action = newurl1+newurl;
//hotelBOX();
frm.submit();
}
//return false;
}
function valid_search()
{
			//alert("Coming for valid search");
			var hname=document.getElementById("txtHotelname").value;
			//alert(hname.length);
			if(hname.length<1){
			alert("Please enter Hotelname to search");
			return false;	
			}
			if(hname.length>0){
			finalurl('name');
		}
}
function uncheck1(val)
{
//alert(val);
if(val=="ON")
document.getElementById("chkRating5").value="";
if(val=="")
document.getElementById("chkRating5").value="ON";
}
function uncheck2(val)
{
if(val=="ON")
document.getElementById("chkRating4").value="";
if(val=="")
document.getElementById("chkRating4").value="ON";
}
function uncheck3(val)
{
if(val=="ON")
document.getElementById("chkRating3").value="";
if(val=="")
document.getElementById("chkRating3").value="ON";
			}