// JavaScript Document - PASTA RAIZ
function MostrarValorDetalhe(){
//funcao para mostrar os div's com os determinados preços
	var indice = document.preco.opcao.selectedIndex;
	var textoEscogido = document.preco.opcao.options[indice].value;
	var tamanho = document.preco.opcao.length;
	
   for(i=0;i<tamanho;i++){	
//for responsavel por fechar todos os div's
	CodPrecoFechar = document.preco.opcao.options[i].value
	div_preco = 'janelaPreco_' + CodPrecoFechar;   

	window.document.getElementById(div_preco).style.visibility='hidden';
	window.document.getElementById(div_preco).style.position='absolute';
	
	div_bto = 'btocomprar_' + CodPrecoFechar;   	
	
	window.document.getElementById(div_bto).style.visibility='hidden';
	window.document.getElementById(div_bto).style.position='absolute';	

}
//aki mostra o preco escolhido deacordo com a descricao	
	div_preco_mostrar = 'janelaPreco_' + textoEscogido;

	window.document.getElementById(div_preco_mostrar).style.visibility='visible';
	window.document.getElementById(div_preco_mostrar).style.position='static';
	
	div_bto_mostrar = 'btocomprar_' + textoEscogido;   	
	
	window.document.getElementById(div_bto_mostrar).style.visibility='visible';
	window.document.getElementById(div_bto_mostrar).style.position='static';	
	
    window.document.preco.OpcaoEscolhida.value = textoEscogido;

}

function Limpar(valor, validos) { 
// retira caracteres invalidos da string 
var result = ""; 
var aux; 
for (var i=0; i < valor.length; i++) { 
aux = validos.indexOf(valor.substring(i, i+1)); 
if (aux>=0) { 
result += aux; 
} 
} 
return result; 
} 


//Formata número tipo moeda usando o evento onKeyDown 
function Formata(campo,tammax,teclapres,decimal) { 
	
var tecla = teclapres.keyCode; 
vr = Limpar(campo.value,"0123456789"); 
tam = vr.length; 
dec=decimal 

if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; } 

if (tecla == 8 ) 
{ tam = tam - 1 ; } 

