// #####################################################################
//
//   $RCSfile: MediaOrders.js,v $
//
//  $Revision: 2.1 $
//
//      $Date: 2005/10/24 07:47:30 $
//
//     Author: Dave Rosenfeld <rosenfel@tlsm.org>
//
//  Copywrite: 2005 The Living Savior Ministries
//
// #####################################################################


// ##################################################################
// This function will reset the Media Order Form should the 
// customer desire to do so
// ##################################################################
function Reset()
{
   return confirmIt = confirm("Are you sure you want to reset the form?")
}


// ##################################################################
// This function will check the Media Order for required fields and 
// then give option to submit order or cancel
// ##################################################################
function errorCheck()
{
   var FirstName =
       document.forms['MediaOrderForm'].elements['*RecipientFirstName'].value;
   var LastName =
       document.forms['MediaOrderForm'].elements['*RecipientLastName'].value;
   var StreetAddress =
       document.forms['MediaOrderForm'].elements['*StreetAddress'].value;
   var City =
       document.forms['MediaOrderForm'].elements['*City'].value;
   var Zipcode =
       document.forms['MediaOrderForm'].elements['*Zipcode'].value;
   var PhoneNumber =
       document.forms['MediaOrderForm'].elements['RecipientPhone1'].value;

   if ( !FirstName || !LastName || !StreetAddress || !City || !Zipcode )
   {
      var alertMsg = "An Order Processing Error Has Occurred. \n"
          + "The following information is required to process your order:\n\n";

      if ( !FirstName )
      {
         alertMsg = alertMsg + "Your First Name\n";
      }
      if ( !LastName )
      {
         alertMsg = alertMsg + "Your Last Name\n";
      }
      if ( !StreetAddress )
      {
         alertMsg = alertMsg + "Your Street Address\n";
      }
      if ( !City )
      {
         alertMsg = alertMsg + "Your City\n";
      }
      if ( !Zipcode )
      {
         alertMsg = alertMsg + "Your Zip Code\n";
      }
      if ( !PhoneNumber )
      {
         alertMsg = alertMsg + "Your Phone Number would be helpful should "
            + "a question arise concerning your order.\n";
      }

      alert( alertMsg );
   }
   else
   {
      confirmOrder = confirm( FirstName + " " + LastName
      + ", your order is ready to be processed.\n\n"
      + "If you wish to continue, select OK.\n"
      + "If not, you may Cancel your order at this time.\n\n"
      + "Thank you and God bless you." );

      if ( confirmOrder )
      {
         document.forms['MediaOrderForm'].submit();
      }
      else
      {
         alert( FirstName + " " + LastName
            + ", your order has been cancelled." );
      }
   }
}


// ======================================================================
// EDIT HISTORY FOR:
// $Source: /home/CVS/TLSM/MediaOrders.js,v $
//
// $Log: MediaOrders.js,v $
// Revision 2.1  2005/10/24 07:47:30  Dave
//  o Initial Revision taken from AudioOrders.js.
//
// Revision 2.0  2005/04/28 08:26:24  rosenfel
//  o Removed code pertaining to media title description.
//  o Updated title list
//
// Revision 1.10  2005/04/25 22:22:21  rosenfel
//  o Saving the last years changes prior to major rewrite.
//
// Revision 1.9  2004/08/18 23:25:39  ROSENFEL
//  o Added audio CD entries.
//
// Revision 1.8  2004/08/16 21:21:54  ROSENFEL
//  o Moved Reset() and checkFields() to common.js.
//
// Revision 1.7  2004/06/30 14:54:42  ROSENFEL
//  o James updated media descriptions.
//  o Removed the Audio: label at the beginning of Katlynn's Miracle
//    description.
//
// Revision 1.6  2004/06/29 17:55:37  ROSENFEL
//  o Completely rewrote CreateAudioOrderChecklist().
//
// Revision 1.5  2004/06/29 17:43:31  ROSENFEL
//  o Added a new Audio title.
//  o Added video tape descriptions.
//
// Revision 1.4  2004/05/26 15:44:25  ROSENFEL
//  o Changed AudioTapeDesc from single to double quotes.
//
// Revision 1.3  2004/05/10 21:48:53  ROSENFEL
//  o Corrected spelling error.
//
// Revision 1.2  2004/04/26 17:20:05  rosenfel
//  o Added CVS variables to all .cgi, .js, .html files.
//  o Added file information header and log footer.
//
// Revision 1.1.1.1  2004/04/26 15:26:46  rosenfel
// Initial Import
//

