function toggle(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}


new function() {
    var Public = {
             'auto': function( bool ) {
                         return bool != undefined ? Private.auto = bool
                                                  : Private.auto;
                     },
             'init': function() {
                         return Private.init();
                     },

        // Perform the 'widont' transformation on a given string.
        'transform': function( string ) {
                         return Private.widont( string );
                     }
    };
    $.jqwidont = Public;
    var Private = {
            'auto': true,
            'init': init,

        // Add a non-breaking space between the last two words of a given
        // string.
          'widont': widont,

        // Regular expression for use later in the plugin.
          'regexp': new RegExp(
                        '[\\n\\r\\s]+'            // whitespace/newlines
                      + '('                       // capture...
                      + '[^\\n\\r\\s(?:&#160;)]+' // non-whitespace/newlines
                      + '[\\n\\r\\s]*'            // trailing whitespace
                      + ')$'                      // ...to end of the string

                        , 'm' // match across newlines
                    )
    };

    $(document).ready(function() {
        if( Private.auto ) init();
    });

    function init() {
        // Use the plugin on all <h*> elements in the page..
        $( 'h1,h2,h3,h4,h5,h6' ).widont();
    };

    $.fn.widont = function() {
        return $(this).each(function() {
            var $obj = $(this);

            $obj.html( Private.widont( $obj.html() ) );
        });
    };

    function widont( string ) {
        return string.replace( Private.regexp, "&#160;$1" );
    };
}();
