﻿//判断数字
function checkNum2(str)
{
	var Expression=/^[1-9]+(\d*$)/; 	
	var objExp=new RegExp(Expression);
	if(objExp.test(str)==false)
	{
		return true;
	}
	    return false;
}

//检测电话号码
function CheckNum(InputValue)
{		   
//		   var reg=/^([0-9]|[\-])+$/g ;
		   var reg=/(\d{3}-)?\d{8}|(\d{4}-)(\d{7})/;
		   var isValid
		   isValid=reg.exec(InputValue)
		   if (!isValid) {
		     return true
		   }
		   return false
}

//检测邮箱
function CheckEmail(InputValue)
{		   
		   var reg=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
		   var isValid
		   isValid=reg.exec(InputValue)
		   if (!isValid) {
		     return true
		   }
		   return false
}



//商品评论
function protxt()
{
    if($F('txtproC3')=='')
    {
        alert("对不起，您还什么都没填！");
    }
    else
    {
        var url='ms.aspx';
        var loginstr='addprotxt='+$F('txtProId')+'-'+$('txtProName').innerHTML+'-'+$('txtParId').innerHTML+'-'+$F('txtproC3')+'-'+'&time='+(new Date()).getTime();
        var myAjax=new Ajax.Request(
                url,{method:'POST',
                parameters: loginstr,
                onComplete: showms
                });

                function showms(ms)
                {
                    if(ms.responseText=="1")
                    {
                    alert("评论提交成功！");
                    clearjoin();
                    }
                    else if(ms.responseText=="2")
                    {
                        alert("您提交的评论内容中包含了危险字符，请重新发表评论！");
                        clearjoin(); 
                    }
                    else
                    {
                    alert("评论提交失败！");
                    clearjoin();        
                    }
                }
                
                function clearjoin()
                {
                    $('txtproC3').value = "";
                    $("txtproC3").focus();
                }
    }
}

//申请加盟
function AddJoin()
{

if($F('txtCompany')=="" || $F('txtAgent')=="" || $F('txtLxr')=="" || $F('txtTel')=="" || $F('txtFax')=="" || $F('txtEmail')=="" || $F('txtZip')=="" || $F('txtAddress')=="")
{
alert("请填写表单的所有内容！");
}
else if(CheckNum($F("txtTel")))
{
alert("您输入的联系电话格式不正确！");
$("txtTel").value = "";
$("txtTel").focus();
}
else
{
var tishi2=$('loadpic');
tishi2.style.display='';
var tishi=$('okbtn');
tishi.style.display='none';

var url='ms.aspx';
var loginstr='addjoinstr='+$F('txtCompany')+'-'+$F('txtAgent')+'-'+$F('txtLxr')+'-'+$F('txtTel')+'-'+$F('txtFax')+'-'+$F('txtEmail')+'-'+$F('txtZip')+'-'+$F('txtAddress')+'-'+$F('txtC')+'-'+$F('ntype')+'&time='+(new Date()).getTime();
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });

        function showms(ms)
        {
            if(ms.responseText=="1")
            {
            alert("提交成功！");
            tishi.style.display="";
            tishi2.style.display="none";
            clearjoin();
            
//            window.location.href="joinme.aspx";
            }
        
            else
            {
            alert("提交失败！"); 
            tishi.style.display=""; 
            tishi2.style.display="none";  
            clearjoin();        
            }
        }
        
        function clearjoin()
        {
        $('txtCompany').value = "";
        $('txtAgent').value = "";
        $('txtLxr').value = "";
        $('txtTel').value = "";
        $('txtFax').value = "";
        $('txtEmail').value = "";
        $('txtZip').value = "";
        $('txtAddress').value = "";
        $('txtC').value = "";
        }

}
}


