// For IE hover flicker bug
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

// Hello jQuery!
$(document).ready(function(){

// Gallery Nav Hover
	$("#nav_drop_category").mouseover(function() {$(this).addClass("sfhover")});
	$("#nav_drop_category").mouseout(function() {$(this).removeClass("sfhover")});
	$("#nav_drop_gall").mouseover(function() {$(this).addClass("sfhover")});
	$("#nav_drop_gall").mouseout(function() {$(this).removeClass("sfhover")});

// Thumbnail Hover
	$("#gallery #content .th").mouseover(function() {$(this).addClass("over")});
	$("#gallery #content .th").mouseout(function() {$(this).removeClass("over")});

// Animation
	$(".img_block").hide(); // hide all the image panes
	$("#slideshow .img_block:first").fadeIn(1000); // automatically show the first image pane
	$("#slideshow .img_block:first").addClass("activeImgPane"); // automatically show the first image pane


	var counter = 0;
	$("#slideshow .img_block").each(function(){
		var imgBlockNum = "imgBlock_"+counter
		$(this).addClass(imgBlockNum);
		counter++;
	});

	var counter = 0;
	$("#nav_slideshow div.th a").each(function(){
		var imgNum = "th_"+counter
		var imgNum2 = +counter
		$(this).addClass(imgNum);
		$(this).click(function(){
			$("#nav_slideshow div.th a").removeClass("active");
			$(this).addClass("active");
			$(".activeImgPane").fadeOut(500);
			$(".activeImgPane").removeClass("activeImgPane");
			$(".imgBlock_" + imgNum2).fadeIn(500);
			$(".imgBlock_" + imgNum2).addClass("activeImgPane");
			return false;
		});
		counter++;
	});

}); // Bye-bye jQuery!
