$j(function() {
	Site.popfloat();
	
	/* Destaques Rotativos */
	if($j('#foto_noticia').size()>0) {
		$j('#foto_noticia .texto').cycle({
			fx:     'fade',
			timeout: 10000,
			speed: 500,
			next:   '.next',
			prev:   '.previous',
			pager: '.numbers'
		});	
	}
	
	$j(".abrir_video").click(function(){
		window.open("video.php","","width=340, height=280");
	});
	
	$j(".abrir_radio").click(function(){
		window.open("radio.php","","width=380, height=300");
	});
	
	setTimeout(function() {
		$j('.galeria-visualizacao .gvIIContainer .gvIIImgContainer img').css({ marginTop:'1px' });
	}, 800);
});

var Site = {
	popfloat:function(acao) {
		if(acao == 0) {
			$j('.banner-flutuante').fadeOut();	
		} else if(location.href.indexOf('?') == -1) {
			$j('.banner-flutuante').fadeIn();
			setTimeout(function() { $j('.banner-flutuante').fadeOut(); }, 30000);
		}
	}
}

var Musica = {
	pedido:function(form) {
		if ($Form.validate(form) != false) {
			$j.alert({ type: 'loading', html: 'Enviando pedido, aguarde...', width: 200 });
			
			$j.ajax({
				url: 'acoes.php?pedido_musica', type: 'post', data: $j(form).serialize(),
				success: function(response){ //	alert(response);
					if (response == '' || response) {
						$j(form)[0].reset();
						
						$j.alert({
							html: 'Seu pedido foi enviado com sucesso. Obrigado por participar!',
							timeout: 8000,
							out: function(){
								location.replace('/');
							}
						});
					}
				}
			});
		}
		
		return false;
	}
}
