var today = new Date()
var day = today.getDate()
var month = today.getMonth()
var year = today.getYear()
var whichOne = ""

  function newCalWindow(field)
{    

	 whichOne = field;
	 eval("var thedate=document.EC_Form." + field +'.value')
	 if(thedate.length!=10){
    	day = today.getDate(), month = today.getMonth(), year = today.getYear();
	}else{
		var theday=thedate.slice(0,2)
		var themonth=thedate.slice(3,5)
		var theyear=thedate.slice(6,10)
		day = theday, month = (themonth*1)-1, year = theyear;
	}
    mywindow=open('cal.htm','Calendar','resizable=no,width=350,height=270');
    mywindow.location.href = 'cal.htm';
    if (mywindow.opener == null) mywindow.opener = self;
}

function padout(number) { return (number < 10) ? '0' + number : number; }
function restart() 
{
	//alert(whichOne)
	(month+1)
    document.EC_Form[whichOne].value =  day + '/' + padout(((month*1)+1)) + '/' + year
    mywindow.close();
}