﻿var Y='&yen;';function parsePrice(s){return parseFloat(s.replace(/,/g,'').replace('￥','').replace('¥','').replace('&yen;','').replace('?','').replace('-',''))};jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};jQuery.fn.extend({switchBox:function(){$(this).find("h3:first").addClass("close");$(this).find("h3:first").bind('click',function(){if($(this).find("~ .detail").css("display")=="block"){$(this).removeClass("open").addClass("close")}else{$(this).removeClass("close").addClass("open")}$(this).find("~ .detail").toggle()});return $(this)}});function clickOnce(btn,msg){if(typeof(Page_ClientValidate)=='function'){if(Page_ClientValidate()==false){return false}}if(btn.getAttribute('type')=='button'){if(!msg||(msg=='undefined')){msg='处理中...'}btn.value=msg;btn.disabled=true}return true};function keyPress(e,id){var keycode=window.event?e.keyCode:e.which;if(keycode==13){document.getElementById(id).focus();document.getElementById(id).click()}};function goSearch(){var v=$.trim($("#q").val());if(v.length>50){alert("您输入的关键字过长！");$('#q').focus();return false}if(v==""||v.substring(0,3)=="请输入"){alert('请输入要搜索的关键字!');$('#q').focus();return false}$('#q').val(v);return true};function showUserInfo(){var url="/XHttpService/XHttp.ashx?t=getuserinfo&dt="+new Date();$.getJSON(url,function(data){if(data.nickname!=""){$(".userinfo").html("您好，<a href=/usercenter/default.aspx class=uname>"+data.nickname+"</a> <a href=/usercenter/loginout.aspx>[退出]</a>")}else{$(".userinfo").html("您好，欢迎光临<span class=sn>    搜宝商城·佳仕达门业  </span> <a href=/login.aspx>请登录</a> <a href=/register.aspx>免费注册</a>")}$("span.num").html(data.cart)})};function showQuickAlert(msg){$('<div class="quick-alert">'+msg+'</div>').insertAfter($("#BTN_Submit")).fadeIn('slow').animate({opacity:1.0},3000).fadeOut('slow',function(){$(this).remove()})};function showQuickAlert(msg,sender,sec){$('<div class="quick-alert">'+msg+'</div>').insertAfter($(sender)).fadeIn('slow').animate({opacity:1.0},(sec==undefined?3*1000:sec*1000)).fadeOut('slow',function(){$(this).remove()})};function bindSearchItems(){$("#c").append('<option value=>数据加载中...</option>');$.getJSON('/system_data/searchcategories.js',function(data){if(data!=""){$("#c")[0].options.length=0;$("#c").append("<option value=''>商品类别</option>");$.each(data,function(i,o){$("#c").append('<option value='+o.url+'>'+o.name+'</option>')})}})};function selectAllCheckBox(){var b=false;if($("#selall").attr("checked"))b=true;$("input:checkbox").each(function(){$(this).attr("checked",b)})};function checkSelectCheckBox(){var b=false;$("input:checkbox").each(function(){if($("this").attr("checked"))b=true});if(!b){alert("至少要选择一条信息后才能进行操作！")}return b};function changeManageState(){if($("#ManageState").val()=="ToCategory"){$("#ToCategory").show()}};jQuery.fn.rowStyle=function(c1,c2,cm){if(!(c1&&c2))return;var css,oj;this.each(function(){oj=jQuery("tr",jQuery(this));oj.each(function(i){css=i%2==0?c1:c2;jQuery(this).addClass(css)});if(cm){oj.hover(function(){jQuery(this).addClass(cm)},function(){jQuery(this).removeClass(cm)})}})};function getLeftChars(varField,num){var i=0;var counter=0;var cap=num;var leftchars=cap-varField.value.length;return(leftchars)};function onCharsChange(varField,num,tip){var leftChars=getLeftChars(varField,num);if(leftChars>=0){if(tip==undefined){charsmonitor.innerText=leftChars}else{$("#"+tip).text(leftChars)}return true}else{if(tip==undefined){charsmonitor.innerText="0"}else{$("#"+tip).text("0")}window.alert("超过了系统限定字数，你只能输入"+num+"个字符！");var len=varField.value.length+leftChars;varField.value=varField.value.substring(0,len);leftChars=getLeftChars(varField,num);if(leftChars>=0){if(tip==undefined){charsmonitor.innerText=leftChars}else{$("#"+tip).text(leftChars)}}return false}};function formatNumber(num,decplaces){num=parseFloat(num);if(!isNaN(num)){var str=""+Math.round(eval(num)*Math.pow(10,decplaces));if(str.indexOf("e")!=-1){return"Out of Range"}while(str.length<=decplaces){str="0"+str}var decpoint=str.length-decplaces;return String(str.substring(0,decpoint)+"."+str.substring(decpoint,str.length))}else{return"NaN"}};function isInt(s){if(s.match(/^[1-9][0-9]{0,3}$/)==null){alert("错误,购买商品的数量只能输入1-9999间的数字.")}};function setPageSize(name,val){$.cookie(name,val,{expires:365});location.href=document.URL};function setMenu(v){$.cookie("mainmenu",v,{expires:365})};function goUrl(url){location.href=url.value};function clearBrowseHistory(id){$(id).empty();var url="/XHttpService/XHttp.ashx?t=clearbrowsehistory&dt="+new Date();$.get(url)};function loading(id,v){$(id).html("<img src=\"/skins/default/images/loading.gif\" /> "+(v==undefined?"请稍候，正在读取内容...":v))};function zoomDoc(size){$("#description").css("font-size",size);$("#description p").css("font-size",size)};function getPageAds(pageNo){$("div[id^=Ad_No_]").html(" 请稍候，正在加载内容...");var url="/XHttpService/XHttp.ashx?t=ad&pageno="+pageNo+"&dt="+new Date();$.getJSON(url,function(data){if(data!=""){$.each(data,function(i,o){$("#Ad_No_"+o.id).html(o.content)})}})};function addFavorite(id){var url="/XHttpService/XHttp.ashx?t=addfav&id="+id;$.getJSON(url,function(data){if(data.status==200){alert(data.msg)}else if(data.status==100){$.colorbox({iframe:true,overlayClose:false,width:"520px",height:"430px",href:"LoginLite.aspx?runfun=addFavorite("+id+")"})}else{alert(data.msg)}})};function accordionMenus(){$("#accordion div").hide();$("#accordion div.current").show()};
