var floatad = floatad || {}; floatad.automove = function automove(id) { var xPos = 300; var yPos = 200; var step = 1; var delay = 30; var width = document.body.clientWidth; var height = document.body.clientHeight; var Hoffset = 0; var Woffset = 0; var yon = 0; var xon = 0; var pause = true; var interval; var img1=document.getElementById(id); img1.style.top = yPos; function changePos() { Hoffset = img1.offsetHeight; Woffset = img1.offsetWidth; img1.style.left = xPos + document.body.scrollLeft; img1.style.top = yPos + document.body.scrollTop; if (yon) { yPos = yPos + step; } else { yPos = yPos - step; } if (yPos < 0) { yon = 1;yPos = 0; } if (yPos >= (height - Hoffset)) { yon = 0;yPos = (height - Hoffset); } if (xon) { xPos = xPos + step; } else { xPos = xPos - step; } if (xPos < 0) { xon = 1;xPos = 0; } if (xPos >= (width - Woffset)) { xon = 0;xPos = (width - Woffset); } } function start() { if(interval == null) { img1.visibility = "visible"; interval = setInterval(changePos, delay); } } function pauseit() { if(pause) { clearInterval(interval); pause = false; } } function resumeit() { if(!pause) { interval = setInterval(changePos,delay); pause = true; } } function pause_resume() { if(pause) { clearInterval(interval); pause = false; } else { interval = setInterval(changePos,delay); pause = true; } } start(); img1.onmouseover = function() {pauseit();}; img1.onmouseout = function() {resumeit();}; }; function hide(id) { var e = document.getElementById(id); e.style.display = 'none'; } function setMenuListSize(menubarId,width) { var menubar=document.getElementById(menubarId); var menulist = menubar.getElementsByTagName("ul")[0]; var style = "width:" + menulist.children.length * width + "px;"; menulist.setAttribute('style', style); menulist.style.width = menulist.children.length * width; } function autoSizeImg(id, maxWidth, maxHeight) { var abc=document.getElementById(id); var imgs=abc.getElementsByTagName("img"); for (var i=0,g;g=imgs[i];i++) g.onload=function(){ if (this.width>maxWidth){ this.width=maxWidth; }else{ if (this.height>maxHeight) this.height=maxHeight; } }; } function enableDropDownMenu(id) { var handler = attachDropDownMenuHandler(id); //if (window.attachEvent) window.attachEvent("onload", handler); } function attachDropDownMenuHandler(id) { try { var sfEls = document.getElementById(id).getElementsByTagName("LI"); for (var i=0; i 0) { an = i[0]; } else { pt.onmouseout=function() { pmenu.style.display = "none"; }; } an.onmouseover=function() { pmenu.style.display = "block"; }; var sfEls = pmenu.getElementsByTagName("li"); for (var i=0; ifocusPhoto.getCounts()-1)n=0; focusPhoto.Mea(n); focusPhoto.conaus(n); focusPhoto.n = n; }; /** * marquee * 閫熷害鏁板€艰秺澶ч€熷害瓒婃參 */ var marquee = marquee || {}; marquee.startHorizontal= function startHorizontal(boxId, box1Id, box2Id, speed) { if(speed === null || typeof speed === "undefined") { speed = 25; } var box = document.getElementById(boxId); var box1 = document.getElementById(box1Id); var box2 = document.getElementById(box2Id); box2.innerHTML=box1.innerHTML; function Marquee(){ if(box2.offsetWidth-box.scrollLeft<=0) box.scrollLeft-=box1.offsetWidth; else{ box.scrollLeft++; } } var MyMar=setInterval(Marquee,speed); box.onmouseover=function() { clearInterval(MyMar); }; box.onmouseout=function() { MyMar=setInterval(Marquee,speed); }; }; marquee.startVertical = function startVertical(boxId, box1Id, box2Id, speed) { if(speed === null || typeof speed === "undefined") { speed = 100; } var box = document.getElementById(boxId); var box1 = document.getElementById(box1Id); var box2 = document.getElementById(box2Id); box2.innerHTML=box1.innerHTML; function Marquee(){ if(box2.offsetTop-box.scrollTop<=0) box.scrollTop-=box1.offsetHeight; else{ box.scrollTop++; } } var MyMar=setInterval(Marquee,speed); box.onmouseover=function() { clearInterval(MyMar); }; box.onmouseout=function() { MyMar=setInterval(Marquee,speed); }; }; /** * theme */ var theme = theme || {}; theme.cookieName = 'theme'; theme.linkId = 'link'; theme.selectId = 'select'; theme.resetTheme = function resetTheme() { var select = document.getElementById(theme.selectId); select.selectedIndex = 0; theme.selectTheme(); }; theme.applyTheme = function applyTheme() { var t = cookie.readCookie(theme.cookieName); if(t === null || typeof t === "undefined") { return; } var link = document.getElementById(theme.linkId); link.href='/'+t+'/style.css'; }; theme.adjustSelect = function adjustSelect() { var t = cookie.readCookie(theme.cookieName); if(t === null || typeof t === "undefined") { return; } var select = document.getElementById(theme.selectId); for(var i =0; i= select.length) { index = 0; } } else { index--; if(index < 0) { index = select.length-1; } } select.options[index].selected = true; changeImgOnSelect(select, imgid); } // common JavaScript functions /* ---------------- Common basic type operations/ --------------- */ // serial of functions to trim string var whitespace = " \t\n\r"; function charInString (c, s) { for (i = 0; i < s.length; i++) { if (s.charAt(i) == c) return true; } return false; } function stripInitialWhitespace (s) { var i = 0; while ((i < s.length) && charInString (s.charAt(i), whitespace)) i++; return s.substring (i, s.length); } function stripEndingWhitespace (s) { var i = s.length - 1; while ((i > 0) && charInString (s.charAt(i), whitespace)) i--; return s.substring (0, i+1); } function trimString (s) { return stripEndingWhitespace ( stripInitialWhitespace (s) ); } // function to check E-mail address like string function isEmail (s) { // there must be >= 1 character before @, so we // start looking at character position 1 // (i.e. second character) var i = 1; var sLength = s.length; if ( sLength <= 1 ) return false ; // look for @ while ((i < sLength) && (s.charAt(i) != "@")) { i++; } if ((i >= sLength) || (s.charAt(i) != "@")) return false; else i += 2; // look for . while ((i < sLength) && (s.charAt(i) != ".")) { i++; } // there must be at least one character after the . if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false; else return true; } // function to check IP Address like string function isIPAddress ( strIPAddress ) { regExp = new RegExp ( "([0-9]{1,3})[\.]{1,}([0-9]{1,3})[\.]{1,}([0-9]{1,3})[\.]{1,}([0-9]{1,3})" ) ; aParts = regExp.exec ( strIPAddress ) ; if ( aParts == null ) { return false ; } if ( aParts.length != 5 ) { return false ; } for ( nLoopCnt = 1 ; nLoopCnt < 5 ; nLoopCnt ++ ) { if ( aParts [ nLoopCnt ] < 0 || aParts [ nLoopCnt ] > 255 ) { return false ; } } return true ; } // function to check login name like string function fn_CheckLoginName ( strLogin ) { strLogin = trimString( strLogin ) ; var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._"; var checkStr = strLogin ; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if ( ! allValid ) { return (false); } if ( checkStr.charAt(0) == '-' || checkStr.charAt(0) == '.' || checkStr.charAt(0) == '_' ) { return (false); } return (true); } // function to check Domain name like string function fn_CheckDomainName ( strDomainName ) { strDomainName = trimString ( strDomainName ) ; var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-."; var checkStr = strDomainName; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { return (false); } if ( checkStr.charAt(0) == '-' || checkStr.charAt(0) == '.' ) { return (false); } return (true); } // function to check year, month, day numbers function fn_ValidateDate ( nYear , nMonth , nDay ) { if ( nMonth < 1 || nMonth > 12 ) return false ; if ( nDay < 1 || nDay > 31 ) return false ; if ( nMonth == 4 || nMonth == 6 || nMonth == 9 || nMonth == 11 ) { if ( nDay > 30 ) return false ; } if ( nMonth == 2 ) { if ( nYear % 4 == 0 ) { if ( nYear % 100 == 0 ) { if ( nYear % 400 == 0 ) { if ( nDay > 29 ) return false ; } else { if ( nDay > 28 ) return false ; } } else { if ( nDay > 29 ) return false ; } } else { if ( nDay > 28 ) return false ; } } return true ; } /* ---------------- /Common basic type operations --------------- */ var ad = ad || {}; ad.autohide = function autohide(id,height) { var time = 600; var h = 0; if(typeof height === "undefined") { height = 500; } var element = document.getElementById(id); function addCount() { if(time>0) { time--; h = h+5; } else { return; } if(h>height) //楂樺害 { return; } element.style.display = ""; element.style.height = h+"px"; setTimeout(addCount,30); } window.onload = function showAds() { addCount(); setTimeout(noneAds,7000); //鍋滅暀鏃堕棿鑷繁閫傚綋璋冩暣 }; var T = 600; var N = height; //楂樺害 function noneAds() { if(T>0) { T--; N = N-5; } else { return; } if(N<0) { element.style.display = "none"; return; } element.style.height = N+"px"; setTimeout(noneAds,30); } }; var QuickScrollYLast=0; var OnlineChat; function enableOnlineChat() { OnlineChat=document.getElementById("onlineChat"); if(OnlineChat === null || typeof OnlineChat === "undefined") { return; } window.setInterval("LoadMenu()",1); } function LoadMenu(){ var QuickScrollYDefault; if(document.documentElement&&document.documentElement.scrollTop){ QuickScrollYDefault=document.documentElement.scrollTop; }else if(document.body){ QuickScrollYDefault=document.body.scrollTop; }else{ } QuickPercent=.1*(QuickScrollYDefault-QuickScrollYLast); if(QuickPercent>0){ QuickPercent=Math.ceil(QuickPercent); }else{ QuickPercent=Math.floor(QuickPercent); } OnlineChat.style.top=parseInt(OnlineChat.style.top)+QuickPercent+"px"; QuickScrollYLast=QuickScrollYLast+QuickPercent; } function ChangeMenu(contextPath){ if(document.getElementById("chatList").style.display == "none"){ document.getElementById("chatList").style.display="block"; document.getElementById("chatMenu").src=contextPath+"/resources/images/onlinechat/chat_close.gif"; }else{ document.getElementById("chatMenu").src=contextPath+"/resources/images/onlinechat/chat_open.gif"; document.getElementById("chatList").style.display="none"; } } function changeMenu2(contextPath){ if(document.getElementById("chatList2").style.display == "none"){ document.getElementById("chatList2").style.display="block"; document.getElementById("chatMenu2").src=contextPath+"/resources/images/onlinechat/chat_close.gif"; }else{ document.getElementById("chatMenu2").src=contextPath+"/resources/images/onlinechat/chat_open.gif"; document.getElementById("chatList2").style.display="none"; } } function changeCloseOpen(contextPath) { var closeopen = document.getElementById("chat_close"); var chat_bg = document.getElementById("chat_bg"); if (chat_bg.style.display=="none") { chat_bg.style.display="block"; closeopen.className="close"; } else { chat_bg.style.display="none"; closeopen.className="open"; } return false; } // http://answers.yahoo.com/question/index?qid=20080924072549AAbkvzn // http://support.microsoft.com/kb/318086 // http://www.javascriptsource.com/page-details/no-right-click.html function disabletext(e){ return false; } function reEnable(){ return true; } function disableTextSelection() { //if the browser is IE4+ document.onselectstart=new Function ("return false"); //if the browser is NS6 if (window.sidebar){ document.onmousedown=disabletext; document.onclick=reEnable; } } // JavaScript Document // Left - right AD lastScrollY=0; function heartBeat(){ var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop; else {/*Netscape stuff*/} //alert(diffY); percent=.1*(diffY-lastScrollY); if(percent>0)percent=Math.ceil(percent); else percent=Math.floor(percent); document.getElementById("couplet_left").style.top=parseInt(document.getElementById("couplet_left").style.top)+percent+"px"; document.getElementById("couplet_right").style.top=parseInt(document.getElementById("couplet_right").style.top)+percent+"px"; lastScrollY=lastScrollY+percent; //alert(lastScrollY); } function enableCoupletBox(ctxPath, leftImgUri, leftLinkUri, rightImgUri, rightLinkUri) { if(typeof leftImgUri !== "undefined" && leftImgUri.length > 0) { left_box="

"; } else { left_box=""; } if(typeof rightImgUri !== "undefined" && rightImgUri.length > 0) { right_box="

"; } else { right_box=""; } document.write(left_box); document.write(right_box); window.setInterval("heartBeat()",1); } // End left - right AD function showSpecMenu() { $(".salesProperty").addClass("salesPropertyRequired"); } // product.xhtml function addToCart(soldoutmsg, e,json,msg) { var inventory = parseFloat(document.getElementById('inventoryCount').textContent); // alert("inventory="+inventory); if(inventory <= 0) { displayToast(soldoutmsg); return false; } var chooseWarehouse = document.getElementById("chooseWarehouse"); var chooseWarehouseId; if (chooseWarehouse !== null && typeof chooseWarehouse !== 'undefined') { var wlist = chooseWarehouse.getElementsByTagName("li"); var selectw; for (var wi = 0; wi < wlist.length; wi++) { var w = wlist[wi]; if (w.className.indexOf("selected") != -1) { selectw = w; break; } } if (typeof selectw !== 'undefined') { var idtag = selectw.getElementsByTagName("b"); chooseWarehouseId = idtag[0].textContent; } else if (wlist.length > 0) { displayToast("璇烽€夋嫨閰嶉€佷腑蹇?); return false; } } var prop = ""; var plist = document.getElementById("salesProperty").getElementsByTagName("ul"); for (var pi = 0; pi < plist.length; pi++) { var prow = plist[pi]; var radiolist = prow.getElementsByTagName("input"); var checked = false; for (var i = 0; i < radiolist.length; i++) { var rad = radiolist[i]; if (rad.checked) { if (prop.length != 0) { prop = prop + ","; } prop = prop + rad.name + ":" + rad.value; checked = true; } } if (radiolist.length > 0 && prow.className.indexOf("psales") != -1) { if (!checked) { displayToast("璇烽€夋嫨浜у搧瑙勬牸"); showSpecMenu(); return false; } } } if(typeof chooseWarehouseId !== 'undefined') { e.href = setParameter(e.href, "warehouseId", chooseWarehouseId); } if(e.href.indexOf("quantity") === -1) { e.href = e.href + '&quantity=' + document.getElementById('quantity').value; } else { //e.href = e.href.replace(/quantity=[0-9]*/, 'quantity=' + document.getElementById('quantity').value); e.href = setParameter(e.href, "quantity", document.getElementById('quantity').value); } e.href = setParameter(e.href, "salesprop", prop); if(json) { var url = e.href + "&json=true"; $.ajax({ url: url, success: function( data ) { $("#cart_item_count").text(data.cart_item_count); $("#top_cart_item_count").text(data.cart_item_count); /* try { $("#inventoryCount").text(data.inventoryCount); } catch (e) { // console.log(e); } */ try { if(typeof data.inventoryCount === 'undefined' || data.inventoryCount > 0) { $("#buy_messages").css("display", "none"); $("#buy_buttons").css("display", "block"); } else { $("#buy_messages").css("display", "block"); $("#buy_buttons").css("display", "none"); } }catch(e){ // console.log(e); } displayToast(msg); hideSpecMenu(); }, dataType: "json", error: function(jqXHR, textStatus, errorThrown ) { // console.log("textStatus="+textStatus+",errorThrown="+errorThrown); } }); return false; } else { return true; } } function setParameter(url, param, paramVal){ // http://stackoverflow.com/a/10997390/2391566 var parts = url.split('?'); var baseUrl = parts[0]; var oldQueryString = parts[1]; var newParameters = []; if (oldQueryString) { var oldParameters = oldQueryString.split('&'); for (var i = 0; i < oldParameters.length; i++) { if(oldParameters[i].split('=')[0] != param) { newParameters.push(oldParameters[i]); } } } if (paramVal !== '' && paramVal !== null && typeof paramVal !== 'undefined') { newParameters.push(param + '=' + encodeURI(paramVal)); } if (newParameters.length > 0) { return baseUrl + '?' + newParameters.join('&'); } else { return baseUrl; } } function displayToast(msg) { toastr.options.closeButton = true; //toastr.options.positionClass = "toast-bottom-center"; toastr.options.timeOut = "2000", toastr.info(msg); } function getSelectedWarehouseId() { var chooseWarehouse = document.getElementById("chooseWarehouse"); var chooseWarehouseId; if (typeof chooseWarehouse !== 'undefined') { var wlist = chooseWarehouse.getElementsByTagName("li"); var selectw; for (var wi = 0; wi < wlist.length; wi++) { var w = wlist[wi]; if (w.className.indexOf("selected") != -1) { selectw = w; break; } } if (typeof selectw !== 'undefined') { var idtag = selectw.getElementsByTagName("b"); chooseWarehouseId = idtag[0].textContent; } } return chooseWarehouseId; } var productInventoryInfo; function getWarehouseInfo(chooseWarehouseId) { var chooseWarehouse; if (productInventoryInfo !== 'undefined') { for (var wi = 0; wi < productInventoryInfo.awil.length; wi++) { var ww = productInventoryInfo.awil[wi]; if (ww.id == chooseWarehouseId) { chooseWarehouse = ww; break; } } } return chooseWarehouse; } function warehouseChanged(sel) { var labellist = document.getElementById('chooseWarehouse').getElementsByTagName("li"); for (var i = 0; i < labellist.length; i++) { var e = labellist[i]; e.className = ''; } sel.className = 'selected'; var idtag = sel.getElementsByTagName("b"); var chooseWarehouseId = idtag[0].textContent; var chooseWarehouse = getWarehouseInfo(chooseWarehouseId); if (chooseWarehouse !== 'undefined') { $("#inventoryCount").text(chooseWarehouse.totalCount); $(".inventoryCount").text(chooseWarehouse.totalCount); } } function updateSpecInventoryCount() { var propa = new Array(); var prop = ''; var plist = document.getElementById("salesProperty").getElementsByTagName("ul"); for (var pi = 0; pi < plist.length; pi++) { var prow = plist[pi]; var radiolist = prow.getElementsByTagName("input"); var checked = false; for (var i = 0; i < radiolist.length; i++) { var rad = radiolist[i]; if (rad.checked) { if (prop.length != 0) { prop = prop + ","; } prop = prop + rad.name + ":" + rad.value; propa[pi] = rad.name + ":" + rad.value; checked = true; } } if (radiolist.length > 0 && prow.className.indexOf("psales") != -1) { if (!checked) { // 娌℃湁閫夊叏 console.log("娌℃湁閫夊叏"); return; } } } console.log("propa="+propa); propa = propa.sort(); console.log("propa="+propa); var propn = ''; for(i=0; i 0) { $(".spec-member-profit").text("PV锛?+spcl.memberProfit); } var startTime; var endTime; var giftBonus; var giftVoucher; var rewardBack; var msg = ""; if(spcl["productPromotionData"]) { startTime = spcl.productPromotionData.startTime; endTime = spcl.productPromotionData.endTime; if(spcl.productPromotionData["giftBonusAmount"]) { giftBonus = "璧犻€佷唬閲戝埜"+spcl.productPromotionData["giftBonusAmount"]; msg += giftBonus } if(spcl.productPromotionData["giftVoucherAmount"]) { giftVoucher = "璧犻€佸井鍟嗗竵"+spcl.productPromotionData["giftVoucherAmount"]; msg += "锛? + giftVoucher; } if(spcl.productPromotionData["rewardBackAmount"] && spcl.productPromotionData["rewardBackDays"]) { //msg += "锛屽垎" + spcl.productPromotionData["rewardBackDays"] + "澶╁叡杩旂Н鍒嗗竵" + spcl.productPromotionData["rewardBackAmount"]; rewardBack = "杩旂Н鍒嗗竵" + spcl.productPromotionData["rewardBackAmount"]; msg += "锛? + rewardBack; } } console.log("msg="+msg); // $(".prod-pro").text(msg); if(msg.length > 0) { $(".prod-pro-area").show(); $(".startTime").text(startTime); $(".endTime").text(endTime); } else { $(".prod-pro-area").hide(); } if(typeof(giftBonus) !== 'undefined' && giftBonus.length > 0) { $(".giftBonus").show(); $(".giftBonus i").text(giftBonus); } else { $(".giftBonus").hide(); } if(typeof(giftVoucher) !== 'undefined' && giftVoucher.length > 0) { $(".giftVoucher").show(); $(".giftVoucher i").text(giftVoucher); } else { $(".giftVoucher").hide(); } if(typeof(rewardBack) !== 'undefined' && rewardBack.length > 0) { $(".rewardBack").show(); $(".rewardBack i").text(rewardBack); } else { $(".rewardBack").hide(); } } } } } catch(e) { console.log(e); } } function updatePrice2(prop) { try { if (productInventoryInfo !== 'undefined') { var icl = productInventoryInfo.inventoryCountList; var min = icl.minPrice; var max = icl.maxPrice; if(icl.samePrice) { } else { var p = "" + min + "-" + max; $(".spec-price-value").text(p); } var ic = parseInt(icl.totalAvailableCount); $(".inventoryCount").text(ic); } } catch(e) { console.log(e); } } function formatNumber(c) { if(c > 100000000) { c = c / 100000000; c = c + "浜?; } else if (c > 10000) { c = c / 10000; c = c + "涓?; } return c; } var updateLoginAreaAndCartCallback = function test(data) {}; function updateLoginAreaAndCart(url) { $.ajax({ url: url, success: function (data) { // alert("updateLoginAreaAndCart=" + data); productInventoryInfo = data; try { if (typeof data.cart_item_count !== 'undefined') { $(".cart_item_count").text(data.cart_item_count); } } catch (e) { } try { if (typeof data.inventoryCount !== 'undefined') { $(".inventoryCount").text(data.inventoryCount); } } catch (e) { } try { if (typeof data.viewCount !== 'undefined') { $(".viewCount").text(data.viewCount); } } catch (e) { } try { if (typeof data.commentCount !== 'undefined') { $(".commentCount").text(data.commentCount); } } catch (e) { } try { if (typeof data.favoriteCount !== 'undefined') { $(".favoriteCount").text(formatNumber(data.favoriteCount)); } if (data.favorite) { $(".favoriteYes").show(); $(".favoriteNo").hide(); } else { $(".favoriteYes").hide(); $(".favoriteNo").show(); } } catch (e) { } try { if (typeof data.followCount !== 'undefined') { $(".followCount").text(formatNumber(data.followCount)); } if (data.follow) { $(".followYes").show(); $(".followNo").hide(); } else { $(".followYes").hide(); $(".followNo").show(); } } catch (e) { } try { if(data.returnProfitEnabled) { $(".returnProfit").css("display", "block"); $(".promotion").css("display", "block"); } else { $(".returnProfit").css("display", "none"); $(".promotion").css("display", "none"); } } catch(e) { } try { if (typeof data.salesCount !== 'undefined') { $(".salesCount").text(data.salesCount); } } catch (e) { } try { if (typeof data.awil !== 'undefined') { var ulcontent = ''; for (var wi = 0; wi < data.awil.length; wi++) { var ww = data.awil[wi]; var se = wi == 0 ? 'class="selected"' : ''; ulcontent = ulcontent + '
  • ' + ww.name + '' + ww.id + '' + ww.totalCount + '
  • '; } $("#chooseWarehouse .warehouseList").html(ulcontent); // $("#chooseWarehouse").css("display", "block"); $("#chooseWarehouse").css("display", "none"); } else { $("#chooseWarehouse").css("display", "none"); } } catch (e) { console.log(e); } try { // typeof data.inventoryCount === 'undefined' || // alert(data.inventoryCount); var ic = parseInt(data.inventoryCount); // alert(ic > 0); if (ic > 0) { $("#buy_messages").css("display", "none"); $("#buy_buttons").css("display", "block"); } else { $("#buy_messages").css("display", "block"); $("#buy_buttons").css("display", "none"); // alert("reach here"); } } catch (e) { // alert(e); // console.log(e); } if (data.login) { $("#userinfo_guest").css("display", "none"); $("#userinfo_logined").css("display", "inline"); $("#loginUserName").text(data.userName); $(".loginUserName").text(data.userName); $(".loginForm").css("display", "none"); $(".logoutForm").css("display", "block"); if (typeof data.inboxNewCount !== 'undefined') { try { $("#top_inbox_item_count").text(data.inboxNewCount); } catch (e) { } } } else { $("#userinfo_guest").css("display", "inline"); $("#userinfo_logined").css("display", "none"); $(".loginForm").css("display", "block"); $(".logoutForm").css("display", "none"); } updateLoginAreaAndCartCallback(data); updatePrice2(data); }, dataType: "json", error: function (jqXHR, textStatus, errorThrown) { // console.log("textStatus=" + textStatus + ",errorThrown=" + errorThrown); } }); } function adjustQuantity(increase) { var q = document.getElementById('quantity'); if (increase) { q.value = parseFloat(q.value) + 1; } else { if (q.value > 1) { q.value = parseFloat(q.value) - 1; } } return false; } function pvaluechanged2(radio,label,list) { var labellist = list.getElementsByTagName("label"); for (var i=0; i 0 && prow.className.indexOf("psales") != -1) { if(!checked) { displayToast("璇烽€夋嫨浜у搧瑙勬牸"); return false; } } } specName.value = prop; } function copy(ele) { var codeVal = document.getElementById(ele).innerHTML; copyData(codeVal); } function copyData(codeVal) { if (navigator.userAgent.toLowerCase().indexOf('ie') > -1) { //IE娴忚鍣 clipboardData.setData('Text', codeVal); alert("宸茬粡澶嶅埗鍒板壀鍒囨澘"); } else { prompt("浣犵殑娴忚鍣ㄤ笉鏀寔 璇锋寜 CTRL+C 澶嶅埗", codeVal); } // window.clipboardData.setData("Text",codeVal); } function toggleVisible(ele) { toggleVisibleImpl(ele, ''); } function toggleVisibleImpl(ele, disp) { var e = document.getElementById(ele); if(typeof e !== 'undefined') { if (e.style.display == 'none') { e.style.display = disp; } else { e.style.display = 'none'; } } } function toggleVisible2(self,ele) { if ($('#'+self).attr("class") == 'open') { $('#'+self).attr("class", 'close'); } else { $('#'+self).attr("class", 'open'); } $('#'+ele).toggle(); } function countDown(time, id) { var day_elem = $(id).find('.day'); var hour_elem = $(id).find('.hour'); var minute_elem = $(id).find('.minute'); var second_elem = $(id).find('.second'); //if(typeof end_time == "string") var end_time = new Date(time.replace(/-/g, "/")).getTime(), //鏈堜唤鏄疄闄呮湀浠?1 sys_second = (end_time - new Date().getTime()) / 1000; var timer = setInterval(function () { if (sys_second > 1) { sys_second -= 1; var day = Math.floor((sys_second / 3600) / 24); var hour = Math.floor((sys_second / 3600) % 24); var minute = Math.floor((sys_second / 60) % 60); var second = Math.floor(sys_second % 60); day_elem && $(day_elem).text(day); //璁$畻澶 $(hour_elem).text(hour < 10 ? "0" + hour : hour); //璁$畻灏忔椂 $(minute_elem).text(minute < 10 ? "0" + minute : minute); //璁$畻鍒嗛挓 $(second_elem).text(second < 10 ? "0" + second : second); //璁$畻绉掓潃 } else { clearInterval(timer); } }, 1000); } function startsWith(s, prefix) { return s.slice(0, prefix.length) === prefix; } function endsWith(s, suffix) { return s.indexOf(suffix, s.length - suffix.length) !== -1; } function updateManageTable(data) { if(data.status=='success'){ enableDropDownMenu2("dropDownCommand"); enableTableSelect("manageTable", "opArea"); } } function updateManageTable2() { enableDropDownMenu2("dropDownCommand"); enableTableSelect("manageTable", "opArea"); }