// ------------------------------------------------------------------ //
// ------------------------------------------------------------------ //
//                                                                    //
// JAVASCRIPT INCLUDE FILE TO PROVIDE CALENDAR FUNCTIONS              //
//                                                                    //
// Author           : MJD					      //
// Modifier	    : ABA					      //
// Version          : 2.1                                             //
// Created          : 18/08/2003                                      //
// Last Modified    : 04/01/2006                                      //
//                                                                    //
// ------------------------------------------------------------------ //
// ------------------------------------------------------------------ //
//                                                                    //
// VERSION HISTORY                                                    //
//                                                                    //
// 0.1              18/08/2003  Initial creation                      //
//                  19/08/2003  Initial development work              //
//                  20/08/2003  Continuation of initial development   //
// 0.2              20/08/2003  First beta release                    //
// 0.3              21/08/2003  Solved problems with positioning      //
// 0.4              21/08/2003  Added 'skins'                         //
// 0.5              21/08/2003  Added shadow layer                    //
// 0.6              22/08/2003  Styled top row (buttons & dropdowns)  //
// 0.7              22/08/2003  Split showHideCalendar function into  //
//                              two separate functions                //
// 0.8              22/08/2003  Changed rollover behaviour of buttons //
// 0.9              26/08/2003  Reset dates on initial popup          //
// 1.0              01/09/2003  Display controls in a table to align  //
//                              the buttons to the sides              //
// 1.1              02/09/2003  Added instructions                    //
// 1.2              03/10/2003  Added 'invoicegenerator' skin         //
// 1.3              07/10/2003  Added IE5 Fix (cursor bug)            //
// 1.4              10/10/2003  Added 'blue' skin                     //
// 1.5              14/10/2003  Modified 'salesstats' skin            //
// 1.6              17/10/2003  Modified 'salesstats' skin            //
// 1.7              12/11/2003  Added another arg allowing a set of   //
//                              params as a comma delimited string    //
// 1.8              18/11/2003  Fixed bug with param string           //
// 1.9              04/12/2003  Added 'rps' skin                      //
// 2.0              26/04/2004  Fixed bug where calendar would        //
//                              disappear sometimes when clicking     //
//                              on it. This was caused by the         //
//                              click-off handling which closes the   //
//                              calendar when clicking away from it.  //
//                              What was happening was that the page  //
//                              scroll amount was not being taken     //
//                              into account.                         //
// 2.1              04/01/2006  Added 'cvh' skin                      //
//                                                                    //
// ------------------------------------------------------------------ //
// ------------------------------------------------------------------ //
//                                                                    //
//  INSTRUCTIONS                                                      //
//                                                                    //
//  In the HTML page you will need to have a link (image or normal    //
//  href), which has an onClick event calling the calendar.           //
//                                                                    //
//  Example:                                                          //
//                                                                    //
//  <a href="#" onClick="fPopCalendar();">calendar</a>                //
//                                                                    //
//  When you call the calendar, you will have to pass in the          //
//  necessary arguments.                                              //
//                                                                    //
//  function fPopCalendar(                                            //
//      popupLocatorObject,                                           //
//      dateBox,                                                      //
//      boolReturnShortDates,                                         //
//      strNewSkinName,                                               //
//      sParameters                                                   //
//  )                                                                 //
//                                                                    //
//  popupLocatorObject      : This is the object below which you wish //
//                            the calendar to line up with.           //
//                            Argument can be passed as object or     //
//                            object name.                            //
//  dateBox                 : The date input field where you wish the //
//                            resulting date string to be placed.     //
//                            Argument can be passed as object or     //
//                            object name.                            //
//  boolReturnShortDates    : Boolean deciding whether to return      //
//                            short or long date strings.             //
//                            true = short and false = long           //
//                            [OPTIONAL unless skin specified]        //
//  strNewSkinName          : Name of the skin you wish to apply      //
//                            [OPTIONAL]                              //
//                                                                    //
// ------------------------------------------------------------------ //
// ------------------------------------------------------------------ //


//  ----------------
//  Version Checking
//  ----------------

var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);
var is_opera = (agt.indexOf("opera") != -1);
var iePos  = appVer.indexOf('msie');
if (iePos !=-1)
{
   is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
   is_major = parseInt(is_minor);
}
var is_konq = false;
var kqPos   = agt.indexOf('konqueror');
if (kqPos !=-1)
{
   is_konq  = true;
   is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
   is_major = parseInt(is_minor);
}
var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
var is_khtml  = (is_safari || is_konq);
var is_ie   = ((iePos!=-1) && (!is_opera) && (!is_khtml));
var is_ie5   = (is_ie && is_major == 5);
var is_ie5up = (is_ie && is_minor >= 5);
var is_ie5_5  = (is_ie && (agt.indexOf("msie 5.5") !=-1));
var is_ie5_5up =(is_ie && is_minor >= 5.5);
var is_ie6   = (is_ie && is_major == 6);
var is_ie6up = (is_ie && is_minor >= 6);

//if( !is_ie5up ) alert('You must have IE5 or greater to use calendar.js');

// ------------------------------------------
// Global variables and variable declarations
// ------------------------------------------

// Preference variables (set by skins)
var strBaseFont;
var strBorderType;
var intBorderWidth;
var strBackgroundColor;
var strBorderColor;
var strHighlightedTextColor;
var strHighlightBackgroundColor;
var arrDaysOfWeek;
var arrWeekendDays;
var arrShortMonthNames;
var arrFullMonthNames;
var intStartOfWeek;
var intEarliestYear;
var intLatestYear;
var boolHighlightWeekendDayNames;
var boolShowShortDates;

