std.fontSize = function(gloValue)
{
    var gloMaxLevel = 3;
    var gloFontLevel = gloValue;
    
    function fontSizeChange(object, update)
    {
        $(object).each(function()
        {
            var minFontSize = parseInt($(this).data('min-font-size'));
            var maxFontSize = parseInt($(this).attr('class').replace('maxF',''));

            if(!maxFontSize) {
                classes = $(this).attr('class').split(" ");

                for (var i=1; i<classes.length; i++){
                   if(classes[i].match("^maxF")) {
                       maxFontSize = parseInt(classes[i].replace('maxF',''));
                   }
                }
            }
            
            if (gloFontLevel > gloMaxLevel)
                gloFontLevel = gloMaxLevel;
                
            if (gloFontLevel < 0)
                gloFontLevel = 0;
                
            $(this).css('font-size', minFontSize + (gloFontLevel/gloMaxLevel)*(maxFontSize - minFontSize));
        });
        
        if (update)
        $.ajax({
            url: '/pages_actions/users.set_system_data.php',
            data: {'variable': 'font_level', 'value': gloFontLevel},
            dataType: 'json',
            method: 'post',
            success: function()
            {
            }
        });
    }
    
    $('[class*=maxF]').each(function()
    {
        $(this).data('min-font-size', $(this).css('font-size'));
    });
    
    $('#increase').click(function(ev)
    {
        ev.preventDefault();
        
        if (gloFontLevel < gloMaxLevel)
        {
            gloFontLevel++;
            fontSizeChange($('[class*=maxF]'), true);
        }
    });

    $('#reset').click(function(ev)
    {
        ev.preventDefault();        
        
        if (gloFontLevel != 0)
        {
            gloFontLevel = 0;
            fontSizeChange($('[class*=maxF]'), true);
        }
    });

    $('#decrease').click(function(ev)
    {
        ev.preventDefault();
        
        if (gloFontLevel > 0)
        {
            gloFontLevel--;
            fontSizeChange($('[class*=maxF]'), true);
        }
    });
    
    if (gloValue > 0)
        fontSizeChange($('[class*=maxF]'), false);
}

