$(document).ready(function(){
  $("#content-slider").slider({
    animate: true,
    change: handleSliderChange,
    slide: handleSliderSlide
  });
});

function handleSliderChange(e, ui)
{
  var maxScroll = $("#content-scroll").attr("scrollWidth") - $("#content-scroll").width();
  $("#content-scroll").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000);
}

function handleSliderSlide(e, ui)
{
  var maxScroll = $("#content-scroll").attr("scrollWidth") - $("#content-scroll").width();
  $("#content-scroll").attr({scrollLeft: ui.value * (maxScroll / 100) });
}


$(document).ready(function(){
  $("#content-slider-h").slider({
  	orientation: "vertical",
    animate: true,
    change: handleSliderChange2,
    slide: handleSliderSlide2,
    value: 100
  });
});

function handleSliderChange2(e, ui)
{
  var maxScroll = $("#content-scroll-h").attr("scrollHeight") - $("#content-scroll-h").height();
  $("#content-scroll-h").animate({scrollTop: (100 - ui.value)  * (maxScroll / 100) }, 1000);
}

function handleSliderSlide2(e, ui)
{
  var maxScroll = $("#content-scroll-h").attr("scrollHeight") - $("#content-scroll-h").height();
  $("#content-scroll-h").attr({scrollTop: (100 - ui.value) * (maxScroll / 100) });
}