// Environmental or Situational Information
var strSkinName         = 'default';
var intMouseX           = 0;
var intMouseY           = 0;
var boolTestedMouse     = false;
var objLocatorElement;
var intXOffset          = 0;
var intYOffset          = 2;
var intLeftPosition     = 0;
var intTopPosition      = 0;
var aParameters         = new Array();

// Create variables for Calendar Objects
var objDateBox;
var objCalendar;
var objCalendarShadow;
var objMainTable;
var objTableHeader;
var objTableBody;
var objTableFooter;

// Date variables
var dateToday           = new Date();
var intTodayDate        = dateToday.getDate();
var strTodayDateOrdinal = getOrdinal( intTodayDate );
var intTodayMonth       = dateToday.getMonth();
var intTodayYear        = dateToday.getYear();
var intThisMonth        = intTodayMonth;    // Initialise to today's value
var intThisYear         = intTodayYear;     // Initialise to today's value
var intReturnDate       = intTodayDate;     // Initialise to today's value
var intFirstDayOfMonth  = getFirstDayOfMonth();

// --------------------------------------------
// Global event handlers and relevant functions
// --------------------------------------------

document.onmousemove    = setMouseCoords;
document.onmousedown    = hideIfClickOutside;

function setMouseCoords ()
{
    intMouseX   = window.event.clientX;
    intMouseY   = window.event.clientY;
//  showMouseCoords();
}

function showMouseCoords ()
{
    window.status   = 'X = ' +intMouseX+ ', Y = ' +intMouseY;
}

// ---------------------------
// Calendar Specific Functions
// ---------------------------

function WriteCalendar()
{
    // Do nothing (In to allow backwards compatibility)
}

function createDiv()
{
    // Create or reference the elements
    var objBody                     = document.body;
    objCalendar                     = document.createElement( 'DIV' );
    objCalendarShadow               = document.createElement( 'DIV' );
    var objCalendarTable            = document.createElement( 'TABLE' );
    var objCalendarTableHead        = document.createElement( 'THEAD' );
    var objCalendarTableBody        = document.createElement( 'TBODY' );
    var objCalendarTableFooter      = document.createElement( 'TFOOT' );

    // Setup the Calendar Div
    with ( objCalendar.style)
    {
        position    = 'absolute';
        display     = 'none';
        zIndex      = 100;
    }

    // Setup the Calendar Shadow Div
    with ( objCalendarShadow.style)
    {
        position    = 'absolute';
        border      = 'none';
        background  = 'black';
        filter      = 'progid:DXImageTransform.Microsoft.Alpha(opacity=30)';
        display     = 'none';
        zIndex      = 99;
    }

    // Setup the Table
    objCalendarTable.border         = 0;
    objCalendarTable.cellPadding    = 0;
    objCalendarTable.cellSpacing    = 0;

    // Attach the elements
    objCalendarTable.appendChild( objCalendarTableHead );
    objCalendarTable.appendChild( objCalendarTableBody );
    objCalendarTable.appendChild( objCalendarTableFooter );
    objCalendar.appendChild( objCalendarTable );
    objBody.appendChild( objCalendar );
    objBody.appendChild( objCalendarShadow );
}

function fPopCalendar( popupLocatorObject, dateBox, boolReturnShortDates, strNewSkinName, sParameters )  // Arguments can be either objects or names of objects
{
    if (event.srcElement) event.srcElement.blur(); // Removes dotted border around calendar image after clicking on it

    // Apply any specified 'skin'
    strSkinName = strNewSkinName;
    applySkin();

    // Create calendar object
    objCalendar = document.getElementById( 'CalendarDiv' );
    if (objCalendar == null) createDiv();

    // Identify Environmental Object
    objLocatorElement   = ( typeof popupLocatorObject == 'object' ) ? popupLocatorObject : document.getElementById( popupLocatorObject );
    objDateBox          = ( typeof dateBox == 'object' ) ? dateBox : document.getElementById( dateBox );
    boolShowShortDates  = boolReturnShortDates;

    // Set up global parameters string
    if ( arguments.length > 4 )
        aParameters = sParameters.split(',');

    // Call the setup functions
    setupParameters();      // Use parameters to perform any alterations to the initialisation variables
    initialiseCalendar();   // Perform all intialisation methods on the calendar
    buildCalendar();        // Build the calendar
    showCalendar();         // Toggle Calendar Visibility
    resetVariables();       // Reset Adjusted Variables
}

function resetVariables()
{
    intXOffset      = 0;
    intYOffset      = 2;
    intLeftPosition = 0;
    intTopPosition  = 0;
}

function getParameter( sParamName, sDefault )
{
    var sReturnValue    = sDefault;

    for ( var iParam = 0; iParam < aParameters.length; iParam++ )
    {
        var aParam  = aParameters[iParam].split('=');
        var sName   = aParam[0];
        var sValue  = aParam[1];
        if ( sName == sParamName )
            sReturnValue    = sValue;
    }

    return sReturnValue;
}

function setupParameters()
{
    // Check for adjustments to position
    var iXChange    = parseInt( getParameter( 'adjustx', '0' ) );
    var iYChange    = parseInt( getParameter( 'adjusty', '0' ) );
    if ( iXChange != 0 )
        intXOffset  = intXOffset + iXChange;
    if ( iYChange != 0 )
        intYOffset  = intYOffset + iYChange;
}

