<!-- Script by hscripts.com -->
function checkleapyear(datea)
{
	datea = parseInt(datea);

	if(datea%4 == 0)
	{
		if(datea%100 != 0)
		{
			return true;
		}
		else
		{
			if(datea%400 == 0)
				return true;
			else
				return false;
		}
	}
return false;
}
<!-- End Script by hscripts.com -->


function dateIsValid(theDate) {
	if(!(datePiece = theDate.split("/")) || datePiece.length != 3) { return false; }

	day=datePiece[1];
	month=datePiece[0];
	year=datePiece[2];

	if (isNaN(day) || isNaN(month) || isNaN(year)) { return false; }
	if (month < 1 || month > 12 || day < 1 || day > 31 || year.length != 4) { return false; }

	if (month % 2) {
		maxday=31;
	} else if (month == 2) {
		if(checkleapyear(year)) {
			maxday=29;
			}else{
			maxday=28;
		}
	} else {
		maxday=30;
	}
	if(day > maxday) { return false; }
	
	return true;
}


function isAlphaNumeric(userInput) {
	if(/[^a-zA-Z0-9]/.test(userInput)) {
			return false;
	}	
	return true;
}


function validateForm() {
	frm=document.frmSearch;

	if (frm.vdStart.value != "") {
		if(!(dateIsValid(frm.vdStart.value))) { 
			alert('Invalid start date.'); 
			frm.vdStart.focus();
			frm.vdStart.style.backgroundColor="#FFBFBF"
			frm.vdStart.value="";
			return false; 
		}
	}
	if (frm.vdEnd.value != "") {
		if(!(dateIsValid(frm.vdEnd.value))) { 
			alert('Invalid end date.'); 
			frm.vdEnd.style.backgroundColor="#FFBFBF"
			frm.vdEnd.focus();
			frm.vdEnd.value="";
			return false; 
		}
	}

	return true;
}