function get_days(y,w,v,x,p,q,r)
	{
	if (w)
		{
		the_days = eval("document." + x + "." + v + "_day");
		if (p==0)
			{
			the_month = eval("document." + x + "." + v + "_month").length;
			z = the_days.length-1;
			}
		else
			{
			the_month = eval(p-1);
			u = eval("document." + x + "." + v + "_month[the_month]");
			u.selected = true;
			z = eval(q-1);
			}
		}
	else
		{
		the_month = eval("document." + x + "." + v + "_month.selectedIndex");
		the_days = eval("document." + x + "." + v + "_day");
		z = eval("document." + x + "." + v + "_day.selectedIndex");
		r = eval("document." + x + "." + v + "_year").options[eval("document." + x + "." + v + "_year").selectedIndex].value;
		}
	
	if (y=="month" || (y=="year" && the_month==1))
		{
		leap_year=false;
		if (r%4 == 0)
			{
			leap_year=true;
			}
		the_days.length=0
		if (the_month==0 || the_month==2 || the_month==4 || the_month==6 || the_month==7 || the_month==9 || the_month==11)
			{
			mlength=31
			for (var i=0; i<mlength; i++)
				{
				the_days.options[i]=new Option(eval(i+1))
				the_days.options[i].value = eval(i+1)
				}
			the_days.options[31]=new Option("")
			the_days.options[31].value = 0
			}
		else if (the_month==3 || the_month==5 || the_month==8 || the_month==10)
			{
			mlength=30
			for (var i=0; i<mlength; i++)
				{
				the_days.options[i]=new Option(eval(i+1))
				the_days.options[i].value = eval(i+1)
				}
			the_days.options[30]=new Option("")
			the_days.options[30].value = 0
			}
		else if (the_month==1 && leap_year==true)
			{
			mlength=29
			for (var i=0; i<mlength; i++)
				{
				the_days.options[i]=new Option(eval(i+1))
				the_days.options[i].value = eval(i+1)
				}
			the_days.options[29]=new Option("")
			the_days.options[29].value = 0
			}
		else if (the_month==1 && leap_year==false)
			{
			mlength=28
			for (var i=0; i<mlength; i++)
				{
				the_days.options[i]=new Option(eval(i+1))
				the_days.options[i].value = eval(i+1)
				}
			the_days.options[28]=new Option("")
			the_days.options[28].value = 0
			}
		else
			{
			mlength=31;
			for (var i=0; i<mlength; i++)
				{
				the_days.options[i]=new Option(eval(i+1))
				the_days.options[i].value = eval(i+1)
				}
			the_days.options[31]=new Option("")
			the_days.options[31].value = 0
			}
		if (p != 0 && eval(z+1)>mlength)
			{
			z=0
			}
		}
	for (f=0; f<eval("document." + x + "." + v + "_year").length; f++)
		{
		if (eval("document." + x + "." + v + "_year").options[f].value == r)
			{
			eval("document." + x + "." + v + "_year").options[f].selected = true;
			break;
			}
		}
	// this prevents a Netscape quirk
	the_days.options[z].selected=true;
	}
function load_date(a,x)
	{
	the_date = new Date();
	the_month = the_date.getMonth()+1;
	the_year = the_date.getYear();
	if (navigator.appName=="Netscape") the_year = the_year + 1900
	the_day = the_date.getDate();

	for (i=0; i<eval("document." + x + "." + a + "_year.length"); i++)
		{
		if (eval("document." + x + "." + a + "_year.options[i].value")==the_year) break
		}
	b = eval("document." + x + "." + a + "_year.options[i]");
	b.selected = true;
	
	for (i=0; i<eval("document." + x + "." + a + "_month.length"); i++)
		{
		if (eval("document." + x + "." + a + "_month[i].value")==the_month) break
		}
	c = eval("document." + x + "." + a + "_month[i]");
	c.selected = true;
	
	get_days('month', false, a)

	for (i=0; i<eval("document." + x + "." + a + "_day.length"); i++)
		{
		if (eval("document." + x + "." + a + "_day[i].value")==the_day) break
		}
	d = eval("document." + x + "." + a + "_day[i]");
	d.selected = true;
	}


