$( document ).ready( function()
{

	$( "#gallery_Slider" ).slider(
	{
    
		animate: true,
    	change: handleSliderChange,
    	slide: handleSliderSlide
  
  	});

});

function handleSliderChange( e, ui )
{
  
	var maxScroll = $( "#gallery_Scroll" ).attr( "scrollWidth" ) - $( "#gallery_Scroll" ).width();
  
  	$( "#gallery_Scroll" ).animate( 
	{
		
		scrollLeft: ui.value * ( maxScroll / 100 ) 
	}, 1000 );
}

function handleSliderSlide( e, ui )
{
  
 	var maxScroll = $( "#gallery_Scroll").attr( "scrollWidth" ) - $( "#gallery_Scroll" ).width();
  
  	$( "#gallery_Scroll" ).attr( 
	{
		
		scrollLeft: ui.value * ( maxScroll / 100 ) 
	
	});

}
