var file_name, file_end, file_page, claimed_forum_pages, claimed_member_pages;
claimed_forum_pages = ["forumdisplay", "showthread", "private", "usercp", "modcp", "stats", "newthread", "newreply"];
claimed_member_pages = ["member"];
file_name = document.location.href;
file_end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
file_page = file_name.substring(file_name.lastIndexOf("/")+1, file_end);
file_page = file_page.replace('.php','').replace('#','');
$('body').addClass("page_" + file_page);
if (file_page == '/' || file_page == '') {
file_page = "index";
}
if ($.inArray(file_page, claimed_forum_pages) >= 0) {
$('.menu li').removeClass('active');
$(".menu").find('a[href *="index.php"]').parent("li").addClass("active");
} else if ($.inArray(file_page, claimed_member_pages) >= 0) {
$('.menu li').removeClass('active');
$(".menu").find('a[href *="memberlist.php"]').parent("li").addClass("active");
} else {
$('.logorow_menu li').removeClass('active');
$(".logorow_menu").find('a[href *="' + file_page + '.php"]').parent("li").addClass("active");
};
This is what we use to fix active tabs. It checks the URL you're currently on against links that are in the header menu, if it's not an already claimed page.