// JavaScript Document
 
function validate_contact()
{
	//alert('sdf');
  	var doc=document.contact_form;
	var theForm=document.contact_form;
	if(doc.c_name.value=="")
	{
	alert('Enter Name');
	doc.c_name.focus();
	return false;
	}
	
	if(doc.c_email.value=="")
	{
	alert('Enter Email');
	doc.c_email.focus();
	return false;
	}
	
	// Email Validation start here
if (theForm.c_email.value == "")
{
alert("Please enter a valid email");
theForm.c_email.focus();
return (false);
}

var checkemail = "@.";
var checkStr = theForm.c_email.value;
var emailValid = false;
var emailAt = false;
var emailPeriod = false;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkemail.length; j++)
{
if (ch == checkemail.charAt(j) && ch == "@")
emailAt = true;
if (ch == checkemail.charAt(j) && ch == ".")
emailPeriod = true;
if (emailAt && emailPeriod)
break;
if (j == checkemail.length)
break;
}

if (emailAt && emailPeriod)
{
emailValid = true
break;
}
}
if (!emailValid)
{
alert("Please enter a valid email");
theForm.c_email.focus();
return (false);
} //Eamil Validation end here
if(theForm.q_phone.value==''){
	alert('Please enter telephone number');
	theForm.q_phone.focus();
	return false;
	}
	
if(theForm.c_comments.value=='')
 {	
 	alert('Please Enter Your Comments');
	doc.c_comments.focus();
	return false;
 } 
	
}

