

jQuery(function ($) {

  // sliding arrow kraziness
  (function () {
    var nav = $('#nav');
    var wrapper = nav.parent();
    var arrow = $('<img src="/nav-arrow.png" />');

    var home_x = -10;
    nav.find('a.active').each(function () {
      var active = $(this);
      home_x = active.position().left + active.width()/2;
    });

    arrow.css({
      'position' : 'absolute',
      'top'      : '42px',
      'left'     : home_x + 'px',
      'display'  : 'none'
      });

    wrapper.prepend(arrow);
    arrow.fadeIn();

    nav.find('a').each(function () {
      var self = $(this);
      var center = self.position().left + self.width()/2;
      self.mouseover(function () {
        arrow.animate({'left':center+'px'}, {queue:false});
      }).mouseout(function () {
        arrow.animate({'left':home_x}, {queue:false});
      });
    });
  })(); // end sliding arrow

});


