// JavaScript Document
///publicconst
var PublicWebName =  "腾龙酒店预订网";//window.location.host
var PublicWebURL  =  "http://www.366hotel.com";//window.location.host
var PublicPicURL  =   PublicWebURL+"/photocenter/hotelphoto/";//window.location.host
var PublicTel     =  "010-59237007";
var PublicTelC    =  "400-026-026";//400,800
var PublicFax     =  "010-59237007";
var PublicHotelImagePath ="/hotel/images"
var PublicHotelPath ="/hotels";

//******************************************//右键鼠标产生事件处理中心Start************************
document.onclick=function(){   
if(typeof(hideCalendar)=="function"){

          //日历

          hideCalendar();
                     
      }
if(typeof(hideSuggest)=="function"){

          //suggest城市搜索

          hideSuggest();
                     
      }

if(typeof(hideWriteDistrict)=="function"){

          //区域输出

          hideWriteDistrict();
                     
      }
  }
//******************************************//右键鼠标产生事件处理中心End************************ 
//*****************function*************************//
//Set COOKIE
function SetCookie(name,value,expires,path,domain,secure)
{
    var expDays = expires*24*60*60*1000;
    var expDate = new Date();
    expDate.setTime(expDate.getTime()+expDays);
    var expString = ((expires==null) ? "" : (";expires="+expDate.toGMTString()))
    var pathString = ((path==null) ? "" : (";path="+path))
    var domainString = ((domain==null) ? "" : (";domain="+domain))
    var secureString = ((secure==true) ? ";secure" : "" )
    document.cookie = name + "=" + escape(value) + expString + pathString + domainString + secureString;
} 
//Get CooLike
function GetCookie(name)
{
    var result = null;
    var myCookie = document.cookie + ";";
    var searchName = name + "=";
    var startOfCookie = myCookie.indexOf(searchName);
var endOfCookie;
if (startOfCookie != -1)
{
    startOfCookie += searchName.length;
    endOfCookie = myCookie.indexOf(";",startOfCookie);
    result = unescape(myCookie.substring(startOfCookie, endOfCookie));
}
return result;
} 

//Del CooKIE：
function ClearCookie(name)
{
    var ThreeDays=3*24*60*60*1000;
    var expDate = new Date();
    expDate.setTime(expDate.getTime()-ThreeDays);
    document.cookie=name+"=;expires="+expDate.toGMTString();
}
function DecodeCookie(str) { 
　  var strArr; 
　  var strRtn=""; 
　  strArr=str.split("a"); 　
    for (var i=strArr.length-1;i>=0;i--) 
    {
    strRtn+=String.fromCharCode(eval(strArr[i]));
    }
    return strRtn; 
} 

