$(document).ready(function(){

	$("#team .staff:not(:first)").hide();
	$("#team").addClass("teambox");
	$("#team .staff").addClass("staffbox");
	$("#teamselect a:first").addClass("active");

	$("#teamselect a").click(function(evt) {
		if ($(this).attr("class") == "active") {
			evt.preventDefault();
		}
		else {
			evt.preventDefault();
			$("#teamselect a").removeClass("active");
			$(this).addClass("active");
			var staffselect = "#team " + $(this).attr("href");
			$("#team .staff").fadeOut(500);
			$(staffselect).fadeIn(500);
		}	
	});

	$("#worksamples .sample:not(:first)").hide();
	$("#worksamples").addClass("worksamplesbox");
	$("#worksamples .sample").addClass("samplebox");
	$("#worksamples h3").remove();
	$("#sampleselect a:first").addClass("active");
	
	$("#sampleselect a").click(function(evt) {
		if ($(this).attr("class") == "active") {
			evt.preventDefault();
		}
		else {
			evt.preventDefault();
			$("#sampleselect a").removeClass("active");
			$(this).addClass("active");
			var sampleselect = "#worksamples " + $(this).attr("href");
			$("#worksamples .sample").fadeOut(500);
			$(sampleselect).fadeIn(500);
		}	
	});
	
	
	$("a.x").lightBox({
		overlayOpacity: .5,
		overlayBgColor: '#000'
	});

	
// video landing page	

	$("#pgvideo .toggle .toggle-content").hide();
    $("#pgvideo .toggle h2").hover(
      function () {
        $(this).addClass("hover-state");
      }, 
      function () {
        $(this).removeClass("hover-state");
      }
    );
    $("#pgvideo .toggle h2").toggle(
      function () {
      	$(this).addClass("off");
        $(this).next().hide(500);
      },
      function () {
      	$(this).removeClass("off");
        $(this).next().show(500);
      }
    );
	$("#pgvideo .toggle h2").trigger("click");
	
	
	$("#pgvideo .sample").each(function() {
		$(this).hover (
			function() {
				$(this).addClass("hover-state");
				status=$(this).find("a").attr("href");
			}, 
			function () {
				$(this).removeClass("hover-state");
				status="";
			}	
		);
		$(this).click(function() {
			location = $(this).find("a").attr("href");
		});
	});
	
// video landing page - sample link with anchor tag to activate button on destination page

	$("#pgwork.izzys").each(function() {
		if ( location.hash == "#work-izzys2" ) {
			$("#sampleselect a:eq(1)").trigger("click");
			scroll(0,0);
		}
		else if ( location.hash == "#work-izzys6" ) {
			$("#sampleselect a:eq(5)").trigger("click");
			scroll(0,0);
		}
	});	

	
// fix spacing for two line title on client nav
    $("#client-subnav li br")
         .after("<span class='spacer'></span>");
	

	
});