﻿function submitHotelSearch(disableDateVerify){
	var strUrl = "/Service1StartSearch.aspx?isnewsearch=1";
	var ckSrc = CmsGetCookie("sxlysrc");
	if (ckSrc == 'opt_hotel'){
		strUrl += "&svctype=1&searchform=hotel";
	}else if (ckSrc == 'opt_visa_hotel'){
		strUrl += "&svctype=5&searchform=hotel";
	}else{
		strUrl += "&svctype=1&searchform=hotel";
	}  
	var strCityCode = "";
	if (document.getElementById("ht_usecustcity").value == "1"){
		strCityCode = GetCityCode('ht_tocity','ht_custtocitycode');
	}else{
		//strCityCode = document.getElfementById("ht_tocity").value;
		strCityCode = GetCityCode('ht_tocity','ht_custtocitycode'); //document.getElementById("ht_custtocitycode").value;
	}
	if (strCityCode == ""){
		alert("请选择到达城市");
		return false;
	}
	strUrl += "&tocity=" + escape(strCityCode);
	//escape() 函数可对字符串进行编码，这样就可以在所有的计算机上读取该字符串。
	var strCheckinDate = document.getElementById("ht_checkindate").value;
	if (strCheckinDate == ""){
		alert("请输入有效的入住日期");
		document.getElementById("ht_checkindate").focus();
		return false;
	}
	strUrl += "&checkindate=" + strCheckinDate;
	var strCheckoutdate = document.getElementById("ht_checkoutdate").value;
	if (strCheckoutdate == ""){
		alert("请输入有效的入住日期");
		document.getElementById("ht_checkoutdate").focus();
		return false;
	}
	strUrl += "&checkoutdate=" + strCheckoutdate;

	//jbjdate 校验：入住日期和离店日期不能早于今天日期
	if (disableDateVerify != 1){
		var daysCheckin = GetdiffDays(strCheckinDate, (new Date()).toString());
		if (daysCheckin >= 1 ){
			alert("入住日期不能早于今天日期");
			return false;
		}
	}

	//校验日期间隔不能超过10天 （10天允许）
	var days = GetdiffDays(strCheckinDate, strCheckoutdate);
	if (days <= 0 ){
		alert("离店日期必须大于入住日期。");
		return false;
	}else if (days > 10 ){
		var blnRtn = window.confirm("您确定要入住酒店超过10天吗？");
		if (blnRtn == true){
			document.location.href = "/ServiceDeal10PlusDays.aspx";
			return false;
		}else{
			return false;
		}
	}
	
	var ddlRooms = document.getElementById("ht_roomnum");
	var strRooms = ddlRooms.options(ddlRooms.selectedIndex).value;
	strUrl += "&roomnum=" + strRooms;
	var i;
	for (i=1;i<=parseInt(strRooms);i++){
		strUrl += "&mannum" + i + "=" + document.getElementById("ht_mannum" + i).options(document.getElementById("ht_mannum" + i).selectedIndex).value;
		strUrl += "&chdnum" + i + "=" + document.getElementById("ht_chdnum" + i).options(document.getElementById("ht_chdnum" + i).selectedIndex).value;
	}

	//检查酒店的高级查询
	if (document.getElementById("ht_showadv").value == "1" && document.getElementById("hotelAdv1").style.display == "block"){
		strUrl += "&ht_showadv=1";
		strUrl += "&hotelname=" + escape(document.getElementById("ht_hotelname").value);

		var ddlStar = document.getElementById("ht_hotelstar");
		var strStar = ddlStar.options(ddlStar.selectedIndex).value;
		strUrl += "&hotelstar=" + strStar;
	}
	document.location.href = strUrl;
	return false;
}

//Eric 2007-11-08 add for topdeal
function submitTopDealOrder(disableDateVerify){

	var strUrl = "/TopDealStart1.aspx?isnewsearch=1";
    //strUrl += "&svctype=1&searchform=hotel";//"&svctype=3&searchform=hotelflight";
	//strUrl += "&tocity=25001" //+ escape(strCityCode);
	var strTopic =document.getElementById("ht_cptopic").value;
	if (strTopic=="特惠酒店")
	{
	strUrl +="&svctype=1&searchform=hotel";
	}
	else
	strUrl +="&svctype=3&searchform=hotelflight";
	var strCheckinDate = document.getElementById("ht_checkindate").value;
	if (strCheckinDate == ""){
		alert("请输入有效的入住日期");
		document.getElementById("ht_checkindate").focus();
		return false;
	}
	
	strUrl += "&checkindate=" + strCheckinDate;
    strUrl += "&jp_checkindate=" + strCheckinDate;
	var strCheckoutdate = document.getElementById("ht_checkoutdate").value;
	if (strCheckoutdate == ""){
		alert("请输入有效的入住日期");
		document.getElementById("ht_checkoutdate").focus();
		return false;
	}
	
	
	var strHotel = document.getElementById("ht_hotelinfo").value;
	if (strHotel=="")
	{
		alert("请选择酒店");
		
		return false;
	}
	

	//jbjdate 校验：入住日期和离店日期不能早于今天日期
	if (disableDateVerify != 1){
		var daysCheckin = GetdiffDays(strCheckinDate, (new Date()).toString());
		if (daysCheckin >= 1 ){
			alert("入住日期不能早于今天日期");
		return false;
		}
	}

	//Eric add 2007-12-11
	var strStartdate=document.getElementById("ht_checkindate").value;
	var strEndDate=document.getElementById("ht_checkoutdate").value;
    var dt1=GetdiffDays(strStartdate,strCheckinDate);
    var dt2=GetdiffDays( strCheckoutdate,strEndDate);
   
	if (dt1>=0 &&  dt2>=0 )
	{}
	else
	{
	    alert("请选择在适用日期范围内的入住时间");
		return false;
	}
	//------------------------------------
	
	
	strUrl += "&checkoutdate=" + strCheckoutdate;
    strUrl += "&jp_checkoutdate=" + strCheckoutdate;


	//校验日期间隔不能超过10天 （10天允许）
	var days = GetdiffDays(strCheckinDate, strCheckoutdate);
	if (days <= 0 ){
		alert("离店日期必须大于入住日期。");
		return false;
	}else if (days > 10 ){
		var blnRtn = window.confirm("您确定要入住酒店超过10天吗？");
		if (blnRtn == true){
			document.location.href = "/ServiceDeal10PlusDays.aspx";
			return false;
		}else{
			return false;
		}
	}
	
	var ddlRooms = document.getElementById("ht_roomnum");
	var strRooms = ddlRooms.options(ddlRooms.selectedIndex).value;
	strUrl += "&roomnum=" + strRooms;
	var i;
	for (i=1;i<=parseInt(strRooms);i++){
		strUrl += "&mannum" + i + "=" + document.getElementById("ht_mannum" + i).options(document.getElementById("ht_mannum" + i).selectedIndex).value;
		strUrl += "&chdnum" + i + "=" + document.getElementById("ht_chdnum" + i).options(document.getElementById("ht_chdnum" + i).selectedIndex).value;
	}
	//var aaa=strUrl+document.getElementById("ht_hotelinfo").value+document.getElementById("ht_flightinfo").value;
	document.location.href = strUrl+document.getElementById("ht_hotelinfo").value+document.getElementById("ht_flightinfo").value+"&cpbh="+document.getElementById("ht_cpbh").value;
	return false;
}


