function validate(theform)
{
		if(theform.fname.value=='' || theform.fname.value=='Name')
		{
			alert('Please enter name')
			theform.fname.select();
			theform.fname.focus();
			return false;
		}
		if(theform.email.value=='' || theform.email.value=='Email')
		{
			alert('Please enter email')
			theform.email.select();
			theform.email.focus();
			return false;
		}
		if(echeck(theform.email.value)==false)
		{
			theform.email.select();
			theform.email.focus();
			return false;
		}
		
		if(theform.phone.value=='' || theform.email.phone=='Phone')
		{
			alert('Please enter phone number')
			theform.phone.select();
			theform.phone.focus();
			return false;
		}
		
		if(theform.comments.value=='' || theform.comments.value=='Comments/Questions')
		{
			alert('Please enter comments')
			theform.comments.select();
			theform.comments.focus();
			return false;
		}
		document.frm.submit();
		
		
		
		
}

function echeck(str) 
{
	lastpos=str.length-1;//Total Letters
	apos=str.indexOf("@"); //Total letters before @
	dotpos=str.lastIndexOf(".");//Total letters before .
	beforeStr=str.substring(0,apos);
	afterStr=str.substring(apos);
	dotafatpos=afterStr.indexOf(".");
	udslpos=beforeStr.lastIndexOf("_");
	dotfpos=beforeStr.indexOf(".");
	dotlpos=beforeStr.lastIndexOf(".");
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2 || dotfpos!=dotlpos || apos-1==udslpos || dotafatpos==1) 
	{alert("Invalid E-mail ID");return false; }
	else {return true;}					
}

function IsPhone(strString,extraChar)
{
   var strValidChars = "0123456789()- ";
   strValidChars=strValidChars+extraChar;
   var strChar;
   var blnResult = true;
   if ((strString.length == '0') || (strString.length > '15') || (strString.length < '7'))  return false;

for (i = 0; i < strString.length && blnResult == true; i++)
      {
	  strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1) blnResult = false;
      }
   return blnResult;
}


