
//  **************************************************************************
//  SITE/ISSUES/ISSUES.JS
//  (C) 2007 Peter Newman
//  **************************************************************************

// ===========================================================================
// issues_webos_window_object
// ===========================================================================

var issues_webos_window_object ;

// ===========================================================================
// ISSUES_create_new
// ===========================================================================

function ISSUES_create_new() {

    // -----------------------------------------------------------------------
    // Called when the "create new issue" link on the "List All Issues"
    // page is clicked:-
    //
    //  +------------------------------------------------------------------------+
    //  | Home ISSUES Polls Forums Elected Bodies Service Organisations Laws ... |
    //  | Table of Contents     first last  previous next          Documentation |
    //  |                                                                        |
    //  | All   Created By You   Created By Others   Contributed To By You   ... |
    //  | A to Z   Z to A   Newest to Oldest   Oldest to Newest                  |
    //  | + - - - - - - - - -+         THIS                                      |
    //  | | create new issue |  <<<=== LINK        expand                  theme |
    //  | + - - - - - - - - -+         CLICKED                                   |
    //  |                                                                        |
    //  |         Title              Date/Time Placed Online          Created By |
    //  | ----------------------  ----------------------------------  ---------- |
    //  | Another Test Issue       Fri 17 Aug 2007  10:25 (10:25am)      wottle  |
    //  | Just Another Issue       Fri 17 Aug 2007  10:27 (10:27am)      wottle  |
    //  | Banana 56 12 78          Fri 17 Aug 2007  10:28 (10:28am)      wottle  |
    //  | ...                                     ...                      ...   |
    // ...                                                                      ...
    //  +------------------------------------------------------------------------+
    //
    // Pops-up the "Create New Issue..." window:-
    //
    //      +---------------------------------------------------------------+
    //      |  Create New Issue...                         maximise  other  |
    //      +---------------------------------------------------------------+
    //      |                                                               |
    //      |               C r e a t e    N e w    I s s u e               |
    //      |               C r e a t e    N e w    I s s u e               |
    //      |               C r e a t e    N e w    I s s u e               |
    //      |                                                               |
    //      |   To create a new Issue, just fill in and submit the form     |
    //      |   below...                                                    |
    //      |                                                               |
    //      |      * Title  ___________________________________             |
    //      |                                                               |
    //      |     Synopsis  ______________________________________________  |
    //      |               ______________________________________________  |
    //      |                                                               |
    //      |  Description  ______________________________________________  |
    //      |               ______________________________________________  |
    //      |               ______________________________________________  |
    //      |               ______________________________________________  |
    //      |                                                               |
    //      |               +--------+  +-------+                           |
    //      |               | Submit |  | Clear |                           |
    //      |               +--------+  +-------+                           |
    //      |               * denotes required field                        |
    //      |                                                               |
    //      +---------------------------------------------------------------+
    //      |                        Cancel/Close                           |
    //      +---------------------------------------------------------------+
    //
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // The window's NOT ready yet...
    // -----------------------------------------------------------------------

//  ISSUES__question_window_ready = false ;

    // -----------------------------------------------------------------------
    // Open the "Create New Issue" window...
    // -----------------------------------------------------------------------

    issues_webos_window_object = new wos1_WebOS_Window( {
        width               :   '90%'                                           ,
        height              :   '90%'                                           ,
        title               :   'Create New Issue...'                           ,
        document_url        :   get_url__for_target( 'issue_create' )           ,
        control_buttons     :   '#o'                                ,
        status_bar_buttons  :   [   {   title           :   'Cancel/Close'                  ,
                                        id              :   'issue_cancel_close_button'     ,
                                        onclick         :   function(e) {
                                                                ISSUE__question_close('issue_create');
                                                                }
                                        } ,
                                    {   title           :   'OK'                        ,
                                        id              :   'issue_ok_close_button'     ,
                                        onclick_close   :   undefined
                                        }
                                    ]
        } ) ;

    // -----------------------------------------------------------------------
    // Hide all but the "Cancel/Close" button...
    // -----------------------------------------------------------------------

    ISSUES__select_cancel_close_button( false ) ;
        //  'false' because there's NO 'ok_refresh' button...

    // -----------------------------------------------------------------------
    // Save the original unedited form data (so that we can later
    // determine whether or not the form has been edited)...
    // -----------------------------------------------------------------------

//  ISSUE__original_form_data_saved = false ;

    // -----------------------------------------------------------------------

    ISSUE__save_original_form_data( 'issue_create' ) ;

    // -----------------------------------------------------------------------
    // The window's now READY...
    // -----------------------------------------------------------------------

//  ISSUES__question_window_ready = true ;

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUES_edit_existing
// ===========================================================================

function ISSUES_edit_existing() {

    // -----------------------------------------------------------------------
    // Called when the "edit" link on the "Show Single Issue" page
    // is clicked:-
    //
    //  +------------------------------------------------------------------------+
    //  | Home ISSUES Polls Forums Elected Bodies Service Organisations Laws ... |
    //  | Table of Contents     first last  previous next          Documentation |
    //  |                                                                        |
    //  | +--------------------------------------------------------------------+ |
    //  | |  MY ISSUE                                                          | |
    //  | +--------------------------------------------------------------------+ |
    //  | +------+  back (list all issues)  issue 1 of 42   first last prev next |
    //  | | EDIT |                                                               |
    //  | +------+  <== THIS LINK CLICKED                                        |
    //  |                                                                        |
    //  | +----------+ +-------+ +---------+ +-------+                           |
    //  | | OVERVIEW | | Links | | Surveys | | Forum | ...                       |
    //  | |          +---------------------------------------------------------+ |
    //  | |                                                                    | |
    // ...                                                                      ...
    //  | +--------------------------------------------------------------------+ |
    //  +------------------------------------------------------------------------+
    //
    // Pops-up the "Edit Issue..." window:-
    //
    //      - - - - - - -
    //      OFFLINE Issue
    //      - - - - - - -
    //      +---------------------------------------------------------------+
    //      |   Edit Issue...                                               |
    //      +---------------------------------------------------------------+
    //      | +------+ +--------------+ +--------+ +---------+              |
    //      | | Edit | | Place Online | | Delete | | History |              |
    //      | |      +----------------------------------------------------+ |
    //      | |                           ^                               | |
    //      | |                           |                               | |
    //      | |                           |                               | |
    //      | | <----------------- tab content here --------------------> | |
    //      | |                           |                               | |
    //      | |                           |                               | |
    //      | |                           v                               | |
    //      | +-----------------------------------------------------------+ |
    //      |                                                               |
    //      +---------------------------------------------------------------+
    //      |                        Cancel/Close                           |
    //      +---------------------------------------------------------------+
    //
    //      - - - - - -
    //      ONLINE Issue
    //      - - - - - -
    //      +---------------------------------------------------------------+
    //      |   Edit Issue...                                               |
    //      +---------------------------------------------------------------+
    //      | +------+ +---------+                                          |
    //      | | Edit | | History |                                          |
    //      | |      +----------------------------------------------------+ |
    //      | |                           ^                               | |
    //      | |                           |                               | |
    //      | |                           |                               | |
    //      | | <----------------- tab content here --------------------> | |
    //      | |                           |                               | |
    //      | |                           |                               | |
    //      | |                           v                               | |
    //      | +-----------------------------------------------------------+ |
    //      |                                                               |
    //      +---------------------------------------------------------------+
    //      |                        Cancel/Close                           |
    //      +---------------------------------------------------------------+
    //
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // Initialise the 'edit-action' to 'e' (= Show the "Edit' tab)...
    // -----------------------------------------------------------------------

    //  ----------------------------------------------------------------------
    //  kiwiparty__set_issue_edit_action( issue_edit_action )
    //  - - - - - - - - - - - - - - - - - - - - - - - - - - -
    //  Sets the:-
    //      COOKIE_NAME__ISSUE_EDIT_ACTION
    //
    //  cookie.
    //
    //  issue_edit_action should be either:-
    //      'e' (= Show the 'Edit' tab),
    //      'p' (= Show the 'Place On-Line' tab),
    //      'd' (= Show the 'Delete' tab), or;
    //      'h' (= Show the 'History' tab).
    //
    //  RETURNS
    //      Nothing
    //  ----------------------------------------------------------------------

    kiwiparty__set_issue_edit_action( 'e' ) ;

    // -----------------------------------------------------------------------
    // Open the "Edit Issue" window...
    // -----------------------------------------------------------------------

    issues_webos_window_object = new wos1_WebOS_Window( {
        width               :   '90%'                                           ,
        height              :   '90%'                                           ,
        title               :   'Edit Issue...'                                 ,
        document_url        :   get_url__for_target( 'issue_edit' )             ,
        control_buttons     :   '#o'                                ,
        status_bar_buttons  :   [   {   title           :   'Cancel/Close'                      ,
                                        id              :   'issue_cancel_close_button'         ,
                                        onclick         :   function(e) {
                                                                ISSUE__question_close('issue_edit');
                                                                }
                                        } ,
                                    {   title           :   'OK'                        ,
                                        id              :   'issue_ok_close_button'     ,
                                        onclick_close   :   undefined
                                        } ,
                                    {   title           :   'OK'                        ,
                                        id              :   'issue_ok_refresh_button'   ,
                                        onclick         :   function(e) {
                                                                ISSUE__refresh_the_edit_window() ;
                                                                }
                                        }
                                    ]
        } ) ;

    // -----------------------------------------------------------------------
    // Hide the OK button...
    // -----------------------------------------------------------------------

    ISSUES__select_cancel_close_button( true ) ;
        //  'true' because there IS an 'ok_refresh' button...

    // -----------------------------------------------------------------------
    // Save the original unedited form data (so that we can later
    // determine whether or not the form has been edited)...
    // -----------------------------------------------------------------------

//  ISSUE__original_form_data_saved = false ;

    // -----------------------------------------------------------------------

    ISSUE__save_original_form_data( 'issue_edit' ) ;

    // -----------------------------------------------------------------------
    // NO 'edit window refresh' is as yet required...
    // -----------------------------------------------------------------------

    ISSUE__question_edit_window_refresh_required = false ;

    // -----------------------------------------------------------------------
    //  FUTURE UPDATE!!!
    //  ----------------
    //  We could perhaps add an 'onclose' event handler to this window -
    //  that deletes the 'edit-action' cookie when the window is closed.
    //
    //  This would avoid the now unused cookie wasting bytes on
    //  subsequent server requests.
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

/*
// ===========================================================================
// ISSUES__do_once_window_ready
// ===========================================================================

var ISSUES__question_window_ready ;

// ---------------------------------------------------------------------------

function ISSUES__do_once_window_ready( script) {

    if ( ISSUES__question_window_ready ) {
        eval( script ) ;

    } else {
        setTimeout( "ISSUES__do_once_window_ready('" + script.replace( /'/g , "\\'" ) + "')" , 100 ) ;

        }

    }
*/

// ===========================================================================
// ISSUES__do_once_cancel_close_button_ready
// ===========================================================================

function ISSUES__do_once_cancel_close_button_ready(
    question_is_there_an_OK_refresh_button  ,
    script
    ) {

    // -----------------------------------------------------------------------

    var question_ready = false ;

    // -----------------------------------------------------------------------

    var target_button_element = document.getElementById( 'issue_cancel_close_button' ) ;

    if (    target_button_element
            &&
            target_button_element.style.display === 'block'
        ) {

        // -------------------------------------------------------------------

        target_button_element = document.getElementById( 'issue_ok_close_button' ) ;

        if (    target_button_element
                &&
                target_button_element.style.display === 'none'
            ) {

            // ---------------------------------------------------------------

            if ( question_is_there_an_OK_refresh_button ) {

                // -----------------------------------------------------------

                target_button_element = document.getElementById( 'issue_ok_refresh_button' ) ;

                if (    target_button_element
                        &&
                        target_button_element.style.display === 'none'
                    ) {

                    // -------------------------------------------------------

                    question_ready = true ;

                    // -------------------------------------------------------

                    }

                // -----------------------------------------------------------

            } else {

                // -----------------------------------------------------------

                question_ready = true ;

                // -----------------------------------------------------------

                }

            // ---------------------------------------------------------------

            }

        // -------------------------------------------------------------------

        }

    // -----------------------------------------------------------------------

    if ( question_ready ) {

        eval( script ) ;

    } else {

        setTimeout( 'ISSUES__do_once_cancel_close_button_ready(' +
                        question_is_there_an_OK_refresh_button +
                        ",'" + script.replace( /'/g , "\\'" ) +
                        "')" , 100 ) ;

        }

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__question_close
// ===========================================================================

function ISSUE__question_close( form_name ) {

    // -----------------------------------------------------------------------
    // ISSUE__question_edited( form_name )
    // - - - - - - - - - - - - - - - - - -
    // Returns a flag that indicates whether or not the "issue_edit" form
    // has been edited (and thus has changes that need writing to the
    // server).
    //
    // RETURNS:-
    //      undefined = ERROR (error message issued)!
    //      true      = The id="issue_edit" form HAS been edited.
    //      false     = The id="issue_edit" form HASN'T been edited.
    // -----------------------------------------------------------------------

    var question_edited  = ISSUE__question_edited( form_name ) ;

    // -----------------------------------------------------------------------

    if ( question_edited === true ) {

        if ( confirm( 'WARNING!  Issue NOT SAVED!' +
                        "\n\nThere are CHANGES to this issue which HAVEN'T BEEN SAVED!" +
                        "\n\nPress OK to DISCARD any changes (and close the window)." +
                        "\n\nPress Cancel to SAVE any changes (before closing the window)."
                        )
            ) {

            if ( confirm( "Discard Changes?\n\nARE YOU SURE?" ) ) {
                wos1__close( issues_webos_window_object ) ;
                }

            }

    } else if ( question_edited === false ) {

        wos1__close( issues_webos_window_object ) ;

        }

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUES__select_cancel_close_button
// ===========================================================================

function ISSUES__select_cancel_close_button( question_is_there_an_OK_refresh_button ) {

    ISSUE_EDIT__button_setup(
        question_is_there_an_OK_refresh_button  ,
        'block'                                 ,
        'none'                                  ,
        'none'
        ) ;

    }

// ===========================================================================
// ISSUES__select_ok_close_button
// ===========================================================================

function ISSUES__select_ok_close_button( question_is_there_an_OK_refresh_button ) {

    ISSUE_EDIT__button_setup(
        question_is_there_an_OK_refresh_button  ,
        'none'                                  ,
        'block'                                 ,
        'none'
        ) ;

    }

// ===========================================================================
// ISSUES__select_ok_refresh_button
// ===========================================================================

function ISSUES__select_ok_refresh_button() {

    ISSUE_EDIT__button_setup(
        true        ,   //  question_is_there_an_OK_refresh_button
        'none'      ,
        'none'      ,
        'block'
        ) ;

    }

// ===========================================================================
// ISSUE_EDIT__button_setup
// ===========================================================================

function ISSUE_EDIT__button_setup(
    question_is_there_an_OK_refresh_button  ,
    cancel_close_style_display              ,
    ok_close_style_display                  ,
    ok_refresh_style_display
    ) {

    // -----------------------------------------------------------------------

    var detected_in = "\n\nThis error was detected in:  'ISSUE_EDIT__button_setup().'" ;

    // -----------------------------------------------------------------------

    var target_button_element = document.getElementById( 'issue_cancel_close_button' ) ;

    if ( target_button_element ) {
        target_button_element.style.display = cancel_close_style_display ;

    } else {
        alert( "Can't find 'CancelClose' button!" + detected_in ) ;

        }

    // -----------------------------------------------------------------------

    target_button_element = document.getElementById( 'issue_ok_close_button' ) ;

    if ( target_button_element ) {
        target_button_element.style.display = ok_close_style_display ;

    } else {
        alert( "Can't find 'OK (Close)' button!" + detected_in ) ;

        }

    // -----------------------------------------------------------------------

    if ( question_is_there_an_OK_refresh_button ) {

        target_button_element = document.getElementById( 'issue_ok_refresh_button' ) ;

        if ( target_button_element ) {
            target_button_element.style.display = ok_refresh_style_display ;

        } else {
            alert( "Can't find 'OK (Refresh)' button!" + detected_in ) ;

            }

        }

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__save_original_form_data
// ===========================================================================

var ISSUE__original_title       = undefined ;
var ISSUE__original_synopsis    = undefined ;
var ISSUE__original_description = undefined ;

var ISSUE__question_cancel_save_original_form_data ;

// ---------------------------------------------------------------------------

function ISSUE__save_original_form_data( target_form_name ) {

    // -----------------------------------------------------------------------

    ISSUE__question_cancel_save_original_form_data = false ;

    // -----------------------------------------------------------------------

    ISSUE__save_original_form_data_1( target_form_name ) ;

    // -----------------------------------------------------------------------

    }

// ---------------------------------------------------------------------------

function ISSUE__save_original_form_data_1( target_form_name ) {

    // -----------------------------------------------------------------------

    if ( ISSUE__question_cancel_save_original_form_data ) {
        return ;
        }

    // -----------------------------------------------------------------------
    // webos__get_document_object(
    //      target_window_object
    //      )
    // - - - - - - - - - - - - - -
    // Utility function to return the window's document object.
    //
    // If 'target_window_object' === null (the background web page), then
    // document is returned.
    //
    // Otherwise, document object for the document in the specified Webos
    // window's IFRAME is returned.
    // -----------------------------------------------------------------------

    var target_forms_container_document ;

    var target_form_element ;

    if ( issues_webos_window_object ) {

        target_forms_container_document = webos__get_document_object( issues_webos_window_object ) ;

        if ( target_forms_container_document ) {

            target_form_element = target_forms_container_document.forms[ target_form_name ] ;

            if ( target_form_element ) {

                ISSUE__save_original_form_data_2( target_form_element ) ;

                return ;
                    //  Because the data has been now been saved!

                }

            }

    } else {

        return ;
            // Because the window has presumably been closed!

        }

    // -----------------------------------------------------------------------

    setTimeout( 'ISSUE__save_original_form_data_1(\'' + target_form_name + '\')' , 100 ) ;
        // Try again later.  Hopefully, the document and/or form will
        // have been found by then...

    // -----------------------------------------------------------------------

    }

// ---------------------------------------------------------------------------

function ISSUE__save_original_form_data_2( target_form_element ) {

    // -----------------------------------------------------------------------

    ISSUE__original_title = parent.wos1__get_form_field__element_value(
        target_form_element.elements['title']           ,
        undefined
        )

    ISSUE__original_synopsis = parent.wos1__get_form_field__element_value(
        target_form_element.elements['synopsis']        ,
        undefined
        )

    ISSUE__original_description = parent.wos1__get_form_field__element_value(
        target_form_element.elements['description']     ,
        undefined
        )

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__question_edited
// ===========================================================================

function ISSUE__question_edited( form_name ) {

    // -----------------------------------------------------------------------
    // ISSUE__question_edited( form_name )
    // - - - - - - - - - - - - - - - - - -
    // Returns a flag that indicates whether or not the "issue_edit" form
    // has been edited (and thus has changes that need writing to the
    // server).
    //
    // RETURNS:-
    //      undefined = ERROR (error message issued)!
    //      true      = The id="issue_edit" form HAS been edited.
    //      false     = The id="issue_edit" form HASN'T been edited.
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // webos__get_document_object(
    //      target_window_object
    //      )
    // - - - - - - - - - - - - - -
    // Utility function to return the window's document object.
    //
    // If 'target_window_object' === null (the background web page), then
    // document is returned.
    //
    // Otherwise, document object for the document in the specified Webos
    // window's IFRAME is returned.
    // -----------------------------------------------------------------------

    var target_form = webos__get_document_object( issues_webos_window_object ).forms[form_name] ;

    // -----------------------------------------------------------------------

    if ( ! target_form ) {
        var detected_in = "\n\nThis error was detected in:  'ISSUE__question_edited().'" ;
        alert( "Can't find form!" + detected_in ) ;
        return undefined ;
        }

    // -----------------------------------------------------------------------

    return  (   parent.wos1__get_form_field__element_value(
                    target_form.elements['title']      ,
                    undefined
                    ) != ISSUE__original_title
                ||
                parent.wos1__get_form_field__element_value(
                    target_form.elements['synopsis']      ,
                    undefined
                    ) != ISSUE__original_synopsis
                ||
                parent.wos1__get_form_field__element_value(
                    target_form.elements['description']      ,
                    undefined
                    ) != ISSUE__original_description
                ) ;

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__question_save
// ===========================================================================

function ISSUE__question_save( form_name ) {

    // -----------------------------------------------------------------------
    // ISSUE__question_edited( form_name )
    // - - - - - - - - - - - - - - - - - -
    // Returns a flag that indicates whether or not the "issue_edit" form
    // has been edited (and thus has changes that need writing to the
    // server).
    //
    // RETURNS:-
    //      undefined = ERROR (error message issued)!
    //      true      = The id="issue_edit" form HAS been edited.
    //      false     = The id="issue_edit" form HASN'T been edited.
    // -----------------------------------------------------------------------

    var question_edited = ISSUE__question_edited( form_name ) ;

    // -----------------------------------------------------------------------

    if ( question_edited === true ) {

        return confirm( "Save changes?\n\nARE YOU SURE?" ) ;
            //  YES/NO; save the form to the server...

    } else if ( question_edited === false ) {

        alert( "This form HASN'T been edited!\n\nThere are NO CHANGES to save." ) ;

        return false ;
            //  NO; DON'T save the form to the server...

    } else {

        return false ;
            //  NO; DON'T save the form to the server (Ie; Cancel the
            //  submission - and do nothing)...

        }

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__save_changes
// ===========================================================================

function ISSUE__save_changes() {

    // -----------------------------------------------------------------------
    // ISSUE__question_edited( form_name )
    // - - - - - - - - - - - - - - - - - -
    // Returns a flag that indicates whether or not the "issue_edit" form
    // has been edited (and thus has changes that need writing to the
    // server).
    //
    // RETURNS:-
    //      undefined = ERROR (error message issued)!
    //      true      = The id="issue_edit" form HAS been edited.
    //      false     = The id="issue_edit" form HASN'T been edited.
    // -----------------------------------------------------------------------

    var question_edited  = ISSUE__question_edited( 'issue_edit' ) ;

    // -----------------------------------------------------------------------

    if ( question_edited === true ) {

        if ( ! confirm( "Save changes?\n\nARE YOU SURE?" ) ) {

            return false ;
                //  Abort the save.
                //  And DON'T SUBMIT the form!

            }

    } else if ( question_edited === false ) {

        alert( "This form HASN'T been edited!\n\nThere are NO CHANGES to save." ) ;

        return false ;
            //  Abort the save.
            //  And DON'T SUBMIT the form!

    } else {

        return false ;
            //  Abort the save.
            //  And DON'T SUBMIT the form!

        }

    // -----------------------------------------------------------------------
    // Do the SAVE...
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // webos__get_document_object(
    //      target_window_object
    //      )
    // - - - - - - - - - - - - - -
    // Utility function to return the window's document object.
    //
    // If 'target_window_object' === null (the background web page), then
    // document is returned.
    //
    // Otherwise, document object for the document in the specified Webos
    // window's IFRAME is returned.
    // -----------------------------------------------------------------------

    var target_form = webos__get_document_object( issues_webos_window_object ).forms['issue_edit'] ;

    // -----------------------------------------------------------------------

    if ( ! target_form ) {
        var detected_in = "\n\nThis error was detected in:  'ISSUE__save_changes().'" ;
        alert( "Can't find form!" + detected_in ) ;
        return undefined ;
        }

    // -----------------------------------------------------------------------
    // wos1__get_form_field__element_value(
    //      target_form_field_element_object
    //      [value_to_return_on_error]
    //      )
    // - - - - - - - - - - - - - - - - - - -
    // Gets a value of a form element.
    //
    // RETURNS:-
    //
    //      o   The specified value (which will usually be a string),
    //
    //      --UNLESS--
    //
    //      o   An error occurs.  In which case it:-
    //
    //          a)  Issues the appropriate error message, and;
    //
    //          b)  Returns either:-
    //              o   value_to_return_on_error, or
    //              o   undefined
    //
    //              depending on whether or not 'value_to_return_on_error'
    //              was specified.
    // -----------------------------------------------------------------------

    var iid = parent.wos1__get_form_field__element_value(
        target_form.elements['iid']         ,
        0
        ) ;

    var title = parent.wos1__get_form_field__element_value(
        target_form.elements['title']       ,
        ''
        ) ;

    var synopsis = parent.wos1__get_form_field__element_value(
        target_form.elements['synopsis']    ,
        ''
        ) ;

    var description = parent.wos1__get_form_field__element_value(
        target_form.elements['description'] ,
        ''
        ) ;

    // -----------------------------------------------------------------------

/*
    parent.webos__send_ajax_request( {
        method          :   'POST'                              ,
        url             :   parent.public_root_url              ,
        GET_parameters  :   {   target : 'issue_edit'       ,
                                iid    : iid                ,
                                action : 'sav'
                                }                               ,
        POST_parameters :   {   title       : 'title'       ,
                                synopsis    : 'synopsis'    ,
                                description : 'description'
                                }                               ,
        window_object   :   issues_webos_window_object
        } ) ;
*/
        //  Ajax just doesn't work.  For some reason no data is posted!

    // -----------------------------------------------------------------------

/*
    var callID = parent.jsrsCall(
        parent.public_root_url + '?target=issue_edit_rpc'       ,
        ISSUE_EDIT__process_JSRS_response                       ,
        'ISSUE__save_changes_inner'                             ,
        {   iid         : iid               ,
            action      : 'sav'             ,
            title       : 'title'           ,
            synopsis    : 'synopsis'        ,
            description : 'description'
            }
        ) ;
*/
        //  JSRS V3 (Sam Blum - Hidden IFrames) doesn't work either.  But
        //  this seems to be due to clashes between the WebOS and JSRS V3
        //  IFrames.  I suspect it would work if WebOS didn't use IFrames.

    // -----------------------------------------------------------------------

/*
    if ( FORK.Ajax.isSupported()  ) {

        new FORK.Ajax(
            'POST'                                                  ,
            parent.public_root_url + '?target=issue_edit'           ,
            {   form        :   target_form                     ,
                body        :   {action : 'sav' }               ,
                argument    :   issues_webos_window_object      ,
                on200       :   wos1__ajax_response_handler
                }
            ) ;

        }
*/
        //  FORK Ajax doesn't work either.  It's exactly the same problem
        //  as the WebOS Ajax handler.  The Ajax handler appears to execute
        //  correctly and without complaint - but NO data is POSTED.
        //
        //  Funnily enough, the "Content-Type" and "Content-Length"
        //  headers get correctly set.  But the POST data itself just
        //  doesn't seem to make it to the message body.

    // -----------------------------------------------------------------------
    // Hidden IFrame...
    // -----------------------------------------------------------------------

    var form_data = {
        'iid'                               :   iid                                                     ,
        'action'                            :   'sav'                                                   ,
        'title'                             :   title                                                   ,
        'synopsis'                          :   synopsis                                                ,
        'description'                       :   description                                             ,
        'hidden_iframe_response_handler'    :   'parent.ISSUE_EDIT__hidden_iframe_response_handler'
        }

    // -----------------------------------------------------------------------

    var hidden_iframe = document.getElementById( 'hidden_iframe' ) ;

    // -----------------------------------------------------------------------

    var iframe_document = get_iframe_document( hidden_iframe ) ;

    var form_el = iframe_document.createElement( 'form' ) ;

//  form_el.id = 'hidden_form' ;

    form_el.method = 'post' ;

    form_el.action = parent.public_root_url + '/?target=issue_edit_rpc' ;
        //  NOTE!   The reason the Ajax methods above didn't work,
        //          is probably the "same origin" policy.
        //
        //          They specified:-
        //              action = parent.public_root_url + '?target=issue_edit_rpc' ;
        //
        //          (NOTE the missing "/" (immediately before the query).)
        //
        //          This hidden iframe method also fails if you omit that "/".

    form_el.target = 'hidden_iframe' ;

    var field_el , field_name , field_value ;

    for ( field_name in form_data ) {

        if ( field_name != 'toJSONString' ) {

            field_el = iframe_document.createElement( 'input' ) ;

            field_el.type = 'text' ;

            field_el.name = field_name ;

            field_value = form_data[field_name] ;
//          alert( field_value )


//          field_value = field_value.replace( /\n/g , '\\n' ) ;
                //  For reasons that I don't understand, you've got to
                //  manually convert new-line characters (the single
                //  byte 10h,) to the '\n' two character/byte
                //  combination.
//          alert( field_value ) ;

            field_value = parent.URLEncode( field_value ) ;
                //  We use kos Hacks URLEncode - instead of
                //  the Javascript standard 'escape()' - because
                //  'escape()' doesn't handle SPace characters
                //  very well.
//          alert( field_value ) ;

            field_el.value = field_value ;

            form_el.appendChild( field_el ) ;

            }
        }

    hidden_iframe.appendChild( form_el ) ;

    // -----------------------------------------------------------------------

    form_el.submit() ;

    // -----------------------------------------------------------------------

    return false ;
        //  DON'T SUBMIT the form!

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE_EDIT__hidden_iframe_response_handler
// ===========================================================================

function ISSUE_EDIT__hidden_iframe_response_handler( response_text ) {

    // -----------------------------------------------------------------------

//  alert( 'Hello from the Hidden IFrame onload handler!' ) ;

//  alert( response_text ) ;

    // -----------------------------------------------------------------------

    webos__hidden_iframe_response_handler(
        response_text               ,
        issues_webos_window_object
        ) ;

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// webos__hidden_iframe_response_handler
// ===========================================================================

function webos__hidden_iframe_response_handler( response_text , target_window_object ) {

    // -----------------------------------------------------------------------
    // A response is ready...
    //
    // ==>  Process it!
    // -----------------------------------------------------------------------

    wos1__process_webos_message(
        response_text.parseJSON()       ,
        target_window_object            ,
        target_window_object === false      //  question_window_is_being_created
        ) ;

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__place_online
// ===========================================================================

function ISSUE__place_online() {

    // -----------------------------------------------------------------------
    // ISSUE__question_edited( form_name )
    // - - - - - - - - - - - - - - - - - -
    // Returns a flag that indicates whether or not the "issue_edit" form
    // has been edited (and thus has changes that need writing to the
    // server).
    //
    // RETURNS:-
    //      undefined = ERROR (error message issued)!
    //      true      = The id="issue_edit" form HAS been edited.
    //      false     = The id="issue_edit" form HASN'T been edited.
    // -----------------------------------------------------------------------

    var question_edited  = ISSUE__question_edited( 'issue_edit' ) ;

    // -----------------------------------------------------------------------

    if ( question_edited === true ) {

        if ( confirm( 'WARNING!  Issue has been edited!' +
                        "\n\nThere are CHANGES to this issue which HAVEN'T BEEN SAVED!" +
                        "\n\nPress OK to DISCARD any changes (and place the issue online)." +
                        "\n\nPress Cancel to SAVE any changes (before placing the issue online)."
                        )
            ) {

            if ( ! confirm( "WARNING!" +
                                "\nOnce this issue has been placed on-line, you WON'T be able to:-" +
                                "\no   EDIT the issue's TITLE," +
                                "\no   DELETE the issue, or;" +
                                "\no   TAKE the issue back OFF-LINE." +
                                "\n\nDISCARD CHANGES (then PLACE THIS ISSUE ONLINE)?\n\nARE YOU SURE?"
                                )
                ) {

                return false ;
                    //  Abort the place online.
                    //  And DON'T SUBMIT the form!

                }

        } else {

            return false ;
                //  Abort the place online.
                //  And DON'T SUBMIT the form!

            }

    } else if ( question_edited === undefined ) {

        return false ;
            //  Abort the place online.
            //  And DON'T SUBMIT the form!

    } else if ( ! confirm( "WARNING!" +
                                "\nOnce this issue has been placed on-line, you WON'T be able to:-" +
                                "\no   EDIT the issue's TITLE," +
                                "\no   DELETE the issue, or;" +
                                "\no   TAKE the issue back OFF-LINE." +
                                "\n\nPLACE THIS ISSUE ONLINE?\n\nARE YOU SURE?"
                                )
        ) {

        return false ;
            //  Abort the place online.
            //  And DON'T SUBMIT the form!

        }

    // -----------------------------------------------------------------------
    // Do the PLACE-ONLINE...
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // webos__get_document_object(
    //      target_window_object
    //      )
    // - - - - - - - - - - - - - -
    // Utility function to return the window's document object.
    //
    // If 'target_window_object' === null (the background web page), then
    // document is returned.
    //
    // Otherwise, document object for the document in the specified Webos
    // window's IFRAME is returned.
    // -----------------------------------------------------------------------

    var target_form = webos__get_document_object( issues_webos_window_object ).forms['issue_place_online'] ;

    // -----------------------------------------------------------------------

    if ( ! target_form ) {
        var detected_in = "\n\nThis error was detected in:  'ISSUE__place_online().'" ;
        alert( "Can't find form!" + detected_in ) ;
        return undefined ;
        }

    // -----------------------------------------------------------------------
    // wos1__get_form_field__element_value(
    //      target_form_field_element_object
    //      [value_to_return_on_error]
    //      )
    // - - - - - - - - - - - - - - - - - - -
    // Gets a value of a form element.
    //
    // RETURNS:-
    //
    //      o   The specified value (which will usually be a string),
    //
    //      --UNLESS--
    //
    //      o   An error occurs.  In which case it:-
    //
    //          a)  Issues the appropriate error message, and;
    //
    //          b)  Returns either:-
    //              o   value_to_return_on_error, or
    //              o   undefined
    //
    //              depending on whether or not 'value_to_return_on_error'
    //              was specified.
    // -----------------------------------------------------------------------

    var iid = parent.wos1__get_form_field__element_value(
        target_form.elements['iid']    ,
        0
        ) ;

    // -----------------------------------------------------------------------

    parent.webos__send_ajax_request( {
        method          :   'GET'                               ,
        url             :   parent.public_root_url + '/'        ,
        GET_parameters  :   {   target : 'issue_edit_rpc'   ,
                                iid    : iid                ,
                                action : 'pol'
                                }                           ,
        window_object   :   issues_webos_window_object
        } ) ;

    // -----------------------------------------------------------------------

    return false ;
        //  DON'T SUBMIT the form!

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__delete
// ===========================================================================

function ISSUE__delete() {

    // -----------------------------------------------------------------------
    // Get user confirmation...
    // -----------------------------------------------------------------------

    if ( ! confirm( "WARNING!" +
                        "\nOnce this issue has been deleted, it's GONE FOREVER; there's NO UNDO!" +
                        "\n\nDELETE THIS ISSUE?\n\nARE YOU SURE?"
                        )
        ) {

        return false ;
            //  Abort the delete.
            //  And DON'T SUBMIT the form!

        }

    // -----------------------------------------------------------------------
    // Do the DELETE...
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // webos__get_document_object(
    //      target_window_object
    //      )
    // - - - - - - - - - - - - - -
    // Utility function to return the window's document object.
    //
    // If 'target_window_object' === null (the background web page), then
    // document is returned.
    //
    // Otherwise, document object for the document in the specified Webos
    // window's IFRAME is returned.
    // -----------------------------------------------------------------------

    var target_form = webos__get_document_object( issues_webos_window_object ).forms['issue_delete'] ;

    // -----------------------------------------------------------------------

    if ( ! target_form ) {
        var detected_in = "\n\nThis error was detected in:  'ISSUE__delete().'" ;
        alert( "Can't find form!" + detected_in ) ;
        return undefined ;
        }

    // -----------------------------------------------------------------------
    // wos1__get_form_field__element_value(
    //      target_form_field_element_object
    //      [value_to_return_on_error]
    //      )
    // - - - - - - - - - - - - - - - - - - -
    // Gets a value of a form element.
    //
    // RETURNS:-
    //
    //      o   The specified value (which will usually be a string),
    //
    //      --UNLESS--
    //
    //      o   An error occurs.  In which case it:-
    //
    //          a)  Issues the appropriate error message, and;
    //
    //          b)  Returns either:-
    //              o   value_to_return_on_error, or
    //              o   undefined
    //
    //              depending on whether or not 'value_to_return_on_error'
    //              was specified.
    // -----------------------------------------------------------------------

    var iid = parent.wos1__get_form_field__element_value(
        target_form.elements['iid']    ,
        0
        ) ;

    // -----------------------------------------------------------------------

    parent.webos__send_ajax_request( {
        method          :   'GET'                               ,
        url             :   parent.public_root_url + '/'        ,
        GET_parameters  :   {   target : 'issue_edit_rpc'   ,
                                iid    : iid                ,
                                action : 'del'
                                }                           ,
        window_object   :   issues_webos_window_object
        } ) ;

    // -----------------------------------------------------------------------

    return false ;
        //  DON'T SUBMIT the form!

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__refresh_the_edit_window
// ===========================================================================

function ISSUE__refresh_the_edit_window() {

    // -----------------------------------------------------------------------
    // Refresh/reload the entire "Edit Issue..." window...
    // -----------------------------------------------------------------------

    issues_webos_window_object.iframe_element.contentWindow.location.reload() ;

    // -----------------------------------------------------------------------
    // Restore the "CancelClose" button...
    // -----------------------------------------------------------------------

    ISSUES__select_cancel_close_button( true ) ;
        //  'true' because there IS an 'ok_refresh' button...

    // -----------------------------------------------------------------------
    // Save the original unedited form data (so that we can later
    // determine whether or not the form has been edited)...
    // -----------------------------------------------------------------------

    ISSUE__save_original_form_data( 'issue_edit' ) ;

    // -----------------------------------------------------------------------
    // NO 'edit window refresh' is as yet required...
    // -----------------------------------------------------------------------

    ISSUE__question_edit_window_refresh_required = false ;

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__question_refresh_the_edit_window
// ===========================================================================

var ISSUE__question_edit_window_refresh_required ;

// ---------------------------------------------------------------------------

function ISSUE__question_refresh_the_edit_window() {

    // -----------------------------------------------------------------------
    // Must return either true or false - depending on whether or not
    // the edit window tab click is to be ignored...
    // -----------------------------------------------------------------------

    if ( ISSUE__question_edit_window_refresh_required ) {

        // -------------------------------------------------------------------
        // Select the "Edit" tab...
        // -------------------------------------------------------------------

        //  ----------------------------------------------------------------------
        //  kiwiparty__set_issue_edit_action( issue_edit_action )
        //  - - - - - - - - - - - - - - - - - - - - - - - - - - -
        //  Sets the:-
        //      COOKIE_NAME__ISSUE_EDIT_ACTION
        //
        //  cookie.
        //
        //  'issue_edit_action' should be either:-
        //      'e' (= Show the 'Edit' tab),
        //      'p' (= Show the 'Place On-Line' tab),
        //      'd' (= Show the 'Delete' tab), or;
        //      'h' (= Show the 'History' tab).
        //
        //  RETURNS
        //      Nothing
        //  ----------------------------------------------------------------------

        kiwiparty__set_issue_edit_action( 'e' ) ;

        // -------------------------------------------------------------------
        // Refresh/reload the entire "Edit Issue..." window (so that it
        // relects the fact that the issue is now ONLINE)...
        // -------------------------------------------------------------------

        ISSUE__refresh_the_edit_window() ;

        // -------------------------------------------------------------------
        // IGNORE the click!
        //
        // The "Edit Issue..." window has been refreshed - just as if it's
        // just been popped up.  So in effect, the click has been honoured
        // (and there's no need to do any tab switching)...
        // -------------------------------------------------------------------

        return true;
            // IGNORE the click!

        // -------------------------------------------------------------------

        }

    // -----------------------------------------------------------------------

    return false;
        // DON'T ignore the click!

    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__after_successful_place_online
// ===========================================================================

function ISSUE__after_successful_place_online() {

    //  ----------------------------------------------------------------------
    //  Hide the "Delete" tab...
    //  ----------------------------------------------------------------------

    if ( issues_webos_window_object ) {
        var target = webos__get_document_object( issues_webos_window_object ) ;
        if ( target ) {
            target = target.getElementById( 'edit_issue_tab_notebook_d' ) ;
            if ( target ) {
                target.style.display = 'none' ;
                }
            }
        }

    //  ----------------------------------------------------------------------
    //  Replace the "CancelClose" button with the "OK" button...
    //  ----------------------------------------------------------------------

    ISSUES__select_ok_close_button( true ) ;
        //  'true' because there IS an 'OK refresh' button...

    //  ----------------------------------------------------------------------
    //  The "Edit Issue..." window must be refreshed before the "Edit" tab
    //  is displayed...
    //  ----------------------------------------------------------------------

    ISSUE__question_edit_window_refresh_required = true ;

    // -----------------------------------------------------------------------
    // Refresh the ("Show Single Issue") background web page...
    // -----------------------------------------------------------------------

    send_ajax_request_to_update_center_column() ;

    //  ----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUE__after_successful_delete
// ===========================================================================

function ISSUE__after_successful_delete() {

    //  ----------------------------------------------------------------------
    //  Hide the "Edit" and "Place Online" tabs...
    //  ----------------------------------------------------------------------

    if ( issues_webos_window_object ) {

        var target = webos__get_document_object( issues_webos_window_object ) ;

        if ( target ) {

            var target_element = target.getElementById( 'edit_issue_tab_notebook_e' ) ;
            if ( target_element ) {
                target_element.style.display = 'none' ;
                }

            target_element = target.getElementById( 'edit_issue_tab_notebook_p' ) ;
            if ( target_element ) {
                target_element.style.display = 'none' ;
                }

            }

        }

    //  ----------------------------------------------------------------------
    //  Replace the "CancelClose" button with the "OK" button...
    //  ----------------------------------------------------------------------

    ISSUES__select_ok_close_button( true ) ;
        //  'true' because there IS an 'ok_refresh' button...

    //  ----------------------------------------------------------------------
    //  The "Edit Issue..." window must be refreshed before the "Edit" tab
    //  is displayed...
    //  ----------------------------------------------------------------------

    ISSUE__question_edit_window_refresh_required = true ;

    // -----------------------------------------------------------------------
    // Refresh the ("Show Single Issue") background web page...
    // -----------------------------------------------------------------------

    send_ajax_request_to_update_center_column() ;

    //  ----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUES__goto
// ===========================================================================

function ISSUES__goto( issue_id ) {

    // -----------------------------------------------------------------------
    // Set the 'issue_id' cookie...
    // -----------------------------------------------------------------------

    kiwiparty__set_issue_id( issue_id ) ;

    // -----------------------------------------------------------------------
    // Refresh the page...
    // -----------------------------------------------------------------------

    send_ajax_request_to_update_center_column() ;

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUES__list_all
// ===========================================================================

function ISSUES__list_all() {

    // -----------------------------------------------------------------------
    // Set the 'issue_id' cookie...
    // -----------------------------------------------------------------------

    kiwiparty__set_issue_id( 0 ) ;

    // -----------------------------------------------------------------------
    // Refresh the page...
    // -----------------------------------------------------------------------

    send_ajax_request_to_update_center_column() ;

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

// ===========================================================================
// ISSUES__expand_collapse
// ===========================================================================

var ISSUES__expand_collapse_display_value ;

// ---------------------------------------------------------------------------

function ISSUES__expand_collapse( e_or_c ) {

    // -----------------------------------------------------------------------
    // NOTE!
    // -----
    // 'e_or_c' is the opposite of the expand/collapse value when the page
    // was created.
    //
    // So if:-
    //
    // o    'e_or_c' == 'c', then:-
    //
    //      1.  The page will include the issue synopses (as well as the
    //          issue titles), and;
    //
    //      2.  We can thus collapse and expand the issues by simply
    //          hiding and showing the class="issue_synopsis" DIVs in
    //          which the synopses live.
    //
    //          This avoids unnecessary trips to the server...
    //
    // o    'e_or_c' == 'e', then:-
    //
    //      1.  The page won't include the issue synopses (as well as the
    //          issue titles), so;
    //
    //      2.  We need to go to the server, to get these synopses.
    //
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // SYNOPSES NOT INCLUDED...
    // -----------------------------------------------------------------------

    if ( e_or_c !== 'c' ) {

        // -------------------------------------------------------------------
        // Set the 'issue_expand_collapse' cookie...
        // -------------------------------------------------------------------

        kiwiparty__set_issue_expand_collapse( 'e' ) ;

        // -------------------------------------------------------------------
        // Refresh the page...
        // -------------------------------------------------------------------

        send_ajax_request_to_update_center_column() ;

        // -------------------------------------------------------------------
        // That's that!
        // -------------------------------------------------------------------

        return ;

        // -------------------------------------------------------------------

        }

    // -----------------------------------------------------------------------
    // SYNOPSES INCLUDED...
    //
    // -->  Toggle the synopsis DIVs -= and the Expand/Collapse toggle switch
    //      on the issues menu...
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // Determine whether the DIVs are to be shown or hidden...
    // -----------------------------------------------------------------------

    //  ----------------------------------------------------------------------
    //  kiwiparty__get_issue_expand_collapse__clean_and_simplified()
    //  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    //  Returns the current issue expand/collapse setting.  Unless that
    //  value isn't defined, or is invalid, in which case the default
    //  issue expand/collapse value ('c' = collapse) will be returned.
    //
    //  The current selected issue expand/collapse value is determined
    //  from the:-
    //      COOKIE_NAME__ISSUE_EXPAND_COLLAPSE
    //
    //  cookie (sent by the user's browser).
    //
    //  NOTE!
    //  ------
    //  This routine issues NO error messages.
    //  ----------------------------------------------------------------------

    ISSUES__expand_collapse_display_value = 'block'    ;

    var new_toggle_switch_title           = 'collapse' ;

    var new_cookie_value                  = 'e'        ;

    //  ----------------------------------------------------------------------

    if ( kiwiparty__get_issue_expand_collapse__clean_and_simplified() === 'e' ) {

        ISSUES__expand_collapse_display_value = 'none'   ;

        new_toggle_switch_title               = 'expand' ;

        new_cookie_value                      = 'c'      ;

        }

    // -----------------------------------------------------------------------
    // Then toggle the Expand/Collapse entry on the issues menu...
    // -----------------------------------------------------------------------

    var toggle_switch_element = document.getElementById(
                                    'issues_expand_collapse_toggle_switch'
                                    ) ;

    // -----------------------------------------------------------------------

    if ( toggle_switch_element ) {
        toggle_switch_element.innerHTML = new_toggle_switch_title ;
        }

    // -----------------------------------------------------------------------
    // Then hide/show the synopsis DIVs...
    // -----------------------------------------------------------------------

    // -----------------------------------------------------------------------
    // xGetElementsByClassName(sClsName, oParentEle, sTagName, fnCallback)
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // Returns an array of elements which are descendants of parentEle and
    // have tagName and clsName.  If parentEle is null or not present,
    // document will be used.  If tagName is null or not present, "*" will
    // be used.
    //
    // PARAMETERS
    //      sClsName        String
    //
    //      oParentEle      Element reference
    //
    //      sTagName        String
    //
    //      fnCallback      Callback function, iterates thru the returned
    //                      list.  Is passed a reference to each Element
    //                      object found.
    //
    // RETURN
    //      Always returns an array but it may have zero length.
    // -----------------------------------------------------------------------

    xGetElementsByClassName(
        "issue_synopsis"        ,
        null                    ,
        null                    ,
        function (e) {
            e.style.display = ISSUES__expand_collapse_display_value ;
            }
        ) ;

    // -----------------------------------------------------------------------
    // Set the 'issue_expand_collapse' cookie...
    // -----------------------------------------------------------------------

    kiwiparty__set_issue_expand_collapse( new_cookie_value ) ;

    // -----------------------------------------------------------------------
    // That's that!
    // -----------------------------------------------------------------------

    }