//留言
function addguest()
{
if($F('txtname')=="")
{
alert("请输入您的姓名！");
$("txtname").focus();
}
else if($F("txttel")!="" && CheckNum($F("txttel")))
{
alert("您输入的联系电话格式不正确！");
$("txttel").value = "";
$("txttel").focus();
}
else if($F("txtC")=="")
{
alert("请输入留言的内容！");
$("txtC").focus();
}
else
{
var nsex = "2";
if($F('nsex1') != null)
{
nsex = "1";
}

var tishi=$('loadpic');
tishi.style.display='';

var url='ms.aspx';
var loginstr='gueststr='+$F('txtname')+'-'+$F('txttel')+'-'+$F('txtemail')+'-'+nsex+'-'+$F('txtqq')+'-'+$F('txtC')+'&time='+(new Date()).getTime();
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });

        function showms(ms)
        {
            if(ms.responseText=="1")
            {
            tishi.style.display="none";
            alert("留言提交成功！");
            clearguest(); 
//            locaton.href="guest.aspx";
            }
        
            else
            {
            tishi.style.display="none";
            alert("出错啦！");
            clearguest();           
            }
        }

}
}

//清空留言
function clearguest()
{
$('txtname').value = "";
$('txttel').value = "";
$('txtemail').value = "";
$('txtqq').value = "";
$('txtC').value = "";
$("txtname").focus();
}


function a ()
{
$('left_login').style.display="";
$('name1').value = "";
$('pwd1').value = "";
$('tishi').style.display="none";
}


//登录
function login()
{
if($F('name1')=="")
{
alert("用户名不能为空！");
$('name1').focus();
}
else if($F("pwd1")=="")
{
alert("密码不能为空！");
$('pwd1').focus();
}
else
{
$('login2').style.display="none";
var tishi=$('loading2');
tishi.style.display='';

var url='ms.aspx';
var loginstr='loginstr='+$F('name1')+'-'+$F('pwd1')+'&time='+(new Date()).getTime();
var uame=$F('name1');
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });

        function showms(ms)
        { 
            if(ms.responseText=="2")
            {
                alert("用户密码错误！");
                tishi.style.display='none';
                $('login2').style.display="";
                $('pwd1').value = "";
            }
            else if(ms.responseText=="0")
            {
                alert("用户名不存在！");
                tishi.style.display='none';
                $('login2').style.display="";
                $('name1').value = "";
                $('pwd1').value = "";
                $('name1').focus();
            }
            else if(ms.responseText=="-1")
            {
                alert("出错啦！");
                $('login2').style.display="";
                tishi.style.display='none';
                $('name1').value = "";
                $('pwd1').value = "";
                $('name1').focus();
            }
            else
            {
                $('lgtitle').innerHTML = "<img src='images/ligion_dian.jpg' style='vertical-align: middle;' />&nbsp;会员中心";
                $('login2').style.display="none";
                tishi.style.display='none';
                $('loginM').style.display='';
                $('loginM').innerHTML=ms.responseText;
            }
        }
        
//        function logining(log)
//        {
//        tishi.innerHTML="<div style=\"text-align:left; margin-left:30px; margin-top:30px; font-size:16px; line-height:200%;\">欢迎您，"+log+"<br /><a href=\"javascript:void(0);\" onclick='a();' >注销</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"guest.aspx\">用户信息反馈</a></div>";
////        $('huany').innerHTML="欢迎您，<font style='color:red;font-size:14px;'>"+log+"</font>";
//        }
}
}

function login2()
{
if($F('name1')=="")
{
alert("用户名不能为空！");
$('name1').focus();
}
else if($F("pwd1")=="")
{
alert("密码不能为空！");
$('pwd1').focus();
}
else
{
$('login2').style.display="none";
var tishi=$('loading2');
tishi.style.display='';

var url='ms.aspx';
var loginstr='loginstr='+$F('name1')+'-'+$F('pwd1')+'&time='+(new Date()).getTime();
var uame=$F('name1');
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });

        function showms(ms)
        {
        
            if(ms.responseText=="2")
            {
                alert("用户密码错误！");
                tishi.style.display='none';
                $('login2').style.display="";
                $('pwd1').value = "";        
            }
            else if(ms.responseText=="0")
            {
                alert("用户名不存在！");
                tishi.style.display='none';
                $('login2').style.display="";
                $('name1').value = "";
                $('pwd1').value = "";
                $('name1').focus();
            }        
            else if(ms.responseText=="-1")
            {
                alert("出错啦！");
                $('login2').style.display="";
                tishi.style.display='none';
                $('name1').value = "";
                $('pwd1').value = "";
                $('name1').focus();
            }
            else
            {  
                window.location.href="orderlist.aspx";
            }
        }
}
}



