$(document).ready(function () {
//parametros para galerias
//  var overlayColor = $('#fancy_overlay').css('background-color') || '#2c2c2c';
    $("a.zoom").fancybox({
        'padding': 12,
        'overlayOpacity': 0.5,
        'zoomSpeedIn': 500,
        'zoomSpeedOut': 500,
        'callbackOnShow': iniciodaJanela
    });
//galerias
//	$("ul#gal1 li:first").css({'display':'inline'});

	//efeito pras capas
	$("ul.galeria li a").hover(
	  function () {
		$(this).stop().fadeTo("normal", 0.7);
	  },
	  function () {
		$(this).stop().fadeTo("fast", 1);
	  }
	);

	$('.foto_a').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:  500, //tempo para fazer a transicao
		timeout:  8000	// tempo que mostra a imagem
	});

	$('.foto_b').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:  500, //tempo para fazer a transicao
		timeout:  10700	// tempo que mostra a imagem
	});

	$('.foto_c').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:  500, //tempo para fazer a transicao
		timeout:  10250	// tempo que mostra a imagem
	});

	$('.foto_d').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:  500, //tempo para fazer a transicao
		timeout:  14500	// tempo que mostra a imagem
	});

	$('.foto_e').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:  500, //tempo para fazer a transicao
		timeout:  8200	// tempo que mostra a imagem
	});

	//dicas
	$("a.dicas").find("div").css({"display":"none"});
		$("li a.dicas").click(function () {
			$(this).find("div").toggle('normal');
	
		});
	//formulario de comentarios blog
	$("h4#comentarios").click(function () {
		$("#commentform").show('normal');									   
	});
	
	$(".bt_enviar").click(function(){
	var id_post = $("#Com_idpost").val();
	var nome = $("#Com_nome").val();
	var email = $("#Com_email").val();
	var mensagem = $("#Com_mensagem").val();
	var quepassa = 'op=addcomentario&id_post='+ id_post + '&titulo=' + nome + '&email=' + email + '&mensagem=' + mensagem;
	$.ajax({
	  type: "POST",
	  url: "adm/blog_exe.php",
	  data: quepassa,
	  beforeSend: function() {
		$('#commentform').hide('fast');
		$('#mensagem').addClass('atencao')
		$('#mensagem').show('normal');															
		$('#mensagem').html('Aguarde...');															
	},
	success: function(resp) {
		$("#mensagem").html(resp);
		$("#commentform")[0].reset();  
	  },
	error: function(resp) {
	  $("#mensagem").html(resp);
	}
	 });
		return false;
});
	
});


//funcao para inicar a janela
	function iniciodaJanela() {
	    $('#fancy_inner').addClass('rounded');
	    cantosRedondos();
	}
//funcao para cantos redondos
	function cantosRedondos() {
    	$('.rounded, .ui-corner-all').css({
        	'-moz-border-radius': '5px',
        	'-webkit-border-radius': '5px',
        	'border-radius': '5px'
    	})
	};

	function bla(){
		if($("#nome").val().length < 4){
			alert("O campo nome deve conter mais de 4 caracters");
			return false;
	}	
	var a = $("#email").val();
	var tipo = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
	if(tipo.test(a)){
		return true;
	}
	else{
		alert("Digite um e-mail valido");
		return false;
	}

	}

