function janPDF(url){ window.open(url,'janPDF','status,scrollbars=1,resizeable=0,width=577,height=600,top=30,left=30') return false; } function strtofloat(valor) { valor = valor.toString(); retorno = valor; retorno = retorno.replace(/[.]/gi, ''); retorno = retorno.replace(/[,]/gi, '.'); if (parseFloat(retorno)) return parseFloat(retorno); else return 0; } function fmt_valor(valor, sep_mil, sep_dec) { len = valor.length; if (len > 0) { var strCheck = '0123456789'; for(i = 0; i < len; i++) if ((valor.charAt(i) != '0') && (valor.charAt(i) != sep_dec)) break; aux = ''; for(; i < len; i++) if (strCheck.indexOf(valor.charAt(i))!=-1) aux += valor.charAt(i); len = aux.length; if (len == 0) aux3 = '0,00'; if (len == 1) aux3 = '0'+ sep_dec + '0' + aux; if (len == 2) aux3 = '0'+ sep_dec + aux; if (len > 2) { aux2 = ''; for (j = 0, i = len - 3; i >= 0; i--) { if (j == 3) { aux2 += sep_mil; j = 0; } aux2 += aux.charAt(i); j++; } aux3 = ''; len2 = aux2.length; for (i = len2 - 1; i >= 0; i--) aux3 += aux2.charAt(i); aux3 += sep_dec + aux.substr(len - 2, len); } return aux3; } else return ""; } function fmt_campo_valor(campo, sep_mil, sep_dec, evento) { len = campo.value.length; if (len > 0) { var whichCode = (window.Event) ? evento.which : evento.keyCode; if ((whichCode >= 96 && whichCode <= 105) || (whichCode == 8) || (whichCode == 46) || (evento.type == 'blur')) { aux = fmt_valor(campo.value, sep_mil, sep_dec); while (aux.length > campo.maxLength) { aux2 = aux.substring(0, aux.length -1); aux = fmt_valor(aux2, sep_mil, sep_dec); } campo.value = aux; } } } function mascara_cep(objeto) { campo = eval (objeto); separador1 = '.'; separador2 = '-'; conjunto1 = 2; conjunto2 = 6; if (campo.value.length == conjunto1) { campo.value = campo.value + separador1; } if (campo.value.length == conjunto2) { campo.value = campo.value + separador2; } } function mascara_data(data) { var mydata = ''; mydata = mydata + data; if (mydata.length == 2) { mydata = mydata + '/'; } if (mydata.length == 5) { mydata = mydata + '/'; } return mydata; } function mascara_data2(campo, evento) { var tecla = evento.keyCode; vr = campo.value; vr = vr.replace( "/", "" ); vr = vr.replace( "/", "" ); tam = vr.length + 1; if ((tecla >= 96 && tecla <= 105 ) || (evento.type == 'blur')) { if (tam > 2 && tam < 5) campo.value = vr.substr(0, tam - 2) + '/' + vr.substr(tam - 2, tam); if (tam >= 5 && tam <= 11) campo.value = vr.substr(0, 2) + '/' + vr.substr(2, 2) + '/' + vr.substr(4, 4); } } function ver_data(data, ano_ini, ano_fim) { erro = false; meses = new Array (31,28,31,30,31,30,31,31,30,31,30,31); if (data.length <10) erro = true; else { if ((data.substr(2,1) != "/") && (data.substr(5,1) != "/")) { erro = true; } else { d = parseFloat(data.substr(0,2)); m = parseFloat(data.substr(3,2)); a = parseFloat(data.substr(6,4)); if (((d>0) && (d<32)) && ((m>0) && (m<13)) && ((a>=ano_ini) && (a<=ano_fim))) { if (m==2) { if (a%4==0) { if ((d<1) || (d>29)) erro = true; } else { if ((d<1) || (d>meses[m-1])) erro = true; } } else { if ((d<1) || (d>meses[m-1])) erro = true; } } else erro = true; } } return (!erro); } function trim(str) { return str.replace(/^\s*|\s*$/g,""); } function checa_email(email) { aux = trim(email) aux_pos = aux.indexOf("@"); aux_pos2 = aux.indexOf(" "); if ((aux_pos <= 1) || (aux == '') || (aux_pos2 > 0)) return false else return true; } function mascara_cpf(campo, teclapres) { tecla = teclapres.keyCode; vr = new String(campo.value); vr = vr.replace(".", ""); vr = vr.replace(".", ""); vr = vr.replace("/", ""); vr = vr.replace("-", ""); tam = vr.length + 1 ; if (tecla != 9 && tecla != 8) { if (tam > 3 && tam < 7) campo.value = vr.substr(0, 3) + '.' + vr.substr(3, tam); if (tam >= 7 && tam < 10) campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,tam-6); if (tam >= 10 && tam < 14) campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,3) + '-' + vr.substr(9,tam-9); } } function verifica_cpf(valor) { erro = 0; aux1 = 0; aux2 = 0; aux3 = 1; for (i=0;i -1)) return true; else return false; } function MostrarData() { Hoje = new Date() Data = Hoje.getDate() Dia = Hoje.getDay() Mes = Hoje.getMonth() Ano = Hoje.getYear() // if (Data<10) { Data = "0" + Data } var sNavegador = navigator.appName; if (sNavegador == "Microsoft Internet Explorer") { if (Ano < 2000) { Ano = "19" + Ano } } else { Ano = Ano + 1900; } // NomeDia = new Array(7) NomeDia[0] = "Domingo" NomeDia[1] = "Segunda-feira" NomeDia[2] = "Terça-feira" NomeDia[3] = "Quarta-feira" NomeDia[4] = "Quinta-feira" NomeDia[5] = "Sexta-feira" NomeDia[6] = "Sábado" // NomeMes = new Array(12) NomeMes[0] = "Janeiro" NomeMes[1] = "Fevereiro" NomeMes[2] = "Março" NomeMes[3] = "Abril" NomeMes[4] = "Maio" NomeMes[5] = "Junho" NomeMes[6] = "Julho" NomeMes[7] = "Agosto" NomeMes[8] = "Setembro" NomeMes[9] = "Outubro" NomeMes[10] = "Novembro" NomeMes[11] = "Dezembro" // document.write (Data + " " + NomeMes[Mes] + " " + Ano) }