window.addEvent('domready', function() {

	var i = 0;
	var elems = $$('#content ul li');
	if( elems.length == 0 ) return;
	var s = new Fx.Scroll( $('content'), {
		duration: 800,
		wait: false,
		transition: Fx.Transitions.Sine.easeInOut
	}).toElement(elems[i]);

	var elems1 = $$('#bottomContent a');
	var j = 2;
	var periodica = function(){
		j = (j+1)%3;
		s.toElement(elems[j]);
		elems1.each(function(el1) {
			el1.setStyle('background','none');
		});
		elems1[j].setStyle('background','url(_img/underline.png) bottom repeat-x');
	};
	
	periodica();
	var peri = periodica.periodical(2500);
	
	elems1[0].setStyle('background','url(_img/underline.png) bottom repeat-x');
	elems1.each(function(el,index) {
		el.addEvents({
			'mouseenter': function(e) {
				new Event(e).stop();
				$clear(peri);
				s.toElement(elems[index]);
				elems1.each(function(el1) {
					el1.setStyle('background','none');
				});
				el.setStyle('background','url(_img/underline.png) bottom repeat-x');
			},
			'mouseleave': function(e) {
				new Event(e).stop();
				j = index;
				peri = periodica.periodical(2500);
			}
		});
	}.bindWithEvent(this));
	
});
