function showHide(objShowHide){
	d=document;layer="";
	if(d.getElementById)layer1=d.getElementById(objShowHide).style;
	else if(d.layers)layer1=document.layers[objShowHide];
	else return 1;
	if(layer1.display=="")layer1.display="none";
	if(layer1.display!="none")layer1.display="none";
	else layer1.display="block";
}
window.onload = (function(){
    notificacoes_request_permission();
});
notificacoes_check = function() {
    if (window.Notification) {
        return true;
    } else {
      console.log("Hum... navegador sem suporte a notificações!.");
      return false;
    }

}
notificacoes = function(title, opt) {
    if (notificacoes_check()) {
        if (window.Notification.permission != 'granted') {
            console.log('aqui');
            window.Notification.requestPermission(function(){
                new Notification(title, opt);
            });
        } else {
            new Notification(title, opt);
        }
    }

}

notificacoes_request_permission = function(callback) {
    if (notificacoes_check()) {
        if (window.Notification.permission != 'granted') {
            window.Notification.requestPermission();
        }
    }

}

function getBaseUrl() {
    return $('input[name=base_url]').val();
}
function createUrl(action, params = []) {
    var url = getBaseUrl() + '/index.php?r=' + action;
    return params.length > 0 ? url + '&'+ params.join('&') : url;
}
$(document).on('click', 'a.menu-nivel1', function() {
    $(document).find('a.menu-nivel0.no-children').removeClass('active');
    $(document).find('a.menu-nivel1').removeClass('active');
    $(this).addClass('active');
});
$(document).on('click', 'a.menu-nivel0.no-children', function() {
    $(document).find('a.menu-nivel0.no-children').removeClass('active');
    $(document).find('a.menu-nivel1').removeClass('active');
    $(this).addClass('active');
});