// JavaScript Document
	$(function() {
	
			if( $("#slidebox").height() < $("#content-slider").height() ) {
				 //$("#content-slider").slider('destroy'); 
				 $("#content-slider").css('display','none') 
			 } else {
			$("#content-slider").slider({
			orientation: "vertical",
			range: "max",
			min: 0,
			max: 100,
			value: 98,
			change: handleSliderChange,
			slide: handleSliderSlide			
		})};

	});
	
function handleSliderChange(e, ui)
{
		var maxScroll = $("#main").attr("scrollHeight") -   $("#main").height();
		$("#main").animate({scrollTop: (100 - ui.value) * (maxScroll / 100) }, 1000);
}

function handleSliderSlide(e, ui)
{
		  var maxScroll = $("#main").attr("scrollHeight") -  $("#main").height();
		  $("#main").attr({scrollTop: (100 - ui.value) * (maxScroll / 100) });
}


