function getdata(gettype,getvalue,putdiv,backcall)
{
	if(gettype=="country")
	{
	//alert(getvalue);
			if(getvalue=='noselected')
			{
			showselectcontinent('Layercountry')
			showselectcountry('Layercity')
			return false;
			}
			else
			{
			showwaitcountry(putdiv)
			showselectcountry('Layercity')
			url="/hotel_global/geo_country.asp"
			sendcode="continent_id="+getvalue
			}
	}
	if(gettype=="city")
	{
	//alert(getvalue);
	//alert(getvalue);
			if(getvalue=='noselected')
			{
			showselectcountry('Layercity')
			return false;
			}
			else
			{
			showwaitcountry(putdiv)
			url="/hotel_global/geo_city.asp"
			sendcode="country_id="+getvalue
			}
	}
		var xmlhttp;
		try{
			xmlhttp=new XMLHttpRequest();
			}
		catch(e){
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		xmlhttp.onreadystatechange=function(){
		//alert(xmlhttp.readyState);
		if (xmlhttp.readyState==4){
			if (xmlhttp.status==200){
				var data=xmlhttp.responseText;
				//对结果进行unescape解码以防止中文乱码
				document.all(putdiv).innerHTML=unescape(data);
				backcall
				}
			 else
			 	{
				alert(xmlhttp.responseText);
				}
				
			}
		}
		//alert(sendcode);
		xmlhttp.open("post", url, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		xmlhttp.send(sendcode);
}





function getdata_owne(gettype,getvalue,putdiv,backcall)
{
	if(gettype=="country")
	{
	//alert(getvalue);
			if(getvalue=='noselected')
			{
			showselectcontinent('Layercountry')
			showselectcountry('Layercity')
			return false;
			}
			else
			{
			showwaitcountry(putdiv)
			showselectcountry('Layercity')
			url="/hotel_global/geo_country.asp"
			sendcode="continent_id="+getvalue
			}
	}
	if(gettype=="city")
	{
	//alert(getvalue);
	//alert(getvalue);
			if(getvalue=='noselected')
			{
			showselectcountry_owne('Layercity')
			return false;
			}
			else
			{
			showwaitcountry_owne(putdiv)
			url="/hotel_global/geo_city_owne.asp"
			sendcode="country_id="+getvalue
			}
	}
		var xmlhttp;
		try{
			xmlhttp=new XMLHttpRequest();
			}
		catch(e){
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		xmlhttp.onreadystatechange=function(){
		//alert(xmlhttp.readyState);
		if (xmlhttp.readyState==4){
			if (xmlhttp.status==200){
				var data=xmlhttp.responseText;
				//对结果进行unescape解码以防止中文乱码
				document.all(putdiv).innerHTML=unescape(data);
				backcall
				}
			 else
			 	{
				alert(xmlhttp.responseText);
				}
				
			}
		}
		//alert(sendcode);
		xmlhttp.open("post", url, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		xmlhttp.send(sendcode);
}





function showwaitcountry_owne(showdiv)
{
document.all(showdiv).innerHTML="<select name='cg2' disabled  style='font-size: 12px;color: #000000;height: 18px;width: 127px;border: 1px solid #7F9DB9; '><option value='noselected'>载入中……</option></select>"
}
function showselectcountry_owne(showdiv)
{
document.all(showdiv).innerHTML="<select name='country_id'  style='font-size: 12px;color: #000000;height: 18px;width: 127px;border: 1px solid #7F9DB9; ' ><option value='noselected'>请先选择国家……</option></select>"
}



function showwaitcountry(showdiv)
{
document.all(showdiv).innerHTML="<select name='cg2' disabled class='toselect'><option value='noselected'>载入中……</option></select>"
}
function showselectcountry(showdiv)
{
document.all(showdiv).innerHTML="<select name='country_id' disabled  class='toselect' ><option value='noselected'>请先选择国家……</option></select>"
}
function showselectcontinent(showdiv)
{
document.all(showdiv).innerHTML="<select name='continent_id' disabled class='toselect'><option value='noselected'>请先选择大洲……</option></select>"
}
function showselectcity(showdiv)
{
document.all(showdiv).innerHTML="<select name='city_id' disabled class='toselect'><option value='noselected'>请先选择城市……</option></select>"
}

function gosearch(obj)
{
if(obj.country_id.value=='noselected')
	{
	alert('请选择国家');
	return false;
	}
if(obj.city_id.value=='noselected')
	{
	alert('请选择城市');
	return false;
	}
	
country_id=obj.country_id.value
city_id=obj.city_id.value
var iaDate = new Array(3)
var year, month, day
CheckIn=obj.CheckIn.value
CheckOut=obj.CheckOut.value

if (isDateString(CheckIn)==false)
	{
	alert("您输入的入住日期不符合要求！");
	return false;
	}

if (isDateString(CheckOut)==false)
	{
	alert("您输入的退房日期不符合要求！");
	return false;
	}
	//alert(test(document.form1.AirDate.value,document.form1.AirDateReturnCn.value));
if(CompareDate(CheckIn,CheckOut)==true)
	{
	alert("入住日期不能晚于退房日期");
	return false;
	}



iaDate = CheckIn.toString().split("-")
year = parseFloat(iaDate[0])
month = parseFloat(iaDate[1])
day=parseFloat(iaDate[2])
CheckIn=month+"/"+day+"/"+year

iaDate = CheckOut.toString().split("-")
year = parseFloat(iaDate[0])
month = parseFloat(iaDate[1])
day=parseFloat(iaDate[2])
CheckOut=month+"/"+day+"/"+year

Rooms=obj.Rooms.value
Adults=obj.Adults.value
Children=obj.Children.value
backlink='http://www.trip-home.com/'
refurl='http://www.trip-home.com/0808.asp'
header='http://www.tjcyts.com/top.htm'
footer='http://www.tjcyts.com/bottom.htm'
url1="http://ajaxsearch.partners.agoda.com.cn/webforms/waitpage.aspx"
//alert(obj.hotelchk.value);
if(obj.hotelchk.value=='hotellist')
{
url2="?waitpage=hotellist&fromInternal=1&cid=1414378&countryID="+country_id+"&cityID="+city_id+"&CheckIn="+CheckIn+"&CheckOut="+CheckOut+"&Rooms="+Rooms+"&Adults="+Adults+"&Children="+Children+"&searchtype=&backlink="+backlink+"&refurl="+refurl+"&header="+header+"&footer="+footer+"&sidebar="
}
else
{
HotelID=obj.HotelID.value
url2="?waitpage=hotel&fromInternal=1&cid=1414378&countryID="+country_id+"&cityID="+city_id+"&HotelID="+HotelID+"&CheckIn="+CheckIn+"&CheckOut="+CheckOut+"&Rooms="+Rooms+"&Adults="+Adults+"&Children="+Children+"&searchtype=&backlink="+backlink+"&refurl="+refurl+"&header="+header+"&footer="+footer+"&sidebar="
}
url=url1+url2
//alert(url)
//obj.action=url;
window.open(url,"_blank")   
//window.location.target="_blank";   
//window.location.href=url;
//alert(obj.action)
//document.write document.getElementById('toagodafrm').action
//document.all.Layersearch.style.visibility='hidden';
}
function toly(country_id,city_id,hotelchk,HotelID)
{
document.toagodafrm.country_id.value=country_id;
document.toagodafrm.city_id.value=city_id;
document.toagodafrm.hotelchk.value=hotelchk;
document.toagodafrm.HotelID.value=HotelID;
gosearch(document.toagodafrm)
//x=document.body.clientWidth  /2 -100;   
//y=document.body.clientHeight   /2-50 ;   
//document.getElementById('Layersearch').style.visibility='visible';
//document.getElementById('Layersearch').style.posLeft=x;
//document.getElementById('Layersearch').style.top=y;

}
