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.

155 lines
5.2 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// JavaScript Document
$(function(){
var sdates = $("#hotelstarttime,#hotelendtime").datepicker({showAnim:"fadeIn",duration:0,minDate: 0, maxDate:"2y",numberOfMonths: 3,showButtonPanel: true});
shcity= $("a[name='city']");
$("#hotelcityList a").click(function(){
$("#citys").val($(this).text());
shcity.text($(this).text());
$("#hotelcityList").hide();
});
$("a[name='city']").click(function(){
$("#hotelcityList").fadeIn(200);
});
$(".closeIt").click(function(){
$("#hotelcityList").fadeOut(200);
});
$("#introContent p:not(:first)").hide();
$("#introContent").slideDown();
subFTForm();
});
function ShowHideTr(e)
{
$(e).find("img").toggle();
$(e).parents("tbody").find('tr[name]').toggle();
}
function showHideLocation(e)
{
var eimg =$(e).find('img'),textStr = $("#localMore"),Obj = $(".hideLocation");
if(Obj.css("display")=="block")
{
Obj.css("display","none");//Obj.hide();
textStr.html("More Location Select<img src=\"/css/images/hotel/double-arrow-down.png\" align=\"absmiddle\">");
//eimg.attr("src","/css/images/hotel/double-arrow-down.png");
}
else
{
Obj.css("display","block");
textStr.html("Less Location Select<img src=\"/css/images/hotel/double-arrow-up.png\" align=\"absmiddle\"");
//eimg.attr("src","/css/images/hotel/double-arrow-up.png");
}
}
//==============
var loading = true; //是否正在加载
//切换左边的菜单
function Togle(obj,id){
var mObj = $(obj);
var sObj = $("#"+id);
if(sObj.is(":hidden")){
sObj.slideDown("slow");
mObj.removeClass("filtercategoryclose").addClass("filtercategory");
}else{
sObj.slideUp("slow");
mObj.removeClass("filtercategory").addClass("filtercategoryclose");
}
}
//提交隐藏的表单
function subFTForm(){
$.ajax({
type:"post",
data:$("#listCondition").serialize(),
url:"/hotel/ajax-hotel-list.asp",
beforeSend:function(){loading = true;},
complete:function(){loading = false;},
success:function(msg){
$("#contentRight2").html(msg).hide().slideDown(2000);
}
});
}
function getFTmenu(){
$.ajax({
type:"post",
data:$("#listCondition").serialize(),
url:"/hotel/condition.asp",
beforeSend:function(){showBg("condition")},
success:function(msg){
$("#condition").html(msg);//update the content
$("#myBGTopDiv").fadeOut(200);//remove the cover div
setTimeout('$("#myBGTopDiv").remove()',200);
}
});
}
//ajax 翻页
function goToPage(p){
$("#listCondition #page").val(p);
$("#contentRight2 ").children().hide();
$(document).scrollTop(350);
$("#contentRight2").append("<div class=\"hotelLoading\"><table width=\"100%\" border=\"0\"><tr><td width=\"56%\" align=\"center\" valign=\"middle\"><span class=\"loadingStyle1\">We are updating your hotel list.</span><br /><span class=\"loadingStyle2\">Please don't close this window.</span><br /></p><img src=\"/css/images/flight/loading.gif\" width=\"136\" height=\"10\" /><br /></td><td width=\"44%\" class=\"withLine\"><img src=\"/css/images/hotel/loading.jpg\" /></td></tr></table></div>");
subFTForm();
}
//文本ID 是否覆盖[即原来的值还有] 值, 点击的对象
function fTHotels(inputID, isOver, val, e){
var clickObj = $(e);
var clickPerantObj = clickObj.parents("div");
var clickPerentObjID = clickPerantObj.attr("id");
var newVal="";
//sortSort 顺序
//sortPrice 价格
//sortRating 星级
//sortType 类型
//sortFacilties 设施
//sortDistrict 周边城市
if(loading){return;}
switch(clickPerentObjID)
{
case "sortSort":
newVal = val;
break;
case "sortPrice":
clickObj.siblings().attr("class","unselect2").end().attr("class","select2");
newVal = val;
break;
case "sortRating":
clickObj.siblings().attr("class","unselect2").end().attr("class","select2");
newVal = val;
break;
case "sortType":
if(clickObj.attr("class") == "select"){
clickObj.attr("class", "unselect");
}else{
clickObj.attr("class", "select");
}
$("#sortType .select").each(function(i){
if(newVal.length>0){newVal=newVal+ "," +$(this).attr("val");}else{newVal=$(this).attr("val");}
});
break;
case "sortFacilties":
if(clickObj.attr("class") == "select"){
clickObj.attr("class", "unselect");
}else{
clickObj.attr("class", "select");
}
$("#sortFacilties .select").each(function(i){
if(newVal.length>0){newVal=newVal+ "," +$(this).attr("val");}else{newVal=$(this).attr("val");}
});
break;
case "sortDistrict":
break;
default:
}
var Obj = $("#listCondition #"+inputID);
Obj.val(newVal);
if(clickPerentObjID == "sortPrice" || clickPerentObjID == "sortRating" || clickPerentObjID == "sortType"){getFTmenu()}
$("#listCondition #page").val(1);//return to first page
$("#contentRight2 ").children().hide();
$(document).scrollTop(350);
$("#contentRight2").append("<div class=\"hotelLoading\"><table width=\"100%\" border=\"0\"><tr><td width=\"56%\" align=\"center\" valign=\"middle\"><span class=\"loadingStyle1\">We are updating your hotel list.</span><br /><span class=\"loadingStyle2\">Please don't close this window.</span><br /></p><img src=\"/css/images/flight/loading.gif\" width=\"136\" height=\"10\" /><br /></td><td width=\"44%\" class=\"withLine\"><img src=\"/css/images/hotel/loading.jpg\" /></td></tr></table></div>");
subFTForm();
}