//单机票的查询开始
function submitFlightSearch(disableDateVerify){
	var strUrl = "/Service1StartSearch.aspx?isnewsearch=1";
	var ckSrc = CmsGetCookie("sxlysrc");
	if (ckSrc == 'opt_flight'){
		strUrl += "&svctype=2&searchform=flight";
	}else if (ckSrc == 'opt_visa_flight'){
		strUrl += "&svctype=6&searchform=flight";
	}else{
		strUrl += "&svctype=2&searchform=flight";
	}
	//=====================================================================================这里是机票的查询================================
	//=====================================================================================这里是机票的查询================================
	//=====================================================================================这里是机票的查询================================
	//=====================================================================================这里是机票的查询================================
	//=====================================================================================这里是机票的查询================================	
	var fromCityId = "";                    //出发城市的文本框id
	var toCityId = "";                      //到达城市的文本框的id
	var fromCityCodeId = "";                //出发城市的隐藏域的id
	var toCityCodeId = "";                  //到达城市的隐藏域的id
    var flightmode = "";                    //机票飞行模式（单程，往返，多目的地）
    var flightnums = 0;                     //机票数（不是人数）
    var strFromCityCode = "";               //出发城市的ivision城市代码
    var strToCityCode = "";                 //到达城市的ivision城市代码
    var fromDate = "";                      //始发日期
    var fromTime = ""                       //始发时间
	if(document.getElementById('singleFlight').checked){       //单程	==============    	  
	    flightmode = "single";  
	    flightnums = 1;                
	    fromCityId="jp_singleFromCity";   
	    toCityId="jp_singleToCity";      	    
	    fromCityCodeId = "jp_singleFromCityCode";   
	    toCityCodeId = "jp_singleToCityCode";        
	     if(GetCityCode(fromCityId,fromCityCodeId) && GetCityCode(toCityId,toCityCodeId)){
	         strFromCityCode ="&fromcity1=" + GetCityCode(fromCityId,fromCityCodeId);
	         strToCityCode ="&tocity1=" + GetCityCode(toCityId,toCityCodeId);
	     }else{
	         alert("城市无效,请确认.") ; 
	         //document.getElementById("jp_singleToCity").focus();
	         return false;
	     }	  	    
	    fromDate ="&fromdate1=" + Getdate("jp_checkindate");     //日期
	    fromTime ="&fromtime1=" + GetTime("singleTime");         //时间
	    if(disableDateVerify != 1){
		    var daysCheckin = GetdiffDays(fromDate, (new Date()).toString());
		    if (daysCheckin >= 1 ){
			    alert("出发日期不能早于今天日期");
			    return false;
		    }
	    }   	
	    if(!fromDate || !fromDate){
	        alert("日期不能为空");
	        return false;
	    }	    
	}else if(document.getElementById("roundtrip").checked){      //往返	  ===============
	     flightnums = 2;	    
	     flightmode = "round";
	     fromCityId = "jp_roundFromCity";
	     fromCityCodeId = "jp_roundFromCityCode";           
	     toCityId = "jp_roundToCity";
	     toCityCodeId = "jp_roundToCityCode";     
	     if(GetCityCode(fromCityId,fromCityCodeId) && GetCityCode(toCityId,toCityCodeId)){
	         strFromCityCode = "&fromcity1=" + GetCityCode(fromCityId,fromCityCodeId) ;    
	         strToCityCode = "&tocity1=" + GetCityCode(toCityId,toCityCodeId);   	     
	         strFromCityCode1 = strFromCityCode + "&fromcity2=" + GetCityCode(toCityId,toCityCodeId);
	         strToCityCode1 = strToCityCode + "&tocity2=" + GetCityCode(fromCityId,fromCityCodeId);   
	     }else{
	        alert("城市无效,请确认.") ;
	        //document.getElementById("jp_roundToCity").focus();
	        return false;
	     }    
	     strFromCityCode = strFromCityCode1;	     
	     strToCityCode = strToCityCode1;  
	     var fromDate1 = Getdate("jp_roundcheckindate");
	     var fromDate2 = Getdate("jp_roundcheckoutdate");
	     
	     if(!fromDate1 || !fromDate2){
	        return false;    
	     }
	     var fromTime1 = GetTime("roundTime1");
	     var fromTime2 = GetTime("roundTime2");
	     var errMsg = "返程日期必须大于出发日期";	      
	     if(CheckInputdate(fromDate1,fromDate2,disableDateVerify,errMsg)){
	     }else{
	        return false;
	     }
	     //获取始发返程时间。
	     fromDate = "&fromdate1=" + fromDate1 + "&fromdate2=" + fromDate2;
	     fromTime = "&fromtime1=" + fromTime1 + "&fromtime2=" + fromTime2;          
   }else{                                                       //多目的地    ============        
        flightmode = "mul";
        flightnums = 0;
        var b = true;
        var i = 1;
        for(i; i < 6;i++){
            var fromCityId = "jp_mulFromCity" + i;
            var fromCityCodeId = "jp_mulFromCityCode" + i;
            var toCityId = "jp_mulToCity" + i;
            var toCityCodeId = "jp_mulToCityCode" + i;             
            var fromDateId = "jp_checkindate" + i;
            var fromTimeId = "mulTime" + i;            
            var fromCity = document.getElementById(fromCityId).value;
            var toCity = document.getElementById(toCityId).value;        
	        if(fromCity && toCity){
	             var FromCityCode = GetCityCode(fromCityId,fromCityCodeId);	             
	             var ToCityCode = GetCityCode(toCityId,toCityCodeId);
	             var mulDate = Getdate(fromDateId);
	             var mulTime = GetTime(fromTimeId);
	             if(FromCityCode && ToCityCode ){
	                 if(i > 1){
	                     var date2 = Getdate("jp_checkindate"+ (i-1));
	                     var errMsg = "目的地"+ i +"出发日期必须大于目的地" + (i-1) + "的出发日期" ;
	                     if(CheckInputdate(date2,mulDate,disableDateVerify,errMsg)){

	                     }else{
	                        return false;
	                     }	                     
	                 }  
	                 fromDate += "&fromdate" + i + "=" + escape(mulDate);  
	                 fromTime += "&fromtime" + i + "=" + escape(mulTime);	                 
                     strFromCityCode += "&fromcity" + i + "=" + escape(FromCityCode);  
                     strToCityCode += "&tocity" + i + "=" + escape(ToCityCode);
	             }else{
	                 if(i==1){
	                     b = false;
	                     alert("城市名称无效!");
	                 }
	                 break;
	             }
	        }else{
	              if(i==1){
	                     b = false;
	                     alert("请输入有效城市名称");
	                 }
	              break;
	        }
	        flightnums = i;
        }
        if(b == false ){
            return false;
        }
	}                                                      		   
	    if(strFromCityCode == "" || strToCityCode==""){    
	        alert("请选择到达城市");
		    return false;
	    }
	    strUrl +="&flightmode=" + escape(flightmode);                     
	    strUrl +="&flightnums=" + escape(flightnums);
	    strUrl += strFromCityCode;                //出发城市
	    strUrl += strToCityCode;                   //到达城市 tocity 
	    strUrl += fromDate;                         //出发日期 
	    strUrl += fromTime;                         //出发时间    

	var dllRennum = document.getElementById("jp_rennum");        //人数的查询提取采用以前的方法
	var strRennum = dllRennum.options(dllRennum.selectedIndex).value;
	var strRoomNum = (parseInt(strRennum)/2).toFixed(0);
	if(strRoomNum == 0){
	    strRoomNum = 1;
	}
	var dllChdnum = document.getElementById("jp_chdnum");        //人数的查询提取采用以前的方法
	var strChdnum = dllChdnum.options(dllChdnum.selectedIndex).value;
	//alert(strChdnum);
	strUrl += "&mannum1=" + strRennum + "&chdnum1="+strChdnum;
	strUrl += "&roomnum=" + strRoomNum;
	
	document.location.href = strUrl;
	return false;
}

