function yearIndex(yearIdx){
/*
	var now = new Date(yearIdx);
	y = now.getFullYear();
	if (yearIdx == y) {
		ry = 0;
	}
	else if (yearIdx == (y+1)) {
		ry = 1;
	}
   return(ry);
*/
	return yearIdx - (new Date()).getFullYear();
}
function addDate(year, month, date, n){
    var leisure_number = n * 1000 * 60 * 60 * 24;
	var targetDate = new Date(year, month, date);
	var DateInMS = targetDate.getTime();
	DateInMS += leisure_number;
	targetDate.setTime(DateInMS);
	var theYear = targetDate.getFullYear();
	var theMonth = targetDate.getMonth();
	var theDate = targetDate.getDate();
    rdt  = new Date(theYear, theMonth, theDate);
    return(rdt);
}
function setDates(){

	leisure_nd = new Date();
    set_y = leisure_nd.getFullYear();
    set_m = leisure_nd.getMonth();
    set_d = leisure_nd.getDate();
    dt = addDate(set_y, set_m ,set_d, 0);
	//document.formName.paramName
	document.quick.ciDateY.selectedIndex = yearIndex(dt.getFullYear());
	document.quick.ciDateM.selectedIndex = dt.getMonth();
	document.quick.ciDateD.selectedIndex = dt.getDate()-1;
    dt2 = addDate(set_y, set_m ,set_d, 1);
	document.quick.coDateY.selectedIndex = yearIndex(dt2.getFullYear());
	document.quick.coDateM.selectedIndex = dt2.getMonth();
	document.quick.coDateD.selectedIndex = dt2.getDate()-1;
}
window.onload = setDates;

