<!--

// When the page loads: 
window.onload = function(){ 
if (document.getElementsByTagName) { 
// Get all the tags of type object in the page. 
var objs = document.getElementsByTagName("object"); 
for (i=0; i<objs.length; i++) { 
// Get the HTML content of each object tag 
// and replace it with itself. 
objs[i].outerHTML = objs[i].outerHTML; 
} 
} 
} 
// When the page unloads: 
window.onunload = function() { 
if (document.getElementsByTagName) { 
//Get all the tags of type object in the page. 
var objs = document.getElementsByTagName("object"); 
for (i=0; i<objs.length; i++) { 
// Clear out the HTML content of each object tag 
// to prevent an IE memory leak issue. 
objs[i].outerHTML = ""; 
} 
} 
} 

function alternador(parametro){
// funcao para esconder/mostrar tópicos do menu lateral
	for(i=1;i<=5;i++){
		if (parametro != i) {
			eval("div"+i).style.display='none'
		}
	}

	if (parametro.style.display==''){
		parametro.style.display='none';
//		window.document.location='aula.asp#marca1';
	}else{
		parametro.style.display='';
		}
	return false;
}

var clicados = 0

function help(qual){
//funcao apenas para ajudar o usuário
//pagina dos produtos
	if (qual == 1) {
		alert("Clique sob a linha vermelha para digitar o nome do produto desejado.\n\nDepois clique no botão INICIAR A BUSCA")	
	}
	
	if (qual == 2) {
		alert("Clique sob a linha vermelha para digitar o nome do produto desejado.\n\nDepois clique no botão INICIAR A BUSCA")	
	}
//pagina de cadastre-se	
	if (qual == 3) {
		alert("Este campo espera o nome da empresa, pode ser Jurídico ou Fantasia.\nDê preferência ao nome mais conhecido.")	
	}	
	
	if (qual == 4) {
		alert("Digite a CNPJ de sua empresa no formato '00.000.000/0000-00'.")	
	}
	
	if (qual == 5) {
		alert("Digite aqui o seu nome ou o do responsável pelo contato externo da empresa.")	
	}
	
	if (qual == 6) {
		alert("Insira apenas um telefone de contato com a empresa.\nNão esqueça do DDD e verifique se está correto o número.")	
	}	
		if (qual == 7) {
		alert("Insira seu e-mail aqui.\nO formato esperado é SeuNome@empresa.com.br, o caractere '@' é obrigatório.\nCertifique que seu e-mail está digitado corretamente.")	
	}				
}



////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////// validação dos Camos do formulário
////////////////////////////////////////// validação dos Camos do formulário
////////////////////////////////////////// validação dos Camos do formulário
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

function valida_cep(cep) {
	var aux_cep;
	if ( isNaN(cep) ) {
		if ( cep.indexOf("-") == -1 ) {
			return false;
		}	
		else {
			aux_cep = cep.split("-");
			if (aux_cep.length != 2) {
				return false;
			}
			if (aux_cep[0].length != 5 || isNaN(aux_cep[0]) || aux_cep[0] == "") {
				return false;
			}
			if (aux_cep[1].length != 3 || isNaN(aux_cep[1]) || aux_cep[1] == "") {
				return false;
			}
			return true;
		}
	}	 
	else {
		if (cep.length != 8) {	
			return false;		
		}
		else {
			return true;
		}	
	}	
}

///////////////////////////////////////////////
///////////////////////////////////////////////
///////////////////////////////////////////////
function valida_cnpj(cnpj){
	cnpj = cnpj + "/.- "
	cnpj = cnpj.replace("/","")
	cnpj = cnpj.replace("-","")
	cnpj = cnpj.replace(".","")	
	 
	 while(''+cnpj.charAt(cnpj.length-1)==' '){
		  cnpj=cnpj.substring(0,cnpj.length-1);
	 }	
		if (cnpj == "") {
			return false
		}
	if (cnpj.length < 14 || cnpj.length > 18) {
			return false
			}
        

	var numeros = "1234567890";     
	s = "";

	for (x = 0 ; x < cnpj.length ; x++) 
		{
		var ch = cnpj.charAt(x);
		if ( numeros.indexOf(ch) != -1 ) {
			 s = (s + ch);	
		   }
		}
valor = s; 		
	if ( (s.length != 14) ) { 
		return false
	}
		
		
}
///////////////////////////////////////////////////


function valida_empresa(empresa){
 while(''+empresa.charAt(empresa.length-1)==' '){
   	  empresa=empresa.substring(0,empresa.length-1);
	  }
  if (empresa == ""){return false}
 }
 ///////////////////////////////////////////////////


function valida_endereco(endereco){
 while(''+endereco.charAt(endereco.length-1)==' '){
   	  endereco=endereco.substring(0,endereco.length-1);
	  }
  if (endereco == ""){return false}
 }
 
///////////////////////////////////////////////////
function valida_cidade(cidade){
 while(''+cidade.charAt(cidade.length-1)==' '){
   	  cidade=cidade.substring(0,cidade.length-1);
	  }
  if (cidade == ""){return false}
 } 
///////////////////////////////////////////////////
function valida_estado(estado){
 while(''+estado.charAt(estado.length-1)==' '){
   	  estado=estado.substring(0,estado.length-1);
	  }
  if (estado == ""){return false}
 } 
///////////////////////////////////////////////////
function valida_telefone(telefone){
 while(''+telefone.charAt(telefone.length-1)==' '){
   	  telefone=telefone.substring(0,telefone.length-1);
	  }
  if (telefone == ""){return false}
 } 
///////////////////////////////////////////////////
function valida_nome(nome){
 while(''+nome.charAt(nome.length-1)==' '){
   	  nome=nome.substring(0,nome.length-1);
	  }
  if (nome == ""){return false}
 }
///////////////////////////////////////////////////
function valida_email(email){
 while(''+email.charAt(email.length-1)==' '){
   	  email=email.substring(0,email.length-1);
	  }
  if (email == ""){return false}
 }

 
//-->

