﻿//
Array.prototype.remove = function(aItem) {
    for (var i = 0; i < this.length; i++) {
        if (this[i] == aItem) {
            this.splice(i, 1);
        }
    }
}
Array.prototype.pushone = function(aItem) {
    var contained = false;
    for (var i = 0; i < this.length; i++) {
        if (this[i] == aItem) {
            this.splice(i, 1);
            contained = true;
        }
    }
    if (!contained) {
        this.push(aItem);
    }
}
String.prototype.TrimStr = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
function checkDateFormat(aDateStr) {
    var a = /^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/igm;
    if (a.exec(aDateStr.TrimStr())) {
        return true
    }
    else
        return false
} 
//
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
var is_kon = userAgent.indexOf('konqueror') != -1;
var is_saf = userAgent.indexOf('applewebkit') != -1 || navigator.vendor == 'Apple Computer, Inc.';
var is_mac = userAgent.indexOf('mac') != -1;

//代替document.getElementById() 
function HT$(objID) {
    return document.getElementById(objID);
}
/**********************************************************************************/
/****************************导航条************************************************/
/**********************************************************************************/

var currentid = 0;

$(function() {
    onhtpage_load();
    $(".titleblockmouseout").not($("#titleblock-1")).mouseover(function() {
        var id = $(this).attr("id");

        if (currentid != id) {
            $("#" + id).removeClass("titleblockmouseout").addClass("titleblockmouseon");
            $("#" + id + ">a").css("color", "Black");
            $("#" + id + "_content").removeClass("contentblockinvisible").addClass("contentblockvisible");
            $("#titleblockdefault_content").css("display", "none");
            currentid = id;
        }
    }).mouseout(function() {
        var id = $(this).attr("id");

        $("#" + id).removeClass("titleblockmouseon").addClass("titleblockmouseout");
        $("#" + id + ">a").css("color", "White");
        $("#" + id + "_content").removeClass("contentblockvisible").addClass("contentblockinvisible");
        $("#titleblockdefault_content").css("display", "block");
        currentid = 0;
    });

    $(".contentblockinvisible").mouseover(function() {
        $("#" + $(this).attr("id").substring(0, 11)).attr("className", "titleblockmouseon");
        $("#" + $(this).attr("id").substring(0, 11) + ">a").css("color", "Black");
        $(this).attr("className", "contentblockvisible");
        $("#titleblockdefault_content").css("display", "none");

    }).mouseout(function() {
        $("#" + $(this).attr("id").substring(0, 11)).attr("className", "titleblockmouseout");
        $("#" + $(this).attr("id").substring(0, 11) + ">a").css("color", "White");
        $(this).attr("className", "contentblockinvisible");
        $("#titleblockdefault_content").css("display", "block");

    });
});
/********************* 导航条结束********************************************/


//仿造treeview插件的写法
(function($) {
    var isfoucs = 0;

    var Template;

    var defaults = {
        position: "right",
        css: {
            backgroundColor: "#FFFFE5",
            border: "solid 1px #F79502",
            padding: "2px 5px 2px 5px",
            fontSize: "12px",
            margin: "2px"
        },
        msg: "your input is error!",
        offset: { left: 0, top: 0 }
    };

    $.extend($.fn, {

        showHtip: function(p, css, msg, Offset, nofocus) {
            var hasmsgdiv = $(this).attr("alt");
            if (hasmsgdiv != 1) {

                var p = p || defaults.position;
                var css = css || defaults.css;
                var msg = msg || defaults.msg;
                var offset = Offset || defaults.offset;
                var OffsetL = offset.left;
                var OffsetT = offset.top;

                var divTemp = document.createElement("DIV");
                //继承默认css
                $(divTemp).css(defaults.css);
                $(divTemp).css(css)
                    .attr("id", this.attr("id") + "_HToolTip")
                    .html(msg)
                    .css("position", "absolute")
                    .css("zIndex", "2999");

                var offset = this.offset();
                if (this.parent().css("position") == "relative") {
                    offset = { left: 0, top: 0 };
                }
                if (p == "bottom") {
                    $(divTemp).css("left", OffsetL + offset.left + "px");
                    $(divTemp).css("top", OffsetT + offset.top + this.height() + "px");
                }

                if (p == "right") {
                    $(divTemp).css("left", OffsetL + offset.left + this.width() + "px");
                    $(divTemp).css("top", OffsetT + offset.top + "px");
                }

                this.before(divTemp);
                $(this).attr("alt", 1);
                //drag(divTemp);
            }
            if (!nofocus && isfoucs == 0) {
                this.focus();
                isfoucs = 1;
            }

            return divTemp;
        },

        removeHtip: function() {
            if ($(this).attr("alt") == 1) {
                $("#" + this.attr("id") + "_HToolTip").remove();
                $(this).attr("alt", 0);
                if (isfoucs == 1) {
                    isfoucs = 0;
                }
            }
        },

        showHtipEx: function(p, msg, Offset) {

            var divhtml = Template;
            divhtml = divhtml.replace("$msg", msg);
            $(this).showHtip(p, {}, divhtml, Offset);
        }
    });

    $.extend($, {
        //加载模板
        loadHtipExTemplate: function(template) {
            Template = template;
        }
    });

})(jQuery);

