$(function() {
	if (/Firefox\/2/.test(navigator.userAgent))
		$("#direita div.meio_top10").css("margin-left", "4px");

	$("div.nome div.scroll").each(function(i){
		var wa = $(this).find("span.artista").width();
		var wm = $(this).find("span.musica").width();
		var maior = (wa > wm) ? wa : wm;
		var dif = maior - 103;

		$(this).css("width", maior);

		if (maior > 103) {
			$(this).hover(function() {
				$(this).stop().animate({ left: -dif }, 2000);
			},function() {
				$(this).stop().animate({ left: 0 }, 2000);
			});
		}
	});

	$('div.top10').serialScroll({
		target:'div.meio_top10',
		items:'div.musicas',
		prev:'div.botao_esq',
		next:'div.botao_dir',
		axis:'y',
		duration:200,
		cycle:false,
		stop:true,
		lazy:false,
		step:3
	});

	$("div.recados div.bt_deixe_recado a").click(function() {
		$("div.recados").html(
			'<form method="post" action="" id="frmRecado">'+
			'Recado: (<span class="countBox box0">100</span> caractéres)<br /><textarea name="Recado" cols="19" rows="3" class="deixe_recado" rel="text_"></textarea><br />De:<br />'+
			'<input type="text" name="De" size="21" class="deixe_recado" rel="text_" /><br />Para:<br />'+
			'<input type="text" name="Para" size="21" class="deixe_recado" rel="text_" />'+
			'<div class="bt_enviar_recado"><a><span class="botoes">Enviar</span></a></div>'+
			'</form>'
		);
		$("div.recados textarea").charLimit({
			limit: 100,
			speed: "slow",
			descending: true,
			boxexists: true
		});
		$("#frmRecado").validaForm({
			success: function(){
				$.ajax({
					type: "POST",
					url: "../_funcoes/index.php",
					data: "__funcao=recado_enviar&"+$(this).serialize(),
					cache: false,
					success: function(r) {
						if (r.length)
							alert(r);
						else
							location.href = '../home/';
					}
				});
				return false;
			}
		});
		$("div.recados div.bt_enviar_recado a").click(function() {
			$("#frmRecado").submit();
		});
	});

	$("div.banners_dir").banners(10000, "../_funcoes/index.php", "__funcao=banners");
});
