function setYear(yearInit, selYear){
	if (yearInit < 1900) yearInit += 1900; //FireFox用
	selectYNo = -1;
	f = document.forms[1];

	//セレクトボックス「年」欄に、配列YNの値をセットし、value値に配列YVの値をセットする。
	f[selYear].options.length = YN.length + 1;
	for(i = 0; i < YN.length; i++){
		f[selYear].options[i + 1].text = YN[i];
		f[selYear].options[i + 1].value = YV[i];
		if(YV[i] == yearInit){
			f[selYear].selectedIndex = i + 1;
			selectYNo = i;
		}
	}
	if(selectYNo == -1){
		f[selYear].selectedIndex = 0
	}
}

function setMonth(yearInit, monthInit, selectYear, selectMonth, selYear, selMonth){
	if (yearInit < 1900) yearInit += 1900; //FireFox用
	selectYNo = -1;
	selectMNo = -1;
	f = document.forms[1];

	// 初期以外の場合、選択した年を使用する
	if(selectYear != null && selectYear.length > 0) {
		yearInit = selectYear;
	}
	// 初期以外の場合、選択した月を使用する
	if(selectMonth != null && selectMonth.length > 0) {
		monthInit = selectMonth;
	}

	//セレクトボックス「年」欄に、配列YNの値をセットし、value値に配列YVの値をセットする。
	f[selYear].options.length = YN.length + 1;
	for(i = 0; i < YN.length; i++){
		f[selYear].options[i + 1].text = YN[i];
		f[selYear].options[i + 1].value = YV[i];
		if(YV[i] == yearInit){
			f[selYear].selectedIndex = i + 1;
			selectYNo = i;
		}
	}
	if(selectYNo == -1){
		f[selYear].selectedIndex = 0
	}

	//セレクトボックス「月」欄に、配列MNの値をセットし、value値にMVの値をセットする。
	if(selectYNo != -1){
		f[selMonth].options.length = MN[selectYNo].length + 1;
		for(j = 0; j < MN[selectYNo].length; j++){
			f[selMonth].options[j+1].text = MN[selectYNo][j];
			f[selMonth].options[j+1].value = MV[selectYNo][j];
			if(MV[selectYNo][j] == monthInit){
				f[selMonth].selectedIndex = j + 1;
				selectMNo = j;
			}
		}
	}else{
		f[selMonth].selectedIndex = 0;
	}

}

function setDate(yearInit, monthInit, dayInit, selYear, selMonth, selDay){
	if (yearInit < 1900) yearInit += 1900; //FireFox用
	selectYNo = -1;
	selectMNo = -1;
	selectDNo = -1;
	f = document.forms[1];

	//セレクトボックス「年」欄に、配列YNの値をセットし、value値に配列YVの値をセットする。
	f[selYear].options.length = YN.length + 1;
	for(i = 0; i < YN.length; i++){
		f[selYear].options[i + 1].text = YN[i];
		f[selYear].options[i + 1].value = YV[i];
		if(YV[i] == yearInit){
			f[selYear].selectedIndex = i + 1;
			selectYNo = i;
		}
	}
	if(selectYNo == -1){
		f[selYear].selectedIndex = 0
	}

	//セレクトボックス「月」欄に、配列MNの値をセットし、value値にMVの値をセットする。
	if(selectYNo != -1){
		f[selMonth].options.length = MN[selectYNo].length + 1;
		for(j = 0; j < MN[selectYNo].length; j++){
			f[selMonth].options[j+1].text = MN[selectYNo][j];
			f[selMonth].options[j+1].value = MV[selectYNo][j];
			if(MV[selectYNo][j] == monthInit){
				f[selMonth].selectedIndex = j + 1;
				selectMNo = j;
			}
		}
	}else{
		f[selMonth].selectedIndex = 0;
	}

	//セレクトボックス「日」欄に、配列DNの値をセットし、value値にDVの値をセットする。
	if(selectMNo != -1){
		f[selDay].options.length = DN[selectYNo][selectMNo].length + 1;
		for( k = 0; k < DN[selectYNo][selectMNo].length; k++){
			f[selDay].options[k + 1].text = DN[selectYNo][selectMNo][k];
			f[selDay].options[k + 1].value = DV[selectYNo][selectMNo][k];
			if(DV[selectYNo][selectMNo][k] == dayInit){
				f[selDay].selectedIndex = k + 1;
				selectDNo = k;
			}
		}
	}else{
		f[selDay].selectedIndex = 0;
	}

}

