function validEmail(objEmail) {

		email = objEmail.value;
		
			invalidChars = " */:,;"
			if (email == "") {			// cannot be empty
				//alert("Email id cannot be empty");
				return false;
				
			}
			for (i=0; i<invalidChars.length; i++) {
// does it contain any invalid characters?
				badChar = invalidChars.charAt(i);
				if (email.indexOf(badChar,0) > -1) {
					//alert("Email id contains invalid characters");
					return false;
					
				}
			}
			atPos = email.indexOf("@",1);
// there must be one "@" symbol
			if (atPos == -1) {
				//alert("Invalid Email id ");
				return false;
			}
			if (email.indexOf("@",atPos+1) != -1) {
				//alert("Invalid Email id ");
// and only one "@" symbol
				return false;
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				//alert("Invalid Email id ");
// and at least one "." after the "@"
				return false;
			}
			if (periodPos+3 > email.length)	{
				//alert("Invalid Email id ");
// must be at least 2 characters after the "."
				return false;
			}
			return true;
}
function fnValidateName(objName)
{
	var i;
	var	strName = objName.value;
	var strReplace = "";
	
	for (i = 0; i < strName.length; i++)
	{
		if ((strName.charCodeAt(i) > 44) && (strName.charCodeAt(i) < 47)  || (strName.charCodeAt(i) > 64) && (strName.charCodeAt(i) < 91) || (strName.charCodeAt(i) > 96 ) && ( strName.charCodeAt(i) < 123) || (strName.charCodeAt(i)==32) || (strName.charCodeAt(i) == 39)  || (strName.charCodeAt(i) == 95))
		{
			continue;
		}
		else return false;
	}
	
	
	return true;
}
function checkAlpahOnly(s)
    {
	var i;
	for (i = 0; i < s.length; i++)
	{
		var code = s.charCodeAt(i);
		if((code>=65 && code<=90 )||(code>=97 && code<=122)|| code==32)
		{
		}
		else
		return false;

	}
	return true;
    }

function fnValidateZipCode(objZip)
{
  var  i;
  var numZip = objZip.value;
  if (numZip == "") return true;
  if(numZip != "")
	{
	  if(numZip.length != "5") return false;
	}
  for(i = 0; i < numZip.length; i++)
	{
		if(numZip.charAt(i) < "0" || numZip.charAt(i) > "9")
			{
				return false;
			}
	}
  return true;
}

function fnFormSubmit2(strSubActionId,strFormName)
 {   
   if((document.forms[strFormName].selYourSubject.value=="Click and Hold to Select")||(document.forms[strFormName].selYourSubject.value=="----------------------------"))
	{
		alert("Select subject");
		document.forms[strFormName].selYourSubject.focus();
      	return false;
	} else if(!checkAlpahOnly(document.forms[strFormName].txtFirstName.value)		
		|| document.forms[strFormName].txtFirstName.value == "") {
	  alert("Please enter a valid Firstname.");
	  document.forms[strFormName].txtFirstName.value="";  
	  document.forms[strFormName].txtFirstName.focus();  
	  return false;   
  	}     
  	else if(!fnValidateName(document.forms[strFormName].txtLastName) 
		|| !checkAlpahOnly(document.forms[strFormName].txtLastName.value)
		|| document.forms[strFormName].txtLastName.value == "") 
	{
	  alert("Please enter a valid Lastname.");
	  document.forms[strFormName].txtLastName.value=""; 
	  document.forms[strFormName].txtLastName.focus();  
	  return false;   
  	}     
   else if(document.forms[strFormName].txtEmailAddress.value == "" || !validEmail(document.forms[strFormName].txtEmailAddress))
	{
		alert("Please enter a valid e-mail address.");
		document.forms[strFormName].txtEmailAddress.value="";
		document.forms[strFormName].txtEmailAddress.focus();
		return false;
	}        
    else if(!fnValidateZipCode(document.forms[strFormName].txtZipCode) || document.forms[strFormName].txtZipCode.value == "")
	{
		alert("Please enter a valid ZipCode.");
		document.forms[strFormName].txtZipCode.value="";
		document.forms[strFormName].txtZipCode.focus();
      	return false;
	}
	else if(document.forms[strFormName].txtMessage.value=="")
	{
	 alert("Please Enter your Message.");
	 document.forms[strFormName].txtMessage.value="";
	 document.forms[strFormName].txtMessage.focus();
	 return false;
	}
	else
	{
	fnFormSubmit(strSubActionId,strFormName);
	}
      	return false;
}


