jQuery(document).ready(function(){
  jQuery("#aboutBlock").hide();
  jQuery("#contactBlock").hide();
  jQuery("#teamBlock").hide();
  jQuery("#showsBlock").hide();
  
  var aboutShowing = false;
  var contactShowing = false;
  var teamShowing = false;
  var showsShowing = false;
  
  jQuery("#aboutLink").click(function() {
    if(aboutShowing){
      hideBlocks();
      aboutShowing = false;
    } else {
      hideBlocks();
      jQuery("#aboutBlock").fadeIn("slow");
      jQuery("#aboutLink").addClass("active");
      aboutShowing = true;
      contactShowing = false;
      teamShowing = false;
      showsShowing = false;
      return false;
    }
  });
  
  jQuery("#contactLink").click(function() {
    if(contactShowing) {
      hideBlocks();
      contactShowing = false;
    } else {
      hideBlocks();
      jQuery("#contactBlock").fadeIn("fast");
      jQuery("#contactLink").addClass("active");
      aboutShowing = false;
      contactShowing = true;
      teamShowing = false;
      showsShowing = false;
      return false;
    }
  });
  
  jQuery("#teamLink").click(function() {
    if(teamShowing) {
      hideBlocks();
      teamShowing = false;
    } else {
      hideBlocks();
      jQuery("#teamBlock").fadeIn("fast");
      jQuery("#teamLink").addClass("active");
      aboutShowing = false;
      contactShowing = false;
      teamShowing = true;
      showsShowing = false;
      return false;
    }
  });
  
  jQuery("#showsLink").click(function() {
    if(showsShowing) {
      hideBlocks();
      showsShowing = false;
    } else {
      hideBlocks();
      jQuery("#showsBlock").fadeIn("fast");
      jQuery("#showsLink").addClass("active");
      aboutShowing = false;
      contactShowing = false;
      teamShowing = false;
      showsShowing = true;
      return false;
    }
  });
});

function hideBlocks() {
  jQuery("#aboutBlock").fadeOut("fast");
  jQuery("#contactBlock").fadeOut("fast");
  jQuery("#teamBlock").fadeOut("fast");
  jQuery("#showsBlock").fadeOut("fast");
  jQuery("#aboutLink").removeClass("active");
  jQuery("#contactLink").removeClass("active");
  jQuery("#teamLink").removeClass("active");
  jQuery("#showsLink").removeClass("active");
}