$(document).ready(function() {

	// For each link containing -off, set up a -on hover
	$("img[src*='-off']").each(function() {
	
		// Preload on state
		var img = new Image();
		img.src = $(this).attr("src").replace(/-off/,"-on");
		
		// If this is within the navigation, then put the hover on the <li> so it stays switched during dropdown navs
		if ($(this).parent().parent().parent().parent().attr("id") == "main-nav")
		{
			// Set up the hover switcher
			$(this).parent().parent().hover(function() {
				$(this).find("img").attr("src",$(this).find("img").attr("src").replace(/-off/,"-on"));
			}, function() {
				$(this).find("img").attr("src",$(this).find("img").attr("src").replace(/-on/,"-off"));
			});
		} 
		else 
		{
			// Set up the hover switcher
			$(this).hover(function() {
				$(this).attr("src",$(this).attr("src").replace(/-off/,"-on"));
			}, function() {
				$(this).attr("src",$(this).attr("src").replace(/-on/,"-off"));

			});
			
		}
		
	
	});
	
	$("#main-nav > ul > li").hover(function() {
		$(this).find("ul").show();
	}, function() {
		$(this).find("ul").hide();
		
		
	});
	
if ($("#feature-banner").length > 0)
	{
		// Homepage features
		$("#feature-banner").flash({
			swf: 'flash/feature-banner.swf',
			height: 282,
			width: 691
		});
	}
});

