// JQuery Based Panel Rotator Application // gFly_Rotr V2.2009.12.02
// Grendelfly - A Division of SC&G Technology Solutions
// Requires JQuery: jquery-1.3.2.min.js or higher

// Updated 2010.02.16 	- cleaned up sentax and documentation
//						- added rotation on start up

// altered for CLECO - pulled all nav control function out


$(function(){
$(document).ready(function() {


// Set Rotator Styles
$('#gFly_Rotr').css({
	'width':'760px',
	'height':'60px',
	'margin':'0px auto',
	'padding':'0px',
	'position':'relative',
	'overflow':'hidden'
	});	
	var fTimer = ""; // Declears Variable fTime


// Rotator and Time Function
fTimer = setInterval(function(){fRotate()}, 8000); // timed at 8 seconds per rotation
							
function fRotate(){
	var nDiv = $('#gFly_Rotr div').length; nDiv = nDiv - 1; // Get number of divs in set
	var nPnl = $('#gFly_Rotr_Stats').html(); nPnl = parseInt(nPnl) + 1; // Get what div (panel) number we're currently on and moves one forward
	if (nPnl>nDiv) { nPnl=0;}; // if we've seen all panels let's start from the beginning
	$('#gFly_Rotr div').hide(); // hide all divs

	$('#gFly_Rotr div').each(function (index, domEle) { // index is 'number count' / domEle is 'this'
		if (index==nPnl){
			$(domEle).fadeIn(300); // Change 'Show' effect here - show,fadeIn,slideDown
			$('#gFly_Rotr_Stats').html(parseInt(nPnl));
			return false; // stops process			
		}; // if (index==nPnl)
	}); // $('#gFly_Rotr div').each

}; // function fRotate()


}); // $(document).ready
}); // $(function()