if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) 
{ 

if ( tam <= dec ) 
{ campo.value = vr ; } 

if ( (tam > dec) && (tam <= 5) ){ 
campo.value = vr.substr( 0, tam - 2 ) + "," + vr.substr( tam - dec, tam ) ; } 
if ( (tam >= 6) && (tam <= 8) ){ 
campo.value = vr.substr( 0, tam - 5 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; 
} 
if ( (tam >= 9) && (tam <= 11) ){ 
campo.value = vr.substr( 0, tam - 8 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; } 
if ( (tam >= 12) && (tam <= 14) ){ 
campo.value = vr.substr( 0, tam - 11 ) + "." + vr.substr( tam - 11, 3 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; } 
if ( (tam >= 15) && (tam <= 17) ){ 
campo.value = vr.substr( 0, tam - 14 ) + "." + vr.substr( tam - 14, 3 ) + "." + vr.substr( tam - 11, 3 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - 2, tam ) ;} 
} 

} 

function VerificaQtd(Form,Submit,Num, QtdMax){
	var Form, Submit, Num, QtdMax
	Qtd = Num.value
	if (Qtd > QtdMax){
		alert('Quantidade muito alta do produto, diminua!')
		Num.value = QtdMax
		}
		if(Submit == 'True'){
			document[Form].submit();
			}
	
	}
	
// FUNÇÕES DE COOKIE
function Tecla(e)
{
		if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if (tecla > 47 && tecla < 58)   // numeros de 0 a 9 |tecla 46 = . | tecla 44 = ,  vvv || tecla == 46 || tecla == 44
			return true;
		else
			{
				if (tecla != 8) // backspace
					event.keyCode = 0;
					//return false;
				else
					return true;
			}
}
//Funcao q bloqueia as letras e os pontos, permitindo só os números e vírgulas
function TeclaB(e)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if (tecla > 47 && tecla < 58 || tecla == 44)   // numeros de 0 a 9 |tecla 46 = . | tecla 44 = ,  vvv || tecla == 46 || tecla == 44
			return true;
		else
			{
				if (tecla != 8) // backspace
					event.keyCode = 0;
					//return false;
				else
					return true;
			}
}
//fim da funcao

function deci(N){
       texto = N.toString();
       texto2 = ""
       if (texto.indexOf(',') != -1)
       {
          for (var i = 0; i < texto.length; i++)
          {
              if(texto.charAt(i) == ",")
                                 texto2 += ".";
              else
                                 texto2 += texto.charAt(i);
          }
          texto = texto2;
       }   
          
          
          texto[texto.indexOf(',')] = ".";
       ponto = texto.indexOf('.');
    if (ponto == -1)
    {
 texto += ".00";
 Term = texto
    }
    else
    {
 texto += "0";
 decimal = ponto + 3;
 Term = texto.substring(0,decimal);
    }
    if (Term == ".0")    { Term = "0.00";}
       if (Term == ".00")   { Term = "0.00";}
    //if (Term == "NaN.00"){ Term = "Erro";}
    return Term;
}

function SomaFinal(){
var VFinal, SubTotal, Frete, Desconto, VDesconto, VDescontoB
	
SubTotal 	= 	document.form_pedido.SubTotal.value;
Frete 	 	= 	document.form_pedido.Frete.value;
Desconto 	=	document.form_pedido.Desconto.value;
DescontoB 	=	document.form_pedido.DescontoB.value;

if (SubTotal == '' && Frete == ''){
document.form_pedido.ValorFinal.value = '';

}else{
SubTotal = SubTotal.replace(".","");
SubTotal = SubTotal.replace(",",".");

		if (Frete.length > 7) {
		Frete = Frete.replace(".","")
		Frete = Frete.replace(",",".")
		}else{

		Frete = Frete.replace(".",",")
		Frete = Frete.replace(",",".")

		}

//Frete = Frete.replace(".",",");
//Frete = Frete.replace(",",".");

		if (Desconto.length > 7) {
		Desconto = Desconto.replace(".","")
		Desconto = Desconto.replace(",",".")
		}else{

		Desconto = Desconto.replace(".",",")
		Desconto = Desconto.replace(",",".")

		}
//Desconto = Desconto.replace(".","");
//Desconto = Desconto.replace(",",".");
if (Frete == ''){
VFinal = eval(SubTotal);	
	}else{
VFinal = eval(SubTotal) + eval(Frete);
	}

//**********************************
//contagem do desconto Porcentagem
if (Desconto != ''){
					VDesconto = eval(VFinal) - eval(Desconto)
							if (VDesconto < 0 ){
								document.form_pedido.Desconto.value = '';
								document.form_pedido.Desconto.className = 'campo_alerta';
								document.form_pedido.Desconto.focus();		
								alert('O Desconto de R$ '+Desconto+' reais é muito alto!');
								}else{
									VFinal = VDesconto
									}
				}

if (DescontoB != ''){
					VDescontoB = (eval(VFinal) * eval(DescontoB))/100
					VDescontoB = eval(VFinal) - eval(VDescontoB)					
							if (VDescontoB < 0 ){
								document.form_pedido.DescontoB.value = '';
								document.form_pedido.DescontoB.className = 'campo_alerta';
								document.form_pedido.DescontoB.focus();		
								alert('O Desconto de '+DescontoB+'% é muito alto!');
								}else{
									VFinal = VDescontoB
									}
					}
		
//fim do desconto em Porcentagem


VFinal = deci(VFinal);
document.form_pedido.ValorFinal.value = VFinal;	
	}
	

}
function muda_valor1(NomeCampo){

var NomeCampo
//alert(NomeCampo);
if (NomeCampo == "Tipo1n") {
ProxCampo = "Valor1n"
}
if (NomeCampo == "Valor1n") {
ProxCampo = "Tipo2n"
}
if (NomeCampo == "Tipo2n") {
ProxCampo = "Valor2n"

TipoTXT = document.form_incluir[NomeCampo][document.form_incluir[NomeCampo].selectedIndex].value
TipoTXT = TipoTXT.concat("n")
TipoTXT = TipoTXT.concat(document.form_incluir["Valor1n"][document.form_incluir["Valor1n"].selectedIndex].text)

}else{


    TipoTXT = document.form_incluir[NomeCampo][document.form_incluir[NomeCampo].selectedIndex].value
	TipoTXT = TipoTXT.concat("n")
}

sel = "Selecione,"
	str_1 = new String(sel.concat(document.form_incluir[TipoTXT].value));
	itens = str_1.split(","); 
    //vejo se o pais está definido 
    if (TipoTXT != 0) { 
       //se estava definido, entao coloco as opcoes do estado correspondente. 

       //calculo o numero de estados 
       num_itens = itens.length
       //marco o número de estados no select 
       document.form_incluir[ProxCampo].length = num_itens
       //para cada estado do array, o introduzo no select 
       for(i=0;i<num_itens;i++){ 
if (document.form_incluir[ProxCampo].options[i].value=itens[i] == "" )
{
          document.form_incluir[ProxCampo].disabled = "yes"
}else
{
          document.form_incluir[ProxCampo].disabled = ""
}

          document.form_incluir[ProxCampo].options[i].value=itens[i] 
          document.form_incluir[ProxCampo].options[i].text=itens[i] 

	  
	   } 
    }else{ 
       //se não havia estado selecionado, elimino os estados do select 
       document.form_incluir[ProxCampo].length = 1 
       //coloco um traço na única opção que deixei 
       document.form_incluir[ProxCampo].options[0].value = "-" 
       document.form_incluir[ProxCampo].options[0].text = "-" 
    } 
    //marco como selecionada a opção primeira de estado 
    document.form_incluir[ProxCampo].options[0].selected = true 
}

function opcaobalanco(acao){
var acao
if (acao == 'Categoria'){
	document.form_relatorio1.categoria.disabled = '';
	}else{
	document.form_relatorio1.categoria.disabled = 'True';
		}
	

	
}

function opcaopedido(acao){
var acao
if (acao == 1){
	document.form_relatorio1.Dias.disabled      = '';		
	document.form_relatorio1.dtunica.disabled   = 'True';	
	document.form_relatorio1.dtinicial.disabled = 'True';
	document.form_relatorio1.dtfinal.disabled   = 'True';	
	document.form_relatorio1.Cliente.disabled   = 'True';		
	}
if (acao == 2){
	document.form_relatorio1.dtunica.disabled   = '';		
	document.form_relatorio1.Dias.disabled      = 'True';	
	document.form_relatorio1.dtinicial.disabled = 'True';
	document.form_relatorio1.dtfinal.disabled   = 'True';	
	document.form_relatorio1.Cliente.disabled   = 'True';	
    }	
if (acao == 3){
	document.form_relatorio1.dtunica.disabled   = 'True';	
	document.form_relatorio1.Dias.disabled      = 'True';	
	document.form_relatorio1.dtinicial.disabled = '';
	document.form_relatorio1.dtfinal.disabled   = '';	
	document.form_relatorio1.Cliente.disabled   = 'True';	
	}
if (acao == 4){
	document.form_relatorio1.Cliente.disabled   = '';	
	document.form_relatorio1.dtunica.disabled   = 'True';	
	document.form_relatorio1.Dias.disabled      = 'True';	
	document.form_relatorio1.dtinicial.disabled = 'True';
	document.form_relatorio1.dtfinal.disabled   = 'True';	
	}	
}

function opcaovisualizar(acao){

var acao
if (acao == 'avancado'){
	window.janelaopcao.style.visibility='visible';
	window.janelaopcao.style.position='static';
	window.janelaopcaoSimples.style.visibility='hidden';
	window.janelaopcaoSimples.style.position='absolute';
		
}else{
	window.janelaopcao.style.visibility='hidden';
	window.janelaopcao.style.position='absolute';
	window.janelaopcaoSimples.style.visibility='visible';
	window.janelaopcaoSimples.style.position='static';	
	}
	}
	
function AscendeApaga(Obj, Acao){
var Obj, Acao

if (Acao == "Ascende"){
	window[Obj].style.visibility='visible';
	window[Obj].style.position='static';
}else{
	window[Obj].style.visibility='hidden';
	window[Obj].style.position='absolute';
}
}
	
function MandaCliente(codcliente, user_id, nome, cgccpf, TelefoneCom, rua, Numero, bairro, cep, complemento, cidade, estado){

var codcliente, user_id, nome, cgccpf, TelefoneCom, rua, Numero, bairro, cep, complemento, cidade, estado

window.opener.janelaLoginCliente.style.visibility='visible';
window.opener.janelaLoginCliente.style.position='static';
window.opener.janelaLoginEndereco.style.visibility='visible';
window.opener.janelaLoginEndereco.style.position='static';
window.opener.form_pedido.Produto.disabled = '';
window.opener.form_pedido.CodCliente.value 	= codcliente;
window.opener.form_pedido.NomeComp.value 	= nome;
window.opener.form_pedido.CNPJCPFComp.value = cgccpf;
window.opener.form_pedido.EmailComp.value 	= user_id;
window.opener.form_pedido.FoneComp.value 	= TelefoneCom;
window.opener.form_pedido.Rua.value 		= rua;
window.opener.form_pedido.NumComp.value 	= Numero;
window.opener.form_pedido.Bairro.value 		= bairro;
window.opener.form_pedido.CEP.value 		= cep;
window.opener.form_pedido.complemento.value = complemento;
window.opener.form_pedido.estado.value 		= estado;
window.opener.form_pedido.Cidade.value 		= cidade;
window.close();
}

function MandaSubTotal(SubTotal){

var SubTotal
    if (SubTotal == '') {
window.parent.form_pedido.SubTotal.value = '';
    }else{

//tratamento quando o número der picadinho
numero = SubTotal.indexOf(".")
if (numero != -1){
numero = numero + 3
SubTotal = SubTotal.substring(0,numero);
SubTotal = SubTotal.replace(".",",");
}
//fim do tratamento

window.parent.form_pedido.SubTotal.value = SubTotal;
	}
window.parent.form_pedido.SubTotal.focus();

}

function Mandaformapg(VisImage,formapgto, Banco, Cedente, Agencia, Conta, TipoConta, Imagem, Codigo, CGCCPF, Digito, CarteiraCobra){

var VisImage, formapgto, Banco, Cedente, Agencia, Conta, TipoConta, Imagem, Codigo, CGCCPF, Digito, CarteiraCobra

window.opener.janelaLoginFormadePG.style.visibility='visible';
window.opener.janelaLoginFormadePG.style.position='static';

window.opener.form_pedido.BtSubmit.disabled 	  = '';
window.opener.form_pedido.Pagamento.value 	 	  = formapgto;
window.opener.form_pedido.Banco.value 		 	  = Banco;
window.opener.form_pedido.Codformapgto.value 	  = Codigo;
window.opener.form_pedido.Conta.value 		 	  = Conta;

if (VisImage != "No"){
window.opener.form_pedido.Cedente.value 	 	  = Cedente;
window.opener.form_pedido.Agencia.value 	 	  = Agencia;

window.opener.form_pedido.Tipo.value 		 	  = TipoConta;

window.opener.form_pedido.FPG_CGCCPF.value   	  = CGCCPF;
window.opener.form_pedido.FPG_Digito.value        = Digito;
window.opener.form_pedido.FPG_CarteiraCobra.value = CarteiraCobra;


window.opener.document.logo.src = Imagem;
}


window.close();
}


function setCookie(name, value, expires, path, domain, secure) {
          var curCookie = name + "=" + escape(value) +
          ((expires) ? "; expires=" + expires.toGMTString() : "") +
          ((path) ? "; path=" + path : "") +
          ((domain) ? "; domain=" + domain : "") +
          ((secure) ? "; secure" : "");
          document.cookie = curCookie;
}
function getCookie(name) {
        var dc = document.cookie;
        var prefix = name + "=";
        var begin = dc.indexOf("; " + prefix);
        if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
        } else
        begin += 2;
        var end = document.cookie.indexOf(";", begin);
        if (end == -1)
        end = dc.length;
        return unescape(dc.substring(begin + prefix.length, end));
 }
 function deleteCookie(name, path, domain) {
        if (getCookie(name)) {
               document.cookie = name + "=" + 
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               "; expires=Thu, 01-Jan-70 00:00:01 GMT";
               history.go(0);
        }
 }
 function fixDate(date) {
        var base = new Date(0);
        var skew = base.getTime();
        if (skew > 0) date.setTime(date.getTime() - skew);
 } 
 