//机票加酒店
function submitHotelFlightSearch(disableDateVerify){
	var strUrl = "/Service1StartSearch.aspx?isnewsearch=1";
	var ckSrc = CmsGetCookie("sxlysrc");
	if (ckSrc == 'opt_hotelflight'){
		strUrl += "&svctype=3&searchform=hotelflight";
	}else if (ckSrc == 'opt_visa_hotel_flight'){
		strUrl += "&svctype=7&searchform=hotelflight";
	}else{
		strUrl += "&svctype=3&searchform=hotelflight";
	}
	var strCityCode = "";
	if (document.getElementById("ht_jp_usecustcity").value == "1"){
		strCityCode = GetCityCode('va_custtocity','va_custtocitycode');  //document.getElementById("va_custtocitycode").value;
	}else{
		strCityCode = GetCityCode('va_custtocity','va_custtocitycode');
	}
	if (strCityCode == ""){
		alert("请选择到达城市");
		return false;
	}
	strUrl += "&fromcity1=11431";
	strUrl += "&tocity1=" + escape(strCityCode);
	strUrl += "&fromcity2=" + escape(strCityCode); ;
	strUrl += "&tocity2=11431" ;
	var strCheckinDate = document.getElementById("va_checkindate").value;
	if (strCheckinDate == ""){
		alert("请输入有效的出发日期");
		document.getElementById("va_checkindate").focus();
		return false;
	}
	strUrl += "&jp_checkindate=" + strCheckinDate;
	strUrl += "&fromdate1=" + strCheckinDate;
	var strCheckoutdate = document.getElementById("va_checkoutdate").value;
	if (strCheckoutdate == ""){
		alert("请输入有效的返程日期");
		document.getElementById("va_checkoutdate").focus();
		return false;
	}
	strUrl += "&jp_checkoutdate=" + strCheckoutdate;
	strUrl += "&fromdate2=" + strCheckoutdate;

//	var fromTime1 = GetTime("roundTime1");
//	var fromTime2 = GetTime("roundTime2");
//	
//	strUrl += "&fromtime1=" + fromTime1 + "&fromtime2=" + fromTime2;    

	//jbjdate 校验：入住日期和离店日期不能早于今天日期
	if (disableDateVerify != 1){
		var daysCheckin = GetdiffDays(strCheckinDate, (new Date()).toString());
		if (daysCheckin >= 1 ){
			alert("入住日期不能早于今天日期");
			return false;
		}
	}
	//校验日期间隔不能超过10天 （10天允许）
	var days = GetdiffDays(strCheckinDate, strCheckoutdate);
	if (days <= 0 ){
		alert("返程日期必须大于出发日期。");
		return false;
	}else if (days > 10 ){
		var blnRtn = window.confirm("您确定要出出行超过10天吗？");
		if (blnRtn == true){
			document.location.href = "/ServiceDeal10PlusDays.aspx";
			return false;
		}else{
			return false;
		}
	}
	var ddlRooms = document.getElementById("va_roomnum");
	var strRooms = ddlRooms.options(ddlRooms.selectedIndex).value;
	strUrl += "&roomnum=" + strRooms;

	var i;
	for (i=1;i<=parseInt(strRooms);i++){
		strUrl += "&mannum" + i + "=" + document.getElementById("va_mannum" + i).options(document.getElementById("va_mannum" + i).selectedIndex).value;
		strUrl += "&chdnum" + i + "=" + document.getElementById("va_chdnum" + i).options(document.getElementById("va_chdnum" + i).selectedIndex).value;
	}
   // alert(strUrl) ;
  
    var fromTime1 = GetTime("jpandhotelroundTime1");
    var fromTime2 = GetTime("jpandhotelroundTime2");
    strUrl += "&fromtime1=" + fromTime1 + "&fromtime2=" + fromTime2;
	document.location.href = strUrl;
	return false;
}

function submitVisaSearch(){
    if (document.getElementById("vs_tocountry").value==""){
        alert("请选择有效的国家名");
        document.getElementById("vs_tocountry").focus();
        return false;
    }
    if (document.getElementById("vs_visa").value==""){
        alert("请选择有效的签证");
        document.getElementById("vs_visa").focus();
        return false;
    }
    
    if(!F3IsDate(document.getElementById("vs_checkindate").value)){
        alert("请选择有效的日期");
        document.getElementById("vs_checkindate").focus();
        return false;
    }
    
	var strUrl = "/Service1StartSearch.aspx?isnewsearch=1";
	strUrl += "&svctype=4&searchform=visa";
	strUrl += "&vs_tocountry=" + document.getElementById("vs_tocountry").value;
	strUrl += "&vs_visa=" + escape(document.getElementById("vs_visa").value);
	strUrl += "&vs_rennum=" + document.getElementById("vs_rennum").value;
	strUrl += "&vs_date=" + document.getElementById("vs_checkindate").value;
	document.location.href = strUrl;
	return false;
}

