var _version = 1.2;

_version = 1.3;

function makeDate() {
/*
  Format masks -- 
    M, MM:  Month in digit format
    MMM:  Three-letter abbreviation of month
    MMMM:  Month spelled out

    D:  Date without any leading zero
    DD:  Date with a leading zero, if applicable
    DDD:  Three-letter abbreviation for day of the week
    DDDD:  Weekday spelled out

    YY:  Two-digit year
    YYYY:  Four-digit year
  All masks preceded and followed by an underscore character (_).
*/
    var dateMask = (arguments.length == 1) ? arguments[0] : "_MMMM_ _D_, _YYYY_";
    // Define array of months
    var months=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    // Define weekdays
    var weekdays=new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    // Create date object and get the numeric values for month, day and year
    var today = new Date();
    // Weekday
    var da = today.getDay();
    // Month with and without leading zero.
    var m = today.getMonth();
    var mo = "0"+(m+1);
    mo = mo.substring(mo.length-2, mo.length);
    // Date with and without leading zero.
    var d = today.getDate();
    var dy = "0"+d;
    dy = dy.substring(dy.length-2, dy.length);
    // Use getYear on older browsers and getFullYear on newer browsers
    //      (getYear deprecated in favor of getFullYear as of JavaScript 1.2
    //      but used 1.3 as a cutoff based on Netscape documentation)
    var yr = (_version < 1.3) ?  today.getYear() : today.getFullYear();
    // Verify that a four digit year was returned and adjust if necessary 
    if (yr < 1900) yr += 1900;
    // If abbreviated year, add leading zero to make two digits, if necessary.
    var y = "0" + yr % 100;
    y = y.substring(y.length-2, y.length);
    //  Here's the fun part.  Replace the date mask specifications with the actual date.
    var date=dateMask;
    
    date=date.replace(/_YYYY_/g, yr);
    date=date.replace(/_YY_/g, y);
    date=date.replace(/_MMMM_/g, months[m]);
    date=date.replace(/_MMM_/g, months[m].substring(0, 3));
    date=date.replace(/_MM_/g, mo);
    date=date.replace(/_M_/g, m);
    date=date.replace(/_DDDD_/g, weekdays[da]);
    date=date.replace(/_DDD_/g, weekdays[da].substring(0, 3));
    date=date.replace(/_DD_/g, dy);
    date=date.replace(/_D_/g, d);
    
    return (date);
    }