<!--//
    function abrePG(url) {
      window.open(url,'Modificar_Forma_de_Pagamento','status=no,toolbar=no,location=no,scrollbars=no,resizable=no,menubar=no,width=325,height=305');
	  }


function DropDown(Janela, Habilita){
var Janela, Habilita
if (Habilita.value != "True"){
Janela.style.visibility='hidden';
Janela.style.position='absolute';
}else{
Janela.style.visibility='visible';
Janela.style.position='static';
}
}

function MSGbanner(){
if (document.form_incluir.banner_classificacao.value == "Central_Superior"){
	
	link_banner.href = 'df_upload_imagens.asp?campo=Imagem&pasta=banners%5Fimagens&TipoInfo=Central_Superior'
	document.form_incluir.banner_instrucao.value = "Esta imagem deve possui até 470 pixels de largura. Caso isto não seja feito, o banner terá sua visualização comprometida."

}else{

	link_banner.href = "df_upload_imagens.asp?campo=Imagem&pasta=banners%5Fimagens&TipoInfo=Lateral_Menu"
	document.form_incluir.banner_instrucao.value = "Esta imagem deve possui até 220 pixels de largura. Caso isto não seja feito, o banner terá sua visualização comprometida."

}
}

function FormadePg(){
if (document.form_incluir.formapgto.value == "Débito em Conta BB"){

janelaFormdePG_Debito_BB.style.visibility='visible';
janelaFormdePG_Debito_BB.style.position='static';

janelaFormdePG.style.visibility='hidden';
janelaFormdePG.style.position='absolute';
janelaFormdePG2.style.visibility='hidden';
janelaFormdePG2.style.position='absolute';



}else{
if (document.form_incluir.formapgto.value != "Boleto" && document.form_incluir.formapgto.value != "Depósito"){

janelaFormdePG.style.visibility='hidden';
janelaFormdePG.style.position='absolute';
janelaFormdePG2.style.visibility='hidden';
janelaFormdePG2.style.position='absolute';

janelaFormdePG_Debito_BB.style.visibility='hidden';
janelaFormdePG_Debito_BB.style.position='absolute';

}else{

janelaFormdePG_Debito_BB.style.visibility='hidden';
janelaFormdePG_Debito_BB.style.position='absolute';	
	
janelaFormdePG.style.visibility='visible';
janelaFormdePG.style.position='static';
janelaFormdePG2.style.visibility='visible';
janelaFormdePG2.style.position='static';
}
}
}


