<!--

   function DoCal(elTarget) {
    var sRtn;
 
    if (window.showModalDialog){
     sRtn = window.showModalDialog("cal.htm","name","center=yes;dialogWidth=350pt;dialogHeight=200pt");
    } else {
     sRtn = window.open('cal.htm','name','height=255,width=450,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
    }
 

    if (sRtn!="") {
      elTarget.value = sRtn;
	  //d = Date.parse(sRtn);
	  //document.newform.year.value = lastmoddate.year();
	  
      //d = new Date(sRtn);
	  d = new Date(sRtn);
	  //d = Date.parse(sRtn);
     
	  //alert(d);
	  //alert(d.getDate());

	  document.newform.year.value = d.getFullYear();	  	  
	  document.newform.month.value = d.getMonth()+1;	  
      bookdaysmenu();	  	  
	  document.newform.day.value = d.getDate();	 

      if (document.newform.day.value > 0){
         document.newform.day.disabled = 0;
	  }	 
	  
	  } 
	else{
	  if ((document.newform.day.value < 0)||(document.newform.day.value == null)||(document.newform.day.value == '')){
         document.newform.day.disabled = 1;
	  }	 
	}  

 
 }



function bookdaysmenu()
{
	if (document.newform.month.options[document.newform.month.selectedIndex].value != "") 
	 {
 	        tempDay = document.newform.day.value;
			if (document.newform.day.disabled == 1) document.newform.day.disabled = 0;
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "1") { updatemenu(31); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "2") {
			 	checkyear = document.newform.year.options[document.newform.year.selectedIndex].value;
				if  (checkyear % 4 == 0) updatemenu(29); 
				else updatemenu(28);
			  }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "3") { updatemenu(31); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "4") { updatemenu(30); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "5") { updatemenu(31); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "6") { updatemenu(30); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "7") { updatemenu(31); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "8") { updatemenu(31); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "9") { updatemenu(30); }												
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "10") { updatemenu(31); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "11") { updatemenu(30); }
			 if (document.newform.month.options[document.newform.month.selectedIndex].value == "12") { updatemenu(31); }
             document.newform.day.value = tempDay;
			}
	}
	
	
	
function updatemenu(maxnum) {
	clear();		
	option1 = new Option("", '');
	document.newform.day.options[document.newform.day.length] = option1;
	for (i=1; i<=maxnum; i++) {

		option1 = new Option(i, i);
		document.newform.day.options[document.newform.day.length] = option1;		
		document.newform.day.selectedIndex = 0;
	}
}


function clear() {
	while(document.newform.day.length != 0) {
		document.newform.day.options[document.newform.day.length-1] = null;
	}
}


function setenddate()
{
	if ((document.newform.day.options[document.newform.day.selectedIndex].value != "") && (document.newform.month.options[document.newform.month.selectedIndex].value != "") &&  (document.newform.year.options[document.newform.year.selectedIndex].value != ""))
	{
		//newyear = parseFloat(document.newform.bookdays.value) + parseFloat(document.newform.year.value);
		//newmonth = parseFloat(document.newform.changemonth.value) + parseFloat(document.newform.month.value);
		newyear = parseFloat(document.newform.year.value);
		newmonth = parseFloat(document.newform.month.value);

		newday = parseFloat(document.newform.bookdays.value) + parseFloat(document.newform.day.value);		

		if (newmonth > 12) { 
			newyear += parseInt(newmonth / 12);
			newmonth = (newmonth % 12);
			}
		if (newmonth == "1") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
			
		if (newmonth == "2") {
			if  (newyear % 4 == 0) monthnum = 29;
			else monthnum = 28;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				} 
			}
			
		if (newmonth == "3") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
			
		if (newmonth == "4") {
			monthnum = 30;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
			
		if (newmonth == "5") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
			
		if (newmonth == "6") {
			monthnum = 30;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
		if (newmonth == "7") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}

		if (newmonth == "8") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
															
		if (newmonth == "9") {
			monthnum = 30;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
																
		if (newmonth == "10") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
														
		if (newmonth == "11") {
			monthnum = 30;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
													
		if (newmonth == "12") {
			monthnum = 31;
			if (newday > monthnum) {
				newmonth += 1;
				newday -= monthnum;
				}
			}
																																																								
		if (newmonth > 12) { 
			newyear += parseInt(newmonth / 12);
			newmonth = (newmonth % 12);
			}
		document.newform.endyear.value = newyear;
		document.newform.endday.value = newday;
		document.newform.endmonth.value = newmonth;		
		if (newmonth == "1") document.newform.endmonth2.value = "January";
		if (newmonth == "2") document.newform.endmonth2.value = "February";
		if (newmonth == "3") document.newform.endmonth2.value = "March";
		if (newmonth == "4") document.newform.endmonth2.value = "April";
		if (newmonth == "5") document.newform.endmonth2.value = "May";
		if (newmonth == "6") document.newform.endmonth2.value = "June";
		if (newmonth == "7") document.newform.endmonth2.value = "July";
		if (newmonth == "8") document.newform.endmonth2.value = "August";
		if (newmonth == "9") document.newform.endmonth2.value = "September";														
		if (newmonth == "10") document.newform.endmonth2.value = "October";
		if (newmonth == "11") document.newform.endmonth2.value = "November";		
		if (newmonth == "12") document.newform.endmonth2.value = "December";						
	}
	else 
	{ 
		document.newform.endyear.value = "-";
		document.newform.endmonth.value = "-";
		document.newform.endday.value = "-";
	}
}
<!--

function checkdate() {
	if (document.newform.month.options[document.newform.month.selectedIndex].value == "") 
	{ 
		document.newform.day.disabled = 1; 
	}
}


function changeinyear()
{	 
	if (document.newform.month.options[document.newform.month.selectedIndex].value == "2") {
			checkyear = document.newform.year.options[document.newform.year.selectedIndex].value;
			if  (checkyear % 4 == 0) updatemenu(29); 
			else updatemenu(28);
		}
}
	
-->