TK = {};

TK.init = function($){
	//add scroll event to all project links
	$("#work_nav").find("li").click( TK.scrollTo );
	$("#title").click( TK.scrollTo );
	//add expand event to all content links
	$(".expand_button").click( TK.expand );
	
	//set intro button to expand
	$("#intro_more_button").click( TK.expand );
	
	//add title hidden rollover#
	$("#title").mouseover( function(){ $("#title_hidden").addClass("show"); } );
	
	//make all the galleries
	$(".gallery_wrapper").each( function(){
		//make the slider
		var ele = $(this);
		var slider = ele.find(".gallery").bxSlider( {controls: false} );
		//add the navigation controls
		ele.find(".gallery_nav.L").click( function(){
			slider.goToPreviousSlide();
			return false;
		});
		ele.find(".gallery_nav.R").click( function(){
			slider.goToNextSlide();
			return false;
		});	
	});
	
};

TK.scrollTo = function(e){
	e.preventDefault();
	//get link val
	var dest = $(this).find("a").attr("href"); 	
	$('html, body').animate({ scrollTop: $(dest).offset().top-130 }, 600);
};

TK.expand = function(e){
	e.preventDefault();
	//get the content partent and add the expand class
	$(this).closest(".content").addClass("expand", 400)
		.find(".proj_title").hide().end()
		.find("div").addClass("expand", 400);
};