function EscolheEnvio(StrTipoEntrega){
var StrTipoEntrega
if (StrTipoEntrega == "Correios"){
Correios.style.visibility='visible';
Correios.style.position='static';
ConfigCorreios.style.visibility='visible';
ConfigCorreios.style.position='static';

ConfigTabelaFree.style.visibility='hidden';
ConfigTabelaFree.style.position='absolute';
FreteGratis.style.visibility='hidden';
FreteGratis.style.position='absolute';


		var now = new Date();
		fixDate(now);
		now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
		setCookie("ConfigEnvio", "Correios", now);

}
if (StrTipoEntrega == "TabelaPropria"){
FreteGratis.style.visibility='visible';
FreteGratis.style.position='static';
ConfigTabelaFree.style.visibility='visible';
ConfigTabelaFree.style.position='static';

ConfigCorreios.style.visibility='hidden';
ConfigCorreios.style.position='absolute';
Correios.style.visibility='hidden';
Correios.style.position='absolute';

		var now = new Date();
		fixDate(now);
		now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
		setCookie("ConfigEnvio", "Gratis", now);

}
}



function AtivaDesativa(Origem, Filho){
var Origem, Filho
if (Origem.checked == false){
Filho.disabled = true;
}else{
Filho.disabled = false;
}
}
function BtCarrinho2(form){
if (verifica_form(form) == false){
return
}else{
form.submit();
}
}