//年のセレクトボックスに空白がない場合
function setMonth2(yearInit, monthInit, selectYear, selectMonth, selYear, selMonth){
	if (yearInit < 1900) yearInit += 1900; //FireFox用
	selectYNo = -1;
	selectMNo = -1;
	f = document.forms[1];

	// 初期以外の場合、選択した年を使用する
	if(selectYear != null && selectYear.length > 0) {
		yearInit = selectYear;
	}
	// 初期以外の場合、選択した月を使用する
	if(selectMonth != null && selectMonth.length > 0) {
		monthInit = selectMonth;
	}

	//セレクトボックス「年」欄に、配列YNの値をセットし、value値に配列YVの値をセットする。
	f[selYear].options.length = YN.length;
	for(i = 0; i < YN.length; i++){
		f[selYear].options[i].text = YN[i];
		f[selYear].options[i].value = YV[i];
		if(YV[i] == yearInit){
			f[selYear].selectedIndex = i;
			selectYNo = i;
		}
	}
	if(selectYNo == -1){
		f[selYear].selectedIndex = 0
	}

	//セレクトボックス「月」欄に、配列MNの値をセットし、value値にMVの値をセットする。
	if(selectYNo != -1){
		f[selMonth].options.length = MN[selectYNo].length + 1;
		for(j = 0; j < MN[selectYNo].length; j++){
			f[selMonth].options[j+1].text = MN[selectYNo][j];
			f[selMonth].options[j+1].value = MV[selectYNo][j];
			if(MV[selectYNo][j] == monthInit){
				f[selMonth].selectedIndex = j + 1;
				selectMNo = j;
			}
		}
	}else{
		f[selMonth].selectedIndex = 0;
	}

}

//年のセレクトボックスに空白がない場合(年・月・日をセット)
function setDateNoBlank(yearInit, monthInit, dayInit, selYear, selMonth, selDay){
	if (yearInit < 1900) yearInit += 1900; //FireFox用
	selectYNo = -1;
	selectMNo = -1;
	selectDNo = -1;
	f = document.forms[1];

	//セレクトボックス「年」欄に、配列YNの値をセットし、value値に配列YVの値をセットする。
	f[selYear].options.length = YN.length;
	for(i = 0; i < YN.length; i++){
		f[selYear].options[i].text = YN[i];
		f[selYear].options[i].value = YV[i];
		if(YV[i] == yearInit){
			f[selYear].selectedIndex = i;
			selectYNo = i;
		}
	}
	if(selectYNo == -1){
		f[selYear].selectedIndex = 0
	}

	//セレクトボックス「月」欄に、配列MNの値をセットし、value値にMVの値をセットする。
	if(selectYNo != -1){
		f[selMonth].options.length = MN[selectYNo].length;
		for(j = 0; j < MN[selectYNo].length; j++){
			f[selMonth].options[j].text = MN[selectYNo][j];
			f[selMonth].options[j].value = MV[selectYNo][j];
			if(MV[selectYNo][j] == monthInit){
				f[selMonth].selectedIndex = j;
				selectMNo = j;
			}
		}
	}else{
		f[selMonth].selectedIndex = 0;
	}

	//セレクトボックス「日」欄に、配列DNの値をセットし、value値にDVの値をセットする。
	if(selectMNo != -1){
		f[selDay].options.length = DN[selectYNo][selectMNo].length;
		for( k = 0; k < DN[selectYNo][selectMNo].length; k++){
			f[selDay].options[k].text = DN[selectYNo][selectMNo][k];
			f[selDay].options[k].value = DV[selectYNo][selectMNo][k];
			if(DV[selectYNo][selectMNo][k] == dayInit){
				f[selDay].selectedIndex = k;
				selectDNo = k;
			}
		}
	}else{
		f[selDay].selectedIndex = 0;
	}

}


