var settimeout = null; function convert_url(s) { return s.replace(/http:\/\/www\.tudou\.com\/programs\/view\/([\w\-]+)\/?/i, "http://www.tudou.com/v/$1") .replace(/http:\/\/www\.youtube\.com\/watch\?v=([\w\-]+)/i, "http://www.youtube.com/v/$1") .replace(/http:\/\/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/i, "http://static.youku.com/v1.0.0149/v/swf/loader.swf?VideoIDS=$1&winType=adshow&isAutoPlay=false") .replace(/http:\/\/www\.56\.com\/u\d+\/v_([\w\-]+)\.html/i, "http://player.56.com/v_$1.swf") .replace(/http:\/\/www.56.com\/w\d+\/play_album\-aid\-\d+_vid\-([^.]+)\.html/i, "http://player.56.com/v_$1.swf") .replace(/http:\/\/v\.ku6\.com\/.+\/([^.]+)\.html/i, "http://player.ku6.com/refer/$1/v.swf") .replace(/http:\/\/v\.qq\.com\/boke\/page\/f\/c\/l\/([\w\-=]+)\.html/i, "http://static.video.qq.com/TPout.swf?vid=$1&auto=1") .replace(/http:\/\/www\.iqiyi\.com\/v_([\w\-=]+)\.html/i, "http: //player.video.qiyi.com/0fe40d267bf44a8fe90dd6a7e031b70f/0/0/v_$1.swf-albumId=333504600-tvId=333504600-isPurchase=0-cnId=7"); } /** * 根据url生成视频预览 * @param url */ var showcoke = 0; function createPreviewVideo(url,iw,ih) { if (!url) return; url = convert_url(url); $("#player").html(''); } function setCookie(name, value) //cookies设置 { var argv = setCookie.arguments; var argc = setCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; if (expires != null) { var LargeExpDate = new Date(); LargeExpDate.setTime(LargeExpDate.getTime() + (expires * 1000 * 3600 * 24)); } document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + LargeExpDate.toGMTString())); } function getCookie(Name) //cookies读取 { var search = Name + "=" if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset) if (end == -1) end = document.cookie.length return unescape(document.cookie.substring(offset, end)) } else return "" } } function showsearchwords() { // var $searchForm = $(".search"); //$searchForm.append($('

