/* Author: 

*/

$(document).ready(function() {
	
    //Set the speeds for the various banners/sliders
    var bannerSpeed = 8000;
    
    //Start the sliders and set their speed using the values provided
    var bannerInterval = setInterval("slideSwitch()", bannerSpeed);
        
});
        
/*
 *  Function which changes the slides in the slideshow on the front page
 */

function slideSwitch() {
    
    //Get the currently active image and descriptions
    var $active_img = $('#banner div.active');
    
    //check to see if we are at the last image
    if(!$active_img.next('div').length){
        
        //if we are at the last image, get the first img element in the slideshow to display next
        $next_img = $('#banner').children('div:first');
        
    }
    else{
        
        //else just next the next image element
        $next_img = $active_img.next('div');
        
    }
    
    //Give the active elements the last-active class to give them a lower z-index than the next elements to be displayed
    $active_img.addClass('last-active');
    
    //Animate the opacity of the next image to be displayed and give it the '.active' class to bring it to the front
    $next_img.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 1000, function() {
        $active_img.removeClass('active last-active');
    });
    
}






















