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(""); $(".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 = "同时可对比3条产品,您还可以继续添加