(function($){
	$.fn.adminNav = function(settings) {
		settings = $.extend({
			}, settings);

		var matches = this;

		function _initialize() {
			if (matches.length <= 0)
				return;
			
			matches.hover(
							function() {
								var menuitem = $(this);
								var pos = menuitem.position();
								var popup = menuitem.children('ul');
								var bordercrop = $('<div class="bordercrop" style="position: absolute; background-color: #fff; height: 1px; font-size: 1px"></div>');
								bordercrop.css({
											   top: (pos.top - 1) + 'px',
											   left: (pos.left + 1) + 'px',
											   width: (menuitem.outerWidth() - 7) + 'px'
											   });
								popup.after(bordercrop);
								popup.css({
										  position: 'absolute',
										  top: (pos.top - popup.outerHeight()) + 'px',
										  left: (pos.left + menuitem.outerWidth() - popup.outerWidth() - 5) + 'px'
										  });
								menuitem.toggleClass('highlight');
								popup.stop().css({display: 'block', visibility: 'visible', opacity: 0}).fadeTo('fast', 1);
							},
							function() {
								var menuitem = $(this);
								var popup = menuitem.children('ul');
								menuitem.toggleClass('highlight');
								popup.stop().fadeOut('slow');
								popup.siblings('.bordercrop').remove();
							}
						 );
		}
		
		_initialize(this);
		return this;
	}
})(jQuery);
