// JavaScript Document
//Validation Functions
function verify(num)
{
	var submitBool = false;
	if(emptyvalidation(document.getElementById("name"),"Please enter in a name.") != false)
	{
		if(emailnemptyvalidation(document.getElementById("email"),"Please enter in a valid email.") != false)
		{
			if(emptyvalidation(document.getElementById("subject"),"Please enter in a subject.") != false)
			{
				if(emptyvalidation(document.getElementById("message"),"Please enter in a message.") != false)
				{
					submitBool = true;
				}
			}
		}
	}
	if(document.getElementById("first_name").value != "")
	{
		alert("Do not put anything into the robot detector field.")
		submitBool = false;
	}	
	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;
		}
	}
}