//退出
function Out()
{
$('loginM').style.display="none";
var tishi=$('loading2');
tishi.style.display='';
var url='ms.aspx';
var loginstr='outer=1';
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });
        function showms(ms)
        {
            if(ms.responseText == "1")
            {
                    $('lgtitle').innerHTML = "<img src='images/ligion_dian.jpg' style='vertical-align: middle;' />&nbsp;会员登录";
                    $('login2').style.display="";
                    tishi.style.display='none';
                    $('name1').value = "";
                    $('pwd1').value = "";
                    $('name1').focus();                    
            }
            else
            {
                alert("出错啦！");
            }
        }
}

//退出
function Out2()
{
$('loginM').style.display="none";
var tishi=$('loading2');
tishi.style.display='';
var url='ms.aspx';
var loginstr='outer=1';
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });
        function showms(ms)
        {
            if(ms.responseText == "1")
            {
                window.location.href="login.aspx";           
            }
            else
            {
                alert("出错啦！");
            }
        }
}

//判断登录状态
function panduan()
{
var url="Judgement.aspx?time="+(new Date()).getTime();
var loginstr='loginstr=1';
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: loginstr,
        onComplete: showms
        });
        
        function showms(ms)
        {
        if(ms.responseText!="2")
        {
        $('login').style.display="none";
        logining(ms.responseText);
        }
        else
        {
         $('login').style.display="";
        }
        }
        
        function logining(log)
        {
        $("logined").style.display="";
        $('huany').innerHTML="欢迎您，尊敬的<font style='color:red;font-size:14px;'>"+log+"</font>";
        }

}



//注册会员
function reZhuce()
{
    if($F('txtName')=="" || $F('txtPassword')=="" || $F('txtPassword2')=="" || $F('txtEmail')=="" || $F('txtQuestion')=="" || $F('txtAnswer')=="" || $F('txtRealname')=="" || $F('txtTel')=="")
    {
    alert("请填写带星号的项目！");
    }
    else if($F('txtName').length <2)
    {
    alert("用户名的长度不能小于2个字符！");
    $('txtName').value="";
    $('txtName').focus();
    }
    else if($F('txtPassword').length <6)
    {
    alert("密码的长度不能小于6个字符！");
    $("txtPassword").value = "";
    $("txtPassword2").value = "";
    $("txtPassword").focus();
    }
    else if($F('txtPassword')!=$F('txtPassword2'))
    {
    alert("两次密码输入不一致，请重新输入！");
    $("txtPassword").value = "";
    $("txtPassword2").value = "";
    $("txtPassword").focus();
    }
    else if(CheckNum($F("txtTel")))
    {
    alert("您输入的联系电话格式不正确！");
    $("txtTel").value = "";
    $("txtTel").focus();    
    }
    else if(CheckEmail($F('txtEmail')))
    {
        alert("您输入的电子邮箱格式不正确！");
        $("txtEmail").value = "";
        $("txtEmail").focus();
    }
    else
    {
    $("loadimg").style.display="";
    $("okbtn").style.display="none";
    $("clearbtn").style.display="none";
    var url="ms.aspx";
    var pars='memberstr='+$F('txtName')+'-'+$F('txtPassword')+'-'+$F('txtEmail')+'-'+$F('txtQuestion')+'-'+$F('txtAnswer')+'-'+$F('txtRealname')+'-'+$F('txtTel')+'-'+$F('txtOicq')+'-'+$F('txtAddress');
    var myAjax=new Ajax.Request(
            url,{method:'POST',
            parameters: pars,
            onComplete: showms
            });

            function showms(ms)
            {
                if(ms.responseText=="1")
                {
                   alert("注册成功！\r请登录！");
//                   clearinput();
                   window.location.href="login.aspx";
                }
                else if(ms.responseText=="0")
                {
                    alert("您输入的用户名已存在！\r请输入新的用户名！");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                    $("clearbtn").style.display="";
                    $('txtName').value="";
                    $('txtPassword').value="";
                    $('txtPassword2').value="";                    
                    $('txtName').focus();
                }
                else
                {
                    alert("注册失败");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                    $("clearbtn").style.display="";
                    clearinput();
                }
            }
            function clearinput()
            {
                $('txtName').value="";
                $('txtPassword').value="";
                $('txtPassword2').value=""
                $('txtEmail').value=""
                $('txtQuestion').value=""
                $('txtAnswer').value=""
                $('txtRealname').value=""
                $('txtTel').value=""
                $('txtOicq').value=""
                $('txtAddress').value=""
            }
    }
}


