function checkDate(strDate) {
	
	var monthsOf30Days = " 4 6 9 11 "
	var monthsOf31Days = " 1 3 5 7 8 10 12 "
	var startIndex = 0;
	
	if(strDate == "")
		return false;
	
	//Take out any Time elements
	strDate = strDate.slice(0, strDate.indexOf(" ", 0));
		
	//Check month
	var endIndex = strDate.indexOf("/");
	if(endIndex == -1) 
		return false;	//not a valid date
	var iMonth = new Number(strDate.substring(startIndex, endIndex));
	if(isNaN(iMonth))
		return false;
	if(iMonth < 1 || iMonth > 12)
		return false;
	
	//Check Day
	startIndex = ++endIndex;
	endIndex = strDate.indexOf("/", startIndex);
	if(endIndex == -1) 
		return false;	//not a valid date
	var iDay = strDate.substring(startIndex, endIndex);
	if(isNaN(iDay))
		return false;
	if(iDay < 1)
		return false;
	
	//Check if the day is valid for months with thirty days
	if((monthsOf30Days.indexOf(" " + iMonth + " ") >= 0 ) && iDay > 30)
		return false;
	
	//Check if the day is valid for months with thirty-one days
	if((monthsOf31Days.indexOf(" " + iMonth + " ") >= 0) && iDay > 31)
		return false;
		
	//Check Year (need year to check February)
	startIndex = ++endIndex;
	var iYear = strDate.substring(startIndex);
	if(isNaN(iYear))
		return false;
	if(iYear < 00 || iYear > 9999)
		return false;
	
	//Check for February 28 days and Leap year with 29 days
	if(iMonth == 2) { //if Feb
		if((iDay > 28) && ((iYear % 4) != 0)) // day greater than 28 not a leap year
			return false;
		if(iDay > 29 ) //if it is a leap year and the day is greater than 29 kill it
			return false;
	}
	
	return true;
}

function fillDate(objDateText) {
	
	if(!((typeof objDateText) == "undefined")) {
		var strDate = new String(objDateText.value); 
		if(strDate.indexOf("/") == -1) {
			var theDate = new Date();
			var strDate = (theDate.getMonth() + 1) + "/";
			strDate += theDate.getDate() + "/";
			var sYear = theDate.getYear();
			if(sYear < 1900)
				sYear += 1900;
			strDate += sYear;
			objDateText.value = strDate;
		}
	}
}


function checkEmail(objEmail) {

	if(objEmail.value == "") { 
		alert("An Email Address is required");
		objEmail.focus();
		return false;
	}
	
	var sEmail = objEmail.value
	if(sEmail.indexOf("@") == -1) {
		alert("A valid Email Address requires an '@' symbol");
		objEmail.focus();
		return false;
	}
	
	if(sEmail.indexOf(".") == -1) {
		alert("A valid Email Address requires a '.xxx' extention");
		objEmail.focus();
		return false;
	}
	
	if(sEmail.indexOf(" ") > -1) {
		alert("A valid Email Address should not contain spaces");
		objEmail.focus();
		return false;
	}
	return true;
}

function checkEmailStr(sEmail) {

	if(sEmail.indexOf("@") == -1) {
		alert("This Email Address requires an '@' symbol\r" + sEmail);
		return false;
	}
	
	if(sEmail.indexOf(".") == -1) {
		alert("This Email Address requires a '.xxx' extention\r" + sEmail);
		return false;
	}

	if(sEmail.indexOf(" ") > -1) {
		alert("This Email Address should not contain spaces\r" + sEmail);
		return false;
	}
	return true;
}

function checkBlank(val2check) {
	if(val2check == "")
		return false;
	return true;
}

function checkNumber(num2check){

	if(!checkBlank(num2check))
		return false;

	if(isNaN(num2check))
		return false;
	return true;
}
