$(function() {
  $(".infoBox").hide();
  if( window.location.hash.indexOf('#info')==0) {
		var activeTab = window.location.hash;
    window.location.hash='';
    $("#links ul li a").each(function() {
        if($(this).attr("href")==activeTab) {$(this).parent().addClass("active");}
    });
    $(activeTab).fadeIn();
  } else {
    if ($("#links li.active").length==0) {
        $("#links ul li:first").addClass("active").show(); //Activate first tab
        $(".infoBox:first").show(); //Show first tab content
    } else {
        var activeTab = $("li.active a").attr("href");
        $(activeTab).show();
    }
  }
  
 $("#links ul li").click(function() {
	  var activeTab = $(this).find("a").attr("href");
	  if(typeof(activeTab)=='undefined') {activeTab = $(this).attr("href");}
    $("#links ul li").removeClass("active"); //Remove any "active" class
    $("#links ul li a").each(function() {
    	if($(this).attr("href")==activeTab) {$(this).parent().addClass("active");}
    });
    $(".infoBox").hide(); //Hide all tab content
    $(activeTab).fadeIn(); //Fade in the active ID content
    return false;
  });
});
