var lista;
var current;
var hValue;
var topValue;

$(document).ready(
	function()
	{
		inspectElements('#promo');
		current = 0;
	    setInterval( 'slideTitle()', 3000 );
	}
);


function slideTitle()
{
	var last = current;
	current = ( current<(lista.size()-1) )? current+1:0;

	$.each(lista, function(index)
		{	
			switch( index )
			{
				case current:	
							$(this).animate( 
								{
									'top':'0'//topValue
								},
								'slow', function(){});
							break;
				
				
				case last:
							$(this).animate(
								{
									'top': (hValue*(-1))
								}, 'slow', function()
								{
									$(this).css('top',hValue);
								}
							);
							break;
			
			}
		}
	);

}


function inspectElements( id )
{
	lista = $(id).children();
	hValue = $(id).attr('offsetHeight') + $(id).attr('offsetTop');

	lista.each( function(index)
	{
		if( index>0 )
		{
			$(this).css('top', hValue);
		}
		else
		{
			topValue = $(this).attr('offsetTop');
			hValue = hValue + topValue;
		}
	});

//	console.log(hValue);
//	console.log(topValue);
}
