(function ($, _) {
  $.fn.spriteNavigtion = function(config) {
	  var
	    settings = $.extend({
		    allowClick: true,
		    show:       { opacity: 'show' },
		    hide:       { opacity: 'hide' },
		    active:     'current',
		    click:      'click'
	    }, config),
  	  root = $(this);

	  // Attach events to each child
	  
	  root.
	    children().
	    prepend('<div class="hover" style="display:none"></div>').
	    each(function() 
	  {
		  var 
		    item  = $(this),
		    link  = item.children('a'), 
		    hover = item.children('.hover');

		  // Do not attach events to active children
		  if(! item.hasClass(settings.active)) {
			
			  // hide the css defined :hover background
			  // link.css({ background: 'none' });
			  link.addClass('default');
			  
			  // Mouseover
			  link.hover(function () {
			    hover.animate(settings.show);
			  // Mouseout
			  }, function () {
				  hover.animate(settings.hide);
			  });
			
			  // click events on the a if allowClick is true
			  if(settings.allowClick) {
				  // Mousedown
				  link.mousedown(function() {
					  hover.addClass(settings.click);
				  // Mouseup
				  }).mouseup(function () {
					  hover.removeClass(settings.click);
				  });
			  }
			
		  }
	  });
  };
}(jQuery, window));
