
function getMonthText(month) {
var m_names = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	mon = m_names[parseInt(month,10)]
	return mon
}
 
function getYear(UTCDate) {
  var yr = UTCDate.substr(0,4);
return yr;
}

function getMonth(UTCDate) {
  var mon = UTCDate.substr(5,2);
return mon;
}

function getDay(UTCDate) {
  var day = UTCDate.substr(8,2);
return day;
}

// Convert from the date format in the xml file and return a string of the form "Mon May 25 2009"
function convertToUTCDate(xmlDate) {

var uDate = new Date();
	 uDate.setFullYear(getYear(xmlDate),getMonth(xmlDate)-1,getDay(xmlDate));	//Format for setFullYear is yyyy,mm(0..11),dd
  
var str = uDate.toDateString();
  return str;
}

// Find the number of whole daye difference between today and some other date. Positive if other date is in the future.
function getDaysDifference(xmlOtherDate ) {

var todaysDate = new Date();
var otherDate = new Date();

// Convert date format in xml file to Javascript date format
	 otherDate.setFullYear(getYear(xmlOtherDate),getMonth(xmlOtherDate)-1,getDay(xmlOtherDate));	//Format for setFullYear is yyyy,mm(0..11),dd

// Subtract the dates and convert from mS
  var days_left = Math.round(((otherDate-todaysDate)/(24*3600*1000)));
  return days_left;
}
