function Click()
{	if (event.button==2) {	
		alert("Site desenvolvido pela\nItaipu Software Ltda.\nwww.itasoft.com.br");
	}
}

function abrejanela(janela,altura,largura,titulo)
{
	window.open(janela,titulo,"top=0px,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width="+largura+",height="+altura+"")
}

function abrejanela2(janela,altura,largura,titulo)
{
	window.open(janela,titulo,"top=0px,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width="+largura+",height="+altura+"")
}

var ns = (document.layers) ? 1 : 0;
var ie = (document.all) ? 1 : 0;

function ProxPagina() {
	document.ProxLista.wnListar.value = document.ListaDowns.nListar.value;
	document.ProxLista.submit()
}

function GoToInicio() {
	document.Inicio.wnListar.value = document.ListaDowns.nListar.value;
	document.Inicio.submit()
}

function DelInicio() {
	document.ListaDowns.wnListar.value = document.ListaDowns.nListar.value;
	document.ListaDowns.submit()
}

function Redireciona(Endereco)
{		
	window.open("http://www.itasoft.com.br/" + Endereco,"ManutItasoft","toolbar=yes,location=Yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=no,width=790,height=444,top=0,left=0");
}

function ProcuraEMail()
{		
	Endereco = "2002download.asp?Acao=list&Ordem=EMail&primID=" + document.DownEmailLoc.wEMail.value + "&Contendo=" + document.DownEmailLoc.comEMail.checked + "&nListar=" + document.DownEmailLoc.nListar[document.DownEmailLoc.nListar.selectedIndex].value
	window.open("http://www.itasoft.com.br/2002/" + Endereco,"ManutItasoft","toolbar=yes,location=Yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=no,width=790,height=444,top=0,left=0");
	retutrn=false
}

function ProcuraNome()
{		
	Endereco = "2002download.asp?Acao=list&Ordem=Nome&primID=" + document.DownNomeLoc.wNome.value + "&Contendo=" + document.DownNomeLoc.comEMail.checked + "&nListar=" + document.DownNomeLoc.nListar[document.DownNomeLoc.nListar.selectedIndex].value
	window.open("http://www.itasoft.com.br/2002/" + Endereco,"ManutItasoft","toolbar=yes,location=Yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=no,width=790,height=444,top=0,left=0");
	retutrn=false
}

function Enviar()
{
	document.Fale.submit();
	document.Geral.submit();
	return true ;
}

function EnviarGeral()
{
	document.Geral.submit();
}

function EnviarDivirtase()
{
	document.Divirtase.submit();
	return true;
}

function EnviarCEP()
{
	if (CriticaCamposCEP()) {
		document.GeralCEP.submit(); 
	}
}

function EnviarCTM()
{
	validado="";
	var seleSerie = document.LoginUser.NumeroSerie.value;
	if (seleSerie == "") {
		alert("Favor preencher o Número de Série !!!");
		document.LoginUser.NumeroSerie.focus();
		validado="nao";
	}
	var seleSist  = document.LoginUser.wSistema.options[document.LoginUser.wSistema.selectedIndex].value;
	if (seleSist == "00") {
		alert("Favor Escolher um Sistema !!!");
		document.LoginUser.wSistema.focus();
		validado="nao";
	}
	
	if (validado == "") {
		document.LoginUserOK.NumSerie.value = seleSerie;
		document.LoginUserOK.NumSist.value  = seleSist;
		document.LoginUserOK.submit()
	}
}

function Apagar()
{
	document.Fale.reset();
	document.Fale.Nome.focus();
}

function ApagarDivirtase()
{
	document.Divirtase.reset();
	document.Divirtase.Nome.focus();
}

function IniSuporte(wAgente) {
	location.href="lnk_suporte_avaliacao.asp?opMenu=Supte&Agente=" + wAgente + ""
}

