// JavaScript Document

function validateQuickRegisterForm()
{
	var name = document.getElementById("textfield");
	var email = document.getElementById("textfield2");
	var state = document.getElementById("textfield22");
	var course = document.getElementById("textfield23");
	var contact = document.getElementById("textfield24");
	
	var numericExpression = /^[0-9 + -]+$/;
	var alphaExp = /^[a-z A-Z .]+$/;
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	
	//alert("Hi")
	if(name.value == "")
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name must be filled!</font></center></h5>";
		name.value = "";
		name.focus();
		return false;
	}
	
	else if(!name.value.match(alphaExp))
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please enter characters only!</font></center></h5>";
		name.value = "";
		name.focus();
		return false;
	}
	else if(email.value == "")
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Email must be filled!</font></center></h5>";
		email.value = "";
		email.focus();
		return false;
	}
	else if(!email.value.match(emailExp))
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please enter valid email!</font></center></h5>";
		//email.value = "";
		email.focus();
		return false;
	}
	else if(state.value == "")
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please enter your state!</font></center></h5>";
		state.value = "";
		state.focus();
		return false;
	}
	else if(course.value == "")
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enter course name!</font></center></h5>";
		course.value = "";
		course.focus();
		return false;
	}
	else if(contact.value == "")
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact no must be filled!</font></center></h5>";
		contact.value = "";
		contact.focus();
		return false;
	}
	else if(!contact.value.match(numericExpression))
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please enter valid contact no!</font></center></h5>";
		contact.value = "";
		contact.focus();
		return false;
	}
	
	else if(contact.value.length < 10 || contact.value.length > 18)
	{
		document.getElementById("resid").innerHTML = "<h5><center><font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact no must be 10 or 11 digit!</font></center></h5>";
		contact.value = "";
		contact.focus();
		return false;
	}
	else
	{
		return true;	
	}
}

function clearMessage(id)
{
	var valueobj = document.getElementById(id);	
	var value = valueobj.value;
	if(value != 0)
	{
		document.getElementById("resid").innerHTML = "&nbsp;";
	}
}
