//scroll.js
scroll = {
	top:0,
	bottom:0,
	holder:null,
	list:null,
	anim:null,
	speed:5,
	easing:"linear", //linear, easeoutcubic, easeintoutexpo
	init:function(holder, list) {
		scroll.holder = holder;
		scroll.list = list;
		scroll.bottom = (jQuery("#"+scroll.list).height()-jQuery(scroll.holder).height()-199)*-1;
		jQuery("#"+holder).css("position", "relative");
		jQuery("#"+list).css("position", "absolute")
			.css("top", scroll.top)
			.css("left", 0);
	},
	down:function() {
		var cur_top = scroll.position();
		var speed = Math.floor((scroll.speed*((scroll.bottom+cur_top)/scroll.bottom))*100)/100;
		scroll.anim = $t(document.getElementById(scroll.list)).tween({
			time:speed,
			top:scroll.bottom
		}, {transition:scroll.easing});
	},
	up:function() {
		var cur_top = scroll.position();
		var speed = Math.floor((scroll.speed*(cur_top/scroll.bottom*-1))*100)/100;
		scroll.anim = $t(document.getElementById(scroll.list)).tween({
			time:speed,
			top:scroll.top
		}, {transition:scroll.easing});
	},
	stop:function() {
		scroll.anim.stop();
	},
	position:function() {
		var obj_position = jQuery("#"+scroll.list).offset();
		var par_position = jQuery("#"+scroll.holder).offset();
		//alert(par_position.top-obj_position.top);
		return par_position.top-obj_position.top;
	}
};