﻿function checkContact(theForm)
{
  tripper = false;
  message = "Please correct the following errors and try again:\n\n";
  if(!checkWhite(theForm.Email))
  {
    tripper = true;
    message+="Your email address must be filled in.\n";
  }
  else
  {
    if(theForm.Email.value != theForm.Confirm.value)
    {
      tripper = true;
      message += "The email addresses you've typed do not match.\n";
    }
  }
  
  if(tripper==true)
  {
    alert(message);
    return false;
  }
  else
  {
    return true;
  }
}
  
 
//****************************************************checkWhite******************************************
function checkWhite(item)
{
  var tmp = "";
  var item_length = item.value.length;
  var item_length_minus_1 = item.value.length - 1;
  for (index = 0; index < item_length; index++)
  {
    if (item.value.charAt(index) != ' ')
    {
      tmp += item.value.charAt(index);
    }
    else
    {
      if (tmp.length > 0)
      {
        if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1)
        {
          tmp += item.value.charAt(index);
        }
      }
    }
  }
  if (tmp.length > 0)
  {
    return true;
  }
  else
  {
    return false;
  }
}
