﻿  function CheckName()
    { 
    
        var username=$("input[id*=txtusername]").get(0);
        
        if(username.value=="")
        {
        
           $.prompt("用户名不能为空！", { "title": "友请提示", "timeout": 1000 });
           return false;
         
        }
         var test=/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
         if(!test.test(username.value)){
          
            $.prompt("邮箱格式错误！", { "title": "友请提示", "timeout": 1000 });
            return false;
            }
           
        
        var param={'op':1,'userName':escape(username.value)}
     
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                
                $.prompt("此用户名已被注册，请重新填写！", { "title": "友请提示", "timeout": 2000 });
               return false;
            }else if(data==1){
                 return true;
            }
        });  
        
        
    }
    function CheckEmail()
    { 
    
        var username=$("input[id*=txt_email]").get(0);
        
        if(username.value=="")
        {
        
           $.prompt("邮箱为您找回密码的途径，不能为空！", { "title": "友请提示", "timeout": 1000 });
           return false;
         
        }
        var test=/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
         if(!test.test(username.value)){
          
            $.prompt("邮箱格式错误！", { "title": "友请提示", "timeout": 1000 });
            return false;
            }
            else{ return true;}
            
            
      
        
        
    }
    function CheckPwd0()
    {
        var pwd0=$("input[id*=txtuserpwd0]").get(0);
        if(pwd0.value=="")
        {
        $.prompt("密码不能为空！", { "title": "友请提示", "timeout": 2000 });
          
           return false;
         
        }
       
         if(pwd0.value.length<6){
           $.prompt("密码长度不能小于6！", { "title": "友请提示", "timeout": 2000 });
           
           return false;
        }
        else{
             return true;
        }
        
        
    }
    function CheckPwd1()
    {
        var pwd0=$("input[id*=txtuserpwd0]").get(0);
        var pwd1=$("input[id*=txtuserpwd1]").get(0);
        if(pwd1.value!=pwd0.value)
        { 
        
        $.prompt("2次密码不一致！", { "title": "友请提示", "timeout": 2000 });
            
           return false;
        }
        else
        {
            return true;
        }
    }
    function btnsend()
    {
        if(CheckName()==false)
        {
            CheckName();
            return false;
        }
        if(CheckPwd0()==false)
        {
            CheckPwd0();
            return false;
        }
        if(CheckPwd1()==false)
        {
            CheckPwd1();
            return false;
        }
      
        
      
      
        var code=$("input[id*=txtcode]").get(0);
        var username=$("input[id*=txtusername]").get(0);
        var pwd=$("input[id*=txtuserpwd0]").get(0);
        var param={'op':2,'userName': escape(username.value),'userPwd': escape(pwd.value),'Code': escape(code.value)};
        $.prompt("正在提交信息,请稍后...", { "title": "友请提示", "timeout": 600000 });
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                $.prompt.close();
                $.prompt("验证码错误", { "title": "友请提示", "timeout": 1000 });
      
            }else if(data==1){
                 $.prompt.close();
                 $.prompt("恭喜您注册成功", { "title": "友请提示", "timeout": 1000 });
                window.location.href="index.html";
            }
            else if(data==2)
            {
                 $.prompt.close();
                 $.prompt("网络繁忙请稍后再试", { "title": "友请提示", "timeout": 2000 });
            }
        });  
    }
    
