<!--
w_erro=0;
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}
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
			return true;
		else
			{
				if ((tecla != 8) && (tecla != 44))
					event.keyCode = 0;
					//return false;
				else
					return true;
			}
}

function valida_nome(msg,campo)
	{if (campo.value=="")
		       {alert("O Campo " + msg + " tem que ser preenchido");
			w_erro = w_erro + 1;}}

function inscrever()
{
	document.formulario.novo.value = 1;				
	document.formulario.operacao.value="ok";
	document.formulario.submit();
}
function acessar()
{
	w_erro=0;
	valida_nome('UserName',document.formulario.username);
	if (document.formulario.senha.value == "")
	{
	 alert("Se você já está cadastrado, informe sua `SENHA`. Se não, informe `Quero me Cadastrar`");
	 w_erro = w_erro + 1;
	}	
	if (w_erro==0)
	{
		document.formulario.novo.value = 0;
		document.formulario.operacao.value="ok";
		document.formulario.submit();
	 }
}
function valida_email(msg,campo) {
   if (campo.value != "" && campo.value != " "){
       if (campo.value.search("@") == -1 || campo.value.search("[.*]") == -1){ 
           alert("O preenchimento do campo << " + msg + " >> está incorreto!"); 
           campo.focus(); 
           w_erro = w_erro + 1;
       }
   }
}         	
function valida_input(msg,campo,maximo){
	 w_cont=0;
         for (i=0;i<maximo;i++){
              if (campo[i].checked){
 		 w_cont = w_cont + 1; 	              	
              	  }
         }	  	
	if (w_cont==0){
         	alert("A " + msg + " tem que ser preenchida");
        	w_erro = w_erro + 1;}
        }
function isNUMB(c) 
 { 
 if((cx=c.indexOf(","))!=-1) 
  { 
  c = c.substring(0,cx)+"."+c.substring(cx+1); 
  } 
 if((parseFloat(c) / c != 1)) 
  { 
  if(parseFloat(c) * c == 0) 
   { 
   return(1); 
   } 
  else 
   { 
   return(0); 
   } 
  } 
 else 
  { 
  return(1); 
  } 
 } 

function LIMP(c) 
 { 
 while((cx=c.indexOf("-"))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 while((cx=c.indexOf("/"))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 while((cx=c.indexOf(","))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 while((cx=c.indexOf("."))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 while((cx=c.indexOf("("))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 while((cx=c.indexOf(")"))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 while((cx=c.indexOf(" "))!=-1) 
  { 
  c = c.substring(0,cx)+c.substring(cx+1); 
  } 
 return(c); 
 } 

function carregar()
{
	var url;
	url = 'cidades.php?uf='+document.formulario.UF[document.formulario.UF.selectedIndex].value;
	document.formulario.cidade.options.length = 0;
	addItem(document.formulario.cidade,"Aguarde...carregando","",false,document.formulario.cidade.length)
	myIframe.location = url;
	document.formulario.cidade.focus();
}

function inicia(){
local = new Array();
var maximo, i, campo;
local = myIframe.a;
campo = document.formulario.cidade;
local = myIframe.a;
maximo = local.length;
document.formulario.cidade.options.length = 0;
for (i=0;i<maximo;i++){
  addItem(campo,local[i][1],local[i][0],false,campo.length);
}
}
function addItem(obj,strText,strValue,blSel,intPos){ 
     var newOpt,i,ArTemp,selIndex; 
     selIndex = (blSel)?intPos:obj.selectedIndex; 
     newOpt = new Option(strText,strValue); 
     Len = obj.options.length+1 
     if (intPos > Len) return 
     obj.options.length = Len 
     if (intPos != Len) { 
          ArTemp = new Array(); 
          for(i=intPos;i<obj.options.length-1;i++) 
               ArTemp[i] = Array(obj.options[i].text,obj.options[i].value); 
          for(i=intPos+1;i<Len;i++) 
               obj.options[i] = new Option(ArTemp[i-1][0],ArTemp[i-1][1]); 
     } 
     obj.options[intPos] = newOpt; 
     if (selIndex > intPos) 
          obj.selectedIndex = selIndex+1; 
     else if (selIndex == intPos)  
          obj.selectedIndex = intPos; 
} 
    function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
      var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

      if(document.all) { // Internet Explorer
        nTecla = evtKeyPress.keyCode; }
      else if(document.layers) { // Nestcape
        nTecla = evtKeyPress.which;
      }
      sValue = objForm[strField].value;

      // Limpa todos os caracteres de formatação que
      // já estiverem no campo.
      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) == "/"))
        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++;
      }

      objForm[strField].value = sCod;

      if (nTecla != 8) { // backspace
        if (sMask.charAt(i-1) == "9") { // apenas números...
          return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
        else { // qualquer caracter...
          return true;
        } }
      else {
        return true;
      }
    }
function populate(selectIndex,year,month,day) {
 timeA = new Date(year.options[year.selectedIndex].text, month.options[month.selectedIndex].value,1);
 timeDifference = timeA - 86400000;
 timeB = new Date(timeDifference);
 var daysInMonth = timeB.getDate();
 for (var i = 0; i < day.length; i++) {
 day.options[0] = null;
 }
 for (var i = 0; i < daysInMonth; i++) {
 day.options[i] = new Option(i+1);
 if (day.options[i].text < 10){
 day.options[i].text= "0" + day.options[i].text;
 }
 day.options[i].value = day.options[i].text;
 }
 day.options[0].selected = true;
}
//----