<!--
function MM_findObj(n, d) { //v3.0
  var p,i,x;  
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_validateForm() { //v3.0
  var da,db,i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
 
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
   //alert(val.name);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' tem que conter um endereço de email válido.\n';
      } 
	  
	  else if (test!='R') { num = parseFloat(val);
       // alert("num"+num+" val"+val)

       
		if (val!= num) errors+='- '+nm+' tem que conter números no formato 0000.00 \n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' tem que conter um número entre '+min+' e '+max+'.\n';
    
	} } } 

        
    


	else if (test.charAt(0) == 'R') errors += '- '+nm+' é obrigatório.\n'; }
  } 
  //alert (errors)
  //if (test.indexOf('inDate') != -1) { p=test.indexOf(':');
    //      da=parseInt(test.substring(7,p)); db=parseInt(test.substring(p+1));
      //    if (da > db) errors+='- data.\n';    
//	} 
  
  if (errors) alert('Ocorreram os seguintes erros:\n\n'+errors);
  document.MM_returnValue = (errors == '');
}

function confirmacao(inform, texto)
{
	
if (confirm("tem certeza que deseja "+texto)){
window.location=inform;
}
}

function confere_data(inform)
{
if (confirm("tem certeza que deseja deletar o registro")){
window.location=inform;
}
}

function valida(inform, mensagem)
{
if (confirm(mensagem)){
window.location=inform;
}
}

function mostra(div_id)
{
document.all[div_id].style.visibility="visible"; 
}
function apaga(div_id)
{
document.all[div_id].style.visibility="hidden"; 
}

VerifiqueTAB=true;
function Mostra(quem, tammax) {
	   if ( (quem.value.length == tammax) && (VerifiqueTAB) ) {
		 var i=0,j=0, indice=-1;
		 for (i=0; i<document.forms.length; i++) {
		   for (j=0; j<document.forms[i].elements.length; j++) {
			  if (document.forms[i].elements[j].name == quem.name) {
				indice=i;
				break;
			  }
		   }
		   if (indice != -1) break;
		 }
		 for (i=0; i<=document.forms[indice].elements.length; i++) {
		   if (document.forms[indice].elements[i].name == quem.name) {
			  while ( (document.forms[indice].elements[(i+1)].type == "hidden") &&
					  (i < document.forms[indice].elements.length) ) {
				 i++;
			  }
			  document.forms[indice].elements[(i+1)].focus();
			  VerifiqueTAB=false;
			  break;
		   }
		 }
	   }
	}
function PararTAB(quem) { VerifiqueTAB=false; }
function ChecarTAB() { VerifiqueTAB=true; }

function FormataDado(campo,tammax,pos,teclapres){
	var tecla = teclapres.keyCode;
	vr = document.forms.form_acao.custo_acao.value;
	vr = vr.replace( "-", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length ;

	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

	if (tecla == 8 ){ tam = tam - 1 ; }
			
	if ( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){
	 		document.forms.form_acao.custo_acao.value = vr ;}
		if ( tam > pos && tam <= tammax ){
			document.forms.form_acao.custo_acao.value = vr.substr( 0, tam - pos ) + '.' + vr.substr( tam - pos, tam );}
	}
	//alert("campo: " + document.form[campo+1].name);
	
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
