


calendar = new Date();

this_year = calendar.getFullYear();

min_month = 1;
max_month = 12;
this_month = calendar.getMonth()+1;

min_date = 1;
max_date = 31;
this_date = calendar.getDate();



function showYear(adjust) {
	
	var aYear = adjust;
	
	for (var i=this_year;i<=this_year+1;i++) {		
		if (i == aYear) {
			document.write ('<option selected="selected" value="'+i+'">'+i+'</option>');
		} else {
			document.write ('<option value="'+i+'">'+i+'</option>');
		}
	}
		
}


function showMonth(adjust) {
	
	var aMonth = adjust;
	
	for (var i=min_month;i<=max_month;i++) {
		if (i == aMonth ) {
			document.write ('<option value="'+i+'" selected="selected" >'+i+'</option>');	
		} else {
			document.write ('<option value="'+i+'" >'+i+'</option>');	
		}
	}
	
}


function showDate(adjust) {
	
	var aDate = adjust;
	
	for(var i=min_date;i<=max_date;i++) {
		if(i == aDate) {
			document.write ('<option value="'+i+'" selected="selected">'+i+'</option>');
		} else {
			document.write ('<option value="'+i+'">'+i+'</option>');
		}
	}
	
}


function showCalc(adjust,yID,mID,dID,yName,mName,dName) {
	
	var adjustDate = this_date + adjust;
	var aDate = adjustDate;
	var aMonth = this_month;
	var aYear = this_year;
	
	if (adjustDate > max_date) {
		aDate = adjustDate - max_date;
		
		aMonth = this_month + 1;
		if(aMonth > max_month) {
			aMonth = aMonth - max_month;
			aYear = this_year + 1;
		}
	}


	document.write ('<select id="'+yID+'" name="'+yName+'">');
	showYear(aYear);
	document.write ('</select>');
	
		
	document.write ('<select id="'+mID+'" name="'+mName+'">');
	showMonth(aMonth);
	document.write ('</select>');
			
			
	document.write ('<select id="'+dID+'" name="'+dName+'">');
	showDate(aDate)
	document.write ('</select>');
	
	
}





