
function login(){var username="";var password="";username=document.getElementById("username").value;password=document.getElementById("password").value;if(username==""){alert("用户名不能为空");return false;}
if(password==""){alert("密码不能为空");return false;}
userAction.dwrLogin(username,password,{callback:function(str){if(str=="1")
alert("用户名或者密码错误");if(str=="3")
alert("该账户已经登陆,不能重复登录!");if(str=="4"){window.location.reload();}}});}
function regUser(){var email=document.signinform.email.value;var name=document.signinform.name.value;var spellName=document.signinform.spellName.value;var tel=document.signinform.tel.value;var mobile=document.signinform.mobile.value;var comment=document.signinform.comment.value;if(name==""||name.length<2){alert("请输入真实姓名");return;}
if(spellName==""||spellName.length<2){alert("请输入拼音姓名");return;}
if(mobile==""||mobile.length!=11){alert("手机号不正确");return;}
showHideStyle(2,1,3);userAction.dwrFireWebReg(name,spellName,mobile,tel,email,comment,{callback:function(str){var brands=new Array();brands=str.split("&");str=brands[0];if(str=="doubleAccount")
{alert("该用户名已经存在");}
else if(str=="fail")
alert("注册失败");else if(str=="exception")
alert("获取远程服务器账户错误,请稍后重试");else if(str=="success"){window.location="../simsuccess/result.jsp?account="+brands[1]+"";return;}
else
{alert("提交不成功,请重试");}
showHideStyle(1,2,3);}});}
function showHideStyle(a,b,c){document.getElementById("sign"+a).style.display="block";document.getElementById("sign"+b).style.display="none";document.getElementById("sign"+c).style.display="none";}
function materialnumber(id,herf){knowledgeAction.dwrMaterialnumber(id,herf,{callback:function(str){if(str=="1")
{alert("对不起！没有找到该文件");}
else{window.location=herf;}}});}
function booknumber(id,herf){knowledgeAction.dwrBook(id,herf,{callback:function(str){if(str=="1")
{alert("对不起！没有找到该文件");}
else{window.location=herf;}}});}
function searchAll(){if(document.searchformall.searchrName.value==""){alert("请填写搜索内容");document.searchformall.searchKey.focus();return false;}
document.searchformall.submit();}
function dwrloginxixi(){userAction.dwrloginxixi({callback:function(str){if(str!=""){document.getElementById("loginxinxi").innerHTML=str;}}});}
function agreementClass(type){tradingTypeAction.dwrAgreement(type,{callback:function(str){document.getElementById("dweag").innerHTML=str;}});}
function dwrAgreementlist(type){tradingTypeAction.dwrAgreementlist(type,{callback:function(str){document.getElementById("dweaglist").innerHTML=str;}});}
function viewagreement(id){tradingTypeAction.dwrViewAgreement(id,{callback:function(str){document.getElementById("dwrviewag").innerHTML=str;}});}
function regLoginUser(){var userName=document.signinform.userName.value;var pwd=document.signinform.pwd.value;var rpwd=document.signinform.rpwd.value;var name=document.signinform.name.value;var email=document.signinform.email.value;var cellphone=document.signinform.cellphone.value;var telephone=document.signinform.telephone.value;var validateImg=document.signinform.validateImg.value;if(userName==""||userName.length<2){alert("请输入用户名");return;}
if(pwd==""||pwd.length<6){alert("请输入密码或密码必须为六位以上");return;}
if(rpwd==""||rpwd.length<6){alert("请输入确认密码或确认密码必须为六位以上");return;}
if(pwd!=rpwd){alert("两次输入密码不一致");return;}
if(name==""||name.length<2){alert("真实姓名不能为空");return;}
if(email=="")
{alert("邮箱地址不能为空");return;}else{if(!Isyx(email)){alert("请输入正确的邮箱地址!");return;}}
if(cellphone==""||cellphone.length!=11){alert("请输入手机号码");return;}
if(validateImg==""){alert("请输验证码");return;}
userAction.dwrLoginUser(userName,pwd,name,email,cellphone,telephone,validateImg,{callback:function(str){if(str=="doubleAccount")
{alert("该用户名已经存在");}
else if(str=="validateError")
alert("验证码不正确");else if(str=="fail")
alert("远程服务连接错误请重试");else if(str=="success"){window.location="confirm.html";alert("提交成功");return;}
else
{alert("提交不成功,请重试");}}});}
function Isyx(yx){var reyx=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;return(reyx.test(yx));}