<header>
    <h2>
        <i class="icon-wrench"></i>
        {{ PMF_LANG['ad_config_edit'] }}
   </h2>
</header>

<div id="user_message"></div>
<form class="form-horizontal" id="config_list" name="config_list"
      action="?action=config&amp;config_action=saveConfig" method="post">

    <p>
        <button class="btn btn-inverse toggleConfig" data-toggle="Main">
            <i class="icon-home icon-white"></i>
            {{ PMF_LANG['mainControlCenter'] }}
        </button>
    </p>
    <div id="configMain" class="hide"></div>

    <p>
        <button class="btn btn-inverse toggleConfig" data-toggle="Records">
            <i class="icon-th-list icon-white"></i>
            {{ PMF_LANG['recordsControlCenter'] }}
        </button>
    </p>
    <div id="configRecords" class="hide"></div>

    <p>
        <button class="btn btn-inverse toggleConfig" data-toggle="Search">
            <i class="icon-search icon-white"></i>
            {{ PMF_LANG['searchControlCenter'] }}
        </button>
    </p>
    <div id="configSearch" class="hide"></div>

    <p>
        <button class="btn btn-inverse toggleConfig" data-toggle="Security">
            <i class="icon-warning-sign icon-white"></i>
            {{ PMF_LANG['securityControlCenter'] }}
        </button>
    </p>
    <div id="configSecurity" class="hide"></div>

    <p>
        <button class="btn btn-inverse toggleConfig"  data-toggle="Spam">
            <i class="icon-thumbs-down icon-white"></i>
            {{ PMF_LANG['spamControlCenter'] }}
        </button>
    </p>
    <div id="configSpam" class="hide"></div>

    <p>
        <button class="btn btn-inverse toggleConfig" data-toggle="SocialNetworks">
            <i class="icon-retweet icon-white"></i>
            {{ PMF_LANG['socialNetworksControlCenter'] }}
        </button>
    </p>
    <div id="configSocialNetworks" class="hide"></div>

    <!--
    <p>
        <a class="btn btn-inverse" onclick="javascript:toggleConfig('Cache');">
            {{ PMF_LANG['cacheControlCenter'] }}
        </a>
    </p>
    <div id="configCache" class="hide"></div>
    -->

    <p>
        <button class="btn btn-primary" type="submit">
            {{ PMF_LANG['ad_config_save'] }}
        </button>
        <button class="btn btn-warning" type="reset">
            {{ PMF_LANG['ad_config_reset'] }}
        </button>
    </p>
</form>

<script type="text/javascript">
    toggleConfig = function (e) {
        e.preventDefault();
        var configContainer = $("#config" + $(this).data('toggle'));

        if ("hide" === configContainer.attr("class")) {
            $.get("index.php", {
                action: "ajax",
                ajax: "config_list",
                conf: $(this).data('toggle').toLowerCase()
            }, function (data) {
                configContainer.empty().append(data);
            });
            configContainer.fadeIn("slow").removeAttr("class");
        } else {
            configContainer.fadeOut("slow").attr("class", "hide").empty();
        }
    }
    $('button.toggleConfig').on('click', toggleConfig);
</script>
