﻿
function changeDate(hotelid, sOldStart, sOldEnd, sStart, sEnd) {
    if ((sStart != sOldStart) || (sOldEnd != sEnd)) {
        //更新提交
        location.href = '/hotels.aspx?hotelid=' + hotelid + '&indate=' + sStart + '&outDate=' + sEnd;
    }

}

function changeDate2(hotelid, sOldStart, sOldEnd, sStart, sEnd) {
    if ((sStart != sOldStart) || (sOldEnd != sEnd)) {
        //更新提交
        location.href = '/resv/hotel' + hotelid + '.aspx?indate=' + sStart + '&outDate=' + sEnd;
    }
}
function getJFRoom(hotelid, startDate, endDate, roomtype, sPoint, usercents) {
    if (usercents.length < 1 || usercents == null || usercents == 'undefined') {
        jAlert('您还没有登录,请先登录', '提示');
        location.href = '/user/login.aspx';
        return false;
    }
    if ((usercents - sPoint) < 0) {
        jAlert('无法兑换,兑换需要：' + sPoint + ' 您目前积分：' + usercents, '提示');
        return false;
    }
    var sUrl = "/user/bookt.aspx?hotelid=" + hotelid + "&roomtype=" + roomtype + "&indate=" + startDate + "&outDate=" + endDate + "jf=1";
    location.href = sUrl;
}

//客房服务
function getRoomSerice(contentId, hotelid) {
    $.ajax({
        type: "get",
        url: "/Ajax/RoomSerice.aspx",
        data: "hotelid=" + hotelid,

        success: function (html) {
            $("#" + contentId).html(html);
            //              alert(html);
        }
    });
}

//酒店图片
function getHotelpic(contentId, hotelid) {
    $.ajax({
        type: "get",
        url: "/Ajax/HotelPicInfo.aspx",
        data: "hotelid=" + hotelid,

        success: function (data) {
            $("#" + contentId).attr("src", data);
            //              alert(data);
        }
    });
}

//酒店地图
function getHotelMap(contentId, hotelid) {
    $.ajax({
        type: "get",
        url: "/Ajax/HotelMap.aspx",
        data: "hotelid=" + hotelid,

        success: function (data) {
            $("#" + contentId).attr("src", data);
        }
    });
}

//驾车服务
function getDrivingInfo(contentId, hotelid) {
    $.ajax({
        type: "get",
        url: "/Ajax/DrivingInfo.aspx",
        data: "hotelid=" + hotelid,

        success: function (html) {
            $("#" + contentId).html(html);
        }
    });
}

//获取房态
function getRoomState(contentId, hotelid, indate, outdate) {
    //    $("#" + contentId).ajaxStart(function () {
    //    });

    $.ajax({
        type: "get",
        url: "/Ajax/roomstate.aspx",
        data: 'indate=' + indate + '&outdate=' + outdate + '&hotelid=' + hotelid + '&' + Math.random(),
        error: function () {
            $("#" + contentId).html("error...");
        },
        success: function (html) {
            $("#" + contentId).html(html);
        }
    });

}

//会员积分
function getUserCent(cardno, contentId) {
    $.ajax({
        type: "get",
        url: "/Ajax/UserCent.aspx",
        data: "cardno=" + cardno,

        success: function (data) {
            if (contentId != null && contentId != '' && contentId != 'undefined') {
                if ($("#" + contentId) != null && $("#" + contentId) != 'undefined') {
                    $("#" + contentId).val(data);
                }
                else if (typeof (contentId) == "string") {
                    contentId = data;
                }
            }
        }
    });

}


function ChangeTag(nType) {
    var objDocLogin = document.getElementById("longinTable");
    var objDocBook = document.getElementById("bookTable");
    var objLiLogin = document.getElementById("liLogin");
    var objLiBook = document.getElementById("liBook");

    if (nType == 1) {
        objDocLogin.style.display = "";
        objDocBook.style.display = "none";
        objLiLogin.style.backgroundImage = "url(/img/home_hydl.jpg)";
        objLiBook.style.backgroundImage = "url(/img/home_ssyd.jpg)";
    }
    else {
        objDocLogin.style.display = "none";
        objDocBook.style.display = "";
        objLiLogin.style.backgroundImage = "url(/img/home_hydl1.jpg)";
        objLiBook.style.backgroundImage = "url(/img/home_ssyd1.jpg)";
    }
}

function SearchByCity() {
    var cityId = $("#sltCity").val();
    var startDate = $("#indate").val();
    var endDate = $("#OutDate").val();
    var sUrl = "/resv/city" + cityId + ".aspx?indate=" + startDate + "&outDate=" + endDate;
    location.href = sUrl;
}
