function closeWin()
{
	//self.close();
	window.location.href="manageIndex.do";
}

function checkOldPasswdDwr(bbb)
{	var uuu = document.getElementById("UserID").value;
	var aa=document.getElementById("OldPasswd").value;
	//var aaa=service.getMD5Pwd(aa);
	service.panduan(function(aaa){
	if(aaa=="no"){
		//alert("您的登录以因超时而失效，请重新登录后修改密码！"); 
		showLoginDiv();
		//window.location.href="index.jsp?loginflag=1";
	}
	if(aa!="")
	{
		service.getMD5Pwd(aa,function(vvv)
		{
			if(vvv!=bbb)
			{	
				document.getElementById("OldPasswdWarn").innerHTML="<font color=\"red\">原密码输入错误</font>";
				document.getElementById("mpasswdform").OldPasswd.select(); 
	   		}else{
	   			document.getElementById("OldPasswdWarn").innerHTML="<font color=\"green\">原密码输入正确</font>";
	   		}
	   	});
	}});
}
function checkNewPasswdDwr()
{
	var passwd=document.getElementById("NewPasswd").value;
	if(passwd!="")
	{
		var regm1 = /^[a-zA-Z0-9_-]+$/;//验证密码必须为字母,下划线,数字,
		var regm2 = /\S{6,16}/;
	 	if (!passwd.match(regm1)|| !passwd.match(regm2) )
		{
			document.getElementById("NewPasswdWarn").innerHTML="<font color=\"red\">密码长度6-16个字符(数字，字母和下划线)</font>";
			document.getElementById("mpasswdform").NewPasswd.select();   
		}else{
			document.getElementById("NewPasswdWarn").innerHTML="<font color=\"green\">密码可以使用</font>";
		} 
   	}
}

function checkReNewPasswdDwr()
{
	var bbb = document.getElementById("NewPasswd").value;
	var ccc = document.getElementById("ReNewPasswd").value;
	if(ccc!="")
	{
	if(bbb!=ccc)
		{
	  		document.getElementById("ReNewPasswdWarn").innerHTML="<font color=\"red\">两次输入的密码不一致</font>";
	  		document.getElementById("mpasswdform").ReNewPasswd.select();   
	  	}else{
	  		document.getElementById("ReNewPasswdWarn").innerHTML="<font color=\"green\">两次密码输入正确</font>";
	  	}
	 }else{
	 document.getElementById("ReNewPasswdWarn").innerHTML="<font color=\"red\">再确认一次新密码</font>";
	 }
}
function checkForm5()
{
	var aa = document.getElementById("name").value;
	//var aaa=service.getMD5Pwd(aa);
	var bbb = document.getElementById("email").value;
	var ccc = document.getElementById("bandname").value;
	var ddd = document.getElementById("tel").value;
	var regm = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
	if(aa=="")
	{
		document.getElementById("name11").innerHTML="<font color=\"red\">请输入姓名！</font>";
		document.getElementById("name").focus();
		return false;
	}
	if(bbb=="")
	{
		document.getElementById("email11").innerHTML="<font color=\"red\">请输入email！</font>";
		document.getElementById("email").focus();
		return false;
	}
	if(ddd=="")
	{
		document.getElementById("tel1").innerHTML="<font color=\"red\">请输入电话号码！</font>";
		document.getElementById("tel").focus();
		return false;
	}
	if(ccc=="")
	{
		document.getElementById("bandname11").innerHTML="<font color=\"red\">请输入艺名或乐队名称！</font>";
		document.getElementById("bandname").focus();
		return false;
	}
	if(aa!=""){
		if(bbb!=""){
			if(!bbb.match(regm))
			{
				document.getElementById("email11").innerHTML="<font color=\"red\">E-mail格式不正确，请重新输入。</font>";
				document.artistinfo.email.select();   
			}else{
				if(ccc!=""){
					document.artistinfo.submit();
				}
			}
		}
	}
}
function checkForm(ddd)
{
	var aa = document.getElementById("OldPasswd").value;
	//var aaa=service.getMD5Pwd(aa);
	var bbb = document.getElementById("NewPasswd").value;
	var ccc = document.getElementById("ReNewPasswd").value;
	if(aa=="")
	{
		document.getElementById("OldPasswdWarn").innerHTML="<font color=\"red\">请输入原密码！</font>";
		document.getElementById("mpasswdform").OldPasswd.focus();
		return false;
	}
	
	if(bbb=="")
	{
		document.getElementById("NewPasswdWarn").innerHTML="<font color=\"red\">请输入新密码！</font>";
		document.mpasswdform.NewPasswd.focus();
		return false;
	}
	if(ccc== "")
	{
		document.getElementById("ReNewPasswdWarn").innerHTML="<font color=\"red\">请输入确认密码！</font>";
		document.mpasswdform.ReNewPasswd.focus();
		return false;
	}
	if(aa!="")
	{	service.getMD5Pwd(aa,function(vvv)
		{
			if(vvv!=ddd)
			{	
				document.getElementById("OldPasswdWarn").innerHTML="<font color=\"red\">原密码输入错误</font>";
				document.getElementById("mpasswdform").OldPasswd.focus();
				return false; 
	   		}
	   	else{
	   		if(bbb!="")
	   		{
	   			var regm1 = /^[a-zA-Z0-9_-]+$/;//验证密码必须为字母,下划线,数字,
				var regm2 = /\S{6,16}/;
			 	if (!bbb.match(regm1)|| !bbb.match(regm2) )
				{
					document.getElementById("NewPasswdWarn").innerHTML="<font color=\"red\">密码长度6-16个字符(数字，字母和下划线)</font>";
					document.getElementById("mpasswdform").NewPasswd.select();
					return false;   
				}
				else{
					if(ccc!="")
					{
						if(bbb!=ccc)
						{
					  		document.getElementById("ReNewPasswdWarn").innerHTML="<font color=\"red\">两次输入的密码不一致</font>";
					  		document.getElementById("mpasswdform").ReNewPasswd.select();
					  		return false;   
					  	}else{
					  		//v return true;
					  		document.mpasswdform.submit();
					  	}
					}
				}
	   		}
		}
		});
	}
}

