function trocaimg(img) {
	endereco = "imagens/projetos/m1propaganda/"+ img +".jpg";
	document.getElementById('img_projeto').src = endereco;
}

// Include the Aardvark class above.
var Connection = new Aardvark('Connection');

// Function that starts the asnchronous variable transfer
function envia_form_contato() {
	
	nome = document.getElementById('form_contato').nome.value;
	email = document.getElementById('form_contato').email.value;
	telefone = document.getElementById('form_contato').telefone.value;
	mensagem = document.getElementById('form_contato').mensagem.value;
	
	if ( !valida(email) ) {
		alert("O endereco de e-mail esta digitado de forma incorreta");
		return false;
	}
		
	Connection.add('nome', nome);
	Connection.add('email', email);
	Connection.add('telefone', telefone);
	Connection.add('mensagem', mensagem);

	document.getElementById('msg').className = "transparente";
	document.getElementById('msgtxt').innerHTML = "<span>Enviando mensagem...</span>";		
	
	Connection.send('http://www.publicarpaineis.com.br/contato/envia_form_contato.php', 'passback(variables)');
}

// Function that is fired when new data is received
function passback(variables) {
	document.getElementById('msgtxt').innerHTML = Connection.vars['msg'];
}


// Funcao para validar emails
function valida(email) {
	var expressao = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	return expressao.test(email);	
}