

/* make sure required fields have a value */	
function isEmpty()
{

	var valUsed="";
	for (var i=0; i < document.theform.used.length; i++)
	    {
	    if (document.theform.used[i].checked)
	       {
	       var valUsed = document.theform.used[i].value;
	       }
	    }	
	var valHave="";
	for (var i=0; i < document.theform.have.length; i++)
	    {
	    if (document.theform.have[i].checked)
	       {
	       var valHave = document.theform.have[i].value;
	       }
	    }		
			
	if (document.theform.fname.value == "" || document.theform.fname.value ==null)
		{
		document.theform.fname.focus();
		alert ("Please enter your first name.")
		return true
		}
	if (document.theform.lname.value == "" || document.theform.lname.value ==null)
		{
		document.theform.lname.focus();
		alert ("Please enter your last name.")
		return true
		}
	if (document.theform.address.value == "" || document.theform.address.value ==null)
		{
		document.theform.address.focus();
		alert ("Please enter your address.")
		return true
		}
	if (document.theform.city.value == "" || document.theform.city.value ==null)
		{
		document.theform.city.focus();
		alert ("Please enter your city.")
		return true
		}
	if ((document.theform.state.options[document.theform.state.selectedIndex].value) == "" || (document.theform.state.options[document.theform.state.selectedIndex].value) ==null)
		{
		document.theform.state.focus();
		alert ("Please select a state.")
		return true
		}
	if (document.theform.zip.value == "" || document.theform.zip.value ==null)
		{
		document.theform.zip.focus();
		alert ("Please enter your zip code.")
		return true
		}
	if (document.theform.email.value == "" || document.theform.email.value ==null)
		{
		document.theform.email.focus();
		alert ("Please enter your e-mail address.")
		return true
		}
	if (document.theform.email_conf.value == "" || document.theform.email_conf.value ==null)
		{
		document.theform.email_conf.focus();
		alert ("Please confirm your e-mail address.")
		return true
		}
	if ((document.theform.age.options[document.theform.age.selectedIndex].value) == "" || (document.theform.age.options[document.theform.age.selectedIndex].value) ==null)
		{
		document.theform.age.focus();
		alert ("Please select an age range.")
		return true
		}
	if ((document.theform.occupation.options[document.theform.occupation.selectedIndex].value) == "" || (document.theform.occupation.options[document.theform.occupation.selectedIndex].value) ==null)
		{
		document.theform.occupation.focus();
		alert ("Please select an occupation.")
		return true
		}
	if ((document.theform.how.options[document.theform.how.selectedIndex].value) == "" || (document.theform.how.options[document.theform.how.selectedIndex].value) ==null)
		{
		document.theform.how.focus();
		alert ("Please select how you found out about this offer.")
		return true
		}
	if (valUsed == "" || valUsed ==null)
		{
		alert ("Please select an answer for 'Have you used Post-It Pop-Up Notes Before?'.")
		return true
		}
	if (valHave == "" || valHave ==null)
		{
		alert ("Please select an answer for 'Do you have a Post-It Pop-Up Notes dispenser?'.")
		return true
		}
	if ((document.theform.where_have.options[document.theform.where_have.selectedIndex].value) == "" || (document.theform.where_have.options[document.theform.where_have.selectedIndex].value) ==null)
		{
		document.theform.where_have.focus();
		alert ("Please select where you have a Pop-up Notes dispenser now.")
		return true
		}	
	if ((document.theform.where_like.options[document.theform.where_like.selectedIndex].value) == "" || (document.theform.where_like.options[document.theform.where_like.selectedIndex].value) ==null)
		{
		document.theform.where_like.focus();
		alert ("Please select where you would like to have a Pop-up Notes dispenser.")
		return true
		}	
		
	if ((document.theform.where.options[document.theform.where.selectedIndex].value) == "" || (document.theform.where.options[document.theform.where.selectedIndex].value) ==null)
		{
		document.theform.where.focus();
		alert ("Please select where you usually purchase your office products.")
		return true
		}		
	else
	{
		return false
	}
}

function checkEmailConf()
{
	if (document.theform.email.value != document.theform.email_conf.value)
	{
		document.theform.email.focus();
		alert ("The e-mail addresses entered do not match.  Please correct.")
		return true
	}
	else
	{
		return false
	}
}

//Here is the batch form validation		
function validateForm()
{	
	if (isEmpty())
		{
			return false;
		}
	if (fnameNumbers())
		{
			return false;
		}
	
	if (lnameNumbers())
		{
			return false;
		}
	if (fixAddress())
		{
			return false;
		}
	if (nukeCity())
		{
			return false;
		}
	if (fixCity())
		{
			return false;
		}	
	
	if (checkZip())
		{
			return false;
		}
	if (checkEmail())
		{
			return false;
		}
	if (checkEmailConf())
		{
			return false;
		}
	else
		{
			return true;
		}
}

