function setCursor() 
	{
		document.theform.name.focus()
	}

function isEmpty()
{
	
	if (document.theform.name.value == "" || document.theform.name.value ==null)
		{
		document.theform.name.focus();
		alert ("Please enter your name.")
		return true
		}
		if (document.theform.number.value == "" || document.theform.number.value ==null)
	{
		document.theform.number.focus();
		alert ("Please enter a valid house number.")
		return true
		}
	if (document.theform.zip.value == "" || document.theform.zip.value ==null)
		{
		document.theform.zip.focus();
		alert ("Please enter a valid zip code.")
		return true
	}
		
	else
	{
	return false
	}
}
function isNotEmpty()
{
	
	if (document.theform.name.value != "" && document.theform.name.value !=null)
		{
		document.theform.name.focus();
		alert (document.theform.pin_name.value+" entered above, please choose only one search method.")
		return true
		}
		if (document.theform.number.value != "" && document.theform.number.value !=null)
	{
		document.theform.number.focus();
		alert (document.theform.pin_name.value+" entered above, please choose only one search method.")
		return true
		}
	if (document.theform.zip.value != "" && document.theform.zip.value !=null)
		{
		document.theform.zip.focus();
		alert (document.theform.pin_name.value+" entered above, please choose only one search method.")
		return true
	}
		
	else
	{
	return false
	}
}
//change to upper case
function upperMe(objname)
	{
		var field1 = eval("document.all.theform."+new String(objname))			
		field1.value= field1.value.toUpperCase();
	}

//fix name
function fixName()
{
if
(document.theform.name.value.indexOf (' ',0) > 1) 
{
alert("Please enter one name, without any spaces, for your last name.")
document.theform.name.focus();
return true;
}
else
	{
	return false;
	}
}		


	
//check zip code
function checkZip()
{
	var zipcode = document.theform.zip.value
	if ( zipcode.length  != 5 && zipcode.length  != 6 )
	{
		alert("Zip code must be 5 or 6 characters.")
		document.theform.zip.focus();
		return true;
		}
	
	/*var zip=document.theform.zip.value
	inputStr=document.theform.zip.value.toString()
	for (var i=0; i < inputStr.length; i++)
	{
	var oneChar=inputStr.charAt(i)
	if (oneChar < "0" || oneChar > "9")
		{	
		document.theform.zip.focus()
		alert("Zip code may contain only numbers.")
			return true
		}
	}*/
	return false
	}

function checkNum()
{
	var num = document.theform.number.value
	
	inputStr=document.theform.number.value.toString()
	for (var i=0; i < inputStr.length; i++)
	{
	var oneChar=inputStr.charAt(i)
	if (oneChar < "0" || oneChar > "9")
		{	
		document.theform.number.focus()
		alert("Your house number may contain only numbers.")
			return true
		}
	}
	return false
	}
	


//Here is the batch form validation	for if there is no pin lookup for the subdomain
function validateForm()
{
	if (isEmpty())
		{
			return false;
		}
	
	if (fixName())
		{
			return false;
		}
	if (checkZip())
	{
			return false;
	}			
	else
	{
	return true;
	}
}

//Here is the batch form validation	for if there is a pin lookup for the subdomain
function validateForm2()
{
	if (document.theform.pin.value == "" || document.theform.pin.value ==null)
	{		
		if (isEmpty())
			{
				return false;
			}
		
		if (fixName())
			{
				return false;
			}
		if (checkNum())
			{
				return false;
			}
		if (checkZip())
		{
				return false;
		}			
 		else
		{
			document.theform.pin.value = "None";
			return true;
		} 
	}
	else
	{
		if(isNotEmpty())
		{
			return false
		}
		else
		{
			return true;
		}
	}	
}





