(function($){
	
	$.fn.mlddm = function(options) {
		
		var defaults = {
			
		},
		settings = $.extend({}, defaults, options);
		
		var z_count = 1000;
		
		this.find('li').each(function() {
			
			var $this = $(this);
			
			$this.hover(
				function()
				{
					$this.find('ul').eq(0).children('li').not('li:last').css('display','none');
					
					$this._dimensions={ w:this.offsetWidth, h:this.offsetHeight, l:$this.offset().left, subulw:$this.find('ul').outerWidth(), subulh:$this.find('ul').outerHeight() }
					
					if( $this._dimensions.l + $this._dimensions.w + $this._dimensions.subulw > $(window).width() && $this.parent('ul').attr('id') != 'nav' )
					{
						$this.find('ul').eq(0).css({ left:-($this._dimensions.subulw - 10) });
					}
					
					$this.find('ul').eq(0).css('zIndex',z_count++).children('li').not('li:last').stop(true, true).animate({ height:'show', opacity:'show' });
				},
				function()
				{
					$this.find('ul').eq(0).children('li').not('li:last').stop(true, true).hide();
					z_count = 1000;
				}
			)
			
		});
		
		// returns the jQuery object to allow for chainability.
		// return this;
		
	}
	
})(jQuery);

