$(function(){
	
	// Slider
	$('#slider').slider({
		orientation: "vertical",
		range: "min",
		min: 0,
		max: 185,
		value: 185,
		slide: function(event, ui) {
			$("#slidebox").css('top',(-185 + ui.value + 'px'));
		}
	});
});

function moveSlider(element,target,direction,increment,max) {

	var value = $(element).slider('option', 'value');

	if (direction == 'up') {
		var newValue = value + increment;
		if (newValue <= max) {
			$(element).slider('option', 'value', newValue);
			$(target).css('top',((0-max) + newValue + 'px'));		
		}
		else {
			$(element).slider('option', 'value', max);
		}
	}
	else {
		var newValue = value - increment;
		if (newValue >= 0) {
			$(element).slider('option', 'value', newValue);			
			$(target).css('top',((0-max) + newValue + 'px'));	
		}
		else {
			$(element).slider('option', 'value', 0);
		}
	}
}

