jQuery(document).ready(function($) {
  $('#homepage-content > div').hide();
  $('#homepage-content > div.placeholder').show();
  $('#homepage-content-nav a').click(function() {
    var $link = $(this);
    $('#homepage-content-nav a').removeClass('active');
    $link.addClass('active');
    $('#homepage-content > div:visible').fadeOut(function() {
      $($link.attr('href')).fadeIn();
    });
    
    var position = $link.position();
    $('#homepage-content-nav-indicator').animate({
      left: position.left + ($link.outerWidth() / 2) - 25
    });
    $link.blur();
    return false;
  });
  $('#homepage-content-nav a:first').click();
  
  $('#content .category .category-inner').hover(function() {
    $(this).addClass('category-hover');
  }, function() {
    $(this).removeClass('category-hover');
  }).click(function() {
    document.location = $(this).find('a').attr('href');
  });

  $('#what-we-do .category .category-inner, #who-we-serve .category .category-inner, #why-choose-bldi .category .category-inner').hover(function() {
    $(this).addClass('category-hover');
  }, function() {
    $(this).removeClass('category-hover');
  }).click(function() {
    document.location = $(this).find('a').attr('href');
  });


  var $signupInput = $('.overlabel input');
  var $signupLabel = $('.overlabel label');
  
  if ($signupInput.val()) {
    $signupLabel.hide();
  }

  $signupInput.focus(function() {
    $signupLabel.hide();
  }).blur(function() {
    if (this.value == '') {
      $signupLabel.show();
    }
  });
  
  $signupLabel.click(function() {
    $signupInput.trigger('focus');
  });
});

