function isEmpty(strVal) {
  strVal = trim(strVal);
  if ( (strVal.length==0) || (strVal==null) ) {
      return true;
   }
   else { 
     return false; 
   }      
}

function trim(strVal) {
  if (strVal == null) return strVal;
  return strVal.replace(/^\s+|\s+$/g,"");
}

function isValidEmail(strName,strVal) {
  if (isEmpty(strVal)) { promptEmpty(strName); return false; }
		
  var ATTR_RE = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  //ATTR_RE= /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*[.][a-zA-Z]{2,3}$/gi;
  if (!ATTR_RE.test(strVal)) { alert('E-mail address Format Error'); return false; }
			
  return true;
}
function isValidUsername(strName,strVal) {
  if (isEmpty(strVal)) { promptEmpty(strName); return false; }

  var ATTR_RE= /[\W_.]/; 
  //ATTR_RE= /^[0-9a-zA-Z]{1,}$/gi;  

  if (ATTR_RE.test(strVal)) { alert('User Name contains non alphanumeric characters'); return false; }
  if (strVal.length < 3) { alert('User Name not within 3 to 15 alphanumeric characters'); return false; }
  if (strVal.length > 15) { alert('User Name not within 3 to 15 alphanumeric characters'); return false; }
	 				
  return true;
}
function isValidPassword(strName,strVal) {
  if (isEmpty(strVal)) { promptEmpty(strName); return false; }

  var ATTR_RE= /[\W_.]/; 
  //ATTR_RE= /^[0-9a-zA-Z]{1,}$/gi;  

  if (ATTR_RE.test(strVal)) { alert('Password contains non alphanumeric characters'); return false; }
  if (strVal.length < 5) { alert('Password not within 5 to 16 alphanumeric characters'); return false; }
	 				
  return true;
}
