
IB.fluid.apply = function()
{
    IB.fullWidth = $(document).width();

    /*
    
    COMMON RESIZE STUFF
    
    
    */
    
    
    /* CURRENT PAGE RESIZE STUFF */
    if(IB[IB.pageName[0]] && IB[IB.pageName[0]]['fluid']['apply'])
    {
        IB[IB.pageName[0]].fluid.apply();
    }
    IB.fluid.add();
    
    IB.fluid.footer();
    
    IB.lastFullWidth = IB.fullWidth;

};


IB.fluid.footer = function()
{
    var f = $.e.div_footer.css('margin-top', '20px');
    
    var totalHeight = $(window).height();
    
    var contentHeight = $.e.container.height();

    if(totalHeight > contentHeight)
    {
        var mt = totalHeight - contentHeight - f.height() - $.e.div_header.height() - 61;

        if(mt < 20) mt = 20;

        f.css('margin-top', mt+'px');
    }
};



/*
this allow to add a "name.fluid.js" to page with another name
ex: activity.js is automaticaly apply to activity page (#activity/all) but not user activity (#user/activity)
*/
IB.fluid.add = function()
{    
    var add = false, add2 = false;
    
    
    if(IB.pageName[1] === 'translate')
    {
        add = 'translate';
    }


    if(add)
    {
        IB.fluid.bind(add);
    }
    if(add2)
    {
        IB.fluid.bind(add2);
    }
};

IB.fluid.bind = function(n)
{
    IB[n].fluid.init().apply();
};
