// JavaScript Document
//Validation Functions
function registerJacket(num)
{
	var submitBool = false;
	if(emptyvalidation(document.getElementById("parent_name"),"Please fill in a value for Parent's Name.") != false)
	{
		if(emptyvalidation(document.getElementById("jacket_number"),"Please enter your Jacket Number.") != false)
		{
			
			if(emailnemptyvalidation(document.getElementById("email"),"Please put in a valid Email address.") != false)
			{
				submitBool = true;
			}
		}
	}
	if (submitBool == true)
		document.getElementById("confirm").click();
}


function emailnemptyvalidation(entered, alertbox)
{
	if(entered == null)	//if object doesnt exist 
		return false;	
	// E-mail Validation by Henrik Petersen / NetKontoret
	// Explained at www.echoecho.com/jsforms.htm
	// Please do not remove this line and the two lines above.
	with (entered)
	{
		apos=value.indexOf("@"); 
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
		{
			if (alertbox) {alert(alertbox);} 
			return false;
		}
		else 
		{
			return true;
		}
	}
}

function emptyvalidation(entered, alertbox)
{
	if(entered == null)	//if object doesnt exist 
		return false;	
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
//with (entered)
//{
//if (value==null || value=="")
//{if (alertbox!="") {alert(alertbox+'Error: value='+value);} return false;}
//else {return true;}
//}
	with (entered)
	{
		if (value==null || value=="")
		{
			if (alertbox!="") {alert(alertbox);} return false;}
		else {
			return true;
		}
	}
}