function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
function padout(number) { return (number < 10) ? '0' + number : number; }
function noy2k(number)    {
	tmp = ""+ number;
	tmp = tmp.substring(0,4);
	return tmp;
}

var whichOne = 0;
var today = new Date();
var day = today.getDate(), month = today.getMonth(), year = today.getYear(), whichOne = 0;

function restart() {
    document.getElementsByName("day")[whichOne].value = (day == null || day == '' ? '' : padout(day));
    document.getElementsByName("month")[whichOne].value = (month == null || (month == '' && month != 0) ? '' : padout(month - 0 + 1));
    document.getElementsByName("year")[whichOne].value = (year ==  null  || year == '' ? '' : noy2k(year));
    mywindow.close();
}

function newWindow(number,currentDay,currentMonth,currentYear,top,left) {
    whichOne = number;

    day = currentDay;
    month = currentMonth-1;
    year = currentYear;
    
    initDay = currentDay;
    initMonth = currentMonth-1;
    initYear = currentYear;
    winProlist= 'resizable=no,width=300,height=240,top=' + top + ',left=' + left;
    mywindow=open('/JFAM/en/cal/cal.htm','calendar',winProlist);
    mywindow.focus();
    if (mywindow.opener == null) mywindow.opener = self;
}

