if (window.navigator.platform == 'iPhone' && document.body.id == 'homepage') {
  msg = "Would you like to use the mobile version?"
  if (confirm(msg)) {
    path = window.location.pathname;
    window.location.replace("http://m.nathanborror.com" + path);
  }
}

jQuery(function($) {

  /* Navigation */
  if ($('#navigation')) {
    var nav_resting_width = "-60px";
    var nav_hover_width = "0px";
    var delay = 400;

    $('#navigation > li').each(function(e) {
      if ($('body').hasClass(this.className)) {
        $('a', this).stop().animate({marginLeft:nav_hover_width}, 600);
      }
      else {
        $(this).hover(function() {
          $('a', this).stop().animate({marginLeft:nav_hover_width}, 200);
        },
        function () {
          $('a', this).stop().animate({marginLeft:nav_resting_width}, 200);
        });
      }
    });
  }

  if (document.body.id == 'homepage') {
    $('#navigation > li').each(function(e) {
      $('a', this)
        .fadeTo(delay, .8)
        .animate({marginLeft:nav_hover_width}, 200)
        .animate({marginLeft:nav_resting_width}, 200);
      delay += 100;
    });
  }
  
  $('.grid').masonry({itemSelector: '.item'});
});
