
	
function getScrollTop() {
    if (document.documentElement && !document.documentElement.scrollTop)
    {
      // IE6 +4.01 but no scrolling going on
      return parseInt($('#comexframe',top.document.body).offset().top);
    }
    else if (document.documentElement && document.documentElement.scrollTop)
    {
      // IE6 +4.01 and user has scrolled
      return document.documentElement.scrollTop;
    }
    else if (document.body && document.body.scrollTop)
    {
      // IE5 or DTD 3.2
      return document.body.scrollTop;
    }
} 

function mostraTitle(obj,evt, txt) {
    
    if($.trim(txt)=="") return false;
    divT = document.getElementById('divTitleList');
    divT.style.top = (parseInt(evt.clientY)+getScrollTop())+'px';
    
    posicao = parseInt(evt.clientX) + 10;

    divT.style.left = posicao+'px'; 
    divT.innerHTML = txt;
    divT.style.display = '';
}
	
function escondeTitle(){
    divT = document.getElementById('divTitleList');
    divT.style.display = 'none';
}

function mostraTitleBebida(obj,evt, txt) {
    
    if($.trim(txt)=="") return false;
    divT = document.getElementById('divTitleBebida');
    divT.style.top = (parseInt(evt.clientY)+getScrollTop()-15)+'px';
    
    posicao = parseInt(evt.clientX) - 260;

    divT.style.left = posicao+'px'; 
    divT.innerHTML = txt;
    divT.style.display = '';
}
	
function escondeTitleBebida(){
    divT = document.getElementById('divTitleBebida');
    divT.style.display = 'none';
}

function remove_item(id_del){
    
    if(confirm('Deseja realmente excluir esse item?')){
        formulario = document.formPaginacao;
        formulario.totporpagina.value = 50;
        formulario.id_del.value = id_del;
        var teste = formulario.strids.value;
        formulario.strids.value = teste.replace(id_del+"¿","");
        formulario.submit();
    }

}




$(function() {
    $('#ipt_principal').click(function() {
        if ($(this).attr('checked')) {
            $('.caixaBox').attr('checked', true);
        } else {
            $('.caixaBox').attr('checked', false);
        }
    });
});

	
function customizaLote() {
      var grupo = document.getElementsByTagName('input');   
      var i = 0;
      var ids = '';
       
      while (i < grupo.length) {          
         
         if ((grupo[i].getAttribute('type') == 'checkbox')){                 
             if (grupo[i].checked == true) {                        
                 ids += grupo[i].value+',';               
             }          
         }        
         
         i++;
      }
		  
      if( ids != ''  ){
         
         ids = ids.substring(0, (ids.length - 1));
         document.getElementById('ids_lote').value = ids;
         return true;
      
      }else{
        
        alert('Selecione os itens que deseja configurar!');							
        return false;

      }

      return false;
}
