// JavaScript Document
function openindex(){
	window.location = 'index.php';
	}
function validacad(){
	
	var nome = document.contato.nome.value;
	var email = document.contato.email.value;
	var estado = document.contato.estado.value;
	var pais = document.contato.pais.value;	
	var mensagem = document.contato.mensagem.value;
	var verifica = new Array(new Array(nome,'nome'),new Array(email,'email'),new Array(estado,'estado'),new Array(pais,'pais'),new Array(mensagem,'mensagem'));
	var i=0;
//	alert(verifica);
	
	for(i=0;i<verifica.length;i++){
		if (verifica[i][0]==""){
		alert('Preencha o campo '+verifica[i][1]+'!');
		return false;}
		}
	}	

function mostraSub(id){
	document.getElementById(id).style.display='block';
	}
function ocultaSub(id){
		document.getElementById(id).style.display='none';
	}
	

function selecionaList(idd,valor){
	var com = document.getElementById(idd);
	var fa= valor.split("|");
	resetCombo(idd);
			
	for(i=0;i<(fa.length);i++){
		for(j=0;j<com.length;j++){
			if(com.options[j].value==fa[i]){
				com.options[j].selected=true;
			}
		}
	}
}

function resetCombo(idr){
  var com = document.getElementById(idr);
  for(i=0;i<com.options.length;i++){
	com.options[i].selected=false;
  }
}
