﻿$(document).ready(function () {
    var subDivs = $('#m-subnav li');
    if (subDivs.filter('.active').length > 0)
        return;

    var bSelSub = false;
    var subnavString = Array("beautysalon", "videolist", "musiclist", "screenshots", "wallpaper", "poll", "client", 'faqlist', 'userabuse', 'security', 'regulations',
        'shop/guide_', 'shop/shop', 'intro', 'gameinfo', 'StrategyGuide', 'StrategyFAQ', 'news', 'lornapan', 'erinnwalker', 'guild'
        );
    var currentPage = location.pathname.toLowerCase();
    subDivs.each(function () {
        if (bSelSub == true) return;
        var url = $(this).find('a').attr('href').toLowerCase();
        $(this).children('div').each(function () {
            var subUrl = $(this).find('a').attr('href').toLowerCase();
            if (subUrl.indexOf(nexon.util.getQueryVariable('boardNo')) > 0) {
                $(this).addClass('active');
                bSelSub = true;
            }
        });
        if (bSelSub == true || url.indexOf(nexon.util.getQueryVariable('boardNo')) > 0) {
            $(this).addClass('active');
            bSelSub = true;
        }
    });
    if (bSelSub == false) {
        subDivs.each(function () {
            var url = $(this).find('a').attr('href').toLowerCase();
            if(url.indexOf(currentPage) > -1)
                $(this).addClass('active');
        });
    }
});





        
