// Função para validar e-mail // Criado por: Eduardo Y. Palomba (eduardo@linkecerebro.com.br) // Criado em : 24 de abril de 2003 - 19h40 function valida_EMAIL(campo) { var goodEmail = campo.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi); if (goodEmail) { return true; } else { return false; } } // Função para entrar somente números num campo do formulário // Criado por: Eduardo Y. Palomba (eduardo@linkecerebro.com.br) // Criado em : 24 de abril de 2003 - 17h20 function filtro_SoNumeros() { if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false; } function newFiltro_SoNumeros(evt) { var tecla; if (evt.keyCode) tecla = evt.keyCode; else tecla = evt.which; if (tecla < 48 || tecla > 57) { if (evt.keyCode) evt.returnValue = false; else evt.preventDefault(); } } // Função para mascarar Telefone 9999-9999 // Criado por: Eduardo Y. Palomba (eduardo@linkecerebro.com.br) // Criado em : 25 de abril de 2003 - 11h40 function mascara_FONEFAX(Campo, teclapres){ var tecla = teclapres.keyCode; var vr = new String(Campo.value); vr = vr.replace(".", ""); vr = vr.replace(".", ""); vr = vr.replace("/", ""); vr = vr.replace("-", ""); tam = vr.length + 1 ; if (tam > 4) Campo.value = vr.substr(0, 4) + '-' + vr.substr(4, tam); } function mascara_DDDFONEFAX(Campo, evt) { var tecla; if (evt.keyCode) tecla = evt.keyCode; else tecla = evt.which; var vr = new String(Campo.value); vr = vr.replace(".", ""); vr = vr.replace(".", ""); vr = vr.replace("/", ""); vr = vr.replace("-", ""); vr = vr.replace("(", ""); vr = vr.replace(")", ""); tam = vr.length + 1; if (tam > 2 && tam < 4) Campo.value = '(' + vr.substr(0, tam) + ')'; if (tam > 6 && tam < 8) { Campo.value = '(' + vr.substr(0, 2) + ')' + vr.substr(2, 4) + '-' + vr.substr(6,tam -6); } } function mascara_DATA(Campo, evt){ var tecla; if (evt.keyCode) tecla = evt.keyCode; else tecla = evt.which; var vr = new String(Campo.value); vr = vr.replace(".", ""); vr = vr.replace("/", ""); vr = vr.replace("-", ""); tam = vr.length + 1; if (tecla != 9 && tecla != 8){ if (tam > 2 && tam < 4) Campo.value = vr.substr(0, 2) + '/' + vr.substr(3, tam); if (tam > 4 && tam < 11) Campo.value = vr.substr(0,2) + '/' + vr.substr(2,2) + '/' + vr.substr(5,tam-4); } } function montaFlash(movie, width, height, wmode, FlashVars){ var swf = '' + '' + '<\/embed>' + '<\/object>'; document.write(swf); } function SelArqBI(Formulario,Campo,Diretorio,TipoArqUpl,BotaoVer) { dist_top = parseInt((window.screen.availHeight - 150) / 2); dist_left = parseInt((window.screen.availWidth - 300) / 2); window.open('/modulos/include/modulo_oficina/dialog/newarq.asp?Formulario=' + Formulario + '&Campo=' + Campo + '&Diretorio=' + Diretorio + '&TipoArqUpl=' + TipoArqUpl + '&BotaoVer=' + BotaoVer, 'SelArq', 'top=' + dist_top + ',left=' + dist_left + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=300,height=150') return false; }