///////////////////////////////////////////////////////////////////////////////////////
//                                                                                   //
// This file contains routines that are common for all web pages                     //
//                                                                                   //
// A typical web page consists of the following:                                     //
//                                                                                   //
//     <html>                                                                        //
//     <head>                                                                        //
//     <link rel="stylesheet" type="text/css" href="stylesheet.css" />               //
//     <script language="javascript" src="scripts/common.js"></script>               //
//     <script language="javascript" src="scripts/top.js"></script>                  //
//     <script language="javascript" src="scripts/menu.js"></script>                 //
//     </head>                                                                       //
//                                                                                   //
//     <body>                                                                        //
//     <script>                                                                      //
//     commonStart(ttl, sel, hdr, basedir, allow);                                   //
//     </script>                                                                     //
//                                                                                   //
//     Put content here                                                              //
//                                                                                   //
//     <script>                                                                      //
//     commonEnd(sel, basedir);                                                      //
//     </script>                                                                     //
//     </body>                                                                       //
//     </html>                                                                       //
//                                                                                   //
//     where:                                                                        //
//         sel     = Menu item to select                                             //
//         hdr     = Content header                                                  //
//         basedir = Optional argument indicating the location of the base directory //
//         allow   = Optional argument indicating whether to allow selected menu     //
//                   item to be selected                                             //
//                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////

// Common start for all web pages
//
// Input:
//     ttl     = Title of web page
//     sel     = Optional argument containing menu item to select. If not specified,
//               it will be the same as ttl
//     hdr     = Optional argument containing content header. If not specified and sel
//               is not specified, it will be the same as ttl. If not specified and
//               sel is specified, it will be the same as sel
//     basedir = Optional argument indicating the location of the base directory
//     allow   = Optional argument indicating whether to allow selected menu item to
//               be selected
//
function commonStart(ttl, sel, hdr, basedir, allow)
{
    with(document)
    {
        // Set web page title
        title = ttl;

        // If menu item to select is not specified,
        if (!sel)
        {
            // Set menu item to select to web page title
            sel = ttl;
        }

        // If content header is not specified,
        if (!hdr)
        {
            // Set content header to menu item to select
            hdr = sel;
        }

        // Open main table
        write('<table border="0" cellspacing="0" cellpadding="0">');

        // Open logo and club name table row
        write('<tr>');

        // Open logo and club name table cell
        write('<td>');

        // Display club logo and name
        top(basedir);

        // Close logo and club name table cell
        write('</td>');

        // Close logo and club name table row
        write('</tr>');

        // Open left menu, content, and bottom menu table row
        write('<tr>');

        // Open left menu, content, and bottom menu table cell
        write('<td>');

        // Open left menu, content, and bottom menu table
        write('<table border="0" cellspacing="0" cellpadding="0">');

        // Open left menu and content table row
        write('<tr>');

        // Display left menu
        leftMenu(sel, basedir, allow);

        // Open content table cell
        write('<td class="Content">');

        // Display content header
        write('<h3>' + hdr + '</h3>');
    }
}

// Common end for all web pages
//
// Input:
//     sel     = Menu item to select
//     basedir = Optional argument indicating the location of the base directory
//
function commonEnd(sel, basedir)
{
    with(document)
    {
        // Close content table cell
        write('</td>');

        // Close left menu and content table row
        write('</tr>');

        // Display bottom menu
        bottomMenu(sel, basedir);

        // Close left menu, content, and bottom menu table
        write('</table>');

        // Close left menu, content, and bottom menu table cell
        write('</td>');

        // Close left menu, content, and bottom menu table row
        write('</tr>');

        // Close main table
        write('</table>');
    }
}
