$(document).ready(function(){
	
	// set default opacity of overlays
	$(".thumb-hover .overlay").css("opacity", "0.7");
	
	// thumbnail hover
    $(".thumb-hover").hover(
      function () {
		// over
		if (!$.browser.msie) {
			$(this).find(".badge").fadeIn("fast");
			$(this).find(".overlay").fadeIn("fast");
		}
		else {
			// for IE, just set display: block, to avoid fade artifacts
			$(this).find(".badge").css("display", "block");
			$(this).find(".overlay").css("display", "block");
		}
      }, 
      function () {
		// out
		if (!$.browser.msie) {
			$(this).find(".badge").fadeOut("fast");
			$(this).find(".overlay").fadeOut("fast");
		}
		else {
			// for IE, just set display: none, to avoid fade artifacts
			$(this).find(".badge").css("display", "none");
			$(this).find(".overlay").css("display", "none");
		}
      }
    );

	// "plus" link hover
	$("#sidebar-more").hover(
		function () {
			// over
			$(this).find("span#more-more").fadeIn("fast");
		},
		function () {
			// out
			$(this).find("span#more-more").fadeOut("fast");
		}
	);
	
	// ignore IE, where doing this causes untold havoc
	if (!$.browser.msie) {
	
		// set photo page graduated opacities on thumbs
		$(".thumb-fade-outside").fadeTo("fast", 0.4);
		$(".thumb-fade-inside").fadeTo("fast", 0.8);
	
		// add hover behaviours to restore full opacity
		$(".thumb-fade-outside").hover(
	      function () {
			// over
	        $(this).fadeTo("fast", 1.0);
	      }, 
	      function () {
			// out
	        $(this).fadeTo("fast", 0.4);
	      }
	    );
		$(".thumb-fade-inside").hover(
	      function () {
			// over
	        $(this).fadeTo("fast", 1.0);
	      }, 
	      function () {
			// out
	        $(this).fadeTo("fast", 0.8);
	      }
	    );
	
	}

	// hide collection menu items by default
	//$("li.citem").hide();
	
	// add toggle behaviour for tag menu (default shown)
	$("li#top").toggle(
		function () {
			// hide items
			$("li.tagitem").fadeOut("fast");
		},
		function () {
			// show items
			$("li.tagitem").fadeIn("fast");
		}
	);
	
	// add toggle behaviour for collection menu (default not shown)
	$("li#top2").toggle(
		function () {
			// show items
			$("li.citem").fadeIn("fast");
		},
		function () {
			// hide items
			$("li.citem").fadeOut("fast");
		}
	);

});