// JavaScript Document
function anexar_arquivo(cod_processo){
	if (cod_processo != ""){
      window.open("anexar_arquivos.php?cod_processo="+cod_processo,"Anexar_Arquivos","top=150,left=250,Resizable=no,width=420,height=320,Scrollbars=yes");	
	}
}

function verifica_aut(){
    f = document.form1;
	
	if (f.login.value == ''){
	   alert("O Campo Login deve ser preenchido");
	   f.login.focus();
	   return false;
	}
	if (f.senha.value == ''){
	   alert("O Campo Senha deve ser preenchido");
	   f.senha.focus();
	   return false;
	}
	
}

function cria_objeto(qtd){
	table = document.createElement('table');
	tr    = document.createElement('tr');
	td    = document.createElement('td');
	campo = document.createTextNode("Bem-vindo");
	td.appendChild(campo);
	tr.appendChild(td);
	table.appendChild(tr);
}

function verifica_usuario(){
   f = document.form1;
   
   if (f.nom_usuario.value == ''){
	  alert("O campo Nome deve ser preenchido");
	  f.nom_usuario.focus();
	  return false;
   }
   if (f.email.value == ''){
	  alert("O campo E-mail deve ser preenchido");
	  f.email.focus();
	  return false;
   }
   if (f.des_login.value == ''){
	  alert("O campo Login deve ser preenchido");
	  f.des_login.focus();
	  return false;
   }
   if (f.des_senha.value == ''){
	  alert("O campo Senha deve ser preenchido");
	  f.des_senha.focus();
	  return false;
   }
   if (f.des_senha2.value == ''){
	  alert("O campo Confirmar Senha deve ser preenchido");
	  f.des_senha2.focus();
	  return false;
   }
   if (f.des_senha.value != f.des_senha2.value){
	  alert("Campos Senha e Confirmar Senha devem ser iguais");
	  f.des_senha.focus();
	  return false ;
   }
	
}

function confirmacao(){
   if(!(confirm("Deseja realmente excluir este registro?"))){
	  return false;   
   } else {
      return true;
   }
	
}

