// useful functions
function updateLayout(){
    //var winHeight = $(window).height();
    var winWidth = $(window).width();
    
    if ( winWidth >= 1200 )
        $("body").addClass('wide');
    else 
        $("body").removeClass('wide');
}

function fixDottedLists(){
    
    // fix red lists
    $(".dotted-list").each( function(){
        
        var listWidth = $(this).outerWidth();
        
        $(this).find("li").each( function(){
            
            var label = $(this).children("label");
            var value = $(this).children(".value");
            var dots =  $(this).children(".dots");

            var dotsWidth = listWidth - ( label.outerWidth() + value.outerWidth() ) - 5;
            dots.css( 'width', dotsWidth );
            
        });
        
    });
    
    // fix gray lists
    $(".gray-dotted-list").each( function(){
        
        var listWidth = $(this).outerWidth();
        
        $(this).find("li").each( function(){
            
            var label = $(this).children("label");
            var value = $(this).children(".menu");
            var dots =  $(this).children(".gray-dots");

            var dotsWidth = listWidth - ( label.outerWidth() + value.outerWidth() ) - 5;
            dots.css( 'width', dotsWidth );
            
        });
        
    });

}

$(function() {
  updateLayout();
});

$(window).load(function() {
    
    // fix dotted lists
    fixDottedLists();
    
    // keep it correct ...
    $(window).bind( "resize", updateLayout );
    
});

