$(document).ready(function() {
	$("#conhecaItem1 a").fancybox({
		'hideOnContentClick': false,
		'frameWidth': 430,
		'frameHeight':350
	});
	$("#conhecaItem2 a").fancybox();
	$("#conhecaItem3 a").fancybox();
	
	$("#imagemDepoimento a").fancybox({
		'hideOnContentClick': false,
		'frameWidth': 430,
		'frameHeight':350
	});
	
	$("#form").submit(function() {
			var nome = $("#nomeForm").val();
			var email = $("#emailForm").val();
			var departamento = $("#departamentoForm").val();
			var assunto = $("#assuntoForm").val();
			var mensagem = $("#mensagemForm").val();
			
			var dataString = 'nome='+ nome + '&email=' + email + '&assunto=' + assunto + '&mensagem=' + mensagem + '&departamento=' + departamento;
			
			if(nome=='' || email=='' || assunto=='' || mensagem=='' || nome==' ' || email==' ' || assunto==' ' || mensagem==' '){
				$('.success').fadeOut(200).hide();
				$('.error').fadeOut(200).show();
			}
			else{
				$.ajax({
					type: "POST",
					url: "http://www.dominiopublicocomunicacao.com.br/wp-content/themes/dominiopublico/enviar_contato.php",
					data: dataString,
					success: function(){
					$('.success').fadeIn(200).show();
					$('.error').fadeOut(200).hide();
				}
				});
			}
			return false;
		});	
	
		$("a[rel=galeria]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
});

