jQuery.fn.SlideMenu = function (options) {
	
	var opts = jQuery.extend({
		orientation: '',
		scrSpeed: 25,
		elementFather: ''
	}, options);

	this.each(function(){
			
			var sizeObj = 0;
			
			$(this).children('ul').each(function(){
				//Pego a largura dos itens
				s = 0;
				$(this).children('li').each(function(){
					if (opts.orientation == 'horizontal') { s+=$(this).outerWidth(true); }
					if (opts.orientation == 'vertical') { s+=$(this).outerHeight(true); }
				});
				
				if (opts.orientation == 'horizontal') { $(this).width(s+2); }
				if (opts.orientation == 'vertical') { $(this).height(s+2); }
					
				sizeObj = s;
				//------------------------				
			});
			
			var itemMove	= $(this).children('ul');
			var posObj		= 0;
			var speed		= 0;
			var posMouse	= 0;
			var sizeObjMask;
			if (opts.orientation == 'horizontal') { sizeObjMask = $(this).width(); }
			if (opts.orientation == 'vertical') { sizeObjMask = $(this).height(); }
			
			$(this).mouseover(function(e){
				if (opts.elementFather!='') {
					$(opts.elementFather).mousemove(function(){
						if (opts.orientation == 'horizontal') { v = this.offsetLeft; }
						if (opts.orientation == 'vertical') { v = this.offsetHeight; }
					});
				} else {
						v = 0;	
				}
			});
			
			$(this).mousemove(function(e){

				if (opts.orientation == 'horizontal') { posMouse = (e.pageX - (this.offsetLeft+v)) - (sizeObjMask / 2); }
				if (opts.orientation == 'vertical') { posMouse = (e.pageY - (this.offsetTop+v)) - (sizeObjMask / 2); }
				
			});
			
			$(this).hover(function(){ intID = setInterval(SetPos, 10); }, function(){ clearInterval(intID); });
			
			function SetPos () {
				speed = (posMouse) / opts.scrSpeed;
				
				if (speed < 0) { speed = -(speed); }
				if (posMouse < 0) { posObj = posObj + speed; }
				if (posMouse > 0) {	posObj = posObj - speed; }
				if (posObj > 0) { posObj = 0; }
				if (posObj < -(sizeObj - sizeObjMask)) { posObj = -(sizeObj - sizeObjMask);	}
				
				if (opts.orientation == 'horizontal') { itemMove.css({left: posObj+'px'}); }
				if (opts.orientation == 'vertical') { itemMove.css({top: posObj+'px'}); }
			}

	});
}