//Scroll
var timer;

function scrollPieces(x, elid) {
	var scrollBy = 10;

	var pieces = document.getElementById(elid);
	var currPos = pieces.scrollTop;
	
	if(x > 0)
		nextPos = currPos + scrollBy;
	else
		nextPos = currPos - scrollBy;
		
	pieces.scrollTop = nextPos;
		
	timer = setTimeout("scrollPieces("+x+", '"+elid+"')", 10);
}

function moveUp(elid) {
	scrollPieces(-1, elid);
}

function moveDown(elid) {
	scrollPieces(1, elid);
}

function stop() {
	clearTimeout(timer);
}

window.onload = function() {
	//setupZoom();
	initImage();
	
	if(nUp = document.getElementById('upLista')) {
	
		nUp.style.cursor = 'pointer';
		nUp.onmouseover = function() {
			moveUp('lista');
		}
		nUp.onmouseout = function() {
			stop();
		}
		
		document.getElementById('lista').style.overflow = 'hidden';
	
	}
	
	if(nDown = document.getElementById('dnLista')) {

		nDown.style.cursor = 'pointer';
		nDown.onmouseover = function() {
			moveDown('lista');
		}
		nDown.onmouseout = function() {
			stop();
		}
	
	}
	
	if(nUp = document.getElementById('upAct')) {
	
		nUp.style.cursor = 'pointer';
		nUp.onmouseover = function() {
			moveUp('actividad');
		}
		nUp.onmouseout = function() {
			stop();
		}
		
		document.getElementById('actividad').style.overflow = 'hidden';
		
	}
		
	if(nDown = document.getElementById('dnAct')) {

		nDown.style.cursor = 'pointer';
		nDown.onmouseover = function() {
			moveDown('actividad');
		}
		nDown.onmouseout = function() {
			stop();
		}
	
	}
	
	if(nUp = document.getElementById('upLibro')) {
	
		nUp.style.cursor = 'pointer';
		nUp.onmouseover = function() {
			moveUp('comentariosContainer');
		}
		nUp.onmouseout = function() {
			stop();
		}
		
		document.getElementById('comentariosContainer').style.overflow = 'hidden';
		
	}
		
	if(nDown = document.getElementById('dnLibro')) {

		nDown.style.cursor = 'pointer';
		nDown.onmouseover = function() {
			moveDown('comentariosContainer');
		}
		nDown.onmouseout = function() {
			stop();
		}
	
	}
	
	if(nUp = document.getElementById('upTxt')) {
	
		nUp.style.cursor = 'pointer';
		nUp.onmouseover = function() {
			moveUp('interior_onright2');
		}
		nUp.onmouseout = function() {
			stop();
		}
		
		document.getElementById('interior_onright2').style.overflow = 'hidden';
		
	}
		
	if(nDown = document.getElementById('dnTxt')) {

		nDown.style.cursor = 'pointer';
		nDown.onmouseover = function() {
			moveDown('interior_onright2');
		}
		nDown.onmouseout = function() {
			stop();
		}
	
	}
	
}