购物车中还没有商品,赶紧选购吧!
'; } } else { stru = '读取数据出错...
'; } $(".ShoppCartbox").html(stru); }); } } function showqiandao(e, t) { clearInterval(settimeout); if ($(".ShoppCartbox").is(":hidden")) { $('.ShoppCartbox').removeClass("hide"); var stru = '
今日还没有签到的人,赶紧去 签到 吧!
'; } } else { stru = '读取数据出错...
'; } $(".ShoppCartbox").html(stru); }); } } function hidecart(e, t) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { clearInterval(settimeout); settimeout = setInterval(function () { $(".ShoppCartbox").hide("300"); }, 300); } } function onnewsmenu(t) { $(".newsbox h3 a.hover").removeClass("hover"); $(".newsbox h3 a#newsmenu" + t).addClass("hover"); $(".newsbox ul").hide(); $(".newsbox ul#newsbox" + t).show(); } function showcategory() { clearInterval(settimeout); if (isCategory == 0) { if ($(".nav-category-section").is(":hidden")) { $(".nav-category-section").show("300"); $(".nav-category-abnt .iconfont").html(""); } } } function hidecategory(e, t) { if (isCategory == 0) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { if ($(".nav-category-section").is(":visible")) { clearInterval(settimeout); settimeout = setInterval(function () { $(".nav-category-section").hide("300"); $(".nav-category-abnt .iconfont").html(""); }, 100); } } } } function showcategory2(id) { $(".nav-category-list li div").hide(); $(".nav-category-list li div#classbox" + id).show(); $(".nav-category-list li span.hover").removeClass("hover"); $(".nav-category-list li span#classtitle" + id).addClass("hover"); } function hidecategory2(e, t, id) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { $(".nav-category-list li div#classbox" + id).hide(); $(".nav-category-list li span#classtitle" + id).removeClass("hover"); } } function hideselectprovince(e, t) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { $("#provincebox").hide("300"); } } function onprovince(ProvinceID, ProvinceName, YFmoney) { $("#cityselbox").show(); $("#provinceselbox").hide(); $("#countyselbox").hide(); $("#provincebox dl dt.selected").removeClass("selected"); $("#provincebox dl dt#citytitle").addClass("selected"); $("#provincebox dl dt#provincetitle span").html(ProvinceName); $("#hidprovince").val(ProvinceID); setCookie("province", ProvinceID + "|" + ProvinceName + "|" + YFmoney); if (showcoke == 0) { setCookie("city", "0"); setCookie("county", "0"); } $("#hidprovincetit").val(ProvinceName); $("#selecttoptitle").html(ProvinceName); $("#hidcity").val("0"); $("#hidcounty").val("0"); if ($("#yunfeibox").html() == "") { $("#yunfeibox").html("运费:¥" + YFmoney + ""); } var cid = $("#hidcity").val(); $.post("/Ajax.ashx", { action: 'GetCity2', ProvinceID: ProvinceID, cityIDs: cid }, function (data) { if (data != 'false') { $('#cityselbox').html(data); } }); } function oncity(CityID, CityName) { $("#countyselbox").show(); $("#provinceselbox").hide(); $("#cityselbox").hide(); $("#provincebox dl dt.selected").removeClass("selected"); $("#provincebox dl dt#countytitle").addClass("selected"); $("#provincebox dl dt#citytitle span").html(CityName.substring(0, 4)); $("#hidcity").val(CityID); $("#hidcitytit").val(CityName); $("#hidcounty").val("0"); setCookie("city", CityID + "|" + CityName); if (showcoke == 0) { setCookie("county", "0"); } var ss = $("#hidprovincetit").val(); $("#selecttoptitle").html(ss + (CityName == "市辖区" || CityName == "县" ? "" : CityName)); var qid = $("#hidcounty").val(); $.post("/Ajax.ashx", { action: 'GetCounty2', CityID: CityID, countyIDs: qid }, function (data) { if (data != 'false') { $('#countyselbox').html(data); } }); } function oncounty(CountyID, CountyName) { $("#provincebox").hide(300); $("#provincebox dl dt#countytitle span").html(CountyName.substring(0, 4)); $("#hidcounty").val(CountyID); $("#hidcountytit").val(CountyName); setCookie("county", CountyID + "|" + CountyName); var ss = $("#hidprovincetit").val(); var sss = $("#hidcitytit").val(); sss = (sss == "市辖区" || sss == "县" ? "" : sss) $("#selecttoptitle").html(ss + sss + CountyName); } function showviewprovince(p) { $("#provincebox dl dt.selected").removeClass("selected"); $("#provincebox dl dt#" + p + "title").addClass("selected"); $("#provincebox ul").hide(); $("#provincebox ul#" + p + "selbox").show(); } function onshowqg(a, b, c) { var al = $("#" + a + " li"); if (a == "board-list2") { $("#board-list li div").hide(); $(".scrollsidebar").css("top", "-200px"); } else { $(".scrollsidebar").css("top", "0px"); } for (var j = 0; j < al.length; j++) { if (j == c) { $(al[j]).find(" div").fadeIn("300"); $(al[j]).find("span .iconfont").html(""); $(al[j]).find("span").addClass("hover"); } else { $(al[j]).find(" div").hide(); $(al[j]).find("span .iconfont").html(""); $(al[j]).find("span").removeClass("hover"); } } } function showmenus(k) { clearInterval(settimeout); $(".menus li.select em").empty(); $(".menus li").removeClass("select"); $(".menus li .menusbox").hide(); if ($("#soumenus" + k).is(":hidden")) { if ($(".menus li#menussp" + k).length > 0) { $(".menus li#menussp" + k).addClass("select"); $(".menus li#menussp" + k).append(""); } var menusbox = $("#soumenus" + k); menusbox.fadeIn("300"); } } function hidemenus(k, e, t) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { clearInterval(settimeout); settimeout = setInterval(function () { $("#soumenus" + k).hide(); if ($(".menus li#menussp" + k).length > 0) { $(".menus li#menussp" + k).removeClass("select"); $(".menus li#menussp" + k + " em").empty(); } }, 100); } } function showmodulemenus(k) { clearInterval(settimeout); var menusbox = $(".mobilemenus ul li div"); for (var i = 0; i < menusbox.length; i++) { if ($(menusbox[i]).length > 0) { if (i == k) { $(menusbox[i]).fadeIn("300"); } else { $(menusbox[i]).hide(); } } } } function hidemodulemenus(k, e, t) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { clearInterval(settimeout); settimeout = setInterval(function () { $("#modulemenus" + k + " div").hide("300"); }, 300); } } function showemenus(k) { clearInterval(settimeout); var width = parseInt($(document).width()); if (width > 620) { $(".emenusbox").hide() $("#souemenus" + k).fadeIn("300"); } } function hideemenus(k, e, t) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { clearInterval(settimeout); settimeout = setInterval(function () { $("#souemenus" + k).hide("300"); }, 300); } } function showhyjiage() { clearInterval(settimeout); if ($(".hyjiagebox").css("display") == "none") { $(".hyjiagebox").fadeIn("300"); } } function hidehyjiage(e, t) { var s; if (e.toElement) { s = e.toElement; } else if (e.fromElement) { s = e.fromElement; } else if (e.relatedTarget) { s = e.relatedTarget; } if (!t.contains(s)) { settimeout = setInterval(function () { $(".hyjiagebox").hide("300"); }, 300); } } function taocaocheck(id) { if (typeof ($("#taocao_check_" + id + " .checked input").attr("checked")) != "undefined") { alert("选择成功"); } else { alert("取消成功"); } } function showtaocao(id) { $(".taocaobox ul li a").removeClass("hover"); $(".taocaobox ul li a#taocaoa" + id).addClass("hover"); $(".taocaobox dl").hide(); $(".taocaobox dl#taocao_check_" + id).show(); } function addcart(id) { var bb = true; var selcolor = ""; if ($("#IFSelColor").length > 0) { if ($("#IFSelColor").val() == "") { bb = false; alert("请选择颜色"); } else { selcolor = $("#IFSelColor").val(); } } /*if (bb) { if ($("#hidprovince").val() == "" || $("#hidprovince").val() == "0") { bb = false; $("#provincebox").show(); alert("请选择省份"); } } if (bb) { if ($("#hidcity").val() == "" || $("#hidcity").val() == "0") { bb = false; $("#provincebox").show(); alert("请选择城市"); } } if (bb) { if ($("#hidcounty").val() == "" || $("#hidcounty").val() == "0") { bb = false; $("#provincebox").show(); alert("请选择地区"); } }*/ if (bb) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addcart", id: id, selcolor: (selcolor == "" ? "" : escape(selcolor)) }, function (data) { if (data.success) { alert(data.msg); } else { alert(data.msg); } }); } } function addcart2(id) { var bb = true; var selcolor = ""; if ($("#IFSelColor").length > 0) { if ($("#IFSelColor").val() == "") { bb = false; alert("请选择颜色"); } else { selcolor = $("#IFSelColor").val(); } } if (bb) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addcart", id: id, selcolor: (selcolor == "" ? "" : escape(selcolor)) }, function (data) { if (data.success) { location.href = "/Sell/myShoppingCart.aspx"; } else { alert(data.msg); } }); } } function addcart3(id) { var bb = true; var selcolor = ""; if ($("#IFSelColor").length > 0) { if ($("#IFSelColor").val() == "") { bb = false; alert("请选择颜色"); } else { selcolor = $("#IFSelColor").val(); } } if (bb) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addcart2", id: id, selcolor: (selcolor == "" ? "" : escape(selcolor)) }, function (data) { if (data.success) { alert("兑换成功"); location.href = "/Member_Orders_List.aspx"; } else { alert(data.msg); } }); } } function addcart4(id) { var bb = true; var selcolor = ""; if ($("#IFSelColor").length > 0) { if ($("#IFSelColor").val() == "") { bb = false; alert("请选择颜色"); } else { selcolor = $("#IFSelColor").val(); } } if (bb) { location.href = "/Sell/UserQRGM.aspx?id=" + id; } } function addtaocaocart(id) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addcart", id: id, selcolor: "" }, function (data) { if (data.success) { location.href = "/Sell/myShoppingCart.aspx"; } else { alert(data.msg); } }); } function addfavorite(id) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addfavorite", id: id }, function (data) { if (data.success) { if ($("#showfavorite_" + id).length > 0) { $("#showfavorite_" + id).html((parseInt($("#showfavorite_" + id).html())+1)); } alert(data.msg); } else { alert(data.msg); } }); } function addguangzhu(id) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addfavorite", id: id }, function (data) { if (data.success) { if ($("#guangzhu" + id).length > 0) { $("#guangzhu" + id).html((parseInt($("#guangzhu" + id).html()) + 1)); } alert(data.msg); } else { alert(data.msg); } }); } function addxihuan(id) { $.getJSON("/Ajax.ashx?t=" + Math.random(), { action: "addxihuan", id: id }, function (data) { if (data.success) { if ($("#xihuan" + id).length > 0) { $("#xihuan" + id).html((parseInt($("#xihuan" + id).html()) + 1)); } alert(data.msg); } else { alert(data.msg); } }); } function search() { if ($("#keyword").val() == "") { return false; $("#keyword").focus(); } else { return true; } } var $list, $btnPrev, $btnNext, itemWidth, itemHeight, itemPerSlide, countPage, curIndex = 0, timeoutAuto=null; function slideList(targetPage) { var offsetX = "-" + (targetPage * itemWidth * itemPerSlide) + "px"; $list.animate({ "margin-left": offsetX }, 500); //alert(targetPage + "|" + itemWidth + "|" + itemPerSlide); if (targetPage > 0) { if ((countPage - 1) > targetPage) { $btnPrev.removeClass("page-btn-prev-disabled"); $btnNext.removeClass("page-btn-next-disabled"); } else if (targetPage == countPage - 1) { $btnPrev.removeClass("page-btn-prev-disabled"); $btnNext.addClass("page-btn-next-disabled"); } } else { $btnPrev.addClass("page-btn-prev-disabled"); $btnNext.removeClass("page-btn-next-disabled"); } } function autoPlay() { clearInterval(timeoutAuto); timeoutAuto = setInterval(function () { curIndex += 1, curIndex > countPage - 1 && (curIndex = 0), slideList(curIndex) },10000); } function btnPrev() { if(0 < curIndex){ curIndex -= 1; clearInterval(timeoutAuto); slideList(curIndex); } } function btnNext() { if(curIndex < countPage - 1){ curIndex += 1; clearInterval(timeoutAuto); slideList(curIndex); } } var imgPerSlide = 4, listnum = 0, imgpages = 0, curimgpage = 0; function checkimgpage() { listnum = $(".img_list ul li").length; var rslt = listnum / imgPerSlide; //除 imgpages = Math.ceil(rslt); //返回值为大于等于其数字参数的最小整数。 if (imgpages == 1) { $(".a_down").addClass("a_down_disable"); $(".a_up").addClass("a_up_disable"); } else { var imgleft = curimgpage * (91 * 4 + 48); $(".img_list ul").animate({ left: -imgleft + "px" }, 1000); if (curimgpage == imgpages-1) { $(".a_down").addClass("a_down_disable"); } else { $(".a_down").removeClass("a_down_disable"); } if (curimgpage <= 0) { $(".a_up").addClass("a_up_disable"); } else { $(".a_up").removeClass("a_up_disable"); } var curshowimg = (curimgpage * 4 + 1); selimg(curshowimg); } } function selimg(j) { var img_list = $(".img_list ul li"); for (var i = 0; i < img_list.length; i++) { if (i == (j - 1)) { $("#productImg").attr("src", $(img_list[i]).find("img").attr("simg")); $("#productImgA").attr("href", $(img_list[i]).find("img").attr("ssimg")); $(".img_list ul li.select em").empty(); $(".img_list ul li.select").removeClass("select"); $(img_list[i]).append(""); $(img_list[i]).addClass("select"); } } } function selcolor(c, j) { //$("#productImg").attr("src", "/images/ajaxLoader.gif"); $("#IFSelColor").val(c); $(".colorbox.selected em").empty(); $(".colorbox.selected").removeClass("selected"); $(".colorbox#colorbox" + j).append(""); $(".colorbox#colorbox" + j).addClass("selected"); var aimgs = strlistimages.split("|"); var listimgs = ""; var k = 0; for (var i = 0; i < aimgs.length; i++) { var simg = aimgs[i].split(","); if (simg.length == 4) { if (simg[3] == c) { listimgs += "