
var startY = 2007;
var endY   = new Date().getYear();
if (startY < 1900) startY += 1900; 
if (endY   < 1900) endY   += 1900; 


var yearL = Math.abs(endY - startY) + 1;
YearV=new Array(yearL);
YearN=new Array(yearL);
for(i = 0; i < yearL; i++){
	if (startY == Math.min(startY, endY)) {
		
		YearV[i] = startY + i;
		YearN[i] = startY + i;
	} else {
	
		YearV[i] = startY - i;
		YearN[i] = startY - i;
	}
}



MonthV = new Array(YearV.length);
MonthN = new Array(YearV.length);

m12 = new Array("01","02","03","04","05","06","07","08","09","10","11","12");


for(i = 0; i < YearV.length; i++){
	MonthV[i] = m12;
	MonthN[i] = m12;
}



function setMon(yearInit, monthInit, selectYear, selectMonth, selYear, selMonth){
	if (yearInit < 1900) yearInit += 1900; 
	selectYearN = -1;
	selectMonthN = -1;
	f = document.forms[1];

	
	if(selectYear != null && selectYear.length > 0) {
		yearInit = selectYear;
	}
	
	if(selectMonth != null && selectMonth.length > 0) {
		monthInit = selectMonth;
	}

	
	f[selYear].options.length = YearN.length;
	for(i = 0; i < YearN.length; i++){
		f[selYear].options[i].text = YearN[i];
		f[selYear].options[i].value = YearV[i];
		if(YearV[i] == yearInit){
			f[selYear].selectedIndex = i;
			selectYearN = i;
		}
	}
	if(selectYearN == -1){
		f[selYear].selectedIndex = 0
	}

	
	if(selectYearN != -1){
		f[selMonth].options.length = MonthN[selectYearN].length + 1;
		for(j = 0; j < MonthN[selectYearN].length; j++){
			f[selMonth].options[j+1].text = MonthN[selectYearN][j];
			f[selMonth].options[j+1].value = MonthV[selectYearN][j];
			if(MonthV[selectYearN][j] == monthInit){
				f[selMonth].selectedIndex = j + 1;
				selectMonthN = j;
			}
		}
	}else{
		f[selMonth].selectedIndex = 0;
	}

}
