	var date_arr = new Array;
	var days_arr = new Array;
	
	date_arr[0]=new Option("January",31);
	date_arr[1]=new Option("February",28);
	date_arr[2]=new Option("March",31);
	date_arr[3]=new Option("April",30);
	date_arr[4]=new Option("May",31);
	date_arr[5]=new Option("June",30);
	date_arr[6]=new Option("July",31);
	date_arr[7]=new Option("August",30);
	date_arr[8]=new Option("September",30);
	date_arr[9]=new Option("October",31);
	date_arr[10]=new Option("November",30);
	date_arr[11]=new Option("December",31);
	
	function fill_select(datDefaultDate,strDateFieldId,strClass,strDisabled)
	{
		var curdate = new Date(datDefaultDate);		
		var month = curdate.getMonth();
		document.writeln("<select id=\"months_"+strDateFieldId+"\" name=\"months_"+strDateFieldId+"\" class=\""+strClass+"\" "+strDisabled+" onchange=\"update_days('"+datDefaultDate+"','"+strDateFieldId+"')\">");
	    for(x=0;x<12;x++){
	    	if(x==month){document.writeln("<option value=\""+(x+1)+"\" selected>"+date_arr[x].text);}
	   		else {document.writeln("<option value=\""+(x+1)+"\">"+date_arr[x].text);}
		}
	    document.writeln("</select>")
		document.writeln("<select id=\"days_"+strDateFieldId+"\" name=\"days_"+strDateFieldId+"\" class=\""+strClass+"\" "+strDisabled+" onchange=\"UpdateDateField('"+strDateFieldId+"')\"></select>");
	    selection=date_arr[document.getElementById("months_"+strDateFieldId).selectedIndex].value;
	}
	function update_days(datDefaultDate,strDateFieldId)
	{
		var curdate = new Date(datDefaultDate);
		var date = curdate.getDate();
	    temp=document.getElementById("days_"+strDateFieldId).selectedIndex; 
	    for(x=days_arr.length;x>0;x--){
	    	days_arr[x]=null;
	        document.getElementById("days_"+strDateFieldId).options[x]=null;
		}
		selection=date_arr[document.getElementById("months_"+strDateFieldId).selectedIndex].value;
	    ret_val = 0;
	    if(date_arr[parseInt(document.getElementById("months_"+strDateFieldId)[document.getElementById("months_"+strDateFieldId).selectedIndex].value)-1].value == 28){
		    year=parseInt(document.getElementById("years_"+strDateFieldId).options[document.getElementById("years_"+strDateFieldId).selectedIndex].value);
			if (year % 4 != 0 || year % 100 == 0 ){ret_val=0;}
	        else{
	        	if(year % 400 == 0){ret_val=1;}
	            else{ret_val=1;}
			}
	   	}
		selection = parseInt(selection) + ret_val;
		for(x=1;x<parseInt(selection)+1;x++){
	    	days_arr[x-1]=new Option(x);            
	        document.getElementById("days_"+strDateFieldId).options[x-1]=days_arr[x-1];
		 	document.getElementById("days_"+strDateFieldId).options[x-1].value=x;
	    } 
	    if (temp == -1){document.getElementById("days_"+strDateFieldId).options[date-1].selected=true;}
	    else {document.getElementById("days_"+strDateFieldId).options[temp].selected=true;}
		UpdateDateField(strDateFieldId);
	}       
	function year_install(datDefaultDate,strDateFieldId,strClass,strDisabled){
		var curdate = new Date(datDefaultDate);
		var year = curdate.getFullYear() - 2;
		document.writeln("<select name=\"years_"+strDateFieldId+"\" id=\"years_"+strDateFieldId+"\" class=\""+strClass+"\" "+strDisabled+" onchange=\"update_days('"+datDefaultDate+"','"+strDateFieldId+"')\">")
	    for(x=year;x<year+10;x++) {
			if(x==year+2) {document.writeln("<option value=\""+x+"\" selected>"+x);}
			else {document.writeln("<option value=\""+x+"\">"+x);}
		}
	   	document.writeln("</select>");
	    update_days(datDefaultDate,strDateFieldId);
	}
	function UpdateDateField(strDateFieldId) 
	{
		document.getElementById(strDateFieldId).value=document.getElementById("months_"+strDateFieldId).value+"/"+document.getElementById("days_"+strDateFieldId).options[document.getElementById("days_"+strDateFieldId).selectedIndex].value+"/"+document.getElementById("years_"+strDateFieldId).value;
	}
