function FormHelper()
{

	var me = this;
	
	this.validate_asZipcode = function(test1, errdisp, disp) {
		if(test1 == null) return false;
		var regx = '^([0-9]{5}(?:-[0-9]{4})?)*$';
		return me.validate_byRegExp(test1, regx, null, errdisp, disp);
	}
	
	this.validate_asEmail = function(test1, errdisp, disp) {
		if(test1 == null) return false;
		var regx = '[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?'
		return me.validate_byRegExp(test1, regx, null, errdisp, disp);
	}
	
	this.validate_byLength = function (test1, min, max, errdisp, disp) {
		if(test1.length < min || test1.length > max) {
			if(errdisp != null) errdisp.style.display = disp;
			return false;
		} else {
			if(errdisp != null) errdisp.style.display = 'none';
			return true;
		}
	}
	
	this.validate_byRegExp = function (test1, regex1, regex2, errdisp, disp) {
		if(test1 == null || regex1 == null) return false;
		regx = regex2 == null ? eval('/' + regex1 + '/') : eval('/' + regex1 + '/' + regex2);
		if(test1.search(regx) > -1) {
			if(errdisp != null) errdisp.style.display = 'none';
			return true;
		} else {
			if(errdisp != null) errdisp.style.display = disp;
			return false;
		}
	}
	
	this.validate_hasContent = function (test1, errdisp, disp) {
		if (test1 == '' || test1 == null) {
			if(errdisp != null) errdisp.style.display = disp;
			return false;
		} else {
			if(errdisp != null) errdisp.style.display = 'none';
			return true;
		}
	}
	
	this.validate_isEquivalent = function (test1, test2, errdisp, disp) {
		if(test1 == test2) {
			if(errdisp != null) errdisp.style.display = 'none';
			return true;
		} else {
			if(errdisp != null) errdisp.style.display = disp;
			return false;
		}
	}
	
	// Helper array for the following functions.
	var kctest1 = new Array(35, 37, 38, 39, 40, 46);
	
	this.textFieldLengthLimiter = function (event, test1, maxlength) {
		if(test1.length > (maxlength - 1)) {
			var kpe = event || window.event;
			var kc = kpe.charCode || kpe.keyCode;
			if(kc < 32) return true;
			for(var x = 0; x < 6; x++) {
				if(kc == me.kctest1[x]) return true;
			}
			return false;	
		}
		return true;
	}
	
	this.filterTextInputByChar = function (event, obj, chk) {
		var regx;
		var kpe = event || window.event;
		var kc = kpe.charCode || kpe.keyCode;
		if(kc < 32) return true;
		for(var x = 0; x < 6; x++) {
			if(kc == me.kctest1[x]) return true;
		}	
		var t = String.fromCharCode(kc);
		regx = eval('/' + chk + '/');
		if(t.search(regx) > -1) return true;
		return false;
	}
}