//会员资料
function reZhuce2()
{
    if($F('txtEmail')=="" || $F('txtQuestion')=="" || $F('txtAnswer')=="" || $F('txtRealname')=="" || $F('txtTel')=="")
    {
    alert("请填写带星号的项目！");
    }
    else if(CheckNum($F("txtTel")))
    {
    alert("您输入的联系电话格式不正确！");
    $("txtTel").value = "";
    $("txtTel").focus();    
    }
    else if(CheckEmail($F('txtEmail')))
    {
        alert("您输入的电子邮箱格式不正确！");
        $("txtEmail").value = "";
        $("txtEmail").focus();
    }
    else
    {
    $("loadimg").style.display="";
    $("okbtn").style.display="none";
    var url="ms.aspx";
    var pars='member2str='+$F('txtName')+'-'+$F('txtEmail')+'-'+$F('txtQuestion')+'-'+$F('txtAnswer')+'-'+$F('txtRealname')+'-'+$F('txtTel')+'-'+$F('txtOicq')+'-'+$F('txtAddress');
    var myAjax=new Ajax.Request(
            url,{method:'POST',
            parameters: pars,
            onComplete: showms
            });

            function showms(ms)
            {
                if(ms.responseText=="1")
                {
                   alert("资料修改成功！");
                   $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                }
                else
                {
                    alert("资料修改失败");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                }
            }
    }
}


//修改密码
function reZhuce3()
{
    if($F('txtoldsn')=="" || $F('txtnewsn')=="" || $F('txtnewsn2')=="" || $F('txtid')=="")
    {
    alert("请认真填写资料！");
    }
    else if($F('txtnewsn').length <6)
    {
    alert("密码的长度不能小于6个字符！");
    $("txtnewsn").value = "";
    $("txtnewsn2").value = "";
    $("txtnewsn").focus();
    }
    else if($F('txtnewsn')!=$F('txtnewsn2'))
    {
    alert("两次密码输入不一致，请重新输入！");
    $("txtnewsn").value = "";
    $("txtnewsn2").value = "";
    $("txtnewsn").focus();
    }
    else
    {
    $("loadimg").style.display="";
    $("okbtn").style.display="none";
    var url="ms.aspx";
    var pars='member3str='+$F('txtid')+'-'+$F('txtoldsn')+'-'+$F('txtnewsn')+'-'+$F('txtnewsn2');
    var myAjax=new Ajax.Request(
            url,{method:'POST',
            parameters: pars,
            onComplete: showms
            });

            function showms(ms)
            {
                if(ms.responseText=="1")
                {
                   alert("密码修改成功！");
                   $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                    $('txtoldsn').value="";
                    $('txtnewsn').value="";
                    $('txtnewsn2').value="";                    
                    $('txtoldsn').focus();
                }
                else if(ms.responseText=="0")
                {
                    alert("您输入原密码错误！");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                    $('txtoldsn').value="";
                    $('txtnewsn').value="";
                    $('txtnewsn2').value="";                    
                    $('txtoldsn').focus();
                }
                else
                {
                    alert("密码修改失败！");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                    $('txtoldsn').value="";
                    $('txtnewsn').value="";
                    $('txtnewsn2').value="";                    
                    $('txtoldsn').focus();
                }
            }
    }
}

