(function($) {
	$.fn.sliderMenu = function(options) {
	
		var defaults = {
			speed: 500,
			easing: 'swing'
		};
		var options = $.extend(defaults, options);
		return this.each(function() {
			var obj = $(this);
			obj.css({
				display: 'block',
			});
			
			var menuItems = $("li.slider_menu_list").size();
			var menuItemWidth = $("li.slider_menu_list").width();
			var menuItemHeight = $("li.slider_menu_list").height();
			var menuWidth = menuItems * menuItemWidth;
			var menuHeight = menuItems * menuItemHeight;
			var inactiveMargin;
			
			var bodyHeight;
			var browserWidth;
			var browserHeight; 
			var cursorX;
			var cursorY;
			var move;	
			var offset;
			
			obj.css({
				display: 'none'
			});	
			
			$().mousemove(function(e){
				bodyHeight = $(document).height();
				browserWidth = $(window).width();
				browserHeight = $(window).height();
				
				cursorX =  e.pageX;
				cursorY =  e.pageY;
							
				obj.find("ul").css({
					height: menuHeight+"px",
					width: menuItemWidth+"px"
				}).end()
				.css({
					top: 0,
					right: 0,
					height: browserHeight+"px"
				});
				$('#menu').hover(function() {
					if(obj.is(':hidden')) { obj.animate({width: 'show'}, options.speed, options.easing); }
				});
				if(obj.is(':visible')) {
					offset = obj.offset();
					inactiveMargin = 100;
					move = (cursorY - offset.top) * ((menuHeight + 2 * inactiveMargin) - browserHeight) / browserHeight - inactiveMargin ;
					obj.scrollTop(move);
				}
				obj.mouseleave(function() {
					obj.animate({width: 'hide'}, options.speed, options.easing);
				});
			});	
		});
	};
})(jQuery)