var origem_aplicar_filtro = false;

function marcar_todos(tipo){
   form = document.forms[ 'formulario' ]; 
   for( var i=0; i < form.elements.length; i++ ){
      if (form.elements[i].type == 'checkbox') {
         if (tipo == 'M') {
            form.elements[i].checked = true;
         }
         if (tipo == 'D') {
            form.elements[i].checked = false;
         }
         if (tipo == 'I') {
            form.elements[i].checked = !form.elements[i].checked;
         }
      }
   }
}

function validar_itens() {
   result = true;
//   if ( !origem_aplicar_filtro ) {
      result = verificar_item_selecionado( 'chk_item[]' ); 
      if ( !result ) {
         alert( 'Favor selecionar pelo menos um item' );
      }
  // }
   return result;   
}

function verificar_item_selecionado( nome_itens ) {
   form   = document.forms[ 'formulario' ]; 
   i      = 0;
   result = false;
   while( !result && i < form.elements.length ) {
     if ((form.elements[i].type == 'checkbox') && (form.elements[i].name == nome_itens )) {
        result = form.elements[i].checked;
     }
     i++;
   }
   return result;        
}	
		       
//$(function(){
//	$('ul.jd_menu').jdMenu({onShow: loadMenu, 
//	                                 onHide: unloadMenu, 
//	                                 offset: 0, 
//	                                 onAnimate: onAnimate}); 
//	var sobre = $('#sobre_janela')[0];                                 
//   $('#sobre_acesso').click( function () {
//      $.blockUI( sobre, { width: '200px' } );   
//   }); 
//   $('#sobre_fechar').click( $.unblockUI );    
//   $("input").focus(function(){
//      $(this).css('background', '#F8FBD2');
//   });  
//   $("input").blur(function(){
//      $(this).css('background', 'white');
//   });  
//   $("textarea").focus(function(){
//      $(this).css('background', '#F8FBD2');
//   });  
//   $("textarea").blur(function(){
//      $(this).css('background', 'white');
//   });
//   $("select").focus(function(){
//      $(this).css('background', '#F8FBD2');
//   });  
//   $("select").blur(function(){
//      $(this).css('background', 'white');
//   });
//   if ( $('input:visible').get(0) ) {
//      $('input:visible').get(0).focus();      
//   }       
//});
