// JavaScript Document

	function formValidation(theForm) 
	{
		
		
		if (theForm.Email.value == "")
		{
			alert("\"Email\" is a required field.");
			theForm.Email.focus();
			return (false);
		}
		
		if (theForm.Email.value.indexOf("@") == -1 || theForm.Email.value.indexOf(".") == -1)
		{
			alert("The email you entered is not formatted correctly");
			theForm.Email.focus();
			return(false);
		}
		
		if (theForm.EmailVerify.value == "")
		{
			alert("\"Email Verify\" is a required field.");
			theForm.EmailVerify.focus();
			return (false);
		}
		
		
		if (theForm.EmailVerify.value.indexOf("@") == -1 || theForm.EmailVerify.value.indexOf(".") == -1)
		{
			alert("The verification email you entered is not formatted correctly");
			theForm.EmailVerify.focus();
			return(false);
		}
		
		if (theForm.Email.value.toUpperCase() != theForm.EmailVerify.value.toUpperCase())
		{
			alert("The verification email you typed does not match!");
			theForm.EmailVerify.focus();
			return (false);
		}
				
		
		if (theForm.password.value == "")
		{
			alert("\"Password\" is a required field.");
			theForm.password.focus();
			return (false);
		}
		if (theForm.passwordverify.value == "")
		{
			alert("\"Password Verify\" is a required field.");
			theForm.passwordverify.focus();
			return (false);
		}
		
		
		if (theForm.password.value.length < 4)
		{
			alert("The \"Password\" field must have more than 3 characters.");
			theForm.password.focus();
			return(false);
		}
		if (theForm.passwordverify.value.length < 4)
		{
			alert("The \"Password Verify\" field must have more than 3 characters.");
			theForm.passwordverify.focus();
			return(false);
		}
		
		
		
		if (theForm.password.value != theForm.passwordverify.value)
		{
			alert("The passwords you entered do not match!");
			theForm.password.focus();
			return(false);
		}
		
		
		
		if (theForm.FirstName.value == "")
		{
			alert("\"First Name\" is a required field.");
			theForm.FirstName.focus();
			return (false);
		}
		
		if (theForm.FirstName.value.length == 1)
		{
			alert("The \"First Name\" field must have more than 1 character.");
			theForm.FirstName.focus();
			return(false);
		}
		
		var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
        	
        	for (var i = 0; i < theForm.FirstName.value.length; i++) 
      		if (iChars.indexOf(theForm.FirstName.value.charAt(i)) != -1) 
               	{
               		alert ("Your First Name entry contains special characters. \nPlease remove any of the following characters from your First Name. \n @ ! # $ % ^ & * ( ) + = - [ ] \ \\ ' ; , .  /  { } |  \" : < > ?.\n");
                	theForm.FirstName.focus();
					return (false);
        	}
        
		
		if (theForm.LastName.value == "")
		{
			alert("\"Last Name\" is a required field.");
			theForm.LastName.focus();
			return (false);
		}
		
		
		
		if (theForm.LastName.value.length == 1)
		{
			alert("The \"Last Name\" field must have more than 1 character.");
			theForm.LastName.focus();
			return(false);
		}
		
		for (var i = 0; i < theForm.LastName.value.length; i++) 
      		if (iChars.indexOf(theForm.LastName.value.charAt(i)) != -1) 
               	{
               		alert ("Your Last Name entry contains special characters. \nPlease remove any of the following characters from your Last Name. \n @ ! # $ % ^ & * ( ) + = - [ ] \ \\ ' ; , .  /  { } |  \" : < > ?.\n");
					theForm.LastName.focus();
                	return (false);
        	}

	
		if (theForm.Address1.value == "")
		{
			alert("\"Address1\" is a required field.");
			theForm.Address1.focus();
			return (false);
		}
		
		for (var i = 0; i < theForm.Address1.value.length; i++) 
      		if (iChars.indexOf(theForm.Address1.value.charAt(i)) != -1) 
               	{
               		alert ("Your Address entry contains special characters. \nPlease remove any of the following characters from the Address. \n @ ! # $ % ^ & * ( ) + = - [ ] \ \\ ' ; , .  /  { } |  \" : < > ?.\n");
                	theForm.Address1.focus();
					return (false);
        	}
        	
        	
		for (var i = 0; i < theForm.Address2.value.length; i++) 
      		if (iChars.indexOf(theForm.Address2.value.charAt(i)) != -1) 
               	{
               		alert ("Your Address 2 entry contains special characters. \nPlease remove any of the following characters from the Address 2. \n @ ! # $ % ^ & * ( ) + = - [ ] \ \\ ' ; , .  /  { } |  \" : < > ?.\n");
                	theForm.Address2.focus();
					return (false);
        	}
		
		if (theForm.City.value == "")
		{
			alert("\"City\" is a required field.");
			theForm.City.focus();
			return (false);
		}
		
		for (var i = 0; i < theForm.City.value.length; i++) 
      		if (iChars.indexOf(theForm.City.value.charAt(i)) != -1) 
               	{
               		alert ("Your City entry contains special characters. \nPlease remove any of the following characters from the City. \n @ ! # $ % ^ & * ( ) + = - [ ] \ \\ ' ; , .  /  { } |  \" : < > ?.\n");
                	theForm.City.focus();
					return (false);
        	}
		
		if (theForm.Province.value == "" && theForm.state.selectedIndex < 1)
		{
			alert("\"State or Province\" is a required field.");
			theForm.state.focus();
			theForm.Province.focus();
			return (false);
		}
			
		
		if (theForm.Zip.value == "")
		{
			alert("\"Zip\" is a required field.");
			theForm.Zip.focus();
			return (false);
		}
		
		
		if (theForm.Zip.value.length < 5 || theForm.Zip.value.length > 10 )
		{
			alert("The \"Zip Code\" field must have at least 5 digits.");
			theForm.Zip.focus();
			return(false);
		}
		
		
		
		if (theForm.WorkPhone.value == "")
		{
			alert("\"Daytime Phone\" is a required field.");
			theForm.WorkPhone.focus();
			return (false);
		}
		
		if (theForm.WorkPhone.value.length < 10)
		{
			alert("The \"Daytime Phone Number\" field must have at least 10 digits.");
			theForm.WorkPhone.focus();
			return(false);
		}
						
		if (!isNumeric(theForm.WorkPhone.value))
		{
	alert("The \"Daytime Phone Number\" field must be only numbers.\n\nCorrect: 3335551212\n\nIncorrect : 333-555-1212 or (333) 555-1212");
			theForm.WorkPhone.focus();
			return false;
		}
						
		if (theForm.Phone.value == "")
		{
			alert("\"Evening Phone\" is a required field.");
			theForm.Phone.focus();
			return (false);
		}
		
		if (theForm.Phone.value.length < 10)
		{
			alert("The \"Evening Phone Number\" field must have at least 10 digits.");
			theForm.Phone.focus();
			return(false);
		}
						
		if (!isNumeric(theForm.Phone.value))
		{
			alert("The \"Evening Phone Number\" field must be only numbers.\n\nCorrect: 3335551212\n\nIncorrect : 333-555-1212 or (333) 555-1212");
			theForm.Phone.focus();
			return false;
		}
					
		
		if (theForm.Destination1.selectedIndex < 0)
		{
			alert("\"Select country 1\" is a required field.");
			theForm.Destination1.focus();
			return (false);
		}
		
	
		return (true);
}


function isNumeric(inputVal)
	{
		var checkOK = "0123456789-.";
		var checkStr = inputVal;
		var allValid = true;
		var decPoints = 0;
		var allNum = "";
		for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
				if (ch == checkOK.charAt(j))
					break;
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
			if (ch == ".")
			{
				allNum += ".";
				decPoints++;
			}
			else
				allNum += ch;
		}
		if (!allValid || decPoints > 0)
			return(false);
		return(true);
	}



