//-----------------------------------------------------------------------
//                                  contato
//-----------------------------------------------------------------------

var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
    var keyCode = (isNN) ? e.which : e.keyCode; 
    var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
    if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
   <!-- input.form2[(getIndex(input)+1) % input.form2.length].focus();-->
}

function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
}

function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
    }
    return true;
}



//-----------------------------------------------------------------------
//                                  cadastro
//-----------------------------------------------------------------------
function valida3(){
	
//nome
if ((document.cadastro.nome.value == "") || (document.cadastro.nome.value == " ") ) {  
	alert("Digite seu nome.");
	document.cadastro.nome.focus();
	return false; 
}

//email
if ((document.cadastro.email.value == "") || (document.cadastro.email.value == " "))  {  
	alert("Digite seu e-mail.");
	document.cadastro.email.focus();
	return false; 
}
if (document.cadastro.email.value.length > 0)  {  
    if  (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.cadastro.email.value)) {
        // return ()
    }
    else {
	    alert("Digite seu e-mail corretamente.");
	    document.cadastro.email.focus();
	    document.cadastro.email.select();
	    return false;
    } 
}

//cidade
if ((document.cadastro.cidade.value == "") || (document.cadastro.cidade.value == " ") ) {  
	alert("Digite sua cidade.");
	document.cadastro.cidade.focus();
	return false; 
}

//estado
if ((document.cadastro.estado.value == "") || (document.cadastro.estado.value == " ") ) {  
	alert("Digite seu estado.");
	document.cadastro.estado.focus();
	return false; 
}

//profissão
if ((document.cadastro.profissao.value == "") || (document.cadastro.profissao.value == " ") ) {  
	alert("Digite sua profissão.");
	document.cadastro.profissao.focus();
	return false; 
}

//pais
if ((document.cadastro.pais.value == "") || (document.cadastro.pais.value == " ")) {  
	alert("Digite seu país.");
	document.cadastro.pais.focus();
	return false; 
}

document.cadastro.submit();

}