function CriticaCampos()
{
  if (document.Geral.Localidade.value == "")
  {
    alert("Informe o nome completo da Cidade/Município/Distrito/Povoado. Para o DF poderá ser informado o nome da Região Administrativa (Lago Sul, Lago Norte, Cruzeiro, Taguatinga, etc) !!");
    document.Geral.Localidade.focus();
    return (false);
  } 
  else
  { 
   var Branco = " ";
   var Posic, Carac;
   var Temp = document.Geral.Localidade.value.length;    
   var Cont = 0;
   for (var i=0; i < Temp; i++)   
   {  
   Carac =  document.Geral.Localidade.value.charAt (i);
   Posic  = Branco.indexOf (Carac);   
   if (Posic == -1)   
	  Cont++;      
   }   
   if (Cont <= 0)
   {
    	alert("Informe o nome completo da Cidade/Município/Distrito/Povoado. Para o DF poderá ser informado o nome da Região Administrativa (Lago Sul, Lago Norte, Cruzeiro, Taguatinga, etc) !!");
    	document.Geral.Localidade.focus();
    	return (false);
   }  
  }
  if (document.Geral.Logradouro.value == "")
  {
    alert("Informe o nome da avenida, alameda, beco, passagem, praça, rua, travessa etc. Não informe o número da casa/lote/apartamento. Nos logradouros com preposições (DA(S), DE, DO(S), etc) entre o tipo de logradouro e seu nome (Exemplo: Rua das Acácias), informe somente o nome do logradouro sem a preposição e utilize preferencialmente a opção COMEÇANDO COM ou QUE CONTENHA.");
    document.Geral.Logradouro.focus();
    return (false);
  }  
   var Branco = " ";
   var Posic, Carac;
   var Temp = document.Geral.Logradouro.value.length;    
   var Cont = 0;
   for (var i=0; i < Temp; i++)   
   {  
   Carac =  document.Geral.Logradouro.value.charAt (i);
   Posic  = Branco.indexOf (Carac);   
   if (Posic == -1)   
	  Cont++;      
   }   
   if (Cont <= 0)
   {
    	alert("Informe o nome da avenida, alameda, beco, passagem, praça, rua, travessa etc. Não informe o número da casa/lote/apartamento. Nos logradouros com preposições (DA(S), DE, DO(S), etc) entre o tipo de logradouro e seu nome (Exemplo: Rua das Acácias), informe somente o nome do logradouro sem a preposição e utilize preferencialmente a opção COMEÇANDO COM ou QUE CONTENHA.");
    	document.Geral.Logradouro.focus();
    	return (false);
   }
   else
   {
       if (Cont <= 2)  
       { 
          if (document.Geral.Opcao[1].checked)
          {
             alert("Na opção COMEÇANDO COM, informe no mínimo 3 caracteres !!");
    	     document.Geral.Logradouro.focus();    	 
		     return (false);   
          }
	      else
	         if (document.Geral.Opcao[2].checked)    
             {
        	    alert("Na opção CONTENHA, informe no mínimo 3 caracteres !!");
    	        document.Geral.Logradouro.focus();
    	        return (false);
             } 
	         else	
	            if (document.Geral.Opcao[3].checked)           
                {
    	           alert("Na opção TERMINADO EM, informe no mínimo 3 caracteres !!");
    	           document.Geral.Logradouro.focus();
    	           return (false);
                } 
       }	   
  }
}

