function validName(name)
{
	if (name == "")
	{
		return false;
	}
	return true;
}
function validCountry(country)
{
	if (country == "Select a Country")
	{
		return false;
	}
	return true;
}
function validEmail(x_email)
{
	// Can't use these characters
	invalidChars = " + / ? ; : , () {} [] \ & % !"
	if (x_email == "")
	{
		return false;
	}
	// Start looking for the invalid characters in the string.
	for (i=0; i < invalidChars.length; i++)
	{
		badChar = invalidChars.charAt(i);
		if(x_email.indexOf(badChar,0) != -1)
		{
			return false
		}
	}
	//Atleast 1 charactor before the @
	atPos = x_email.indexOf("@", 1)
	if(atPos == -1)
	{
		return false;
	}
	//Atleast 1 charactor after the @
	if(x_email.indexOf("@",atPos+1) != -1)
	{
		return false
	}
	//Atleast 1 Dot after the @
	periodPos = x_email.indexOf(".", atPos)
	if(periodPos == -1)
	{
		return false;
	}
	//Atleat 2 charactors after the .
	if (periodPos+3 > x_email.length)
	{
		return false;
	}
	return true;
}
function checkSubmit() {
	alert(document.forms["theForm"].Email.value);
}
function submitIt()
{
	/* get form elements */
	var objForm = "" ;
	var email = document.getElementById("Email");
	var confirmEmail = document.getElementById("confirmEmail");
	var institution = document.getElementById("Institution");
	var title = document.getElementById("Title");
	var gradeLevel = document.getElementById("GradeLevel");
	var subject = document.getElementById("Subject");
	var postalCode = document.getElementById("PostalCode");
	
	if(!validEmail(email.value))
	{
		alert("\nSorry, Invalid E-Mail  . . . .\n" +
		  "\n All E-Mail addresses must have the following \n" +
		  "\n 1) Must not blank.\n" +
		  "\n 2) Must not have the following invalid characters \n" +
		  "\n        spaces + / ? ; : , () {} [] \ & % ! \n" +
		  "\n 3) Must have one @ character \n" +
		  "\n 4) at least one .(period) after the @ character \n");
		email.focus();
		email.select();
		return;
	}
	else
	{
		if(!validEmail(confirmEmail.value))
		{
			alert("\Please re-enter your E-Mail address.");
			confirmEmail.focus();
			confirmEmail.select();
		}
		else
		{
			if(email.value != confirmEmail.value)
			{
				alert("E-Mail addresses do not match.  Please retype your e-mail address.");
			}										
			else
			{
				if(!validName(institution.value))
				{
					alert("\nPlease Enter your School/Company\n");
					institution.focus();
					institution.select();
					return;
				}
				else
				{
					if(title.value == " ")
					{
						alert("\Please select Job Title/Position.");
						title.focus();
						title.select();
					}
					else
					{
						if(gradeLevel.value == " ")
						{
							alert("\Please select Grade Level.");
							gradeLevel.focus();
							gradeLevel.select();
						}
						else
						{
							if(subject.value == " ")
							{
								alert("\Please select Subject.");
								subject.focus();
								subject.select();
							}
							else
							{
								if(!validName(postalCode.value))
								{
									alert("\Please enter your Zip Code.");
									postalCode.focus();
									postalCodee.select();
								}
								else
								{	
									document.getElementById("theForm").submit();
								}	
							}		
						}	
					}
				}
			}	
		}		
	}
}