function CheckLoginText()
{
   if(GetCookie("UserID")!=null&&GetCookie("UserID").length!=0&&GetCookie("UserID")!="0")	
     {
     document.write("　 <a href='/User/Manage.aspx'><font color=green>欢迎您!"+DecodeCookie(GetCookie("UserID"))+"</font></a>")	 
     }
   else
     {
     document.write(" 　　　　　　　·<a href='/User/MyProfile.aspx?action=initlogin&nowurl="+escape(window.location)+"'>登录</a>  ")		 
     document.write("·<a href='/User/MyProfile.aspx?action=initreg&nowurl="+escape(window.location)+"'>注册</a>")	 	 
     }
}
//******************************************HotelPostCheckCenter-Start************************
function HotelSearchCheck()
    {
	var ToDays	= ToDayShortDate();

	if (document.getElementById('keyword'))
        {		
	document.getElementById('city').value=document.getElementById('keyword').value
	}
	if (document.getElementById('city').value==""||document.getElementById('city').value=="中文或拼音") {
		
		alert('请选择或填写酒店所在城市！');		
		if(document.getElementById('TextCity'))	{
		document.getElementById('TextCity').focus();
		}
		else{
		if(document.getElementById('keyword')){
		document.getElementById('keyword').focus();				
		}
		else{
		document.getElementById('city').focus();
		}
		}
		return false;
		
	}
	if (document.getElementById('HotelName')){
	if (document.getElementById('HotelName').value=="中文或英文")
        {
		document.getElementById('HotelName').value="";
	}
	}
		
	if (document.getElementById('StartDate').value.length==0){
	    alert("请输入入住时间！");
		document.getElementById('StartDate').focus();
		return false
	}	
	if(!isDateString(document.getElementById('StartDate').value)){
		alert("入住时间不符合格式规范或无效的日期！");
		document.getElementById('StartDate').focus();
		return false
	}
	if (stringToDate(document.getElementById('StartDate').value,true)<stringToDate(ToDays,true)){
	    alert("入住时间不能早于"+document.getElementById('StartDate').value+"！");
		document.getElementById('StartDate').focus();
		return false
	}
	if (compareDate1(ToDays,parent.document.getElementById('StartDate').value)){
		alert('本系统不支持晚于或等于'+document.getElementById('StartDate').value+'号的网上预订,如有需要请与'+PublicWebName+'预订部联系,'+PublicTel+'，我们会竭诚为您服务。');
		return false}
	
	if (document.getElementById('DepDate').value.length==0){
		alert("请输入离店时间！");
		document.getElementById('DepDate').focus();
		return false
	}	
	if(!isDateString(document.getElementById('DepDate').value)){
		alert("离店时间不符合格式规范或无效的日期！");
		document.getElementById('DepDate').focus();
		return false
	}
	if (stringToDate(document.getElementById('DepDate').value,true)<=stringToDate(document.getElementById('StartDate').value,true)){
		alert("离店时间不能早于或等于入住时间"+document.getElementById('StartDate').value+"！");
		document.getElementById('DepDate').focus();
		return false
	}

	if (compareDate(document.getElementById('StartDate').value,document.getElementById('DepDate').value)){
		alert('本系统不支持大于25天以上的网上预订，如有需要请与'+PublicWebName+'预订部联系,'+PublicTel+'，我们会竭诚为您服务。');
		return false
	}
	document.getElementById('SearchForm').action="/Hotels/Search.aspx"
	return true;
}


function HotelDateCheck(PostStartDate,PostDepDate)
    {
	var ToDays	= ToDayShortDate();

	
	if (document.getElementById(PostStartDate).value.length==0){
	    alert("请输入入住时间！");
		document.getElementById(PostStartDate).focus();
		return false
	}	
	if(!isDateString(document.getElementById(PostStartDate).value)){
		alert("入住时间不符合格式规范或无效的日期！");
		document.getElementById(PostStartDate).focus();
		return false
	}
	if (stringToDate(document.getElementById(PostStartDate).value,true)<stringToDate(ToDays,true)){
	    alert("入住时间不能早于"+document.getElementById(PostStartDate).value+"！");
		document.getElementById(PostStartDate).focus();
		return false
	}
	if (compareDate1(ToDays,parent.document.getElementById(PostStartDate).value)){
		alert('本系统不支持晚于或等于'+document.getElementById(PostStartDate).value+'号的网上预订，如有需要请与'+PublicWebName+'预订部联系,'+PublicTel+'，我们会竭诚为您服务');
		return false}
	
	if (document.getElementById(PostDepDate).value.length==0){
		alert("请输入离店时间！");
		document.getElementById(PostDepDate).focus();
		return false
	}	
	if(!isDateString(document.getElementById(PostDepDate).value)){
		alert("离店时间不符合格式规范或无效的日期！");
		document.getElementById(PostDepDate).focus();
		return false
	}
	if (stringToDate(document.getElementById(PostDepDate).value,true)<=stringToDate(document.getElementById(PostStartDate).value,true)){
		alert("离店时间不能早于或等于入住时间"+document.getElementById(PostStartDate).value+"！");
		document.getElementById(PostDepDate).focus();
		return false
	}

	if (compareDate(document.getElementById(PostStartDate).value,document.getElementById(PostDepDate).value)){
		alert('本系统不支持大于25天以上的网上预订，如有需要请与'+PublicWebName+'预订部联系,'+PublicTel+'，我们会竭诚为您服务');
		return false
	}
	document.getElementById('SearchForm').action="/Hotels/HotelSearchResult.aspx"
	return true;
}