//找回密码
//第一步
function foundsn1()
{
    if($F('txtname')=="")
    {
        alert("请输入用户名！");
    }
    else
    {
        $("loadimg").style.display="";
        $("okbtn1").style.display="none";
        var url="ms.aspx";
        var pars='member4str='+$F('txtname')+'-'+$F('txtQ')+'-'+$F('txtA')+'-'+$F('txtnew');
        var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: pars,
        onComplete: showms
        });

        function showms(ms)
        {
            if(ms.responseText=="1")
            {
               alert("该用户名不存在！");
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("okbtn2").style.display="";
               $("okbtn3").style.display="";
               $("fsn1").style.display="block";
               $("fsn2").style.display="none";
               $("fsn3").style.display="none";
               $('txtname').value="";
               $('txtQ').value="";
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtname').focus();
            }
            else if(ms.responseText=="0")
            {
               alert("出错啦！");
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("okbtn2").style.display="";
               $("okbtn3").style.display="";
               $("fsn1").style.display="block";
               $("fsn2").style.display="none";
               $("fsn3").style.display="none";
               $('txtname').value="";
               $('txtQ').value="";
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtname').focus();
            }
            else
            {
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("fsn1").style.display="none";
               $("fsn2").style.display="block";
               $("fsn3").style.display="none";
               $('txtQ').value=ms.responseText;
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtA').focus();
            }
        }
    }
}
//第二步
function foundsn2()
{
    if($F('txtname')=="")
    {
        alert("请输入用户名！");
        $("fsn1").style.display="block";
        $("fsn2").style.display="none";
        $("fsn3").style.display="none";
    }
    else if($F('txtQ')=="")
    {
        alert("起不对！该功能暂时无法使用！");
        $("fsn1").style.display="block";
        $("fsn2").style.display="none";
        $("fsn3").style.display="none";    
    }
    else if($F('txtA')=="")
    {
        alert("请输入您的密码答案！");
    }
    else
    {
        $("loadimg").style.display="";
        $("okbtn2").style.display="none";
        var url="ms.aspx";
        var pars='member4str='+$F('txtname')+'-'+$F('txtQ')+'-'+$F('txtA')+'-'+$F('txtnew');
        var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: pars,
        onComplete: showms
        });

        function showms(ms)
        {
            if(ms.responseText=="1")
            {
               alert("该用户名不存在！");
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("okbtn2").style.display="";
               $("okbtn3").style.display="";
               $("fsn1").style.display="block";
               $("fsn2").style.display="none";
               $("fsn3").style.display="none";
               $('txtname').value="";
               $('txtQ').value="";
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtname').focus();
            }
            else if(ms.responseText=="0")
            {
               alert("出错啦！");
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("okbtn2").style.display="";
               $("okbtn3").style.display="";
               $("fsn1").style.display="block";
               $("fsn2").style.display="none";
               $("fsn3").style.display="none";
               $('txtname').value="";
               $('txtQ').value="";
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtname').focus();
            }
            else if(ms.responseText=="2")
            {
               alert("您输入的密码答案错误！");
               $("loadimg").style.display="none";
               $("okbtn2").style.display="";
               $("fsn1").style.display="none";
               $("fsn2").style.display="block";
               $("fsn3").style.display="none";
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtA').focus();
            }
            else if(ms.responseText=="4")
            {
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("okbtn2").style.display="";
               $("okbtn3").style.display="";
               $("fsn1").style.display="none";
               $("fsn2").style.display="none";
               $("fsn3").style.display="block";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtnew').focus();
            }
            else
            {
               $("loadimg").style.display="none";
               $("okbtn1").style.display="";
               $("fsn1").style.display="none";
               $("fsn2").style.display="block";
               $("fsn3").style.display="none";
               $('txtQ').value=ms.responseText;
               $('txtA').value="";
               $('txtnew').value=""; 
               $('txtnew2').value="";          
               $('txtA').focus();
            }
        }
    }
}
//第三步
function foundsn3()
{
   if($F('txtname')=="" || $F('txtQ')=="" || $F('txtA')=="")
    {
        alert("起不对！该功能暂时无法使用！");
        $("fsn1").style.display="block";
        $("fsn2").style.display="none";
        $("fsn3").style.display="none";
        $('txtname').value="";
        $('txtQ').value="";
        $('txtA').value="";
        $('txtnew').value=""; 
        $('txtnew2').value="";          
        $('txtname').focus();
    }
    else if($F('txtnew').length <6)
    {
    alert("密码的长度不能小于6个字符！");
    $("txtnew").value = "";
    $("txtnew2").value = "";
    $("txtnew").focus();
    }
    else if($F('txtnew')!=$F('txtnew2'))
    {
    alert("两次密码输入不一致，请重新输入！");
    $("txtnew").value = "";
    $("txtnew2").value = "";
    $("txtnew").focus();
    }
    else
    {
            $("loadimg").style.display="";
            $("okbtn3").style.display="none";
            var url="ms.aspx";
            var pars='member4str='+$F('txtname')+'-'+$F('txtQ')+'-'+$F('txtA')+'-'+$F('txtnew');
            var myAjax=new Ajax.Request(
            url,{method:'POST',
            parameters: pars,
            onComplete: showms
            });

            function showms(ms)
            {
                if(ms.responseText=="1")
                {
                   alert("该用户名不存在！");
                   $("loadimg").style.display="none";
                   $("okbtn1").style.display="";
                   $("okbtn2").style.display="";
                   $("okbtn3").style.display="";
                   $("fsn1").style.display="block";
                   $("fsn2").style.display="none";
                   $("fsn3").style.display="none";
                   $('txtname').value="";
                   $('txtQ').value="";
                   $('txtA').value="";
                   $('txtnew').value=""; 
                   $('txtnew2').value="";          
                   $('txtname').focus();
                }
                else if(ms.responseText=="0")
                {
                   alert("出错啦！");
                   $("loadimg").style.display="none";
                   $("okbtn1").style.display="";
                   $("okbtn2").style.display="";
                   $("okbtn3").style.display="";
                   $("fsn1").style.display="block";
                   $("fsn2").style.display="none";
                   $("fsn3").style.display="none";
                   $('txtname').value="";
                   $('txtQ').value="";
                   $('txtA').value="";
                   $('txtnew').value=""; 
                   $('txtnew2').value="";          
                   $('txtname').focus();
                }
                else if(ms.responseText=="2")
                {
                   alert("您输入的密码答案错误！");
                   $("loadimg").style.display="none";
                   $("okbtn2").style.display="";
                   $("fsn1").style.display="none";
                   $("fsn2").style.display="block";
                   $("fsn3").style.display="none";
                   $('txtA').value="";
                   $('txtnew').value=""; 
                   $('txtnew2').value="";          
                   $('txtA').focus();
                }
                else if(ms.responseText=="4")
                {
                   $("loadimg").style.display="none";
                   $("okbtn1").style.display="";
                   $("okbtn2").style.display="";
                   $("okbtn3").style.display="";
                   $("fsn1").style.display="none";
                   $("fsn2").style.display="none";
                   $("fsn3").style.display="block";
                   $('txtnew').value=""; 
                   $('txtnew2').value="";          
                   $('txtnew').focus();
                }
                if(ms.responseText=="3")
                {
                   alert("密码修改成功！\n请重新登录！");
                   $("loadimg").style.display="none";
                   $("okbtn3").style.display="";
                   $("fsn1").style.display="block";
                   $("fsn2").style.display="none";
                   $("fsn3").style.display="none";
                   $('txtname').value="";
                   $('txtQ').value="";
                   $('txtA').value="";
                   $('txtnew').value=""; 
                   $('txtnew2').value="";          
                   $('txtname').focus();
                }
                else
                {
                   alert("出错啦！");
                   $("loadimg").style.display="none";
                   $("okbtn1").style.display="";
                   $("okbtn2").style.display="";
                   $("okbtn3").style.display="";
                   $("fsn1").style.display="block";
                   $("fsn2").style.display="none";
                   $("fsn3").style.display="none";
                   $('txtname').value="";
                   $('txtQ').value="";
                   $('txtA').value="";
                   $('txtnew').value=""; 
                   $('txtnew2').value="";          
                   $('txtname').focus();
                }
            }
    }
}


