/**
 * @author Marco Valori
 */


var pause = 0;

$(function() {		
	
	$('a.lightbox_da_mostrare').show().lightBox();
	
	var refreshId = setInterval(function() {
		$.ajax({
		  type: "GET",
		  url: "keep_alive.php"
		});
	}, 60000);
	
	init();
	
	$('#scroll').hover(function() {
		pause = 1;
	}, function() {
		pause = 0;
	});
	
});

function scorri(){
   copyspeed = 1
	scrollerheight = 0
	if (pause == 1) copyspeed = 0
	scroller = document.getElementById("scroll");
	actualheight=scroller.offsetHeight
	if (parseInt(scroller.style.top)>(actualheight*(-1)-40)){
		scroller.style.top=parseInt(scroller.style.top)-copyspeed+"px";
		setTimeout("scorri()", 100);
		return;
	} else {
		setTimeout("scorri()", 100);
		scroller.style.top=parseInt(scrollerheight)+30+"px";
		return;
	}
}
//-------------------

function init(){
	div_scorrimento = $('#scroll');
	if (div_scorrimento != undefined) {
   		scorri();
	}
}
