addEvent(window,'load',homefunc);
//addEvent(window,'load',scrol_move);
//addEvent($('mn'),'mouseout',scrol_move);
//addEvent($('mn'),'mouseover',scrol_stop);

var current_estr = 1; //estr are counted in reverse order

function homefunc() {
	$('estr_back').href='#';
	addEvent($('estr_back'),'click', estr_back_click);
	$('estr_forw').href='#';
	addEvent($('estr_forw'),'click', estr_forw_click);
/*	if (current_estr==1) 
	{
	  $('estr_forw').style.visibility='hidden';
	}
*/	
}

function estr_back_click(){estr_click(+1);}
function estr_forw_click(){estr_click(-1);}

function estr_click(value_offset){
    $('estr_forw').style.visibility='visible';
    $('estr_back').style.visibility='visible';

//	estr_spinner();
	current_estr+=value_offset;
	current_estr=clamp(current_estr, 1, 6);
	new ajax ('http://www.pianetalotto.it/inc/inc_estrazioni'+current_estr+'.html', {update: $('estrazioni_lotto'),onComplete:homefunc});
	if (current_estr==1) 
	{
	  $('estr_forw').style.visibility='hidden';
	}
	if (current_estr==6) 
	{
	  $('estr_back').style.visibility='hidden';
	}
	return;
}

function estr_spinner(){
	$('estrazioni_lotto').innerHTML='<table cellspacing="0"><caption>&nbsp;<span>&nbsp;</span><br />&nbsp;<span>&nbsp;</span></caption><tbody><tr><th class="spinner">Caricamento in corso</th></tr></tbody></table>';
	return;
}