function CriticaCamposCEP()
{
	if (document.GeralCEP.CEP.value == "")
	{
		alert("Informe no mínimo os 5(cinco) primeiros dígitos do CEP. Ex. 70001");
		document.GeralCEP.CEP.focus();
		return (false);
	}
	if (document.GeralCEP.CEP.value.length <= 4)
	{
		alert("Informe no mínimo os 5(cinco) primeiros dígitos do CEP. Ex. 70001");
		document.GeralCEP.CEP.focus();
		return (false);
	}
	{
		var Numeros = "0123456789";
		var Posic, Carac;
		var Temp = document.GeralCEP.CEP.value.length;    
		var Cont = 0;
		for (var i=0; i < Temp; i++)   
		{
			Carac =  document.GeralCEP.CEP.value.charAt (i);
			Posic  = Numeros.indexOf (Carac);   
			if (Posic > -1)   
			Cont++;      
		}   
		if (Cont == 9)
			{
			alert("O CEP tem no máximo 8(oito) digitos numéricos. Ex. 70001-970");
			document.GeralCEP.CEP.focus();
			return (false);
			} 
		}
		{
		var Numeros = "0123456789-";
		var Posic, Carac;
		var Temp = document.GeralCEP.CEP.value.length;    
		var Cont = 0;
		for (var i=0; i < Temp; i++)   
		{  
			Carac =  document.GeralCEP.CEP.value.charAt (i);
			Posic  = Numeros.indexOf (Carac);   
			if (Posic == -1)   
			{	  
				alert("Informe um CEP válido. Ex. 70001-970");
				document.GeralCEP.CEP.focus();
				return (false);
			}
		}   
	}
return (true);
}    

function RetiraAcentos(Campo)
 {   
   var Acentos = "áàãââÁÀÃÂéêÉÊíÍóõôÓÔÕúüÚÜçÇabcdefghijklmnopqrstuvxwyz";
   var Traducao ="AAAAAAAAAEEEEIIOOOOOOUUUUCCABCDEFGHIJKLMNOPQRSTUVXWYZ";
   var Posic, Carac;
   var TempLog = ""; 
   for (var i=0; i < Campo.length; i++)
   {
   Carac = Campo.charAt (i);
   Posic  = Acentos.indexOf (Carac);
   if (Posic > -1)   
	  TempLog += Traducao.charAt (Posic);
   else  
      TempLog += Campo.charAt (i);	  	   
   }
      return (TempLog);
}

function AjudaLocalidade()
{   
DocRemote =  window.open('http://www.correios.com.br/servicos/cep/AjudaLocalidade.cfm','Localidade','scrollbars,resizable,width=410,height=180');  	   
}    

function AjudaLogradouro()
 {   
   DocRemote =  window.open('http://www.correios.com.br/servicos/cep/AjudaLogradouro.cfm','Logradouro','scrollbars,resizable,width=410,height=220');  	   
 }   
 
function MascaraCEP (formato, keypress, objeto)
{
	campo = eval (objeto);
	if (formato=='CEP')
	{
		caracteres = '01234567890';
		separacoes = 1;
		separacao1 = '-';
		conjuntos = 2;
		conjunto1 = 5;
		conjunto2 = 3;
		if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (conjunto1 + conjunto2 + 1))
		{
		if (campo.value.length == conjunto1) 
			campo.value = campo.value + separacao1;
		}
		else 
			event.returnValue = false;
	}
}

