/***
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch(num) {
    var slideshows = ["slideshow1","slideshow2","slideshow3", "slideshow4"];
    var $active = $('#' + slideshows[num]+ ' img.active');

    	if ( $active.length == 0 ) $active = $('#' + slideshows[num] + ' img:last');

    	var $next =  $active.next().length ? $active.next()
        	: $('#' + slideshows[num] + ' 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 slideswitchBack(num) {
    var slideshows = ["slideshow1","slideshow2","slideshow3", "slideshow4"];
    var $active = new array();
	var j = num;
    	$active[j] = $('#' + slideshows[j]+ ' img.active');

    	if ( $active[j].length == 0 ) $active[j] = $('#' + slideshows[j] + ' img:last');

    	var $next =  $active[j].next().length ? $active[j].next()
        	: $('#' + slideshows[j] + ' img:first');

    	$active[j].addclass('last-active');

    	$next.css({opacity: 0.0})
        	.addclass('active')
        	.animate({opacity: 1.0}, 1000, function() {
        	   $active[num].removeclass('active last-active');
        	});
}
*/
$(function() {
    setInterval( "slideSwitch(0)", 5000 );
    setTimeout('setInterval( "slideSwitch(1)", 5000 )', 1000);
    setTimeout('setInterval( "slideSwitch(2)", 5000 )', 2000);
    setTimeout('setInterval( "slideSwitch(3)", 5000 )', 3000);
});

