function fadeRotation() {
	//Set the opacity of all images to 0
	$('div[id*=rotator] ul li').css({opacity: 0.0});
	
	//Get first image and display it at full opacity
	$('div#rotator ul li:first').css({opacity: 1.0});
		
	//Call the rotation function (display interval in milliseconds)
	setInterval('rotation()',5800);	
}

function rotation() {	
	//Get first image for each div
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));

	//Get next image and cycle through upon reaching last image in each div
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));

	//Set the fade in effect for the next image in each div, the show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1200);

	//Hide the current image per div
	current.animate({opacity: 0.0}, 1200).removeClass('show');
};

$(document).ready(function() {		
	//Load image rotator.
	fadeRotation();

	//Load linked file icons.
	$('a[href*=http://]').hoverIcon({icon : '../neiwpcc_images/icons/small_exit_icon.png', xOffset : 23, yOffset : 0, fadeSpeed : 220});
	$('a[href*=https://]').hoverIcon({icon : '../neiwpcc_images/icons/small_exit_icon.png', xOffset : 23, yOffset : 0, fadeSpeed : 220});
	$('a[href$=.pdf]').hoverIcon({icon : '../neiwpcc_images/icons/small_pdf_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.doc]').hoverIcon({icon : '../neiwpcc_images/icons/small_doc_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.docx]').hoverIcon({icon : '../neiwpcc_images/icons/small_doc_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 252});
	$('a[href$=.ppt]').hoverIcon({icon : '../neiwpcc_images/icons/small_ppt_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.pptx]').hoverIcon({icon : '../neiwpcc_images/icons/small_ppt_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.xls]').hoverIcon({icon : '../neiwpcc_images/icons/small_xls_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.xlt]').hoverIcon({icon : '../neiwpcc_images/icons/small_xls_icon.png', xOffset : 21, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.zip]').hoverIcon({icon : '../neiwpcc_images/icons/small_zip_icon.png', xOffset : 22, yOffset : 20, fadeSpeed : 220});
	$('a[href$=.rar]').hoverIcon({icon : '../neiwpcc_images/icons/small_zip_icon.png', xOffset : 22, yOffset : 20, fadeSpeed : 220});

	//Load rounded corners for mainmenu, content container, and tabs.
	$("#content, #content2, #contentHome, #contentAlt, #pageNav").corner("8px");
	$("#neiwpcc_pic").corner("bottom tr 8px");
	$("#navBar").corner("8px");
	$("#content table td.tabs, #contentAlt table td.tabs, #content2 table td.tabs, #contentAlt2 table td.tabs").corner("top 12px");
});