function initialiseCalendar()
{
    // Setup position
    intLeftPosition = getXCoordinate( objLocatorElement ) + intXOffset;
    intTopPosition  = getYCoordinate( objLocatorElement ) + objLocatorElement.offsetHeight + intYOffset;
    // Correct for frames as necessary (bug correction)
    if (top.frames.length > 0)
    {
        intLeftPosition += 2;
        intTopPosition += 2;
    }


    // Restore Dates on new popup
    intThisMonth        = intTodayMonth;
    intThisYear         = intTodayYear;
    intFirstDayOfMonth  = getFirstDayOfMonth();

    // Apply styles to calendar
    with ( objCalendar.style )
    {
        fontFamily  = strBaseFont;
        position    = 'absolute';
        left        = intLeftPosition+ 'px';
        top         = intTopPosition+ 'px';
        border      = intBorderWidth+ 'px ' +strBorderColor+ ' ' +strBorderType;
        padding     = '5px';
        margin      = '0px';
        background  = strBackgroundColor;
    }

    // Initialise the main variables
    objMainTable    = objCalendar.getElementsByTagName('TABLE')(0);
    objTableHeader  = objMainTable.getElementsByTagName('THEAD')(0);
    objTableBody    = objMainTable.getElementsByTagName('TBODY')(0);
    objTableFooter  = objMainTable.getElementsByTagName('TFOOT')(0);
}

function buildCalendar()
{
    // Clean the table
    removeAllChildren( objTableHeader );
    removeAllChildren( objTableBody );
    removeAllChildren( objTableFooter );

    // Setup the separate parts
    buildHeader();
    buildBody();
    buildFooter();
}

