var temp_i=1;
var xx;
function flash_sms() {for (i=1;i<=9;i++) { if (i==temp_i)temp_str="red"; else temp_str="green"; eval("a"+i+".style.color='"+temp_str+"';"); } 
temp_i++; if (temp_i>9) temp_i=1;var Mcf=window.frames.HotelMapList;
		if(Mcf.bCalLoaded)SetHotelMap();} 

function SetHotelMap()
{
	if(_g("HotelMapList").style.display=="none")
	{
		var Mcf=window.frames.HotelMapList;
		if(!Mcf.bCalLoaded)
		{
			_g("HotelMapList").src="/ChinaHotels/UC/HotelMaps.aspx?U=SetHotelMap";
			_g("HotelMapList").style.display="none";
			_g("AAstr").style.display="";
			xx=this.setInterval("flash_sms()",200); 
			return;
		}
		var Citude=_g("CityLtude").value;
		var Hitude=_g("HotelLtude").value;
		if(Citude=="")return ;
		
		_g("HotelMapList").style.display=""
		_g("Map_text").innerHTML="Hide Map"
		Mcf.Clox=Citude.split(',')[0];
		Mcf.Clax=Citude.split(',')[1];
		Mcf.Vstr=Hitude;
		Mcf.SetHotelMarker();
		_g("AAstr").style.display="none";
		clearInterval(xx);
	}
	else
	{
		_g("HotelMapList").style.display="none";
		_g("Map_text").innerHTML="Show Map";
		_g("AAstr").style.display="none";
		clearInterval(xx);
	}
}




function Book(x,y,z,u,t)
{
	var url="/ChinaHotels/Reserve.aspx?HID=" + x;
	if(t==1)url="/ChinaHotels/ReserveC.aspx?HID=" + x;
	url+="&RoomID="+y;
	url+="&RateID="+z;
	url+="&Rnum=" +u;
	url+="&CheckIn="+_g("B_CheckIn").value;
	url+="&CheckOut="+_g("B_CheckOut").value;
	document.location.href=url;	
}
	
function CheckData()
{	
	if(_g("Search1_H_CityID").value=="0")
	{	
		alert("Please Select The Ctiy!");
		return false;
	}
	if(_g("Search1_CheckIn").value=="YYYY-MM-DD")
	{
		alert("Please enter a valid Check-in date!");
		_g("Search1_CheckIn").focus();
		return false;
	}
	if(DifferDate(ReturnDate(_g("Search1_CheckIn").value),ReturnDate(GetToday()))<1)
	{
		alert("Please book 15 days in advance of the Check-in or Send email chinahotels@ChinaTravelDepot.com!");
		return false;
	}
	if(_g("Search1_CheckOut").value=="YYYY-MM-DD")
	{
		alert("Please enter a valid Check-out date!");
		_g("Search1_CheckOut").focus();
		return false;
	}
	if(ReturnDate(_g("Search1_CheckOut").value)<=ReturnDate(_g("Search1_CheckIn").value))
	{
		alert("The check-out date can not be earlier than the check-in date!");
		return false;
	}
	if(DifferDate(ReturnDate(_g("Search1_CheckOut").value),ReturnDate(_g("Search1_CheckIn").value))>28)
	{
		alert("Your reservation period is more than 28 nights, please call 888-598-2008!");
		return false;
	}
	if(_g("Search1_RoomNum").value=="0")
	{
		alert("To book hotel rooms more than 5, please contact chinahotels@ChinaTravelDepot.com, or call 888-598-2008");
		return false;
	}
	
	var url="CityID="+_g("Search1_H_CityID").value+"&CheckIn="+_g("Search1_CheckIn").value+"&CheckOut="+_g("Search1_CheckOut").value;
	url+="&RNum="+_g("Search1_RoomNum").value+"&HCx="+_g("Search1_HotelClass").value;
	if(_g("Search1_HotelName").value!="")url+="&HName="+_g("Search1_HotelName").value;
	window.top.location.href="/ChinaHotels/HotelList.aspx?"+url;
	return false;
}
function SetPag(x)
{	
	_g("SPageNum").value=x;
	_g("SPageButt").click();
}
function SetSortBY(x)
{
	var SortBy="T_default";
	if(_g("Radio_2").checked)SortBy="T_hotelclass";
	if(_g("Radio_3").checked)SortBy="T_roomprice";
	_g("SPageNum").value=SortBy;
	_g("SPageButt").click();
}
function $SHL(x)
{
	if(_g("HL_"+x).style.display=="none")
	{
		_g("HL_"+x).style.display=""
		_g("HL_text_"+x).innerHTML="Hide"
	}
	else
	{
		_g("HL_"+x).style.display="none"
		_g("HL_text_"+x).innerHTML="Show"
	}
}
function ShowULCityList()
{
	_g("liMore").style.display="none";
	_g("UlCityList").style.display="block";
}