// ============================================ 
// validate email address - syntax check with regular expressions 
// (not used anymore - left for reference) 
// ============================================ 
function IsValidEmailSyntax ( obj ) 
{ 
   // regular expression courtesy of ed.courtenay@nationwideisp.net 
   // 
   // here's some documentation he provided: 
   // 
   //   \w+ 
   //      I am looking here for at least one 'word' - i.e. the 'fred' in 
   //      fred.bloggs@somewhere.com 
   // 
   //   ((-\w+)|(\.\w+)|(\_\w+))* 
   //      This is probably the most complex section of  the whole 
   //      expression. All I am looking for here are zero or more 
   //      'words' prefixed by either a minus (-), dot (.) or 
   //      underscore (_) all of which are legal characters in email 
   //      addresses. 
   // 
   //   \@ 
   //      The one and only @ symbol used in the address 
   // 
   // [A-Za-z0-9] 
   //      Now, I want at least one character that matches this rule 
   //      (i.e. any letter from A-Z, uppercase or lowercase or a number 
   //      from 0-9) 
   // 
   // ((.|-)[A-Za-z0-9]+)* 
   //      This is saying that I can optionally accept more ranges of 
   //      characters that match the rule above, prefixed with either a 
   //      dot (.) or a minus (-). For example, this would match the 
   //      .xyz portion of abc@uvw.xyx.com 
   // 
   // \. 
   //      A dot (.) 
   // 
   // [A-Za-z]{2,5} 
   //      This final section ensures that the TLD (top level domain) 
   //      portion of the email address is at least 2 characters long 
   //      (as in .uk or .to) and no longer than 5 characters (to allow 
   //      for .firm and .store) 

	var sEmail
	
	sEmail = obj.value;
	if (sEmail.search( /\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,5}/ ) != -1) {
		return true;
	}
	else {
		alert("Invalid Email address.");
		obj.focus();
		return false;
	}
} 


function validateNumbers() {
	if ((event.keyCode >= 45 && event.keyCode <= 57) || event.keyCode == 8 || event.keyCode == 9) 
		return true;
	else
		return false;
}

function validatePhone(objCurr, maxlen, objNext) {
	var valid;
	
	valid = validateNumbers()	
	
	if (valid) 
	{
		if (objCurr.value.length == maxlen)
			{ 
			objNext.focus();
			}	
	}
	else
	{
	 return false;
	}
}
