var ocontainer;
var ocontent;
var spaceToScroll;

function set_scroll(){
	var content_height = $("#cr_content").height();
	var holder_height = $("#cr_right").height();
	var min_height = 84;
	var max_height = 435;
	if (content_height>=435){
		$("#cr_right").css("height",max_height+"px");
		holder_height = max_height;
	}	
	if (content_height<435 && content_height>min_height){
		$("#cr_right").css("height",content_height+"px");
		holder_height = content_height;
	}
	if (content_height>holder_height){
		$("#content_slider").show();
	}
	
	ocontainer = $('#cr_right');
	ocontent = $('#cr_content');
			
	containerSize = jQuery.iUtil.getSize(ocontainer.get(0));
	containerPosition = jQuery.iUtil.getPosition(ocontainer.get(0));
	containerInner = jQuery.iUtil.getClient(ocontainer.get(0));
			
	contentSize = jQuery.iUtil.getSize(ocontent.get(0));
			
	spaceToScroll = contentSize.hb - containerInner.h;
						
	$('#content_slider').Slider(
	{
		accept : '#indicator',
		onSlide : function( cordx, cordy, x , y){
					ocontent
						.css('top', - spaceToScroll * cordy / 100 + 'px');
				}
	});
}

$(document).ready(
	function() {

		var content_height = $("#cr_content").height();
		var holder_height = $("#cr_right").height();
		var min_height = 84;
		var max_height = 435;
		if (content_height>=435){
			$("#cr_right").css("height",max_height+"px");
			holder_height = max_height;
		}	
		if (content_height<435 && content_height>min_height){
			$("#cr_right").css("height",content_height+"px");
			holder_height = content_height;
		}
		if (content_height>holder_height){
			$("#content_slider").show();
		}
		
		ocontainer = $('#cr_right');
		ocontent = $('#cr_content');
				
		containerSize = jQuery.iUtil.getSize(ocontainer.get(0));
		containerPosition = jQuery.iUtil.getPosition(ocontainer.get(0));
		containerInner = jQuery.iUtil.getClient(ocontainer.get(0));
				
		contentSize = jQuery.iUtil.getSize(ocontent.get(0));
				
		spaceToScroll = contentSize.hb - containerInner.h;
							
		$('#content_slider').Slider(
		{
			accept : '#indicator',
			onSlide : function( cordx, cordy, x , y){
						ocontent
							.css('top', - spaceToScroll * cordy / 100 + 'px');
					}
		});
	}
);
