function checkdate(question){
		question=question.name;
		if (question.indexOf("day")!=-1)
		{
			question=question.substr(0,question.indexOf("day"));
		}
		else if (question.indexOf("month")!=-1)
		{
			question=question.substr(0,question.indexOf("month"));
		}
		else if (question.indexOf("year")!=-1)
		{
			question=question.substr(0,question.indexOf("year"));
		}
		else
		{
			return;
		}
		
		var d = document.f[question+"day"];
		var m = document.f[question+"month"];
		var y = document.f[question+"year"];
		
		if (d.selectedIndex>0 && m.selectedIndex>0 && y.selectedIndex>0)
		{
			var days=daysm(m.options[m.selectedIndex].value,y.options[y.selectedIndex].value);
			
			var dd=Math.ceil(d.options[d.selectedIndex].value);
			
			while (dd>days)
			{
				d.selectedIndex--;
				dd--;
			}
		}
	}
	
	function daysm(m,y)
	{
		return Math.round((new Date(new Date(y,m,1).valueOf()-new Date(y,m-1,1).valueOf()).valueOf())/1000/60/60/24);
	}
	
	function datechecker() {
		var d = document.getElementById("day");
		var m = document.getElementById("month");
		var y = document.getElementById("year");
		
		if (d.selectedIndex>0 && m.selectedIndex>0 && y.selectedIndex>0)
		{
			var days=daysm(m.options[m.selectedIndex].value,y.options[y.selectedIndex].value);
			
			var dd=Math.ceil(d.options[d.selectedIndex].value);
			
			if (dd>days) {
				alert("Please enter a valid date");
				return false;
			} else {
				return true;
			}			
		} else {
			alert("Please enter a valid date");
			return false;
		}
		
		
		
	}