function IniDownload() {
	{document.open("index2002.asp?Abrir=2002Download&Rot=Download&M2=m2Download.htm","WEBItasoft","")}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		botao_1_over = newImage("imagens/botao_over.gif");
		botao_2_over = newImage("imagens/botao_over.gif");
		botao_3_over = newImage("imagens/botao_over.gif");
		botao_4_over = newImage("imagens/botao_over.gif");
		botao_5_over = newImage("imagens/botao_over.gif");
		botao_6_over = newImage("imagens/botao_over.gif");
		botao_7_over = newImage("imagens/botao_over.gif");
		botao_8_over = newImage("imagens/botao_over.gif");
		preloadFlag = true;
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function Invisivel_parc(src){
	document.getElementById('sub_parc').style.visibility='hidden';
	document.getElementById('sub_parc_td').style.backgroundColor='BBECC8';
}
function Invisivel_serv(src){
	document.getElementById('sub_serv').style.visibility='hidden';
	document.getElementById('sub_serv_td').style.backgroundColor='BBECC8';
}
function Invisivel_adm(src){
	document.getElementById('sub_adm').style.visibility='hidden';
	document.getElementById('sub_adm_td').style.backgroundColor='BBECC8';
}
function Invisivel_cont(src){
	document.getElementById('sub_cont').style.visibility='hidden';
	document.getElementById('sub_cont_td').style.backgroundColor='BBECC8';
}
function Invisivel_prof(src){
	document.getElementById('sub_prof').style.visibility='hidden';
	document.getElementById('sub_prof_td').style.backgroundColor='BBECC8';
}
function Invisivel_empre(src){
	document.getElementById('sub_empre').style.visibility='hidden';
	document.getElementById('sub_empre_td').style.backgroundColor='BBECC8';
}

function Visivel_parc(src){
	// Mostra todas as DIV
	document.getElementById('sub_parc').style.visibility='visible';
	document.getElementById('sub_parc_td').style.backgroundColor='00CA65';
}
function Visivel_serv(src){
	document.getElementById('sub_serv').style.visibility='visible';
	document.getElementById('sub_serv_td').style.backgroundColor='00CA65';
}
function Visivel_adm(src){
	document.getElementById('sub_adm').style.visibility='visible';
	document.getElementById('sub_adm_td').style.backgroundColor='00CA65';
}
function Visivel_cont(src){
	document.getElementById('sub_cont').style.visibility='visible';
	document.getElementById('sub_cont_td').style.backgroundColor='00CA65';
}
function Visivel_prof(src){
	document.getElementById('sub_prof').style.visibility='visible';
	document.getElementById('sub_prof_td').style.backgroundColor='00CA65';
}
function Visivel_empre(src){
	document.getElementById('sub_empre').style.visibility='visible';
	document.getElementById('sub_empre_td').style.backgroundColor='00CA65';
}

function Gravar(NomeAsp)
	{
		var nReg = ManutMens.txtNumero.value;		
		location.href = NomeAsp + "?RegEdit=" + nReg + "&Sistema="
	}
function AtuSistema(NomeAsp)
	{
		var wSis=Filtrar.wSistema.options[Filtrar.wSistema.selectedIndex].value;
		var wTip=Filtrar.wTipo.options[Filtrar.wTipo.selectedIndex].value;
		location.href = NomeAsp + "?Sistema=" + wSis + "&Tipo=" + wTip
	}

function MesmoCampo(origem,destino) {
	var xori="document.CadPedido."+origem+".value";
	xori=eval(xori);
	var xdes="document.CadPedido."+destino+".value";
	xdes=eval(xdes);
	if (xdes.length<1) {
	    var xnovo="document.CadPedido."+destino+".value=document.CadPedido."+origem+".value";
        eval(xnovo);
	}
}

function checkmail(mail){
	// EXEMPLO: <input type="text" name="email" onblur="javascript:checkmail(this)" 
	var txt=mail.value;
	if (txt.length<1)
	{	//alert('vazio!!!');
		mail.value="nao_tem";
		mail.focus();
		return false;
	}
	var er = /^[a-zA-Z0-9][a-zA-Z0-9\._-]+@([a-zA-Z0-9\._-]+\.)[a-zA-Z-0-9]{2}/;
//alert("txt="+txt+"\n"+txt.indexOf('@')+"\n"+txt.indexOf('.')+"\n"+txt.indexOf(' '));
	var nt='nao_tem'
	var erro=((txt.indexOf(nt)>0));
//alert(txt+'\n'+'Erro='+erro+'\n'+txt.indexOf(nt));
	if (erro!=true) {
		var erro=((txt.length>0) && ((txt.indexOf('@')<1) || (txt.indexOf('.')<2)  || (txt.indexOf(' ')>0) ))
		if (erro || (txt.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1))
		{	alert('"'+txt+'"\nE-mail incorreto !!!');
			mail.focus();
			return false;
		}
	}
}

abre_fecha = function(body)
{
		if(document.getElementById(body).style.display == "block")
		{
			document.getElementById(body).style.display = "none";
		}
		else
		{
			if(document.getElementById(body).style.display == "none")
			{
				document.getElementById(body).style.display = "block";
			}
			else
			{
				document.getElementById(body).style.display = "none";
			}
		}
};
