function validate()

{

	if((document.c_form.Name.value=="") || (document.c_form.Name.value=="name"))

	{
		alert("Please enter name");
		document.c_form.Name.select();
		document.c_form.Name.focus();		
		return false;

	}
	

	if(echeck(document.getElementById("reply-to-addr").value)==false)

	{		
		document.getElementById("reply-to-addr").select();
		document.getElementById("reply-to-addr").focus();
		return false;		
	}

	if((document.c_form.Phone.value=="") || (document.c_form.Phone.value=="phone"))

	{
		alert("Please enter phone");
		document.c_form.Phone.select();
		document.c_form.Phone.focus();
		return false;

	}
	
		if(IsPhone(document.c_form.Phone.value,"( ) -")==false)
		{
			alert("Please enter valid phone number");
			document.c_form.Phone.select();
		document.c_form.Phone.focus();
			return false;
		}

	if((document.c_form.Comments.value=="") ||  (document.c_form.Comments.value=="comments"))

	{
		alert("Please enter comments");
		document.c_form.Comments.select();
		document.c_form.Comments.focus();
		return false;

	}

	//window.location='mailSend.asp?name='+document.getElementById("name").value+'&mail='+document.getElementById("email").value+'&phone='+document.getElementById("phone").value+'&comments='+document.getElementById("comments").value;

	document.c_form.submit();

}

function echeck(str) 

	{

		var at="@"

		var dot="."

		var lat=str.indexOf(at)

		var lstr=str.length

		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1){

		   alert("Invalid E-mail ID")

		   return false

		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    alert("Invalid E-mail ID")

		    return false

		}



		 if (str.indexOf(at,(lat+1))!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.indexOf(dot,(lat+2))==-1){

		    alert("Invalid E-mail ID")

		    return false

		 }

		

		 if (str.indexOf(" ")!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }

		

	 return true					

	}
function IsPhone(strString,extraChar)
{
   var strValidChars = "0123456789()-. ";
   strValidChars=strValidChars+extraChar;
   var strChar;
   var blnResult = true;
   if ((strString.length == 0) || (strString.length > 18) || (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;
}


