//Contato
function ContatoConfirma(){

	var nome = document.getElementById('nome');
	var email = document.getElementById('email');
	var cidade = document.getElementById('cidade');
	var telefone = document.getElementById('telefone');
	var msg = document.getElementById('msg');
	if(!nome.value){
		$( "#erro_nome" ).dialog({ title: 'ATENÇÃO', buttons: { "Ok": function() { $(this).dialog("close"); } }, modal: true });
		nome.focus();
		return false;
	}
	if(!email.value){
		$( "#erro_email" ).dialog({ title: 'ATENÇÃO', buttons: { "Ok": function() { $(this).dialog("close"); } }, modal: true });
		email.focus();
		return false;
	}
	if(!msg.value){
		$( "#erro_msg" ).dialog({ title: 'ATENÇÃO', buttons: { "Ok": function() { $(this).dialog("close"); } }, modal: true });
		msg.focus();
		return false;
	}
	var data = {
		nome : nome.value,
		email : email.value,
		cidade : cidade.value,
		telefone : telefone.value,
		mensagem : msg.value
	}
	$.ajax({
		url : 'http://www.empreiteiradigital.com.br/wp-content/themes/empdigital/envia_mail.php',
		type : 'POST',
		data : data,
		success : function(){
			$( "#form_sucesso" ).dialog({ title: 'SUCESSO!', buttons: { "Ok": function() { $(this).dialog("close"); } }, modal: true });
			setTimeout(function(){
				document.location.href = 'http://www.empreiteiradigital.com.br';
			},2000);
		}
	});
	return false;
}

//Clientes
function Clientes(id){
	$(Array('foto','titulo','txt')).each(function(ix,div){
		if(ix==0){
			$('#cliente_ativo_foto').attr('src',$('#clientes_foto_'+id).val());
		} else {
			$('#cliente_ativo_'+div).html($('#clientes_'+div+'_'+id).val());
		}
		
	});
}
