// JavaScript Document

var sliderTimeoutHolder;

jQuery(document).ready(function() {
    
	if(jQuery("#FeaturedItem")) {
		jQuery("#FeaturedItem").add(jQuery("#FeatureContent")).hover(openPanel, closePanel);
		jQuery("#FeaturedItem").add(jQuery("#FeatureContent")).click(function() {
			window.location = jQuery('#FeatureLink').attr('href');
		});
	}
	
	jQuery("#CategoryHolder a.thumb").each(
		function(i) { 
			jQuery(this).add(jQuery(this).next()).hover(
				function() { 
					if(jQuery(this).next().attr('class')) 
						jQuery(this).next().css({ backgroundPosition:"110px -40px" });
					else
						jQuery(this).css({ backgroundPosition:"110px -40px" });
				},
				function() { 
					if(jQuery(this).next().attr('class'))
						jQuery(this).next().css({ backgroundPosition:"110px 5px" });
					else
						jQuery(this).css({ backgroundPosition:"110px 5px" });
				}
			);
		}
	);
	
	jQuery("#NLArchiveOpen").click(function() {
		var archive = jQuery('#NLArchive');
		var label = jQuery('#NLArchiveLabel');
		if(archive.css("display") == "none") {
			archive.slideDown(); label.text('Hide');
		} else {
			archive.slideUp(); label.text('Show');
		}
		return false;
	});
	
});

var openPanel = function() { 
  clearTimeout(sliderTimeoutHolder)
	jQuery("#FeatureContent").slideDown("slow");
};
var closePanel = function() { 
	sliderTimeoutHolder = setTimeout(function() {jQuery("#FeatureContent").slideUp("slow")}, 1000);
};

