BeneficiaryEnterprise.Models.Name=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return n.val==""||n.val.length<n.minLength||n.val.length>n.maxLength},r=function(){return/\d/.test(n.val)},u=function(){return/^([A-Za-z-'. /\s]+)$/.test(n.val)};return i()&&(this.errorMsg+="Must be "+this.minLength+" to "+this.maxLength+" characters.<br/>",t=!1),r()&&(this.errorMsg+="Must not contain a number.<br/>",t=!1),u()||(this.errorMsg+="Must contain at least one character.<br/>",t=!1),t}};BeneficiaryEnterprise.Models.ZipCode=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return n.val==""||n.val.length<n.minLength||n.val.length>n.maxLength},r=function(){return/^\d+$/.test(n.val)};return i()&&(this.errorMsg+="Must be "+this.maxLength+" numeric characters.<br/>",t=!1),r()||(this.errorMsg+="Must only contain numeric characters.<br/>",t=!1),t}};BeneficiaryEnterprise.Models.TricareID=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return/^(\d{9}|\d{11})$/.test(n.val)},r=function(){return/^\d+$/.test(n.val)};return i()||(this.errorMsg+="Must be length of "+n.minLength+" or "+n.maxLength+" numeric characters.<br/>",t=!1),r()||(this.errorMsg+="Must only contain numeric characters.<br/>",t=!1),t};this.validateLast4=function(){var n=this,t=!0,i=function(){return/^(\d{4})$/.test(n.val)},r=function(){return/^\d+$/.test(n.val)};return i()||(this.errorMsg+="Must be length of "+n.maxLength+" numeric characters.<br/>",t=!1),r()||(this.errorMsg+="Must only contain numeric characters.<br/>",t=!1),t}};BeneficiaryEnterprise.Models.Email=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.emailOneVal=n.emailOneVal;this.emailTwoVal=n.emailTwoVal;this.validate=function(){var n=this,t=!0,i=function(){return n.val==""||n.val.length<n.minLength||n.val.length>n.maxLength},r=function(){return/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(n.val)};return i()&&(this.errorMsg+="Must be between "+n.minLength+" and "+n.maxLength+" characters.<br/>",t=!1),r()||(this.errorMsg+="Email is invalid.<br/>",t=!1),t};this.compareEmail=function(){var n=this;return n.emailOneVal!=n.emailTwoVal?(this.errorMsg="Emails are not equal.<br/>",!1):!0}};BeneficiaryEnterprise.Models.Last4SSN=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return n.val==""||n.val.length<n.minLength||n.val.length>n.maxLength},r=function(){return/^\d+$/.test(n.val)};return i()&&(this.errorMsg+="Must be "+this.maxLength+" numeric characters.<br/>",t=!1),r()||(this.errorMsg+="Must only contain numeric characters.<br/>",t=!1),t}};BeneficiaryEnterprise.Models.Credentials=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.passwordOneVal=n.OneVal;this.passwordTwoVal=n.TwoVal;this.validate=function(){var n=this,t=!0,i=function(){return n.val===""||n.val.length<n.minLength||n.val.length>n.maxLength?!0:!1},r=function(){return/\d/.test(n.val)},u=function(){return/[A-Za-z]/.test(n.val)},f=function(){return/[\$\@\#\!\-\+\_\?]/.test(n.val)};return i()&&(this.errorMsg+="Must be length of "+n.minLength+" to "+n.maxLength+" characters. <br/>",t=!1),r()||(this.errorMsg+="Must have at least one number. <br/>",t=!1),u()||(this.errorMsg+="Must have at least one letter. <br/>",t=!1),f()||(this.errorMsg+="Must have one of the following characters: $ @ # ! - + _ ? <br/>",t=!1),t};this.comparePassword=function(){var n=this;return n.passwordOneVal!=n.passwordTwoVal?(this.errorMsg="Passwords are not equal. <br/>",!1):!0}};BeneficiaryEnterprise.Models.DateOfBirth=function(n){function t(n){var t=n.split("/"),i=new Date(t[2],t[0]-1,t[1]);return i&&i.getMonth()+1==t[0]}function i(n){return n.replace(/[\/\-\.]/g,"")}this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.checkMinor=n.checkMinor;this.errorMsg="";this.validate=function(){var n=this,i=!0,r=function(){return n.val===""||n.val.length<n.min||n.val.length>n.max},u=function(){return/[A-Za-z]/.test(n.val)},f=function(){return/^(\d{2})\/(\d{2})\/(\d{4})$/.test(n.val)?!0:!1},e=function(){return t(n.val)},o=function(){var r,u;if(n.checkMinor){var f=new Date,t=n.val.split("/"),e=new Date(t[2],t[0]-1,t[1]),i=f.getTime()-e.getTime();return i<0?!0:(r=new Date(i),u=Math.abs(r.getUTCFullYear()-1970),u<18)}return!1};return r()&&(this.errorMsg+="Must be length of "+n.maxLength+" characters.<br/>",i=!1),u()&&(this.errorMsg+="Date must not contain non numeric characters.<br/>",i=!1),f()||(this.errorMsg+="Please correct format to be MM/DD/YYYY.<br/>",i=!1),e()||(this.errorMsg+="Please enter a valid date.<br/>",i=!1),o()&&(this.errorMsg+="Date entered is less than 18 years.<br/>",i=!1),i};this.FormatDate=function(){var t=this,f=t.val,e,n;if(t.val=i(t.val),e=/^(0[1-9]|1[0-2]|[1-9])(\d{1,2})(\d{4})$/,n=t.val.match(e),n!=null){var r=parseInt(n[1]),u=parseInt(n[2]),o=parseInt(n[3]),s=r>9?r:"0"+r,h=u>9?u:"0"+u;f=s+"/"+h+"/"+o}return f}};BeneficiaryEnterprise.Models.UserID=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=function(){return n.val==""||n.val.length<n.val.minLength||n.val.length>n.val.maxLength},i=function(){return/^([a-zA-Z0-9]{6,25})$/.test(n.val)};return t()?(this.errorMsg="Must be between "+n.minLength+" and "+n.maxLength+" characters",!1):i()?!0:(this.errorMsg="User ID is invalid. Must be 6-25 letters and/or numbers. Must not contain special characters.",!1)}};BeneficiaryEnterprise.Models.PhoneNumber=function(n){this.length=n.length;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return/^(\d{10}|\(\d{3}\)\s*\d{3}\s*\-\s*\d{4}|\d{3}\s*\-\s*\d{3}\s*\-\s*\d{4})$/.test(n.val)},r=function(){return/^(\(\d{3}\)\s*|\d{3}\-|\d{3})\d{3}(\-|\s*)+\d{4}$/.test(n.val)},u=function(){return!/^[A-Za-z]+$/.test(n.val)};return i()||(this.errorMsg+="Must be length of "+n.length+"<br/>",t=!1),u()||(this.errorMsg+="Letters not allowed within the phone number <br/>",t=!1),r()||(this.errorMsg+="Phone number is not in the correct format. <br/>",t=!1),t};this.format=function(){for(var r=this,t=r.val.replace(/\D/g,""),u={0:"(",3:") ",6:" - "},i="",n=0;n<t.length;n++)i+=(u[n]||"")+t[n];return i}};BeneficiaryEnterprise.Models.TextConfirmNumber=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return n.val==""||n.val.length<n.minLength||n.val.length>n.maxLength},r=function(){return/^\d+$/.test(n.val)};return i()&&(this.errorMsg+="Must be "+this.maxLength+" numeric characters<br/>",t=!1),r()||(this.errorMsg+="Must only contain numeric characters.<br/>",t=!1),t}};BeneficiaryEnterprise.Models.CheckBox=function(n){this.checked=n.checked;this.errorMsg="";this.validate=function(){var n=this;return(_isChecked=function(){return n.checked==!0},!_isChecked())?(this.errorMsg="Please select the checkbox to proceed.<br/>",!1):!0}};BeneficiaryEnterprise.Models.DropDown=function(n){this.val=n.val;this.errorMsg="";this.validate=function(){var n=this;return(_isSelectedValue=function(){return n.val!=""},_isSelectedValue2=function(){return n.val!="Please select a category"},!_isSelectedValue())?(this.errorMsg="Please select an option.<br/>",!1):_isSelectedValue2()?!0:(this.errorMsg="Please select a category<br/>",!1)}};BeneficiaryEnterprise.Models.MessageBody=function(n){this.minLength=n.minLength;this.maxLength=n.maxLength;this.val=n.val;this.errorMsg="";this.validate=function(){var n=this,t=!0,i=function(){return n.val==""||n.val.length<n.minLength||n.val.length>n.maxLength};return i()&&(this.errorMsg+="Must be "+this.minLength+" to "+this.maxLength+" characters.<br/>",t=!1),t}};BeneficiaryEnterprise.Models.Files=function(n){this.maxNbrFiles=n.maxNbrFiles;this.maxFileSize=n.maxFileSize;this.maxTotalFileSize=n.maxTotalFileSize;this.allowedExtensions=n.allowedExtensions;this.ele=n.ele;this.errorMsg="";this.validate=function(){function e(n,t){return new RegExp("("+t.join("|").replace(/\./g,"\\.")+")$").test(n)}var n=this,t=!0,f=function(){var t=n.ele[0].files.length;return t>n.maxNbrFiles},o=/^[a-zA-Z0-9 .\-_]*$/,i=!1,r=!1,u=0,s=function(){for(var t=0;t<n.ele[0].files.length;++t)u+=n.ele[0].files[t].size,e(n.ele[0].files[t].name.toLowerCase(),n.allowedExtensions)||(i=!0),o.test(n.ele[0].files[t].name)||(r=!0)};return f()&&(this.errorMsg+="Must not select more than "+n.maxNbrFiles+" files.<br/>",t=!1),s(),u>n.maxTotalFileSize*1e6&&(this.errorMsg+="Total allowed size of all files exceeded.<br/>",t=!1),i&&(this.errorMsg+="A selected file has an invalid file type.<br/>",t=!1),r&&(this.errorMsg+="A selected file has an invalid character in its name.<br/>",t=!1),t}}