var req; function NWmotor(caminho){ req = null; if (window.XMLHttpRequest){ req = new XMLHttpRequest(); req.onreadystatechange = NWinfo; req.open("GET", caminho, true); req.send(null); }else if (window.ActiveXObject){ req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = NWinfo; req.open("GET", caminho, true); req.send(); }}} function NWinfo(){ if (req.readyState == 4){ if (req.status == 200){ document.getElementById('NWlayer').innerHTML = unescape(req.responseText); document.getElementById("meu_form").reset(); document.getElementById("NWenviar").disabled=0; }else{ alert("AVISO\n\nNão foi possível efetuar o cadastro.\n\n 1) Sua conexão pode estar lenta;\n 2) Sua conexão pode estar intenrompida;\n 3) O servidor pode estar ocupado no momento;\n\nTente novamente em alguns minutos."); }}} function NWcadastrar(){ var caminho; document.getElementById("NWenviar").disabled=1; if (NWnome==1){ NWa = "&nome="+document.getElementById("NWa").value; if(document.getElementById("NWa").value.length < 3){ alert("Erro!\n\nO campo NOME deve conter mais de 3 caracteres.\nPor Favor verifique o campo novamente") document.getElementById("NWenviar").disabled=0; document.getElementById("NWa").focus(); return false;} }else{ NWa = "&nome=vazio"} if (NWnascimento==1){ NWb = "&nascimento="+document.getElementById("NWb").value; if(document.getElementById("NWb").value.length < 10){ alert("Erro!\n\nO campo NASCIMENTO deve ser preenchido.\nPor Favor verifique o campo novamente") document.getElementById("NWenviar").disabled=0; document.getElementById("NWb").focus(); return false;} }else{ NWb = "&nascimento=vazio"} if (NWsexo==1){ NWc = "&sexo="+document.getElementById("NWc").value; }else{ NWc = "&sexo=vazio"} if (NWgrupo==1){ NWd = "&grupo="+document.getElementById("NWd").value; }else{ NWd = "&grupo=vazio"} if(document.getElementById("NWemail").value.indexOf('@')==-1 || document.getElementById("NWemail").value.indexOf('.')==-1 || document.getElementById("NWemail").value.length < 8){ alert("Erro!\n\nO campo EMAIL está vazio ou incorreto\nPor Favor verifique o campo novamente") document.getElementById("NWenviar").disabled=0; document.getElementById("NWemail").focus(); return false;} caminho = "./news.asp?op=cadastrar"+NWa+NWb+NWc+NWd+"&email="+document.getElementById("NWemail").value; NWmotor(caminho); return false;} //MÁSCARA DE VALORES function txtBoxFormat(objeto, sMask, evtKeyPress) { var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla; if(document.all){ nTecla = evtKeyPress.keyCode; }else if(document.layers){ nTecla = evtKeyPress.which; }else{ nTecla = evtKeyPress.which; if (nTecla == 8){ return true;}} sValue = objeto.value; sValue = sValue.toString().replace( "-", "" ); sValue = sValue.toString().replace( "-", "" ); sValue = sValue.toString().replace( ".", "" ); sValue = sValue.toString().replace( ".", "" ); sValue = sValue.toString().replace( "/", "" ); sValue = sValue.toString().replace( "/", "" ); sValue = sValue.toString().replace( ":", "" ); sValue = sValue.toString().replace( ":", "" ); sValue = sValue.toString().replace( "(", "" ); sValue = sValue.toString().replace( "(", "" ); sValue = sValue.toString().replace( ")", "" ); sValue = sValue.toString().replace( ")", "" ); sValue = sValue.toString().replace( " ", "" ); sValue = sValue.toString().replace( " ", "" ); fldLen = sValue.length; mskLen = sMask.length; i = 0; nCount = 0; sCod = ""; mskLen = fldLen; while (i <= mskLen) { bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":")) bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " ")) if (bolMask) { sCod += sMask.charAt(i); mskLen++; } else { sCod += sValue.charAt(nCount); nCount++;} i++;} objeto.value = sCod; if (nTecla != 8){ if (sMask.charAt(i-1) == "9"){ return ((nTecla > 47) && (nTecla < 58));} else{ return true;}} else{ return true;}}