function submitTicketSearch(disableDateVerify){
	var strUrl = "/Service1StartSearch.aspx?isnewsearch=1";
	strUrl += "&svctype=8&searchform=ticket";
	var strCityCode = "";
	if (document.getElementById("tk_usecustcity").value == "1"){
		strCityCode = document.getElementById("tk_custtocitycode").value;
	}else{
		strCityCode = document.getElementById("tk_custtocitycode").value;
	}
	if (strCityCode == ""){
		alert("请选择到达城市");
		return false;
	}
	strUrl += "&tocity=" + escape(strCityCode);
	var strCheckinDate = document.getElementById("tk_checkindate").value;
	if (strCheckinDate == ""){
		alert("请输入有效的车票门票使用日期");
		document.getElementById("tk_checkindate").focus();
		return false;
	}
	strUrl += "&tk_checkindate=" + strCheckinDate;

	//jbjdate 校验：车票门票使用日期不能早于今天日期
	if (disableDateVerify != 1){
		var daysCheckin = GetdiffDays(strCheckinDate, (new Date()).toString());
		if (daysCheckin >= 1 ){
			alert("车票门票使用日期不能早于今天日期");
			return false;
		}
	}
	strUrl += "&tk_name=" + escape(document.getElementById("tk_name").value);
	document.location.href = strUrl;
	return false;
}

function submittransferSearch(disableDateVerify){
	var strUrl = "/Service1StartSearch.aspx?isnewsearch=1";
	strUrl += "&svctype=9&searchform=transfer";

	var strCityCode = "";
	if (document.getElementById("tr_usecustcity").value == "1"){
		strCityCode = document.getElementById("tr_custtocitycode").value;
	}else{
		strCityCode = document.getElementById("tr_custtocitycode").value;
	}
	if (strCityCode == ""){
		alert("请选择到达城市");
		return false;
	}
	strUrl += "&tocity=" + escape(strCityCode);
	
	var strCheckinDate = document.getElementById("tr_checkindate").value;  
	if (strCheckinDate == ""){
		alert("请输入有效的接送日期");
		document.getElementById("tr_checkindate").focus();
		return false;
	}
	strUrl += "&tr_checkindate=" + strCheckinDate;

	//jbjdate 校验：接送日期不能早于今天日期
	if (disableDateVerify != 1){
		var daysCheckin = GetdiffDays(strCheckinDate, (new Date()).toString());
		if (daysCheckin >= 1 ){
			alert("接送日期不能早于今天日期");
			return false;
		}
	}

	strUrl += "&tr_addr1=" + escape(document.getElementById("tr_addr1").value);
	strUrl += "&tr_addr2=" + escape(document.getElementById("tr_addr2").value);
    alert(strUrl);
	document.location.href = strUrl;
	return false;
}

function showOneModule(){
	if (document.getElementById("opt_hotel").checked == true){
		showHotel();
	}else if (document.getElementById("opt_flight").checked == true){
        showFlight();
	}else if (document.getElementById("opt_hotelflight").checked == true){
		showHotelFlight();
	}else if (document.getElementById("opt_visa").checked == true){
		showVisa();
	}else if (document.getElementById("opt_visa_hotel").checked == true){
		showVisaHotel();
	}else if (document.getElementById("opt_visa_flight").checked == true){
		showVisaFlight();
	}else if (document.getElementById("opt_visa_hotel_flight").checked == true){
		showVisaHotelFlight();
	}else if (document.getElementById("opt_ticket").checked == true){
		showTicket();
	}else{
		showVisa();
	}
}

function showHotel(){
	document.getElementById("tab_hotel").style.display="block";
	document.getElementById("tab_flight2").style.display="none";
	document.getElementById("tab_hotelflight").style.display="none";
	document.getElementById("tab_visa").style.display="none";
	document.getElementById("opt_hotel").checked = true;
	document.getElementById("opt_flight").checked = false;
	document.getElementById("opt_hotelflight").checked = false;
	document.getElementById("opt_visa").checked = false;
	document.getElementById("opt_visa_hotel").checked = false;
	document.getElementById("opt_visa_flight").checked = false;
	document.getElementById("opt_visa_hotel_flight").checked = false;	
	CmsSetCookie("sxlysrc", "opt_hotel");
	
}

function showFlight(){
    
    document.getElementById("roundtrip").checked = true;
//    var tbFlight = document.getElementById("divFlightSearch") ; 
//    if (tbFlight=='undefined'){
//        window.location.reload();
//    }
	document.getElementById("tab_hotel").style.display="none";
	document.getElementById("tab_flight2").style.display="block";
	document.getElementById("tab_hotelflight").style.display="none";
	document.getElementById("tab_visa").style.display="none";
	//document.getElementById("tab_visa_hotel").style.display="none";
	//document.getElementById("tab_visa_flight").style.display="none";
	//document.getElementById("tab_visa_hotel_flight").style.display="none";

	document.getElementById("opt_hotel").checked = false;
	document.getElementById("opt_flight").checked = true;	
	document.getElementById("opt_hotelflight").checked = false;
	document.getElementById("opt_visa").checked = false;
	document.getElementById("opt_visa_hotel").checked = false;
	document.getElementById("opt_visa_flight").checked = false;
	document.getElementById("opt_visa_hotel_flight").checked = false;
	CmsSetCookie("sxlysrc", "opt_flight");
	var divManNum = document.getElementById("divSearch");
	divManNum.style.top = "138px";
	document.getElementById("divSng").style.display = "none";
	document.getElementById("divRound").style.display = "block";
	document.getElementById("divMul").style.display = "none";
	document.getElementById("round").style.display = "none";
	document.getElementById("single").style.display = "none";
	document.getElementById("multi").style.display = "none";
	document.getElementById("round").style.display = "block"; 
}

function showHotelFlight(){
   
//    var tbFlightHotel = document.getElementById("divFlightHotelSearch") ; 
//    prompt("",tbFlightHotel.innerHTML);
	document.getElementById("tab_hotel").style.display="none";
	document.getElementById("tab_flight2").style.display="none";
	document.getElementById("tab_hotelflight").style.display="block";
	document.getElementById("tab_visa").style.display="none";
	//document.getElementById("tab_visa_hotel").style.display="none";
	//document.getElementById("tab_visa_flight").style.display="none";
	//document.getElementById("tab_visa_hotel_flight").style.display="none";

	document.getElementById("opt_hotel").checked = false;
	document.getElementById("opt_flight").checked = false;
	document.getElementById("opt_hotelflight").checked = true;
	document.getElementById("opt_visa").checked = false;
	document.getElementById("opt_visa_hotel").checked = false;
	document.getElementById("opt_visa_flight").checked = false;
	document.getElementById("opt_visa_hotel_flight").checked = false;
	CmsSetCookie("sxlysrc", "opt_hotelflight");
}