function btSubmit2(form){
SomaFinal();
if (verifica_form(form) == false){
return
}else{

form.submit();
}
}

function btSubmit(form){

if (verifica_form(form) == false){
return
}else{

abreImpressao('','Relatorio');
form.submit();
}
}

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 imagem(bmp)
{
if (bmp.width > 100) bmp.width = 100
}

function imagemZoom(bmp)
{
if (bmp.width > 250) bmp.width = 250
//if (bmp.height > 100) bmp.height = 100
}

function imagembanner_530(bmp)
{
if (bmp.width > 470) bmp.width = 470
//if (bmp.height > 100) bmp.height = 100
}
function imagembanner_220(bmp)
{
if (bmp.width > 220) bmp.width = 220
//if (bmp.height > 100) bmp.height = 100
}

    function abre(url, titulo) {
      window.open(url,titulo,'status=no,toolbar=no,location=no,scrollbars=no,resizable=no,menubar=no,width=300,height=225');
	  }

function checa_email(campo) {
var mensagem = "Informe corretamente o email"
var msg = "";
if (campo != ""){
var email = campo.match(/(\w+)@(.+)\.(\w+)$/);
if (email == null){
  msg = mensagem;
  }
}
return msg;
}

function MandaEmailSenha(Form){
if (Form.login.value != ''){
msg = checa_email(Form.login.value)
	if (msg == ''){	
	Form.action = 'MandaEmailSenha.asp'
	Form.submit();
	}else{
	alert('Digite corretamente o email!');
	Form.login.className = 'campo_alerta'
	Form.login.focus();
	}
}else{
alert('Digite corretamente o email!');
Form.login.className = 'campo_alerta'
Form.login.focus();
}
}

