
/***检查用户名**/
function checkUsername(username) {
    //根据AJAX返回值来判断
    var usernameMSG=document.getElementById("usernameMSG");
	if(usernameMSG.innerHTML.indexOf("可以使用")>-1 && !checkIsChinese(username.value)){
	   return true; 
	}else{
	   return false; 
	}   
}
/***检查密码**/
function checkPassword(obj) {
	var passwordMSG=document.getElementById("passwordMSG");
	var cpassword=document.getElementById("cpassword");
	if (checkIsNotEmpty(obj.value)){
	     if(obj.value.length>5){
	         passwordMSG.innerHTML="<img src='"+page_root+"/images/ajax/ok.jpg' alt='填写正确' width='19px' height='18px' >填写正确";
	         checkCPassword(cpassword);
		     return true;
		 }else{
		      passwordMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>不得少于6个字符";
		     return false;
		 }     
    }else{		 
		 passwordMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>密码不能为空";
		 return false; 
	}
}
/***检查密码是否一至**/
function checkCPassword(obj) {
	var cpasswordMSG=document.getElementById("cpasswordMSG");
	var password=document.getElementById("password");
	if (checkIsNotEmpty(obj.value)){
		if (password.value == obj.value) {
		    cpasswordMSG.innerHTML="<img src='"+page_root+"/images/ajax/ok.jpg' alt='密码一至' width='19px' height='18px'>密码一至";
		     return true;
		} else {
			cpasswordMSG.innerHTML= "<img src='"+page_root+"/images/ajax/msg.jpg' alt='二次输入的密码不一至' width='19px' height='18px'>二次输入的密码不一至";
			return false; 
		}
	}else{
	       cpasswordMSG.innerHTML= "<img src='"+page_root+"/images/ajax/msg.jpg' alt='确认密码不能为空' width='19px' height='18px'>确认密码不能为空";
			return false; 
	}		
}     

/***检查邮箱**/
function checkEmail() {
	var emailMSG=document.getElementById("emailMSG");
	//根据AJAX返回值来判断
	if(emailMSG.innerHTML.indexOf("可以使用")>-1){
	    return true; 
	}else{
	    return false;   
	}    
}

/***检查验证码**/
function checkConfirmationcode() {
	var confirmationcodeMSG=document.getElementById("confirmationcodeMSG");
	//根据AJAX返回值来判断
	if(confirmationcodeMSG.innerHTML.indexOf("可以使用")>-1){
	    return true;
	}else{
	    return false;
	}    
}

/***检查备份邮箱**/
function checkBakEmail(obj) {
  var bakemailMSG=document.getElementById("bakemailMSG");
  if(checkIsNotEmpty(obj.value)){
	if (checkIsEmail(obj.value)){
	    bakemailMSG.innerHTML="";
	    return true;  
	}else{
	   bakemailMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>备用Email地址不正确";
	   return false; 
	}  
  }else{
 
    bakemailMSG.innerHTML="";
    return true;
  }	  
}
/***检查证件号码**/
function checkIdnumber(obj) {
  var idnumberMSG=document.getElementById("idnumberMSG");
  if(checkIsNotEmpty(obj.value)){
    if (checkIsNumbericOrEnglish(obj.value)){
	   idnumberMSG.innerHTML="";
	    return true;  
	}else{
	    idnumberMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>证件号码不正确";
	   return false; 
	}  
  }else{
    idnumberMSG.innerHTML="";
    return true;
  }	  
}

/***检查邮编**/
function checkZipcode(obj) {
  var zipcodeMSG=document.getElementById("zipcodeMSG");
  if(checkIsNotEmpty(obj.value)){
    if (checkIsInteger(obj.value)&&obj.value.length==6){
	   zipcodeMSG.innerHTML="默认为物件地址编码";
	    return true;  
	}else{
	   zipcodeMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>邮编不正确";
	    return false; 
	}  
  }else{
    zipcodeMSG.innerHTML="默认为物件地址编码";
    return true;
  }	  
}

/***检查电话号码**/
function checkTelephone(obj) {
  var telephoneMSG=document.getElementById("telephoneMSG");
  if(checkIsNotEmpty(obj.value)){
    if (checkIsTelephone(obj.value)){
	    telephoneMSG.innerHTML="";
	    return true;  
	}else{
	    telephoneMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>电话号码不正确";
	   return false; 
	}  
  }else{
    telephoneMSG.innerHTML="";
    return true;
  }	  
}

/***检查手机号码**/
function checkMobilephone(obj) {
  var mobilephoneMSG=document.getElementById("mobilephoneMSG");
  if(checkIsNotEmpty(obj.value)){
    if (checkIsMobilephone(obj.value)){
	    mobilephoneMSG.innerHTML="";
	    return true;  
	}else{
	    mobilephoneMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>手机号码不正确";
	   return false; 
	}  
  }else{
    mobilephoneMSG.innerHTML="";
    return true;
  }	  
}

/***检查QQ号码**/
function checkQq(obj) {
  var qqMSG=document.getElementById("qqMSG");
  if(checkIsNotEmpty(obj.value)){
    if (checkIsInteger(obj.value)&&obj.value.length>4){
	    qqMSG.innerHTML="";
	    return true;  
	}else{
	    qqMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>QQ号码不正确";
	    return false; 
	}  
  }else{
    qqMSG.innerHTML="";
    return true;
  }	  
}

/***检查MSN**/
function checkMsn(obj) {
  var msnMSG=document.getElementById("msnMSG");
  if(checkIsNotEmpty(obj.value)){
	if (checkIsEmail(obj.value)){
	    msnMSG.innerHTML="";
	    return true;  
	}else{
	   msnMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>MSN地址不正确";
	   return false; 
	}  
  }else{
   msnMSG.innerHTML="";
    return true;
  }	  
}

/***检查传真号码**/
function checkFax(obj) {
  var faxMSG=document.getElementById("faxMSG");
  if(checkIsNotEmpty(obj.value)){
    if (checkIsTelephone(obj.value)){
	    faxMSG.innerHTML="";
	    return true;  
	}else{
	   faxMSG.innerHTML="<img src='"+page_root+"/images/ajax/msg.jpg' alt='出错' width='19px' height='18px'>传真号码不正确";
	   return false; 
	}  
  }else{
   faxMSG.innerHTML="";
    return true;
  }	  
}
/***把年，月，日，组在一起构成出生日期**/
function createDate() {
	byear = document.getElementById("birthyear");
	bmonth = document.getElementById("birthmonth");
	bday = document.getElementById("birthday");
	var userbirthday = document.getElementById("user.birthday");
	userbirthday.value=+byear.value+"-"; 
	if(bmonth.value-1<9){
		userbirthday.value += "0"+bmonth.value;
	}else{
		userbirthday.value = bmonth.value;
	}
	userbirthday.value+="-";  
	if(bday.value-1<9){
		userbirthday.value += "0"+bday.value;
	}else{
		userbirthday.value += bday.value;  
	}
	
}
