function leapYear (theyear) {
	if (((theyear % 4)==0) && ((theyear % 100)!=0) ||
		((theyear % 400)==0)) return true;
	else return false;
}

function setMonthday(theyear, themonth, theday,f) {
	_y = f.f_year_low; _m = f.f_month_low; _d = f.f_day_low;
	var monthday = new Array(31, (leapYear(theyear)? 29:28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	_d.options.length = themonth-1;
	theday = (theday > monthday[themonth-1])? monthday[themonth-1] : theday;
	_d.options[0] = new Option("-D-","");

	for(i=1;i<=monthday[themonth-1];i++) {
		eval("_d.options[i] = new Option(\"" + i + "\", \"" + ((i<10)?'0'+i:i) + "\", false, (theday==i)?true:false)");
	}
	_d.options[theday].selected = true;
}

function changeit(f) {
	_y = f.f_year_low; _m = f.f_month_low; _d = f.f_day_low;
	_theyear  = (_y.options[_y.selectedIndex].value!='')? _y.options[_y.selectedIndex].value : _y.options[1].value;
	_themonth = (_m.options[_m.selectedIndex].value!='')? _m.options[_m.selectedIndex].value : _m.options[1].value;
	_theday   = _d.selectedIndex;
	setMonthday(_theyear, _themonth, _theday,f);
}


function yearLstBox(name, prop, selYear, ServerCurrentYear){
	
	document.write("<select name='"+name+"' " + prop + " >")
	var dateobj = new Date();
	document.writeln('<option value="" '+ (selYear==''?' selected':'')+'>-Y-'); 
	if (ServerCurrentYear == null) 
	{
		curryear = dateobj.getYear()>1900?dateobj.getYear():dateobj.getYear()+1900;
	}
	else
	{
		curryear = ServerCurrentYear;
	}
	startYear=curryear-15;
	for(i=startYear;i>=curryear-50;i--)
		document.writeln("<option value=" + i + (selYear==i?' selected':'')+ ">" + i);
	document.write("</select>")
}			

function monthLstBox(name, prop, selMonth){
	document.write("<select name='"+name+"' " + prop + " >")
	document.writeln('<option value="" '+ (selMonth==''?' selected':'')+'>-M-'); 
	for(i=1;i<=12;i++) document.write("<option value=" + ((i<10)?'0'+i:i) + (selMonth==i?' selected':'')+ ">" + i);
	document.write("</select>")
}			

function dayLstBox(name, prop, selDay){
	document.write("<select name='"+name+"' " + prop + " >")
	document.writeln('<option value="" '+ (selDay==''?' selected':'')+'>-D-'); 
	for(i=1;i<=31;i++) document.write("<option value=" + ((i<10)?'0'+i:i) + (selDay==i?' selected':'') +  ">" + i);
	document.write("</select>")
}			

function yearAddLstBox(name, prop, selYear){
	
	document.write("<select name='"+name+"' " + prop + " >")
	var dateobj = new Date();
	document.writeln('<option value="" '+ (selYear==''?' selected':'')+'>-Y-'); 
	curryear = dateobj.getYear();
	nextyear = dateobj.getYear() + 1;

	document.writeln("<option value=" + curryear + (selYear==curryear?' selected':'')+ ">" + curryear);
	document.writeln("<option value=" + nextyear + (selYear==nextyear?' selected':'')+ ">" + nextyear);
	document.write("</select>")
}			

function hrsLstBox(name, prop, selHrs){
	document.write("<select name='"+name+"' " + prop + " >")
	var dateobj = new Date();
	document.writeln('<option value="" selected' + '>-Hrs-'); 
	for(i=0;i<24;i++) document.write("<option value=" + i + (selHrs==i+""?' selected':'')+ ">" + ((i<10)?'0'+i:i));
	document.write("</select>")
}			

function minLstBox(name, prop, selMin){
		
	document.write("<select name='"+name+"' " + prop + " >")
	var dateobj = new Date();

	document.writeln('<option value="" selected' + '>-Min-'); 
	for(i=0;i<60;i+=15) {document.write("<option value=" + i + (selMin==i+""?' selected':'')+ ">" + ((i<10)?'0'+i:i));

	}
	
	document.write("</select>")
}			