// JavaScript Document

$('document').ready(function(){

$('.slidebtn1').hover(function(){
							   
							   $('#img1').addClass('active');
							   
							   });

$('.slidebtn2').hover(function(){
							   
							   $('#img2').addClass('active');
							   
							   });

$('.slidebtn3').hover(function(){
							   
							   $('#img3').addClass('active');
							   
							   });
});


function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 3000 );
});

function buttonSwitch() {
    var $active = $('.act');

    if ( $active.length == 0 ) $active = $('.slidebuttons :last');

    var $next =  $active.next().length ? $active.next()
        : $('.slidebuttons :first');

    $active.addClass('act');

    $next.css({opacity: 0.0})
        .addClass('act')
        .animate({opacity: 1.0},500, function() {
            $active.removeClass('act');
        });
}

$(function() {
    setInterval( "buttonSwitch()", 3000 );
});

