$(document).ready(function(){
  $("#slider").slider({
    animate: true,
    handle: ".slider_suwak",
    change: handleSliderChange,
    slide: handleSliderSlide
  });
});

function handleSliderChange(e, ui)
{
	var maxScroll = $(".prawa_content").attr("scrollHeight") - $(".prawa_content").height();
	$(".srodek_content").animate({scrollTop: ui.value * (maxScroll / 100) }, 1000);
}

function handleSliderSlide(e, ui)
{
	var maxScroll = $(".prawa_content").attr("scrollHeight") - $(".prawa_content").height();
	$(".prawa_content").attr({scrollTop: ui.value * (maxScroll / 100) });
}
