
function Email(str)
		{
			var supported = 0;
			if (window.RegExp)
			{
			var tStr = "a";
			var tReg = new RegExp(tStr);
			if (tReg.test(tStr)) supported = 1;
			}
			if (!supported)
			return (str.indexOf(".") <= 5) || (str.indexOf("@") < 0);
			var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			return (r1.test(str) || !r2.test(str));
		}
function EmailAddr(str) 
		{
		    return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/);
		}
function IsNumeric(strString)
   //  check for valid numeric strings 
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   function Isalpha(strCharacter)
   //  check for valid numeric strings 
   {
   var strValidAlpha = "ABCDEFGHIJKLMNOPQRSTWXYZ.abcdefghijklmnopqrstuvwxyz.-";
   var strAlpha;
   var blnResult = true;

   if (strCharacter.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strCharacter.length && blnResult == true; i++)
      {
      strAlpha = strCharacter.charAt(i);
      if (strValidAlpha.indexOf(strAlpha) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   

function contactus_frm()
{		

	if (document.frmcontact.comments.value==0)
	{
	alert("Please enter the comments");
	document.frmcontact.comments.focus();
	document.frmcontact.comments.select();
	return false;
	} 
	
	if (Isalpha(document.frmcontact.name.value)==false)
	{
	alert("Please enter your name");
	document.frmcontact.name.focus();
	document.frmcontact.name.select();
	return false;
	}
		
  	if (Email(document.frmcontact.email.value))
	{
	alert("Please enter your email id");
	document.frmcontact.email.focus();
	document.frmcontact.email.select();
	return false;
	} 
	if (IsNumeric(document.frmcontact.phone.value)==false)
	{
	alert("Please enter the Phone No");
	document.frmcontact.phone.focus();
	document.frmcontact.phone.select();
	return false;
	}		
		
	document.frmcontact.submit();
}