	// if month is 4, 6, 9 or 11, daysInMonth = 30. if month is 2, daysInMonth = 28. otherwise daysInMonth = 31
	var daysInMonth=(month==4 || month==6 || month==9 || month==11) ? 30 : (month==2) ? 28 : 31	
	
	for(j=1; j<=daysInMonth; j++){  // the number of options in the 2nd menu depends on the daysInMonth variable
	   if(j==date){  // if the counter is equal to today's date, var "sel" = "selected"
	   sel = "selected"
	   }
	   else{
	   sel = ""
	   }
	document.write("<option value="+j+" "+sel+">"+j+"\n")  // write each option
	}
