	function FormChecker()
	{
		this.isEmpty = FormChecker_isEmpty;
		this.isNumeric = FormChecker_isNumeric;
		this.isInRange = FormChecker_isInRange;
		this.isDate = FormChecker_isDate;
		this.isYear = FormChecker_isYear;	
		this.isMonth = FormChecker_isMonth;	
		this.isDay = FormChecker_isDay;
		this.isEmail = FormChecker_isEmail;
	}
	
	function FormChecker_isEmpty(value)
	{
		emptyExp = /^\s*$/;
		return (emptyExp.test(value));
	}
	
	function FormChecker_isNumeric(value)
	{
		numericExp = /^\d*$/;
		return (numericExp.test(value));
	}

	function FormChecker_isInRange(value, min, max)
	{
		return (value >= min && value <= max);
	}

	function FormChecker_isDate(value, format)
	{
		dayReplace = /d+/g;
		monthReplace = /m+/g;
		yearReplace = /y+/g;

		dateExpStr = format;

		// change day-placeholder to regexp
		while (result = dayReplace.exec(dateExpStr))
		{
			dateExpStr = dateExpStr.replace(dayReplace, "(\\w{"+result[0].length+"})");
		}

		// change month-placeholder to regexp
		while (result = monthReplace.exec(dateExpStr))
		{
			dateExpStr = dateExpStr.replace(monthReplace, "(\\w{"+result[0].length+"})");
		}

		// change year-placeholder to regexp
		while (result = yearReplace.exec(dateExpStr))
		{
			dateExpStr = dateExpStr.replace(yearReplace, "(\\w{"+result[0].length+"})");
		}

		dateExpStr = "^" + dateExpStr + "$"	;
		
		// split format and value
		dateExp = new RegExp(dateExpStr);
		formatArray = dateExp.exec(format);
		valueArray = dateExp.exec(value);

		if (formatArray && valueArray)
		{
			// validate day, month and year values
			for (i=1; i<formatArray.length; i++)
			{
				if (formatArray[i].length == valueArray[i].length)
				{
					if (formatArray[i].substr(0, 1) == "d")
						day = valueArray[i];
					else if (formatArray[i].substr(0, 1) == "m")
						month = valueArray[i];
					else if (formatArray[i].substr(0, 1) == "y")
						year = valueArray[i];
				}
				else
					return false;
			}
		}
		else
			return false;

		return (this.isYear(year) && this.isMonth(month) && this.isDay(day, month, year));
	}
	
	function FormChecker_isYear(value)
	{
		yearExp = /^\d{1,4}$/;
		return (yearExp.test(value));
	}
	
	function FormChecker_isMonth(value)
	{
		monthName = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
		monthExp = /^\d{1,2}$/;
		
		found = false;
		i = 0;
		while (i<12 && !found)
		{
			if (monthName[i] == value)
				found = true;
			else
				i++;
		}
		
		return (found || (monthExp.test(value) && this.isInRange(value, 1, 12)));
	}
	
	function FormChecker_isDay(value, month, year)
	{
		daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
		
		dayExp = /^\d{1,2}$/;
		return (dayExp.test(value) && this.isInRange(value, 1, daysInMonth[month-1] + ((year%4==0 && month==2)?1:0)));
	}

	function FormChecker_isEmail(value)
	{
		emailExp = /^\w+@\w+.\w+$/;
		return (emailExp.test(value));
	}