function showVisa() {
//    var tbVisa = document.getElementById("divVisaSearch") ; 
//    if (tbVisa=='undefined'){
//        window.location.reload();
//    }
    //window.location.reload();
	document.getElementById("tab_hotel").style.display="none";
	document.getElementById("tab_flight2").style.display="none";
	document.getElementById("tab_hotelflight").style.display="none";
	document.getElementById("tab_visa").style.display="block";
//	//document.getElementById("tab_visa_hotel").style.display="none";
//	//document.getElementById("tab_visa_flight").style.display="none";
//	//document.getElementById("tab_visa_hotel_flight").style.display="none";
	document.getElementById("opt_hotel").checked = false;
	document.getElementById("opt_flight").checked = false;
	document.getElementById("opt_hotelflight").checked = false;
	document.getElementById("opt_visa").checked = true;
	document.getElementById("opt_visa_hotel").checked = false;
	document.getElementById("opt_visa_flight").checked = false;
	document.getElementById("opt_visa_hotel_flight").checked = false;
	CmsSetCookie("sxlysrc", "opt_visa");
}

function showVisaHotel(){
	document.getElementById("tab_hotel").style.display="block";
	document.getElementById("tab_flight2").style.display="none";
	document.getElementById("tab_hotelflight").style.display="none";
	document.getElementById("tab_visa").style.display="none";
	document.getElementById("tab_hotel").style.display="block";
	document.getElementById("opt_hotel").checked = false;
	document.getElementById("opt_flight").checked = false;
	document.getElementById("opt_hotelflight").checked = false;
	document.getElementById("opt_visa").checked = false;
	document.getElementById("opt_visa_hotel").checked = true;
	document.getElementById("opt_visa_flight").checked = false;
	document.getElementById("opt_visa_hotel_flight").checked = false;
	CmsSetCookie("sxlysrc", "opt_visa_hotel");
	
}

function showVisaFlight(){
	document.getElementById("tab_hotel").style.display="none";
	document.getElementById("tab_flight2").style.display="block";
	document.getElementById("tab_hotelflight").style.display="none";
	document.getElementById("tab_visa").style.display="none";
	document.getElementById("opt_hotel").checked = false;
	document.getElementById("opt_flight").checked = false;
	document.getElementById("opt_hotelflight").checked = false;
	document.getElementById("opt_visa").checked = false;
	document.getElementById("opt_visa_hotel").checked = false;
	document.getElementById("opt_visa_flight").checked = true;
	document.getElementById("opt_visa_hotel_flight").checked = false;
	CmsSetCookie("sxlysrc", "opt_visa_flight");
}

function showVisaHotelFlight(){
	document.getElementById("tab_hotel").style.display="none";
	document.getElementById("tab_flight2").style.display="none";
	document.getElementById("tab_hotelflight").style.display="block";
	document.getElementById("tab_visa").style.display="none";
	document.getElementById("opt_hotel").checked = false;
	document.getElementById("opt_flight").checked = false;
	document.getElementById("opt_hotelflight").checked = false;
	document.getElementById("opt_visa").checked = false;
	document.getElementById("opt_visa_hotel").checked = false;
	document.getElementById("opt_visa_flight").checked = false;
	document.getElementById("opt_visa_hotel_flight").checked = true;
	CmsSetCookie("sxlysrc", "opt_visa_hotel_flight");
}

function showTicket(){
	CmsSetCookie("sxlysrc", "opt_ticket");
}

function hotelRoomChange(){
    
	var ddl = document.getElementById("ht_roomnum");
    //alert(ddl.options(ddl.selectedIndex).value);
	var strRoomNum = ddl.options(ddl.selectedIndex).value;
    
	var i=1;
	for (i=1;i<=parseInt(strRoomNum);i++){
		document.getElementById("tr_ren"+i).style.display="block";
	}
	for (i=(parseInt(strRoomNum)+1);i<=5;i++){
		document.getElementById("tr_ren"+i).style.display="none";
	}
    //AdSearchHotel(strRoomNum);
	//为了不让鼠标滚动改变房间数量
	
	document.getElementById("tab_main").focus();
}

//function AdSearchHotel(roomNum){
//    var divAdHotel = document.getElementById("divAdHotel");
//    if (roomNum >= 6){
//        divAdHotel.style.left = "173px";
//    }else{
//        divAdHotel.style.left = "11px";
//    }
//}

function hotelflightroomChange(){
	var ddl = document.getElementById("va_roomnum");
	var strRoomNum = ddl.options(ddl.selectedIndex).value;
    
	var i=1;
	for (i=1;i<=parseInt(strRoomNum);i++){
		document.getElementById("va_ren"+i).style.display="block";
	}
	for (i=(parseInt(strRoomNum)+1);i<=5;i++){
		document.getElementById("va_ren"+i).style.display="none";
	}
	//为了不让鼠标滚动改变房间数量
	
	document.getElementById("tab_main").focus();
}


function showHotelAdvanceSearch(){
	var pageName = "";
	try{
		pageName = document.getElementById("pagename").value;
	}catch(ex){
	}
	if (pageName == "host"){
		document.location.href = "/Default_hotel.aspx";
		return false;
	}
	if (document.getElementById("hotelAdv1").style.display == "none"){
		document.getElementById("hotelAdv1").style.display="block";
		document.getElementById("hotelAdv2").style.display="block";
		document.getElementById("ht_hotelname").focus();
		document.getElementById("ht_showadv").value = "1";
	}else{
		document.getElementById("hotelAdv1").style.display="none";
		document.getElementById("hotelAdv2").style.display="none";
		document.getElementById("ht_showadv").value = "0";
	}
	return false;
}

function GetdiffDays(date1, date2){
	var d1 = new String(date1);
	d1 = d1.replace("-", "/");
	d1 = d1.replace("-", "/");
	
	var d2 = new String(date2);
	d2 = d2.replace("-", "/");
	d2 = d2.replace("-", "/");

	var mill = (new Date(d2)).getTime() - (new Date(d1)).getTime();
	if (mill < 0){
		return -1;
	}
	var days = mill / 1000 / 60 / 60 / 24;
	return days;
}

function CmsSetCookie(name, value){
	document.cookie = name + "=" + value + ";";
}

function CmsGetCookie(name){
	var cookies = document.cookie;
	var start = cookies.indexOf(name + "=");
	if (start == -1){
		return "";
	}
	start = cookies.indexOf("=", start) +1;
	var end = cookies.indexOf(";", start);
	if (end == -1){
		end = cookies.length;
	}

	var value = unescape(cookies.substring(start, end));
	if (value == null){
		return ""
	}else{
		return value;
	}
}

