var Validator = new Class({

	// CONSTRUCTOR
	intitialize: function() {
		
	},
	
	// PUBLIC MEMBER FUNCTIONS
	validateInput: function(field, decoration) {
		var classes			= field.className.split(" ");
		var validatorClass	= classes[0];
		var styleClass		= classes[1];
		
		var isValid			= false;
		
		switch(validatorClass) {
			case "dom__validateString"	:	isValid = this.__validateString(field.value);
											break;
			case "dom__validateInteger"	:	isValid = this.__validateInteger(field.value);
											break;
			case "dom__validateEmail"	:	isValid = this.__validateEmail(field.value);
											break;
		}
		
		if(decoration == true) {
			styleClass 			= styleClass.replace(/Wide__ok/g, "Wide");
			styleClass 			= styleClass.replace(/Wide__notok/g, "Wide");
			styleClass 			= styleClass.replace(/Wide__active/g, "Wide");
			
			var newClass = (isValid == true) ?  validatorClass+" "+styleClass+"__ok" : validatorClass+" "+styleClass+"__notok";
				
			field.className = newClass;
		}
			
		if(isValid)
			return true;
		return false;
	},
	
	// PROTECTED MEMBER FUNCTIONS
	
	
	// PRIVATE MEMBER FUNCTIONS
	__validateString: function(value) {
		var string	= value;
		
		string		= string.replace(/^\s+/, "");
		string		= string.replace(/\s+$/, "");
		
		if(string.length > 0)
			return true;
		return false;
	},
	
	__validateInteger: function(value) {
		if(isNaN(value))
			return false;
		else if(value >= 1)
			return true;
		return false;
	},
	
	__validateEmail: function(value) {
		/*emailPattern = new RegExp(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/);
		if(emailPattern.test(value) == true)
			return true;
		return false;*/
		var string	= value;
		
		string		= string.replace(/^\s+/, "");
		string		= string.replace(/\s+$/, "");
		
		if(string.length > 0 && string.indexOf('@') > 0 && string.indexOf('.') > 0)
			return true;
		return false;
    }

});
