var today = new Date();
var day   = today.getDate();
var month = today.getMonth();
var year  = y2k(today.getYear());
var destination;

function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
function padout(number) { return (number < 10) ? '0' + number : number; }
function newWindow(dest) {
	destination = dest;
	mywindow=open('/cal.htm','Calendar','resizable=no,width=350,height=280');

	if (mywindow.opener == null) mywindow.opener = self;
}
function refresh() {
  if (destination == 'date1') {
	document.form.date1.value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
  }
  if (destination == 'date2') {
	document.form.date2.value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
  }
  if (destination == 'date3') {
	document.form.date3.value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
  }

}