function valida_procura() {
  var Form; 
  Form = document.encontra;
  if (Form.procura.value.length == 0) {
    alert("Campo Procura não pode ser vazio !");
    Form.procura.focus();
    return false;
  }
  if (Form.procura.value.length < 2) {
    alert("Campo procura deve conter ao menos 2 caracteres !");
    Form.procura.focus();
    return false;
  }
  return true;
}
//-->
<!--
function abre_janela(width, height, nome) {
var top; var left;
top = ( (screen.height/2) - (height/2) )
left = ( (screen.width/2) - (width/2) )
window.open('',nome,'width='+width+',height='+height+',align=right, scrollbars=yes,toolbar=no,location=no,status=yes,menubar=no,resizable=no,left='+left+',top='+top);
}
function recebe_imagem(campo, imagem){
var foto = 'img_' + campo
document.form_incluir[campo].value = imagem;
document.form_incluir[foto].src = imagem;
}


function verifica_form(form) {

var passed = false;
var ok = false
var campo
for (i = 0; i < form.length; i++) {
  campo = form[i].name;
	
	//funcao repetir senha
	if (form[i].df_Senha == "sim") {
	  if (form[i].value != form[i+1].value){
	  alert("Senha não confere");
	  return false;
	  }
	  }
	  
  if (form[i].df_verificar == "sim") {
    if (form[i].type == "text"  | form[i].type == "password" | form[i].type == "textarea" | form[i].type == "select-one") {
      if (form[i].value == "" | form[i].value == "http://") {
		  if (form[i].disabled == "") {
			form[campo].className='campo_alerta'
			form[campo].focus();
			alert("Preencha corretamente o campo");
			return passed;
			stop;
		 }
//		 else{
//						passed = true;					  
//					  }
      }
    }
    else if (form[i].type == "radio") {

	if (form[campo].length == null){
		if (form[campo].checked) {
          ok = true;
        }else{
			ok = false;
		}
		
		}else{
	      for (x = 0; x < form[campo].length; x++) {
        ok = false;
        if (form[campo][x].checked) {
          ok = true;
          break;
        }
      }
		}
		
      if (ok == false) {
	  if (form[i].disabled == "") {
        //form[campo][0].focus();
		//form[campo][0].select();
        alert("Informe uma das opcões");
        return passed;
        stop;
	  }
//	  else{
//						passed = true;					  
//					  }
      }
    }
//VOLTAR AKI
  }

  //INICIO
      var msg = ""
    if (form[campo].df_validar == "cpf") msg = checa_cpf(form[campo].value);
    if (form[campo].df_validar == "cnpj") msg = checa_cnpj(form[campo].value);
    if (form[campo].df_validar == "cpf_cnpj") {
	  msg = checa_cpf(form[campo].value);
	  if (msg != "") msg = checa_cnpj(form[campo].value);
	}
    if (form[campo].df_validar == "email") msg = checa_email(form[campo].value);
    if (form[campo].df_validar == "numerico") msg = checa_numerico(form[campo].value);

if (msg != "") {
				  if (form[i].disabled == "") {

	  if (form[campo].df_validar == "cpf_cnpj") msg = "informe corretamente o número do CPF ou CNPJ";

form[campo].className='campo_alerta'
      form[campo].focus();
      form[campo].select();
      alert(msg);
      return passed;
      stop;
				  }
//				  else{

//						passed = true;					  
//					  }
    }//FIM
}
passed = true;
return passed;
}
function desabilita_cor(campo) {
campo.className='CxMenu'
}
function checa_numerico(String) {
var mensagem = "Este campo aceita somente números"
var msg = "";
if (String != "") {
if (isNaN(String)) msg = mensagem;
}
return msg;
}

