// Flytter opp og fader inn neste bilde og flytter gammelt bilde bak n�r den kalles.
function slideSwitch() {
    var $active = $('#slideshow a.active');
    
    if ( $active.length == 0 ) $active = $('#slideshow a:last');
    
    var $next =  $active.next().length ? $active.next()
    : $('#slideshow a:first');
    
    $active.addClass('last-active');
    
    $next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
    });
}
// Flytter opp og fader inn neste bilde og flytter gammelt bilde bak n�r den kalles.
function slideSwitch2() {
    var $active = $('#slideshow2 a.active');
    
    if ( $active.length == 0 ) $active = $('#slideshow2 a:last');
    
    var $next =  $active.next().length ? $active.next()
    : $('#slideshow2 a:first');
    
    $active.addClass('last-active');
    
    $next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
    });
}

$(document).ready(function() { 						   
	//tiden i millisekund mellom hver gang slideswith() kj�res					   
	var refreshId1 = setInterval( "slideSwitch()", 6000 );   
    
	//Stopper autorulleringen ved mouse over ved � stoppe setInterval mens musa er over diven
    $("#fadeshow-wrap").hover(
        function() {
            clearInterval(refreshId1)
        }, 
        function() {
            refreshId1 = setInterval( "slideSwitch()", 6000 );
        }
    );
	//tiden i millisekund mellom hver gang slideswith2() kj�res					   
	var refreshId2 = setInterval( "slideSwitch2()", 6000 );   
    
	//Stopper autorulleringen ved mouse over ved � stoppe setInterval mens musa er over diven
    $("#fadeshow-wrap2").hover(
        function() {
            clearInterval(refreshId2)
        }, 
        function() {
            refreshId2 = setInterval( "slideSwitch2()", 6000 );
        }
    );  	
});
