$(document).ready(function(){

	slideSwitch();
	setInterval( "slideSwitch()", 10000 );
	
	$('#hpSlides li').hover( function() {
		$(this).find('.hpGalleryLabel').animate({opacity: 1}, 500);
	}, function() {
		$(this).find('.hpGalleryLabel').animate({opacity: .4}, 500);
	});

});

function slideSwitch() {
    var $active = $('#hpSlides li.active');
    var $next = $active.next();

    if ( $active.length == 0 ) $active = $('#hpSlides li:last');

    var $next =  $active.next().length ? $active.next()
        : $('#hpSlides li:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}