function OrderHotelDateCheck(PostStartDate,PostDepDate)
    {
	var ToDays	= ToDayShortDate();

	
	if (document.getElementById(PostStartDate).value.length==0){
	    alert("请输入入住时间！");
		document.getElementById(PostDepDate).focus();
		return false
	}	
	if(!isDateString(document.getElementById(PostStartDate).value)){
		alert("入住时间不符合格式规范或无效的日期！");
		document.getElementById(PostStartDate).focus();
		return false
	}
	if (stringToDate(document.getElementById(PostStartDate).value,true)<stringToDate(ToDays,true)){
	    alert("入住时间不能早于"+document.getElementById(PostStartDate).value+"！");
		document.getElementById(PostStartDate).focus();
		return false
	}
	if (compareDate1(ToDays,parent.document.getElementById(PostStartDate).value)){
		alert('本系统不支持晚于或等于'+document.getElementById(PostStartDate).value+'号的网上预订，如有需要请与'+PublicWebName+'预订部联系,'+PublicTel+'，我们会竭诚为您服务');
		return false}
	
	if (document.getElementById(PostDepDate).value.length==0){
		alert("请输入离店时间！");
		document.getElementById(PostDepDate).focus();
		return false
	}	
	if(!isDateString(document.getElementById(PostDepDate).value)){
		alert("离店时间不符合格式规范或无效的日期！");
		document.getElementById(PostDepDate).focus();
		return false
	}
	if (stringToDate(document.getElementById(PostDepDate).value,true)<=stringToDate(document.getElementById(PostStartDate).value,true)){
		alert("离店时间不能早于或等于入住时间"+document.getElementById(PostStartDate).value+"！");
		document.getElementById(PostDepDate).focus();
		return false
	}

	if (compareDate(document.getElementById(PostStartDate).value,document.getElementById(PostDepDate).value)){
		alert('本系统不支持大于60天以上的网上预订，如有需要请与'+PublicWebName+'预订部联系,'+PublicTel+'，我们会竭诚为您服务');
		return false
	}
	return true;
}
//******************************************HotelPostCheckCenter-end************************



//******************************************HeadFile-NowTime-Start************************
function WriteNowTime()
{

	var day       ="";
	var month     ="";
	var ampm      ="";
	var ampmhour  ="";
	var myweekday ="";
	var year      ="";
	mydate        =new Date();
	
	myweekday = mydate.getDay();
	mymonth   = mydate.getMonth()+1;
	myday     = mydate.getDate();
	myyear    = mydate.getYear();
    year=(myyear > 200) ? myyear : 1900 + myyear;
	if(myweekday == 0)
	weekday=" 星期日 ";
	else if(myweekday == 1)
	weekday=" 星期一 ";
	else if(myweekday == 2)
	weekday=" 星期二 ";
	else if(myweekday == 3)
	weekday=" 星期三 ";
	else if(myweekday == 4)
	weekday=" 星期四 ";
	else if(myweekday == 5)
	weekday=" 星期五 ";
	else if(myweekday == 6)
	weekday=" 星期六 ";
	document.write(myyear+"年"+mymonth+"月"+myday+"日 "+weekday);
}
//******************************************HeadFile-NowTime-end************************

function CheckNum(NUM) 
{ 
	var i,j,strTemp; 
	strTemp="-.0123456789"; 
	if ( NUM.length== 0) 
	return 0 
	for (i=0;i<NUM.length;i++) 
	{ 
	j=strTemp.indexOf(NUM.charAt(i)); 
		if (j==-1) 
		{ 
		
		return false; 
		} 
	} 

	return true; 
} 

