function MM_validateForm(){var f,e,l,h,i,m,g="",k=MM_validateForm.arguments;j=0;var n=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/,o=/[^\s]/,p=/^([a-zA-Z][^\b]+)$/,q=/^([0-9][0-9][0-9]+-[0-9][0-9][0-9]+-[0-9][0-9][0-9][0-9])$/,r=/^([a-zA-Z0-9-+/_& :?;\n\r.,\']+)$/,t=/^([0-9_]+-[0-9][0-9]+-[0-9][0-9]+)$/;for(f=1;f<k.length-2;f+=3){mesg=k[f+1];i=k[f+2];if(val=document.forms[""+k[0]].elements[""+k[f]]){h=mesg;val=val.value;if(o.test(val))if(i.indexOf("isEqual")!=-1){result=trim(val);if(result.length==
0)g+="- "+h+" is required.\n";else{equal_obj_val=i.substring(8,i.indexOf(":"));mesg_string=i.substring(i.indexOf(":")+1);if(val!=document.forms[""+k[0]].elements[""+equal_obj_val].value)g+="- "+h+" must be same to "+mesg_string+".\n"}}else if(i.indexOf("isString")!=-1){result=trim(val);if(result.length==0)g+="- "+h+" is required.\n";else p.test(val)||(g+="- "+h+": Only Chars Allowed.\n")}else if(i.indexOf("isAlphaNum")!=-1){result=trim(val);if(result.length==0)g+="- "+h+" is required.\n";else r.test(val)||
(g+="- "+h+': Only Alpha Numeric and "_" Chars Allowed.\n')}else if(i.indexOf("isDate")!=-1){e=val.indexOf("-");if(e!=4)g+="- "+h+" must contain Valid Date YYYY-MM-DD.\n";else t.test(val)||(g+="- "+h+" must contain Valid Date YYYY-MM-DD.\n")}else if(i.indexOf("isPhone")!=-1){val.indexOf("-");q.test(val)||(g+="- "+h+" must contain Valid Phone Number xxx-xxx-xxxx\n")}else if(i.indexOf("isPassword")!=-1){val.indexOf("-");result=trim(val);if(result.length<5)g+="- "+h+" must contain must contain at least 5 characters\n"}else if(i.indexOf("isExtNew")!=
-1){pp=val.indexOf(".pdf");ss=val.indexOf(".doc");aa=val.indexOf(".PDF");bb=val.indexOf(".DOC");if((pp<1||pp==val.length-1)&&(ss<1||ss==val.length-1)&&(aa<1||aa==val.length-1)&&(bb<1||bb==val.length-1))g+="- "+h+" File should be in .doc, .pdf format!.\n"}else if(i.indexOf("isExt")!=-1){e=val.indexOf(".jpg");s=val.indexOf(".gif");l=val.indexOf(".jpeg");z=val.indexOf(".png");a=val.indexOf(".JPG");b=val.indexOf(".GIF");c=val.indexOf(".JPEG");d=val.indexOf(".PNG");if((e<1||e==val.length-1)&&(s<1||s==
val.length-1)&&(l<1||l==val.length-1)&&(z<1||z==val.length-1)&&(a<1||a==val.length-1)&&(b<1||b==val.length-1)&&(c<1||c==val.length-1)&&(d<1||d==val.length-1))g+="- "+h+" File should be in .jpg, .jpeg, .gif, .png format!.\n"}else if(i.indexOf("isEmail")!=-1){e=val.indexOf("@");s=val.indexOf(".");if(e<1||e==val.length-1)g+="- "+h+" must contain an e-mail Address.\n";else n.test(val)||(g+="- "+h+" must contain a valid e-mail Address.\n")}else if(i.indexOf("isUrl")!=-1){e=val.indexOf("http://");s=val.indexOf(".");
if(e<0||e==val.length-1)g+="- "+h+" must be valid URL e.g. http://www.abc.com\n";else if(s<e||s==val.length-1)g+="- "+h+" must be valid URL e.g. http://www.abc.com\n"}else if(i.indexOf("isChar")!=-1){e=val.charAt(0);if(e==0||e==1||e==2||e==3||e==4||e==5||e==6||e==7||e==8||e==9)g+="- "+h+" must starts with  a char.\n"}else if(i!="R"){result=trim(val);if(result.length==0)g+="- "+h+" is required.\n";if(isNaN(val))g+="- "+h+" must contain a number.\n";if(i.indexOf("inRange")!=-1){l=parseFloat(val);e=
i.indexOf(":");m=i.substring(8,e);e=i.substring(e+1);if(l<m||e<l)g+="- "+h+" must contain a number between "+m+" and "+e+".\n"}if(val.indexOf("-")!=-1)g+="- "+h+" must contain a number without dashes sign.\n";if(val.indexOf("+")!=-1)g+="- "+h+" must contain a number without plus sign.\n"}else{if(i.charAt(0)=="R"){result=trim(val);if(result.length==0)g+="- "+h+" is required.\n"}}else if(i.charAt(0)=="R")g+="- "+h+" is required.\n"}if(g!="")if(j<=0){focusitem=document.forms[""+k[0]].elements[""+k[f]];
j++}}if(g){alert("The following error(s) occurred:\n\n"+g);focusitem.focus();return false}else return true}function trim(f){if(typeof f!="string")return f;f=f;for(var e=f.substring(0,1);e==" ";){f=f.substring(1,f.length);e=f.substring(0,1)}for(e=f.substring(f.length-1,f.length);e==" ";){f=f.substring(0,f.length-1);e=f.substring(f.length-1,f.length)}for(;f.indexOf("  ")!=-1;)f=f.substring(0,f.indexOf("  "))+f.substring(f.indexOf("  ")+1,f.length);return f};
