function clear(node) {
	while (node.childNodes.length > 0) {
		node.removeChild(node.childNodes[0]);
	}
}

function replaceDates(fields, dates, prefix) {
	for (var x=0; x < fields.length; x++) {
		replaceDate(fields[x], dates[x], prefix);
	}
}
function replaceDate(fieldId, thisDate, prefix) {
	var months = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

	var field = document.getElementById(fieldId);
	clear(field);
	var thisDate = new Date(Date.parse(thisDate));

	var ampm = "am";
	var hour = thisDate.getHours();
	if (hour == 0) {
		hour = "12";
	} else if (hour > 12) {
		ampm = "pm";
		hour -= 12;
	}

	var minutes = thisDate.getMinutes();
	minutes=((minutes < 10) ? "0" : "") + minutes

	var seconds = thisDate.getSeconds()
	seconds=((seconds < 10) ? "0" : "") + seconds

	var dateStr = months[thisDate.getMonth()] + " " + thisDate.getDate() + ", " + thisDate.getFullYear() + " " + hour + ":" + minutes + ":" + seconds + ampm;
	field.appendChild(document.createTextNode(prefix + dateStr));
	/*
	var luckyday=new Date(Date.UTC(2008,7,8,(20 + offset ),8);
	document.write(" The 2008 Olympics starts at " + luckyday.toUTCString());
	*/
}

