/* Author: Les graphiquants

*/
var intervalHome = 0;
var intervalSpeed = 2500;

var value = $('#slideshow DIV.active a').attr('href');
$('span#slideshowOver a').attr('href',value);
	
  	function slideSwitch() {
    		var $active = $('#slideshow DIV.active');
    		if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
    		var $next =  $active.next().length ? $active.next()
        		: $('#slideshow DIV:first');
		    $active.addClass('last-active');
		    $next.css({opacity: 1}).addClass('active');
			$active.removeClass('active last-active');
			var newUrl = $next.find('a').attr('href');
			$("#slideshowOver").find('a').attr('href', newUrl);
		}
		
//$(document).ready(function() {

		if ($("#slideshow").length){ intervalHome = setInterval( "slideSwitch()", intervalSpeed );}	
			
		$("#slideshowOver a").mouseover(function(){
			clearInterval(intervalHome);
			$(this).animate({opacity: 1}, 'fast');
		});

		$("#slideshowOver a").mouseout(function(){
			$(this).animate({opacity: 0}, 'fast');
			intervalHome = setInterval( "slideSwitch()", intervalSpeed );
		});

//});