function btnLogin() {
    var username = $("input[id*=tb_username]").get(0);
    var pwd = $("input[id*=tb_pwd]").get(0);
    if (username.value == "") {

        $.prompt("用户名不能为空", {
            "title": "友请提示",
            "timeout": 1000
        });
        return false;

    }
    if (pwd.value == "") {
        $.prompt("密码不能为空", {
            "title": "友请提示",
            "timeout": 1000
        });

        return false;

    }
    //var code = $("input[id*=tb_code]").get(0).value;
    $.prompt("正在提交信息,请稍后...", {
        "title": "友请提示",
        "timeout": 600000
    });

    var param = {
        'op': 3,
        'userName': escape(username.value),
        'userPwd': escape(pwd.value)
       // 'Code': escape(code)
    };
    $.getJSON("ajax/Handler.ashx?Math=" + Math.random(), param,
    function(data) {
       
        if (data == 0) {

            $.prompt.close();
            $.prompt("验证码不正确", {
                "title": "友请提示",
                "timeout": 6000
            });
        } else if (data == 1) {
            $.prompt.close();
            $.prompt("密码不正确", {
                "title": "友请提示",
                "timeout": 1000
            });
        } else if (data == 2) {
            $.prompt.close();

            $.prompt("恭喜您登录成功", {
                "title": "友请提示",
                "timeout": 1000
            });

            if (getQueryString("url") == null) {
                window.location.href = "index.html";
            } else {
                window.location.href = getQueryString("url");
            }

        } else if (data == 3) {
            $.prompt.close();
            $.prompt("用户不存在", {
                "title": "友请提示",
                "timeout": 1000
            });
        }
    });

}
    
    
    
    function articlelistsearch()
    {
        var kerword=document.getElementById("txt_key_1").value;
        if(document.getElementById("Radio1").checked==true)
        {
            window.location.href="articlelist_"+encodeURI(kerword)+"_1.html";
        }
         if(document.getElementById("Radio2").checked==true)
        {
            window.location.href="articlelist_"+encodeURI(kerword)+"_2.html";
        }
    }
    
   
       function checknum()
        {
           var count= document.getElementById("input_goods_buy_number").value;
           if(count=="0")
           {
                
                $.prompt("输入格式错误,只能为大于0的整数", { "title": "友请提示", "timeout": 1000 });
                document.getElementById("input_goods_buy_number").value="1";
                return false;
           }
           var reg=/^(0|([1-9]\d*))$/;
           if(!reg.test(count))
           {
           
                 $.prompt("输入格式错误,只能为大于0的整数", { "title": "友请提示", "timeout": 1000 });
                document.getElementById("input_goods_buy_number").value="1";
                return false;
           }
           var Storage_hondu=document.getElementById("Storage_hondu").value;
           
           if(parseInt(count)>parseInt(Storage_hondu))
           {
                
                 $.prompt("库存不足", { "title": "友请提示", "timeout": 1000 });
                 document.getElementById("input_goods_buy_number").value="1";
                return false;
           }
          
           return true;
        }
        
      



 function getprice(val,price,weight,Name)
     {
     
    var param={'op':4,'AreaID':val,'price':price,'weight':weight};
        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
        
           document.getElementById("showPrice").innerHTML=" ：申通快递:"+data.txtFeeSTO+" 顺风:"+data.txtFeeSF+" <br />&nbsp;&nbsp;圆通快递:"+data.txtFeeYTO+" EMS："+data.txtFeeEMS;
        });
        
        document.getElementById("Span1").innerHTML=Name;
        offarea();
     }
     