function checa_cpf(CPF) {
var mensagem = "informe corretamente o número do CPF"
var msg = "";
if (CPF != ""){
if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
  CPF == "22222222222" ||	CPF == "33333333333" || CPF == "44444444444" ||
  CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
  CPF == "88888888888" || CPF == "99999999999")
msg = mensagem;
soma = 0;
for (y=0; y < 9; y ++)
soma += parseInt(CPF.charAt(y)) * (10 - y);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11)resto = 0;
if (resto != parseInt(CPF.charAt(9)))
  msg = mensagem; soma = 0;
for (y = 0; y < 10; y ++)
  soma += parseInt(CPF.charAt(y)) * (11 - y);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11) resto = 0;
if (resto != parseInt(CPF.charAt(10)))
  msg = mensagem;
}
return msg;
}
function checa_cnpj(s) {
var mensagem = "informe corretamente o número do CNPJ"
var msg = "";
var y;
var c = s.substr(0,12);
var dv = s.substr(12,2);
var d1 = 0;
if (s != ""){
	for (y = 0; y < 12; y++)
	{
	d1 += c.charAt(11-y)*(2+(y % 8));
	}
	if (d1 == 0) msg = mensagem;
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(0) != d1)msg = mensagem;
	d1 *= 2;
	for (y = 0; y < 12; y++)
	{
	d1 += c.charAt(11-y)*(2+((y+1) % 8));
	}
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(1) != d1) msg = mensagem;
}
return msg;
}
function mascara_data(data){ 
var mydata = ''; 
mydata = mydata + data; 
if (mydata.length == 2){ 
mydata = mydata + '/'; 
} 
if (mydata.length == 5){ 
mydata = mydata + '/'; 
} 
return mydata; 
} 
function verifica_data(data) { 
if (data.value != "") {
dia = (data.value.substring(0,2));
mes = (data.value.substring(3,5)); 
ano = (data.value.substring(6,10)); 
situacao = ""; 
if ((dia < 01)||(dia < 01 || dia > 30) && (  mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31) { 
situacao = "falsa"; 
} 
if (mes < 01 || mes > 12 ) { 
situacao = "falsa"; 
}
if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4)))) { 
situacao = "falsa"; 
} 
if (situacao == "falsa") { 
data.focus();
data.select();
alert("Data inválida!"); 
}
} 
}

function submita(){

document.formPgto25.submit();
}
//-->
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);