$(document).ready(function() {
  if( ($.browser.msie && $.browser.version < 7) ) {
    $('#header .links-menu > li').hover(function() {
	  $(this).addClass('over');
	}, function() {
	  $(this).removeClass('over');
	});
  }

  // support basic facebox content
  if( $.fn.facebox ) {
	// Facilitate links in image captions that want to popup their images
	$('div.inline-image > a[rel*="facebox"]').each(function() {
	  var href = $(this).attr('href');
	  $('span a[href="#"]', $(this).parent()).each(function() {
	    $(this).attr({
		  href: href,
		  rel: 'facebox'
		});
	  });
	});

	// tweak images added with img_assist - this is disabled
	$('span.bogus-inline-link-node > a').each(function() {
	  var $a = $(this);
	  var nid = $a.parent().attr('nid');
	  if( ! $a.attr('target') ) {
		$a.attr('rel', 'facebox').attr('href', BASE_URL + 'image_peek/' + nid);
	  }
	});

	// now enable facebox
    $('a[rel*=facebox], area[rel*=facebox]').facebox();

	// support facebox links within facebox content
	$(document).bind('reveal.facebox', function() {
	  $('#facebox a[rel*=facebox], #facebox area[rel*=facebox]').facebox();
	});
  }
});