function buildHeader()
{
    // -----------------------
    // Month/Year Controls Row
    // -----------------------

    // Create the objects
    var objControlsRow              = document.createElement( 'TR' );
    var objControlsCell             = document.createElement( 'TD' );
    var objControlsTable            = document.createElement( 'TABLE' );
    var objControlsTableBody        = document.createElement( 'TBODY' );
    var objControlsTableRow         = document.createElement( 'TR' );
    var objControlsLeftButtonCell   = document.createElement( 'TD' );
    var objControlsMonthDropdownCell= document.createElement( 'TD' );
    var objControlsYearDropdownCell = document.createElement( 'TD' );
    var objControlsRightButtonCell  = document.createElement( 'TD' );
    var objLeftButton               = document.createElement( 'INPUT' );
    var objMonthDropdown            = document.createElement( 'SELECT' );
    var objYearDropdown             = document.createElement( 'SELECT' );
    var objRightButton              = document.createElement( 'INPUT' );

    // Set outer-cell colspan
    objControlsCell.colSpan = 7;

    // Format outer-cell
    with ( objControlsCell.style )
    {
        paddingBottom   = '5px';
    }

    // Create and setup Left Button
    objLeftButton.type          = 'button';
    objLeftButton.value         = '<';
    objLeftButton.onclick       = backOneMonth;
    objLeftButton.onmouseover   = function() { objLeftButton.style.background = strHighlightBackgroundColor; };
    objLeftButton.onmouseout    = function() { objLeftButton.style.background = strBackgroundColor; };
    with ( objLeftButton.style )
    {
        position    = 'relative';
        top         = '-1px';
        fontFamily  = 'Arial';
        fontSize    = '11px';
        width       = '18px';
        height      = '18px';
        marginRight = '5px';
        border      = '1px solid ' +strBorderColor;
        color       = strHighlightedTextColor;
        background  = strBackgroundColor;
        cursor      = (is_ie5_5up) ? 'pointer' : 'hand';
    }

    // Create and Setup Month Dropdown
    objMonthDropdown.onchange   = rebuild;
    objMonthDropdown.forceshow  = 'forceshow';  // Needed so that this dropdown isn't hidden when the calendar pops up
    for ( var intMonthIndex = 0; intMonthIndex < arrFullMonthNames.length; intMonthIndex++ )
    {
        var strMonthValue       = intMonthIndex;
        var strMonthText        = arrFullMonthNames[ intMonthIndex ];
        var objMonthOption      = document.createElement( 'OPTION' );
        objMonthOption.value    = strMonthValue;
        objMonthOption.appendChild( document.createTextNode( strMonthText ) );
        if ( intMonthIndex == intThisMonth ) objMonthOption.selected = true;
        objMonthDropdown.appendChild( objMonthOption );
        with ( objMonthDropdown.style )
        {
            fontSize    = '11px';
            height      = '20px';
        }
    }

    // Create Year Dropdown
    objYearDropdown.onchange    = rebuild;
    objYearDropdown.forceshow   = 'forceshow';  // Needed so that this dropdown isn't hidden when the calendar pops up
    for ( var intYear = intEarliestYear; intYear <= intLatestYear; intYear++ )
    {
        var strYearValue    = intYear;
        var strYearText     = intYear;
        var objYearOption   = document.createElement( 'OPTION' );
        objYearOption.value = strYearValue;
        objYearOption.appendChild( document.createTextNode( strYearText ) );
        if ( intYear == intThisYear ) objYearOption.selected = true;
        objYearDropdown.appendChild( objYearOption );
        with ( objYearDropdown.style )
        {
            fontSize    = '11px';
            height      = '20px';
        }
    }

    // Create and setup Right Button
    objRightButton.type     = 'button';
    objRightButton.value    = '>';
    objRightButton.onclick  = forwardOneMonth;
    objRightButton.onmouseover  = function() { objRightButton.style.background = strHighlightBackgroundColor; };
    objRightButton.onmouseout   = function() { objRightButton.style.background = strBackgroundColor; };
    with ( objRightButton.style )
    {
        position    = 'relative';
        top         = '-1px';
        fontFamily  = 'Arial';
        fontSize    = '11px';
        width       = '18px';
        height      = '18px';
        marginLeft  = '5px';
        border      = '1px solid ' +strBorderColor;
        color       = strHighlightedTextColor;
        background  = strBackgroundColor;
        cursor      = (is_ie5_5up) ? 'pointer' : 'hand';
    }

    // Setup controls table
    with ( objControlsTable )
    {
        cellPadding = '0';
        cellSpacing = '0';
        border      = '0';
        width       = '100%';
    }

    // Setup Left Button Cell
    with( objControlsLeftButtonCell.style )
    {
        width           = '25px';
        textAlign       = 'left';
        verticalAlign   = 'top';
    }

    // Setup Dropdowns Cells
    with( objControlsMonthDropdownCell.style )
    {
        textAlign       = 'center';
        verticalAlign   = 'top';
    }
    with( objControlsYearDropdownCell.style )
    {
        textAlign       = 'center';
        verticalAlign   = 'top';
    }

    // Setup Right Button Cell
    with( objControlsRightButtonCell.style )
    {
        width           = '25px';
        textAlign       = 'right';
        verticalAlign   = 'top';
    }

    // Add the objects (in the right order!)
    objControlsLeftButtonCell.appendChild( objLeftButton );
    objControlsMonthDropdownCell.appendChild( objMonthDropdown );
    objControlsYearDropdownCell.appendChild( objYearDropdown );
    objControlsRightButtonCell.appendChild( objRightButton );
    objControlsTableRow.appendChild( objControlsLeftButtonCell );
    objControlsTableRow.appendChild( objControlsMonthDropdownCell );
    objControlsTableRow.appendChild( objControlsYearDropdownCell );
    objControlsTableRow.appendChild( objControlsRightButtonCell );
    objControlsTableBody.appendChild( objControlsTableRow );
    objControlsTable.appendChild( objControlsTableBody );
    objControlsCell.appendChild( objControlsTable );
    objControlsRow.appendChild( objControlsCell );
    objTableHeader.appendChild( objControlsRow );

    // ----------------
    // Days of Week Row
    // ----------------

    // Create the objects
    var objDaysRow      = document.createElement( 'TR' );

    // Set up the day cells
    for ( var intDayIndex = 0; intDayIndex < arrDaysOfWeek.length; intDayIndex++ )
    {
        // Determine the day, using the days array and the start of the week index
        var intCurrentDay       = intDayIndex + intStartOfWeek;
        if ( intCurrentDay >= 7 ) intCurrentDay = intCurrentDay - 7;
        var strCurrentDay       = arrDaysOfWeek[ intCurrentDay ];

        // Determine whether the day is on the weekend
        var boolDayIsWeekend    = false;
        for ( var intWeekendIntIndex = 0; intWeekendIntIndex < arrWeekendDays.length; intWeekendIntIndex++ )
            if ( arrWeekendDays[intWeekendIntIndex] == intCurrentDay ) boolDayIsWeekend = true;

        // Create the day cell
        var objDayCell          = document.createElement( 'TD' );
        objDayCell.appendChild( document.createTextNode( strCurrentDay ) );

        // Format the day cell
        with ( objDayCell.style )
        {
            fontFamily      = strBaseFont;
            padding         = '2px';
            paddingLeft     = '5px';
            paddingRight    = '5px';
            fontSize        = '10px';
            color           = ( boolDayIsWeekend && boolHighlightWeekendDayNames ) ? strHighlightedTextColor : 'black';
            textAlign       = 'center';
            border          = '1px solid ' +strBorderColor;
            if ( intDayIndex != 6 ) borderRight = 'none';
        }

        // Add cell to the days row
        objDaysRow.appendChild( objDayCell );

    }

    // Add the objects (in the right order!)
    objTableHeader.appendChild( objDaysRow );
}

