
function makeArray()    
{
    this[0] = makeArray.arguments.length;
    for (i = 0; i<makeArray.arguments.length; i++)
        this[i+1] = makeArray.arguments[i];
}



var daysofweek   = new makeArray('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var monthsofyear = new makeArray('January','February','March','April','May','June','July','August','September','October','November','December');

function next_week(target_week_day)
{         
         date = new Date();
         
         day = date.getDate();
         month = date.getMonth();
         year = date.getFullYear();
         week_day = date.getDay();
         
         months = new Array('January',
                            'February',
                            'March',
                            'April',
                            'May',
                            'June',
                            'July',
                            'August',
                            'September',
                            'October',
                            'November',
                            'December');
                                    
         
         //This assumes that if today is a target week day,
         //today's date will be used and not next week's.
         //To change that, just change
         //if(week_day <= target_week_day)
         //to
         //if(week_day < target_week_day)
         
         if(week_day <= target_week_day)
            days_left = target_week_day - week_day;
         else
            days_left = 7 - (week_day - target_week_day);
         
         //This script works by finding out the number of days separating
         //the current date and the next target week day.
         next_week_day = new Date(year, month, day + days_left);
         
         //next_week_html = months[next_week_day.getMonth()] + " " + next_week_day.getDate() + ", " + next_week_day.getFullYear();
         next_week_html = daysofweek[target_week_day +1] + ", " +  months[next_week_day.getMonth()] + " " + next_week_day.getDate();
         
         return next_week_html;
                                              
         //document.write(next_week_html);
}

var g_nextSaturday = next_week(6); // Saturday
var g_nextTuesday = next_week(2); // Tuesday

//var g_nextSaturday = "Saturday, June 28";