function changeYear(selYear,selMonth,selDay){
	f = document.forms[1];

	selectYNo = f[selYear].selectedIndex - 1;

	//セレクトボックス「月」の設定
	if(selectYNo == -1){
		f[selMonth].options.length = 1;
	}else{

		f[selMonth].options.length = MN[selectYNo].length + 1;

		for( j = 0; j < MV[selectYNo].length; j++){
			f[selMonth].options[j + 1].text = MN[selectYNo][j];
			f[selMonth].options[j + 1].value = MV[selectYNo][j];
		}
	}

	f[selMonth].selectedIndex = 0;

	//「日」の設定
	f[selDay].options.length = 1;
	f[selDay].selectedIndex = 0;

}


function changeMonth(selYear,selMonth,selDay){
	f = document.forms[1];

	selectYNo = f[selYear].selectedIndex - 1;
	selectMNo = f[selMonth].selectedIndex - 1;
	
	//セレクトボックス「日」の設定
	if(selectMNo == -1){
		f[selDay].options.length = 1;
	}else{
		f[selDay].options.length = DN[selectYNo][selectMNo].length + 1;
		for(j = 0; j < DV[selectYNo][selectMNo].length; j++){
			f[selDay].options[j + 1].text = DN[selectYNo][selectMNo][j];
			f[selDay].options[j + 1].value = DV[selectYNo][selectMNo][j];
		}
	}
	
	f[selDay].selectedIndex = 0;

}

//年・月のセレクトボックスに空白がない場合
function changeYearNoBlank(selYear,selMonth,selDay){
	f = document.forms[1];

	//selectYNo = f[selYear].selectedIndex - 1;
	selectYNo = f[selYear].selectedIndex;

	//セレクトボックス「月」の設定
	f[selMonth].options.length = MN[selectYNo].length;

	for( j = 0; j < MV[selectYNo].length; j++){
		f[selMonth].options[j].text = MN[selectYNo][j];
		f[selMonth].options[j].value = MV[selectYNo][j];
	}

	f[selMonth].selectedIndex = 0;

	//「日」の設定
	f[selDay].options.length = 1;
	f[selDay].selectedIndex = 0;

}

//年・月のセレクトボックスに空白がない場合
function changeMonthNoBlank(selYear,selMonth,selDay){
	f = document.forms[1];

	//selectYNo = f[selYear].selectedIndex - 1;
	//selectMNo = f[selMonth].selectedIndex - 1;
	selectYNo = f[selYear].selectedIndex;
	selectMNo = f[selMonth].selectedIndex;	

	//セレクトボックス「日」の設定
	f[selDay].options.length = DN[selectYNo][selectMNo].length;
	for(j = 0; j < DV[selectYNo][selectMNo].length; j++){
		f[selDay].options[j].text = DN[selectYNo][selectMNo][j];
		f[selDay].options[j].value = DV[selectYNo][selectMNo][j];
	}
	
	f[selDay].selectedIndex = 0;

}

