String.prototype.vazio = function checa_vazio(){
	return this.replace(/\s/gi,"")==""
}

var msg=new Array()

msg[0, 1]="Preencha o campo 'Seu nome'."
msg[1, 1]="Preencha corretamente o campo 'Seu e-mail'."
msg[2, 1]="Preencha o campo 'Mensagem'."

msg[0, 3]="Fill in the field: 'Your name'."
msg[1, 3]="Fill in correctly the field: 'Your e-mail'."
msg[2, 3]="Fill in the field: 'Message'."

function valida_form(formulario){
	lang=parseInt(formulario.P_idioma.value)
	//nome, email, empresa, mensagem
	if(formulario.nome.value.vazio()){
		alert( msg[0, lang] );
		formulario.nome.focus();
	}else if(!validaemail(formulario.email.value)){
		alert( msg[1, lang] );
		formulario.email.focus();
	}else if(formulario.mensagem.value.vazio()){
		alert( msg[2, lang] );
		formulario.mensagem.focus();
	}else{
		return true
	}
	return false;
}

function validaemail(email) {
  var objRegExp  = /^[A-Za-z]([\-\w\.]*)@([A-Za-z0-9\.]*)\.(([A-Za-z]{3}\.[A-Za-z]{2}$)|([A-Za-z]{3}$)|([a-z]{2}$))/i ;
  return objRegExp.test(email);
}