/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

document.write('<script type="text/javascript" src="numeros.js"></script>');

function mascaraCEP(obj,event,corCampo,corLetra){
    enter=13;space=32;esc=27;del=83;backspace=8;validos='0123456789';aux='';
    if(!corCampo)corCampo='#FF0000';
    if(!corLetra)corLetra='#FFFFFF';
    if(navigator.appName.indexOf('Netscape')!=-1)tecla=event.which;
    else tecla=event.keyCode;
    if(tecla==enter)return false;
    else if(tecla==backspace)return true;
    else if(tecla==space)return false;
    else if(tecla==esc)return false;
    else if(tecla==del)return true;
    key=String.fromCharCode(tecla);
    if(validos.indexOf(key)==-1)return false;
    aux=obj.value;
    aux+=key;
    if(aux.length==5)obj.value=aux+'-';
    else if(aux.length<=9)obj.value=aux;
    return false;
}

function validaTamanhoCep(obj, corCampo, corLetra){
    if(!corCampo)corCampo='#FF0000';
    if(!corLetra)corLetra='#FFFFFF';
    if(obj.value!='' && obj.value.length<9){obj.style.backgroundColor=corCampo;obj.style.color=corLetra;obj.focus;alert('ATENÇÃO!\n\nO campo deve conter 9 caracteres com o formato 99999-999, verifique!');}
    comparacao = new Array('00000-000','11111-111','22222-222','33333-333','44444-444','55555-555','66666-666','77777-777','88888-888','99999-999');
    for(i=0;i<comparacao.length;i++){if(obj.value==comparacao[i]){obj.style.backgroundColor=corCampo;obj.style.color=corLetra;obj.focus;alert('ATENÇÃO!\n\nO campo está preenchido de forma incorreta. Este, deve conter um cep válido, verifique!');return;}}
}