var productInfo = { httpHost: $("#hidGroupDomain").val(), getProductId: function () { return $("#hidProductID").val() }, getCalendarUrl: function () { return $("#hidCalendarUrl").val() }, getiscussInfoUrl: function () { return $("#hidDiscussInfoUrl").val() }, getDestCityID: function () { return $("#hidDestCityID").val() }, activityType: $("#hidActivityType").val(), getProductPriceCalendar: function () { var activity = this.activityType; $.ajax({ url: this.httpHost + this.getCalendarUrl(), data: { productID: this.getProductId(), activityType: activity }, type: 'GET', cache: false, async: true, success: function (data) { $("#CalendarDiv").find("#divloadingr").remove(); $("#CalendarDiv").append($(data)); setMonthHeadClick(); //出发日期异步加载 if ($("#hidAllDepartDateStr").val() != undefined) { var allDepartDateStr = $("#hidAllDepartDateStr").val(); if (allDepartDateStr.length > 30) { $("#departDateInfoAll").html(allDepartDateStr.substring(0, 29) + "..."); } else { $("#departDateInfoAll").html(allDepartDateStr); } if ($("#hidAllDepartDateStr").val().length <= 0) { $("#divGroupDepartDate").hide(); } } //预订按钮 if ($("#hidProductStatus").val() != undefined && $("#hidProductStatus").val() == "30") { if ($("#hidFirstDepartDate").val() != undefined && $("#hidFirstDepartDate").val() != "1900-01-01") { if ($("#hidShowPrice").val() != undefined && $("#hidShowPrice").val() != 0) { var preferencePrice = $("#hidNormalPreferentialAmount").val(); var showPrce = $("#hidShowPrice").val(); var aoyouPrice = showPrce - preferencePrice; if (aoyouPrice < 0) { aoyouPrice = showPrce; } if (activity != 1) { if (aoyouPrice == showPrce) { $("#showPrce").parent("p").hide(); } $("#showPrce").html(showPrce); $("#aoyouPrice").html(aoyouPrice); var departDateMin = $("#hidQijiaShowPriceMinDate").val(); $("#departDateMin").html(departDateMin); } if (activity == 1) { $("#Popqijiashouming").hide(); } //手机二维码价格相关 var haveMobile = $("#hidHaveMobile").val(); if (haveMobile == 1) { $(".code-btn-product").show(); var mobilePrePrice = $("#hideMobilePrePrice").val(); if (mobilePrePrice > 0) { $("#p_mobliePrePriceOrName").html("¥" + (showPrce - mobilePrePrice) + "起"); } else { $("#p_mobliePrePriceOrName").html($("#hidMobilePreName").val()); } } else { $(".code-btn-product").hide(); } } var bookHmtl = "立即预订"; var bookHtmlWraper = "立即预订"; } else { var bookHmtl = "产品已售罄"; var bookHtmlWraper = ""; sellout(); } } else { var bookHmtl = "产品已售罄"; var bookHtmlWraper = ""; sellout(); } $("#p_booking").html(bookHmtl); $("#wrapperBook").html(bookHtmlWraper); if ($("#hidmainTitleMark").val() != undefined && $("#hidmainTitleMark").val().length > 0) { var strMark = $("#hidmainTitleMark").val(); var markList = strMark.split(","); var markHtml = ""; for (var i = 0; i < markList.length; i++) { markHtml += "

" + markList[i] + "

"; } $("#GroupMarklist").html(markHtml); } } }); }, getPreferential: function () { $.ajax({ type: "Get", url: this.httpHost + "/GroupProductDetail/GerPreferentialHtml?productID=" + $("#lbproductid").val() + "&s=" + Date().toLocaleString(), success: function (dataHtml) { if (dataHtml == "0") { $("#divPreferential").hide(); } else { if ($("#divOtherPreferential") == undefined || $("#divOtherPreferential") == null || $("#divOtherPreferential").html() == null || $("#divOtherPreferential").html() == undefined) { $("#divPreferential").addClass("borderBottomNone"); } $("#divPreferential").html(dataHtml).mouseenter(function () { $("#youhuitip").show(); }).mouseleave(function () { $("#youhuitip").hide(); }); } } }); }, getProductDiscussInfo: function () { $.ajax({ url: this.httpHost + this.getiscussInfoUrl(), data: { destCityID: this.getDestCityID() }, type: 'GET', cache: false, async: true, success: function (data) { if (data != null && data != "") { $("#ProductDiscuss").html($(data)); } }, error: function () { $("#discuss_nav").addClass("hidden"); } }); }, click99Monitor: function () { var tprm = "times=" + new Date().getTime() + "&price=" + $("#aoyouPrice").html() + "&pname=" + unescape($(".mainTitle .mainTitle-h1").html()); __ozfac2(tprm, "#window"); }, PageInit: function () { // 让文字多余变省略号 $(".cpdetail_lyzx_list_con").each(function (i) { if ($(this).text().length > 33) { var text = $(this).text().substring(0, 52) + "..."; $(this).text(text); } }); // 客户点评 $(".khdp_dianPinBtn").live('click', function () { $("#adddisscussdiv").show(); }) $(".tip_Close").live('click', function () { $(this).parent().parent().parent().hide(); }); //图片懒加载 $("img[data-original]").lazyload(); //第一个模块动态添加高度 $(".cpdetail_con").children("h3").eq(0).css("margin-top", "0px"); setWindowsScroll(); //对比功能加载 start setCompareData(); //跑马灯 startmarquee(25, 25, 700); //轮播图片 ImgShuffling(); //签证相关事件 VisaFunction(); //出发城市事件 DepartCityFuction(); $(".duibiReset").live("click", function () { $.cookie("__search_compare", "", { expires: 1, path: "/" }); $("#tianjiaduibi").removeClass("jiaruBtn").html(" 对比"); setCompareData(); }) $(".aoyouDuibiPro-close").live("click", function () { removeData($(this).attr("data-compare")); }) $(".aoyouDuibiBtn").live("click", function () { if (__compareID != "" && __compareID.replace(",").indexOf(",") > -1) { window.open("http://www.aoyou.com/compare/index?ids=[" + __compareID.substring(0, __compareID.length - 1) + "]"); } }) $("#tianjiaduibi").click(function () { $(".tcBox").remove(); if ($(this).hasClass("jiaruBtn")) { $(this).removeClass("jiaruBtn nobackImg").html(" 对比"); removeData($(this).attr("data-compare")); } else { var searchCompare = $.cookie("__search_compare"); if ($(".aoyouDuibiPro").length > 2) { $(this).after("
最多能添加3条线路,
请删除部分线路后再加入。
"); $(".deltcBtn").click(function () { $(".tcBox").remove(); }) } else { if (searchCompare != undefined) { if (searchCompare.indexOf($(this).attr("data-compare").split(',')[0]) < 0) { searchCompare = searchCompare + $(this).attr("data-compare") + ","; } } else { searchCompare = $(this).attr("data-compare") + ","; } if (searchCompare != undefined) { $.cookie("__search_compare", searchCompare, { expires: 1, path: "/" }); } setCompareData(); } } }) //IE6下的右侧导航高度调整 if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) { $(".aoyouSideLeft").css({ height: $(window).height() }); } //判断移动浏览器 var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var isVisitPCSite = document.cookie ? document.cookie.indexOf("visitpc=true") > 0 : false; if ((bIsCE || bIsMidp || bIsUc7 || bIsUc || bIsIphoneOs || bIsAndroid || bIsWM) && !isVisitPCSite) { var viewPortScale = 0.5; var dpr = window.devicePixelRatio; var width = parseInt(window.screen.width); var detectBrowser = function (name) { if (navigator.userAgent.toLowerCase().indexOf(name) > -1) { return true; } else { return false; } }; var scale = width / 1200; if (detectBrowser("qq/")) userScalable = 'yes'; var viewprotHtml = "" $("head").append(viewprotHtml); } $.each($('.zyhd_p'), function () { if ($(this).height() > 20) { $(this).parent("td").attr("class", "al"); } else { $(this).parent("td").attr("class", "ac"); } }); $.each($('.zyhd_no'), function () { if ($(this).html() == "--") { $(this).parent("td").attr("class", "ac"); } else { $(this).parent("td").attr("class", "al"); } }); } }; //优惠标签 $(".aoyouCharacteristic").each(function () { $(this).children(".aoyouOnsale").eq(2).css({ "margin-right": "70px" }) }) //价格日历 $(".calendar-table").find("tr").each(function () { $(this).children("td").first().css({ "border-left": "0" }) }) $(".calendar-table").find("tr").last().children("td").css({ "border-bottom": "0" }) //$(".cpdetail_xcjs_nav").smartFloat(); ////行程左侧浮动*** var firstDatepopDiv = ""; $(function () { startmarquee(25, 25, 700); //ImgShuffling(); productInfo.PageInit(); productInfo.getProductPriceCalendar(); productInfo.getPreferential(); productInfo.getProductDiscussInfo(); ajaxLoading(); //弹出层正在加载提示 //产品等级 $('.product-box-stars').hover(function () { $(this).find('.product-box-stars-tips').show(); }, function () { $(this).find('.product-box-stars-tips').hide(); }); //出发城市 if ($(".des-p-city").parents(".productInfoBox-desBox").children(".des-p-city-list").children("span").children("a").length > 0) { $(".des-p-city").hover(function () { $(".des-p-city-list").slideToggle(200, function () { $(".des-p-city").toggleClass("hover"); }); }); } setFocus(); setDayPriceClick(); // 对比功能 end $('#Popqijiashouming').mouseover(function () { popqijiashuoming(); }); $('#Popqijiashouming').mouseout(function () { closeallpopinfodiv(); }); //可选附加服务 $(".xqBtn").click(function () { var kxffTop = $(window).scrollTop() + 200; var $kxff_xq = $(this).parents('tr').find('.kxff_xq'); var $zhezhao = $(".zhezhao"); $kxff_xq.css("top", kxffTop + "px"); $kxff_xq.show(); $zhezhao.height(document.body.scrollHeight).show(); $(".fw_close_btn").click(function () { $kxff_xq.hide(); $zhezhao.hide(); }); }); }); function closeallpopinfodiv() { $("#qijiashuoming").css("display", "none"); //$("#popbooking").css("display", "none"); //$("#adddisscussdiv").css("display", "none"); } //弹出起价说明 function popqijiashuoming() { $("#qijiashuoming").css("display", "block"); } //客户点评 function ChangeCheckCode() { $('#ImgCheckCode').attr('src', productInfo.httpHost + "/GroupProductDetail/getCheckCode?time=" + new Date()); } function AddDiscuss() { var content = $("#content_txt").val(); var code = $('#I_CCode').val(); if (content.replace(/\s/g, "") == '' || content == '快来说两句吧,最多可以输入140字哦!') { $("#discuss_msg").html('  请输入评论内容!'); return; } if (content.replace(/\s/g, "") != '' && content.length > 140) { $("#discuss_msg").html('  评论最多长度为140字!'); return; } if (code == '') { $("#discuss_msg").html('  请输入验证码!'); return; } $.ajax({ type: "Post", url: productInfo.httpHost + "/GroupProductDetail/AddDiscuss", data: { Content: escape(content), Code: code, ForeignID: $('#hidattrid').val(), PlateType: $('#hidattrtype').val(), Title: escape($('#hidattrtit').val() + '景点评论') }, success: function (data) { ChangeCheckCode(); if (data == "0") { $("#discuss_msg").html('  保存失败'); } else if (data == "-1") { $("#discuss_msg").html('  验证码错误'); } else { //$("#content_txt").val('快来说两句吧,最多可以输入140字哦!'); $("#content_txt").val(''); $('#I_CCode').val(''); $("#discuss_msg").html('  提交成功,请耐心等待我们的审核'); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { $("#discuss_msg").html('  系统繁忙,请稍后重试!'); } }); } //价格日历 function setMonthHeadClick() { var monthNow = $("#hidcurMonthIndex").val(); var monthCount = $(".calendarMonths").children(".monthHead").length - 1; $(".calendarMonths").find("a.monthHead").live('click', function () { if (!$(this).hasClass("monthsCurrent")) { monthNow = ($(this).index() - 1); setMonth(); } }); //上个月单机 $(".calendarMonths").find("a.calendarMonthsLast").live("click", function () { if (monthNow > 0) { monthNow--; if (monthCount > 2) { for (var i = (monthNow + 3) ; i <= monthCount ; i++) { $(".calendarMonths").children(".monthHead").eq(i).addClass("hidden"); } } setMonth(); } }).live("mouseover", function () { if (monthNow > 0 && monthCount > 0) { $(this).addClass("calendarMonthsLast-hover"); } }).live("mouseout", function () { $(this).removeClass("calendarMonthsLast-hover"); }); //下个月单机 $(".calendarMonths").find("a.calendarMonthsNext").live("click", function () { if (monthNow < monthCount) { monthNow++; if (monthNow > 2 && monthCount > 2) { for (var i = 0; i < (monthNow - 2) ; i++) { $(".calendarMonths").children(".monthHead").eq(i).addClass("hidden"); } } setMonth(); } }).live("mouseover", function () { if (monthCount > 0 && monthNow < monthCount) { $(this).addClass("calendarMonthsNext-hover"); } }).live("mouseout", function () { $(this).removeClass("calendarMonthsNext-hover"); }); //价格日历月份切换显隐 function setMonth() { $(".calendarMonths").find(".monthsCurrent").find("span").addClass("hidden"); $(".calendarMonths").find("a[data-icon]").removeClass("monthsCurrent").addClass("monthsNext"); $(".calendarMonths").children(".monthHead").eq(monthNow).removeClass("monthsNext").removeClass("hidden").addClass("monthsCurrent"); $(".calendarMonths").children(".monthHead").eq(monthNow).find("span").removeClass("hidden"); $("#CalendarDiv").find("table.calendar-table").addClass("hidden"); $("#CalendarDiv").find("table.calendar-table:eq(" + ($(".calendarMonths").children(".monthHead").eq(monthNow).index() - 1) + ")").removeClass("hidden"); } } //价格日历的 function setFocus() { $(".calendar-table").find("td.on").live('mouseover', function (e) { if (checkHover(e, this)) { $(this).find("a").css("position", "relative").css("z-index", "11"); $(this).find("div.current-box").css("display", "block"); } }).live("mouseout", function (e) { if (checkHover(e, this)) { $(this).find("a").css("position", "").css("z-index", "11"); $(this).find("div.current-box").css("display", "none"); } }).live("hover", function () { $(this).children("a").toggleClass("a-hover"); }); } function checkHover(e, target) { if (getEvent(e).type == "mouseover") { return !contains(target, getEvent(e).relatedTarget || getEvent(e).fromElement) && !((getEvent(e).relatedTarget || getEvent(e).fromElement) === target); } else { return !contains(target, getEvent(e).relatedTarget || getEvent(e).toElement) && !((getEvent(e).relatedTarget || getEvent(e).toElement) === target); } } function getEvent(e) { return e || window.event; } function contains(parentNode, childNode) { if (parentNode.contains) { return parentNode != childNode && parentNode.contains(childNode); } else { return !!(parentNode.compareDocumentPosition(childNode) & 16); } } //价格日历弹出层 //价格日历弹出层日期选择 function datechange() { $("#bookalart").css("display", "none"); productInfo.click99Monitor(); getpopbooking(document.getElementById("lbproductid").value, $("#selectdate").val(), 1); } //按照产品ID和时间弹出预订层 zhy function popupCal(productID, date, type) { if (window.XMLHttpRequest) { $('#shade').css("display", ""); } $(".pop_yuding").css("display", "block"); $(".pop_yuding").width($(document).width()); $(".pop_yuding").height($(document).height()); $(".pop_yuding").find("iframe").width($(document).width()); $(".pop_yuding").find("iframe").height($(document).height()); var position = $(window).scrollTop() + 180; $('#inner_pop').css("top", position); getpopbooking(productID, date, type); } //弹出预订层,但是显示加载缓冲 function ShowpopupCal() { popupCal($("#hidProductID").val(), $("#hidFirstDepartDate").val(), 0); } /***99click立即预订按钮监视***/ function click99Monitor() { var tprm = "times=" + new Date().getTime() + "&price=" + $(".price .num").html() + "&pname=" + unescape($(".clearfix .h1_tt").html()); __ozfac2(tprm, "#window"); } //获取预订弹出层的内容 function getpopbooking(productID, date, tagtype, flag) { productInfo.click99Monitor(); $("#bookingselectdiv").hide(); $("#loading").show(); var thisdate = ""; var thisweek = ""; if (date != undefined) { thisdate = addDay(date, parseInt($('#lbduration').val()) - 1); thisweek = getWeek(thisdate); } $.get(productInfo.httpHost + "/GroupProductDetail/GetPopBookingPriceDetail?productID=" + productID + "&date=" + date + "&tagtype=" + tagtype + "&s=" + Date().toLocaleString(), function (data) { if (flag == 1) { firstDatepopDiv = data; } $("#bookingselectdiv").html(data); $("#bcity").html("出发地点:" + $("#begincity").val() + " "); if (date != undefined) { $("#enddate").html(""); } else { $("#enddate").html("返回时间:"); } $("#loading").hide(); $("#bookingselectdiv").show(); }) } function closebookingdiv() { $("#popbooking").css("display", "none"); $("#bookingselectdiv").html(firstDatepopDiv); $("#bcity").html("出发地点:" + $("#begincity").val() + " "); var backweek = ""; var firstdate = $("#hidFirstDepartDate").html(); if (firstdate != undefined) { var backdate = addDay(firstdate, parseInt($('#lbduration').html()) - 1); backweek = getWeek(backdate); $("#enddate").html(""); } } function setDayPriceClick() { $(".calendar-table").find("td.on").live('click', function () { popupCal($("#hidProductID").val(), $(this).find("input[name=DepartDate]").val(), 0); }); //$("#p_booking").find("a.productInfoBox-price-btn").live('click', function () { // popupCal($("#hidProductID").val(), $("#hidFirstDepartDate").val(), 0); //}); } function getWeek(dateStr) { var myDate = new Date(Date.parse(dateStr.replace(/-/g, "/"))); switch (myDate.getDay()) { case 0: return "星期日"; break; case 1: return "星期一"; break; case 2: return "星期二"; break; case 3: return "星期三"; break; case 4: return "星期四"; break; case 5: return "星期五"; break; case 6: return "星期六"; break; default: break; } } function addDay(DateOne, agreeDays) { var ADDTIME = agreeDays; if (DateOne != null) { var OneMonth = DateOne.substring(5, DateOne.lastIndexOf('-')); var OneMonth1 = Number(OneMonth) - 1; //JS中减去一个月 if (parseInt(OneMonth1) < 10) { OneMonth = '0' + OneMonth1; } else { OneMonth = OneMonth1.toString(); } var OneDay = DateOne.substring(DateOne.length, DateOne.lastIndexOf('-') + 1); var OneYear = DateOne.substring(0, DateOne.indexOf('-')); var dt = new Date(OneYear, OneMonth, OneDay); var dtnow = new Date(dt.getTime() + ADDTIME * 24 * 3600 * 1000); //alert(dt30.toLocaleDateString().replace('年','-').replace('月','-').replace('日','')) var nowYear = dtnow.getFullYear(); var nowMonth = dtnow.getMonth() + 1; var nowDay = dtnow.getDate(); if (parseInt(nowMonth) < 10) { nowMonth = '0' + nowMonth; } if (parseInt(nowDay) < 10) { nowDay = '0' + nowDay; } return (nowYear + "-" + nowMonth + "-" + nowDay); } } //预订按钮点击事件 function CalendarBook(GroupID, TagName, MaxCount) { var alerter = bookingGroup(GroupID, TagName, MaxCount); $("#bookalart").html(alerter); $("#bookalart").css("display", "block"); } function bookingGroup(GroupID, TagName, MaxCount, IsDiscountProduct, ID) { var alerter = ""; var txtMembers = document.getElementsByName(TagName); var Member; var RateObjectID; var BookXML = ""; var IsHaveValue = false; BookXML += "" + GroupID + ""; BookXML += "" + $("#lbproductid").val() + ""; if ($('#lblCrmUserID').length > 0 && $('#lblCrmUserID').html() != "") { BookXML += "" + $('#lblCrmUserID').val() + ""; } if ($('#lblCrmDeptCode').length > 0 && $('#lblCrmDeptCode').html() != "") { BookXML += "" + $('#lblCrmDeptCode').val() + ""; } if ($('#lblCrmMemberID').length > 0 && $('#lblCrmMemberID').html() != "") { BookXML += "" + $('#lblCrmMemberID').val() + ""; } if ($('#lblCrmWorkOrderId').length > 0 && $('#lblCrmWorkOrderId').html() != "") { BookXML += "" + $('#lblCrmWorkOrderId').val() + ""; } var SumCount = 0; for (var i = 0; i < txtMembers.length; i++) { Member = txtMembers[i]; if (Member.value != "") { if (checkNumeric(Member.value)) { RateObjectID = Member.id.split('_')[1]; BookXML += ""; BookXML += "" + RateObjectID + ""; BookXML += "" + Member.value + ""; SumCount += parseInt(Member.value); BookXML += ""; IsHaveValue = true; } else { alerter = "请正确填写出行人数!"; Member.style.cssText = "border: solid 1px red;"; return alerter; } } } if (IsDiscountProduct == "true" && ID != undefined) { BookXML += "" + ID + ""; } BookXML += ""; if (!IsHaveValue || SumCount == 0) { alerter = "请填写出行人数!"; return alerter; } if (SumCount > MaxCount && MaxCount > 0) { //alerter = "目前剩余总名额为" + MaxCount + "人,请您重新填写人数!"; //return alerter; } $("#groupbookhiddenbutton").click(); document.getElementById("bookinginfo").value = escape(BookXML); bookgroup(); //document.getElementById("form1").action = "/DomesticGroup/BookingInput.aspx"; //document.getElementById("form1").submit(); } function ajaxLoading() { var loadingdiv = $("
正在加载数据,请稍后.....
"); $("#bookingselectdiv").before(loadingdiv); } function checkNumeric(s) { var patrn = /^\s*[+-]?[0-9]+\s*$/; if (!patrn.test(s)) { return false; } else return true; } function bookgroup() { //预订按钮点击后变图片 $("#bookalart").html(""); $("#bookalartdate").html(""); $("#bookalartmid").html(""); $(".pop_btn").css("display", "none"); $("#imgwaiting").css("display", "block"); document.getElementById("bookform").action = "http://booking.aoyou.com/" + "Group/Index/" + "1r"; document.getElementById("bookform").submit(); } $.fn.smartFloat = function () { var position = function (element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function () { var scrolls = $(this).scrollTop(); if (scrolls > 300) { if (window.XMLHttpRequest) { element.css({ position: "fixed", top: "0", _top: "0" }); } else { element.css({ top: scrolls }); } } else { element.css({ position: "absolute", top: '0' }); } }); }; return $(this).each(function () { position($(this)); }); }; //产品对比 function removeData(str) { var searchCompare = $.cookie("__search_compare"); if (searchCompare != undefined) { var strJson = eval("({root:[" + str + "]})"); var allJson = eval("({root:[" + searchCompare + "]})"); var removeStr = ""; for (var i = 0; i < allJson.root.length; i++) { if (allJson.root[i].ProductID == strJson.root[0].ProductID) { removeStr = "{'ProductID':'" + allJson.root[i].ProductID + "','Name':'" + allJson.root[i].Name + "','MinPrice':'" + allJson.root[i].MinPrice + "','PicUrl':'" + allJson.root[i].PicUrl + "','ProUrl':'" + allJson.root[i].ProUrl + "'}"; break; } } if (removeStr != "") { searchCompare = searchCompare.replace(removeStr + ",", ""); } $.cookie("__search_compare", searchCompare, { expires: 1, path: "/" }); setCompareData(); } } function setCompareData() { var compareHead = " 产


"; var depro = "
\"产品图片\"" + "{2}" + "关闭
"; var de = "
\"产品图片\"

同时可对比3条产品,您还可以继续添加

"; var compareinfo = ""; var compparenum = 0; var searchCompare = $.cookie("__search_compare"); __compareID = ""; if (searchCompare != undefined) { if (searchCompare != "") { var obj = eval("({compare:[" + searchCompare.substring(0, searchCompare.length - 1) + "]})"); if (obj.compare && obj.compare.length > 0) { $.each(obj.compare, function (i, val) { if (i > 2) { return; } compparenum = i + 1; compareinfo = compareinfo + depro.replace("{0}", val.PicUrl).replace("{1}", val.ProUrl).replace("{2}", val.Name).replace("{3}", val.ProductID).replace("{4}", val.MinPrice).replace("{0}", val.PicUrl).replace("{1}", val.ProUrl).replace("{2}", val.Name); __compareID = __compareID + val.ProductID + ","; }); } } } $("#tianjiaduibi").each(function () { if (searchCompare != null && searchCompare.indexOf($(this).attr("data-compare").split(',')[0]) > -1) { $(this).addClass("nobackImg jiaruBtn").html("√ 已加入"); $(this).hover(function () { if ($(this).hasClass("jiaruBtn")) { $(this).html("- 取消"); } }, function () { if ($(this).hasClass("jiaruBtn")) { $(this).html("√ 已加入"); } }) } else { $(this).removeClass("jiaruBtn nobackImg").html("+ 对比"); } }) if (compparenum < 3) { for (var j = 0; j < 3 - compparenum; j++) { compareinfo = compareinfo + de; } } compareinfo = compareHead + compareinfo + "
开始对比
清空
"; $("#duibi").html(compareinfo); if (compparenum > 0) { $(".aoyouDuibi").show(); } else { $(".aoyouDuibi").hide(); } } //跑马灯 function startmarquee(lh, speed, delay) { var p = false; var t; var o = document.getElementById("enterpriseIntroduce"); o.innerHTML += o.innerHTML; o.style.marginTop = 0; o.onmouseover = function () { p = true; } o.onmouseout = function () { p = false; } function start() { t = setInterval(scrolling, speed); if (!p) o.style.marginTop = parseInt(o.style.marginTop) - 1 + "px"; } function scrolling() { if (parseInt(o.style.marginTop) % lh != 0) { o.style.marginTop = parseInt(o.style.marginTop) - 1 + "px"; if (Math.abs(parseInt(o.style.marginTop)) >= o.scrollHeight / 2) o.style.marginTop = 0; } else { clearInterval(t); setTimeout(start, delay); } } setTimeout(start, delay); } //产品图片轮播 function ImgShuffling() { var imgNo = 0; var shufflingTime = 5000; var shufflingClear; var imgLength = $(".productInfoBox-picShow").children("img").length; if (imgLength > 1) { shufflingClear = setTimeout(ImgShowTime, shufflingTime); } function ImgShow() { $(".productInfoBox-picShow").children("img").hide(); $("#imgShuffling" + imgNo).trigger("appear").show(); $(".productInfoBox-picGetReadyPic").removeClass("productInfoBox-picGetReadyPicHover"); $("#liShuffling" + imgNo).addClass("productInfoBox-picGetReadyPicHover").find("img[data-original]").trigger("appear"); if ($("#liShuffling" + imgNo).attr("source") != undefined && $("#liShuffling" + imgNo).attr("source") != "") { $(".productInfoBoxAuthor").show(); if ($(".productInfoBoxAuthor").html() != ("图片来源:" + $("#liShuffling" + imgNo).attr("source"))) { $(".productInfoBoxAuthor").html("图片来源:" + $("#liShuffling" + imgNo).attr("source")); } } else { $(".productInfoBoxAuthor").hide(); } $(".productInfoBox-picGetReadyPic").hide(); if (imgNo <= 3) { for (var i = 0; i < imgLength; i++) { if (i < 4) { $("#liShuffling" + i).show(); } else { break; } } } else if (imgNo > 3 && imgNo < (imgLength - 4)) { $("#liShuffling" + imgNo).show(); $("#liShuffling" + (imgNo + 1)).show(); $("#liShuffling" + (imgNo + 2)).show(); $("#liShuffling" + (imgNo + 3)).show(); } else if (imgNo >= (imgLength - 4)) { $("#liShuffling" + (imgLength - 4)).show(); $("#liShuffling" + (imgLength - 3)).show(); $("#liShuffling" + (imgLength - 2)).show(); $("#liShuffling" + (imgLength - 1)).show(); } } function ImgShowTime() { imgNo++; if (imgNo >= imgLength) { imgNo = 0; } ImgShow(); shufflingClear = setTimeout(ImgShowTime, shufflingTime); } $(".productInfoBox-picGetReady").children("ul").children("li[class^='productInfoBox-picGetReadyPic']").mouseover(function () { if (imgLength > 1) { clearInterval(shufflingClear); } }).mouseout(function () { if (imgLength > 1) { shufflingClear = setTimeout(ImgShowTime, shufflingTime); } }).click(function () { if (imgLength > 1) { imgNo = $(this).attr("id").replace("liShuffling", ""); ImgShow(); } }); $(".productInfoBox-picGetReady-up").click(function () { imgNo--; if (imgNo < 0) { imgNo = imgLength - 1; } ImgShow(); }).mouseover(function () { if (imgLength > 1) { clearInterval(shufflingClear); } }).mouseout(function () { if (imgLength > 1) { shufflingClear = setTimeout(ImgShowTime, shufflingTime); } }); $(".productInfoBox-picGetReady-down").click(function () { imgNo++; if (imgNo >= imgLength) { imgNo = 0; } ImgShow(); }).mouseover(function () { if (imgLength > 1) { clearInterval(shufflingClear); } }).mouseout(function () { if (imgLength > 1) { shufflingClear = setTimeout(ImgShowTime, shufflingTime); } }); } function setWindowsScroll() { //快捷导航滚动 var wrapper_nav = $(".wrapper_nav").offset().top; var detialXC = 0; if ($(".cpdetail_xcjs_nav") != null && $(".cpdetail_xcjs_nav") != undefined && $(".cpdetail_xcjs_nav").length > 0) { detialXC = $(".cpdetail_xcjs_nav").offset().top - 50; } var hParentLength = $(".cpdetail_tit").length; var hMax = -1; var hNow = -1; $(window).scroll(function () { hParentLength = $(".cpdetail_tit").length; var scrolls = $(this).scrollTop(); if (scrolls >= wrapper_nav) { if (!$(".wrapper_nav").hasClass("wrapper_nav_top")) { $(".cpdetail_khdp").attr("style", "margin-botton:1px;");//解决部分浏览器用户点评和旅游咨询挨着的问题 $(".wrapper_nav").addClass("wrapper_nav_top"); if ($("#hidFirstDepartDate").val() != undefined && $("#hidFirstDepartDate").val() != "1900年01月01日" && $("#hidProductStatus").val() != undefined && $("#hidProductStatus").val() == "30") { $(".wrapper_nav_ydBtn").show(); } } if (hParentLength > 0) { for (var i = 0; i < hParentLength; i++) { if (i + 1 < hParentLength) { if ((scrolls + 70) > $(".cpdetail_tit").eq(i).offset().top && (scrolls + 60) < ($(".cpdetail_tit").eq(i + 1).offset().top)) { hMax = i; } } else if ((scrolls + 70) >= $(".cpdetail_tit").eq(i).offset().top) { hMax = i; } } if (hMax > -1 && hMax != hNow) { hNow = hMax; var hID = $(".cpdetail_tit").eq(hMax).attr("id"); $("a[href='#" + hID + "']").parent("li").parent("ul").children("li").removeClass("now"); $("a[href='#" + hID + "']").parent("li").addClass("now"); $("a[href='#" + hID + "']").parent("li").parent("ul").children("li").children("a").removeClass("ahover"); $("a[href='#" + hID + "']").addClass("ahover"); } } } else { if ($(".wrapper_nav").hasClass("wrapper_nav_top")) { $(".wrapper_nav").removeClass("wrapper_nav_top"); $(".wrapper_nav_list li a").removeClass("ahover").parent("li").removeClass("now"); $(".wrapper_nav_ydBtn").hide(); } } //行程滚动 if (scrolls >= detialXC && detialXC != 0) { if (scrolls > $('.cpdetail_tit_xcjs').offset().top && scrolls < ($('.cpdetail_tit_xcjs').parent(".content-box").height() + $('.cpdetail_tit_xcjs').parent(".content-box").offset().top - $(".cpdetail_xcjs_nav").height())) { if (window.XMLHttpRequest) { $(".cpdetail_xcjs_nav").css({ position: "fixed", top: "60px", _top: "110px" }); for (var i = 0; i < $(".cpdetail_con_dayBox").length; i++) { if (scrolls > ($(".cpdetail_con_dayBox").eq(i).offset().top - 150) && scrolls < ($(".cpdetail_con_dayBox").eq(i).offset().top + $(".cpdetail_con_dayBox").eq(i).height())) { $(".cpdetail_xcjs_nav").children("a").eq(i).addClass("now").siblings("a").removeClass("now"); } } } else { $(".cpdetail_xcjs_nav").css({ top: scrolls + 100 }); for (var i = 0; i < $(".cpdetail_con_dayBox").length; i++) { if (scrolls > ($(".cpdetail_con_dayBox").eq(i).offset().top - 150) && scrolls < ($(".cpdetail_con_dayBox").eq(i).offset().top + $(".cpdetail_con_dayBox").eq(i).height())) { $(".cpdetail_xcjs_nav").children("a").eq(i).addClass("now").siblings("a").removeClass("now"); } } } } else { if ($('.wrapper_nav').hasClass("wrapper_nav_top")) { $(".cpdetail_xcjs_nav").css({ position: "absolute", top: detialXC }); } else { $(".cpdetail_xcjs_nav").css({ position: "absolute", top: detialXC + 50 }); } $(".cpdetail_xcjs_nav").children("a").eq(0).addClass("now").siblings("a").removeClass("now"); } } else { if ($('.wrapper_nav').hasClass("wrapper_nav_top")) { $(".cpdetail_xcjs_nav").css({ position: "absolute", top: detialXC }); } else { $(".cpdetail_xcjs_nav").css({ position: "absolute", top: detialXC + 50 }); } $(".cpdetail_xcjs_nav").children("a").eq(0).addClass("now").siblings("a").removeClass("now"); } }); //锚点滑动 $('a[href*=#]').click(function () { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({ scrollTop: targetOffset - 60 }, 1000); return false; } } }); } //签证相关事件 function VisaFunction() { if ($(".tabs_shenfen") != null && $(".tabs_shenfen") != undefined) { $(".tabs_shenfen").children("li").click(function () { $(".tabs_shenfen").children("li").removeClass("now"); $(this).addClass("now"); $(this).parent(".tabs_shenfen").parent("div").children(".tabs_content").hide(); var visaLength = $(this).parent(".tabs_shenfen").children("li").length; for (var i = 0; i < visaLength; i++) { if ($(this).parent(".tabs_shenfen").children("li").eq(i).html() == $(this).html()) { $(this).parent(".tabs_shenfen").parent("div").children(".tabs_content").eq(i).show(); break; } } }); $(".unfold_span").click(function () { $(this).parent("div").find(".unfold_cont").slideDown(); $(this).hide(); $(this).siblings(".fold_span").show(); }); $(".fold_span").click(function () { $(this).parent().find(".unfold_cont").slideUp(); $(this).hide(); $(this).siblings(".unfold_span").show(); }); } } //出发城市相关 function DepartCityFuction() { //出发城市 if ($(".des-p-city").parents("div[id='cityDIV']").children(".des-p-city-list").children("span").children("a").length > 0) { $(".des-p-city").parents("div[id='cityDIV']").mouseover(function () { $(this).children(".des-p-city").addClass("hover"); $(".des-p-city-list").show(); }).mouseout(function () { $(this).children(".des-p-city").removeClass("hover"); $(".des-p-city-list").hide(); }); } } //二维码扫码相关 function MM_over(mmObj) { var mSubObj = mmObj.getElementsByTagName("div")[0]; mSubObj.style.display = "block"; } function MM_out(mmObj) { var mSubObj = mmObj.getElementsByTagName("div")[0]; mSubObj.style.display = "none"; } //产品详情页售罄跳转 function sellout() { if ($(".pop_out").length > 0) { $(".pop_out").removeClass("hidden"); var labletest = $(".breadcrumb").find("li:last").html().replace("参团度假", ""); if (labletest != "" && typeof (ProductLables) != "undefined") { $.each(ProductLables, function (i, lab) { if (lab.cname == labletest) { $(".sq_btn").attr("href", "http://www.aoyou.com/search/b0-l" + lab.cid + "/"); return false; } else { $(".sq_btn").attr("href", "http://www.aoyou.com/search/b0/"); } }); } else { $(".sq_btn").attr("href", "http://www.aoyou.com/search/b0/"); } } } function closelable() { $(".pop_out").addClass("hidden"); } window.onload = function () { if (!$(".pop_out").hasClass('hidden')) { setTimeout(function () { window.location.href = $(".sq_btn").attr("href"); }, 3000); } };