function trocaimg(projeto,img) {
	endereco = "imagens/projetos/"+projeto+"/"+ 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("Hey nigga,  este emailīs not valid");
		return false;
	} else {
		alert("agora sim");
	}
	
	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.arnet.com.br/web/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);	
}