function setDateForPaper1(yearPublicInit, monthPublicInit, dayPublicInit, selPublicYear, selPublicMonth, selPublicDay){
	if (yearPublicInit < 1900) yearPublicInit += 1900; //FireFox用
	selectYearsNo = -1;
	selectMonthNo = -1;
	selectDayNo = -1;
	forms = document.forms[1];

	//セレクトボックス「年」欄に、配列YearsNoの値をセットし、value値に配列YearsValueの値をセットする。
	forms[selPublicYear].options.length = YearsNo.length + 1;
	for(i = 0; i < YearsNo.length; i++){
		forms[selPublicYear].options[i + 1].text = YearsNo[i];
		forms[selPublicYear].options[i + 1].value = YearsValue[i];
		if(YearsValue[i] == yearPublicInit){
			forms[selPublicYear].selectedIndex = i + 1;
			selectYearsNo = i;
		}
	}
	if(selectYearsNo == -1){
		f[selPublicYear].selectedIndex = 0
	}

	//セレクトボックス「月」欄に、配列MonthNoの値をセットし、value値にMonthValueの値をセットする。
	if(selectYearsNo != -1){
		forms[selPublicMonth].options.length = MonthNo[selectYearsNo].length + 1;
		for(j = 0; j < MonthNo[selectYearsNo].length; j++){
			forms[selPublicMonth].options[j+1].text = MonthNo[selectYearsNo][j];
			forms[selPublicMonth].options[j+1].value = MonthValue[selectYearsNo][j];
			if(MonthValue[selectYearsNo][j] == monthPublicInit){
				forms[selPublicMonth].selectedIndex = j + 1;
				selectMonthNo = j;
			}
		}
	}else{
		f[selPublicMonth].selectedIndex = 0;
	}

	//セレクトボックス「日」欄に、配列DayNoの値をセットし、value値にDayValueの値をセットする。
	if(selectMonthNo != -1){
		forms[selPublicDay].options.length = DayNo[selectYearsNo][selectMonthNo].length + 1;
		for( k = 0; k < DayNo[selectYearsNo][selectMonthNo].length; k++){
			forms[selPublicDay].options[k + 1].text = DayNo[selectYearsNo][selectMonthNo][k];
			forms[selPublicDay].options[k + 1].value = DayValue[selectYearsNo][selectMonthNo][k];
			if(DayValue[selectYearsNo][selectMonthNo][k] == dayPublicInit){
				forms[selPublicDay].selectedIndex = k + 1;
				selectDayNo = k;
			}
		}
	}else{
		forms[selPublicDay].selectedIndex = 0;
	}

}

function setDateForPaper(yearInit, monthInit, dayInit, selYear, selMonth, selDay){
	if (yearInit < 1900) yearInit += 1900; //FireFox用
	selectYNo = -1;
	selectMNo = -1;
	selectDNo = -1;
	f = document.forms[1];

	//セレクトボックス「年」欄に、配列YNの値をセットし、value値に配列YVの値をセットする。
	f[selYear].options.length = YN.length + 1;
	for(i = 0; i < YN.length; i++){
		f[selYear].options[i + 1].text = YN[i];
		f[selYear].options[i + 1].value = YV[i];
		if(YV[i] == yearInit){
			f[selYear].selectedIndex = i + 1;
			selectYNo = i;
		}
	}
	if(selectYNo == -1){
		f[selYear].selectedIndex = 0
	}

	//セレクトボックス「月」欄に、配列MNの値をセットし、value値にMVの値をセットする。
	if(selectYNo != -1){
		f[selMonth].options.length = MN[selectYNo].length + 1;
		for(j = 0; j < MN[selectYNo].length; j++){
			f[selMonth].options[j+1].text = MN[selectYNo][j];
			f[selMonth].options[j+1].value = MV[selectYNo][j];
			if(MV[selectYNo][j] == monthInit){
				f[selMonth].selectedIndex = j + 1;
				selectMNo = j;
			}
		}
	}else{
		f[selMonth].selectedIndex = 0;
	}

	//セレクトボックス「日」欄に、配列DNの値をセットし、value値にDVの値をセットする。
	if(selectMNo != -1){
		f[selDay].options.length = DN[selectYNo][selectMNo].length + 1;
		for( k = 0; k < DN[selectYNo][selectMNo].length; k++){
			f[selDay].options[k + 1].text = DN[selectYNo][selectMNo][k];
			f[selDay].options[k + 1].value = DV[selectYNo][selectMNo][k];
			if(DV[selectYNo][selectMNo][k] == dayInit){
				f[selDay].selectedIndex = k + 1;
				selectDNo = k;
			}
		}
	}else{
		f[selDay].selectedIndex = 0;
	}

}
