function esconde(){
	document.getElementById("txt_industria").style.visibility = "hidden";
	document.getElementById("txt_assunto").style.visibility = "hidden";
}

function mostra(nome){
	if(document.getElementById(nome).selectedIndex == 8)
		document.getElementById("txt_"+nome).style.visibility = "visible";
	else document.getElementById("txt_"+nome).style.visibility = "hidden";
}

function valida(){
	var nome          = document.getElementById("nome").value;
	var empresa       = document.getElementById("empresa").value;
	var industria     = document.getElementById("industria").selectedIndex;
	var txt_industria = document.getElementById("txt_industria").value;
	var email         = document.getElementById("email").value;
	var cod_pais      = document.getElementById("cod_pais").value;
	var ddd           = document.getElementById("ddd").value;
	var fone          = document.getElementById("fone").value;
	var assunto       = document.getElementById("assunto").selectedIndex;
	var txt_assunto   = document.getElementById("txt_assunto").value;
	var msg           = document.getElementById("msg").value;
	var formmail      = document.getElementById("mail");
	
	if(nome.length == 0){ erro.innerHTML = "Information in this field name is required."; return;}
	if(empresa.length == 0){ erro.innerHTML = "Information in this field company is required."; return;}
	if(industria == 0){ erro.innerHTML = "Information in this field industry sector is required."; return;}
	if(industria == 8 && txt_industria.length == 0){ erro.innerHTML = "Information in this field industry sector is required."; return;}
	if(email.length == 0){
		erro.innerHTML = "Information in this field e-mail is required.";
		return;
	}else if(email.indexOf('@',1) == -1 || email.indexOf('.',1) == -1){
		erro.innerHTML = "Information in this field e-mail is required.";
		return;
	}
	if(ddd.length == 0){ erro.innerHTML = "Information in this field area code is required."; return;}
	if(fone.length == 0){ erro.innerHTML = "Information in this field phone number is required."; return;}
	if(assunto == 0){ erro.innerHTML = "Information in this field subject is required."; return;}
	if(assunto == 8 && txt_assunto.length == 0){ erro.innerHTML = "Information in this field subject is required."; return;}
	if(msg.length == 0){ erro.innerHTML = "Information in this field message is required."; return;}
	
	if(nome.length != 0 && empresa.length != 0 && email.length != 0 && msg.length != 0 )
	{
		formmail.submit();
	}

}