
calendar = new Date();

this_year = calendar.getFullYear();

defYear = this_year;

min_month = 1;
max_month = 12;
this_month = calendar.getMonth()+1;

defMonth = this_month;

min_day = 1;
max_day = 31;
this_day = calendar.getDate();

defDay = this_day+3;

if (defDay > max_day) {
	defDay = defDay - max_day;
	
	defMonth = defMonth+1;
	if (defMonth > max_month) {
		defMonth = 1;
		defYear++;
	}
}



function yearList() {
	for (i=this_year;i<=this_year+1;i++) {
		if (i == defYear) {
			document.write ('<option value="'+i+'" selected="selected" >'+i+'</option>');	
		} else {
			document.write ('<option value="'+i+'" >'+i+'</option>');	
		}
	}
}



function monthList() {
	for (i=min_month;i<=max_month;i++) {
		if (i == defMonth ) {
			if (i < 10) {
				i2 = "0"+i;	
			} else {
				i2 = i;	
			}
			document.write ('<option value="'+i+'" selected="selected" >'+i2+'</option>');	
		} else {
			if (i < 10) {
					i2 = "0"+i;	
			} else {
				i2 = i;	
			}
			document.write ('<option value="'+i+'" >'+i2+'</option>');	
		}
	}
}



function dayList() {
	for(i=min_day;i<=max_day;i++) {
		if(i == defDay) {
			if (i < 10) {
				i2 = "0"+i;	
			} else {
				i2 = i;	
			}
			document.write ('<option value="'+i+'" selected="selected">'+i2+'</option>');
		} else {
			if (i < 10) {
				i2 = "0"+i;	
			} else {
				i2 = i;	
			}
			document.write ('<option value="'+i+'">'+i2+'</option>');
		}
	}
}



function hourList(defTime) {
	for(i=0;i<=23;i++) {
		if(i == defTime) {
			if (i < 10) {
				i2 = "0"+i;	
			} else {
				i2 = i;	
			}
			document.write ('<option value="'+i+'" selected="selected">'+i2+'</option>');
		} else {
			if (i < 10) {
				i2 = "0"+i;	
			} else {
				i2 = i;	
			}
			document.write ('<option value="'+i+'">'+i2+'</option>');
		}
	}
}



function minuteList() {
	for(i=0;i<=1;i++) {
		if(i == 0) {
			i2 = "0"+i;
			document.write ('<option value="'+i+'" selected="selected">'+i2+'</option>');
		} else {
			i2 = i*30;	
			document.write ('<option value="'+i2+'">'+i2+'</option>');
		}
	}
}




function showDateForm(gr) {

	switch (gr) {
		
		case 'go':
			
			document.write('<select name="year1">');
			yearList();
			document.write('</select>年');
			
			
			document.write('<select name="month1">');
			monthList();
			document.write('</select>月');
			
			
			
			document.write('<select name="day1">');
			dayList();
			document.write('</select>日');
			
			
			
			document.write('<select name="hour1">');
			hourList(9);
			document.write('</select>時');
			
			
			
			document.write('<select name="minute1">');
			minuteList();
			document.write('</select>分');
			
		break;
		
		
		case 'rt':

			document.write('<select name="year2">');
			yearList();
			document.write('</select>年');
			
			
			document.write('<select name="month2">');
			monthList();
			document.write('</select>月');
			
			
			
			document.write('<select name="day2">');
			dayList();
			document.write('</select>日');
			
			
			
			document.write('<select name="hour2">');
			hourList(19);
			document.write('</select>時');
			
			
			
			document.write('<select name="minute2">');
			minuteList();
			document.write('</select>分');
			
		break;
	
	
	}
}
