function buildBody()
{
    var intDaysInMonth      = getDaysInMonth( intThisMonth, intThisYear );
    var intDaysInFirstWeek  = (7 + intStartOfWeek) - intFirstDayOfMonth;
    if (intDaysInFirstWeek > 7) intDaysInFirstWeek = intDaysInFirstWeek - 7;
    var intDaysInLastWeek   = (intDaysInMonth - intDaysInFirstWeek) % 7;
    if (intDaysInLastWeek == 0) intDaysInLastWeek = 7;
    var intWeeksInMonth     = 5;
    if (intDaysInFirstWeek == 7 && intDaysInLastWeek == 7)
    {
        intWeeksInMonth     =  4;
    }
    else if ((intDaysInFirstWeek + 28) < intDaysInMonth)
    {
        intWeeksInMonth     =  6;
    }
    var intNextDateToShow   = 1;
    var intFirstDayColumn   = 7 - intDaysInFirstWeek;

    // Create the objects
    var objNextDateRow      = document.createElement( 'TR' );

    // Write the blank cells in the first row
    for ( var intColIndex = 0; intColIndex < intFirstDayColumn; intColIndex++ )
    {
        // Create the objects
        var objDayCell  = document.createElement( 'TD' );
        objDayCell.appendChild( document.createTextNode( ' ' ) );

        // Format the day cell
        with ( objDayCell.style )
        {
            border      = '1px solid ' +strBorderColor;
            borderTop   = 'none';
            borderRight = 'none';
            color       = strBackgroundColor;
        }

        // Add cell to the days row
        objNextDateRow.appendChild( objDayCell );
    }

    // Write the date cells in the first row
    for ( var intColIndex = intFirstDayColumn; intColIndex < 7; intColIndex++ )
    {
        // Variables
        var intThisDate     = intNextDateToShow++;

        // Create the objects
        var objDayCell      = document.createElement( 'TD' );
        var objDateLinkText = document.createTextNode( intThisDate );

        // Setup the link
        objDayCell.onclick      = function() { intReturnDate = this.innerText; returnDate(); };
        objDayCell.onmouseover  = function() { this.style.background = strHighlightBackgroundColor; };
        objDayCell.onmouseout   = function() { this.style.background = ''; };

        // Determine whether the day is on the weekend
        var boolDayIsWeekend    = false;
        var dateThisDate        = new Date( intThisYear, intThisMonth, intThisDate );
        var intThisDay          = dateThisDate.getDay();
        for ( var intWeekendIntIndex = 0; intWeekendIntIndex < arrWeekendDays.length; intWeekendIntIndex++ )
            if ( arrWeekendDays[intWeekendIntIndex] == intThisDay ) boolDayIsWeekend = true;

        // Format the day cell
        with ( objDayCell.style )
        {
            fontFamily      = strBaseFont;
            padding         = '2px';
            paddingLeft     = '5px';
            paddingRight    = '5px';
            fontSize        = '10px';
            color           = ( boolDayIsWeekend ) ? strHighlightedTextColor : 'black';
            textAlign       = 'center';
            border          = '1px solid ' +strBorderColor;
            borderTop       = 'none';
            if ( intColIndex != 6 ) borderRight = 'none';
            cursor          = (is_ie5_5up) ? 'pointer' : 'hand';
        }

        // Add objects
        objDayCell.appendChild( objDateLinkText );
        objNextDateRow.appendChild( objDayCell );
    }

    // Add the row
    objTableBody.appendChild( objNextDateRow );

    // Create and add middle rows
    for (var intFullWeekRowIndex = 0; intFullWeekRowIndex < (intWeeksInMonth - 2); intFullWeekRowIndex++)
    {
        // Create the objects
        objNextDateRow      = document.createElement( 'TR' );

        // Write the date cells in the first row
        for ( var intColIndex = 0; intColIndex < 7; intColIndex++ )
        {
            // Variables
            var intThisDate     = intNextDateToShow++;

            // Create the objects
            var objDayCell      = document.createElement( 'TD' );
            var objDateLinkText = document.createTextNode( intThisDate );

            // Setup the link
            objDayCell.onclick      = function() { intReturnDate = this.innerText; returnDate(); };
            objDayCell.onmouseover  = function() { this.style.background = strHighlightBackgroundColor; };
            objDayCell.onmouseout   = function() { this.style.background = ''; };

            // Determine whether the day is on the weekend
            var boolDayIsWeekend    = false;
            var dateThisDate        = new Date( intThisYear, intThisMonth, intThisDate );
            var intThisDay          = dateThisDate.getDay();
            for ( var intWeekendIntIndex = 0; intWeekendIntIndex < arrWeekendDays.length; intWeekendIntIndex++ )
                if ( arrWeekendDays[intWeekendIntIndex] == intThisDay ) boolDayIsWeekend = true;

            // Format the day cell
            with ( objDayCell.style )
            {
                fontFamily      = strBaseFont;
                padding         = '2px';
                paddingLeft     = '5px';
                paddingRight    = '5px';
                fontSize        = '10px';
                color           = ( boolDayIsWeekend ) ? strHighlightedTextColor : 'black';
                textAlign       = 'center';
                border          = '1px solid ' +strBorderColor;
                borderTop       = 'none';
                if ( intColIndex != 6 ) borderRight = 'none';
                cursor          = (is_ie5_5up) ? 'pointer' : 'hand';
            }

            // Add objects
            objDayCell.appendChild( objDateLinkText );
            objNextDateRow.appendChild( objDayCell );
        }

        // Add the row
        objTableBody.appendChild( objNextDateRow );
    }

    // If final week required, show ...
    if (intNextDateToShow <= intDaysInMonth)
    {
        // Create the objects
        objNextDateRow      = document.createElement( 'TR' );

        // Write the date cells in the last row
        for ( var intColIndex = 0; intColIndex < intDaysInLastWeek; intColIndex++ )
        {
            // Variables
            var intThisDate     = intNextDateToShow++;

            // Create the objects
            var objDayCell      = document.createElement( 'TD' );
            var objDateLinkText = document.createTextNode( intThisDate );

            // Setup the link
            objDayCell.onclick      = function() { intReturnDate = this.innerText; returnDate(); };
            objDayCell.onmouseover  = function() { this.style.background = strHighlightBackgroundColor; };
            objDayCell.onmouseout   = function() { this.style.background = ''; };

            // Determine whether the day is on the weekend
            var boolDayIsWeekend    = false;
            var dateThisDate        = new Date( intThisYear, intThisMonth, intThisDate );
            var intThisDay          = dateThisDate.getDay();
            for ( var intWeekendIntIndex = 0; intWeekendIntIndex < arrWeekendDays.length; intWeekendIntIndex++ )
                if ( arrWeekendDays[intWeekendIntIndex] == intThisDay ) boolDayIsWeekend = true;

            // Format the day cell
            with ( objDayCell.style )
            {
                fontFamily      = strBaseFont;
                padding         = '2px';
                paddingLeft     = '5px';
                paddingRight    = '5px';
                fontSize        = '10px';
                color           = ( boolDayIsWeekend ) ? strHighlightedTextColor : 'black';
                textAlign       = 'center';
                border          = '1px solid ' +strBorderColor;
                if ( intColIndex != 6 ) borderRight = 'none';
                borderTop       = 'none';
                cursor          = (is_ie5_5up) ? 'pointer' : 'hand';
            }

            // Add objects
            objDayCell.appendChild( objDateLinkText );
            objNextDateRow.appendChild( objDayCell );
        }

        // Write the blank cells in the last row
        for ( var intColIndex = intDaysInLastWeek; intColIndex < 7; intColIndex++ )
        {
            // Create the objects
            var objDayCell  = document.createElement( 'TD' );
            objDayCell.appendChild( document.createTextNode( ' ' ) );

            // Format the day cell
            with ( objDayCell.style )
            {
                border      = '1px solid ' +strBorderColor;
                borderTop   = 'none';
                if ( intColIndex != 6 ) borderRight = 'none';
                color       = strBackgroundColor;
            }

            // Add cell to the days row
            objNextDateRow.appendChild( objDayCell );
        }

        // Add the row
        objTableBody.appendChild( objNextDateRow );
    }
}