//div拖拽
function drag(o) {
    o.onmousedown = function(a) {

        var d = document; if (!a) a = window.event;
        var x = a.layerX ? a.layerX : a.offsetX, y = a.layerY ? a.layerY : a.offsetY;

        if (o.setCapture)
            o.setCapture();
        else if (window.captureEvents)
            window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);

        d.onmousemove = function(a) {
            if (!a) a = window.event;
            if (!a.pageX) a.pageX = a.clientX;
            if (!a.pageY) a.pageY = a.clientY;
            var tx = a.pageX - x, ty = a.pageY - y;
            o.style.left = tx;
            o.style.top = ty;
        };

        d.onmouseup = function() {
            if (o.releaseCapture)
                o.releaseCapture();
            else if (window.captureEvents)
                window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
            d.onmousemove = null;
            d.onmouseup = null;
        };

    };

}

// -- Functions --
function GetFlash(id, playerfile, flashvers, width, height, NotTransparent) {
    if (playerfile.toLowerCase().indexOf("HjPlayer.swf") != -1) {
        NotTransparent = true;
    }
    if (NotTransparent == true) {
        NotTransparent = "window";
    } else {
        NotTransparent = "transparent";
    }
    var str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0'";
    str += "width='" + width + "' height='" + height + "' id='" + id + "' align='middle' >";
    str += "<param name='allowScriptAccess' value='always' />";
    str += "<param name='movie' value='" + playerfile + "' />";
    str += "<param name='quality' value='high' />";
    str += "<param name='scale' value='noScale' />";
    str += "<param name='align' value='tl' />";
    str += "<param name='allowFullScreen' value='true' />";
    str += "<param name='wmode' value='" + NotTransparent + "' />"; 
    str += "<param name='flashvars' value='" + flashvers + "' />";
    str += "<embed src='" + playerfile + "' quality='high' wmode='" + NotTransparent + "' scale='noScale' bgcolor='#ffffff' width='" + width + "' height='" + height + "' flashvars='" + flashvers + "' name='" + id + "' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>";
    str += "</object>";
    document.write(str);
}
function GetFlashCode(id, playerfile, flashvers, width, height, NotTransparent) {
    if (playerfile.toLowerCase().indexOf("HjPlayer.swf") != -1) {
        NotTransparent = true;
    }
    if (NotTransparent == true) {
        NotTransparent = "window";
    } else {
        NotTransparent = "transparent";
    }
    var str = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0'";
    str += "width='" + width + "' height='" + height + "' id='" + id + "' align='middle' >";
    str += "<param name='allowScriptAccess' value='always' />";
    str += "<param name='movie' value='" + playerfile + "' />";
    str += "<param name='quality' value='high' />";
    str += "<param name='scale' value='noScale' />";
    str += "<param name='align' value='tl' />";
    str += "<param name='allowFullScreen' value='true' />";
    str += "<param name='wmode' value='" + NotTransparent + "' />";
    str += "<param name='flashvars' value='" + flashvers + "' />";
    str += "<embed src='" + playerfile + "' quality='high' wmode='" + NotTransparent + "' scale='noScale' bgcolor='#ffffff' width='" + width + "' height='" + height + "' flashvars='" + flashvers + "' name='" + id + "' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>";
    str += "</object>";
    return str;
}
//切换指定Dom对象的可见性
function ShiftVisible(aObjName){
    var targetElement=HT$(aObjName);
	if (targetElement.style.display == "none" || targetElement.style.display == "") {
		targetElement.style.display = "block";
	} else {
		targetElement.style.display = "none";
	}
	return false;
}

