content = document.getElementById('panel');
ctrls = [
	document.getElementById('down'),
	document.getElementById('up')
//        document.getElementById('left'),
//        document.getElementById('right')
];

pixels = 2;
lastScroll = 0;
timeOut = null;

stopScrolling = function(){
	clearTimeout( timeOut );
}

scrollIt = function( vertScroll, goUp ){
	if( vertScroll )
		content.scrollTop += goUp ? -pixels : pixels;
	else
		content.scrollLeft += goUp ? -pixels : pixels;
		if( vertScroll ? ( lastScroll == content.scrollTop ) : ( lastScroll == content.scrollLeft ) )
			return false;
		lastScroll = vertScroll ? content.scrollTop : content.scrollLeft;
		if( timeOut != null )
			clearTimeout( timeOut );
		timeOut = setTimeout( 'scrollIt(' + vertScroll + ',' + goUp + ')', 50 );
}

// Direita e esquerda
//ctrls[0].onmouseover = function(){ scrollIt( false, false ); }
//ctrls[1].onmouseover = function(){ scrollIt( false, true ); }

// Cima e Baixo - Removido por sobescrever o preloadimages do botao, entao a funcao foi inserida diretamente na tag
//ctrls[0].onmouseover = function(){ scrollIt( true, false ); }
//ctrls[1].onmouseover = function(){ scrollIt( true, true ); }

// Idem item acima
//for( i = 0; i < ctrls.length; i++ )
//	ctrls[i].onmouseout = function(){ stopScrolling(); };