//Eric 2007-12-25 add 
function submitTopDealSearch(disableDateVerify){

	var strUrl = "/TopDealSearchResult.aspx?top=1";
	//var strtopic = document.getElementById("ht_topic").value;
	var strtopic = document.getElementById("jp_topic").value;
	if (strtopic != ""){
			strUrl += "&topic=" + escape(strtopic);
	}
	//var strdes = document.getElementById("ht_destination").value;
	var strdes = document.getElementById("jp_destination").value;
	if (strdes != ""){
	strUrl += "&destination=" + escape(strdes) ;
	}
	
	var strtopicname = document.getElementById("ht_topicname").value;
	if (strtopicname != ""){
	strUrl += "&topicname=" + escape(strtopicname) ;
	}
	document.location.href = strUrl;
	return false;
}

//数据库得到城市代码
//cityName 是城市的中文名或者英文名，返回该城市的ivision城市代码
function IsIvisionCity(cityName){   //判断一个城市是否是ivision数据库中的城市    这里需要调用cms.js的一个方法（F3AjaxGetrowsBySql(strResID, strSql)）
    try{   
        if(cityName){  
            var strSql="SELECT C3_216256156406,C3_218046398750,C3_227668916984 FROM CT216256020687 WHERE C3_218046398750 = '"+cityName+"' OR C3_216256156406 = '"+cityName+"' AND C3_227668916984 <> '' "  
            //prompt("121",strSql);
            var strResID="216256020687";
            //prompt("121",strSql);
            var xmlDoc = F3AjaxGetRowsBySql(strResID, strSql)    //利用cms.js 访问数据库，返回xmlDoc。
            var intNodNum = F3GetXmlDocLength(xmlDoc, "F3AJAX_DATA"); //返回符合城市的个数。
            if(intNodNum>0){;
                var rootNode = xmlDoc.documentElement;        //写的可能有些啰嗦，但是比较容易理解。
                var sonNode = rootNode.childNodes[0];
                //alert(sonNode.childNodes.length);         // 不管数据库有没中文名或者英文名，都会封装到节点中去，节点数为3个。
                var node = sonNode.childNodes[2];
                if(node.text){
                    return node.text;           //返回城市代码
                }
            }else{
                return "";
            }
            
        }else{
            alert("您输入城市不正确,请核对,谢谢！");
        }      
    }catch(ex){
        return null;
    }   
}

//得到城市代码
//cityNameId 是城市的文本框的Id
//cityCodeId 是城市的隐藏域的Id
function GetCityCode(cityNameId,cityCodeId){
    var strCityName=document.getElementById(cityNameId).value;   

    var cityCode = "";
    if(!strCityName ){
         alert("很抱歉，您所选的城市目前没能搜索到合适的城市。");
         document.getElementById(cityNameId).focus();
         return "";
    }else{
        var strCityCode=document.getElementById(cityCodeId).value;    
        if(strCityCode == ""){
            //alert(strCityName);
            cityCode = IsIvisionCity(strCityName);
            return cityCode;
        }else{
            cityCode=strCityCode;
            return cityCode;
        }      
    }
}

//得到下拉框的时间
function GetTime(selectId){
   var time = document.getElementById(selectId).value;
   if(time){
        return time;
   }else{
        return 25;
   }
   return null;
}

//文本框日期
function Getdate(txtId){
   var gDate = document.getElementById(txtId).value;
   if (!F3IsDate(gDate)){
		alert("请输入有效的日期");
		document.getElementById(txtId).focus();
		return false;
	}
	return gDate;
}

//验证日期
//jbjdate 校验：入住日期和离店日期不能早于今天日期
//校验日期间隔不能超过10天 （10天允许）
function CheckInputdate(date1,date2,disableDateVerify,strErrMsg){
    var days = GetdiffDays(date1, date2); 
    if (days < 0 ){
        alert(strErrMsg);
        return false;
    }
    if (disableDateVerify != 1){
        var daysCheckin = GetdiffDays(date1, (new Date()).toString());
        if (daysCheckin >= 1 ){
	    alert("出发日期不能早于今天日期");
	    return false;
        }
    }   	
    if(null==date1 || null==date2){
        alert("日期不能为空");
        return false;
    }	
    return true;	
}

//
function GetCity(txtInput,txtCityName,colCityName,txtCityCode,colCityCode,txtCityName2,colCityName2,txtCityCode2,colCityCode2){
    try{
        var e = event || window.event;
        if (e.keyCode == 13 || e.keyCode == 38 || e.keyCode == 40){
            return ;
        } 
        var aryToSet = new Array();
        if (txtCityName && colCityName){
            var aryCityName = new Array();
            aryCityName.push(txtCityName);
            aryCityName.push(colCityName);
            aryToSet[0] = aryCityName;
        }
        
        if(txtCityCode && colCityCode){
            var aryCityCode = new Array();
            aryCityCode.push(txtCityCode);
            aryCityCode.push(colCityCode);
            aryToSet[1] = aryCityCode;
        }
        
        if (txtCityName2 && colCityName2){
            var aryCityName2 = new Array();
            aryCityName2.push(txtCityName2);
            aryCityName2.push(colCityName2);
            aryToSet[2] = aryCityName2;
        }
        
        if(txtCityCode2 && colCityCode2){
            var aryCityCode2 = new Array();
            aryCityCode2.push(txtCityCode2);
            aryCityCode2.push(colCityCode2);
            aryToSet[3] = aryCityCode2;
        }

        var strInput = document.getElementById(txtInput.id).value;   //
        var strSql = "SELECT DISTINCT TOP 8 C3_216256156406,C3_218046398750,C3_227668916984 FROM CT216256020687 WHERE C3_218046398750 LIKE '%"+strInput+"%' OR C3_216256156406 LIKE '"+strInput+"%' AND C3_227668916984 IS NOT NULL AND C3_218046398750 IS NOT NULL";    //C3_216256156406 like '%"+inputField+"%'
        var strResId = '216256020687';    //城市资源id:216256020687  通用资源Id:227895974187
        var aryToShow = new Array('C3_216256156406','C3_218046398750'); //这里创建一个数组,用来限定检索框里要显示的指定列.  
        AutoComplete(txtInput,strSql,strResId,aryToShow,aryToSet); //鼠标点击选中行,会将选中行的部分数据封装进全局变量g_arraysOfAutoComplete,一个数组中,可以直接进行解析访问.  
        //var childNode = xmlDoc.documentElement;
        //alert(childNode.childNodes(0).childNodes(0).text);
        //g_array = null ;
    }catch(ex){
        return false;        
    }
 
}