function SHotelPrice()
{

	var H=screen.availHeight
    var W=screen.availWidth
	var WinH=260
	var WinW=570
	window.open("/hotels/price.htm","","height="+WinH+",width="+WinW+",scrollbars=yes,toolbar=no,resizable=yes,location=no, status=no,top="+(H-WinH)/2+"px,left="+(W-WinW)/2+"px");
}

function HotelMap(PostHotelName)
{

		var H=screen.availHeight
        var W=screen.availWidth
		var WinH=300
		var WinW=630
		var city=document.getElementById("city").value
		var HotelName=PostHotelName.replace(city,"")
		window.open("Map.htm?city="+city+"&HotelName="+HotelName,"","height="+WinH+",width="+WinW+",scrollbars=yes,toolbar=no,resizable=yes,location=no, status=no,top="+(H-WinH)/2+"px,left="+(W-WinW)/2+"px");
}	
function HotelEMap(HotelID)
{

		var H=screen.availHeight
        var W=screen.availWidth
		var WinH=500
		var WinW=750
		window.open("/Hotels/EMap.asp?HotelID="+HotelID)
		//window.open("EMap.asp?HotelID="+HotelID,"","height="+WinH+",width="+WinW+",scrollbars=yes,toolbar=no,resizable=yes,location=no, status=no,top="+(H-WinH)/2+"px,left="+(W-WinW)/2+"px");
}

function MoreSearch(PostNum)
{
	if(PostNum==0)
	{
	document.getElementById("MoreSearchBody").style.display=""
	}
}

function LableSearch()
{
	var h_city=document.getElementById("h_city")
	var h_lable=document.getElementById("h_lable")
	if (h_city.value=='城市中文或拼音'||h_city.value=='')
	{
		alert('请输入酒店所在城市')
		h_city.focus()
		return false
		
	}
	if (h_lable.value=='地名/路名/标注性建筑'||h_lable.value=='')
	{
		alert('请输入您要搜索的位置')
		h_lable.focus()
		return false
		
	}	
	window.open("/hotels/searchmap.aspx?city="+escape(h_city.value)+"&lable="+escape(h_lable.value)+"")
}
function $$$(_sId){return document.getElementById(_sId)}

//document.write("<div align=center><font color=red>腾龙网于2010年8月6日上午11：00至下午16：00呼叫中心升级，将会影响电话预订，请广大客户期间尽量使用网络预订或拔打应急电话13760832133，影响您的使用我们深感抱歉！</font></div>")
document.write('<div id="SetQueryString" style="display:none;position:absolute;z-index:99;background-color:#ffffff;border:solid #ff6600 2px" ondblclick="this.style.display=\''+'none'+'\'" onmouseout="this.style.display=\''+'none'+'\'" ></div>')	
function AskMarkString(ListID)
{


	$$$("SetQueryString").innerHTML='<table><tr><td>（1）点评奖金：是指您通过'+PublicWebName+'预订酒店并且入住后，返回登陆'+PublicWebName+'，对您入住的酒店发表点评，经我们核实后，由我们网站返给您的现金奖励。</td></tr><tr><td>（2）点评奖金是由'+PublicWebName+'促销返还的，与酒店无关，所以您不能向酒店前台索要。</td></tr><tr><td>（3）每次的点评奖金暂存入您在'+PublicWebName+'的会员账户，当您账户金额达到200元时，即可申请提现。</td></tr><tr><td>（4）点评奖金制度于2009年5月1日开始施行，即于该日或该日以后提交的订单才可以参与该制度</td></tr></table>';	 
	$$$("SetQueryString").style.display=	'block'
	$$$("SetQueryString").style.top =GetIDLT(ListID,'top')+"px"
	$$$("SetQueryString").style.left=(GetIDLT(ListID,'left'))+"px"	
	
}


