//home.js 


function initRotator() {
	
	if($('#rotator').children().length > 1){
		$('#rotator .first').addClass('current');
		$('#rotator .first').siblings().css('position', 'absolute');
		$('#rotator .first').siblings().css('top', '0px');
		$('#rotator .first').siblings().hide();
		$('#rotator .first').siblings().children().hide();
		setInterval('rotate()',6000);
	}
	
}

function rotate() {	
	//curr image
	var current = $('#rotator').children('.current');

	//next image, or go back to first
	var next = ((current.next().length) ? ((current.next().hasClass('current')) ? $('#rotator .first') :current.next()) : $('#rotator .first'));	
	
	next.children(".eachframe").fadeIn(1000);
	next.children().show();
	next.fadeIn(1000).addClass('current');
	current.children(".eachframe").fadeIn(1000);
	current.fadeOut(1000).removeClass('current');
	current.children(".eachframe").fadeOut(1000);
	current.children().hide();
	current.fadeOut();
	
	
};

$(document).ready(function() {		
	initRotator();
});
