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.
303 lines
11 KiB
JavaScript
303 lines
11 KiB
JavaScript
6 years ago
|
// 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": "3 Star "},
|
||
|
{"hotel_name": "Sunworld Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Crowne Plaza Beijing", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-1-bj"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Days Inn Forbidden City Beijing", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Sunworld Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Crowne Plaza Beijing", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-1-bj-2"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Xi'an Skytel Hotel", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Grand Noble Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Sofitel On Renmin Square Xi'an", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-1-xa"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Xi'an Skytel Hotel", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Grand Noble Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Sofitel On Renmin Square Xi'an", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-1-xa-2"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Hengsheng Peninsula International Hotel Shanghai", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "The Bund Hotel Shanghai", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Radisson Shanghai New World", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-1-sh"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Hengsheng Peninsula International Hotel Shanghai", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "The Bund Hotel Shanghai", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Radisson Shanghai New World", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-1-sh-2"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Cruise Ships:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Yangtze Paradise", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "President 1", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "President Prime", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-62-yangtze"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Guilin Osmanthus Hotel", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Guilin Lijiang Waterfall Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Sheraton Guilin", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-da-1-gl"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Yangshuo Aiyuan Hotel", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Yangshuo Aiyuan Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Green Lotus Hotel", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-da-1-ys"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Shambhala Hotel Lhasa", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Xinding Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Brahmaputra Grand Hotel", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-12-lhasa"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Eling Park Hotel", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Eling Park Hotel", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Jw Marriott Hotel Chongqing", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-12-cq"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Metropark Hotel Kowloon", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Ymca Of Hong Kong", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Harbour Grand Kowloon", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-75-hk"
|
||
|
},
|
||
|
{
|
||
|
"boxtitle":"Selected Hotel:",
|
||
|
"hotel_list":
|
||
|
[
|
||
|
{"hotel_name": "Ocean Hotel Guangzhou", "hotel_star": "3 Star "},
|
||
|
{"hotel_name": "Ocean Hotel Guangzhou", "hotel_star": "4 Star "},
|
||
|
{"hotel_name": "Garden Hotel Guangzhou", "hotel_star": "5 Star "}
|
||
|
],
|
||
|
"display_class": "cht-4s-gz"
|
||
|
}
|
||
|
];
|
||
|
select_box.display();
|
||
|
|
||
|
var _cli_no = $("#cli-no").text();
|
||
|
var _cli_no_url = "/api/tmp/tour-detail-price.asp";
|
||
|
if(_cli_no == "") {
|
||
|
_cli_no = $("#city-cli-no").text();
|
||
|
_cli_no_url = "/api/tmp/citytour-detail-price.asp"
|
||
|
}
|
||
|
$.get(_cli_no_url, { 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 span").html("");
|
||
|
$(".priceincluding span").html($.trim($(".pricetable table:eq(0) tr:eq(2) td:eq(3)").text()+"p/p"));
|
||
|
|
||
|
$.get("/api/tmp/converter.asp", function(data) {
|
||
|
var __p__ = eval(data);
|
||
|
var price_list = {'USD': __p__[0].ex_rate, 'AUD': __p__[1].ex_rate, 'CAD': __p__[2].ex_rate, 'EUR': __p__[3].ex_rate, 'GBP': __p__[4].ex_rate};
|
||
|
var usd = __p__[0].ex_rate;
|
||
|
|
||
|
$(".moneyConverter .currencyList").hide();
|
||
|
$(".moneyConverter").hover(
|
||
|
function () {
|
||
|
$(".currencyList").show();
|
||
|
$(".moneyConverter .currencyList li").one('click', function() {
|
||
|
$(".moneyConverter .currencyList li").each(function() {
|
||
|
$(this).removeClass("point");
|
||
|
});
|
||
|
|
||
|
$(this).addClass("point");
|
||
|
$(".moneyConverter #first").empty();
|
||
|
$(".moneyConverter #first").html($(this).html());
|
||
|
$(".currencyList").hide();
|
||
|
|
||
|
var converter_code = $.trim($(this).text()).replace(/[^A-Z]+/g, '');
|
||
|
var sign = $.trim($(this).text()).replace(/[A-Z|\s]+/g, '');
|
||
|
var converter = price_list[converter_code];
|
||
|
$(".book-price .hp").each(function() {
|
||
|
var price = $.trim($(this).text()).replace(/(\$|\-|,)/gi, '');
|
||
|
price = parseInt(price);
|
||
|
|
||
|
$(this).parent().find('.item').empty();
|
||
|
if (converter_code != 'USD') {
|
||
|
var _tmp = format_number(parseInt(price * usd / converter));
|
||
|
$(this).parent().find('.item').text(sign+_tmp);
|
||
|
}else{
|
||
|
$(this).parent().find('.item').text(sign+format_number(price));
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
function () {
|
||
|
$(".currencyList").hide();
|
||
|
}
|
||
|
);
|
||
|
|
||
|
});
|
||
|
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
|
||
|
|
||
|
function format_number(n){
|
||
|
var b=parseInt(n).toString();
|
||
|
var len=b.length;
|
||
|
if(len<=3){return b;}
|
||
|
var r=len%3;
|
||
|
return r>0?b.slice(0,r)+","+b.slice(r,len).match(/\d{3}/g).join(","):b.slice(r,len).match(/\d{3}/g).join(",");
|
||
|
}
|
||
|
// for CHT-1 PRICE CHANGE
|
||
|
TrunMenu("priceTable","active","li","priceDetail");
|
||
|
|
||
|
TrunMenu("toptour_type","active","li","toptype_content");
|