jQuery(document).ready(function($) {
	$("#nav ul li").hover(
		function(){
			$("ul", this).stop(true,true).slideDown();
			$(this).addClass('active');
		},
		function(){
			$("ul", this).stop(true,true).slideUp();
			$(this).removeClass('active');
		}
	);
	
	$('h5').css('visibility','visible').innerfade({ 
		speed: 'slow', 
		timeout: 2000, 
		type: 'sequence', 
		containerheight: '1em' }); 
  
	if( $('#people-nav').length ) {
	  if(window.location.hash) {
	    var hash = (window.location.hash.replace("#",""));
	    var file = "/people/" + hash + ".json";
	    $.getJSON(file, function(data) {
	      $('#showcase-image').fadeOut();
        $('#showcase-image').attr("src", data['image']);
        $('#showcase-image').fadeIn();
        $('.author').html(data['info']['author']);
        $('.position').html(data['info']['author-position']);
        //$('.more').html(data['info']['email']);
        $('#people-info').html(data['text']);
      });
	  }
	  $('#people-nav a').hover(
	    function() {
	      $("img",this).stop(true,true).fadeTo('slow', 0.75);
	    },
	    function() {
	      $("img",this).stop(true,true).fadeTo('slow', 1);
	    }
	  );
	  $('#people-nav a').click(function() {
	      $('#people-info').html("loading...");
        var file = $(this).attr("href");
                
        $.getJSON(file, function(data) {
          $('#showcase-image').attr("src", data['image']);
          $('.author').html(data['info']['author']);
          $('.position').html(data['info']['author-position']);
          //$('.more').html(data['info']['email']);
          $('#people-info').html(data['text']);
        });
        
        return false;
	  });
	}
	if( $('#team-nav').length ) {
	  if(window.location.hash) {
	    var hash = (window.location.hash.replace("#",""));
	    var file = "/people/" + hash + ".json";
	    $.getJSON(file, function(data) {
	      $('#showcase-image').fadeOut();
        $('#showcase-image').attr("src", data['image']);
        $('#showcase-image').fadeIn();
        $('.position').html(data['team']);
        $('.author').html(data['title']);
      });
	  }
	  $('#team-nav a').hover(
	    function() {
	      $("img",this).stop(true,true).fadeTo('slow', 0.75);
	    },
	    function() {
	      $("img",this).stop(true,true).fadeTo('slow', 1);
	    }
	  );
	  $('#team-nav a').click(function() {
        var file = $(this).attr("href");
                
        $.getJSON(file, function(data) {
          $('#showcase-image').attr("src", data['image']);
          $('.position').html(data['team']);
          $('.author').html(data['title']);
          console.log(data['title']);
        });
        
        return false;
	  });
	}
	$('.practice-sections').each(function(){
	  $('.practice-section:last', this).addClass('last');
	});
	$("#accordion").accordion({
	  active: false,
	  collapsible: true,
	  autoHeight: false
	});
});