//Cookie操作
function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}
function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime() + 1000*seconds);
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}

//在指定Dom元素中显示html
function show(aobjID, ahtml){
    $("#"+aobjID).html(ahtml);
    $("#"+aobjID).css("display","block");
}
function showloading(aobjID){
    $("#"+aobjID).html("<img src='/0-Static/images/loading.gif' align='absmiddle'/>");
    $("#"+aobjID).css("display","block");
}

function DelConfirm()
{
    return confirm("确定删除这条记录?");
}

function hide(aobjID){ 
    $("#"+aobjID).css("display","none");
}

function back2homepage() {
    document.location = "/default.aspx";
}
function closeTopMessage() {
    $("#panel_topmessage").css("display", "none");
}
function closeDivMessage() {
    $.unblockUI();
}

function mobilevalid(strValue)
{
    var reg0=/^13\d{9}$/;   //130--139。
    var reg1=/^15\d{9}$/;   //150--159。
    var reg2=/^18\d{9}$/;   //180--189。
    var reg3=/^852\d{8}$/;   //180--189。
    var my=false;
    if (reg0.test(strValue))my=true;
    if (reg1.test(strValue))my=true;
    if (reg2.test(strValue))my=true; 
    if (reg3.test(strValue))my=true;         
    if(!my)
    {
        return false;
    }            
    else
        return true;
}

function emailvalid(strValue)
{
   var patrn=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    if(strValue!="" && !patrn.exec(strValue))
    {
        return false;
    }
    return true;
}

function zipcodevalid(strValue)
{
   var patrn= /^[0-9]\d{5}$/;
    if(strValue!="" && !patrn.exec(strValue))
    {
        return false;
    }
    return true;
}

 //身份证

