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.

96 lines
2.9 KiB
JavaScript

// JavaScript Document
$(function(){
var sTags = $(".switchTags");
var sTags_top = sTags.offset().top;
tagsScroll(".wifi-tips", "#tips");
tagsScroll(".wifi-deposit", "#deposit");
tagsScroll(".wifi-question", "#wquestion");
$(window).unbind("scroll");
$(window).bind("scroll", function() {
try{
var tab_intinerary_info = $("#tips");
var tab_price_details= $("#deposit");
var tab_question = $("#wquestion");
var self_top = $(this).scrollTop();
if(self_top > sTags_top ){
$(".switchTags").show();
sTags.css({"position": "fixed", "top": 0, "width": 990, "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($(".wifi-tips"));
}
if(self_top > tab_price_details.offset().top - 50 && tab_price_details.offset().top != 0){
changingOverTab($(".wifi-deposit"));
}
if(self_top > tab_question.offset().top - 50 && tab_question.offset().top != 0){
changingOverTab($(".wifi-question"));
}
}else{
$(".switchTags").hide();
sTags.css({"position": "static", "background": "none"});
$(".bookingButton-s").css({"margin-top": "5px", "position": "inherit"});
changingOverTab($(".wifi-tips"));
}
}catch(err){}
});
});
function tagsScroll(o, v){
$(o).click(function(){
$("html,body").animate({scrollTop: $(v).offset().top - 43}, 0);
});
}
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);
}
$(document).ready(function(e) {
$(".hide").hide();
});
$(function(){
$("#phoneSummary .thumbPic img").click(function(){
$("#phoneSummary .bigPhoto img").attr("src", $(this).attr("src").replace("-s", ""));
});
});
function changTab(pid,cid){
var pids="#"+pid+" .bookTipsInf";
var cids="#"+cid+" .bookTipsInf"
$(".bookTipsTitleOpen").attr("class","bookTipsTitle")
if($(pids).is(":visible")){
$(pids).hide();
$(cids).show();
$("#"+cid+" .bookTipsTitle").attr("class","bookTipsTitleOpen")
}else{
$(pids).show();
$(cids).hide();
$("#"+pid+" .bookTipsTitle").attr("class","bookTipsTitleOpen")
}
}