function checkEmailDwr()
{
	var ddd = document.getElementById("Email").value;
	var regm = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;//验证Mail的正则表达式,开头必须为字母,下划线,数字,
 	if(ddd!="")
 	{
	 	if (!ddd.match(regm))
		{
			document.getElementById("EmailWarn").innerHTML="<font color=\"red\">E-mail格式不正确，请重新输入。</font>";
			document.muserinfoform.Email.select();   
			return false;
		}else{
			document.getElementById("EmailWarn").innerHTML="<font color=\"green\">E-mail可以使用</font>";
		}
	}else{
		document.getElementById("EmailWarn").innerHTML="<font color=\"red\">请输入您的电子邮件地址！</font>";
		document.muserinfoform.Email.focus();
		return false
	}
	return true;
}	
function checkModifyUserInfoForm()
{
	service.panduan(function(aaa)
	{
		if(aaa=="yes"){
			if(checkEmailDwr()&&checkUserName()&&checkBirthday()&&checkPostcode()&&checkTel()&&checkMobile())
			{
			document.muserinfoform.submit();
			}
		}else{
				showLoginDiv();
		}
	}
	);
}	

function checkMobile()
{	
	var aaa=document.getElementById("Mobile").value;

	if(aaa!="")
	{	
		var regm1 = /^13[13567890](\d{8})$/ ;
		if(!aaa.match(regm1))
		{
			document.getElementById("MobileWarn").innerHTML="<font color=\"red\">手机号码错误！</font>";
			return false;
		}else{
			document.getElementById("MobileWarn").innerHTML="<font color=\"green\">正确√</font>";
		}
   	}else{
   	document.getElementById("MobileWarn").innerHTML="（请填写手机号码）";
   	}
   	return true;
}

function checkTel()
{	
	var aaa=document.getElementById("Tel").value;

	if(aaa!="")
	{	
		var regm1 = /\d{3}-\d{8}|\d{4}-\d{7}$/;
		if(!aaa.match(regm1))
		{
			document.getElementById("TelWarn").innerHTML="<font color=\"red\">电话号码错误，正确格式\"区号-电话号码\"！</font>";
			return false;
		}else{
			document.getElementById("TelWarn").innerHTML="<font color=\"green\">正确√</font>";
		}
   	}else{
   	document.getElementById("TelWarn").innerHTML="（请填写联系电话）";
   	}
   	return true;
}


function checkPostcode()
{	
	var aaa=document.getElementById("Postcode").value;

	if(aaa!="")
	{	
		var regm1 = /^[1-9]\d{5}$/;
		if(!aaa.match(regm1))
		{
			document.getElementById("PostcodeWarn").innerHTML="<font color=\"red\">邮政编码错误！</font>";
			return false;
		}else{
			document.getElementById("PostcodeWarn").innerHTML="<font color=\"green\">正确√</font>";
		}
   	}else{
   	document.getElementById("PostcodeWarn").innerHTML="（请输入正确的六位邮政编码）";
   	}
   	return true;
}


function checkBirthday()
{	
	var aaa=document.getElementById("Birthday_year").value;
	var bbb=document.getElementById("Birthday_month").value;
	var ccc=document.getElementById("Birthday_day").value;
	var flag=1;
	if(aaa!="")
	{	
		var regm1 = /^(\d{4})$/;
		if(!aaa.match(regm1))
		{
			flag=0;
		}
   	}
	if(bbb!="")
	{	
		var regm1 = /^(\d{1,2})$/;
		if(!bbb.match(regm1))
		{
			flag=0;
		}
   	}   
	if(ccc!="")
	{	
		var regm1 = /^(\d{1,2})$/;
		if(!ccc.match(regm1))
		{
			flag=0;
		}
   	}    		
   	if(flag==0)
   	{
   	document.getElementById("birthday").innerHTML="<font color=\"red\">请输入正确的生日！</font>";
   	return false;
   	}else{
   	document.getElementById("birthday").innerHTML="";
   	}
   	return true;
}

function checkUserName()
{	
	var aaa=document.getElementById("Name").value;
	if(aaa!="")
	{	
		if(aaa.length>20)
	  	{   
	  		document.getElementById("NameWarn").innerHTML="<font color=\"red\">用户名不能大于20个字</font>";   
	  		return false
	    }else{
	    	document.getElementById("NameWarn").innerHTML="<font color=\"green\">正确√</font>";
	    }
   	}
   	return true;
}






