function FormValidator(sForm) {
	if (!document.forms[sForm]) {
		alert('couldn\'t ccreate the form validator: No such form name');
		return false;
	}
	this.oForm = document.forms[sForm];
	return this;
};

FormValidator.prototype.sanitize = function(sName) {
	var sValue = this.oForm.sName.value;
	sValue = sValue.replace(/\'/gi,'\\\'');
	sValue = sValue.replace(/\//gi,'\\/');
	sValue = sValue.replace(/;/gi,'');
	this.oForm.sName.value = sValue;
};

FormValidator.prototype.isValidPassword = function(sName) {
	var sValue = this.oForm[sName].value;
	var regX = /^[a-zA-Z0-9]{6,15}$/;
	return regX.test(sValue);
};

FormValidator.prototype.validateMail = function(sName) {
	var sValue = this.oForm[sName].value;
	var regX = /^[a-zA-Z0-9\.\+\-\_]*@[a-z0-9\.\+\-\_]*\.[a-z\.]{2,10}$/i;
	return regX.test(sValue);
};

FormValidator.prototype.validatePhone = function(sName) {
	var sValue = this.oForm[sName].value;
	var regX = /^[0-9]{1,2}(\-|\s)?[0-9\s\-]{7,15}$/;
	return regX.test(sValue);
};

FormValidator.prototype.isFigures = function(sName) {
	var sValue = this.oForm[sName].value;
	var regX = /^\d*$/;
	return regX.test(sValue);
};

FormValidator.prototype.isTooShort = function(sName) {
	var sValue = this.oForm[sName].value;
	return (sValue.length <= 1);
};

FormValidator.prototype.isEmpty = function(sName) {
	var sValue = this.oForm[sName].value;
	return (sValue == '');
};

FormValidator.prototype.isBot = function (sName) {
	var sValue = this.oForm[sName].value;
	return (sValue != '');
};

FormValidator.prototype.isCurrency = function (sName) {
	var sValue = this.oForm[sName].value;
	var regX = /^\d*(\.\d\d)?$/;
	return regX.test(sValue);
};

FormValidator.prototype.isFitImage = function (sName) {
	var myImg = document.createElement('img');
	$('imgHolder').appendChild(myImg);
	myImg.src = this.oForm[sName].value;
	alert (myImg.height);
}

FormValidator.prototype.isValidFilename = function(sName) {
	var sValue = this.oForm[sName].value;
	var regX = /^[a-zA-Z0-9_\s\.\-]*$/;
	return regX.test(sValue);
}

FormValidator.prototype.displayError = function (sName, errMessage) {
	var sValue = this.oForm[sName].value;
	var oElement = this.oForm[sName];
	oElement.className += ' error';
	oElement.value = errMessage;
	/*var errBox = document.createElement('span');
	errBox.className = 'error';
	errBox.innerHTML = errMessage;
	errBox.id = sName + '_error';
	oElement.parentNode.appendChild(errBox);*/
	oElement.onclick = function () {
		oElement.className = oElement.className.replace(/\s?error/gi,'');
		oElement.value = "";
	}
};