Site = {
	_activeScroller: null,

	init: function() {
		this.addScrollers();
	},
	
	addScrollers: function() {
		var scrolls = $('<div class="scroll-up"></div><div class="scroll-down"></div>');
		
		scrolls.mouseover(function() {
			var direction = $(this).hasClass('scroll-up') ? 1 : -1;
			var box = $(this).siblings('.scroll-box');
			
			var scroll = function() {
				var top = parseInt(box.css('top')) + (10 * direction);
				var min_top = parseInt(box.css('height')) * -1;
				
				if (top > 0 || top < min_top)
					return false;
				
				box.css('top', top);
			}
			
			this._activeScroller = setInterval(scroll, 50);
			return false;
		});
		
		scrolls.mouseout(function() {
			clearInterval(this._activeScroller);
		});
	
		var scr = $('.scroll-box')
			.css({top: 0, overflow: 'visible'})
			.wrap('<div class="scroll-box-container"></div>')
			.after(scrolls);

		scr.parent('.scroll-box-container').css('height', scr.css('height'));
	}
}

$(function() {
	Site.init();
});
