var today = new Date();
var day   = today.getDate();
var month = today.getMonth();
var year  = today.getFullYear();
var text_field = "";

function padout(number) { return (number < 10) ? '0' + number : number; }

function restart() {
    text_field.value = '' + padout(month - 0 + 1) + '/' + padout(day) + '/' + year;
    mywindow.close();
}

function newWindow(fieldname,evnt) {
    c_today = new Date();
    day = c_today.getDate();
    month = c_today.getMonth();
    year = c_today.getFullYear();
    text_field = fieldname;
    var properties = "left=" + (evnt.screenX + 20);
    properties += ",top=" + (evnt.screenY + 1);
    properties += ",titlebar=0,resizable=no,width=205,height=195";
    mywindow=open('cal.html','myname',properties);
    mywindow.location.href = 'cal.html';
    if (mywindow.opener == null) mywindow.opener = self;
    mywindow.focus();
}

