$(function () {
    // Lista dyscyplin sportowych.
    var $sportList = $('#sportList');

    if ($sportList.length > 0) {
        $sportList.dataTable({
            ordering: false,
            searching: false,
            paging: false,
            info: false,
            language: {
                url: language,
            }
        });
    }

    // Lista sezonów.
    var $seasonList = $('#seasonList');

    if ($seasonList.length > 0) {
        $seasonList.dataTable({
            ordering: false,
            searching: false,
            paging: false,
            info: false,
            language: {
                url: language,
            }
        });
    }

    // Lista gmin.
    var $communeList = $('#communeList');

    if ($communeList.length > 0) {
        $communeList.dataTable({
            ordering: false,
            searching: false,
            paging: false,
            info: false,
            language: {
                url: language,
            }
        });
    }

    // Lista szkół.
    var $schoolList = $('#schoolList');

    if ($schoolList.length > 0) {
        $schoolList.dataTable({
            ordering: false,
            searching: false,
            paging: false,
            info: false,
            language: {
                url: language,
            }
        });
    }

    // Lista rankingowa.
    var $scoreList = $('#scoreList');

    if ($scoreList.length > 0) {
        $scoreList.dataTable({
            ordering: false,
            searching: false,
            paging: false,
            info: false,
            language: {
                url: language,
            }
        });

        $('.show-sports').click(function (e) {
            e.preventDefault();

            $(this).find('i').toggleClass('icon-down-open-3').toggleClass('icon-up-open-3');

            $(this).closest('div').next().slideToggle();
        });
    }
});