function valid_text(E,A,C,B){var D="";if(A&&((B==null)||(B==""))){D+="\nField '"+E+"' is empty";}if(B.match(/^(\s+)$/)){D+="\nField '"+E+"' contains only whitespace characters";}if(B.length>C){D+="\nField '"+E+"' is too long ("+C+" max)";}return D;}function valid_number(E,A,C,B){var D="";if(A&&((B==null)||(B==""))){D+="\nField '"+E+"' is empty";
}else{if(B.length>C){D+="\nField '"+E+"' is too long ("+C+" max)";}else{if(isNaN(B)){D+="\nField '"+E+"' must be numeric";}else{if(B.match(/\s/)){D+="\nField '"+E+"' must not contain whitespace";}}}}return D;}function valid_nonneg_integer_with_min(F,A,D,C,B){var E=valid_number(F,A,D,C);if(E==""&&C!=""){if(String(parseInt(C))!=String(C)){E+="\nField '"+F+"' must not have a decimal point or leading zeros";
}else{if(C<B){E+="\nField '"+F+"' must be an integer >= "+B;}}}return E;}function valid_natural_number(D,A,C,B){return valid_nonneg_integer_with_min(D,A,C,B,0);}function valid_positive_integer(D,A,C,B){return valid_nonneg_integer_with_min(D,A,C,B,1);}function valid_date(K,F,A){var E=10;var H=valid_text(K,F,E,A);
if(A!=null&&A!=""){var D=A.substr(0,4);var J=A.substr(4,1);var C=A.substr(5,2);var G=A.substr(7,1);var I=A.substr(8,2);var B=new Date(D,C-1,I);if(isNaN(parseInt(D))||isNaN(parseInt(C))||isNaN(parseInt(I))||J!="-"||G!="-"||B==null||D!=B.getFullYear()||C!=B.getMonth()+1||I!=B.getDate()){H+="\nField '"+K+"' is invalid";
}}return H;}function valid_url(E,A,C,B){var D=valid_text(E,A,C,B);if(B!=null&&B!=""){if(!B.match(/^http:\/\/|^\/[a-zA-Z0-9_\.,\/\?=-]+$/)){D+="\nField '"+E+"' is invalid URL";}}return D;}function valid_url_absolute(E,A,C,B){var D=valid_url(E,A,C,B);if(B!=null&&B!=""){if(!B.match(/^http:\/\//)){D+="\nField '"+E+"' is invalid (not absolute URL)";
}}return D;}function valid_url_relative(E,A,C,B){var D=valid_url(E,A,C,B);if(B!=null&&B!=""){if(!B.match(/^\//)){D+="\nField '"+E+"' is invalid (not relative URL)";}}return D;}function valid_email(E,A,C,B){var D=valid_text(E,A,C,B);if(B!=null&&B!=""){if(B.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){D+="\nField '"+E+"' is an invalid E-mail address";
}}return D;}