function checkIdcard(idcard)
{
	var Errors=new Array("0","身份证号码位数不对!","身份证号码出生日期超出范围或含有非法字符!","身份证号码校验错误!","身份证地区非法!");
	//var msg=new Array("生日","","","");
	var area={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"};
	var idcard,Y,JYM;
	var S,M;
	var idcard_array = new Array();
	idcard_array = idcard.split("");
	if(area[parseInt(idcard.substr(0,2))]==null) return Errors[4];
	switch(idcard.length){
		case 15:
			if ((parseInt(idcard.substr(6,2))+1900) % 4 == 0 || ((parseInt(idcard.substr(6,2))+1900) % 100 == 0 && (parseInt(idcard.substr(6,2))+1900) % 4 == 0 )){
				ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/;//测试出生日期的合法性

			}
			else{
				ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/;//测试出生日期的合法性

			}
			if(ereg.test(idcard))
				return Errors[0];
			else
				return Errors[2];
		break;
	   case 18:
		if ( parseInt(idcard.substr(6,4)) % 4 == 0 || (parseInt(idcard.substr(6,4)) % 100 == 0 && parseInt(idcard.substr(6,4))%4 == 0 )){
			ereg = /^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/;//闰年出生日期的合法性正则表达式
		}
		else{
		ereg = /^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/;//平年出生日期的合法性正则表达式
		}
		if(ereg.test(idcard)){
			S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7 + (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9 + (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10 + (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5 + (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8 + (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4 + (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2 + parseInt(idcard_array[7]) * 1 + parseInt(idcard_array[8]) * 6 + parseInt(idcard_array[9]) * 3 ;
			Y = S % 11;
			M = "F";
			JYM = "10X98765432";
			M = JYM.substr(Y,1);
			if(M == idcard_array[17])
				return Errors[0];
			else
				return Errors[3];
		}
		else
			return Errors[2];
		break;
	   default:
		return Errors[1];
		break;
	  }
}
//输入框提示文字色彩设定
var input_shiftcolor_hint = "#CCCCCC";
var input_shiftcolor_text = "#494949";

//页面初始化的公共调用
function onhtpage_load() {
    if ($.blockUI) { 
        if (window.message_div == 1) {
            $.blockUI({ message: $("#panel_divmessage") });
        }
    }
    $(".shiftcolor").focus(
        function() {
            var self = $(this);
            if (self.val() == self.attr("default")) {
                self.val("");
                self.focus();
            }
            self.css("color", self.attr("color"));
            var tdefault = self.attr("default");
            if (typeof tdefault!="undefined" && tdefault.length > 0 && self.attr("hint") != "0") {
                self.showHtip("bottom", { width: (self.width() - 6) + "px" }, tdefault, { left: -2, top: -42 }, true);
            }
            return true;
        }
    ).blur(
        function() {
            var self = $(this);
            if (self.val() == "") {
                self.val(self.attr("default"));
                self.css("color", self.attr("hintcolor"));
            }
            if (self.val() != self.attr("default")) {
                self.css("color", self.attr("color"));
            }
            self.removeHtip();
            return true;
        }
    );
    $(".shiftcolor").each(
        function() {
            var self = $(this);
            if (!self.attr("hintcolor")) {  self.attr("hintcolor", input_shiftcolor_hint); }
            if (!self.attr("color")) { self.attr("color", input_shiftcolor_text) };
            self.blur();
        }
    );
    //告知性提示
        $(".alertonce").each(
        function() {
            var self = $(this);
            var objID = self.attr("id");
            if (typeof objID != "undefined" && objID != "") {
                self.css("display", getcookie(objID) == "1" ? "none" : "block");
            }
        }
    );
}

function closeAlertOnce(aobjID) {
    HT$(aobjID).style.display = "none";
    setcookie("alert_" + aobjID, "1", 99999, "/");
}


if ($.blockUI) {
    $.blockUI.defaults.css.padding = 0;
    $.blockUI.defaults.css.margin = 0;
    $.blockUI.defaults.css.width = '355px';
    $.blockUI.defaults.css.top = '20%';
    $.blockUI.defaults.css.left = '35%';
    $.blockUI.defaults.css.textAlign = 'left';
    $.blockUI.defaults.fadeOut = 0;
    $.blockUI.defaults.fadeIn = 0;
    $.blockUI.defaults.css.color = '#000';
    $.blockUI.defaults.css.border = '0px solid #aaa';
    $.blockUI.defaults.css.backgroundColor = '#fff';
    $.blockUI.defaults.css.cursor = 'default';
    $.blockUI.defaults.overlayCSS.backgroundColor = '#000';
    $.blockUI.defaults.overlayCSS.opacity = '0.2';
    $.blockUI.defaults.overlayCSS.cursor = 'default';
}

//城市联动（根据选择的省市，动态显示城市）------------------------------
function cityResult(flag) 
{ 
    var city=document.getElementById("dpProvince");
    if(flag==0)
    {
		MainInfo.GetCityList(city.value,get_allcity_Result_CallBack);
    }
    else if(flag==1)
    {
		MainInfo.GetCityList(city.value,get_hotelcity_Result_CallBack);
		
    }
    else
    {
		MainInfo.GetCityList(city.value,get_city_Result_CallBack);
    }
}

function get_city_Result_CallBack(response)
{
    if (response.value != null)
    {                    
          var ds = response.value;
         //var ds = MainInfo.GetCityList(city.value).value;
		HT$("dpDistinctArea").options.length=0;
        if(ds != null && typeof(ds) == "object" && ds.Rows != null)
        {                    
            for(var i=0; i<ds.Rows.length; i++)
            {
                var name=ds.Rows[i].descript;
                var id=ds.Rows[i].code;
                HT$("dpDistinctArea").options[HT$("dpDistinctArea").options.length]=new Option(name,id);
            }
        }
        SetCityName();
    }                
    return;
}

function get_allcity_Result_CallBack(response)
{
    if (response.value != null)
    {                    
          var ds = response.value;
         //var ds = MainInfo.GetCityList(city.value).value;
		HT$("dpDistinctArea").options.length=0;
		var name="全部";
        var id="0";
        HT$("dpDistinctArea").options[HT$("dpDistinctArea").options.length]=new Option(name,id);
        if(ds != null && typeof(ds) == "object" && ds.Rows != null)
        {                    
            for(var i=0; i<ds.Rows.length; i++)
            {
                name=ds.Rows[i].cityName;
                id=ds.Rows[i].cityCode;
                HT$("dpDistinctArea").options[HT$("dpDistinctArea").options.length]=new Option(name,id);
            }
        }
        SetCityName();
    }                
    return;
}

function get_hotelcity_Result_CallBack(response)
{
    if (response.value != null)
    {                    
          var ds = response.value;
         //var ds = MainInfo.GetCityList(city.value).value;
		HT$("dpDistinctArea").options.length=0;
		var name;
        var id;
        if(ds != null && typeof(ds) == "object" && ds.Rows != null)
        {                    
            for(var i=0; i<ds.Rows.length; i++)
            {
                name=ds.Rows[i].cityName;
                id=ds.Rows[i].cityCode;
                HT$("dpDistinctArea").options[HT$("dpDistinctArea").options.length]=new Option(name,id);
            }
        }
        xzResult();
        SetCityName();
    }                
    return;
}

function SetCityName()
{
	var hd=HT$("hdCityText");
	for(var i=0;i<HT$("dpDistinctArea").options.length;i++)
	{
		if(HT$("dpDistinctArea").options[i].selected)
		{
			hd.value=HT$("dpDistinctArea").options[i].text;
			break;
		}
	}
}

function GetUrlResponse(url)
{
	var xhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xhttp.open("POST",url,false);
	xhttp.send();
	if(xhttp.status.toString() == "200")
	{
		var doc = xhttp.responseText;
		return doc.toString();
  	}
    else 
    {
	    return null;
    }
}
function openTipsWindow(aurl, aheight) {
    window.open(aurl, '', 'status=no,menubar=no,top=20,left=20,width=630,height=' + ((aheight)?aheight:295) + ',resizable=yes,scrollbars=yes')
}
//input控件的Reset行为：
//      给input控件添加两个属性：class="canReset", resetValue="控件的初始内容"
//调用方式：
// resetAllInput();
function resetAllInput() {
    $(".canReset").each(
                function() {
                    var self = $(this);
                    self.val(self.attr("resetValue"));
                });
    return false;
}
//
function showBlockUI(elementID, awidth, aheight) {
    if (awidth && aheight) {
        $.blockUI({ message: $("#" + elementID), css: { top: ($(window).height() - aheight) / 2 + 'px', left: ($(window).width() - awidth) / 2 + 'px', width: (awidth + 'px'), height: (aheight + 'px')} });
    } else {
        $.blockUI({ message: $("#" + elementID) });
    }
    return false;
}
//
function onEmbedFrameLoaded(iframePanelID) {
    HT$(iframePanelID + "_loading").style.display = "none";
    HT$(iframePanelID + "_cont").style.display = "block"; 
}
function showEmbedIframe(iframePanelID, aurl, awidth, aheight) {
    HT$(iframePanelID + "_loading").style.display = "block";
    HT$(iframePanelID + "_cont").style.display = "none";
    HT$(iframePanelID + "_cont").src = aurl;
    if (awidth && aheight) {
        $.blockUI({ message: $("#" + iframePanelID), css: { top: ($(window).height() - aheight) / 2 + 'px', left: ($(window).width() - awidth) / 2 + 'px', width: (awidth + 'px'), height: (aheight + 'px')} });
    } else {
        $.blockUI({ message: $("#" + iframePanelID) });
    }    
    return false;
}
function hideEmbedIframe(iframePanelID) {
    $.unblockUI();
    HT$(iframePanelID + "_loading").style.display = "block";
    HT$(iframePanelID + "_cont").style.display = "none";
    HT$(iframePanelID + "_cont").src = "about:_blank";
    return false;
}

//日期输入校验
function CheckDate(id1, id2) {
    var ipt1 = document.getElementById(id1);
    var ipt2 = document.getElementById(id2);
    if (ipt1 != undefined && ipt2 != undefined) {
        var valindateresult = CheckDataInput($(ipt1).val(), false);
        var valoutdateresult = CheckDataInput($(ipt2).val(), false);
        if (valindateresult == "" && valoutdateresult == "") {
            var date1 = new Date($(ipt1).val().split('-')[0], $(ipt1).val().split('-')[1]-1, $(ipt1).val().split('-')[2]);
            var date2 = new Date($(ipt2).val().split('-')[0], $(ipt2).val().split('-')[1]-1, $(ipt2).val().split('-')[2]);
            if (date1 < date2) {
                if ((date2 - date1) > 2419200000)
                    return "入住时段不能超过28天";
                else {
                    var today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()); 
                    if ((date2 - today) > 7776000000) { 
                        return "离店日期须在三个月以内";
                    }else
                        return "";
                }
            }
            else
                return "入住日期应小于离店日期";
        }
        else {
            if (valindateresult != "")
                return "入住日期输入有误：" + valindateresult;
            if (valoutdateresult != "")
                return "离店日期输入有误：" + valoutdateresult;
        }
    }
    else
        return "日期输入有误";
}
function CheckDataInput(input,isoutdate) {
    var reg = /20[\d][\d]-[\d]{1,2}-[\d]{1,2}/im;
    if (reg.test(input)) {
        var y = input.split('-')[0];
        var m = input.split('-')[1];
        var d = input.split('-')[2];
        if (isoutdate) {
            var iptdate = new Date(y, m, d);
            var today = new Date(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate());
            if ((iptdate - today) > 7776000000) {
                //这个返回值会被用来判断世博日期，请勿变动
                return "离店日期须在三个月以内";
            }
        }
        if(y<new Date().getFullYear() || y>parseInt(new Date().getFullYear()+1))
            return "年份输入错误";
        if (y > new Date().getFullYear()) {
            if (m > 12)
                return "月份输入错误";
        }
        else {
            if (m < parseInt(new Date().getMonth() + 1) || m > 12)
                return "月份输入错误";
            else {
                if (m > parseInt(new Date().getMonth() + 1))
                    if (d > 0 && d <= 31)
                    return "";
                else {
                    if (d < new Date().getDate() || d > 31)
                        return "日期输入错误，不能小于当天日期";
                    else
                        return "";
                }
            }
        }
        if (y > new Date().getFullYear()) {
            if ( d > 31)
                return "日期输入错误，不能小于当天日期";
        }
        else {
            if (d < new Date().getDate() || d > 31)
                return "日期输入错误，不能小于当天日期";
        }
        return "";
    }
    return "您输入的日期格式不正确";
}
function isDataString(input) {
    var reg = /^20[\d][\d]-[\d]{1,2}-[\d]{1,2}$/im;
    if (reg.test(input)) {
        var y = Number(input.split('-')[0]);
        var m = Number(input.split('-')[1]);
        var d = Number(input.split('-')[2]);
        if (y < 2009)
            return false;
        if (m < 0 || m > 12)
            return false;
        if (d < 0 || d > 31)
            return false;
        return true;
    } else {
        return false;
    }
}
//
function open_kf(){
    window.open("http://218.83.157.3:3080/company.php?arg=test&style=1", "_blank", "height=470, width=700, top=80, left=120, status=yes, toolbar=no, menubar=no, resizable=no, scrollbars=no, location=no, titlebar=no");
    return false;
}
//
//通用的复制代码
var Clipboard = 0;
function GetClipboard() {
    alert("copyit");
    return Clipboard;
}
function copyit(textit) {
    Clipboard = textit;
    if (window.clipboardData) {
        window.clipboardData.setData("Text", textit);
    } else {
        var flashcopier = 'flashcopier';
        if (!HT$(flashcopier)) {
            var divholder = document.createElement('div');
            divholder.id = flashcopier;
            document.body.appendChild(divholder);
        }
        HT$(flashcopier).innerHTML = '';
        var divinfo = '<embed src="/0-Static/common/_clipboard.swf" width="0" height="0" type="application/x-shockwave-flash" id="flashforcopy" name="flashforcopy"></embed>';
        HT$(flashcopier).innerHTML = divinfo;
    }
}

//世博预定临时处理
function expo_check(citycode, checkin, checkout) {
   // if (isExpo(citycode, checkin, checkout))
       // alert("世博会活动期间，上海的酒店仅供价格查询，如需咨询、预订请拨打4008-121-121");
}

function isExpo(citycode, checkin, checkout) {
    if (citycode != "3100")
        return false;
    var checkinStrs = checkin.split("-");
    var checkoutStrs = checkout.split("-");
    var d1 = new Date(checkinStrs[0], checkinStrs[1] - 1, checkinStrs[2]);
    var d2 = new Date(checkoutStrs[0], checkoutStrs[1] - 1, checkoutStrs[2]);
    return !(d2 < new Date(2010, 4, 1) || d1 > new Date(2010, 9, 31))

}

