// JavaScript Document
function next1()
{
	var sp1=document.getElementById("p1").value;
	if(sp1.length==3)
	{
		document.getElementById("p2").focus();
	}
}
function next2()
{
	var sp2=document.getElementById("p2").value;
	if(sp2.length==3)
	{
		document.getElementById("p3").focus();
	}
}
function checkForm()
{
	var sendTo= false;
	var comp= false;
	var name= false;
	var add= false;
	var city= false;
	var state= false;
	var zip= false;
	var phone= false;
	var email= false;
	
	var orgD= false;
	var addressD= false;
	var cityD= false;
	var stateD= false;
	var zipD= false;
	var phoneD= false;
	
	
	//checks if form is complete
	
	
	//this field is ALWAYS mandatory
	if(document.getElementById("sendTo").value=="blank")
	{
		alert("Please select what information you want!");
		document.getElementById("sendTo").focus();
		sendTo=false;
	}
	else
	{
		sendTo=true;
		//sets what is manditory
	
		if(document.getElementById("sendTo").value=="vendor"){
				var orgD= true;
				var addressD= true;
				var cityD= true;
				var stateD= true;
				var zipD= true;
				var phoneD= true;
		}
		if(document.getElementById("sendTo").value=="parade"){
				var orgD= true;
				var addressD= true;
				var cityD= true;
				var stateD= true;
				var zipD= true;
				var phoneD= true;
		}	
		if(document.getElementById("sendTo").value=="entertain"){
				var orgD= false;
				var addressD= false;
				var cityD= false;
				var stateD= false;
				var zipD= false;
				var phoneD= true;
		}
		if(document.getElementById("sendTo").value=="sponsor"){
				var orgD= false;
				var addressD= false;
				var cityD= false;
				var stateD= false;
				var zipD= false;
				var phoneD= true;
		}
		if(document.getElementById("sendTo").value=="volunteer"){
				var orgD= false;
				var addressD= false;
				var cityD= false;
				var stateD= false;
				var zipD= false;
				var phoneD= false;
		}	
		if(document.getElementById("sendTo").value=="more"){
				var orgD= false;
				var addressD= false;
				var cityD= false;
				var stateD= false;
				var zipD= false;
				var phoneD= false;
		}	
	}
	
	//this field is optional in some instances. A value of "false" means it's NOT required and sets the fill value automatically to true
	if(orgD==false){
		comp=true;
	}
	else{
		if(document.getElementById("org").value=="")
		{
			alert("Please enter Company/Organization!");
			document.getElementById("org").focus();
			comp=false;
		}
		else
		{
			comp=true;
		}
	}
	
	//this field is ALWAYS mandatory
	if(document.getElementById("name").value=="")
	{
		alert("Please enter name!");
		document.getElementById("name").focus();
		name=false;
	}
	else
	{
		name=true;
	}
	
	//this field is optional in some instances. A value of "false" means it's NOT required and sets the fill value automatically to true
	if(addressD==false){
		add=true;
	}
	else{
		if(document.getElementById("address").value=="")
		{
			alert("Please enter Address!");
			document.getElementById("address").focus();
			add=false;
		}
		else
		{
			add=true;
		}
	}
	
	//this field is optional in some instances. A value of "false" means it's NOT required and sets the fill value automatically to true
	if(cityD==false){
		city=true;
	}
	else{
		if(document.getElementById("city").value=="")
		{
			alert("Please enter city!");
			document.getElementById("city").focus();
			city=false;
		}
		else
		{
			city=true;
		}
	}
	
	//this field is optional in some instances. A value of "false" means it's NOT required and sets the fill value automatically to true
	if(stateD==false){
		state=true;
	}
	else{
		if(document.getElementById("state").value=="")
		{
			alert("Please enter State!");
			document.getElementById("state").focus();
			state=false;
		}
		else
		{
			state=true;
		}
	}
	
	//this field is optional in some instances. A value of "false" means it's NOT required and sets the fill value automatically to true
	if(zipD==false){
		zip=true;
	}
	else{
		if(document.getElementById("zip").value=="")
		{
			alert("Please enter zip code!");
			document.getElementById("zip").focus();
			zip=false;
		}
		else
		{
			zip=true;
		}
	}
	
	//this field is optional in some instances. A value of "false" means it's NOT required and sets the fill value automatically to true
	if(phoneD==false){
		phone=true;
	}
	else{
		if(document.getElementById("p1").value== "" || document.getElementById("p2").value== "" || document.getElementById("p3").value== "")
		{
			alert("Please enter valid phone!");
			document.getElementById("p1").focus();
			phone=false;
		}
		else
		{
			phone=true;
		}
	}
	
	//this field is ALWAYS mandatory
	if(document.getElementById("email").value=="")
	{
		alert("Please enter E-mail address!");
		document.getElementById("email").focus();
		email=false;
	}
	else
	{
		email=true;
	}
	
	if(comp==true && name==true && add==true && city==true && state==true && zip==true && phone==true && email==true && sendTo==true){
		return true;
	}
	else{
		return false;
	}

}
/*
For any inquiry:
The "You are interested in:" menue is ALWAYS mandatory - mostly because it sets what's required and where the message is going.
The "Additional Message" is ALWAYS optional and limited to 500 characters (this is adjustable- 500 sound good to you?)
The "Primary Contact Person" and "e-mail address" fields are ALWAYS mandatory

For Vendor and Parade inquiries:
All fields except "Additional Message" required

For Entertainment and sponsorship inquiries:
"Primary contact", "E-mail", and "Phone" are the only ones required

For volunteering and more information:
only "Primary contact person" and "e-mail" are required
*/
