// JavaScript Document
function daysInMonth(dCtrlName,mCtrlName,yCtrlName){
	var intMonth = document.all(mCtrlName).options[document.all(mCtrlName).selectedIndex].value;
	var intYear = document.all(yCtrlName).options[document.all(yCtrlName).selectedIndex].value;
	var selIndex = document.all(dCtrlName).selectedIndex;
	
	var num_of_day = parseInt(32 - new Date(intYear, intMonth-1, 32).getDate());
	
	//--------------
	// Clear Item  |
	//--------------
	var Ctrl = document.all(dCtrlName);
			Ctrl.options.length = 0;

	//-----------------------
	// Add Item to DropDown |
	//-----------------------
	for (i=1; i<=num_of_day; i++){
		var opt = document.createElement("option");
		document.all(dCtrlName).options.add(opt);
		opt.text = i;
		opt.value = i;
	}
		document.all(dCtrlName).selectedIndex = selIndex;
}

function ValidateDate(FormName){
	var fd = document.all('fd').options[document.all('fd').selectedIndex].value;
	var fm = document.all('fm').options[document.all('fm').selectedIndex].value;
	var fy = document.all('fy').options[document.all('fy').selectedIndex].value;
	
	var td = document.all('td').options[document.all('td').selectedIndex].value;
	var tm = document.all('tm').options[document.all('tm').selectedIndex].value;
	var ty = document.all('ty').options[document.all('ty').selectedIndex].value;

	var from = new Date(fy, fm, fd);
	var to = new Date(ty, tm, td);
	

	if(from >= to){
		alert("From date Must < To date!");
		document.all(dCtrlName).fous();
	}else{
		document.all(FormName).submit();
	}
}