/***********************************************************
*  validate.js                                             *
*    Contains form validation function.                    *
*                                                          *
*  Version 001 -- Original Version.                        *
*                 1324532 -- Jim Currey                    *
*                 11/17/2009 -- Jose Rosado                *                 
***********************************************************/
/***********************************************************
* validate()                                               *
*   Checks if field exists before validating. If field is  *
*   empty returns false. If all fields have values, returns*
*   true.                                                  *
***********************************************************/
function validate()
{
  var strInput = "";

  //** NAME **//
  strInput = "NAME";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  //** PHONE **//
  strInput = "PHONE";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  //** EMAIL **//
  strInput = "EMAIL";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  //** MOVETYPE **//
  strInput = "MOVETYPE";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  //** MOVEDATE **//
  strInput = "MOVEDATE";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  //** PICKUPZIP **//
  strInput = "PICKUPZIP";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  //** DELIVERYZIP **//
  strInput = "DELIVERYZIP";  // <--- CHANGE THIS TO MATCH ID OF INPUT TAG
  // Check if input exists
  if( document.getElementById( strInput ) != null )
  {
    // Input exists

    // Check if input is empty
    if( document.getElementById( strInput ).value == "" )
    {
      // Input is empty

      // Display error
      alert( "All fields are required." );

      // Return false to stop form from submitting
      return false;
    }
  }
   
  // All input fields have values
  return true;
} // validate()
