Warning : include_once(/home/sunnsea/www/www/includes/lang_cn.php): failed to open stream: No such file or directory in /home/sunnsea/www/www/includes/global_inc.php on line 11
Warning : include_once(): Failed opening '/home/sunnsea/www/www/includes/lang_cn.php' for inclusion (include_path='.:/usr/local/php56/lib/php') in /home/sunnsea/www/www/includes/global_inc.php on line 11
Warning : Cannot modify header information - headers already sent by (output started at /home/sunnsea/www/www/includes/global_inc.php:11) in /home/sunnsea/www/www/js/packagejs.php on line 2
$(document).ready(function() {
var optarray = $("#city-select").children('option').map(function() {
return {
"value": this.value,
"option": "" + this.text + " "
}
})
$("#country-select").change(function() {
$("#city-select").children('option').remove();
var addoptarr = [];
for (i = 0; i < optarray.length; i++) {
if (optarray[i].value.indexOf($(this).val()) > -1) {
addoptarr.push(optarray[i].option);
}
}
$("#city-select").html(addoptarr.join(''))
}).change();
var country_node = $("#srch-country").val() ? '' : finland;
country_node = (country_node=="all")? "" : country_node;
var country = $("#srch-country").val();
var place = $("#srch-place").val();
$.package_loaded = true;
$.package_page = 1;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : 'theme',
"type" : '',
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : '',
"lang" : 'cn'
}
var card_cnt = 0;
var card_max_h = 0;
var w = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var card_per_row = (w<768)?2:4;
$("h3.card-body").height('');
$("h3.card-body").each(function(idx, obj){
if(card_cnt%card_per_row==0 && card_cnt>0){
for(var c = 0; c < card_per_row; c++){
$("h3.card-body").eq(card_cnt-c-1).height(card_max_h);
}
card_max_h = 0;
card_max_h = Math.max(card_max_h, $(this).height());
}else{
card_max_h = Math.max(card_max_h, $(this).height());
}
card_cnt++;
})
for(var c = 0; c < 2-card_cnt%2; c++){
$("h3.card-body").eq(card_cnt-c-1).height(card_max_h);
}
$("#package-section a, #package-menu a").click(function(e){
if($(this).attr("href").indexOf("/package/")>=0)
if (history.pushState) {
e.preventDefault();
$("#package-section li").removeClass("first");
$("#package-menu a").removeClass("active");
$(this).parent().addClass("first");
$(this).addClass("active");
$("a[href='#btn-package-section']").text($(this).text());
$("#package-sub-item .mo-menu-search-modal").empty();
$("a[href='#btn-package-sub-item']").parent().hide();
var country_node = $("#srch-country-node").val();
country_node = (country_node=="all")? "" : country_node;
var country = $("#srch-country").val();
var place = $("#srch-place").val();
$("#srch-country-node").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
$("#srch-country").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
$("#srch-place").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
window.history.pushState("", $("title").eq(0).text(), $(this).attr("href")+((country_node)?"country/"+country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
//$("#link-path").text(' / '+$(this).text()+((country_node)?" / "+$("#srch-country-node option[value="+country_node+"]").text():"")+((country)?" / "+$("#srch-country option[value="+country+"]").text():"")+((place)?" / "+$("#srch-place option[value="+place+"]").text():""));
$("#link-path").html(' / '+$("#package-menu a.active").text()+" "+((country_node)?' / '+$('#srch-country-node option[value='+country_node+']').text()+' ':'')+((country)?' / '+$("#srch-country option[value="+country+"]").text()+' ':'')+((place)?" / "+$("#srch-place option[value="+place+"]").text():""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : $(this).data("sec"),
"type" : $(this).data("type"),
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : ($("#mo-search-bar-package").val())?$("#mo-search-bar-package").val():$("#search-bar-package").val(),
"lang" : 'cn'
}
$("#package-submenu").empty();
$("#package-sub-item .mo-menu-search-modal").empty();
$("#srch-subitems").parent().hide();
$.ajax({
url: "/cn/get_subitems/"+$(this).data("sec")+"/",
type : "GET",
dataType: "json",
timeout : 5000,
success: function(data) {
//$("#package-submenu").html(data.desktop);
var opt_rel = $("#srch-subitems option").eq(0).attr("rel") || "";
$("#srch-subitems").parent().children(".select-options").html(data.desktop);
$("#srch-subitems").parent().show();
$("#srch-subitems").val("");
$("#srch-subitems").next('div.select-styled').text($("#srch-subitems option").eq(0).text());
$("#package-sub-item .mo-menu-search-modal").html(data.mobile);
if(data.mobile){
$("a[href='#btn-package-sub-item']").text($("#package-sub-item .mo-menu-search-modal .first").text());
$("a[href='#btn-package-sub-item']").parent().show();
}
},
error:function(xhr, ajaxOptions, thrownError){
}
});
$("#package-box").empty();
$(window).scroll();
}
})
$("#package-menu a").click(function(e) {
$('.kk-btn').click();
});
$(document).on("click","#package-sub-item a[data-target='#package-sub-item']", function(e){
if($(this).attr("href").indexOf("/diving-")<0 && window.location.href.indexOf("/tailor-made/")<0){
$("#package-sub-item li").removeClass("first");
$(this).parent().addClass("first");
$(this).addClass("active");
$("a[href='#btn-package-sub-item']").text($("#package-sub-item .mo-menu-search-modal .first").text());
var section = $("#package-section .mo-menu-search-modal .first a").data("sec");
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").data("type-alias");
var type = $("#package-sub-item .mo-menu-search-modal .first a").data("type");
var country_node = ($("#country-node .mo-menu-search-modal .first a").length)?$("#country-node .mo-menu-search-modal .first a").data("node") : $("#country .mo-menu-search-modal .first a").data("node");
var country = $("#country .mo-menu-search-modal .first a").data("country");
var place = $("#place .mo-menu-search-modal .first a").data("place");
$("#mo-menu-search form").attr("action","/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : section,
"type" : type,
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : ($("#mo-search-bar-package").val())?$("#mo-search-bar-package").val():$("#search-bar-package").val(),
"lang" : 'cn'
}
$.ajax({
url: "/cn/get_country/"+((section)?section:"all")+"/"+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":""),
type : "GET",
dataType: "json",
timeout : 5000,
success: function(data) {
var data_node = $("#srch-country option").eq(0).data("node") || "";
var opt_rel = $("#srch-country option").eq(0).attr("rel") || "";
$("#srch-country").parent().children(".select-options").html(''+$("#srch-country option").eq(0).text()+' '+data.desktop);
$("#srch-place").parent().hide();
$("#srch-country").val("");
$("#srch-place").val("");
$("#srch-country").next('div.select-styled').text($("#srch-country option").eq(0).text());
$("#country .mo-menu-search-modal").html(data.mobile);
if(data.mobile){
$("a[href='#btn-country']").text($("#country .mo-menu-search-modal .first").text());
$("a[href='#btn-country']").parent().show();
$("a[href='#btn-place']").parent().hide();
}
},
error:function(xhr, ajaxOptions, thrownError){
}
});
$("#package-box").empty();
$(window).scroll();
if (history.pushState) {
window.history.pushState("", $("title").eq(0).text(), "/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
var section = $("#package-section .mo-menu-search-modal .first a").text();
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").text();
var type = $("#package-sub-item .mo-menu-search-modal .first a").text();
var country_node = $("#country-node .mo-menu-search-modal .first a").text();
var country = $("#country .mo-menu-search-modal .first a").text();
var place = $("#place .mo-menu-search-modal .first a").text();
var button = $("#mo-nav-path button");
//$("#mo-nav-path").text(((section)?section:"")+((type_alias)?"/"+type_alias:"")+((country_node)?"/"+country_node:"")+((country)?"/"+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").text(((section)?section:"")+((type_alias)?((section)?"/":"")+type_alias:"")+((country)?((type_alias)?"/":"")+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").append(button);
}
}else{
window.location = $(this).attr("href");
}
});
$(document).on("click","#country-node a[data-target='#country-node']", function(e){
$("#country-node li").removeClass("first");
$(this).parent().addClass("first");
$("a[href='#btn-country-node']").text($("#country-node .mo-menu-search-modal .first").text());
var section = $("#package-section .mo-menu-search-modal .first a").data("sec");
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").data("type-alias");
var type = $("#package-sub-item .mo-menu-search-modal .first a").data("type");
var country_node = $("#country-node .mo-menu-search-modal .first a").data("node");
var country = $("#country .mo-menu-search-modal .first a").data("country");
var place = $("#place .mo-menu-search-modal .first a").data("place");
$("#mo-menu-search form").attr("action","/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : section,
"type" : type,
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : ($("#mo-search-bar-package").val())?$("#mo-search-bar-package").val():$("#search-bar-package").val(),
"lang" : 'cn'
}
$("#country .mo-menu-search-modal").empty();
$.ajax({
url: "/cn/get_country/"+((section)?section:"all")+"/"+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":""),
type : "GET",
dataType: "json",
timeout : 5000,
success: function(data) {
var data_node = $("#srch-country option").eq(0).data("node") || "";
var opt_rel = $("#srch-country option").eq(0).attr("rel") || "";
$("#srch-country").parent().children(".select-options").html(''+$("#srch-country option").eq(0).text()+' '+data.desktop);
$("#srch-place").parent().hide();
$("#srch-country").val("");
$("#srch-place").val("");
$("#srch-country").next('div.select-styled').text($("#srch-country option").eq(0).text());
$("#country .mo-menu-search-modal").html(data.mobile);
if(data.mobile){
$("a[href='#btn-country']").text($("#country .mo-menu-search-modal .first").text());
$("a[href='#btn-country']").parent().show();
$("a[href='#btn-place']").parent().hide();
}
},
error:function(xhr, ajaxOptions, thrownError){
}
});
$("#package-box").empty();
$(window).scroll();
if (history.pushState) {
window.history.pushState("", $("title").eq(0).text(), "/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
var section = $("#package-section .mo-menu-search-modal .first a").text();
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").text();
var type = $("#package-sub-item .mo-menu-search-modal .first a").text();
var country_node = $("#country-node .mo-menu-search-modal .first a").text();
var country = $("#country .mo-menu-search-modal .first a").text();
var place = $("#place .mo-menu-search-modal .first a").text();
var button = $("#mo-nav-path button");
$("#mo-nav-path").text(((section)?section:"")+((type_alias)?"/"+type_alias:"")+((country_node)?"/"+country_node:"")+((country)?"/"+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").append(button);
}
});
$(document).on("click","#country a[data-target='#country']", function(e){
$("#country li").removeClass("first");
$(this).parent().addClass("first");
$("a[href='#btn-country']").text($("#country .mo-menu-search-modal .first").text());
var section = $("#package-section .mo-menu-search-modal .first a").data("sec");
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").data("type-alias");
var type = $("#package-sub-item .mo-menu-search-modal .first a").data("type");
var country_node = ($("#country-node .mo-menu-search-modal .first a").length)?$("#country-node .mo-menu-search-modal .first a").data("node") : $(this).data("node");
var country = $("#country .mo-menu-search-modal .first a").data("country");
var place = $("#place .mo-menu-search-modal .first a").data("place");
$("#mo-menu-search form").attr("action","/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : section,
"type" : type,
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : ($("#mo-search-bar-package").val())?$("#mo-search-bar-package").val():$("#search-bar-package").val(),
"lang" : 'cn'
}
$("#place .mo-menu-search-modal").empty();
$.ajax({
url: "/cn/get_place/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":""),
type : "GET",
dataType: "json",
timeout : 5000,
success: function(data) {
var data_node = $("#srch-place option").eq(0).data("node") || "";
var opt_rel = $("#srch-place option").eq(0).attr("rel") || "";
$("#srch-place").parent().children(".select-options").html(''+$("#srch-place option").eq(0).text()+' '+data.desktop);
$("#srch-place").parent().show();
$("#srch-place").val("");
$("#srch-place").next('div.select-styled').text($("#srch-place option").eq(0).text());
$("#place .mo-menu-search-modal").html(data.mobile);
if(data.mobile){
$("a[href='#btn-place']").text($("#place .mo-menu-search-modal .first").text());
$("a[href='#btn-place']").parent().show();
}
},
error:function(xhr, ajaxOptions, thrownError){
}
});
$("#package-box").empty();
$(window).scroll();
if (history.pushState) {
window.history.pushState("", $("title").eq(0).text(), "/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
var section = $("#package-section .mo-menu-search-modal .first a").text();
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").text();
var type = $("#package-sub-item .mo-menu-search-modal .first a").text();
var country_node = $("#country-node .mo-menu-search-modal .first a").text();
var country = $("#country .mo-menu-search-modal .first a").text();
var place = $("#place .mo-menu-search-modal .first a").text();
var button = $("#mo-nav-path button");
//$("#mo-nav-path").text(((section)?section:"")+((type_alias)?"/"+type_alias:"")+((country_node)?"/"+country_node:"")+((country)?"/"+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").text(((section)?section:"")+((type_alias)?((section)?"/":"")+type_alias:"")+((country)?((type_alias)?"/":"")+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").append(button);
}
});
$(document).on("click","#place a[data-target='#place']", function(e){
$("#place li").removeClass("first");
$(this).parent().addClass("first");
$("a[href='#btn-place']").text($("#place .mo-menu-search-modal .first").text());
var section = $("#package-section .mo-menu-search-modal .first a").data("sec");
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").data("type-alias");
var type = $("#package-sub-item .mo-menu-search-modal .first a").data("type");
var country_node = ($("#country-node .mo-menu-search-modal .first a").length)?$("#country-node .mo-menu-search-modal .first a").data("node") : $(this).data("node");
var country = $("#country .mo-menu-search-modal .first a").data("country");
var place = $("#place .mo-menu-search-modal .first a").data("place");
$("#mo-menu-search form").attr("action","/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : section,
"type" : type,
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : ($("#mo-search-bar-package").val())?$("#mo-search-bar-package").val():$("#search-bar-package").val(),
"lang" : 'cn'
}
$("#package-box").empty();
$(window).scroll();
if (history.pushState) {
window.history.pushState("", $("title").eq(0).text(), "/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
var section = $("#package-section .mo-menu-search-modal .first a").text();
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").text();
var type = $("#package-sub-item .mo-menu-search-modal .first a").text();
var country_node = $("#country-node .mo-menu-search-modal .first a").text();
var country = $("#country .mo-menu-search-modal .first a").text();
var place = $("#place .mo-menu-search-modal .first a").text();
var button = $("#mo-nav-path button");
//$("#mo-nav-path").text(((section)?section:"")+((type_alias)?"/"+type_alias:"")+((country_node)?"/"+country_node:"")+((country)?"/"+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").text(((section)?section:"")+((type_alias)?((section)?"/":"")+type_alias:"")+((country)?((type_alias)?"/":"")+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").append(button);
$("#mo-menu-filter").removeClass("show");
}
});
$("#mo-menu-search form").submit(function(e){
e.preventDefault();
var keyword = $("#mo-search-bar-package").tagsinput('items').join(",");
window.location = $(this).attr("action")+((keyword)?"keyword/"+keyword+"/":"");
/*$("#mo-menu-search form").attr("action","/"+$("body").data("lang")+"/package/all/country/"+((keyword)?"keyword/"+keyword+"/":""));
$.package_loaded = true;
$.package_page = 0;
$.package_param.keyword = $("#mo-search-bar-package").val();
if (history.pushState) {
window.history.pushState("", $("title").eq(0).text(), "/"+$("body").data("lang")+"/package/all/country/"+((keyword)?"keyword/"+keyword+"/":""));
}
$("#package-box").empty();
var section = $("#package-section .mo-menu-search-modal .first a").text();
var type_alias = $("#package-sub-item .mo-menu-search-modal .first a").text();
var type = $("#package-sub-item .mo-menu-search-modal .first a").text();
var country_node = $("#country-node .mo-menu-search-modal .first a").text();
var country = $("#country .mo-menu-search-modal .first a").text();
var place = $("#place .mo-menu-search-modal .first a").text();
var button = $("#mo-nav-path button");
$("#mo-nav-path").text(((section)?section:"")+((type_alias)?"/"+type_alias:"")+((country_node)?"/"+country_node:"")+((country)?"/"+country:"")+((place)?"/"+place:""));
$("#mo-nav-path").append(button);
$(window).scroll();*/
$("#mobile-country-list").removeClass("show");
})
$(document).on("click","#package-submenu .nav-item .nav-link", function(e){
if($(this).attr("href").indexOf("/diving-")<0)
if (history.pushState) {
e.preventDefault();
$("#package-content .nav-item .nav-link").removeClass("active");
$(this).addClass("active");
var section = $("#package-menu a.active").data("sec");
var type_alias = $("#package-submenu a.active").data("type-alias");
var country_node = $("#srch-country-node").val();
country_node = (country_node=="all")? "" : country_node;
var country = $("#srch-country").val();
var place = $("#srch-place").val();
$("#srch-country-node").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
$("#srch-country").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
$("#srch-place").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
window.history.pushState("", $("title").eq(0).text(), $(this).attr("href")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":""));
//$("#link-path").text(' / '+$("#package-menu a.active").text()+" / "+$(this).text().replace(" ↓","")+((country_node)?" / "+$("#srch-country-node option[value="+country_node+"]").text():"")+((country)?" / "+$("#srch-country option[value="+country+"]").text():"")+((place)?" / "+$("#srch-place option[value="+place+"]").text():""));
$("#link-path").html(' / '+$("#package-menu a.active").text()+' '+
((type_alias)?' / '+$("#package-submenu a.active").text()+' ':'')+
((country_node)?' / '+$('#srch-country-node option[value='+country_node+']').text()+' ':'')+
((country)?' / '+$("#srch-country option[value="+country+"]").text()+' ':'')+
((place)?" / "+$("#srch-place option[value="+place+"]").text():""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : $(this).data("sec"),
"type" : $(this).data("type"),
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : ($("#mo-search-bar-package").val())?$("#mo-search-bar-package").val():$("#search-bar-package").val(),
"lang" : 'cn'
}
$("#package-box").empty();
$(window).scroll();
}
})
$(".place-btn").click(function(e){
if (history.pushState) {
e.preventDefault();
var section = $("#package-menu a.active").data("sec");
var type_alias = $("#package-submenu a.active").data("type-alias");
var country_node = $("#srch-country-node").val();
country_node = (country_node=="all")? "" : country_node;
var country = $("#srch-country").val();
var place = $("#srch-place").val();
var keyword = ($("#mo-menu-search").is(":visible"))?$("#mo-search-bar-package").tagsinput('items'):$("#search-bar-package").tagsinput('items');
var keyword = keyword.join(",");
$("#srch-country-node").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
$("#srch-country").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
$("#srch-place").data("baseurl",$(this).attr("href")+((country_node)?"country/"+country_node+"/":""));
window.history.pushState("", $("title").eq(0).text(), "/"+$("body").data("lang")+"/package/"+((section)?section+"/":"all/")+((type_alias)?type_alias+"/":"country/")+((country_node)?country_node+"/":"")+((country)?country+"/":"")+((place)?place+"/":"")+((keyword)?"keyword/"+keyword+"/":""));
$("#link-path").html(' / '+$("#package-menu a.active").text()+' '+
((type_alias)?' / '+$("#package-submenu a.active").text()+' ':'')+
((country_node)?' / '+$('#srch-country-node option[value='+country_node+']').text()+' ':'')+
((country)?' / '+$("#srch-country option[value="+country+"]").text()+' ':'')+
((place)?" / "+$("#srch-place option[value="+place+"]").text():""));
$.package_loaded = true;
$.package_page = 0;
$.package_param = {
"p" : $.package_page,
"qs_id" : 0,
"area_id" : (country_node)? country_node : '',
"place_ids" : (place || country_node)? [] : [],
"place_id" : (place)? 0 : 0,
"section" : 'theme',
"country_node" : country_node,
"country" : country,
"place" : place,
"keyword" : keyword,
"lang" : 'cn'
}
$("#package-box").empty();
$(window).scroll();
}
})
$.to_subscribe = false;
$(window).scroll(function(e){
var card_box_height = ($(".card-box").length)? $(".card-box").outerHeight() : 0;
var pkc_top = ($("#package-box").length)? $("#package-box").offset().top : 0;
var h = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
if(($(this).scrollTop()+h)>=(pkc_top+$("#package-box").outerHeight()-card_box_height) && $.package_loaded && !$.to_subscribe && window.location.href.indexOf("/diving-course")<0){
$.package_loaded = false;
$.package_page++;
var param = $.package_param;
param.p = $.package_page;
var keyword = ($("#mo-menu-search").is(":visible"))?$("#mo-search-bar-package").tagsinput('items'):[];//$("#search-bar-package").tagsinput('items');
var keyword = keyword.join(",");
param.keyword = keyword;
var pkc_secs = {"theme":{"table":"theme_package","title":null},"aplus":{"table":"free_package","title":null},"diving":{"table":"qs_package","title":null},"all":{"table":"","title":null}};
$.ajax({
url: "/get_packages.php",
type : "GET",
dataType: "json",
timeout : 5000,
data:param,
success: function(data) {
if($(data).length){
var card_cnt = $("h3.card-body").length-1;
var card_max_h = 0;
for( n in data){
var card_box_html = ''
if(0)
if(!$.curr_title || $.curr_title!=pkc_secs[data[n]['pkc_sec']]["title"]){
$.curr_title = pkc_secs[data[n]['pkc_sec']]["title"];
card_box_html += ''+$.curr_title+' ';
}
card_box_html += '';
var card_box = $(card_box_html).appendTo("#package-box");
}
$.package_loaded = true;
var w = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var card_per_row = (w<768)?2:4;
var card_max_h = 0;
var card_cnt = 0;
$("h3.card-body").height('');
$("h3.card-body").each(function(idx, obj){
if(card_cnt%card_per_row==0 && card_cnt>0){
for(var c = 0; c < card_per_row; c++){
$("h3.card-body").eq(idx-c-1).height(card_max_h);
}
card_max_h = 0;
card_max_h = Math.max(card_max_h, $(this).height());
}else{
card_max_h = Math.max(card_max_h, $(this).height());
}
card_cnt++;
})
for(var c = 0; c < 2-card_cnt%2; c++){
$("h3.card-body").eq(card_cnt-c-1).height(card_max_h);
}
}else{
if(!$("#package-box").children().length)
$('
').appendTo("#package-box");
}
},
error:function(xhr, ajaxOptions, thrownError){
}
});
}
});
function selectOption() {
var t = document.getElementById("city-select").value;
var b = String(t) + "-image";
var c = document.getElementsByClassName(b);
var d = document.getElementById('package-box').children;
var i;
for (i = 0; i