//<![CDATA[
FunctionHandler.register( '*', function(){

	window.log("BSH scripts are running!");
	
	// ===--- NICE FADE & HOVER-INTENT STUFF FOR TOP NAV BAR ---=== //
	
	$(function(){

		$(".top_nav_sub_item_hover_css").removeClass("top_nav_sub_item_hover_css").addClass("top_nav_sub_item_hover_js").fadeOut(0);
		
		$(".top_nav_item").click(function(){$(this).children(".top_nav_sub_item_hover_js").fadeToggle();});
		
		var top_nav_hoverIntent_config = {
			over: function(){$(this).children(".top_nav_sub_item_hover_js").fadeIn();},
			timeout: 400,
			out: function(){$(this).children(".top_nav_sub_item_hover_js").fadeOut();} 
		};
	
		$(".top_nav_item").hoverIntent( top_nav_hoverIntent_config );

	});
	
	// ===--- Homepage slider ---=== //
	
	$('#feature_slider').nivoSlider({
		effect: 'fade',
		animSpeed: 600,
		pauseTime: 8000,
		pauseOnHover: true,
		captionOpacity: 0.5,
		controlNav: false,
		beforeChange: function(e){
			// window.log("Advancing from slide " + $("#feature_slider").data("nivo:vars").currentSlide);
		},
		afterChange: function(e){
			var caption_id = $("#feature_slider").data("nivo:vars").currentImage.data("caption");
			var new_caption = $(caption_id).html();
			$("#feature_slider_caption").html(new_caption);
			window.log("Taking caption from: " + caption_id);
		},
		afterLoad: function(e){
			var caption_id = $("#feature_slider").data("nivo:vars").currentImage.data("caption");
			var new_caption = $(caption_id).html();
			$("#feature_slider_caption").html(new_caption);
			window.log("Taking caption from: " + caption_id);
		}
	});
	
});
//]]>
