var animatingBlog=false;

$(document).ready(function() {
  $("#pastor-column a").click(function() {
    pastorTransition();
    return false;
  });
  
  $("#lifeplace-team-column a").click(function() {
    lifeplaceTeamTransition();
    return false;
  });
  
  $("#header .hidden").hide().removeClass("hidden");
});

function pastorTransition() {
  if(!animatingBlog) {
    animatingBlog=true;
    
    $("#pastor-column a").fadeOut();
    $("#header a").attr("href",pastorURL);
    $("#header a img").fadeOut();
    $("#lifeplace-team").css({width:"490px",opacity:1}).animate({width:0,paddingLeft:0,opacity:0},function() {
      $(this).hide();
      $("#lifeplace-team-column a").fadeIn();
      $("#pastor").css({width:0,opacity:0}).show().animate({width:"490px",paddingLeft:"15px",paddingRight:"10px",opacity:1},function() {
        animatingBlog=false;
      });
    });
  }
}

function lifeplaceTeamTransition() {
  if(!animatingBlog) {
    animatingBlog=true;
    
    $("#lifeplace-team-column a").fadeOut();
    $("#header a").attr("href",lifeplaceURL);
    $("#header a img").fadeIn();
    $("#pastor").css({width:"490px",opacity:1}).animate({width:0,padding:0,opacity:0},function() {
      $(this).hide();
      $("#pastor-column a").fadeIn();
      $("#lifeplace-team").css({width:0,opacity:0}).show().animate({width:"490px",opacity:1},function() {
        animatingBlog=false;
      });
    });
  }
}