// JavaScript Document

Shadowbox.init();

$(document).ready(init)

function init(){
	
	$(".selected").css("opacity",1);
	
	$("#tabcontrols li").live("click", tabClick);
	
	$(".tabContent:first").show();
	
	function tabClick(element) {
		$(".tabContent").hide();
        	var newImage = $(this).children("a").attr("name")
		$("#"+newImage).show();
		

		window.location.hash = newImage;
		theCallback();
		return false;
	}
	

        $(window).hashchange(function() 
	{
		$(".tabContent").hide();
        	var newImage = window.location.hash
		$(newImage).show();
		theCallback();
	});

	if (window.location.hash.length>=1)
	{
		$(".tabContent").hide();
		$("#tabcontrols li.active").removeClass("active");
		$(this).addClass("active");
        	var newImage = window.location.hash
		$(newImage).show();
		theCallback();
	}
        


	

	
	
	
	$("div.expanderPanel h3").click(expand);
	
	function expand() {
		$(this).parent("div.expanderPanel").find("div.expand").toggle();
		theCallback()	
	}

function theCallback()
{
	$(".sliderContainer").imageslider({
		viewLength:3
	});
	$(".gallery:visible").masonry({columnwidth:100});

}
	$(".sliderContainer").imageslider({
		viewLength:3
	});

	$(".gallery").masonry({columnwidth:100});
}