function secBoard(elementID, listName, n,menuId) {
    for (var i = 1; i < (8); i++) {
        $("#" + listName + "_" + i).css("display", "none")
        
    }
    $(".p_more_titel ul li a ").removeClass("on");
    $("#" + listName + "_" + n).css("display", "")
    $(menuId).addClass("on");
    
}
    function show(val)
    {
       if(document.getElementById("show"+val).style.display=="none")
       {
            document.getElementById("show"+val).style.display="block";
       }
       else
       {
            document.getElementById("show"+val).style.display="none";
       }
    }

    function addcart(val, type, Propertys) {
    var buycount = document.getElementById("input_goods_buy_number");
    var corlor = document.getElementById("color_hide").value;
    //var size=document.getElementById("size_hide").value;
    //alert(corlor);
    if (Propertys != 1) {
        if (corlor == "0") {
                $.prompt("请选择颜色", {
                "title": "友请提示",
                "timeout": 6000,
                buttons: { Ok: true }
                });
                return;
            }
        }
        if (!checknum()) {
            return;
        }
        $.prompt("正在加入购物车请稍后", {
            "title": "友请提示",
            "timeout": 6000
        });

        if (buycount == null) {
            buycount = 1;
        } else {
            buycount = buycount.value;
        }

        var param = {
            'op': 5,
            'proid': val,
            'buycount': buycount,
            'corlor': escape(corlor)
        };
        $.getJSON("/ajax/Handler.ashx?Math=" + Math.random(), param,
        function(data) {

            if (data == 0) {
                $.prompt.close();
                $.prompt("请先登再购买,<a href='logoin.html?url=" + window.location.href + "' style='color:Red;'>点击跳转登录页面</a>", {
                    "title": "友请提示",
                    closed: function() {
                        location.href = "logoin.html?url=" + window.location.href;
                    }
                });
                return false;
            } else if (data == 1) {

                if (type == 1) {
                    $.prompt.close();
                    gettopcart();
                    $.prompt("已成功加入购物车", {
                        "title": "友请提示",
                        "timeout": 1000
                    });
                } else if (type == 0) {
                    $.prompt.close();
                    $.prompt("即将跳转结算页面", {
                        "title": "友请提示",
                        "timeout": 1000
                    });
                    window.location.href = "cartstep.html";
                }
            } else {

                $.prompt.close();
                $.prompt("系统繁忙请稍后再试", {
                    "title": "友请提示",
                    "timeout": 2000
                });
            }
        });

    }

    function addCollect(val) {

        $.prompt("正在加入收藏请稍后", {
            "title": "友请提示",
            "timeout": 600000
        });
        var param = {
            'op': 6,
            'proid': val
        };
        $.getJSON("/ajax/Handler.ashx?Math=" + Math.random(), param,
        function(data) {

            if (data == 0) {

                $.prompt.close();
                $.prompt("请先登再购买,<a href='logoin.html?url=" + window.location.href + "' style='color:Red;'>点击跳转登录页面</a>", {
                    "title": "友请提示",
                    "timeout": 2000
                });
                location.href = "logoin.html?url=" + window.location.href;
                return false;
            } else if (data == 1) {

                $.prompt.close();
                $.prompt("添加成功", {
                    "title": "友请提示",
                    "timeout": 1000
                });
            } else {

                $.prompt.close();
                $.prompt("系统繁忙请稍后再试", {
                    "title": "友请提示",
                    "timeout": 1000
                });
            }
        });
    }
      
      var DG = frameElement.lhgDG;
      function addtrial(val)
      {
        var content=document.getElementById("textarea_consultation_content").value;
        var code=document.getElementById("txtcode").value;
        var name=document.getElementById("txt_name").value;
        var phone=document.getElementById("txt_phone").value;
        var email=document.getElementById("txt_email").value;
        if(name=="")
        {
            alert("请填写您的称呼");
            return;
        }
        if(phone=="")
        {
            alert("请填写您的手机号码");
            return;
        }
        var reg=/^(13[0-9]{9})|(15[89][0-9]{8})$/;
        if(reg.test(phone)==false)
        {
            alert("手机号码格式错误");
            document.getElementById("txt_phone").value="";
            return;
        }

        if(email=="")
        {
            alert("请填写您的电子邮件");
            return;
        }
        var regEmail= /\w@\w*\.\w/;
        if(regEmail.test(email)==false)
        {
            alert("邮箱格式错误");
            document.getElementById("txt_email").value="";
            return;
        }
        if(content=="")
        {
            alert("申请理由不能为空");
            return;
        }
        if(content.length>2000)
        {
            alert("输入字符过长");
            return;
        }
        if(code=="")
        {
            alert("请输入验证码");
            return;
        }
        var param={'op':18,'proid':val,'content':escape(content),'code':code,'name':escape(name),'phone':escape(phone),'email':escape(email)};
     
        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
               alert("请先登录后再操作")
               return false;
            }else if(data==1){
                alert("提交成功");
                var DG = frameElement.lhgDG;
                DG.cancel();
            }
            else if(data==2)
            {
                alert("系统繁忙请稍后再试");
            }
            else if(data==3)
            {
                alert("验证码错误");
            }
        });  
      }
       function addzixun(val)
      {
        var content=document.getElementById("textarea_consultation_content").value;
        var type = $("input[@name='input_consultation_type']:checked").val();
        var code=document.getElementById("txtcode").value;
        if(content=="")
        {
            alert("咨询内容不能为空");
            return;
        }
        if(content.length>250)
        {
            alert("输入字符过长");
            return;
        }
        if(code=="")
        {
            alert("请输入验证码");
            return;
        }
        var param={'op':7,'proid':val,'content':escape(content),'code':code,'type':type}
     
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                alert("请先登再咨询");
               
               return false;
            }else if(data==1){
                alert("提交成功");
                
            }
            else if(data==2)
            {
                alert("系统繁忙请稍后再试");
            }
            else if(data==3)
            {
                alert("验证码错误");
            }
        });  
      }
      
      function addProduct_pl(val)
      {
        var content=document.getElementById("txt_pl_content").value;
        var code=document.getElementById("txt_pl_code").value;
        if(content=="")
        {
            alert("评论内容不能为空");
            return;
        }
        if(content.length>1000)
        {
            alert("输入字符过长");
            return;
        }
        if(code=="")
        {
            alert("请输入验证码");
            return;
        }
        var param={'op':19,'proid':val,'content':escape(content),'code':code}
     
        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                alert("请先登再评论");
               
               return false;
            }else if(data==1){
                alert("提交成功");
               
            }
            else if(data==2)
            {
                alert("系统繁忙请稍后再试");
            }
            else if(data==3)
            {
                alert("验证码错误");
            }
        });  
      }
    function opdg( id ){ 
            
       var param={'op':23}
     
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                
                $.prompt("请先登再购买,<a href='/logoin.html?url="+window.location.href+"'>点击跳转登录页面</a>", { "title": "友请提示",  closed: function() {  location.href = "logoin.html?url="+window.location.href; }});
                
               return false;
            }
            else
            {
                 var dg = new J.dialog({ page:'proask.aspx?id='+id+'',width:720, height:275,title:'商品咨询',btnBar:false, cover:true,lockScroll:true ,iconTitle:false});
        dg.ShowDialog(); 
            }
        });  
            
       
        }
        
    function GetProdurs($Fields,$Orderby,$Showpagecount,$Currenpage,$Htmlstyle){
    
	$.ajax({
		url:"/Interchange/Command.aspx?fields="+$Fields+"&orderby="+$Orderby+"&showpagecount="+$Showpagecount+"&page="+$Currenpage+"&htmlstyle="+$Htmlstyle,
		type:'GET',
		success:function(){
			$('#ProductWindow').html(arguments[0]);
		}
	});
}

  function newslook(val)
        {
       
            window.location.href="/trial_show"+val+".html";
        }
        
  function opdg_try( id ){ 
  
  
  var param={'op':23}
     
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                
                $.prompt("请登录后再操作！", { "title": "友请提示",  closed: function() {  location.href = "login.html?url="+window.location.href; }});
                
               return false;
            }
            else
            {
                 var dg = new J.dialog({ id:id, page:'Apply.aspx?id='+id+'',width:730, height:360,title:'商品试用申请',btnBar:false, cover:true,lockScroll:true ,iconTitle:false}); 
                dg.ShowDialog(); 
            }
        });  
   
        }
        
        
        
     function getprolist(filds,orderby,pagesize,table,pagecurt,where,KeyField,val)
    {
            
        for(var i=1;i<4;i++)
        {
            if(i==val)
            { 
                document.getElementById("tab_to_"+val).className="no";
            }
            else
            {
                document.getElementById("tab_to_"+i).className="";
            }
           
        }
        
        var param={'op':8,'filds':filds,'orderby':orderby,'pagesize':pagesize,'table':table,'pagecurt':pagecurt,'where':where,'KeyField':KeyField};
        
        var html="";

        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(date){
                
               $.each(date,function(index,value){
               
             
                  html +="<li><table class=\"C-P\"><tr><td class=\"th1\"> <a href=\"/product"+value.id+".html\" target='_blank'><img src=\"upfiles/"+value.SrcDetail_hondu+"\" alt=\""+value.Name_hondu+"\" width=\"145px\" height=\"149px\" /></a></td></tr><tr><td class=\"th2\" style=\"height: 40px;\" valign='middle' align='center'><a href=\"/product"+value.id+".html\" target='_blank'>"+value.Name_hondu+"</a> </td></tr><tr><td class=\"th3\" valign='middle' align='center'>本店售价 <font>￥"+value.MemberPrice_hondu+"</font></td></tr> <tr> <td class=\"th4\" valign='middle' align='center'> 已销售<font>"+value.BuyCount_hondu+"</font>件 已有 <font>  "+value.ReviewCount_hondu+"</font>评价  </td></tr> <tr><td class=\"cp_but\"  valign='middle' align='center'><div><a href=\"product"+value.id+".html\">购买</a> <a href=\"javascript:void(0)\" onclick=\"addCollect('"+value.id+"');\">收藏</a><a  onclick=\"opdg('"+value.id+"');\" style=\"cursor:pointer;\">留言</a></div> </td></tr></table></li>";
                  
               });
               
               $('#ProductWindow').html(html);
      });
        
        
    }
    
    
     function ischangepro(val)
            {
               
                var param={'op':20,'pro_id':val};
                $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
              
                if(data==0)
                {  
                   
                    document.getElementById("nomalshow").style.display="block";
                    document.getElementById("pointshow").style.display="none";
                }
                else if(data==1)
                {
                   document.getElementById("nomalshow").style.display="none";
                   document.getElementById("pointshow").style.display="block";
                }
          
               });  
            }
            
            
            
  function sendpwdemail()
    {
        var username= document.getElementById("username").value;
        var code=document.getElementById("code").value;
        if(username.length==0)
        {
            alert("注册帐号不能为空");
            return false;
        }
          var test=/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
         if(!test.test(username)){
           alert("邮箱格式错误");
           
            return false;
        }
        
        $.prompt("正在发送邮件", { "title": "友请提示", "timeout": 6000000 });
       
        var param={'op':21,'username': escape(username),'code':code}
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                $.prompt.close();
                $.prompt("发送失败", { "title": "友请提示", "timeout": 1000 });
               
            }else if(data==1){
                $.prompt.close();
                $.prompt("密码已发送到您的邮箱中请注意查收", { "title": "友请提示", "timeout": 1000 });
                   
            }
            else if(data==2)
            {
                $.prompt.close();
                $.prompt("帐号不存在", { "title": "友请提示", "timeout": 1000 });
                
            }
            else if(data==3)
            {
                $.prompt.close();
                $.prompt("验证码错误", { "title": "友请提示", "timeout": 1000 });
            }
        });  
    }      
    
    
     function getprolistother(filds,orderby,pagesize,table,pagecurt,where,KeyField)
    {
        var param={'op':8,'filds': escape(filds),'orderby':escape(orderby),'pagesize':escape(pagesize),'table':escape(table),'pagecurt':escape(pagecurt),'where':escape(where),'KeyField':escape(KeyField)};
        
        var html="";

        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(date){
                
               $.each(date,function(index,value){
               
             
                  html +="<li><table class=\"C-P\"><tr><td class=\"th1\"> <a href=\"product"+value.id+".html\" target='_blank'><img src=\"upfiles/"+value.SrcDetail_hondu+"\" alt=\""+value.Name_hondu+"\" width=\"145px\" height=\"149px\" /></a></td></tr><tr><td class=\"th2\" style=\"height: 40px;\" valign='middle' align='center'><a href=\"product"+value.id+".html\" target='_blank'>"+value.Name_hondu+"</a> </td></tr><tr><td class=\"th3\" valign='middle' align='center'>本店售价 <font>￥"+value.MemberPrice_hondu+"</font></td></tr> <tr> <td class=\"th4\" valign='middle' align='center'> 已销售<font>"+value.BuyCount_hondu+"</font>件 已有 <font>  "+value.ReviewCount_hondu+"</font>评价  </td></tr> <tr><td class=\"cp_but\" valign='middle' align='center'><div> <a href=\"product"+value.id+".html\">购买</a> <a href=\"javascript:void(0)\" onclick=\"addCollect('"+value.id+"');\">收藏</a> <a onclick=\"opdg('"+value.id+"');\" style=\"cursor:pointer;\">留言</a></div> </td></tr></table></li>";
                  
               });
               
               $('#ProductWindow').html(html);
      });
        
        
    }
  
  function gotoreg(val,orderid)
        {
            
           var param={'op':23};
     
        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
                
                $.prompt("请先登再购买,<a href='/reg.html?url="+window.location.href+"' style='color:Red;'>点击跳转登录页面</a>", { "title": "友请提示",  closed: function() {  location.href = "/reg.html?url="+window.location.href; }});
                
               return false;
            }
            else
            {
                if(val==1)
                {
                    getPrice();
                    document.getElementById("show").style.display="block";
                }
                else
                {
                    document.getElementById("show").style.display="block";
                    if(val==3)
                    {
                    
                        var param={'op':24,'orderID':orderid};
                        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
               
                if(data==0)
                {
                    document.getElementById("pay_1").style.display="none";
                    document.getElementById("pay_2").style.display="none";
                }
                else
                {
                    document.getElementById("pay_1").style.display="block";
                    document.getElementById("pay_2").style.display="block";
                }
                    
               })
                    }
                }
            }
        });  
        }
        
      
        
        function getQueryString(name) 
        {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg); 
            if (r != null) 
            return unescape(r[2]);
            return null;
        }
          function prosearch()
            {
                var kerword=document.getElementById("txt_search_pro").value;
                window.location.href="search"+kerword+".html";

            }   
            
