/*
 ****************************************************************************************************
 *
 * COPYRIGHT NOTICE:
 *   (C) Copyright 2009 DealerTitan, Inc. All rights reserved.
 *
 * FILE NAME:
 *   contact_us.js
 *
 * PURPOSE:
 *   Contact Us Javascript functions
 *
 * NOTES:
 *
 * ABBREVIATIONS/ACRONYMS:
 *
 ****************************************************************************************************
*/

//***************************************************************************************************
//Author: Chris Ayers
//Date: 5/7/09
//Function: Send the support request
//***************************************************************************************************
function Send_Contact_Request()
{
  // Get the user data
  var Name = Symbol_Encode(jQuery("#Contact_Form #Name").val());
  var Email = Symbol_Encode(jQuery("#Contact_Form #Email").val());
  var Phone = Symbol_Encode(jQuery("#Contact_Form #Phone").val());
  var Comments = Symbol_Encode(jQuery("#Contact_Form #Comments").val());
  
  if (Name == "")
  {
    jAlert("Please enter your Name.");
  }
  else if (Email == "" &&
           Phone == "")
  {
    jAlert("Please enter either your Email Address or Phone Number.");
  }
  else if (Comments == "")
  {
    jAlert("Please enter your Comments.");
  }
  else
  {
    // Toggle the busy notifier
    Toggle_Busy_Notifier();
    
    // Perform the ajax call
    jQuery.post("index.php",
                {
                  Function_Name:"Send_Contact_Request",
                  Name:Name,
                  Email:Email,
                  Phone:Phone,
                  Comments:Comments
                },
                function(data)
                {
                  // Toggle the busy notifier
                  Toggle_Busy_Notifier();
    
                  if (data != "")
                  {
                    jAlert(data, "Error sending contact request");
                  }
                  else
                  {
                    jAlert("Comments sent successfully.  We will respond shortly.","Comments Sent",
                           function()
                           {
                             window.location.reload();
                           });
                  }
                });
  }
}