function buildFooter()
{
    // ----------------
    // Today's Date Row
    // ----------------

    // Create the objects
    var objTodaysDateRow    = document.createElement( 'TR' );
    var objTodaysDateCell   = document.createElement( 'TD' );
    var objTodaysDateLink   = document.createElement( 'A' );

    // Set colspan
    objTodaysDateCell.colSpan   = 7;

    // Add today's Date
    var strTodayDateString  = 'Today : ' + intTodayDate + strTodayDateOrdinal + ' ' + arrFullMonthNames[ intTodayMonth ] + ' ' + intTodayYear;  // 'Today : 1st January 2000'
//  var strTodayDateString  = 'Today : ' + arrFullMonthNames[ intTodayMonth ] + ' ' + intTodayDate + ', ' + intTodayYear;                           // 'Today : January 1, 2000'
    var strTodaysDateLink   = document.createTextNode( strTodayDateString );
    objTodaysDateLink.appendChild( strTodaysDateLink );
    with ( objTodaysDateLink.style )
    {
        color           = 'black';
        textDecoration  = 'none';
    }
    objTodaysDateLink.href          = '#';
    objTodaysDateLink.onmouseover   = function() { this.style.color = strHighlightedTextColor };
    objTodaysDateLink.onmouseout    = function() { this.style.color = 'black' };
    objTodaysDateLink.onclick       = function() { returnDate( true ); return false; };
    objTodaysDateCell.appendChild( objTodaysDateLink );

    // Format cell
    with ( objTodaysDateCell.style )
    {
        fontFamily      = strBaseFont;
        textAlign   = 'center';
        fontSize    = '11px';
        fontWeight  = 'bold';
        paddingTop  = '5px';
    }

    // Append children
    objTodaysDateRow.appendChild( objTodaysDateCell );
    objTableFooter.appendChild( objTodaysDateRow );
}

function hideIfClickOutside()
{
    var bCalendarVisible    = ( objCalendar && objCalendar.style.display != 'none' );

    if ( bCalendarVisible )
    {
        var iCL = getXCoordinate( objCalendar ) - document.body.scrollLeft;
        var iCT = getYCoordinate( objCalendar ) - document.body.scrollTop;
        var iCR = iCL + objCalendar.offsetWidth;
        var iCB = iCT + objCalendar.offsetHeight;
        var iMX = intMouseX;
        var iMY = intMouseY;

        var bMouseOverCalendar  = (iMX >= iCL && iMX <= iCR && iMY >= iCT && iMY <= iCB);

        if ( !bMouseOverCalendar )
            hideCalendar();
    }
}

function hideCalendar()
{
    var arrAllSelects       = document.getElementsByTagName( 'SELECT' );

    // Hide calendar and shadow
    objCalendar.style.display   = 'none';
    objCalendarShadow.style.display = 'none';

    // Show all selects
    for ( var intSelectArrayIndex = 0; intSelectArrayIndex < arrAllSelects.length; intSelectArrayIndex++ )
    {
        var objSelectBox    = arrAllSelects[ intSelectArrayIndex ];
        objSelectBox.style.visibility = 'visible';
    }
}