//得到订单用户的详细信息，首先，将所有的需要的字段，以及对应的表单元素都一一对应。
function GetGuest(txtInput,txtName,colName,txtCountry,colCountry,txtGender,colGender,txtBirth,colBirth,txtCertificate,colCertificate,txtStartdate,colStartdate,txtEndDate,colEndDate,txtBirthPro,colBirthPro,txtVisaPro,colVisaPro,txtPhone,colPhone,txtOrderManNo){
    try {
        var aryToSet = new Array();

        if (txtName && colName) {
            var aryName = new Array();
            aryName.push(txtName);
            aryName.push(colName);
            aryToSet[0] = aryName;
        }

        if (txtGender && colGender) {
            var aryGender = new Array();
            aryGender.push(txtGender);
            aryGender.push(colGender);
            aryToSet[1] = aryGender;
        }

        if (txtBirth && colBirth) {
            var aryBirth = new Array();
            aryBirth.push(txtBirth);
            aryBirth.push(colBirth);
            aryToSet[2] = aryBirth;
        }

        if (txtCertificate && colCertificate) {
            var aryCertificate = new Array();
            aryCertificate.push(txtCertificate);
            aryCertificate.push(colCertificate);
            aryToSet[3] = aryCertificate;
        }

        if (txtStartdate && colStartdate) {
            var aryStartdate = new Array();
            aryStartdate.push(txtStartdate);
            aryStartdate.push(colStartdate);
            aryToSet[4] = aryStartdate;
        }

        if (txtEndDate && colEndDate) {
            var aryEndDate = new Array();
            aryEndDate.push(txtEndDate);
            aryEndDate.push(colEndDate);
            aryToSet[5] = aryEndDate;
        }

        if (txtBirthPro && colBirthPro) {
            var aryBirthPro = new Array();
            aryBirthPro.push(txtBirthPro);
            aryBirthPro.push(colBirthPro);
            aryToSet[6] = aryBirthPro;
        }

        if (txtVisaPro && colVisaPro) {
            var aryVisaPro = new Array();
            aryVisaPro.push(txtVisaPro);
            aryVisaPro.push(colVisaPro);
            aryToSet[7] = aryVisaPro;
        } 

        if (txtPhone && colPhone) {
            var aryPhone = new Array();
            aryPhone.push(txtPhone);
            aryPhone.push(colPhone);
            aryToSet[8] = aryPhone;
        }


        var strInput = document.getElementById(txtInput.id).value;
        //订单客人SQL
        var strSql = "SELECT DISTINCT TOP 8 C3_220312659406,C3_267553549178,C3_220312678562,C3_220312691609,C3_220312704156,C3_267553584381,C3_267553599053,C3_373132253578,C3_373132262796,C3_373244521031 FROM CT220312797031 WHERE C3_220312659406 LIKE '" + strInput + "%' AND  C3_220312835234='" + txtOrderManNo + "'";
        var strResId = "220312797031";
        var aryToShow = new Array('C3_220312659406', 'C3_267553549178');
        AutoComplete(txtInput, strSql, strResId, aryToShow, aryToSet);
        return false;
    } catch (ex) {
        alert(ex.Message);
        return false;
    }
}

//查询国家信息,本来是要做签证的检索框功能，现在取消，维持原有的签证检索（下拉框）功能。
//function GetCountry(txtInput,txtName,colName,txtCountryCode,colCountryCode){
//    var aryToSet = new Array();
//    if(txtName && colName){
//        var aryCountry = new Array();
//        aryCountry.push(txtName);
//        aryCountry.push(colName);
//        aryToSet[0] = aryCountry;      
//    }
//    if(txtCountryCode && colCountryCode){
//        var aryCode = new Array();
//        aryCode.push(txtCountry);
//        aryCode.push();
//    }
//}

//创建xmlHttpRequest对象
function createXMLHttpRequest(){
    if(window.XMLHttpRequest){ //Mozilla 
        XMLHttpReq = new XMLHttpRequest();
     }else if(window.ActiveXObject){
        try{
            XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){
                return false;
            }
        }
    }else{
        alert("该浏览器不支持该项功能.");
    }
}

function waitingPage(url){
    try{
        createXMLHttpRequest();
        XMLHttpReq.open("get",url,true);
        XMLHttpReq.send(null); //发送请求
        XMLHttpReq.onreadystatechange = proce;   //指定响应的函数
    }catch(ex){
        return false;
    }
}

function proce(){
    if(XMLHttpReq.readyState==4){
        if(XMLHttpReq.status==200){
            var xmlDoc = XMLHttpReq.responseText;
            document.write(xmlDoc);
        }else{
            
        }
    }
}



//此方法是获得控件的坐标值
//field 是控件对象
//attr 是控件的属性例如:"offsetLeft" 或者"offsetTop"

function GetOffset(field,attr){
	var offset=0;
	while(field){
		offset += field[attr];
		field = field.offsetParent;
	}
	return offset;
}




function CheckCustomerName(){
    var intPersonNum = parseInt(document.getElementById("customerNum").value) ;  
    for(var i = 1; i <= intPersonNum;i++){
        var strName = "txtName" ;
        strName = strName + i ; 
        var strNameReg = document.getElementById(strName).value;
        var strReg = new RegExp("([A-Za-z]{2,6})\/+([A-Za-z])"); 
        if(document.getElementById(strName).value == ""){
            alert("请填写随行人员的基本信息");
            document.getElementById(strName).focus();
            return false;
        }else{
            if(strReg.test(strNameReg)){
            
            }else{
                alert("请按照规定格式输入您的姓名！例如:张学友 填写 ZHANG/XUEYOU");
                document.getElementById(strName).focus();
                return false;
            }
        }
    }
    return true;
}

function CheckChildNum(){
    var aryCheckboxes = document.getElementsByName("intChildNum");
    var intChild = document.getElementById("customerChildNum").value;
    var datCheckin = document.getElementById("customerCheckinDate").value;
    var intNum = 0;
    try{
        for(var i=1;i<=aryCheckboxes.length;i++){
            if(aryCheckboxes[i-1].checked == true){
                var childBirthId = "txtBirth" + i;
                var datBirthday = document.getElementById(childBirthId).value;
                if(F3IsDate(datBirthday)){
                    var datNewBirth = F3ConvertDate(datBirthday);
                    var datNewCheckin = F3ConvertDate(datCheckin);
                    if((datNewCheckin.getFullYear() - datNewBirth.getFullYear())>12){
                        alert("该客人已超过了儿童的年龄限制!");
                        document.getElementById(childBirthId).focus();
                        return false;
                    }
                }else{
                    alert("请填写儿童生日!");
                    return false;
                }
                intNum ++ ;
            }
        }
        if(intNum == intChild){
            return true;
        }else{
            alert("儿童数量不符,请核对后确认！");
            return false;
        }
    }catch(ex){
        alert(ex.Message);
        return false;
    }
}

