﻿
jQuery.tools.validator.fn("[minlength]", function(input, value) {
	var min = input.attr("minlength");
	var type = "text";

	if( input.attr("elementType")  != undefined)
		{
			type =input.attr("elementType");
		}

 if(type=='number'){
	if(value.length >= min || value.length == 0){
		return true;
	}else{
		return {
			ar: "&nbsp;&nbsp;الرجاء إدخال " +min+ "  أرقام على الأقل "
		};
	}
 }
 if(type=='text'){
	 if(value.length >= min || value.length == 0){
			return true;
		}else{
			return {
				ar: "&nbsp;&nbsp;الرجاء إدخال " +min+ "  حروف على الأقل "
			};
		}
 }
});

jQuery.tools.validator.fn("[maxlength]", function(input, value) {
	var max = input.attr("maxlength");
	var type = "text";


	if( input.attr("elementType")  != undefined)
	{
		type =input.attr("elementType");
	}

	if(type=='number'){
	if(value.length <= max || value.length == 0){
		return true;
	}else{
		return {
			ar: "&nbsp;&nbsp;الرجاء إدخال " +max+ "  أرقام على الأكثر "

		};
	}
	}
	if(type=='text'){
		if(value.length <= max || value.length == 0){
			return true;
		}else{
			return {
				ar: "&nbsp;&nbsp;الرجاء إدخال " +max+ "  حروف على الأكثر "

			};
		}
	}
});

