/*
 ****************************************************************************************************
 *
 * COPYRIGHT NOTICE:
 *   (C) Copyright 2009 DealerTitan, Inc. All rights reserved.
 *
 * FILE NAME:
 *   home.js
 *
 * PURPOSE:
 *   Home Page Javascript functions
 *
 * NOTES:
 *
 * ABBREVIATIONS/ACRONYMS:
 *
 ****************************************************************************************************
*/

var Home_Slideshow_Timer = undefined;

//***************************************************************************************************
//Author: Chris Ayers
//Date: 4/27/09
//Function: Display the home page slideshow
//***************************************************************************************************
function Display_Home_Page_Slideshow()
{
  // Display the home page slideshow when loaded
  $(document).ready(function()
  {
    $('#Slideshow').cycle({
  		fx: 'fade',
  		timeout: 3000,
  		speed: 300,
  		pause: 1,
  		random: 1
  	});
  });
}

//***************************************************************************************************
//Author: Chris Ayers
//Date: 4/27/09
//Function: Advance the home page slideshow image
//***************************************************************************************************
function Advance_Home_Page_Slideshow()
{
  // Reset the timer to change the image
  Reset_Home_Page_Slideshow_Timer();
  
  // Advance the image (for the homepage this is previous due to float right)
  $.galleria.prev();
}

//***************************************************************************************************
//Author: Chris Ayers
//Date: 4/27/09
//Function: Reset the home page slideshow image timer
//***************************************************************************************************
function Reset_Home_Page_Slideshow_Timer()
{
  if (Home_Slideshow_Timer != undefined)
  {
    // Cancel any existing timeout
    clearTimeout(Home_Slideshow_Timer);
  }
  
  // Create a timer to change the image
  Home_Slideshow_Timer = setTimeout("Advance_Home_Page_Slideshow()",5000);
}