//产品订购
function orderpro()
{
    if($F('txtProId')=="")
    {
        alert("订购失败！");
    }
    else
    {
        $("piclo").style.display="inline";
        var url='ms.aspx';
        var loginstr='addordertemp='+$F('txtProId')+'&time='+(new Date()).getTime();
        var myAjax=new Ajax.Request(
                url,{method:'POST',
                parameters: loginstr,
                onComplete: showms
                });

                function showms(ms)
                {
                    if(ms.responseText=="1")
                    {
                        $("piclo").style.display="none";
                        alert("订购成功！");
                        window.open('ordertemp.aspx','_blank','directories=no,location=no,menubar=no,titlebar=no,toolbar=no,status=no,scrollbars=yes');
                    }
                    else if(ms.responseText=="3")
                    {
                        $("piclo").style.display="none";
                        alert("该商品已经放进您的购物车了！");
                        window.open('ordertemp.aspx','_blank','directories=no,location=no,menubar=no,titlebar=no,toolbar=no,status=no,scrollbars=yes');
                    }
                    else if(ms.responseText=="2")
                    {
                        $("piclo").style.display="none";
                        alert("请先到会员中心登录！");
                        window.open('login.aspx','_blank');
                    }
                    else
                    {
                        $("piclo").style.display="none";
                        alert("出错啦！");
                    }
                }
    }
}


