
function isEmailAddr(email)
{
	
	var result = false
	var theStr = new String(email)
	var index = theStr.indexOf("@");
	if (index > 0)
	{
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
	}
	return result;
}

function check()
{	

	if(document.add.user_student_name.value == "")
	{
		alert("Student Name not given.");
		document.add.user_student_name.focus();
		return false;
	}

	if(document.add.user_guardian_name.value == "")
	{
		alert("Guardian Name not given.");
		document.add.user_guardian_name.focus();
		return false;
	}

	if(document.add.user_age.value == "")
	{
		alert("Age not given.");
		document.add.user_age.focus();
		return false;
	}

	if(document.add.user_contact_home.value == "")
	{
		alert("Contact Home not given.");
		document.add.user_contact_home.focus();
		return false;
	}

	if(document.add.user_contact_mobile.value == "")
	{
		alert("Contact Mobile not given.");
		document.add.user_contact_mobile.focus();
		return false;
	}

	if(document.add.user_country.value == "")
	{
		alert("Country not given.");
		document.add.user_country.focus();
		return false;
	}

	if(document.add.user_state.value == "")
	{
		alert("State not given.");
		document.add.user_state.focus();
		return false;
	}

	if(document.add.user_contact_time.value == "")
	{
		alert("Contact Time not given.");
		document.add.user_contact_time.focus();
		return false;
	}

	if(document.add.user_primary_email.value == "")
	{
		alert("Primary Email not given.");
		document.add.user_primary_email.focus();
		return false;
	}

	if(!isEmailAddr(document.add.user_primary_email.value))
	{
		alert("Email format not correct.");
		document.add.user_primary_email.focus();
		return false;
	}

	if(document.add.user_hear_about.value == "")
	{
		alert("Hear About not given.");
		document.add.user_hear_about.focus();
		return false;
	}






}
