//<![CDATA[
/**
 * DateTime Helper Utility
 * Community    %COMMUNITY% (%ID%)
 * Updated      %YYYY-MM-DD%
 * @ID:/scripts/DateTimeUtility.js
 */
// ----------------------------------------------------------------
// Date, time, and other helper methods
// ----------------------------------------------------------------
// empty container for date string
var currentDate    = false;
var useCurrentDate = true;

function getCurrentDate()
{
    if (useCurrentDate) {
        if (!currentDate) {
            setCurrentDate();
        }
    }
    return currentDate;
}

/**
 * Checks state of global property useCurrentDate. If true, builds
 * a string date and assigns result to global property viewDate.
 */
function setCurrentDate()
{
    // array of day names
    var dayNames = new Array(
                     "Sunday"
                    ,"Monday"
                    ,"Tuesday"
                    ,"Wednesday"
                    ,"Thursday"
                    ,"Friday"
                    ,"Saturday"
                );

    // array of month names
    var monthNames = new Array(
                     "January"
                    ,"February"
                    ,"March"
                    ,"April"
                    ,"May"
                    ,"June"
                    ,"July"
                    ,"August"
                    ,"September"
                    ,"October"
                    ,"November"
                    ,"December"
                );

    // new date object
    var thisDate = new Date();

    // get the date tokens
    var thisYear  = thisDate.getFullYear();
    var thisMonth = parseInt(thisDate.getMonth() + 1);
    var thisDay   = thisDate.getDate();

    // build a formatted date string for the user view
    // currentDate = thisMonth + "-" + thisDay + "-" +  thisYear;
    currentDate = dayNames[thisDate.getDay()] + ", " + monthNames[thisDate.getMonth()] + " " + thisDate.getDate() + ", " +  thisYear;

}

/* -- END -- */
//]]>
