/**
 * @author Enykey
 */

$(document).ready(function()
{
	$('.vertical-listalka a').bind('mouseenter', function()
	{
		$('.color',this).css({opacity: 1}).fadeIn({
			queue: false,
			duration: 100
		});
	});
	
	$('.vertical-listalka a').bind('mouseleave', function()
	{
		$('.color',this).fadeOut({
			queue: false,
			duration: 100
		});
	});

	var height = $('.scroll').height()-$('.vertical-listalka').height();
	
	var ListTimer; 
	
	var cur = 0;
	var new_pos = 0;
	var differ = 0;
	var moved = true;
	
	$('.scroll').bind('mousemove', function(e)
	{
		new_pos = (240 - e.pageY);
		if (moved)
		{
			moved = false;
			ListTimer = setInterval(function(){
				differ = (new_pos-cur)*5;	
				if (Math.abs(differ) < 15) 
				{
					moved = true;
					clearInterval(ListTimer)
				};
				var step = cur + differ*Math.abs(new_pos-cur)/height/10;
				cur = step;
				$('.scroll').css({top: cur})
			},10)
		}		
	});

});