$(function(){

    if ( jQuery.fn.fancybox ){
        $('.fancybox').fancybox();
    }

    var letters = {
        'russian': {
            'lower': 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя',
            'upper': 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'
        }
    }

    $(document).ready(function(){
        $('ol.russian').each(function() {
            var characters = $(this).attr("data-characters")
            $('> li', this).each(function(index, element) {
                number = characters.charAt(index);
                $(this).attr('data-letter', number);
            });
        });

        $('ol.russian-1').each(function() {
            var characters = $(this).attr("data-characters")
            $('> li', this).each(function(index, element) {
                number = characters.charAt(index);
                $(this).attr('data-letter', number);
            });
        });
    });

    $(".e-list-counter-green").each(function () {
        var classes = $(this).attr('class').split(' ');
        //console.log(classes);
        var reset_value = classes[1].split('-');
        //console.log(reset_value);
        if(reset_value[3] > 8 && reset_value[3] < 99){
            $(this).find("li").css("padding-left", "60px");
        }else if(reset_value[3] > 98){
            $(this).find("li").css("padding-left", "70px");
        }
        $(this).find("li").css("counter-reset", "item "+reset_value[3]);
    });

    $(".e-list-counter-red").each(function () {
        var classes = $(this).attr('class').split(' ');
        //console.log(classes);
        var reset_value = classes[1].split('-');
        //console.log(reset_value);
        if(reset_value[3] > 8 && reset_value[3] < 99){
            $(this).find("li").css("padding-left", "50px");
        }else if(reset_value[3] > 98){
            $(this).find("li").css("padding-left", "60px");
        }
        $(this).find("li").css("counter-reset", "item "+reset_value[3]);
    });

});