// ----------------------------------------------------------------
//    Copyright e-point.S.A.
// ----------------------------------------------------------------

function validator() {
	this.is_email = function (value) {
		return /^[\w\-]+(\.[\w\-]+)*@[\w\-]+(\.[\w\-]+)*(\.[a-zA-Z]{2,4})$/.test(value);
	}
	this.is_zipcode = function (value) {
		return /^\d{2}-\d{3}$/.test(value);
	}
	this.is_notempty = function (value) {
		if ( (new string()).trim(value).length != 0 ) return true;
		return false;
	}
	this.is_empty = function (value) {
		if ( value.length == 0 ) return true;
		return false;
	}
	this.is_number = function (value) {
		return /^[0-9]+((,|\.)[0-9]+)?$/.test(value);
	}
	this.is_numberPL = function (value) {
		return /^[0-9]+(,[0-9]+)?$/.test(value);
	}
	this.is_numberEN = function (value) {
		return /^[0-9]+(\.[0-9]+)?$/.test(value);
	}
	this.is_price = function (value) {
		return /^[0-9]+(,[0-9]{1,2})?$/.test(value);
	}
	this.is_checked = function (field) {
		var l = field.length; 
		var oneChosen = false;

		for (i = 0; i<l; i++) { if (field[i].checked) { oneChosen = true; } }
		return oneChosen;
	}
}

var v = new validator();
