 // various date utilities
var months =new Array (
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December" );

var twelveHours =12*60*60*1000;
var oneDay = 2*twelveHours;

function shiftDay(d,i){
// assumes time of day is nowhere near midnight
// as there would be problems re summer/winter time with 23/25 hour days.
    return new Date(oneDay*i + d*1); // ensure numeric argument
}
function baseDay(d){  // the start of the week containing d , the preceding Sunday
    return shiftDay(d, -(d.getDay()))
}
function monthName(d){
    return months[d.getMonth()];
}
function dateNum(d){
    return d.getDate();
}
function shortName(longtext){
    return longtext.substr(0,3).toLowerCase();
}
function twoDigitDate(xdate){
    if (xdate >9) {return "" + xdate} else {return "0" + xdate};
}
