function checkForm1(formID)
{
	if($('Name').value == "")
	{
	alert("Blank name field.");
	$('Name').focus();
	return false;
	}

	if($('details').value == "")
	{
	alert("Blank details field.");
	$('details').focus();
	return false;
	}

	document.getElementById('key').value = getURL();
	return true;
}

//===========Zen Library===============

//==== checkForm function that checks for blank and valid email in a form ====
//pre-condition: Must have an Email field with id='Email' for it to check Email properly
//Can use real world names for ids of other form fields, such as id="First Name"
function checkForm(formID)
{
	if(document.getElementById(formID))
	{
		theForm		= document.getElementById(formID);
		numofInputs	= theForm.length-2; //minus the submit button and key
		
		for(i=0;i<numofInputs;i++)
		{
			if(theForm[i].value == "")
			{
			alert("Please specify a value for: " + theForm[i].id);
			theForm[i].focus();
			return false;
			}
			else
			{
			var HTMLtemp = NoHTML(theForm[i].value);

				if(!HTMLtemp)
				{
				alert("< > are invalid characters.");
				theForm[i].focus();
				return false;					
				}
			
			
			if(theForm[i].id == "Email")
			{
				var isEmailTemp = IsEmail(theForm[i].value);
				if(!isEmailTemp)
				{
				alert("Please enter a valid email.");
				theForm[i].focus();
				return false;					
				}		
			}
			
			}	//end else
		} //end for	
		
		document.getElementById('key').value = getURL();
		return true;
	}
	else
	alert("No Form Specified with that ID.");
}

//==== Email Check function ====

function IsEmail(sText)
{
var whereisAT = sText.indexOf('@');

if(whereisAT == -1)
return false;
   
var whereisDOT = sText.indexOf('.');  

if(whereisDOT == -1)
return false;

//if makes through checks, return true     
return true;
}

//==== HTML Check function ====
//checks to make sure no HTML tags are in the form

function NoHTML(sText)
{
var whereisAT = sText.indexOf('>');

if(whereisAT != -1)
return false;
   
var whereisDOT = sText.indexOf('<');  

if(whereisDOT != -1)
return false;

//if makes through checks, return true     
return true;

}


//==== getURL function ====
//returns the URL in a hidden field to make sure people are not injecting our mail form
//by checking where the form is coming from
//pre-condition: requires a field with an id='key'
function getURL()
{
test = location.href;

test= test.split("/");
str = "";
for(i=0;i<(test.length-1);i++)
{
	if(i == 0)
	str = test[i]+"/";
	else
	str = str + test[i] + "/";
}
return str;
}