Files

1381 lines
53 KiB
JavaScript
Raw Permalink Normal View History

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('<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
' src="' + url + '"' +
' width="' + iw + '"' +
' height="' + ih + '"' +
' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" ></embed>');
}
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($('<div id="J_keywordList" class="keyword-list hide"><ul class="result-list">'));
var searchConfig = $("#keyword").attr("data-search-config").split(",");
var listHtml=""
for (var i = 0; i < searchConfig.length; i++) {
listHtml += "<li><a href=\"/search.html?keyword=" + searchConfig[i] + "\">" + searchConfig[i] + "</a></li>";
}
$("#J_keywordList").removeClass("hide").children(".result-list").html(listHtml);
$(".hot-words").hide();
}
function showsearchwords2() {
var listHtml = ""
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "GetKeywords", keyword: escape($("#keyword").val()) },
function (data) {
if (data.success) {
var dtconut = data.total;
for (var i = 0; i < dtconut; i++) {
listHtml += "<li><a href=\"/search.html?keyword=" + data.items[i].P_NAME + "\">" + data.items[i].P_NAME + "</a></li>";
}
$("#J_keywordList").removeClass("hide").children(".result-list").html(listHtml)
$(".hot-words").hide();
} else {
//alert(data.msg);
}
});
}
function showmp3() {
$(".mp3box").addClass("mp3");
}
function hidemp3() {
$(".mp3box").removeClass("mp3");
}
function showcart(e, t) {
clearInterval(settimeout);
if ($(".ShoppCartbox").is(":hidden")) {
$('.ShoppCartbox').show("300");
var stru = '<p class="loading"><img src="/images/ajaxLoader.gif"/></p>';
$(".ShoppCartbox").html(stru);
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "GetCartNum" },
function (data) {
if (data.success) {
if (data.TotalNum > 0) {
stru = '<div class="count clearfix"><span class="total">共计 <em>' + data.TotalNum + "</em> 件商品<strong>合计:<em>" + data.TotalMoney + '元</em></strong></span><a href="/Sell/myShoppingCart.aspx" class="btn btn-primary">去购物车结算</a></div>';
} else {
stru = '<p class="loading" style=" line-height:95px;">购物车中还没有商品,赶紧选购吧!</p>';
}
} else {
stru = '<p class="loading" style=" line-height:95px;">读取数据出错...</p>';
}
$(".ShoppCartbox").html(stru);
});
}
}
function showqiandao(e, t) {
clearInterval(settimeout);
if ($(".ShoppCartbox").is(":hidden")) {
$('.ShoppCartbox').removeClass("hide");
var stru = '<p class="loading"><img src="/images/ajaxLoader.gif"/></p>';
$(".ShoppCartbox").html(stru);
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "GetqiandaoNum" },
function (data) {
if (data.success) {
if (data.TotalNum > 0) {
stru = '<div class="count clearfix"><span class="total">今日总共签到 <em>' + data.TotalNum + '</em> 人次</span><a href="/bbs/qiandao.aspx" class="btn btn-primary">我要去签到</a></div>';
} else {
stru = '<p class="loading" style=" line-height:95px;">今日还没有签到的人,赶紧去&nbsp;<a href="/bbs/qiandao.aspx">签到</a>&nbsp;吧!</p>';
}
} else {
stru = '<p class="loading" style=" line-height:95px;">读取数据出错...</p>';
}
$(".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("&#xe606;");
}
}
}
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("&#xe608;");
}, 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("运费:<span class=\"red\">¥" + YFmoney + "</span>");
}
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("&#xe608;");
$(al[j]).find("span").addClass("hover");
} else {
$(al[j]).find(" div").hide();
$(al[j]).find("span .iconfont").html("&#xe606;");
$(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("<em></em>");
}
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("<em></em>");
$(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("<em></em>");
$(".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 += "<li onmouseover='showmaxpic(this)'" + (k == 0 ? " class='select'" : "") + ">" + (k == 0 ? "<em></em>" : "") + "<img src='" + simg[0] + "' simg='" + simg[1] + "' ssimg='" + simg[2] + "'/></li>";
if (k == 0) {
$("#productImg").attr("src", simg[1]);
$("#productImgA").attr("href", simg[2]);
}
k += 1;
}
}
}
$(".img_list ul").html(listimgs);
$(".img_list ul").css("left", "0px");
curimgpage = 0;
checkimgpage();
}
function showmaxpic(id) {
//$("#productImg").attr("src", "/images/ajaxLoader.gif");
var max428pic = $(id).find("img").attr("simg");
var maxpic = $(id).find("img").attr("ssimg");
$(".img_list ul li.select em").empty();
$(".img_list ul li.select").removeClass("select");
$(id).append("<em></em>");
$(id).addClass("select");
$("#productImg").attr("src", max428pic);
$("#productImgA").attr("href", maxpic);
}
function showscrollhover(a,h) {
if (a == "loga") {
$("#scroll .serverhover").hide();
}
if (a == "servera") {
$("#scroll .loghover").hide();
}
h.show();
}
function hidescrollhover(e, t, a, h) {
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)) {
h.hide();
}
}
function showScroll() {
var w = parseInt($(this).width());
$(window).scroll(function () {
var scrollValue = $(window).scrollTop();
var scrollBottom = $(document).height() - $(window).height() - $(window).scrollTop();
if (scrollValue > 200) {
$(".addbtn").addClass("scrolladdbtn");
$(".scroll .cartbox").show();
} else {
$(".addbtn").removeClass("scrolladdbtn");
$(".scroll .cartbox").hide();
}
if (scrollValue > 900) {
if (w > 1260) {
if ($(".tit_tab_box").length > 0) {
$(".tit_tab_box").addClass("scrolltabbox");
$(".addcardbox").show();
$(".product_leftmenu").addClass("scrollmenu");
}
}
} else {
if (w > 1260) {
if ($(".tit_tab_box").length > 0) {
$(".tit_tab_box").removeClass("scrolltabbox");
$(".addcardbox").hide();
$(".product_leftmenu").removeClass("scrollmenu");
}
}
}
if (w > 800) {
if (scrollValue > 1100 && scrollBottom > 200) {
$("#sidebarbox").addClass("scrollsidebar");
} else {
$("#sidebarbox").removeClass("scrollsidebar");
}
/*if (scrollValue > 300 && scrollBottom > 100) {
$("#left-board-section").addClass("scrollsidebar");
} else {
$("#left-board-section").removeClass("scrollsidebar");
}*/
}
});
$("#topbox .topa").click(function () {
$("html,body").animate({ scrollTop: 0 }, 1000);
});
}
function picfocus() {
var sWidth = $("#picfocus").width(); //获取焦点图的宽度(显示面积)
var len = $("#picfocus ul li").length; //获取焦点图个数
var index = 0;
var picTimer;
//以下代码添加数字按钮和按钮后的半透明条,还有上一页、下一页两个按钮
var btn = ""; //<div class='focusBg'></div><div class='focusbtn'>
/*for (var i = 0; i < len; i++) {
btn += "<span></span>";
}*/
btn += "<div class='preNext pre'></div><div class='preNext next'></div>"; //</div>
$("#picfocus").append(btn);
//为小按钮添加鼠标滑入事件,以显示相应的内容
/*$("#picfocus .focusbtn span").css("opacity", 0.4).mouseover(function () {
index = $("#picfocus .focusbtn span").index(this);
showPics(index);
}).eq(0).trigger("mouseover");*/
//上一页、下一页按钮透明度处理
$("#picfocus .preNext").css("opacity", 0.2).hover(function () {
$(this).stop(true, false).animate({ "opacity": "0.5" }, 300);
}, function () {
$(this).stop(true, false).animate({ "opacity": "0.2" }, 300);
});
//上一页按钮
$("#picfocus .pre").click(function () {
index -= 1;
if (index == -1) { index = len - 1; }
showPics(index);
});
//下一页按钮
$("#picfocus .next").click(function () {
index += 1;
if (index == len) { index = 0; }
showPics(index);
});
//本例为左右滚动即所有li元素都是在同一排向左浮动所以这里需要计算出外围ul元素的宽度
$("#picfocus ul").css("width", sWidth * (len));
//鼠标滑上焦点图时停止自动播放,滑出时开始自动播放
$("#picfocus").hover(function () {
clearInterval(picTimer);
}, function () {
picTimer = setInterval(function () {
showPics(index);
index++;
if (index == len) { index = 0; }
}, 4000); //此4000代表自动播放的间隔单位毫秒
}).trigger("mouseleave");
//显示图片函数根据接收的index值显示相应的内容
function showPics(index) { //普通切换
$(window).resize(function () {
sWidth = $("#picfocus").width();
});
var nowLeft = -index * sWidth; //根据index值计算ul元素的left值
$("#picfocus ul").stop(true, false).animate({ "left": nowLeft }, 300); //通过animate()调整ul元素滚动到计算出的position
//$("#picfocus .btn span").removeClass("on").eq(index).addClass("on"); //为当前的按钮切换到选中的效果
//$("#picfocus .focusbtn span").stop(true, false).animate({ "opacity": "0.4" }, 300).eq(index).stop(true, false).animate({ "opacity": "1" }, 300); //为当前的按钮切换到选中的效果
}
}
$(document).ready(function () {
if ($(".img_list ul li").length > 0) {
checkimgpage();
$(".a_down").click(function () {
if (curimgpage < imgpages) {
curimgpage += 1;
}
checkimgpage();
});
$(".a_up").click(function () {
if (curimgpage > 0) {
curimgpage -= 1;
}
checkimgpage();
});
$(".a_down").mouseover(function () { $(this).addClass("a_down_hover"); });
$(".a_down").mouseout(function () { $(this).removeClass("a_down_hover"); });
$(".a_up").mouseover(function () { $(this).addClass("a_up_hover"); });
$(".a_up").mouseout(function () { $(this).removeClass("a_up_hover"); });
}
showScroll();
if ($(".nav-category-section").length > 0) {
if (isCategory == 0) {
$(".nav-category-section").hide();
$(".nav-category-abnt .iconfont").html("&#xe608;");
}
}
if ($("#selectprovince").length > 0) {
showcoke = 1;
var province = getCookie("province");
if (province != "") {
var aprovince = province.split("|");
onprovince(aprovince[0], aprovince[1], aprovince[2]);
}
var city = getCookie("city");
if (city != "" && city != "0") {
var acity = city.split("|");
oncity(acity[0], acity[1]);
}
var county = getCookie("county");
if (county != "" && county != "0") {
var acounty = county.split("|");
oncounty(acounty[0], acounty[1]);
}
showcoke = 0;
}
if ($("#addBookmark").length > 0) {
$("#addBookmark").click(function () {
var title = $(this).attr("title");
var url = $(this).attr("url");
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie 8") > -1) {
external.AddToFavoritesBar(url, title, ''); //IE8
} else {
try {
window.external.addFavorite(url, title);
} catch (e) {
try {
window.sidebar.addPanel(title, url, ""); //firefox
} catch (e) {
alert("加入收藏失败请使用Ctrl+D进行添加");
}
}
}
});
}
$list = $(".J_carouselList");
$btnPrev = $(".J_carouselPrev");
$btnNext = $(".J_carouselNext");
itemWidth = 310;
countPage = 2;
itemPerSlide = 3;
var width = parseInt($(this).width());
if (width <= 620) {
itemPerSlide = 2;
countPage = 3;
}
if (width <= 720) {
var showa = $(".menus ul li .showmenus");
if (showa.length > 0) {
for (var i = 0; i < showa.length; i++) {
$(showa[i]).removeAttr("onmouseover");
}
}
}
autoPlay();
$(window).resize(function () {
var items = $("#picfocus ul li img");
var width = parseInt($(this).width());
/*itemPerSlide = 2;
countPage = 2;
if (width <= 620) {
itemPerSlide = 1;
countPage = 4;
}
autoPlay();*/
/*if (width <= 630 && width > 560) {
$(document.body).css("-webkit-transform", "scale(-0.5)");
}*/
});
$('#login').click(function () {
if ($('#txt_userid').val() != '' && $('#txt_password').val() != '') {
if ($('#txt_Code').val() != '') {
$.post("/Ajax.ashx", { action: 'GetLogin', name: escape($('#txt_userid').val()), pwd: escape($('#txt_password').val()), code: escape($('#txt_Code').val()) }, function (data) {
if (data.indexOf("已锁定") == -1) {
if (data.indexOf("returnurl=") != -1) {
$('#Login_before').css('display', 'none');
$('#Login_after').fadeIn('fact');
$('#username').html($('#txt_userid').val());
//$('#txt_userid,#txt_password,#txt_Code').val('');
location.replace(data.replace("returnurl=", ""));
}
else {
switch (data) {
case "0":
$('#Login_before').css('display', 'none');
$('#Login_after').fadeIn('fact');
$('#username').html($('#txt_userid').val());
//$('#txt_userid,#txt_password,#txt_Code').val('');
location.replace("/Member_Index.aspx");
break;
case "1": alert('用户名或密码错误,或用户名未审核!'); break;
case "2": alert('请输入用户名或密码!'); break;
case "3": alert('请输入验证码!'); break;
case "4": alert('验证码错误!'); break;
case "5": alert('对不起,您的账户不能登录!'); break;
case "6": alert('对不起,您的账户已出局!'); break;
case "7": alert('对不起,您的账户不能在此登录!'); break;
}
}
} else {
alert("账户被锁定");
}
});
}
else alert('请输入验证码!');
}
else alert('请输入用户名或密码!');
});
$('#quit').click(function () {
$.post("/Ajax.ashx", { action: 'Quit' }, function (data) {
if (data != 'false') {
$('#Login_before').fadeIn('fact'); $('#Login_after').css('display', 'none');
location.replace("/?logout=1");
}
else {
$('#Login_before').css('display', 'none'); $('#Login_after').fadeIn('fact');
}
});
});
$('body').each(function () {
$.post("/Ajax.ashx", { action: 'IsLogin' }, function (data) {
if (data != 'false') {
$('#Login_before').css('display', 'none'); $('#Login_after').css('display', 'block'); $('#username').html(data);
}
else {
$('#Login_before').css('display', 'block'); $('#Login_after').css('display', 'none');
}
});
});
$('#ctl00_MyContent_Text_UserName').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'GetUserName', name: escape($(this).val()) }, function (data) {
if (data == 'true') {
$('#msg1').html('<font color="red">用户名已经存在,请换一个。</font>');
$(this).val('');
$('#hidden_UserName').val('1');
} else {
$('#msg1').html('<font color="green">用户名可以使用。</font>');
$('#hidden_UserName').val('0');
}
});
}
});
$('#ctl00_MyContent_Text_card').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'Getcard', card: escape($(this).val()) }, function (data) {
if (data == '0') {
$('#msg0').html('<font color="red">卡号不存在,请换一个。</font>');
$(this).val('');
$('#hidden_card').val('1');
} else {
$('#msg0').html('<font color="green">卡号可以使用。</font>');
$('#hidden_card').val('0');
}
});
}
});
/*
$('#ctl00_MyContent_Text_RememberID').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'GetUserName2', name: escape($(this).val()) }, function (data) {
if (data == 'true') {
$('#Text_RememberID_notice').html('<font color="green">推荐会员编号可以使用。</font>');
$('#hidden_RememberID').val('0');
} else {
$('#Text_RememberID_notice').html('<font color="red">推荐会员编号不存在或未审核,请换一个。</font>');
$(this).val('');
$('#hidden_RememberID').val('1');
}
});
}
});*/
$('#ctl00_MyContent_Text_ContactID').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'GetUserName2', name: escape($(this).val()), t: 2 }, function (data) {
if (data == '1') {
$('#Text_ContactID_notice').html('<font color="green">介绍人账号可以使用。</font>');
$('#hidden_ContactID').val('0');
} else {
$('#Text_ContactID_notice').html('<font color="red">介绍人账号不存在或未审核,请换一个。</font>');
$(this).val('');
$('#hidden_ContactID').val('1');
}
});
}
});
$('#ctl00_MyContent_Text_DLRememberID').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'GetUserName2', name: escape($(this).val()), t: 1 }, function (data) {
if (data == 'true') {
$('#Text_DLRememberID_notice').html('<font color="green">报单中心编号可以使用。</font>');
$('#hidden_DLRememberID').val('0');
} else {
$('#Text_DLRememberID_notice').html('<font color="red">报单中心编号不存在或未审核,请换一个。</font>');
$(this).val('');
$('#hidden_DLRememberID').val('1');
}
});
}
});
$('#ctl00_MyContent_Text_Code').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'GetCode', Code: escape($(this).val()) }, function (data) {
if (data == 'true') {
$('#Text_Code_notice').html('<font color="green">验证码填写正确。</font>');
$('#hidden_Code').val('0');
} else {
$('#Text_Code_notice').html('<font color="red">验证码填写错误。</font>');
$(this).val('');
$('#hidden_Code').val('1');
}
});
}
});
$('#ctl00_MyContent_Text_Email').blur(function () {
if ($(this).val() != '') {
var EmailCount = $(this).val().split(";")
var EmailA = $(this).val().split("@");
var EmailB = $(this).val().split(".");
if (EmailA.length != EmailCount.length + 1) {
$('#msg2').html('<font color="red">Email格式不对,请换一个。</font>');
$(this).val('');
$('#hidden_Email').val('1');
} else {
if (EmailB.length < EmailCount.length + 1) {
$('#msg2').html('<font color="red">Email格式不对,请换一个。</font>');
$(this).val('');
$('#hidden_Email').val('1');
} else {
$.post("/Ajax.ashx", { action: 'GetUserEmail', Email: escape($(this).val()), utype: '0' }, function (data) {
if (data == 'true') {
$('#msg2').html('<font color="red">Email已经存在,请换一个。</font>');
$(this).val('');
$('#hidden_Email').val('1');
} else {
$('#msg2').html('<font color="green">Email可以使用。</font>');
$('#hidden_Email').val('0');
}
});
}
}
}
});
$('#txt_password').keydown(function () {
if (event.keyCode == 13) { document.getElementById('login').focus(); }
});
});
var SysSecond = 120;
function SetRemainTime() {
setRemainTimeSite();
}
function setRemainTimeSite() {
if (SysSecond > 0) {
SysSecond = SysSecond - 1;
var second = SysSecond.toString();
if ($("#sendyzm").length > 0) {
$("#sendyzm").val("还剩" + second + "秒");
} else {
$("#sendyzm2").val("还剩" + second + "秒");
}
} else {
if ($("#sendyzm").length > 0) {
$("#sendyzm").val("重新发送");
$("#sendyzm").removeAttr("disabled");
} else {
$("#sendyzm2").val("重新发送");
$("#sendyzm2").removeAttr("disabled");
}
}
}
function onclicksendyzm() {
$("#sendyzm").attr("disabled", true);
$.post("/Ajax.ashx", { action: 'SendYZM' }, function (data) {
switch (data) {
case "0":
alert("发送成功!");
SysSecond = 120;
window.setInterval(SetRemainTime, 1000);
$("#sendyzm").attr("disabled", true);
break;
default: alert(data);
}
});
}
function onclicksendyzm2() {
$("#sendyzm2").attr("disabled", true);
$.post("/Ajax.ashx", { action: 'SendYZM2' }, function (data) {
switch (data) {
case "0":
alert("发送成功!");
SysSecond = 120;
window.setInterval(SetRemainTime, 1000);
$("#sendyzm2").attr("disabled", true);
break;
default: alert(data);
}
});
}
function onclicksendyzm3() {
$("#sendyzm").attr("disabled", true);
$.post("/Ajax.ashx", { action: 'SendYZM3', UserName: escape($('#Text_UserName').val()), Phone: escape($('#Text_Phone').val()) }, function (data) {
switch (data) {
case "0":
alert("发送成功!");
SysSecond = 120;
window.setInterval(SetRemainTime, 1000);
$("#sendyzm").attr("disabled", true);
break;
default: alert(data);
}
});
}
function tjguests() {
if ($("#Text_NCName").val() == "" || $("#Text_NCName").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#Text_LXFX").val() == "" || $("#Text_LXFX").val() == "必须填写") {
alert('您的联系方式不能为空');
}else if ($("#Text_Body").val() == "" || $("#Text_Body").val() == "尊敬的客户:说几句吧") {
alert('留言内容不能为空');
}else{
$.post("/Ajax.ashx", {
action: "AddGuest",
GuestName: escape($("#Text_NCName").val()),
GuestContact: escape($("#Text_LXFX").val()),
Message: escape($("#Text_Body").val())
}, function (data) {
if (data == 'true') {
alert('发表留言成功,谢谢!');
location.href = location.href.toString();
} else alert(data);
});
}
}
function tjpinglun() {
var addstarbox = $("#addstarbox input");
var star = 1;
for (var i = 0; i < addstarbox.length; i++) {
if ($(addstarbox[i]).attr("checked") == true) {
star = $(addstarbox[i]).val();
}
}
if ($("#pinglunname").val() == "" || $("#pinglunname").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#pinglunbody").val() == "" || $("#pinglunbody").val() == "尊敬的客户:说几句吧") {
alert('您的评论不能为空');
} else {
$.post("/Ajax.ashx", {
action: "Addpinglun",
GuestName: escape($("#pinglunname").val()),
Message: escape($("#pinglunbody").val()),
star: star,
BusinessID: $('#hidd_id').val()
}, function (data) {
if (data == 'true') {
alert('发表评论成功,请等待管理员审核');
} else alert(data);
});
}
}
function tjwenda() {
if ($("#wdid").val() == "") {
if ($("#wendaname").val() == "" || $("#wendaname").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#wendabody").val() == "" || $("#wendabody").val() == "尊敬的客户:说几句吧") {
alert('您的评论不能为空');
} else {
$.post("/Ajax.ashx", {
action: "Addwenda",
GuestName: escape($("#wendaname").val()),
Message: escape($("#wendabody").val()),
BusinessID: $('#hidd_id').val()
}, function (data) {
if (data == 'true') {
alert('提交问题成功,请等待管理员审核');
} else alert(data);
});
}
} else {
if ($("#wendaname").val() == "" || $("#wendaname").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#wendabody").val() == "" || $("#wendabody").val() == "尊敬的客户:说几句吧") {
alert('您的评论不能为空');
} else {
$.post("/Ajax.ashx", {
action: "savewenda",
GuestName: escape($("#wendaname").val()),
Message: escape($("#wendabody").val()),
wdid: $("#wdid").val()
}, function (data) {
if (data == 'true') {
alert('保存成功,请等待管理员审核');
} else alert(data);
});
}
}
}
function zanpinglun(id) {
if ($("#zan" + id).attr("class") == "zan") {
$.post("/Ajax.ashx", {
action: "zanpinglun",
id: id
}, function (data) {
if (data == 'true') {
$("#zan" + id).attr("class", "zan2");
var zannum = $("#zan" + id + " label");
zannum.html(parseInt(zannum.html()) + 1);
$("#showzannum").show();
$("#showzannum").css({ left: $("#zan" + id).offset().left + "px", top: ($("#zan" + id).offset().top - 20) + "px" });
$("#showzannum").hide(500);
} else alert(data);
});
} else {
alert("您已经赞过了");
}
}
function GetPages(ttype, intPage, ID) {
$("#detail_pinglun_box_" + ttype).html("<div align=\"center\"><img src=\"/images/ajaxLoader.gif\"/></div>");
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "GetPages", ttype: ttype, intPage: intPage, ID: ID },
function (data) {
if (data.success) {
var pingcontent = data.content;
var pingpages = data.pages;
$("#detail_pinglun_box_" + ttype).html(pingcontent);
$("#detail_pinglun_pages_" + ttype).html(pingpages);
} else {
alert(data.msg);
}
});
}
function wyhd(id, title) {
$("#wendabody").text(title);
$("#wdid").val(id);
$("#wdbutton").focus();
$("#wdtitle").html("您的回答:");
$("#wdbutton").attr("class","tjld");
}