function addFavorite(productTypeId,productId,site,a){ // if (!isLogined) { // showLoginBox({ // onSuccess:function(){ // hideLoginBox(); $(a).addClass("click"); doAddFavorite(productTypeId, productId, site, a); // } // }); // } else { // doAddFavorite(productTypeId, productId, site, a); // } } function doAddFavorite(productTypeId, productId, site, a) { headCheckLogin(function(loginData){ if (isUserLogined) { standardFrameWindowWrapper({ url:memberDomain+"/favorites.html?productTypeId="+productTypeId+"&productId="+productId+"&site="+site, width:600, height:268, success:function(obj){ if(!$("#notLogined,.user-not-logined").hasClass("undis")){ checkLoginAndDisplay(); } } }); } else { var singleQuotationMarks = 'singleQuotationMarks'; var params = [productTypeId, productId, site].join(","); standardFrameWindowWrapper({ url:memberDomain+"/user/login/mini?redirectURL="+encodeURIComponent("http:"+domain+"/loginSuccess.jsp?m=doAddFavorite&addtionalData="+params)+"&otherLoginRedirectURL="+encodeURIComponent(window.location.href), width:883, height:510, success:function(obj){ obj.find("#removea").css("top", "125px").css("left","730px"); } }); } }); // var width = 688; // var height=368; // var html = "
"; // $(document.body).append(html); // // $.createWrapper(); // $("#favoriteDiv").show().absCenter(); // $("#favoriteDiv").find("iframe").attr("src",memberDomain+"/favorites.html?productTypeId="+productTypeId+"&productId="+productId+"&site="+site); // $("#tourListShoucangId"+productId).text("已收藏"); // $("#tourListShoucangId"+productId).addClass("click"); //// $.removeWrapper(); //// $("#favoriteDiv").slideUp().remove(); } //function closeFavorite(){ // $.removeWrapper(); // $("#favoriteDiv").slideUp().remove(); //} var eventManager = eventManager || new joytrav.EventManager(); $(function(){ checkLoginAndDisplay(); headCheckLoginOld(); $("a.loginTrigger").click(function(){ var url = domain; if(url.indexOf("http") != -1){ url.replace("http", window.location.protocol); }else{ url = window.location.protocol+url; } standardFrameWindowWrapper({ url:memberDomain+"/user/login/mini?redirectURL="+encodeURIComponent(url+"/loginSuccess.jsp?m=loginSuccess")+"&r="+Math.random()+"&otherLoginRedirectURL="+encodeURIComponent(window.location.href), width:683, height:510, success:function(obj){ obj.find("#removea").css("top", "125px").css("left","630px"); } }); }); $("a.regTrigger").click(function(){ window.location=memberDomain+"/user/reg?redirectURL="+encodeURIComponent(window.location.href); }); $("a.logoutTrigger").click(function(){ window.location=memberDomain+"/user/logout?redirectURL="+encodeURIComponent(window.location.href)+"&r="+Math.random(); }); }); function checkLoginAndDisplay() { headCheckLogin(function(loginData){ if (isUserLogined) { eventManager.post("LOGIN_SUCCESS", loginData); $("#loginedUserName").html(userNickName); $("#cartCount").html($("#cartCount").html()+" ( "+cartCount+" )"); $("#logined,.user-logined").removeClass("undis").show().addClass("inline"); $("#notLogined,.user-not-logined").addClass("undis").hide().removeClass("inline"); } else { eventManager.post("LOGIN_FAILURE", loginData); $("#logined,.user-logined").addClass("undis").hide().removeClass("inline"); $("#notLogined,.user-not-logined").removeClass("undis").show().addClass("inline"); } }); } function headCheckLogin(a) { if ($("#couponCountLabel").size() == 0) { $.ajax({ url: memberDomain+"/user/passport/check?r="+Math.random(), dataType:"jsonp", jsonp:"jsonpcallback", success:function(loginData){ isUserLogined = loginData.isLogined; userNickName = loginData.userNickName; cartCount = loginData.cartCount; if (typeof a =="function") a(loginData); } }); } } function loginSuccess() { $.removeWrapper(); checkLoginAndDisplay(); $("div#standardFrameWindowWrapper").remove(); } function headCheckLoginOld() { if ($("#couponCountLabel").size() == 1) { $.post("/checkCookie.html?r="+Math.random(),{}, function(result){ if (result != '') { var arr = result.split("||"); if(arr[3] != "Customer"){ if(arr[1]!="0"){ $("#cartCountLabel").html($("#cartCountLabel").html()+" ( "+arr[1]+" )"); } } }else{ $("#cartCountLabel").html($("#cartCountLabel").html()+" (0)"); } }); } } $(function(){ lazyload("img.laz"); $.each($("[toggle]"), function(index, obj){ var $obj = $(obj); var defaultVal = $obj.attr("toggle"); if (!$obj.val()) { if (typeof(Worker) !== "undefined") { $obj.attr("placeholder", defaultVal); } else { $obj.val(defaultVal); $obj.focus(function(){ if ($(this).val()==defaultVal) $(this).val(""); }); $obj.blur(function(){ if (!$(this).val()) $(this).val(defaultVal); }); } } }); }); function updateLazyload(){ $(window).trigger("resize"); } function lazyload(selectora, placeholder){ var config = { failure_limit: 3, effect: "fadeIn", data_attribute: "o" }; if (typeof placeholder != "undefined") { config.placeholder = placeholder; } $(selectora).lazyload(config); updateLazyload(); } $(function() { $("a.currency").click(function() { var $obj = $(this); if (!$obj.hasClass("current")) { var currency = $obj.attr("currency"); $.ajax({ url : memberDomain + "/currency/", data : { currency : currency }, dataType : "jsonp", jsonp : "jsonpcallback", success : function() { window.location.reload(true); } }); } }); //搜索框:当地玩乐 切换 $(".Head_Stypelist").on("click", "li", function() { $("#currentType").text($(this).text()); var keyword = $("#keyword"); var type = $(this).attr("data-id"); var $url = ""; switch (type) { case "1": $url = "/search/tour"; break; case "2": $url = "/search/ticket"; break; case "3": $url = "/search/hotel"; break; case "4": $url = "/search/cruise"; break; case "5": $url = "/visa/" break; case "7": $url = "/search/bus" break; case "8": $url = "/search/trip" break; case "10": $url = "/search/activity"; break; case "11": $url = "/search/hotelnew"; break; } //因同时需要匹配member和site,所以添加domain keyword.parent().attr("action", domain+$url); }); }); var tran_Simple=0; var tran_Tradition=1; //转换文本 function StranText(txt, flag) { return flag == tran_Tradition ? Traditionalized(txt) : Simplized(txt); } //转换对象,使用递归,逐层剥到文本 function translateObjects(objs) { var flag = getCookie(getCookieName()); var obj = null; if(typeof(objs)=="object"){ obj=objs.childNodes; } else { obj=document.body.childNodes; } for(var i=0;i