/**
 * Wrapper object for all moreLink functionality.
 * I did this to ensure no collisions with future addons
 * (function names like getObj are common!).
 */
var moreLink = 
{

    /**
     * Get an element via it's ID
     *
     * @param string The ID of the element you want to fetch
     *
     * @return Returns null on error, and the element object with success
     */
    getObj: function(id)
    {
        var obj = null;

        if(document.getElementById)
            obj = document.getElementById(id);
        else if(document.all)
            obj = document.all[id];
        else if(document.layers)
            obj = document.layers[id];

        return obj;
    },




    
    /**
     * Turn off the displaying of an element (hide it)
     *
     * @param object Element to hide
     */
    displayOff: function(elm)
    {
        elm.style.display = 'none';
    },





    /**
     * Turn on the displaying of an element (show it)
     *
     * @param object Element to show
     */
    displayOn: function(elm)
    {
        elm.style.display = '';
    },
    




    /**
     * Toggle between showing more or less of the post
     *
     * @param integer   The post number on the page (used with ID's)
     * @param string    The action to do; 'more' or 'less', defaults to 'more'.
     *
     * @return True on success, false on failure
     */
    link: function(link_num, action, moreContentOnDisplay)
    {
        var moreAnchor  = moreLink.getObj('more_anchor_' + link_num);
        var moreContent = moreLink.getObj('more_content_' + link_num);

        if(!moreAnchor || !moreContent)
            return false;

        if(!moreContentOnDisplay)
            moreContentOnDisplay = 'inline';

        if(!action || action == 'more')
        {
            moreAnchor.style.display    = 'none';
            moreContent.style.display   = moreContentOnDisplay;
        }

        else
        {
            moreAnchor.style.display    = '';
            moreContent.style.display   = 'none';
        }

        return true;
    }
};
