
function chk_string( str, req, min, max )// Checking the lent of the text box
{
	if( str.length == 0 && !req )
		return 0;
	if( str.length < min || str.length > max )
		return 1;
	return 0;
}


function chk_email( str, req )
{
	var email_RegEx = /^\w+([-.]\w+)*\@\w+([-.]\w+)*\.\w+$/;
	if( str.length == 0 && !req )
	    return 0;
	var found = email_RegEx.test( str );
	if( found == false )
	    return 1;
	return 0;
}
function Validation()
{	
		
	if( document.form.name.value =="" )
	{
		alert("Name is not specified");
		document.form.name.focus();
		return false;
	}	


	 if( chk_string( document.form.age.value, 1, 2, 50 ) )
	{
		alert("Age is not specified");
		document.form.age.focus();
		return false;
	}
	
	 if( chk_email( document.form.email.value, 1, 2, 50 ) )
	{
		alert("Email address invalid or not specified");
		document.form.email.focus();
		return false;
	}
	
	
	 if( chk_string( document.form.course.value, 1, 2, 50 ) )
	{
		alert("Course Interested is not specified");
		document.form.course.focus();
		return false;
	}
	
	
	 if( chk_string( document.form.education.value, 1, 2, 1050 ) )
	{
		alert("Education is not specified");
		document.form.education.focus();
		return false;
	}
	
	 if(document.form.grades.value=="" )
	{
		alert("Grades not specified");
		document.form.grades.focus();
		return false;
	}
	
	 if( chk_string( document.form.company.value, 1, 2, 50 ) )
	{
		alert("Company is not specified");
		document.form.company.focus();
		return false;
	}
	 if( chk_string( document.form.city.value, 1, 2, 50 ) )
	{
		alert("City is  not specified");
		document.form.city.focus();
		return false;
	}
	



 	if( chk_string( document.form.mobile.value, 1, 2, 50 ) )
	{
	alert("Mobile number is not specified");
		document.form.mobile.focus();
		return false;
	}	
	

	
	 if(document.form.query.value =="")
	{
		alert("Query is not specified");
		document.form.query.focus();
		return false;
	}	
	
 }
   
 

   
   
