You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
5.2 KiB
JavaScript

var checkHotelRate_isFirst = true;
function include_js(file,callBack) {
var _doc = document.getElementsByTagName('head')[0];
var js = document.createElement('script');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', file);
_doc.appendChild(js);
if (!/*@cc_on!@*/0) { //if not IE
//Firefox2、Firefox3、Safari3.1+、Opera9.6+ support js.onload
js.onload = function () {
callBack();
}
} else {
//IE6、IE7 support js.onreadystatechange
js.onreadystatechange = function () {
if (js.readyState == 'loaded' || js.readyState == 'complete') {
callBack();
}
}
}
return false;
}
function tzsearch()
{
document.apLogin.submit();
}
function displayCMI(o){
tmpobj = "win"+o;
$("div.windowHotelRoom").hide();
$("#"+tmpobj).fadeIn(800);
}
function hideCMI(o){
$("#"+"win"+o).fadeOut(800);
}
//新优化使用tsign区别 true
function checkHotelRate2(n, tsign, sinoid){
//document.writeln("/hotel/ajax-room-rate.asp?hotelid="+n+"&starttime="+document.getElementById("starttime").value+"&endtime="+document.getElementById("endtime").value);
var t = parseInt(Math.random() * 200000);
if(checkHotelRate_isFirst){
checkHotelRate_isFirst = false;
}else{
var t1 = $("#changeDate #starttime").val(), t2 = $("#changeDate #endtime").val()
$("#changeDate #hotelnight").html(Math.ceil((new Date(t2) - new Date(t1))/86400000));
$("#changeDate #TxtSdate").html(t1);
$("#changeDate #TxtEdate").html(t2);
$("#changeDate>div").toggle();
}
if(tsign)
{
$.get("/hotel/ajax-room-rate.asp?hotelid="+n+"&starttime="+$("#starttime").val()+"&endtime="+$("#endtime").val()+"&opt=new&sinoid="+sinoid+"&t="+t,function(ajaxdata){
$("#hotelRate").html(ajaxdata);
if ($("#hotelRate").css("display")=="block"){
$("#hotelRate").fadeOut(350);
$("#hotelRate").fadeIn(380);
}else{
$("#hotelRate").slideDown(380);
}
});
}
else
{
$.get("/hotel/ajax-room-rate.asp?sinoid="+sinoid+"&hotelid="+n+"&starttime="+document.getElementById("starttime").value+"&endtime="+document.getElementById("endtime").value+"&t="+t,function(ajaxdata){
$("#hotelRate").html(ajaxdata);
if ($("#hotelRate").css("display")=="block"){
$("#hotelRate").fadeOut(350);
$("#hotelRate").fadeIn(380);
}else{
$("#hotelRate").slideDown(380);
}
});
}
}
function displayRateCalendar(o){
tmphtml1 = "<strong>Hide Rate Calendar</strong>"
tmphtml2 = "<strong>Show Hotel Rate Calendar</strong>"
if ($("#rateCalendar").css("display")=="block"){
$("#rateCalendar").slideUp(1000);
$(o).html(tmphtml2);
}else{
$("#rateCalendar").slideDown(1000);
$(o).html(tmphtml1);
}
}
//预定酒店是机票搜索函数
function hotelSearchFlights(){
var c1 = getCityAirCode(document.sflight.startCode1.value);
var c2 = getCityAirCode(document.sflight.destinationCode1.value);
if(c1 && c2)
{
document.sflight.startCode1.value = c1;
document.sflight.destinationCode1.value = c2;
document.sflight.submit();
}
else
{
alert('Error City Airport');return false;
}
}
function closeFlightTable(o){
o.checked?$("#tableResultid").hide():$("#tableResultid").show();
}
function displayPackinfo(o){
o.checked?$("#packinfoTable").show():$("#packinfoTable").hide();
}
function getHotelListText(o){
$("#listhotel").html("test");
//postget("/hotel/hotellist-all.asp?city=shanghai&s=21");
$.get("/hotel/hotellist-all.asp?city=shanghai", function(data){
$("#listhotel").html(data);
})
}
function postget(theurl) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", theurl, true);
xmlHttp.send(null);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) return xmlHttp.responseText;
}
}
}
function closeThis(Obj){
var hotelid = $(Obj).attr("val");
var NewCK = $.cookie("hotelHistory").split("|");
for(i=0;i<NewCK.length;i++){
if(hotelid == NewCK[i]){
deli = i;break;
}
}
NewCK.splice(i,1);
$.cookie("hotelHistory",NewCK.join("|"),{path:'/'});
$(Obj).parents(".viewhotelList").slideUp(200);
setTimeout(function(){$(Obj).parents(".viewhotelList").remove()}, 200);
return false;
}
function showRecommend(ids){
$.facebox.settings.opacity=0.5;
$.facebox.settings.outClose=false;
$.facebox({ajax:'/hotel/recomment.asp?hid='+ids});
}
//show a div on and cover the Target
function showBg(Obj){
var offset = $("#"+Obj).offset();
var Mheight = $("#"+Obj).height();
var Mwidth = $("#"+Obj).width();
$("#myBGTopDiv").remove();
$("<div>loading....<div>").attr("id","myBGTopDiv")
.css({"display":"none","position":"absolute","margin":"2px","text-align":"center","line-height":Mheight*2/3+"px"})
.css("background-color","#FFFFFF")
.css({"filter":"alpha(opacity=90)","opacity":"0.90"})
.css({"left":offset.left,"top":offset.top})
.appendTo("body");
$("#myBGTopDiv").height(Mheight-4);
$("#myBGTopDiv").width(Mwidth-4);
$("#myBGTopDiv").show();
}
//根据评分给出相应的文字评价
function EGAP(RateN){
RateN = parseInt(RateN)
if(RateN>4.5){
return "Excellent";
} else if(RateN<=4.5 && RateN>3.5){
return "Good";
} else if(RateN<=3.5 && RateN>2.5){
return "Average";
} else if(RateN<=2.5 && RateN>0){
return "Poor";
} else {
return "";
}
}