  
  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;
    }

  function isEmpty( s ) 
    {
      return ((s == null) || (s.length == 0))
    }

  function checkForm(form)
    {
      var form = document.forms[0] 
      
      if (form.age.value == "")
        {
          alert("You must enter your age.")
          return false
        }      
      if (form.age.value < 13) 
        {
          alert("You must be over 13 years old to use this form.")
          return false
        }      
      if ( ! form.privacy.checked) 
        {
          alert("You must read and understand our privacy policy before using this form.")
          return false
        }    
      if(isWhitespace(form.name.value))
        {
          alert("Please enter the name of the Scout being registered.")			
	  return false
        }	
      if(isWhitespace(form.unitno.value))
        {
          alert("Please enter the Scouts troop number.")
          return false
        }
      if(isWhitespace(form.email.value)) 
        {
          alert("An email address must be specified for processing this form.")
	  return false
        }
    } 