Wrapping a JavaScript "class" w/ out self execution?
<p>Wrapping a JavaScript "class"?</p>

<p>Below is a simple "class" for displaying messages.  It stores the output HTML div and then displays messages to it as needed.  </p>

<p>It works fine.  For readability, and encapsulation purposes, I'd like the components of the "class" in a container of sorts or a JavaScript object?  What is the simplest way to to do this.</p>

<p>Or...is there a simple way to do this?</p>

<p>Currently the only container is the comments I've surrounded the code with.</p>

<pre><code>/**
 *      Module  :       Model
 *      Name    :       -Message
 *      Input   :       div via the constructor
                        message type via display
 *      Output  :       TextStream via display to Control.sendInner
 *      Notes   :       Symmetric, client holds message location so needs extra variable
 */

var Message = function( div ) 
{
    this.div = document.getElementById( div ); 
};

Message.prototype.messages = 
{ 
    name:       'Please enter a valid name',
    email:      'Please enter a valid email',
    pass:       'Please enter passoword, 6-40 characters',
    url:        'Pleae enter a valid url',
    title:      'Pleae enter a valid title',
    tweet:      'Please enter a valid tweet',
    empty:      'Please complete all fields',
    empty_bm:   'Please complete all fields',
    same:       'Please make emails equal',
    taken:      'Sorry, that email is taken',
    validate:   'Please contact &lt;a class="d" href="mailto:support@.com"&gt;support&lt;/a&gt; to reset your password'
};

Message.prototype.display = function( type ) 
{
    Control.sendInner( this.div, this.messages[type] ) 
};      


/**      Message End        */
</code></pre>
