/**
 * Firefox 2 doesn't support inline-block, but it does have
 * a similar style named -moz-inline-stack. The problem
 * is that it doesn't wrap text properly. To fix this, we look
 * for all labels marked -moz-inline-stack and enclose the 
 * label's text with a block styled span of the same width.
 *  Ref:
 *   http://www.alistapart.com/articles/prettyaccessibleforms/
 *   http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/
 *
 * Note: every other browser is fine
 */

function ff2_inline_stack_fix()
{
    // Check for mozilla version 1.8 (Firefox 2)
    if($.browser.mozilla && $.browser.version.substr(0,3)=="1.8")
    {
        $('form label').each(function(){
            if($(this).css('display') == '-moz-inline-stack')
            {
                var labelContent = this.innerHTML;
                var labelWidth = document.defaultView.getComputedStyle(this, '').getPropertyValue('width');
                var labelSpan = document.createElement('span');
                labelSpan.style.display = 'block';
                labelSpan.style.width = labelWidth;
                labelSpan.innerHTML = labelContent;
                this.innerHTML = null;
                this.appendChild( labelSpan );
            }
        });
    }
} 

