/*
 * Ext.form.Action.Submit.prototype.run =
 * Ext.form.Action.Submit.prototype.run.createInterceptor(function() {
 * this.form.items.each(function(item) { if (item.el.getValue() ==
 * item.emptyText) { item.el.dom.value = ''; } }); });
 * Ext.form.Action.Submit.prototype.run =
 * Ext.form.Action.Submit.prototype.run.createSequence(function() {
 * this.form.items.each(function(item) { if (item.el.getValue() == '' &&
 * item.emptyText) { item.el.dom.value = item.emptyText; } }); });
 * 
 */

Ext.apply(Ext.form.VTypes, {
	Zend_Validate_StringLengthText :"prea mic string sau prea mare :D",
	Zend_Validate_StringLength : function(val, field, options) {
			if((val=="" || val.length==0) && field.allowBlank){
			return true;
		}
		if (val.length < options.Min
				|| (options.Max && val.length > options.Max) ) {
			Ext.form.VTypes.Zend_Validate_StringLengthText = "Numar de caractere minim " + options.Min + " maxim " + options.Max;
			return false;
		}
		return true;
	},
	Zend_Validate_NotEmptyText :"not Empty",
	Zend_Validate_NotEmpty : function(val, field, options) {
		if (val.length <= 0) {
			return false;
		}
		return true;
	},
	Zend_Validate_AlnumText :"Not alphanumeric",
	Zend_Validate_Alnum : function(val, field, options) {
		return Ext.form.VTypes.alphanum(val);
	},
	Zend_Validate_EmailAddressText :"not Email",
	Zend_Validate_EmailAddress : function(val, field, options) {
		if((val=="" || val.length==0) && field.allowBlank){
			return true;
		}
		
		return Ext.form.VTypes.email(val);
	},
	Zend_Validate_BetweenText :"not between",
	Zend_Validate_Between : function(val, field, options) {
		if (val * 1 != val) {
			return false;
		}
		if (options.Inclusive) {
			if (options.Min > val || val > options.Max) {

				return false;
			}
		} else {
			if (options.Min >= val || val >= options.Max) {

				return false;
			}
		}
		return true;
	}

});
