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.
278 lines
11 KiB
JavaScript
278 lines
11 KiB
JavaScript
// JavaScript Document
|
|
TrunMenu("toptour_type","active","li","toptype_content");
|
|
|
|
document.writeln("<script type=\"text/javascript\" src=\"/js/linksubmit.js\"></script>");
|
|
document.writeln("<script type=\"text/javascript\" src=\"/js/tour-info.js\"></script>");
|
|
document.writeln("<script language=\"JavaScript\" src=\"/js/jquery.cookies.js\" type=\"text/javascript\"></script>");
|
|
document.writeln("<script type=\"text/javascript\" src=\"/js/jquery.md5.js\"></script>");
|
|
document.writeln("<script language=\"JavaScript\" src=\"/js/community/comment.js\" type=\"text/javascript\"></script>");
|
|
document.writeln("<script type=\"text/javascript\" src=\"/js/jquery.pagination.js\"></script>");
|
|
TrunMenu("priceTable","active","li","priceDetail");
|
|
TrunMenu("priceIncl","active","li","in-ex");
|
|
TrunMenu("qaIncl","active","li","c-qa");
|
|
$(function(){
|
|
$(".r_tips").mouseover(function(){
|
|
$(".r_tips_c").show();
|
|
});
|
|
$(".r_tips_c .closeIt").click(function(){
|
|
$(".r_tips_c").hide();
|
|
});
|
|
|
|
$(".tourPic").hover(
|
|
function () {
|
|
$(this).find(".hideBlock").show();
|
|
},
|
|
function () {
|
|
$(this).find(".hideBlock").hide();
|
|
}
|
|
);
|
|
|
|
var sTags = $(".switchTags");
|
|
sTags_top = sTags.offset().top;
|
|
|
|
tagsScroll(".tag-tour-itinerary", "#tourSummary");
|
|
tagsScroll(".tag-price-details", "#tourLeft");
|
|
tagsScroll(".tag-qa", "#questionBox");
|
|
tagsScroll(".tag-feedbacks", "#tourFeedback");
|
|
tagsScroll(".tag-other-option", "#otherOption");
|
|
|
|
$(window).unbind("scroll");
|
|
$(window).bind("scroll", function() {
|
|
try{
|
|
var tab_intinerary_info = $("#tourSummary");
|
|
var tab_price_details= $("#tourLeft");
|
|
var tab_question = $("#questionBox");
|
|
var tab_feedback = $("#tourFeedback");
|
|
var tab_other_option = $("#otherOption");
|
|
|
|
var self_top = $(this).scrollTop();
|
|
if(self_top > sTags_top ){
|
|
sTags.css({"position": "fixed", "top": 0, "width": 952, "height": 40, "z-index": 10, "background": "#FFFFFF", "border-bottom": "2px solid #A31022"});
|
|
$(".bookingButton-s").css({"margin-top": "5px", "position": "absolute"});
|
|
if(self_top > tab_price_details.offset().top - 50 && tab_price_details.offset().top != 0){
|
|
|
|
changingOverTab($(".tag-tour-itinerary"));
|
|
}
|
|
if(self_top > tab_price_details.offset().top - 50 && tab_price_details.offset().top != 0){
|
|
changingOverTab($(".tag-price-details"));
|
|
}
|
|
if(self_top > tab_question.offset().top - 50 && tab_feedback.offset().top != 0){
|
|
changingOverTab($(".tag-qa"));
|
|
}
|
|
if(self_top > tab_feedback.offset().top - 50 && tab_feedback.offset().top != 0){
|
|
changingOverTab($(".tag-feedbacks"));
|
|
}
|
|
if(self_top > tab_other_option.offset().top - 50 && tab_other_option.offset().top != 0){
|
|
changingOverTab($(".tag-other-option"));
|
|
}
|
|
}else{
|
|
sTags.css({"position": "static", "background": "none"});
|
|
$(".bookingButton-s").css({"margin-top": "5px", "position": "inherit"});
|
|
changingOverTab($(".tag-tour-itinerary"));
|
|
}
|
|
}catch(err){}
|
|
});
|
|
|
|
chtcode=$("#cli-no").html();
|
|
if(chtcode==''){
|
|
chtcode='cht-1';
|
|
}
|
|
//Q & A
|
|
//-----------dobook--------------------
|
|
$("#i_doBook").click(function(){
|
|
if($("#i_doBook").attr("checked") == true){
|
|
$(".otherInfoNeed").show();
|
|
}else{
|
|
$(".otherInfoNeed").hide();
|
|
}
|
|
});
|
|
|
|
$.getJSON("/api/tmp/qaJSON.asp?jsoncallback=?", {"num": "50", "path": "/tour/"+chtcode+"/"}, function(json){
|
|
var size = json.qa.length;
|
|
$("#qa-hiddenresult").empty();
|
|
for(var i = 0; i < size; i++){
|
|
var template = "";
|
|
template += " <div class='qaList'>";
|
|
template += " <ul>";
|
|
template += " <li class='questionIcon'> <span class='viewAnswer'>"+json.qa[i].question.content+"</span> <span class='whyAsked'> Asked by <strong>"+json.qa[i].question.name+"</strong> "+json.qa[i].question.dates+" </span></li>";
|
|
a_size = json.qa[i].answer.length;
|
|
for(var j = 0; j < a_size; j++){
|
|
template += " <li class='answerIcon'> <span class='whyAsked'><strong>"+json.qa[i].answer[j].name+"</strong> replied "+json.qa[i].answer[j].dates+" </span> "+json.qa[i].answer[j].content+"</li>";
|
|
}
|
|
template += " </ul>";
|
|
template += " </div>";
|
|
$("#qa-hiddenresult").append(template);
|
|
}
|
|
$("#qa-loading").hide();
|
|
initPagination(3, {"num_entries": "#qa-hiddenresult div.qaList", "list": ".qalistBox", "pagination": "#qa-pagination", "hiddenresult": "#qa-hiddenresult div.qaList"});
|
|
qaclick();
|
|
$(".tag-qa span").html("("+json.qa.length+")");
|
|
/*
|
|
$("#qa-pagination a").click(function(){
|
|
var o = $("#questionBox");
|
|
var offset = o.offset();
|
|
offset.top;
|
|
$(document).scrollTop(offset.top);
|
|
});*/
|
|
});
|
|
|
|
//Feedback
|
|
function initPagination (items_per_page, obj_node) {
|
|
var num_entries = $(obj_node.num_entries).length;
|
|
var run = (function(num_entries, items_per_page, obj_node){
|
|
$(obj_node.pagination).pagination(num_entries, {
|
|
num_edge_entries: 1,
|
|
num_display_entries: 10,
|
|
link_to: '#'+pbounce(obj_node.pagination),
|
|
callback: function(page_index, jq){
|
|
var max_elem = Math.min((page_index + 1) * items_per_page, num_entries);
|
|
$(obj_node.list).empty();
|
|
for(var i = (page_index * items_per_page); i < max_elem; i++){
|
|
var content = $(obj_node.hiddenresult).eq(i).clone();
|
|
$(obj_node.list).append(content);
|
|
}
|
|
qaclick();
|
|
|
|
|
|
//return false;
|
|
},
|
|
items_per_page: items_per_page,
|
|
prev_text: "",
|
|
next_text: ""
|
|
});
|
|
})(num_entries, items_per_page, obj_node);
|
|
};
|
|
|
|
//ajax
|
|
$.getJSON("/api/tmp/feedbackjson.asp?jsoncallback=?", {"code": chtcode}, function(json){
|
|
var size = json.feedback.length;
|
|
for(var i = 0; i < size; i++){
|
|
var attractions = (function(o){
|
|
if(o != ""){
|
|
return "<span>: "+o+"</span>";
|
|
}
|
|
})(json.feedback[i].rate.attractions);
|
|
var hotel = (function(o){
|
|
if(o != ""){
|
|
return "<span>: "+o+"</span>";
|
|
}
|
|
})(json.feedback[i].rate.hotel);
|
|
var restaurant = (function(o){
|
|
if(o != ""){
|
|
return "<span>: "+o+"</span>";
|
|
}
|
|
})(json.feedback[i].rate.restaurant);
|
|
var guide = (function(o){
|
|
if(o != ""){
|
|
return "<span>: "+o+"</span>";
|
|
}
|
|
})(json.feedback[i].rate.guide);
|
|
var dates = (function(o){
|
|
if(o != ""){
|
|
return "<strong>Traveled:</strong> "+o+" ";
|
|
}
|
|
})(json.feedback[i].dates);
|
|
var title = (function(o, t){
|
|
if(o != ""){
|
|
return "Tour Title:</strong> <a href='"+o+"' target='_blank'>"+t+"</a>";
|
|
}else{
|
|
return "Tour Title:</strong> "+t;
|
|
}
|
|
})(json.feedback[i].url, json.feedback[i].title);
|
|
var attractions = (function(o){
|
|
if(o != ""){
|
|
return "<span><strong>Attractions:</strong> "+o+"</span> ";
|
|
}
|
|
})(json.feedback[i].rate.attractions);
|
|
var hotel = (function(o){
|
|
if(o != ""){
|
|
return "<span><strong>Hotels:</strong> "+o+"</span> ";
|
|
}
|
|
})(json.feedback[i].rate.hotel);
|
|
var restaurant = (function(o){
|
|
if(o != ""){
|
|
return "<span><strong>Restaurants:</strong> "+o+"</span> ";
|
|
}
|
|
})(json.feedback[i].rate.restaurant);
|
|
var guide = (function(o){
|
|
if(o != ""){
|
|
return "<span><strong>Guides:</strong> "+o+"</span> ";
|
|
}
|
|
})(json.feedback[i].rate.guide);
|
|
|
|
var pv = (function(o, j){
|
|
if(o != ""){
|
|
return "<span class='feedbackVideo'><img src='//www.chinahighlights.com/image"+o+"' width='200'></span> ";
|
|
}else if(j != ""){
|
|
return "<span class='feedbackimage'><img src='//www.chinahighlights.com/image"+j+"'></span> ";
|
|
}else{
|
|
return "";
|
|
}
|
|
})(json.feedback[i].video, json.feedback[i].image)
|
|
var template = "";
|
|
template += "<div class='feedbackList'>" +pv;
|
|
|
|
template += " <div class='feedbackInfo'> <span class='customerSay'>"+json.feedback[i].content+" <a href='"+json.feedback[i].urlfd+"' target='_blank'>Read more »</a></span> <span class='dates-title'>"+dates+"<strong>"+title+"</span> </div>";
|
|
template += " <div class='feedbackRating'>"+attractions+hotel+restaurant+guide+"</div>";
|
|
template += " <div class='clear'></div>";
|
|
template += "</div>";
|
|
$("#feedback-hiddenresult").append(template);
|
|
}
|
|
$("#feedback-loading").hide();
|
|
initPagination(3, {"num_entries": "#feedback-hiddenresult div.feedbackList", "list": "#feedback-list", "pagination": "#feedback-pagination", "hiddenresult": "#feedback-hiddenresult div.feedbackList"});
|
|
$(".tag-feedbacks span").html("("+json.feedback.length+")");
|
|
$(".reviews").html(json.feedback.length);
|
|
});
|
|
});
|
|
|
|
function pbounce(o){
|
|
if(o == "#qa-pagination"){
|
|
return "tourQuestion";
|
|
}else{
|
|
return "tourFeedback";
|
|
}
|
|
}
|
|
|
|
function tagsScroll(o, v){
|
|
$(o).click(function(){
|
|
$("html,body").animate({scrollTop: $(v).offset().top - 43}, 0);
|
|
});
|
|
}
|
|
|
|
function qaclick(){
|
|
$(".answerIcon").hide();
|
|
$(".questionIcon").click(function(){
|
|
$(this).siblings("li").toggle();
|
|
$(this).parents(".qaList").siblings(".qaList").find("li.answerIcon").hide();
|
|
});
|
|
$("#questionList .qaList:eq(0) li").show();
|
|
}
|
|
|
|
function changingOverTab(o) {
|
|
var a_current = o;
|
|
var a_parent = a_current.parent();
|
|
var a_parent_name = a_current.parent().attr("class");
|
|
if(testReg(/Active/, a_parent_name)){
|
|
|
|
}else{
|
|
a_parent.addClass(a_parent_name+"Active").removeClass(a_parent_name);
|
|
}
|
|
|
|
|
|
a_parent.siblings().each(function(){
|
|
var sibling = $(this);
|
|
var sibling_name = sibling.attr("class");
|
|
if(testReg(/Active/, sibling_name)){
|
|
sibling.addClass(sibling_name.replace(/Active/, "")).removeClass(sibling_name);
|
|
}
|
|
});
|
|
}
|
|
|
|
function execReg(reg,str){
|
|
var result = reg.exec(str);
|
|
return result;
|
|
}
|
|
function testReg(reg,str){
|
|
return reg.test(str);
|
|
}
|