


function theRotator2() {
		
	//Set the opacity of all images to 0
	$('div.rotator2 ul li').css({opacity: 0.0});
	$('div.rotator2 ul li:first').css({opacity: 1.0});

	$('div.rotator3 ul li').css({opacity: 0.0});
	$('div.rotator3 ul li:first').css({opacity: 1.0});
	
	$('div.rotator4 ul li').css({opacity: 0.0});
	$('div.rotator4 ul li:first').css({opacity: 1.0});
	
	$('div.rotator5 ul li').css({opacity: 0.0});
	$('div.rotator5 ul li:first').css({opacity: 1.0});
	
	
	var inter1 = setInterval('rotate2()',12000);
	var inter2 = setInterval('rotate3()',12500);
	var inter3 = setInterval('rotate4()',13000);
	var inter4 = setInterval('rotate5()',13500);
		
}



function clear(){
     clearInterval(inter1);
     clearInterval(inter2);
     clearInterval(inter3);
     clearInterval(inter4);
		

}


function rotate2() {	
	//Get the first image
	var current = ($('div.rotator2 ul li.show')?  $('div.rotator2 ul li.show') : $('div.rotator2 ul li:first'));
    if ( current.length == 0 ) current = $('div.rotator2 ul li:first');
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator2 ul li:first') :current.next()) : $('div.rotator2 ul li:first'));	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');	
};

function rotate3() {	
	//Get the first image
	var current = ($('div.rotator3 ul li.show')?  $('div.rotator3 ul li.show') : $('div.rotator3 ul li:first'));
    if ( current.length == 0 ) current = $('div.rotator3 ul li:first');
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator3 ul li:first') :current.next()) : $('div.rotator3 ul li:first'));
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');	
};

function rotate4() {	
	//Get the first image
	var current = ($('div.rotator4 ul li.show')?  $('div.rotator4 ul li.show') : $('div.rotator4 ul li:first'));
    if ( current.length == 0 ) current = $('div.rotator4 ul li:first');
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator4 ul li:first') :current.next()) : $('div.rotator4 ul li:first'));
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');	
};

function rotate5() {	
	//Get the first image
	var current = ($('div.rotator5 ul li.show')?  $('div.rotator5 ul li.show') : $('div.rotator5 ul li:first'));
    if ( current.length == 0 ) current = $('div.rotator5 ul li:first');
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.rotator5 ul li:first') :current.next()) : $('div.rotator5 ul li:first'));
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');	
};






$(document).ready(function() {		
	//Load the slideshow
	theRotator2();
	
	$('div.rotator2').fadeIn(1000);
    $('div.rotator2 ul li').fadeIn(1000); // tweek for IE
     
	$('div.rotator3').fadeIn(1000);
    $('div.rotator3 ul li').fadeIn(1000); // tweek for IE
    
    
    $('div.rotator4').fadeIn(1000);
    $('div.rotator4 ul li').fadeIn(1000); // tweek for IE
    
    
    $('div.rotator5').fadeIn(1000);
    $('div.rotator5 ul li').fadeIn(1000); // tweek for IE
    
    
});



