
	// Set focus on form when page loads
	function formFoc()
	{
		quoteForm.name.focus()
	}
	
	// Check form for missing fields
	function validateQuote(passForm)
	{
		if (!passForm.name.value){
			alert("Name must be specified")
			passForm.name.focus()
			passForm.name.select()
			return false}
	
		if (!passForm.email.value && !passForm.address1.value && !passForm.telephone.value){
			alert("Email, address, or telephone must be specified so we can contact you")
			passForm.address1.focus()
			passForm.address1.select()
			return false}
		
	    if (!checkEmail(passForm.email)){
			alert("You must enter a valid email address")
			passForm.email.focus()
			passForm.email.select()
			return false
		}
		return true
	}

	// isEmail (STRING s [, BOOLEAN emptyOK])
	// 
	// Email address must be of form a@b.c -- in other words:
	// * there must be at least one character before the @
	// * there must be at least one character before and after the .
	// * the characters @ and . are both required
	function isEmail (s)
	{   
		if (isEmpty(s)) 
      		if (isEmail.arguments.length == 1) return true;
      		else return (isEmail.arguments[1] == true);
   
   		// is s whitespace?
   		if (isWhitespace(s)) return false;
    
   		// there must be >= 1 character before @, so we
   		// start looking at character position 1 
   		// (i.e. second character)
   		var i = 1;
   		var sLength = s.length;

   		// look for @
   		while ((i < sLength) && (s.charAt(i) != "@"))
   		{ 
   			i++
   		}

   		if ((i >= sLength) || (s.charAt(i) != "@")) return false;
   		else i += 2;

   		// look for .
   		while ((i < sLength) && (s.charAt(i) != "."))
   		{ 
   			i++
   		}

   		// there must be at least one character after the .
   		if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
   		else return true;
	}

	// checkEmail (TEXTFIELD theField [, BOOLEAN emptyOK==false])
	//
	// Check that string theField.value is a valid Email.
	//
	// For explanation of optional argument emptyOK,
	// see comments of function isInteger.
	function checkEmail (theField, emptyOK)
	{   
		if (checkEmail.arguments.length == 1) emptyOK = true;
    		if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    		else if (!isEmail(theField.value, false)) 
    		{
       		return false;
  			}
    	else return true;
	}

	// Return true if email is empty
	function isEmpty(s)
	{   
		return ((s == null) || (s.length == 0))
	}

	// Return true if email is whitespace
	function isWhitespace (s)
	{   
		var i;
		var whitespace = " \t\n\r";

    	// Is s empty?
    	if (isEmpty(s)) return true;

    	// Search through string's characters one by one
    	// until we find a non-whitespace character.
    	// When we do, return false; if we don't, return true.

    	for (i = 0; i < s.length; i++)
    	{   
       	// Check that current character isn't whitespace.
        	var c = s.charAt(i);

        	if (whitespace.indexOf(c) == -1) return false;
    	}

    	// All characters are whitespace.
    	return true;
	}

