$(document).ready(function(){
        $("#content-slider").slider({ animate: true, change: handleSliderChange, slide: handleSliderSlide });
        var content_scroll_pos = Math.floor(($("#content-scroll").scrollLeft() / $("#content-scroll").width()) * 100);
       
        if ($("#content-scroll").scrollLeft() != 0) { $("#content-slider a").css("left",content_scroll_pos+"%"); }
		
});

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) });
}
