// 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 += "
{hotel_name}<\/td>\n"; tmp_inlayer += " | {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}", "" + this.data[o].hotel_list[i].hotel_star + ' ' + this.down + "");
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}", "" + this.data[o].hotel_list[i].hotel_star + ' ' + this.up + "");
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![]() ![]() /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"); |