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.

202 lines
7.8 KiB
JavaScript

// New tour detail page
var SelectBox;
SelectBox = (function() {
this.down = "";
this.up = "";
this.data = [];
function SelectBox() {}
SelectBox.prototype.display = function() {
for(var i = 0; i < this.data.length; i++) {
$("." + this.data[i].display_class).html("");
$("." + this.data[i].display_class).html(this.makeParser(i));
}
//return this.makeParser();
};
SelectBox.prototype.makeParser = function(o) {
var tmp_template = "", tmp_inlayer = "", tmp_inlayer_for = "", sizeof = 0;
sizeof = this.data[o].hotel_list.length;
tmp_template += "<div class=\"selectedHotels\"> <strong>"+ this.data[o].boxtitle +"<\/strong>\n";
tmp_template += " <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" class=\"1allHotels\">\n";
tmp_template += " <tbody>\n";
tmp_template += "{inlayer}";
tmp_template += " <\/tbody>\n";
tmp_template += " <\/table>\n";
tmp_template += "<\/div>";
tmp_inlayer += " <tr {style}>\n";
tmp_inlayer += " <td width=\"65%\">{hotel_name}<\/td>\n";
tmp_inlayer += " <td width=\"35%\">{hotel_star}<\/td>\n";
tmp_inlayer += " <\/tr>\n";
for(var i = 0; i< sizeof; i++){
if(0 == i && sizeof > 0) {
tmp_inlayer_for += tmp_inlayer.replace("{hotel_name}", this.data[o].hotel_list[i].hotel_name);
tmp_inlayer_for = tmp_inlayer_for.replace("{hotel_star}", "<a href=\"javascript:;\" onclick=\"selectS(this);\">" + this.data[o].hotel_list[i].hotel_star + ' ' + this.down + "</a>");
tmp_inlayer_for = tmp_inlayer_for.replace("{style}", "");
}else if(i == (sizeof-1) && sizeof > 0){
tmp_inlayer_for += tmp_inlayer.replace("{hotel_name}", this.data[o].hotel_list[i].hotel_name);
tmp_inlayer_for = tmp_inlayer_for.replace("{hotel_star}", "<a href=\"javascript:;\" onclick=\"selectH(this);\">" + this.data[o].hotel_list[i].hotel_star + ' ' + this.up + "</a>");
tmp_inlayer_for = tmp_inlayer_for.replace("{style}", "style=\"display:none\"");
}else{
tmp_inlayer_for += tmp_inlayer.replace("{hotel_name}", this.data[o].hotel_list[i].hotel_name);
tmp_inlayer_for = tmp_inlayer_for.replace("{hotel_star}", this.data[o].hotel_list[i].hotel_star);
tmp_inlayer_for = tmp_inlayer_for.replace("{style}", "style=\"display:none\"");
}
}
tmp_template = tmp_template.replace("{inlayer}", tmp_inlayer_for);
tmp_template = tmp_template.replace("{inlayer}", "");
return tmp_template;
};
return SelectBox;
})();
selectS = function(o) {
var obj = $(o).parent("td").parent("tr").parent("tbody").parent("table").parent("div").parent("div");
$(obj).find(".selectedHotels table").addClass("allHotels");
$(obj).find(".selectedHotels table").find("tr").show();
$(obj).find(".selectedHotels tr:eq(0) img").hide();
}
selectH = function(o) {
var obj = $(o).parent("td").parent("tr").parent("tbody").parent("table").parent("div").parent("div");
$(obj).find(".selectedHotels table").removeClass("allHotels");
$(obj).find(".selectedHotels table").find("tr").hide();
$(obj).find(".selectedHotels table").find("tr").eq(0).find("img").show();
$(obj).find(".selectedHotels table").find("tr").eq(0).show();
}
$(function(){
function preloadImages(json) {
for(var i=0;i<json.length;i++) {
$('<img />').attr('src', json[i]);
}
}
var select_box = new SelectBox();
select_box.down = "<img original=\"\/pic\/arrow-blue-down.jpg\" style=\"display: inline;\" src=\"\/pic\/arrow-blue-down.jpg\" onclick=\"selectS1(this)\">";
select_box.up = "<img src=\"\/pic\/arrow-blue-up.jpg\" original=\"\/pic\/arrow-blue-up.jpg\" style=\"\" onclick=\"selectH1(this)\">";
select_box.data = [
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Days Inn Forbidden City Beijing", "hotel_star": "Economy "},
{"hotel_name": "Sunworld Hotel", "hotel_star": "Deluxe "},
{"hotel_name": "Crowne Plaza Beijing", "hotel_star": "Superior "}
],
"display_class": "cht-1-bj"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Xian Skytel Hotel", "hotel_star": "Economy "},
{"hotel_name": "Grand Noble Hotel", "hotel_star": "Deluxe "},
{"hotel_name": "Sofitel On Renmin Square Xian", "hotel_star": "Superior "}
],
"display_class": "cht-1-xa"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Hengsheng Peninsula International Hotel Shanghai", "hotel_star": "Economy "},
{"hotel_name": "The Bund Hotel Shanghai", "hotel_star": "Deluxe "},
{"hotel_name": "Radisson Shanghai New World", "hotel_star": "Superior "}
],
"display_class": "cht-1-sh"
},
{
"boxtitle":"Cruise Ships:",
"hotel_list":
[
{"hotel_name": "Yangtze Paradise", "hotel_star": "Economy "},
{"hotel_name": "President 1", "hotel_star": "Deluxe "},
{"hotel_name": "President Prime", "hotel_star": "Superior "}
],
"display_class": "cht-62-yangtze"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Guilin Osmanthus Hotel", "hotel_star": "Economy "},
{"hotel_name": "Guilin Lijiang Waterfall Hotel", "hotel_star": "Deluxe "},
{"hotel_name": "Sheraton Guilin", "hotel_star": "Superior "}
],
"display_class": "cht-da-1-gl"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Yangshuo Aiyuan Hotel", "hotel_star": "Economy "},
{"hotel_name": "Yangshuo Aiyuan Hotel", "hotel_star": "Deluxe "},
{"hotel_name": "Green Lotus Hotel", "hotel_star": "Superior "}
],
"display_class": "cht-da-1-ys"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Shambhala Hotel Lhasa", "hotel_star": "Economy "},
{"hotel_name": "Xinding Hotel", "hotel_star": "Deluxe "},
{"hotel_name": "Brahmaputra Grand Hotel", "hotel_star": "Superior "}
],
"display_class": "cht-12-lhasa"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Eling Park Hotel", "hotel_star": "Economy "},
{"hotel_name": "Eling Park Hotel", "hotel_star": "Deluxe "},
{"hotel_name": "Jw Marriott Hotel Chongqing", "hotel_star": "Superior "}
],
"display_class": "cht-12-cq"
},
{
"boxtitle":"Selected Hotel:",
"hotel_list":
[
{"hotel_name": "Metropark Hotel Kowloon", "hotel_star": "Economy "},
{"hotel_name": "Ymca Of Hong Kong", "hotel_star": "Deluxe "},
{"hotel_name": "Harbour Grand Kowloon", "hotel_star": "Superior "}
],
"display_class": "cht-75-hk"
}
];
select_box.display();
var _cli_no = $("#").text();
$.get("/api/tmp/tour-detail-price.asp", { cli_no: _cli_no },
function(data){
$(".pricetable").html("");
$(".pricetable").html($(data).html());
$(".priceTitle img").hover(
function () {
$(".priceTerms").show();
},
function () {
//$(".priceTerms").hide();
}
);
$(".priceTerms .closeIt").click(function(){
$(".priceTerms").hide();
});
$(".tailorTour img").click(function(){
$.cookie("Cht_tour_list", "");
$.cookie("Cht_tour_tailorInfo", "", {path: "/"});
GetCookie("Cht_tour", "tailorInfo");
$.cookie("Cht_tour_tailorInfo", $("#tailorInfo").html().replace(/\<br[\s\/]*\>/g, "\n"), {path: "/"});
});
$(".priceincluding ").html("");
$(".priceincluding ").html($.trim($(".pricetable table:eq(0) tr:eq(2) td:eq(3)").text()+"p/p"));
}
);
});