
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function pula_janela(targ,selObj,restore){ //v3.0
  window.open(eval("'"+selObj.options[selObj.selectedIndex].value+"'"));
  if (restore) selObj.selectedIndex=0;
}


  if((navigator.userAgent.indexOf('Win') != -1) &&
  (navigator.userAgent.indexOf('95') != -1))
    { 
		//window.location.href="win95.html"; 
	}
  else if(navigator.userAgent.indexOf('Win') != -1)
    { 
		//window.location.href="win31.html"; 
  }
  else if(navigator.userAgent.indexOf('Mac') != -1)
    { 
		//window.location.href="mac.html"; 
  }
  else { 
	  //window.location.href="win.html"; 
  }

function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
  }

function mOut(src,clrIn) {
   if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
}

function MM_findObj(n, d)
{ 
  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 cpopreenchido(theObj,msgObj)
{
   obj=MM_findObj(theObj) ;
   if (obj.value == '' || obj.value == null || obj.value == 0)
   {
      if (obj.type=="text")
      {
         obj.select() ;
         obj.focus() ;
	  }else{
	     obj.select() ;
	   }
      alert('O preenchimento do campo ' + msgObj + ' é obrigatório.');
      return false ;
}

//**** CHECA EMAIL   
   if(obj.name == 'Email')
   {
      valoremail = obj.value;
  
      valoremail=valoremail.toLowerCase();
      if (valoremail.indexOf("@")<1 || valoremail.indexOf(".")<1)
      {
     	    alert("O campo e-mail esta preenchido incorretamente.\n"
     	    +"Favor checar o prefixo e o sinal de '@'.");
    	    obj.focus();
            obj.select();
            return false ;
      }else
       {
           if(valoremail.indexOf("@")+1 == valoremail.indexOf("."))
           {
              alert("O campo e-mail esta preenchido incorretamente.\n"
     	       +"Favor checar o prefixo e o sinal de '.'.");
     	       obj.focus();
               obj.select();
               return false ;
           }
       }
   }
//**** FIM CHECA EMAIL
   
//**** CHECA FORMATO DATA 
   if(obj.name.indexOf("data") >= 0)
   {
      var err=0;
      var psj=0;
   
      a = obj.value;
      if (a.length != 10) err=1
         b = a.substring(3, 5)// mes;
         c = a.substring(2, 3)// '/';
         d = a.substring(0, 2)// dia;
         e = a.substring(5, 6)// '/';
         f = a.substring(6, 10)// ano;

        //erros basicos
         if (b<1 || b>12) err = 1
         if (c != '/') err = 1
         if (d<1 || d>31) err = 1
         if (e != '/') err = 1
         if (f<0 || f>9999) err = 1

         //outros erros

         // meses com 30 dias
         if (b==4 || b==6 || b==9 || b==11){
            if (d==31) err=1
         }

         // fevereiro, ano com tratamento diferenciado
         if (b==2){
            // feb
	     var g=parseInt(f/4)
	     if (isNaN(g)) {
            err=1
	     }
         if (d>29) err=1
         if (d==29 && ((f/4)!=parseInt(f/4))) err=1
      }
      xdia = b + '/' + d + '/' + f
      xdata=new Date(xdia);
      xhoje = new Date();
      if (xdata>xhoje){err=1;}
       
      if (err==1){
        obj.select();
        obj.focus();
        alert('Data não é valida!! ex.: 09/11/1985');
        return false;
     }
   }

//**** CHECA FORMATO CEP
if(obj.name == 'CEP')
{
   var checkOK = "0123456789-";
   var checkStr = obj.value;
   var allValid = true;
   var decPoints = 0;
   var allNum = "";

   for (i = 0;  i < checkStr.length;  i++)
   {
      ch = checkStr.charAt(i);
      for (j = 0;  j < checkOK.length;  j++)
         if (ch == checkOK.charAt(j))
         break;
         if (j == checkOK.length)
         {
            allValid = false;
            break;
         }
         allNum += ch;
      }
    if (!allValid)
    {
       alert("'O CEP não é valido!! ex.: 01219-020'");
       obj.focus();
       return false;
    }
    else{
       txt=obj.value;
	   txt=txt.toLowerCase();
       if ((txt.indexOf("-")<5) || (txt.length < 9)){
          alert("'O CEP não é valido!! ex.: 01219-020'");
          obj.focus();
          return false;
       }
       else{return true;
       }
    }
}


}


function chkpreenchido(theObj,msgObj){
   obj=MM_findObj(theObj) ;
   checado = false;
   for(i=0;i<obj.length;i++) {
      if(obj[i].checked==true) {
          checado = true;
      }
   }
   if(checado == false){
      alert('Selecione ' + msgObj + '.');
      return false ;
   }else{return true;} 
}

function combopreenchido(theObj,msgObj){
   obj=MM_findObj(theObj) ;
   if (obj.options[obj.selectedIndex].value == "" || obj.options[obj.selectedIndex].value == null) 
      {
      alert('Selecione ' + msgObj + '.');
      obj.focus() ;
      return false ; 
      }
}

function listapreenchido(theObj,msgObj){

   obj = MM_findObj(theObj) ;
   if(obj.options.length < 1){
      alert('Selecione ' + msgObj + '.');
      obj.focus() ;
	  return false;
   }
   else{
      return true;
   }
   //
   //for(var i=0; i<obj.options.length; i++){
     // if(obj.options[i].selected && obj.options[i].value != ""){
	   //  return true;
     // }
   //}
   
   
}

function checa_campos(ncampos,ndescricao)
{
   campos = ncampos.split(";");
   descricoes = ndescricao.split(";");
   
   for (i=0; i<campos.length; i++)
   {
      obj=MM_findObj(campos[i]);
	  
	  if(obj.type == 'text' || obj.type =='hidden' || obj.type == 'textarea' )
      {
         if(cpopreenchido(campos[i],descricoes[i])==false) {return}; 
      }
	  if(obj.type == 'select-one')
	  {
	      if(combopreenchido(campos[i],descricoes[i])==false) {return};
	  }  
	  if(obj.type == 'select-multiple')
	  {
	      if(listapreenchido(campos[i],descricoes[i])==false) {return};
	  }  
   } 
   document.frmpesq.submit();
}

function preenche_campos(ncampos,nvalores)
{ 
   campos = ncampos.split(";") ;
   nvalores = nvalores.split(";") ;
   //document.forms[0].reset();
   for (i=0; i<campos.length; i++)
   {
      obj=MM_findObj(campos[i]) ;
	  if(obj){
         if(obj.type == 'text' || obj.type == 'hidden' || obj.type == 'textarea')
	     {
            obj.value = nvalores[i];
         }
	     if(obj.type == 'select-one')
	     {
	        for(j=0;j<obj.length;j++) {
			   if(obj.options[j].value == nvalores[i])
               {
                  obj.options[j].selected = true;
               }
            }
	     }
		 if(obj.type == 'checkbox')
	     {
            if(nvalores[i] == 1){obj.checked = true};
         }
	  }  
   } 
}

function vamosver(ncampos)
{
	campos = ncampos
		obj=MM_findObj(campos) ;
if (obj.value == '' || obj.value == null || obj.value == 0){
      alert('O preenchimento do campo Por que ele é o melhor motel da sua cidade? é obrigatório.');
      return false ; 
}
}

//-->

