// JavaScript Document $(document).ready(function(e) { //gotop(); }); $(function(){ //用于游船首页效果 //切换航线图触发事件 $(".pageNav li").css("cursor","pointer"); $(".pageNav li").click(function(){ $(".pageNav li").removeClass("active"); $(this).addClass("active"); var _split = $(this).attr("id").split("-"); var txt = "Cruses Line: "+_split[0]+" > "+_split[1]+" ("+_split[2]+" stream, "+_split[3]+" days)"; $(".cruiseInfoDetail-Txt").html(txt); $("#ShowMap").attr("src","/image/cruise/cruise-map/"+_split[0]+"-"+_split[1]+"-b.jpg").attr("alt",""+_split[2]+"strream: "+_split[0]+" > "+_split[1]+""); //调AJAX获得游船推荐列表 $.post("/include/ajax.asp", {strtemp:"cruise-comm-list",v:$(this).attr("id")}, function(data){$("#cruiseInfoDetail .searchResults").remove(); $(".cruise-comm-list").after(data);}); }); //用于游船首页效果 //预定列表价格赋值操作 $("a[id=nStep]").click(function(){ var nHref = $(this).attr("href"); if($("input[name=RooRadio]:checked").val() != null) { var arr_tmp = $("input[name=RooRadio]:checked").val().split("_"); } else { var choseprice = jsLanguageTag('choseprice'); alert(choseprice); return false; } nHref = nHref.replace("price=","price="+arr_tmp[0]); nHref = nHref.replace("depdate=","depdate="+arr_tmp[1]); nHref = nHref.replace("arrdate=","arrdate="+arr_tmp[2]); nHref = nHref.replace("roomtype=","roomtype="+arr_tmp[3]); $(this).attr("href",nHref); }); //搜索列表进行筛选操作 $("#sortType").change(function() { $("#TmpsortType").val($(this).val()); $("form[name=cruisesearchpanelform]").submit(); }); //游船比对操作 $("input[name=cCRI_SN]").next("a").click(function() { if($("input[name=cCRI_SN]:checked").length <= 1) { alert('err:less than 2');return false; } var cCRI_SN_split = "" ; //cCRI_SN_split 取得航期ID $("input[name=cCRI_SN]:checked").each(function(){ cCRI_SN_split = cCRI_SN_split + $(this).val() + "," }); location.href = "/yangtzecruise/compare-cruise.asp?cruiseid="+cCRI_SN_split }); //淡旺季价格变换操作 $("input[name=Direction]").click(function(){ $(".table-hide").css("display","none"); //$("#"+$(this).val()).css("display",""); $("#"+$(this).attr("value")).css("display","block"); }); //游船随航线变换操作 $("#fromto").change(function(){ var cfrom = $(this).val().split("-")[0]; var cto = $(this).val().split("-")[1]; var ajax_PublicFile="/include/ajax.asp"; $.post(ajax_PublicFile, {strtemp:"change-cruise-option",cfrom:cfrom,cto:cto}, function(data){ // alert(data);return false; $("#shipname").children().remove(); var arri = new Array(); arri = data.split(","); $.each(arri,function(arriIndexOf,arriValue){ if(arriValue != "") { var objOption = $("").val(arriValue).text(arriValue); $("#shipname").prepend(objOption); } }); }); }); //大航期表月份年份切换(链接按钮方式) $("#calendar_nav a").click(function(){ var indexMonthVal = $("#intMonth option:selected").val(); var indexYearVal = $("#intYear option:selected").val(); if($(this).attr("id") == "date-turn-right") { if(indexMonthVal == 12) { $("#intMonth option[value='1']").attr("selected","selected"); $("#intYear option[value='"+(parseInt(indexYearVal) + 1)+"']").attr("selected","selected"); } else { $("#intMonth option[value='"+(parseInt(indexMonthVal) + 1)+"']").attr("selected","selected"); } } else { if(indexMonthVal == 1) { $("#intMonth option[value='12']").attr("selected","selected"); $("#intYear option[value='"+(parseInt(indexYearVal) - 1)+"']").attr("selected","selected"); } else { $("#intMonth option[value='"+(parseInt(indexMonthVal) - 1)+"']").attr("selected","selected"); } } }); $("select[name=PriceRow]").change(function(){ var PriceRow = $(this).val(); if(PriceRow == 0) { $("#"+$(this).parents("table").attr("id")+" .js_row").show(); return; } var ii = 0; $.each($("#"+$(this).parents("table").attr("id")+" .js_row"),function(){ if(ii > PriceRow) { $(this).hide(); } else { $(this).show(); } ii += 1 }); }); $("a[id=js_more_cruiseprice]").click(function(){ var print_PublicFile="/include/cruise-price-window.asp?cruiseship="; ShowIFrame('',print_PublicFile+$(this).attr("name"),750,510,'bottom') }); }); function turnRow(o){ PriceRow = $(o).val(); if(PriceRow == 0) { $(".js_row").show(); return; } var ii = 0; $(".js_row").each(function(index, element) { ii += 1 if(ii > PriceRow) { $(this).hide(); } else { $(this).show(); } }); } //判断email合法 var CheckEmailFormat = function(strEmail) { var pattern1 = /^(([\u4E00-\u9FA5]|[\uFE30-\uFEFF]|[\d]|[a-zA-Z]|[\_\-\.])+[\@])(((([\d]|[a-zA-Z]|[\_\-]|[\[\]\{\}\>\<])+[\.])+)([\d]|[a-zA-Z\_\-])+)$/; if(!strEmail.match(pattern1)) { return false; } return true; } function getNStep(){ if($("input[name=RooRadio]:checked").val() != null) { var arr_tmp = $("input[name=RooRadio]:checked").val().split("_"); } else { var choseprice = "You have to select a price to continue."; alert(choseprice); return false; } $("#cruiseExForm input[name=price]").val(arr_tmp[0].replace(',','')); $("#cruiseExForm input[name=depdate]").val(arr_tmp[1]); $("#cruiseExForm input[name=arrdate]").val(arr_tmp[2]); $("#cruiseExForm input[name=roomtype]").val(arr_tmp[3]); $('#cruiseExForm input[name="productsn"]').val(arr_tmp[4]); $('#cruiseExForm input[name="whereFrom"]').val(arr_tmp[5]); $('#cruiseExForm input[name="whereTo"]').val(arr_tmp[6]); $('#cruiseExForm input[name="star"]').val(arr_tmp[7]); return true; } function getCruiseNStep(){ var arr_tmp = $("input[name=RooRadio]:checked").val().split("_"); $("#cruiseExForm input[name=price]").val(arr_tmp[0].replace(',','')); $("#cruiseExForm input[name=depdate]").val(arr_tmp[1]); $("#cruiseExForm input[name=arrdate]").val(arr_tmp[2]); $("#cruiseExForm input[name=roomtype]").val(arr_tmp[3]); $('#cruiseExForm input[name="productsn"]').val(arr_tmp[4]); $('#cruiseExForm input[name="whereFrom"]').val(arr_tmp[5]); $('#cruiseExForm input[name="whereTo"]').val(arr_tmp[6]); $('#cruiseExForm input[name="star"]').val(arr_tmp[7]); return true; } function getCruisedateNStep(str){ var arr_tmp = str.split("_"); //console.log(arr_tmp); $("#cruiseExForm input[name=price]").val(arr_tmp[0].replace(',','')); $("#cruiseExForm input[name=depdate]").val(arr_tmp[1]); $("#cruiseExForm input[name=arrdate]").val(arr_tmp[2]); $("#cruiseExForm input[name=roomtype]").val(arr_tmp[3]); $('#cruiseExForm input[name="productsn"]').val(arr_tmp[4]); $('#cruiseExForm input[name="whereFrom"]').val(arr_tmp[5]); $('#cruiseExForm input[name="whereTo"]').val(arr_tmp[6]); $('#cruiseExForm input[name="star"]').val(arr_tmp[7]); return true; } //goTop function gotop() { var $backToTopEle = $('
').appendTo($("body")).click(function() { $("html, body").animate({ scrollTop: 0 }, 120); }), $backToTopFun = function() { var st = $(document).scrollTop(), winh = $(window).height(); (st > 0)? $backToTopEle.show(): $backToTopEle.hide(); //IE6下的定位 if (!window.XMLHttpRequest) { $backToTopEle.css("top", st + winh - 166); } }; $(window).bind("scroll", $backToTopFun); $(function() { $backToTopFun(); }); } //get window width //Cruise date var winWidth = 0; $(function(){ if (window.innerWidth){ winWidth = window.innerWidth; }else if ((document.body) && (document.body.clientWidth)){ winWidth = document.body.clientWidth; }else if (document.documentElement && document.documentElement.clientWidth) { winWidth = document.documentElement.clientWidth; } w2Width = parseInt(winWidth/2); }); ca = 1; function displayCruiseInfo(o,s){ var oleft = $(o).offset().left; if(oleft