function showCalendar()
{
    var arrAllSelects       = document.getElementsByTagName( 'SELECT' );

    // Show calendar and shadow
    objCalendar.style.display   = 'block';
    objCalendarShadow.style.display = 'block';

    // Resize/Reposition shadow
    with (objCalendarShadow.style)
    {
        width   = objCalendar.offsetWidth + 'px';
        height  = objCalendar.offsetHeight + 'px';
        left    = (getXCoordinate(objCalendar)+3) + 'px';
        top     = (getYCoordinate(objCalendar)+3) + 'px';
    }

    // Hide all selects that would otherwise show through (apart from the 'forceshow' ones)
    for ( var intSelectArrayIndex = 0; intSelectArrayIndex < arrAllSelects.length; intSelectArrayIndex++ )
    {
        var objSelectBox    = arrAllSelects[ intSelectArrayIndex ];
        var boolIsUnder     = isUnderCalendar( objSelectBox );
        var boolForceShow   = (objSelectBox.forceshow && objSelectBox.forceshow == 'forceshow');
        if (boolIsUnder && !boolForceShow)
            objSelectBox.style.visibility = 'hidden';
    }
}

function rebuild()
{
    var objChosenMonth      = objTableHeader.getElementsByTagName( "SELECT" )(0);   // This is not perfect, should be done with a name, but can't do at the moment
    var intChosenMonthValue = objChosenMonth.options[ objChosenMonth.selectedIndex ].value;
    intThisMonth = intChosenMonthValue;

    var objChosenYear       = objTableHeader.getElementsByTagName( "SELECT" )(1);   // This is not perfect, should be done with a name, but can't do at the moment
    var intChosenYearValue  = objChosenYear.options[ objChosenYear.selectedIndex ].value;
    intThisYear = intChosenYearValue;

    intFirstDayOfMonth      = getFirstDayOfMonth();
    buildCalendar();
    showCalendar();
}

function returnDate( boolReturnToday )
{
    if (boolReturnToday)
    {
        intThisMonth    = intTodayMonth;
        intThisYear     = intTodayYear;
        intReturnDate   = intTodayDate;
    }

    if (boolShowShortDates)
    {
        var strReturnDate   = intReturnDate + '-' + arrShortMonthNames[ intThisMonth ] + '-' + intThisYear;
    }
    else
    {
        var strReturnDate   = intReturnDate + '-' + arrFullMonthNames[ intThisMonth ] + '-' + intThisYear;
    }

    objDateBox.value    = strReturnDate;
    hideCalendar();
}

function backOneMonth()
{
    var objChosenMonth      = objTableHeader.getElementsByTagName( "SELECT" )(0);   // This is not perfect, should be done with a name, but can't do at the moment
    var objChosenYear       = objTableHeader.getElementsByTagName( "SELECT" )(1);   // This is not perfect, should be done with a name, but can't do at the moment

    if ( objChosenMonth.selectedIndex == 0 )
    {
        if (objChosenYear.selectedIndex != 0)
        {
            objChosenMonth.selectedIndex    = 11;
            objChosenYear.selectedIndex     = objChosenYear.selectedIndex - 1;
        }
        else
        {
            return false;
        }
    }
    else
    {
        objChosenMonth.selectedIndex    = objChosenMonth.selectedIndex - 1;
    }

    rebuild();
}

function forwardOneMonth()
{
    var objChosenMonth      = objTableHeader.getElementsByTagName( "SELECT" )(0);   // This is not perfect, should be done with a name, but can't do at the moment
    var objChosenYear       = objTableHeader.getElementsByTagName( "SELECT" )(1);   // This is not perfect, should be done with a name, but can't do at the moment

    if ( objChosenMonth.selectedIndex == 11 )
    {
        if ( objChosenYear.selectedIndex != (objChosenYear.options.length - 1) )
        {
            objChosenMonth.selectedIndex    = 0;
            objChosenYear.selectedIndex     = objChosenYear.selectedIndex + 1;
        }
        else
        {
            return false;
        }
    }
    else
    {
        objChosenMonth.selectedIndex    = objChosenMonth.selectedIndex + 1;
    }

    rebuild();
}

function isUnderCalendar( objSelectBox )
{
    var intCalendarLeft     = getXCoordinate( objCalendar );
    var intCalendarTop      = getYCoordinate( objCalendar );
    var intCalendarRight    = intCalendarLeft + objCalendar.offsetWidth;
    var intCalendarBottom   = intCalendarTop + objCalendar.offsetHeight;

    var intSelectLeft       = getXCoordinate( objSelectBox );
    var intSelectTop        = getYCoordinate( objSelectBox );
    var intSelectRight      = intSelectLeft + objSelectBox.offsetWidth;
    var intSelectBottom     = intSelectTop + objSelectBox.offsetHeight;

    var iCL = intCalendarLeft;
    var iCT = intCalendarTop;
    var iCR = intCalendarRight;
    var iCB = intCalendarBottom;

    var iSL = intSelectLeft;
    var iST = intSelectTop;
    var iSR = intSelectRight;
    var iSB = intSelectBottom;

    var boolReturnValue     = false;
 
    if (((iST >= iCT && iST <= iCB) && ((iSL >= iCL && iSL <= iCR) || (iSR >= iCL && iSR <= iCR))) || ((iSB >= iCT && iSB <= iCB) && ((iSL >= iCL && iSL <= iCR) || (iSR >= iCL && iSR <= iCR))))
    {
        boolReturnValue = true;
    }

    return boolReturnValue;
}

// -----------------
// General functions
// -----------------

function removeAllChildren( objParentElement )
{
    while ( objParentElement.childNodes.length > 0 )
        objParentElement.removeChild( objParentElement.firstChild );
}

function doNothing()
{
    // Do nothing
}

function returnFalse()
{
    return false;
}

