tempo = 5000
n = 0

$(document).ready (function(){
	showhideminipics ();
	animate();
})


showhideminipics = function (){
	$('#lista_carros .descricao').hide ();
	$('#lista_carros a').mouseover (function (){
		$(this).parent ().find('div').slideDown ({easing:"easeOutBounce"})
	})
	$('#lista_carros a').mouseout (function (){
		$(this).parent ().find('div').slideUp ()
	})
}


animate = function (){
	$('.propaganda').html ('<div><p></p></div>')
	for (i=1;i<=4;++i)
		$('.propaganda div p').append ('<img src="layout/inicial'+i+'.jpg"  />')
	$('.propaganda div p').append ('<img src="layout/inicial1.jpg"  />')
	$('.propaganda div p').append ('<img src="layout/inicial2.jpg"  />')
	setTimeout (proximo, tempo)
}

proximo = function (){
	var t = tempo;
	var m = 15;
	switch (n) {
		case 0:
			$('.propaganda p').css ({
				textIndent: '-15px'
			});
			t = tempo/2;
			break;
		case 1:
			m = 372;
			break;
		case 2:
			m = 729;
			break;
		case 3:
			m = 1086;
			break;
		case 4:
			m = 1443;
			t = tempo/2
			break;
	}
	$('.propaganda p').animate ({
		textIndent: "-"+m+"px"
	}, 1500, "easeOutElastic")
	n++
	if (n>=5) n=0
	setTimeout (proximo, t)
}