function changeimage(val)
{
document.getElementById("pro_image").src=val;
} 

/*haiwa@2004-02-12*/  
function Trim(strValue)  
{  
return strValue.replace(/^\s*|\s*/g,"");  
}  
function SetCookie(sName, sValue)  
{  
document.cookie = sName + "=" + escape(sValue);  
}  

function GetCookie(sName)  
{  
var aCookie = document.cookie.split(";");  
for (var i=0; i < aCookie.length; i++)  
{  
var aCrumb = aCookie[i].split("=");  
if (sName == Trim(aCrumb[0]))  
{  
return unescape(aCrumb[1]);  
}  
}  

return null;  
}  
function scrollback()  
{  
if (GetCookie("scroll")!=null){document.documentElement.scrollTop=GetCookie("scroll")}  
}
 function changcorlor(val,id,imgsrc)
            {
                var li=document.getElementById("myForm").getElementsByTagName("span");
                for(var i=0;i<li.length;i++)
                { li[i].className="none";}
                document.getElementById("sp_"+id).className="choose_color_check";
                document.getElementById("color_hide").value=id;
                if(imgsrc!="upfiles/"){
                changeimage(imgsrc);
                }

            }
            function changsize(val)
            {
                var li=document.getElementById("mysize").getElementsByTagName("li");
                for(var i=0;i<li.length;i++)
                {
                   
                   if(val==li[i])
                   {
                       
                       li[i].className="size_check";
                       document.getElementById("size_hide").value=val.title;
                       
                   }
                   else
                   {
                         li[i].className="size_none";
                   }
                }

            }
    function Mail_subscription(val)
        {
            var email=document.getElementById("txt_email").value;
            if(email=="")
            {
                alert("请填写的邮箱");
                return false;
            }
            var test=/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
         if(!test.test(email)){
           document.getElementById("txt_email").value="";
           alert("邮箱格式错误");
            
            return false;
           }
            var param={'op':27,'user_email':escape(email),'type':val};
            $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){ 
                    if(data==0)
                    {
                         alert("订阅失败");
                         return false;
                    }
                    else if(data==1)
                    {
                        alert("订阅成功");
                        return true;
                    }
             });  
        }
        
        
 function  gettopcart()
  {
  
      var param={'op':28};
      var html="";
        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
            if(data==1||data==0)
            {
                document.getElementById("cart_pro_count").innerHTML=0;
            }
            else
            {
             $.each(data,function(index,value)
             {
                if(value.IsScore_hondu==0)
                {
                 html+="<tr id=\"tr_"+value.ID+"\"><td style=\"width: 20%; height: 60px;\" valign=\"middle\" align=\"center\"><img src=\"/upfiles/"+value.Src_hondu+"\" width=\"50\"  height=\"50\" /> </td><td style=\"width: 60%\" align=\"left\"><a href='/product"+value.ProductID_hondu+".html'>"+value.Name_hondu+"</a></td><td style=\"width: 20%\" align=\"right\"><span style=\"color:Red; font-weight:bold\">￥"+value.OrderPrice_hondu+"×"+value.Count_hondu+"</span><br /><a href='javascript:void(0)' onclick=\"removeRow_top("+value.ID+");\"> 删除</a></td></tr>";
                 }
                 else
                 {
                     html+="<tr id=\"tr_"+value.ID+"\"><td style=\"width: 20%; height: 60px;\" valign=\"middle\" align=\"center\"><img src=\"/upfiles/"+value.Src_hondu+"\" width=\"50\"  height=\"50\" /> </td><td style=\"width: 60%\" align=\"left\"><a href='/product"+value.ProductID_hondu+"_isscore.html'>"+value.Name_hondu+"</a></td><td style=\"width: 20%\" align=\"right\"><span style=\"color:Red; font-weight:bold\">￥"+value.OrderPrice_hondu+"×"+value.Count_hondu+"</span><br /><a href='javascript:void(0)' onclick=\"removeRow_top("+value.ID+");\"> 删除</a></td></tr>";
                 }
             });
              var parame={'op':14};
              
              $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),parame,function(date){
                 document.getElementById("cart_pro_count").innerHTML=date.pro_count;
                 html+="<tr><td colspan=\"3\">共<span style=\"color: Red; font-weight: bold\" id=\"cart_pro_count_one\">"+date.pro_count+"</span>件商品金额总计：<span style=\"color: Red; font-weight: bold\" id=\"cart_pro_price\">￥"+date.total_price+"</span><a href=\"/cart.html\"><img src=\"/images/gotocart.png\" style=\"float: right;\" /></a> </td></tr>";
                 $('#ShopCart_top').html(html);
             });
            
           }
          
           
        }); 
       
  }
 function removeRow_top(val){
    var row=document.getElementById("tr_"+val); 
    var index=row.rowIndex;
     var param={'op':13,'cart_id':val};
                 $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
                    if(data==1)
                    {
                      document.getElementById("ShopCart_top").deleteRow(index); 
                      gettopcart();
                    }
                 });  
 } 
  function show_cart(){
    
           var param={'op':23};
     
            $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
            if(data!=0){
                
                    var param={'op':14};
                        $.getJSON("/ajax/Handler.ashx?Math="+Math.random(),param,function(data){
                        if(data.pro_count==0)
                        {
                            document.getElementById("showcart").style.display="none";
                            return;
                        }
                        else
                        {
                            document.getElementById("showcart").style.display="block";
                        }
                       
                    })
                }
                else
                {
                    
                }
            })
	   
	    
	}
    function off_cart(){
	    var con = document.getElementById("showcart");
	    con.style.display = "none";
	}