function getXCoordinate( objSourceElement )
{
    var intReturnCoordinate = 0;

    while ( objSourceElement != null )
    {
        intReturnCoordinate += objSourceElement.offsetLeft;
        objSourceElement    = objSourceElement.offsetParent;
    }

    return intReturnCoordinate;
}

function getYCoordinate( objSourceElement )
{
    var intReturnCoordinate = 0;

    while ( objSourceElement != null )
    {
        intReturnCoordinate += objSourceElement.offsetTop;
        objSourceElement    = objSourceElement.offsetParent;
    }

    return intReturnCoordinate;
}

// --------------
// Date functions
// --------------

function getOrdinal( intCardinalNumber )
{
    var strCardinalNumber   = intCardinalNumber.toString();
    var strLastNumber       = strCardinalNumber.substr( strCardinalNumber.length-1 );
    var strOrdinal;

    switch( parseInt(strLastNumber) )
    {
        case( 1 ):
            strOrdinal = 'st';
            break;
        case( 2 ):
            strOrdinal = 'nd';
            break;
        case( 3 ):
            strOrdinal = 'rd';
            break;
        default:
            strOrdinal = 'th';
            break;
    }

    return strOrdinal;
}

function getFirstDayOfMonth()
{
    // Create first day Date
    var dateFirstDay    = new Date();
    dateFirstDay.setDate( 1 );
    dateFirstDay.setMonth( intThisMonth );
    dateFirstDay.setYear( intThisYear );

    // Retrieve first day
    return dateFirstDay.getDay();
}

function getDaysInMonth( intMonthNumber, intYearNumber )
{
    var intDaysInMonth = 32;

    switch( parseInt(intMonthNumber) )
    {
        case( 0 ):
        case( 2 ):
        case( 4 ):
        case( 6 ):
        case( 7 ):
        case( 9 ):
        case( 11 ):
            intDaysInMonth  = 31;
            break;
        case( 3 ):
        case( 5 ):
        case( 8 ):
        case( 10 ):
            intDaysInMonth  = 30;
            break;
        case( 1 ):
            intDaysInMonth  = 28;
            if (intYearNumber % 4 == 0) {
                if (intYearNumber % 100 == 0 && intYearNumber % 400 != 0) break;
                intDaysInMonth = 29;
            }
            break;
        default:
            intDaysInMonth  = 33;
            break;
    }

    return intDaysInMonth;
}

// -----
// Skins
// -----

function applySkin()
{
    switch( strSkinName )
    {
        case('webcat') :
            strBaseFont                     = 'Arial';
            strBackgroundColor              = '#DEF2F2';
            strBorderColor                  = '#336666';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#ca542c';
            strHighlightBackgroundColor     = '#8DE7E7';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = false;
            break;
        case('invoicegenerator') :
            strBaseFont                     = 'Arial';
            strBackgroundColor              = '#eeffee';
            strBorderColor                  = '#003300';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#ca542c';
            strHighlightBackgroundColor     = '#8DE7E7';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = true;
            break;
        case('blue') :
            strBaseFont                     = 'Arial';
            strBackgroundColor              = '#eeeeff';
            strBorderColor                  = '#003366';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#0000ff';
            strHighlightBackgroundColor     = '#8DE7E7';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = true;
            break;
        case('salesstats') :
            strBaseFont                     = 'Arial';
            strBackgroundColor              = 'white';
            strBorderColor                  = 'black';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#999999';
            strHighlightBackgroundColor     = '#eeeeee';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = true;
            break;
        case('rps') :
            strBaseFont                     = 'Arial';
            strBackgroundColor              = 'white';
            strBorderColor                  = '#013976';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#6393c1';
            strHighlightBackgroundColor     = '#e6ebf1';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = true;
            break;
         case('stl') :
            strBaseFont                     = 'arial';
            strBackgroundColor              = '#fff5fc';
            strBorderColor                  = '#336666';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#E7139F';
            strHighlightBackgroundColor     = '#FF66CC';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = false;
            break;
         case('cvh') :
            strBaseFont                     = 'tahoma';
            strBackgroundColor              = '#e4e9ef';
            strBorderColor                  = '#336666';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#E7139F';
            strHighlightBackgroundColor     = '#FFFF00';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 2005;     // The first year in the drop-down of years
            intLatestYear                   = 2007;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = true;     // true or false (no quotes)
            boolShowShortDates              = false;
            break;
        case('default') :
        default :
            strBaseFont                     = 'Arial';
            strBackgroundColor              = '#FFFFD0';
            strBorderColor                  = '#008080';
            strBorderType                   = 'solid';  // NOTE: If you choose outset or inset, border color must be empty string
            intBorderWidth                  = 1;
            strHighlightedTextColor         = '#9999FF';
            strHighlightBackgroundColor     = '#D9D954';
            arrDaysOfWeek                   = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];  // This must start with Sunday ... starting day of week can be altered below
            arrWeekendDays                  = [ 0, 6 ]; // Indexes of the days in the weekend, taken from the weekdays array
            arrShortMonthNames              = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
            arrFullMonthNames               = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
            intStartOfWeek                  = 1;        // This is the index of the 'arrDaysOfWeek' value that should start the week (zero indexed!)
            intEarliestYear                 = 1990;     // The first year in the drop-down of years
            intLatestYear                   = 2020;     // The last year in the drop-down of years
            boolHighlightWeekendDayNames    = false;    // true or false (no quotes)
            boolShowShortDates              = false;
            break;
    }
}
