var rotatorSpeed = 5000000;

$(document).ready(function(){
	$('a.green-button, a.more').append('<span class="right-button"></span>');
	$("#home-boxes li:even").addClass("even");
	$("footer .footer ul:first-child").addClass("first-child");

	//Banner rotator
	$('#banner-rotator li:eq(0)').css("display", "block");
	runBannerRotator = setInterval('bannerRotateNext()', rotatorSpeed*1000);
	$('#banner-rotator').hover( //stop rotation on mouse over
		function() {
			clearInterval(runBannerRotator);
		}, 
		function() {
			runBannerRotator = setInterval('bannerRotateNext()', rotatorSpeed*1000);	
		}
	); 
	
	/* Prevent accidental deleting */
	$('[rel=delete]').click(function(){
		return confirm("Are you sure you want to delete " +
			$(this).attr("title") +"? \n\n Can not be undone!");
	});

	/* Init feature list on home (or any other) page */
	if($.fn.featureList) {
	$('.feature-list .feature-tabs li a').featureList({
		output			:	'.feature-list .feature-tab-output li',
		start_item		:	0,
		transition_interval: 4500
	});
	}
});


function bannerRotateNext()
{
	$('#banner-rotator li:first-child').fadeOut()
	.next('li').fadeIn()
	.end().appendTo('#banner-rotator');
}


//Notification Animations
$(function () { 
	$('.notification').hide().append('<span class="close" title="Dismiss"></span>').fadeIn('slow');
	$('.notification .close').hover(
		function() { $(this).addClass('hover'); },
		function() { $(this).removeClass('hover'); }
	);
	$('.notification .close').click(function() {
		$(this).parent().fadeOut('slow', function() { $(this).remove(); });
	});
});