function CheckVisa(){
    var intPersonNum = parseInt(document.getElementById("customerNum").value) ; 
    try{
        for(var i = 1;i<=intPersonNum;i++){
            var check = CheckOneVisa(i);
            if (check == false) {
                return false;
            }
        }
        return true;
    }catch(ex){
        alert(ex.Message);
        return false;
    }
}

function CheckOneVisa(i) {
    var CredentialsTypeId = "txtCredentialsType" + i;
    var strCredentialsType = document.getElementById(CredentialsTypeId).value;
    if (strCredentialsType && strCredentialsType == "W") {
        var VisaId = "txtVisaType" + i;
        var strVisaName = document.getElementById(VisaId).value;
        if (!strVisaName) {
            alert("请选择签注类型");
            document.getElementById(VisaId).focus();
            return false;
        }
    }
}


function StartChange(btn) {
    var btnId = btn.id;
    if (btnId) {
        var i = btnId.substring(12);
        var btnCustomer = document.getElementById(btnId);
        btnCustomer.style.display = "none";
        document.getElementById("subCustomer_" + i).style.display = "block";
        document.getElementById("cleCustomer_" + i).style.display = "block";
        IsEnable(false, i);
    }
}

function SubChange(btn) {
    var btnId = btn.id;
    if (btnId) {
        var i = btnId.substring(12);
        document.getElementById("subCustomer_" + i).disabled = true;
        document.getElementById("cleCustomer_" + i).disabled = true; 
        document.getElementById("CustomersIndex").value = i;
        document.getElementById("CustomersNo").value = document.getElementById("CustomerNo_" + i).value;
        var check = CheckOneVisa(i);
        if (check == false) {
            return false;
        }
        document.getElementById("watCustomer_" + i).style.display = "block";
        document.getElementById("Form1").submit();
        return false;
    }
}

function CleChange(btn) {
    var btnId = btn.id;
    if (btnId) {
        var i = btnId.substring(12);
        var btnCustomer = document.getElementById(btnId);
        document.getElementById("subCustomer_" + i).style.display = "none";
        document.getElementById("cleCustomer_" + i).style.display = "none";
        document.getElementById("edtCustomer_" + i).style.display = "block";
        IsEnable(true, i);
        
    }
}

function IsEnable(blnChange, i) {
    document.getElementById("txtCertificate" + i).disabled = blnChange;
    document.getElementById("txtStartDate" + i).disabled = blnChange;
    document.getElementById("txtEndDate" + i).disabled = blnChange;
    document.getElementById("txtCredentialsCountry" + i).disabled = blnChange;
    document.getElementById("txtCredentialsType" + i).disabled = blnChange;
    document.getElementById("txtBirth" + i).disabled = blnChange;
    document.getElementById("txtGender" + i).disabled = blnChange;
    document.getElementById("txtVisaType" + i).disabled = blnChange;
    document.getElementById("txtCountry" + i).disabled = blnChange;
    document.getElementById("txtBirthPro" + i).disabled = blnChange;
    document.getElementById("txtVisaPro" + i).disabled = blnChange;
    document.getElementById("txtPhone" + i).disabled = blnChange;
}

//添加天数
function addDay(d, days) {
    try {
        if (F3IsDate(d)) {
            var d1 = d.replace(/\-/g, '\/');
            var date = new Date(d1);
            var dateMs = date.valueOf();
            dateMs = dateMs + 24 * 60 * 60 * 1000 * F3ParseInt(days);
            var date2 = new Date(dateMs);
            var outputdate = "";
            outputdate = (date2.getYear() < 1900) ? (1900 + date2.getYear()) + "-" + (date2.getMonth() + 1) + "-" + date2.getDate() : date2.getYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate();
            return outputdate;
        }
    } catch (ex) {

    }
}

function ChangeDivShow(spn) {
    var spanid = spn.id;
    switch (spanid) {
        case "spnWhereToGo":
            ShowDiv("divWhereToGo");
            break;
        case "spnEarly":
            ShowDiv("divEarly");
            break;
        case "spnLastDay":
            ShowDiv("divLastDay");
            break;
        default:
            ShowDiv("divLastDay");
    }
}

function ShowDiv(spnid) {
    var spn = document.getElementById(spnid);
    if (spn) {
        HidenDiv();
        document.getElementById(spnid).style.display = "block";
    }
}

function HidenDiv() {
    document.getElementById("divLastDay").style.display = "none";
    document.getElementById("divEarly").style.display = "none";
    document.getElementById("divWhereToGo").style.display = "none";
}


function ChooseProduct(spn) {
    try {
        if (spn.id) {
            var strProductId = spn.id;
            var intProduct = 1 + strProductId.lastIndexOf("_");
            var strProduct = strProductId.substring(intProduct);
            var strUrl = "/ServiceProductDetail.aspx?productNo=" + escape(strProduct);
            window.location.href = strUrl;
            return false;
        }
    } catch (e) {
        alert(e.Message);
    }
}


function UserInputCheck(textObj,textType) {
    var strText = textObj.value;
    if (textObj && strText) {
        var strUrl = "/UserInputCheck.aspx";
        var strPostBody = "f3svc_input=" + strText;
        var xmlReq = F3AjaxSendHttpRequest("POST",strUrl,false,strPostBody);
        //var strSql = "SELECT REN_HANDSET,REN_EMAIL FROM CT184763717169 WHERE REN_HANDSET = '" + textObj + "' OR REN_EMAIL = '" + strText + "'";
        if (xmlReq) {
            var intCount = xmlReq.responseText;
            switch (textType) {
                case "phone":
                    var spnPhone = document.getElementById("phoneTip");
                    if (intCount == "1") {
                        spnPhone.style.color = "red";
                        spnPhone.innerText = "您输入的手机号码已经被注册";
                        //document.getElementById("phoneTip").value = "";
                    } else {
                        spnPhone.style.color = "green";
                        spnPhone.innerText = "手机号码未被使用，可以注册";
                    }
                    return;
                case "email":
                    var spnEmail = document.getElementById("emailTip");
                    if (intCount == "1") {
                        spnEmail.style.color = "red";
                        spnEmail.innerText = "您输入的电子邮件已经被注册";
                        //document.getElementById("phoneTip").value = "";
                    } else {
                        spnEmail.style.color = "green";
                        spnEmail.innerText = "电子邮件未被使用，可以注册";
                    }
                    return;
                default:
                    return;
            }
        }
    }
}


