window.addEvent('domready',function() { 
/* settings */
	var items = $('moos_feed').getElements('div');
	var showDuration = 5000; 
	var morphInDuration = 1000; 
	var morphOutDuration = 1500; 
	var index = 0; 
	var invisible_opacity = 0.0001 ;

	var hover_color_norm = '#FFF' ;
	var hover_color_over = '#FFB' ;

	var minimum_height = 200 ;

	var is_in_development = false ;

// ==================================================================== [ DO NOT EDIT BELOW HERE ] =====

	total_items = items.length ;
	fixed_width = items[0].offsetWidth ;

	$$('#moos_feed div').setStyles({
		'padding':'1px 0'
	});

	fixed_height = 0 ;
	if(is_in_development==true){ alert('INITIAL:'+fixed_height) ; }
	// Find bligest height
	for(i=0;i<items.length;i++){
		if(is_in_development==true){ alert(i+':'+parseFloat(items[i].offsetHeight)) ; }
		if(fixed_height<parseFloat(items[i].offsetHeight)){
			fixed_height = parseFloat(items[i].offsetHeight) ;
		}
	}
	if(fixed_height<minimum_height){fixed_height=minimum_height ;}
	if(is_in_development==true){ alert('BIGGEST:'+fixed_height) ; }

	$('moos_feed').setStyles({
		'overflow':'hidden',
		'height':fixed_height,
		'zindex':99
	});

	items.setStyles({
		'opacity':invisible_opacity,
		'display':'block',
		'float':'left',
		'width':fixed_width,
		'height':fixed_height,
		'cursor':'pointer',
		'zindex':99
	});

	individual_lap = (showDuration+(morphInDuration+morphOutDuration)) ;

	delay_01 = 0 ;
	delay_02 = showDuration ;
	delay_03 = individual_lap*(total_items-1) ;
	this_lap = 0 ;

    items.each(function(element) {
		element.addEvent('click', function(){
			window.location = element.getElements('a').getProperty('href') ;
		});
		element.addEvent('mouseenter', function(){
			element.setStyles({'color':hover_color_over}) ;
		});
		element.addEvent('mouseleave', function(){
			element.setStyles({'color':hover_color_norm}) ;
		});
		this_height = element.offsetHeight ;
		var animation9 = element.animate()
			.serial()
				.delay(delay_01)
				.tween('margin-left',0, {duration: 0})
				.tween('opacity', 1.0, {duration: morphInDuration})
				.delay(delay_02)
				.tween('opacity', invisible_opacity, {duration: morphOutDuration})
				.tween('margin-left',-(this_lap+1)*fixed_width, {duration: 0})
				.delay(delay_03)
				.repeat()
			.end()

		delay_01 = delay_01 + individual_lap ;
		delay_03 = delay_03 - individual_lap ;
		animation9.start();
		this_lap++ ;
	});

});
							