function pede_confirmacao(boolean, valor){
   if(!(confirm(valor))){
	   if (boolean == '1'){
	       document.form1.manter_fonte[0].checked = true;
	   }
	  return false;   
   } else {
	  if (boolean == '1'){
		 
	     document.form1.submit();
      } else {


         f = document.form1;
		 if (boolean == '1'){
         	if (f.solicitante.value == 0){
	   			alert("Selecione uma Empresa Solicitante");
	   			f.solicitante.focus();
	   			return false;
  		 	}
   
  			if (f.nom_solicitante.value == ""){
		 	    alert("O campo Nome Solicitante n�o pode ser nulo");
	 			f.nom_solicitante.focus();
				return false;
   		 	}
   
 			if (f.area.value == 0){
	   			alert("Selecione uma �rea");
	   			f.area.focus();
	   			return false;
   		 	}
   
   		 	if (tinyMCE.get('assunto').getContent() == "" || tinyMCE.get('assunto').getContent() == null ){
	  			alert('O campo assunto deve ser preenchido');	
	  			tinyMCE.get('assunto').focus();
	  			return false;
   		 	}
   
   		 	if (f.ver_logix.value == 0){
	   			alert("Selecione a Vers�o do Logix");
	   			f.ver_logix.focus();
	   			return false;
   		 	}
   
   		 	if (f.banco_de_dados.value == 0){
	   			alert("Selecione o Banco de Dados");
	   			f.banco_de_dados.focus();
	   			return false;
   		 	}  
		 }//end if boolean 1
		 
		 if (boolean == '2'){
		 	if (f.grau_critic.value == 0){
	   			alert("Selecione o Grau de Criticidade");
	   			f.grau_critic.focus();
	   			return false;
   		 	} 
		
		 	if (f.analista.value == 0){
	   			alert("Selecione o Analista");
	   			f.analista.focus();
	   			return false;
   		 	} 
		 }//end if boolean 2
		 if (boolean == '3'){
			
			if (tinyMCE.get('detalhamento').getContent() == "" || tinyMCE.get('detalhamento').getContent() == null ){
	  			alert('O campo Detalhamento deve ser preenchido');	
	  			tinyMCE.get('detalhamento').focus();
	  			return false;
   		 	}
			
			if (tinyMCE.get('detalhamento_tecnico').getContent() == "" || tinyMCE.get('detalhamento_tecnico').getContent() == null ){
	  			alert('O campo Detalhamento Tecnico deve ser preenchido');	
	  			tinyMCE.get('detalhamento_tecnico').focus();
	  			return false;
   		 	}
			
		 	if (f.horas_analise.value == ""){
	   			alert("O campo Hrs. Analise deve ser preenchido");
	   			f.horas_analise.focus();
	   			return false;
   		 	} 
		
		 	if (f.horas_desenv.value == ""){
	   			alert("O campo Hrs. Desenvolvimento deve ser preenchido");
	   			f.horas_desenv.focus();
	   			return false;
   		 	} 
			if (f.horas_teste.value == ""){
	   			alert("O campo Hrs. Teste deve ser preenchido");
	   			f.horas_teste.focus();
	   			return false;
   		 	} 
			if (f.horas_consultoria.value == ""){
	   			alert("O campo Hrs. Consultoria deve ser preenchido");
	   			f.horas_consultoria.focus();
	   			return false;
   		 	} 
			if (f.qtd_prog_novos.value == ""){
	   			alert("O campo Qtd. Programas (Novos) deve ser preenchido");
	   			f.qtd_prog_novos.focus();
	   			return false;
   		 	} 
			if (f.qtd_prog_usados.value == ""){
	   			alert("O campo Qtd. Programas (Altera��o) deve ser preenchido");
	   			f.qtd_prog_usados.focus();
	   			return false;
   		 	} 
			if (f.previsao.value == ""){
	   			alert("O campo Previs�o (Em dias) deve ser preenchido");
	   			f.previsao.focus();
	   			return false;
   		 	} 
			
		 }//end if boolean 3
		 
		 if (boolean == '4'){
			
			if (f.valor_hora.value == ""){
	   			alert("O campo Valor Hora deve ser preenchido");
	   			f.valor_hora.focus();
	   			return false;
   		 	} 
		
		 	if (f.horas_negociadas.value == ""){
	   			alert("O campo Hrs. Negociadas deve ser preenchido");
	   			f.horas_negociadas.focus();
	   			return false;
   		 	} 
			if (f.desc_neg.value == ""){
	   			alert("O campo Desc. Negociado deve ser preenchido");
	   			f.desc_neg.focus();
	   			return false;
   		 	} 
			if (f.cond_pgto.value == 0){
	   			alert("Selecione uma Condi��o de Pagamento");
	   			f.cond_pgto.focus();
	   			return false;
   		 	} 
			
		 }//end if boolean 4
		  
		  
		 if (boolean == '7'){
			
			if (f.programador.value == 0){
	   			alert("Selecione um Programador");
	   			f.programador.focus();
	   			return false;
   		 	} 
		
		 }//end if boolean 7
		   
	  }
      return true;
   }
   
}

function verifica_alt_senha(){
   f = document.form1;
   
   if(f.login.value == ''){
      alert("O campo Login deve ser preenchido.");	   
	  f.login.focus();
	  return false;
   }
   if(f.senha.value == ''){
      alert("O campo Senha atual deve ser preenchido.");	   
	  f.senha.focus();
	  return false;
   }
   if(f.nova_senha.value == ''){
      alert("O campo Nova Senha deve ser preenchido.");	   
	  f.nova_senha.focus();
	  return false;
   }
   if(f.nova_senha2.value == ''){
      alert("O campo Confirmar Nova Senha deve ser preenchido.");	   
	  f.nova_senha2.focus();
	  return false;
   }
   if (f.nova_senha.value != f.nova_senha2.value){
	  alert("Os campos Nova Senha e Confirmar Nova Senha devem coincidir");  
	  f.nova_senha.focus();
	  return false;
   }
	
}


