var nb_front=3;
var cur_front = 2;
var front_t;

function dofront()
{
	front_t = setInterval( "donextfront( 0)", 15000 );
}

function donextfront(is_event)
{
	clearInterval(front_t);
	
	for (i = 1; i <= nb_front; i++) {
		Element.hide('front_' + i);
		if( cur_front == i ) {
			Element.removeClassName('fl_' + i, 'frontother');
			Element.addClassName('fl_' + i, 'frontcurrent');
		}
		else {
			Element.removeClassName('fl_' + i, 'frontcurrent');
			Element.addClassName('fl_' + i, 'frontother');
		}
	}
	
	if( is_event ) {
		Element.show('front_' + cur_front);
	}
	else {
		Effect.Appear('front_' + cur_front);
	}
	
	if( (cur_front + 1) > nb_front )
		cur_front = 1;
	else
		cur_front++;	

	dofront();
}

function gofront(selected_front, is_event)
{
	cur_front = selected_front;
	donextfront(is_event);
}

function obs_all()
{
	Event.observe('fl_1', 'mouseover', function(e) { gofront(1, 1) } );
	Event.observe('fl_2', 'mouseover', function(e) { gofront(2, 1) } );
	Event.observe('fl_3', 'mouseover', function(e) { gofront(3, 1) } );
}
obs_all();

function sobs_all()
{
	Event.stopObserving('fl_1', 'mouseover');
	Event.stopObserving('fl_2', 'mouseover');
	Event.stopObserving('fl_3', 'mouseover');
}

/*
Event.observe('fl_1', 'mouseover', function(e) { gofront(1) } );
Event.observe('fl_1', 'mouseout', function(e) { } );

Event.observe('fl_2', 'mouseover', function(e) { gofront(2) } );
Event.observe('fl_2', 'mouseout', function(e) { } );

Event.observe('fl_3', 'mouseover', function(e) { gofront(3) } );
Event.observe('fl_3', 'mouseout', function(e) { } );
*/
