
//By Dylan Wagstaff, http://www.alohatechsupport.net 
//  allmost all changed by AKSOS, http://www.redaks.com 

var $myInterval = 0;
var $slideInterval = 3000; // 6000 = change to next image after 6 seconds

function mainRotator() {
	//Set the opacity of all images to 0
	$('#sanubabuRotator a').css({opacity: 0.0});
	//Get the first image and display it (gets set to full opacity)
	$('#' + $rotatorParts[0]).css({opacity: 1.0});
	//$('#sanubabuRotator a:first').css({opacity: 1.0});
	//Call the rotator function to run the slideshow
	$myInterval = setInterval('rotateThis()', $slideInterval);
}

function rotateThis() {
	//Get the first image
	var current = ($('#sanubabuRotator a.show') ? $('#sanubabuRotator a.show') : $('#sanubabuRotator a: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')) ? $('#sanubabuRotator a:first') :current.next()) : $('#sanubabuRotator a: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
	mainRotator();
});


function navigOver($part) {
	//Clear and stop the rotator 
	clearInterval($myInterval);
	//Set the opacity of all images to 0
	$('#sanubabuRotator a').css({opacity: 0.0});
	$('#sanubabuRotator a').removeClass('show');
	//Get the first image and display it (gets set to full opacity)
	$('#' + $part + '_1').css({opacity: 1.0});
	$('#' + $part + '_1').addClass('show');
	document.getElementById('href_' + $part).style.color = "#FFFFFF";
	document.getElementById('href_' + $part).style.backgroundColor = "#F7941D";
}
function navigOut($part) {
	//Call the rotator function to run the slideshow 
	$myInterval = setInterval('rotateThis()', $slideInterval);
	document.getElementById('href_' + $part).style.color = "#F7941D";
	document.getElementById('href_' + $part).style.backgroundColor = "transparent";
}

function rotatorOver($part, $thisId) {
	//Clear and stop the rotator 
	clearInterval($myInterval);
	//Set the opacity of all images to 0
	$('#sanubabuRotator a').css({opacity: 0.0});
	$('#sanubabuRotator a').removeClass('show');
	//Get the first image and display it (gets set to full opacity)
	$('#' + $thisId).css({opacity: 1.0});
	$('#' + $thisId).addClass('show');
	document.getElementById('href_' + $part).style.color = "#FFFFFF";
	document.getElementById('href_' + $part).style.backgroundColor = "#F7941D";
}
function rotatorOut($part) {
	//Call the rotator function to run the slideshow 
	$myInterval = setInterval('rotateThis()', $slideInterval);
	document.getElementById('href_' + $part).style.color = "#F7941D";
	document.getElementById('href_' + $part).style.backgroundColor = "transparent";
}

