function trim(texto){
	while(texto.indexOf(" ") != -1){
	  texto = texto.replace(" ","");
	}
    return texto;
}

function submeterContato(){
	nome = document.getElementById("nome");
	email = document.getElementById("email");
	mensagem = document.getElementById("msg");
	
	
	if(trim(nome.value)==""){
		alert("Informe seu nome!");
		nome.focus();
		return;
	}
	if(trim(email.value)==""){
		alert("Informe seu e-mail");
		email.focus();
		return;
	}else{
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value))){
			alert("E-mail inválido");
			email.focus();	
	   	    return;
	    }
	}	
	if(mensagem.value==""){
		alert("Deixe sua mensagem");
		comentario.focus();
		return;
	}
	
	campos =  "nome="+encodeURI(nome.value);
	campos += "&email="+encodeURI(email.value);
	campos += "&msg="+encodeURI(mensagem.value);
	enviaRequisicao('formContato', 'enviaContato.php?'+campos, 'Enviando...');
	
}

