function validForm(passForm) {                                                                              
    if (passForm.username.value == "") {                                                                      
      alert("You must enter login name")                                                                        
      passForm.username.focus()                                                                               
      return false                                                                                            
    }                                                                                                         
    if (passForm.passwd.value == "" ) {                                                                       
      alert("You must enter Password")                                                                        
      passForm.passwd.focus()                                                                                 
      return false                                                                                            
    }                                                                                                         
    return true                                                                                               
}  

function validMembers(formObj) {
		if (formObj.username.value == "") {                                                                      
      alert("You must enter username")                                                                        
      formObj.username.focus()                                                                               
      return false                                                                                            
    }
	  if (formObj.passwd1.value == "") {                                                                      
      alert("You must enter Password")                                                                        
      formObj.passwd1.focus()                                                                               
      return false                                                                                            
    }
	  if (formObj.passwd2.value == "") {                                                                      
      alert("You must enter Repeat password  ")                                                                        
      formObj.passwd2.focus()                                                                               
      return false                                                                                            
    }    
	  if (formObj.passwd1.value != formObj.passwd2.value) {                                                                      
      alert("Passwords are not the same! ")                                                                        
      formObj.passwd2.focus()                                                                               
      return false                                                                                            
    }
  	if (checkEmail(formObj.email.value)==false) {
	   	alert("Please enter valid email address ");
   		formObj.email.focus() 
		  return false;
  	} 
	  if (formObj.question.value == "") {                                                                      
      alert("You must choice Secret Question  ")                                                                        
      formObj.passwd2.focus()                                                                               
      return false                                                                                            
    } 
	  if (formObj.answer.value == "") {                                                                      
      alert("You must enter asnwer")                                                                        
      formObj.answer.focus()                                                                               
      return false                                                                                            
    } 
    if (formObj.agree.value == "1" ) {
		  alert("Please select Agree or not Agree these conditions");
		    formObj.agree.focus() 
		  return false;
	   }
}
function validPurchase(formObj) {
	if (formObj.pay.value == "0") {                                                                      
      alert("Choice method to pay!!!")                                                                        
      formObj.pay.focus()                                                                               
      return false                                                                                            
    }

}

function UpdateMembers(formObj) {
		
	  if (formObj.passwd1.value == "") {                                                                      
      alert("You must enter Password")                                                                        
      formObj.passwd1.focus()                                                                               
      return false                                                                                            
    }
	  if (formObj.passwd2.value == "") {                                                                      
      alert("You must enter Repeat password  ")                                                                        
      formObj.passwd2.focus()                                                                               
      return false                                                                                            
    }    
	  if (formObj.passwd1.value != formObj.passwd2.value) {                                                                      
      alert("Password's is not the same! ")                                                                        
      formObj.passwd2.focus()                                                                               
      return false                                                                                            
    }
  	if (checkEmail(formObj.email.value)==false) {
	   	alert("Please enter valid email address ");
   		formObj.email.focus() 
		  return false;
  	} 
    if (formObj.oldpasswd.value == "") {                                                                      
      alert("You must enter Old Password to apply changes")                                                                        
      formObj.oldpasswd.focus()                                                                               
      return false                                                                                            
    }
}
function chkContacts(formObj) {                                                                              
  	if (IsValidEmail(formObj.email.value)==false) {
		alert("Please enter valid email address ");
		 formObj.email.focus() 
		return false;
	}  
}

function chkForget(formObj) {                                                                              
  	if (checkEmail(formObj.email.value)==false) {
	   	alert("Please enter valid email address ");
   		formObj.email.focus() 
		  return false;
  	}                                                                                              
}  

function checkLength(str, chklen)
{
	var len = str.length;
	if(len < chklen)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function IsBlank( str ) {
	var isValid = false;
 	if ( IsNull(str) || IsUndef(str) || (str+"" == "") )
 		isValid = true;
	return isValid;
}
function IsUndef( val ) {
	var isValid = false;
 	if (val+"" == "undefined")
 		isValid = true;
	return isValid;
}
function IsNull( val ) {
	var isValid = false;
 	if (val+"" == "null")
 		isValid = true;
	return isValid;
}
function IsAlpha( str ) {
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
		return false;
	var isValid = true;
		str += "";
  	for (i = 0; i < str.length; i++) {
		if ( !( ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ) ) {
         				isValid = false;
         				break;
      			}
   }
	return isValid;
}
function IsValidEmail( str ) {
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
		return false;
	var isValid = true;	str += "";namestr = str.substring(0, str.indexOf("@"));
	domainstr = str.substring(str.indexOf("@")+1, str.length);
   	if (IsBlank(str) || (namestr.length == 0) ||(domainstr.indexOf(".") <= 0) ||(domainstr.indexOf("@") != -1) ||!IsAlpha(str.charAt(str.length-1)))
		{isValid = false;return isValid;}
}
function IsNumber( str ){
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
		return false;
	var isValid = true;
		str += "";
  	for (i = 0; i < str.length; i++) {
		if ( !((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) ) {
         				isValid = false;
         				break;
      			}
   }
	return isValid;
}


function IsNumeric( str ){
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")
		return false;
	var isValid = true;
		str += "";
  	for (i = 0; i < str.length; i++) {
		if ( !(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || (str.charAt(i) == ".")) ) {
         				isValid = false;
         				break;
      			}
   }
	return isValid;
}

function checkEmail(email) {
	 if (email.length == 0) {
	 	window.alert("You must provide an e-mail address");
	 	return false;
	 }
	 if (email.indexOf("/") > -1) {
	 	window.alert("E-mail address has invalid character");
	 	return false;
	 }
	 if (email.indexOf(":") > -1) {
	 	window.alert("E-mail address has invalid character");
	 	return false;
	 }	 
	 if (email.indexOf(",") > -1) {
	 	window.alert("E-mail address has invalid character");
	 	return false;
	 }	 
	 if (email.indexOf(";") > -1) {
	 	window.alert("E-mail address has invalid character");
	 	return false;
	 }	 
	 if (email.indexOf("@") < 0) {
	 	window.alert("E-mail address is missing @");
	 	return false;
	 }	 
	 if (email.indexOf("\.") < 0) {
	 	window.alert("E-mail address is missing .");
	 	return false;
	 }	 	 
	 return true;
}
