/**
 * In The Name of Allah, The Most Gracious, The Most Merciful
 */
 // ? = Zero or One Time
 // + = One or More Times
 // * = Zero or More Times
var RegExpPatterns = {
	"STRING" : /./,
	"En_STRING" : /\w+/,
	"Fa_STRING" : /./,
	"NAME" : /./,
	"USERNAME" : /^[0-9a-zA-Z-_&#^!~]{5,15}$/,
	"PASSWORD" : /^[0-9a-zA-Z-_&#^!~]{5,15}$/,
	"EMAIL" : /^[\w-\.]+\@([a-zA-Z0-9\x60-\x69-_]+\.)+[a-zA-Z0-9\x60-\x69-_]{2,}$/,
	"URL" : /./,
	"FILE_PATH" : /./,
	"PATH" : /./,
	"NUMBER" : /^[-+]?[0-9\x60-\x69]+(\.[0-9\x60-\x69]*)?$/,
	"NONZERONUMBER" : /^[-+]?(([0\x60]*[1-9\x61-\x69]{1}[0-9\x60-\x69]*[\.]?[0\x60]+)|([0\x60]+[\.]?[0\x60]*[1-9\x61-\x69]{1}[0-9\x60-\x69]*)|([0\x60]*[1-9\x61-\x69]{1}[0-9\x60-\x69]*[\.]?[0\x60]*[1-9\x61-\x69]{1}[0-9\x60-\x69]*))$/,
	"NONNUMERIC" : /[^0-9\x60-\x69]+/,
	"PHONE_NUMBER" : /^[0-9\x60-\x69]+$/,
	"NATIONAL_CODE" : /./,
	"POSTAL_CODE" : /./,
	"HEXADECIMAL_RGB_COLOR_CODE" : /./,
	"ISBN" : /^[0-9\x60-\x69-]{4,}$/,
	"AGE" : /./,
	"DATE" : /^[0-9]{4}\/(([0]{1}[1-9]{1})|([1]{1}[0-2]{1}))\/(([0-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))$/,
	"YEAR" : /./,
	"MONTH" : /./,
	"DAY" : /./,
	"TIME" : /^[0-9\x60-\x69]{1,}:[0-5\x60-\x65]{1}[0-9\x60-\x69]{1}$/,
	"CLOCK" : /^(2[0-3\x60-\x63]{1}|[0-1\x60-\x61]{1}[0-9\x60-\x69]{1}):[0-5\x60-\x65]{1}[0-9\x60-\x69]{1}$/,
	"HOUR" : /./,
	"MINUTE" : /./,
	"SECOND" : /./,
	"PERCENT" : /^[%]?(100|[0-9\x60-\x69]{1,2}(\.[0-9\x60-\x69]*)?|[0\x60]+)$/,
	"NUMERICPERCENT" : /^(100|[0-9\x60-\x69]{1,2}(\.[0-9\x60-\x69]*)?|[0\x60]+)$/
};
function Validate(Value, Type, Force) {
	Force = ((typeof Force == 'string') && (trim(Force).toLowerCase != 'false')) || ((typeof Force != 'string') && Force !== false) ? true : false;
	Value = trim(Value);
//	$Value .= '';
	if (typeof RegExpPatterns[Type] != 'undefined')
	{
		if (RegExpPatterns[Type].test(Value))
		{
			return true;
		}
		else if (Force && !Value)
		{
			return -2; // Forced But Value Not Set
		}
		else if (Value)
		{
			return -1;// Not Forced But Value is Not Regular!
		}
		else if (!Value)
		{
			return 0; // Is Not Forced And Value is Not Set
		}
	}
	else
	{
//		return false;
		return true; // temporary for Compatibility return true!
	}
}