﻿// JScript 文件
function setCheckInDate(d)
    {

	    document.getElementById("StartDate").value=d;
	    var cf=document.getElementById("CalFrame");
	    document.getElementById("EndDate").value=d;
	    showCalendar("EndDate",false,"EndDate","","");
	    document.getElementById("EndDate").value="";	
    }
    mainLoop = function()
		{
			val = escape(queryField.value);				
			if (lastVal != val)
			{				
				var response = Index.GetSearchItems(val);
				showQueryDiv(response.value);
				lastVal = val;
			}				
			setTimeout('mainLoop()', 10);
			return true;
		}
 function SearchBackground(strType)
	    {
	        if(strType == "hotel")
	        {
		        sHotel.background = "/images/homesearch1.gif";
		        sHomeHotel.background = "/images/homesearch2.gif";
		        sTripLine.background = "/images/homesearch2.gif";
		        sSight.background = "/images/homesearch2.gif";
		        sContext.innerHTML = unescape(Index.GetRoomDatePrice('hotel','<%=ViewState["CyId"].ToString()%>').value);
		    }
		    if(strType == "homehotel")
	        {
		        sHotel.background = "/images/HomeSearchleft1.gif";
		        sHomeHotel.background = "/images/homesearch3.gif";
		        sTripLine.background = "/images/homesearch2.gif";
		        sSight.background = "/images/homesearch2.gif";
		        sContext.innerHTML = unescape(Index.GetRoomDatePrice('homehotel','<%=ViewState["CyId"].ToString()%>').value);
		    }
		    if(strType == "tripline")
	        {
		        sHotel.background = "/images/HomeSearchleft1.gif";
		        sHomeHotel.background = "/images/homesearch2.gif";
		        sTripLine.background = "/images/homesearch3.gif";
		        sSight.background = "/images/homesearch2.gif";
		        sContext.innerHTML = unescape(Index.GetRoomDatePrice('tripline','').value);
		    }
		    if(strType == "sight")
	        {
		        sHotel.background = "/images/HomeSearchleft1.gif";
		        sHomeHotel.background = "/images/homesearch2.gif";
		        sTripLine.background = "/images/homesearch2.gif";
		        sSight.background = "/images/homesearch3.gif";
		        sContext.innerHTML = unescape(Index.GetRoomDatePrice('sight','').value);
		    }
		}
		function SearchSubmitHotel()
		{
		    strHCNName = document.getElementById("HCNName").value;
		    strStar = document.getElementById("star").value;
		    strPrice = document.getElementById("Price").value;
		    strPdId = "";
		    if(document.getElementById("PdId") == null)
		    {
		    
		    }
		    else
		    {
		        strPdId = document.getElementById("PdId").value;
		    }
		    strHKysj = "";
		    if(document.getElementById("HKysj") == null)
		    {}
		    else
                    {
		    	strHKysj = document.getElementById("HKysj").value;
		    }
		    strHAId = document.getElementById("HAId").value;
		    strStartDate = document.getElementById("StartDate").value;
		    if(strStartDate == "")
		    {
		        alert("请选择入住日期");
		        document.getElementById("StartDate").focus();
		        return false;
		    }
		    strEndDate = document.getElementById("EndDate").value;
		    if(strEndDate == "")
		    {
		        alert("请选择离店日期");
		        document.getElementById("EndDate").focus();
		        return false;
		    }
		    location.href="/hotel/hotelsearchlist.aspx?HCNName=" + strHCNName + "&Star=" + strStar + "&Price=" + strPrice + "&PdId=" + strPdId + "&HAId=" + strHAId + "&StartDate=" + strStartDate + "&EndDate=" + strEndDate + "&HKysj=" + strHKysj;
		    
		}
		function SearchSubmitHomeHotel()
		{
		    strHiName = document.getElementById("HiName").value;
		    strPrice = document.getElementById("Price").value;
		    strPdId = document.getElementById("PdId").value;
		    strHAId = document.getElementById("HAId").value;
		    location.href="/homehotel/?HiName=" + strHiName + "&Price=" + strPrice + "&PdId=" + strPdId + "&HAId=" + strHAId;
		}
		function SearchSubmitTripLine()
		{
		    strCyId = document.form1.CyId.value;
		    strEndCyId = document.form1.EndCyId.value;
		    strKeyWord = document.form1.KeyWord.value;
		    location.href="/TripLine/?CyId=" + strCyId + "&EndCyId=" + strEndCyId + "&KeyWord=" + strKeyWord;
		}
		function SearchSubmitSight()
		{
		    strCyId = document.form1.SCyId.value;
		    strKeyWord = document.form1.SName.value;
		    location.href="/Sight/?CyId=" + strCyId + "&SName=" + strKeyWord;
		}
		function Sfonchange(strPId,objCy)
		{
		    strResult = unescape(Index.GetCity(strPId).value);
		    aryResult = strResult.split(",");
		    objCy.length = aryResult.length - 1;
		    for(var i=0;i<aryResult.length;i++)
		    {
		        if(aryResult[i] != null && aryResult[i] != "")
		        {
		            aryOpt = aryResult[i].split("|");
		            objCy.options[i].value = aryOpt[0];
					objCy.options[i].text = aryOpt[1];
		        }
		    }
		}
            function owls()
            {
                window.open('http://www.dl766.com/Tripline/TripLineBH000006.html','','');
                return false;
            }
            function owjst()
            {
                window.open('http://www.dl766.com/TripLine/triplineBH000007.html','','');
                return false;
            }
            function owVirtual(URL) {
width=776;height=450;
                var left = ( screen.width - width ) / 2;
                var top = ( screen.height - height ) / 5;
                window.open(URL,'','width=776,height=450,top='+top+',left='+left+',resizable=0');
                return false;
            }