//更新商品数量
function changenum(id)
{
    if($F('txtnum'+id)=="" || $F('txtprice'+id)=="")
    {
        alert("出错啦！");
    }
    else if($F('txtnum'+id)=="")
    {
        alert("请输入商品数量！");
        $('txtnum'+id).focus();
    }
    else if(checkNum2($F('txtnum'+id)))
    {
        alert("商品的数量请输入自然数！");
    }
    else
    {
        var url='ms.aspx';
        var loginstr='changenumtemp='+$F('txtid'+id)+'-'+$F('txtnum'+id)+'-'+$F('txtprice'+id)+'&time='+(new Date()).getTime();
        var myAjax=new Ajax.Request(
                url,{method:'POST',
                parameters: loginstr,
                onComplete: showms
                });

                function showms(ms)
                {
                    if(ms.responseText=="0")
                    {
                        alert("出错啦！");
                    }
                    else
                    {
                        $('txtall'+id).innerHTML=ms.responseText;
                        var oldprice = $('txt2all'+id).value;
                        $('txt2all'+id).value=ms.responseText;
                        $('proallprice22').value=($F('proallprice22')-0) - (oldprice-0) + ($F('txt2all'+id)-0);
                        $('proallprice2').innerHTML="合计："+ $F('proallprice22') + "元";
                    }
                }
    }
}


//提交订单
function addorder()
{
    if($F('txtname')=="" || $F('txttel')=="" || $F('txtemail')=="" || $F('txtaddress')=="")
    {
    alert("请填写带星号的项目！");
    }
    else if(CheckNum($F("txttel")))
    {
    alert("您输入的联系电话格式不正确！");
    $("txttel").value = "";
    $("txttel").focus();    
    }
    else if(CheckEmail($F('txtemail')))
    {
        alert("您输入的电子邮箱格式不正确！");
        $("txtemail").value = "";
        $("txtemail").focus();
    }
    else
    {
    $("loadimg").style.display="";
    $("okbtn").style.display="none";
    var ns = "1";
    if($F("sex2")!=null)
    {
        ns="2";
    }
    var npm = "1";
    if($F("pm1")!=null)
    {
        npm = "1";
    }
    else if($F("pm2") != null)
    {
        npm = "2";
    }
    else if($F("pm3") != null)
    {
        npm = "3";
    }
    else if($F("pm4") != null)
    {
        npm = "4";
    }
    else if($F("pm5") != null)
    {
        if($F("pm6") != null)
        {
            npm = $F("pm6");
        }
        else
        {
            npm = "5";
        }
    }
    var url="ms.aspx";
    var pars='addorderstr='+$F('txtname')+'-'+ns+'-'+$F('txttel')+'-'+$F('txtemail')+'-'+$F('txtzip')+'-'+$F('txtaddress')+'-'+$F('txtother')+'-'+$F('txtc')+'-'+npm;
    var myAjax=new Ajax.Request(
            url,{method:'POST',
            parameters: pars,
            onComplete: showms
            });

            function showms(ms)
            {
                if(ms.responseText=="1")
                {
                   alert("订单提交成功！\r我们马上会处理您的订单！");
                   window.opener=null; 
                   window.open('','_self'); 
                   window.close();
                }
                else if(ms.responseText=="0")
                {
                    alert("打单提交失败！");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                }
                else
                {
                    alert("打单提交失败！");
                    $("loadimg").style.display="none";
                    $("okbtn").style.display="";
                }
            }
    }
}



//你前边的两个变量赋值恐怕不是这样的吧？   
//  请先进行类型转换   
//    
//  c   =   parseInt(a)   +   parseInt(b)   
