function activateMenu(url, activated) {
    var activePage = stripTrailingSlash(url);
    $('.sidebar-menu li a, ul.navbar-nav li a').each(function () {
        var currentPage = stripTrailingSlash($(this).attr('href'));
        //console.log("activePage:" + activePage +" currentPage:" + currentPage);
        if (activePage == currentPage) {
            $(this).parent().addClass('active');
            if (isMobile() && $('#enableMobileHeader').length) {
                createMobileHeader($(this).html());
            }
            activated = true;
        } else {
            $(this).parent().removeClass('active');
        }
    });

    //submenus
    $('.sidebar-menu li ul a').each(function () {
        var currentPage = stripTrailingSlash($(this).attr('href'));
        //console.log("sub-activePage:" + activePage +" sub-currentPage:" + currentPage);
        if (activePage == currentPage) {
            $(this).parentsUntil("ul.sidebar-menu", "li.treeview").each(function () {
                $(this).addClass('active');
            });
            activated = true;
        }
    });

    if (!isLayoutTop() && !activated && localStorage.getItem("activatedMenuUrl")) {
        //if not activated set latest activated url
        activateMenu(localStorage.getItem("activatedMenuUrl"), true);
    } else {
        saveCurrentActivatedUrl(url);
    }

}
/* set active style in menu based on current url */
set active style in menu based on current url
set active style in menu based on current url
function activateMenu(url, activated) {
    var activePage = stripTrailingSlash(url);
    $('.sidebar-menu li a, ul.navbar-nav li a').each(function () {
        var currentPage = stripTrailingSlash($(this).attr('href'));
        if (activePage == currentPage) {
            $(this).parent().addClass('active');
            if (isMobile() && $('#enableMobileHeader').length) {
                createMobileHeader($(this).html());
            }
            activated = true;
        } else {
            $(this).parent().removeClass('active');
        }
    });
    $('.sidebar-menu li ul a').each(function () {
        var currentPage = stripTrailingSlash($(this).attr('href'));
        if (activePage == currentPage) {
            $(this).parentsUntil("ul.sidebar-menu", "li.treeview").each(function () {
                $(this).addClass('active');
            });
            activated = true;
        }
    });
    if (!isLayoutTop() && !activated && localStorage.getItem("activatedMenuUrl")) {
        activateMenu(localStorage.getItem("activatedMenuUrl"), true);
    } else {
        saveCurrentActivatedUrl(url);
    }
}
function activateMenu ( url , activated ) { var activePage = stripTrailingSlash ( url ) ; $ ( '.sidebar-menu li a, ul.navbar-nav li a' ) . each ( function ( ) { var currentPage = stripTrailingSlash ( $ ( this ) . attr ( 'href' ) ) ; if ( activePage == currentPage ) { $ ( this ) . parent ( ) . addClass ( 'active' ) ; if ( isMobile ( ) && $ ( '#enableMobileHeader' ) . length ) { createMobileHeader ( $ ( this ) . html ( ) ) ; } activated = true ; } else { $ ( this ) . parent ( ) . removeClass ( 'active' ) ; } } ) ; $ ( '.sidebar-menu li ul a' ) . each ( function ( ) { var currentPage = stripTrailingSlash ( $ ( this ) . attr ( 'href' ) ) ; if ( activePage == currentPage ) { $ ( this ) . parentsUntil ( "ul.sidebar-menu" , "li.treeview" ) . each ( function ( ) { $ ( this ) . addClass ( 'active' ) ; } ) ; activated = true ; } } ) ; if ( ! isLayoutTop ( ) && ! activated && localStorage . getItem ( "activatedMenuUrl" ) ) { activateMenu ( localStorage . getItem ( "activatedMenuUrl" ) , true ) ; } else { saveCurrentActivatedUrl ( url ) ; } }
set active style in menu based on current url
set active style in menu based on current url
//console.log("activePage:" + activePage +" currentPage:" + currentPage); //submenus //console.log("sub-activePage:" + activePage +" sub-currentPage:" + currentPage); //if not activated set latest activated url