function verifica_esq_senha(){
   f = document.form1;
   
   if(f.login.value == ''){
      alert("O campo Login deve ser preenchido.");	   
	  f.login.focus();
	  return false;
   }
   if(f.empresa.value == ''){
      alert("O campo Empresa deve ser preenchido.");	   
	  f.empresa.focus();
	  return false;
   }
	
}


var indice = 0;
var velocidade = 500;
function texto_piscante(){
	
	valor = 'R$ 14,90 mensal por fonte';
	
	if (document.form1.manter_fonte.checked){
		
	   if (indice == 0){
		   texto.innerHTML = valor;
	   	   indice = 1;
	   } else {
		   
		   texto.innerHTML = "";
		   indice = 0;
	   }
	  
	} else {
		
		texto.innerHTML = "";
	}
	setTimeout("texto_piscante()",velocidade);
}


function verifica_proc(){
   f = document.form1;
   if (f.solicitante.value == 0){
	   alert("Selecione uma Empresa Solicitante");
	   f.solicitante.focus();
	   return false;
   }
   
   if (f.nom_solicitante.value == ""){
	   alert("O campo Nome Solicitante n�o pode ser nulo");
	   f.nom_solicitante.focus();
	   return false;
   }
   
   if (f.area.value == 0){
	   alert("Selecione uma �rea");
	   f.area.focus();
	   return false;
   }
   
   if (tinyMCE.get('assunto').getContent() == "" || tinyMCE.get('assunto').getContent() == null ){
	  alert('O campo assunto deve ser preenchido');	
	  tinyMCE.get('assunto').focus();
	  return false;
   }
   
   if (f.ver_logix.value == 0){
	   alert("Selecione a Vers�o do Logix");
	   f.ver_logix.focus();
	   return false;
   }
   
   if (f.banco_de_dados.value == 0){
	   alert("Selecione o Banco de Dados");
	   f.banco_de_dados.focus();
	   return false;
   }
	
}



function verif_obs(){
   f = document.form1;
  
   if (f.observacao.value == ""){
	  alert("O campo observa��o deve ser preenchido");
	  f.observacao.focus();
	  return false;
   }
	
	
}


function verif_etapa_3(){
   f = document.form1;
   
  
   
   if (f.horas_analise.value == ""){
	  alert("O campo Hrs. An�lise deve ser preenchido.");
	  f.horas_analise.focus();
	  return false;
   }
   
   if (f.horas_desenv.value == ""){
	  alert("O campo Hrs. Desenvolvimento deve ser preenchido.");
	  f.horas_desenv.focus();
	  return false;
   }
   
   if (f.horas_teste.value == ""){
	  alert("O campo Hrs. Teste deve ser preenchido.");
	  f.horas_teste.focus();
	  return false;
   }
   
   if (f.horas_orcadas.value == ""){
	  alert("O campo Hrs. Or�adas deve ser preenchido.");
	  f.horas_orcadas.focus();
	  return false;
   }
   
   if (f.previsao.value == ""){
	  alert("O campo Previs�o (em dias) deve ser preenchido.");
	  f.previsao.focus();
	  return false;
   }
	
}