var timer;

function secBoard1(elementID, listName, n, menuid) {
    var elem = document.getElementById(elementID);
    var elemlist = elem.getElementsByTagName("li");
    for (var i = 0; i < elemlist.length; i++) {
        var m = i + 1;
        document.getElementById(listName + m).style.display = "none";
        menuid.removeClass("on")
    }

    document.getElementById(listName + n).style.display = "block";
    menuid.addClass("on");

}
 function addcomplaint()
        {
           var title=document.getElementById("txt_title").value;
           var name=document.getElementById("txt_name").value;
           var tel=document.getElementById("txt_tel").value;
           var email=document.getElementById("txt_email").value;
           var address=document.getElementById("txt_address").value;
           var content=document.getElementById("txt_content").value;
        if(title=="")
        {
            alert("请填写主题");
            return;
        }
        if(name=="")
        {
            alert("请填写姓名");
            return;
        }
        if(tel=="")
        {
            alert("请填写您的电话号码");
            return;
        }
       
        var reg=/((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/;
        if(reg.test(tel)==false)
        {
            alert("电话号码格式错误");
            document.getElementById("txt_phone").value="";
            return;
        }

        if(email=="")
        {
            alert("请填写您的电子邮件");
            return;
        }
        var regEmail= /\w@\w*\.\w/;
        if(regEmail.test(email)==false)
        {
            alert("邮箱格式错误");
            document.getElementById("txt_email").value="";
            return;
        }
        if(content=="")
        {
            alert("反馈信息不能为空");
            return;
        }
        if(content.length>2000)
        {
            alert("反馈信息输入字符过长");
            return;
        }
          var param={'op':18,'title':escape(title),'name':escape(name),'tel':escape(tel),'email':escape(email),'address':escape(address),'content':escape(content)};
     
        $.getJSON("ajax/Handler.ashx?Math="+Math.random(),param,function(data){
       
            if(data==0){
               alert("请先登录后再操作")
               return false;
            }else if(data==1){
                alert("提交成功");
               
            }
            else if(data==2)
            {
                alert("系统繁忙请稍后再试");
            }
           
        });  
     }
