var vvlalue=2;
function changeLoginType(v)
{
  if(v==1){
      vvlalue=1;
	  document.getElementById('login'+v).src="NewImages/login"+v+"_a.jpg";
	  document.getElementById('login2').src="NewImages/login2.jpg";
  }else if(v==2){
      vvlalue=2;
	  document.getElementById('login'+v).src="NewImages/login"+v+"_a.jpg";
	  document.getElementById('login1').src="NewImages/login1.jpg"
  }
}
function checkform(xxx){
  if(vvlalue==2){
    if (checkspace(xxx.loginUserName.value)){
	 alert("Please inter your UserID!");
	 xxx.loginUserName.focus();
	 return false;
	}else if(xxx.loginUserName.value.length>50 || xxx.loginUserName.value.length<6 || !Isemail(xxx.loginUserName.value)){
	 alert("Your UserID is error!");
	 xxx.loginUserName.focus();
	 return false;
	}else if(checkspace(xxx.loginPassword)){
	 alert("Please inter your Password!");
	 xxx.loginPassword.focus();
	 return false;
	}else if(xxx.loginPassword.value.length>20 || xxx.loginPassword.value.length<6 || !Ispwd(xxx.loginPassword.value)){
	 alert("Your Password is error!");
	 xxx.loginPassword.focus();
	 return false;
	}
    xxx.action="Member/LoginSubmit.asp";
	return true;
  }else if(vvlalue==1){
    if (checkspace(xxx.loginUserName.value)){
	 alert("Please inter your UserID!");
	 xxx.loginUserName.focus();
	 return false;
	}else if(xxx.loginUserName.value.length>20 || xxx.loginUserName.value.length<6 || !Isusername(xxx.loginUserName.value)){
	 alert("Your UserID is error!");
	 xxx.loginUserName.focus();
	 return false;
	}else if(checkspace(xxx.loginPassword)){
	 alert("Please inter your Password!");
	 xxx.loginPassword.focus();
	 return false;
	}else if(xxx.loginPassword.value.length>20 ||xxx.loginPassword.value.length<6 || !Ispwd(xxx.loginPassword.value)){
	 alert("Your Password is error1!");
	 xxx.loginPassword.focus();
	 return false;
	}
    xxx.action="Company/LoginSubmit.asp";
	return true;
  }	
}

function Isemail(charx){
  var reyx=/^[a-zA-Z0-9]+([\-\_\.]\w+)*@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
  return(reyx.test(charx));
}
function Isusername(charx){
  var reyx=/^([A-Za-z0-9])+([a-zA-Z0-9\-_])*([a-zA-Z0-9])+$/;
  return(reyx.test(charx));
 }
function Ispwd(charx){
  var reyx=/^([A-Za-z0-9])+([A-Za-z0-9\-_#])*$/;
  return(reyx.test(charx));
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}  