function calcula_total(){
//************************************************************************************
//FUNCAO PARA FORMATAR NO ONKEYPRESS DO CAMPO VALOR TOTAL DAS CONTAS EM FORMATO MOEDA
	
	

Number.prototype.formatMoney = function(c, d, t){ //Serve para formatar um number em formato dinheiro 
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, 
i = parseInt(n = (+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; 
return (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) 
+ (c ? d + (n - i).toFixed(c).slice(2) : ""); 
}; 

 
//-----------------------------------------------------------------------------------------
//_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_

	document.form1.elements['total'].value = 0;
	var valor_hora       = document.form1.elements['valor_hora'].value.replace(".","");
	    valor_hora       = valor_hora.replace(",",".");
	var horas_negociadas = document.form1.elements['horas_negociadas'].value.replace(".","");
	    horas_negociadas = horas_negociadas.replace(",",".");
	var desc_negociado   = document.form1.elements['desc_neg'].value.replace(".","");
	    desc_negociado   = desc_negociado.replace(",",".");
	
	var total            = valor_hora * horas_negociadas;
	if (desc_negociado != ""){
	   var desconto         = (total * desc_negociado) / 100;	
	   var total            = (total - desconto);
	}
	//AQUI FAZ ARREDONDAMENTO DO RESULTADO
	var casas = 2;
	var vlr_arredondado = Math.round(total * Math.pow(10,casas)) / Math.pow(10,casas);
	document.form1.elements['total'].value = vlr_arredondado.formatMoney();

	
}




function calcula_hr_total(){
Number.prototype.formatMoney = function(c, d, t){ //Serve para formatar um number em formato dinheiro 
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, 
i = parseInt(n = (+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; 
return (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) 
+ (c ? d + (n - i).toFixed(c).slice(2) : ""); 
}; 
	document.form1.elements['horas_orcadas'].value = 0;
	var horas_analise     = document.form1.elements['horas_analise'].value.replace(".","");
	    horas_analise     = horas_analise.replace(",",".");
	var horas_desenv      = document.form1.elements['horas_desenv'].value.replace(".","");
	    horas_desenv      = horas_desenv.replace(",",".");
	var horas_consultoria = document.form1.elements['horas_consultoria'].value.replace(".","");
	    horas_consultoria = horas_consultoria.replace(",",".");
    var horas_teste       = document.form1.elements['horas_teste'].value.replace(".","");
	    horas_teste       = horas_teste.replace(",",".");
	if (horas_analise == ""){
	   horas_analise = 0;	
	}
	if (horas_desenv == ""){
	   horas_desenv = 0;	
	}
	if (horas_consultoria == ""){
	   horas_consultoria = 0;	
	}
	if (horas_teste == ""){
	   horas_teste = 0;	
	}
	var total             = parseFloat(horas_analise) + parseFloat(horas_desenv) + parseFloat(horas_consultoria) + parseFloat(horas_teste);
	var casas             = 2;
	var vlr_arredondado   = Math.round(total * Math.pow(10,casas)) / Math.pow(10,casas);
	document.form1.elements['horas_orcadas'].value = vlr_arredondado.formatMoney();

	
}

function showtip2( current, e, text){
        if (document.all && document.readyState == "complete" ){
                document.all.tooltip2.innerHTML = '<p style="border:1px solid black; background-color:#FFC">'+ text +'</p>';
                document.all.tooltip2.style.pixelLeft = event.clientX + document.body.scrollLeft + 10;
                document.all.tooltip2.style.pixelTop = event.clientY + document.body.scrollTop + 10;
                document.all.tooltip2.style.display = 'block';
        } else if ( document.getElementById ){
                document.getElementById('nstip').innerHTML = '<b>'+ text +'</b>';
                document.getElementById('nstip').style.marginLeft = '0px';
                document.getElementById('nstip').style.display = 'block';
                currentscroll = setInterval('scrolltip()',100);
                document.getElementById('tooltip2').style.left = e.pageX + 10;
                document.getElementById('tooltip2').style.top = e.pageY + 10;
                document.getElementById('tooltip2').style.display = 'block';
        }
}

function hidetip2(){
        if (document.all){
                document.all.tooltip2.style.display = 'none';
        }else if (document.getElementById){
                clearInterval(currentscroll);
                document.getElementById('tooltip2').style.display = 'none';
                document.getElementById('nstip').style.display = 'none';
        }
}

function scrolltip(){
        if ( parseInt( document.getElementById('nstip').style.marginLeft ) >= -(parseInt( document.getElementById('nstip').style.width )) ){
                document.getElementById('nstip').style.marginLeft = (parseInt( document.getElementById('nstip').style.marginLeft ) - 5) + 'px';
        }else{
                document.getElementById('nstip').style.marginLeft = '152px';
        }
}



function pede_confirmacao_cliente(boolean, msg, acao, tipo, manter_fonte){
   	
	
   if(!(confirm(msg))){
	   if (boolean == '1'){
	       document.form1.manter_fonte[0].checked = true;
	   }
	  return false;   
   } else {
	  if (boolean == '1'){
		 document.form1.action = "processa_dados_processo.php?acao="+acao+"&tipo="+tipo+"&manter_fonte="+manter_fonte;
	     document.form1.submit();
      }
      return true;
   }
   
}


function verifica_form_cnd_pagto(){
   f = document.form1;
   if (f.nome.value == ""){
	   alert("O Campo Nome deve ser preenchido");
	   f.nome.focus();
	   return false;
   }
   if (f.num_parcelas.value == ""){
	   alert("O Campo Numero de Parcelas deve ser preenchido");
	   f.num_parcelas.focus();
	   return false;
   }
   
   for (i=0;i<=300;i++){
	   
	   if (document.form1.elements['pct'+i]){
		   if (document.form1.elements['pct'+i].value == ""){
		      alert("Campo % Parcela "+i+" nao pode ser nulo");
			  document.form1.elements['pct'+i].focus();
			  return false;
			  
		   }
	   }
	   if (document.form1.elements['prazo'+i]){
		   if (document.form1.elements['prazo'+i].value == ""){
		      alert("Campo Prazo (Dias) "+i+" nao pode ser nulo");
			  document.form1.elements['prazo'+i].focus();
			  return false;
			  
		   }
		   
	   }
	      
	   
   }
   
   
   
   
}


function remove_objeto(){
    for (i=1;i<100; i++){
	   if (document.form1.elements['pct'+i]){   
	       var elemento = document.getElementById("tBody-lista");
		   var child    = document.getElementById("line"+i);
		   elemento.removeChild(child);
	   }
    }
}

function cria_objeto(o){

	//var ultima     = tabela.rows.length;
	//Cria grid
	var prazo      = 0;
	var tabela     = document.getElementById("tBody-lista");
	var pct        = (100 / o);
	var dimntv     = parseFloat(o) - 1;
	var somavlr    = 0;
   var ajustavlr  = 0;
   for (i=1;i<=o; i++){
		if (document.form1.elements['pct'+i]){ 
			continue;
		}
		somavlr = parseFloat(somavlr) + parseFloat(pct);
		
		if (somavlr > 100){
			ajustavlr = parseFloat(somavlr) - 100;
			if (ajustavlr > 0 ){
				pct = parseFloat(pct) - ajustavlr;	
			}
		}
		
		 //Cria linha do grid
		 var linha     = document.createElement("tr");
		 linha.setAttribute("id","line"+i);
		 //Cria 1� coluna do grid
		 var celula1     = document.createElement("td");
		celula1.setAttribute("align","right");
		celula1.setAttribute("class","style1");
		//Define texto a ser inserido na coluna 1
		var nodotexto1     = document.createTextNode("% Parcela "+i+":");
		
		 celula1.appendChild(nodotexto1);
		linha.appendChild(celula1);
		 //Cria 2� coluna do grid
		 var celula2     = document.createElement("td");
		celula2.setAttribute('align','left');
		
		//Define input texto da coluna 2
	
		var codigo = "<input type='text' size='03' class='style1' name='pct"+i+"' id='pct"+i+"' value= '"+pct+"' onkeyup='verifica_pct_cnd_pagto(0)' nowrap>";
		//Cria o input texto da coluna 2
		var nodotexto2     = document.createElement(codigo);
		 celula2.appendChild(nodotexto2);
		linha.appendChild(celula2);
	
		 var celula3     = document.createElement("td");
		celula3.setAttribute("align","right");
		celula3.setAttribute("class","style1");
		//Define texto a ser inserido na coluna 1
		var nodotexto3     = document.createTextNode("Prazo (Dias) "+i+":");
		
		 celula3.appendChild(nodotexto3);
		linha.appendChild(celula3);
		 //Cria 2� coluna do grid
		 var celula4     = document.createElement("td");
		celula4.setAttribute('align','left');
		//Define input texto da coluna 2
		var codigo = "<input type='text' size='03' class='style1' name='prazo"+i+"' id='prazo"+i+"' maxlength='05' onkeyup='verifica_prazo_cnd_pagto()' nowrap value='"+prazo+"'>";
		//Cria o input texto da coluna 2
		var nodotexto4     = document.createElement(codigo);
		 celula4.appendChild(nodotexto4);
		linha.appendChild(celula4);
	
	
	
		 tabela.appendChild(linha);
		 prazo = parseFloat(prazo) + 30;
    }//end for


	document.form1.elements['pct1'].focus();
}

function cria_objeto_alteracao(i,campo1,campo2){
//	document.write(campo2 + "<br />");
	
	//var ultima     = tabela.rows.length;
	//Cria grid
//	var i = o;
	var prazo      = 0;
	var tabela     = document.getElementById("tBody-lista");
//	var pct        = (100 / o);
	var pct = 0;
    //for (i=1;i<=o; i++){
	//if (document.form1.elements['pct'+i]){ 
	//   continue;
	//}
    //Cria linha do grid
    var linha     = document.createElement("tr");
    linha.setAttribute("id","line"+i);
    //Cria 1a coluna do grid
    var celula1     = document.createElement("td");
	celula1.setAttribute("align","right");
	celula1.setAttribute("class","style1");
	//Define texto a ser inserido na coluna 1
	var nodotexto1     = document.createTextNode("% Parcela "+i+":");
	
    celula1.appendChild(nodotexto1);
	linha.appendChild(celula1);
    //Cria 2a coluna do grid
    var celula2     = document.createElement("td");
	celula2.setAttribute('align','left');
	
	//Define input texto da coluna 2
	var codigo = "<input type='text' size='03' class='style1' name='pct"+i+"' id='pct"+i+"' value='"+campo1+"' onkeyup='verifica_pct_cnd_pagto(0)' nowrap>";
	//Cria o input texto da coluna 2
	var nodotexto2 = document.createElement(codigo);
    celula2.appendChild(nodotexto2);
	linha.appendChild(celula2);

    var celula3     = document.createElement("td");
	celula3.setAttribute("align","right");
	celula3.setAttribute("class","style1");
	//Define texto a ser inserido na coluna 1
	var nodotexto3     = document.createTextNode("Prazo (Dias) "+i+":");
	
    celula3.appendChild(nodotexto3);
	linha.appendChild(celula3);
    //Cria 2a coluna do grid
    var celula4     = document.createElement("td");
	celula4.setAttribute('align','left');
	//Define input texto da coluna 2
	var codigo = "<input type='text' size='03' class='style1' name='prazo"+i+"' id='prazo"+i+"' maxlength='05' onkeyup='verifica_prazo_cnd_pagto()' nowrap value='"+campo2+"'>";
	//Cria o input texto da coluna 2
	var nodotexto4     = document.createElement(codigo);
    celula4.appendChild(nodotexto4);
	linha.appendChild(celula4);


    
    tabela.appendChild(linha);

    prazo = parseFloat(prazo) + 30;
    //}//end for


	document.form1.elements['pct1'].focus();
}





function valida_filtro_guarda_fontes(){
	
   f = document.form1;
   
   if (f.vlr_unit_ini.value > f.vlr_unit_fim.value){
	   alert("Valor ATE nao pode ser maior que Valor DE.");
	   f.vlr_unit_fim.focus();
	   return false;
	
   }
}


function chama_gerador(){
	
	document.form1.action = "gera_csv_guarda_fontes.php";
	document.form1.submit();
	
}


function verifica_pct_cnd_pagto(parametro){
	var soma = 0; 

	if (parametro == 1){
	   for(i=0;i<=300;i++){
	    
	      if (document.form1.elements['pct'+i]){
		      if (document.form1.elements['pct'+i].value == ""){
			      valor = 0;
		      }  else {
			      valor = document.form1.elements['pct'+i].value.replace(",",".");   
		      }
		   
		      soma = parseFloat(soma) + parseFloat(valor);
		   
	      }
	 	
	   }
   	   if (soma != 100){
			   
	      alert("A soma de Porcentagem das Parcelas  \n não pode ser diferente de 100 ");
		  return false;    
       }
	} else {
		
	   	var erro = 0;
	    var o = 0;
	    var teste;
	    
	    for(i=0;i<=300;i++){
		    
  	        var entrou = 0;
	        teste = "";
	        if (document.form1.elements['pct'+i]){
				var tam = document.form1.elements['pct'+i].value.length;
				
				caracter1 = document.form1.elements['pct'+i].value;
		        if (document.form1.elements['pct'+i].value != ""){ 
			    
				   for (e=0;e<=tam;e++){
			             caracter = caracter1.charAt(e);
		                 if (caracter != "" ){
		                     if (caracter != 0 &&
			                     caracter != 1 &&
			                     caracter != 2 &&
			                     caracter != 3 &&
			                     caracter != 4 &&
			                     caracter != 5 &&
			                     caracter != 6 &&
			                     caracter != 7 &&
			                     caracter != 8 &&
			                     caracter != 9 &&
								 caracter != '.' &&
								 caracter != ','){
			                      
			                     alert("Campo prazo só permite números");
					             erro = 1;
			                     break;
		                     } else {
								 
					             entrou = 1;
					             teste = teste+caracter;
					
					         }
				         }
		            }
			        if (entrou == 1){
				        document.form1.elements['pct'+i].value = teste;
				  
			        } else {
				        document.form1.elements['pct'+i].value = "";  
			        }
		        }
	        }
	        if (erro != 0){
		        break;   
	        }
	    }
	
	}
	
	
}



function verifica_prazo_cnd_pagto(){
	var erro = 0;
	var o = 0;
	var teste;
	
	for(i=0;i<=300;i++){
  	   var entrou = 0;
	   teste = "";
	   if (document.form1.elements['prazo'+i]){
		   caracter1 = document.form1.elements['prazo'+i].value;
		   if (document.form1.elements['prazo'+i].value != ""){ 
			  for (e=0;e<5;e++){
			      caracter = caracter1.charAt(e);
		         if (caracter != "" ){
		            if (caracter != 0 &&
			            caracter != 1 &&
			            caracter != 2 &&
			            caracter != 3 &&
			            caracter != 4 &&
			            caracter != 5 &&
			            caracter != 6 &&
			            caracter != 7 &&
			            caracter != 8 &&
			            caracter != 9 ){
			  
			            alert("Campo prazo só permite números");
					    erro = 1;
			            break;
		            } else {
					   entrou = 1;
					   teste = teste+caracter;
					
					}
				 }
		      }
			  if (entrou == 1){
				document.form1.elements['prazo'+i].value = teste;
				  
			  } else {
				document.form1.elements['prazo'+i].value = "";  
			  }
		   }
	   }
	   if (erro != 0){
		  break;   
	   }
	}
}



function verifica_caracter_pct_parcela(){
	var erro = 0;
	var o = 0;
	var teste;
	
	for(i=0;i<=300;i++){
  	   var entrou = 0;
	   teste = "";
	   if (document.form1.elements['prazo'+i]){
		   caracter1 = document.form1.elements['prazo'+i].value;
		   if (document.form1.elements['prazo'+i].value != ""){ 
			  for (e=0;e<5;e++){
			      caracter = caracter1.charAt(e);
		         if (caracter != "" ){
		            if (caracter != 0 &&
			            caracter != 1 &&
			            caracter != 2 &&
			            caracter != 3 &&
			            caracter != 4 &&
			            caracter != 5 &&
			            caracter != 6 &&
			            caracter != 7 &&
			            caracter != 8 &&
			            caracter != 9 ){
			  
			            alert("Campo prazo só permite números");
					    erro = 1;
			            break;
		            } else {
					   entrou = 1;
					   teste = teste+caracter;
					
					}
				 }
		      }
			  if (entrou == 1){
				document.form1.elements['prazo'+i].value = teste;
				  
			  } else {
				document.form1.elements['prazo'+i].value = "";  
			  }
		   }
	   }
	   if (erro != 0){
		  break;   
	   }
	}
}