(function(n){"use strict";function t(n){return parseFloat(n.replace(/\,/g,""))}function i(n){var t="";return n.lastIndexOf(".")!==-1&&(t=n.slice(0,n.lastIndexOf("."))+"."),t}function r(n){return n.replace(/\./g,"_")}function u(t){var i=t.replace("_","."),r=n("input[name='"+t+"']");return r.is("input:radio")?n("input:radio[name='"+i+"']:checked").val():n("#"+t).val()}n.validator.methods.number=function(n,i){return n=t(n),this.optional(i)||!isNaN(n)};n.validator.methods.range=function(n,i,r){return n=t(n),this.optional(i)||n>=r[0]&&n<=r[1]};n.validator.addMethod("date",function(n){if(n!=="")return/^(?:(?![0-9][0-9]\/[0-9][0-9][0-9])(?:(?![0-9][0-9][0-9])[0-9](?:(?![0-9][0-9])[0-9]?))(?:(?:(?!\/\/)\/?)(?:(?![0-9][0-9][0-9]\/)[0-9]?[0-9]?))(?:(?:(?!\/\/)\/?))(?:(?![0-9][0-9][0-9][0-9][0-9])[0-9]?[0-9]?[0-9]?[0-9]?))$/i.test(n);return!0});n.validator.unobtrusive.adapters.addBool("date");n.validator.addMethod("emailaddress",function(n){return/^(?:^[\-a-z0-9`~!@#$%^&*_=+{}|'\/?](?:(?!\.\.|@@)[\-a-z0-9`~!@#$%^&*_=+{}|'.\/?])*$)$/i.test(n)});n.validator.unobtrusive.adapters.addBool("emailaddress");n.validator.addMethod("enforcechecked",function(t,i){return n(i).is(":checked")});n.validator.unobtrusive.adapters.add("enforcechecked",[],function(n){n.rules.enforcechecked=n.params;n.message&&(n.messages.enforcechecked=n.message)});n.validator.addMethod("enforcecheckedif",function(t,i,r){if(n(i).is(":checked"))return!0;var f=u(r.otherproperty);return f.toString().toLowerCase()!==r.otherpropertyvalue.toString().toLowerCase()?!0:!1});n.validator.unobtrusive.adapters.add("enforcecheckedif",["otherproperty","otherpropertyvalue"],function(n){n.rules.enforcecheckedif={otherproperty:n.params.otherproperty,otherpropertyvalue:n.params.otherpropertyvalue};n.messages.enforcecheckedif=n.message});n.validator.addMethod("lifeinsuredid",function(n){return/^(Life|Child)[1-9]{1}$/.test(n)});n.validator.unobtrusive.adapters.addBool("lifeinsuredid");n.validator.addMethod("multilinetext",function(n){return/^[\-a-z0-9`~!@#$%^&*()_=+;:"',.\/?\s]*$/i.test(n)});n.validator.unobtrusive.adapters.addBool("multilinetext");n.validator.addMethod("noneoftheabove",function(t,u,f){if(n(u).prop("checked")){var e=!1,o=i(u.name),s=r(o),h=f.otherproperties.split(",");if(n.each(h,function(t,i){var r=n("#"+s+i);r.prop("checked")&&(e=!0)}),e)return!1}return!0});n.validator.unobtrusive.adapters.add("noneoftheabove",["otherproperties","value"],function(n){n.rules.noneoftheabove={otherproperties:n.params.otherproperties,value:n.params.value};n.messages.noneoftheabove=n.message});n.validator.addMethod("noneoftheaboverequired",function(t,u,f){if(n(u).prop("checked")===!1){var e=!0,o=i(u.name),s=r(o),h=f.otherproperties.split(",");if(n.each(h,function(t,i){var r=n("#"+s+i);r.prop("checked")&&(e=!1)}),e)return!1}return!0});n.validator.unobtrusive.adapters.add("noneoftheaboverequired",["otherproperties","value"],function(n){n.rules.noneoftheaboverequired={otherproperties:n.params.otherproperties,value:n.params.value};n.messages.noneoftheaboverequired=n.message});n.validator.addMethod("personname",function(n){return/^[\-a-z0-9()',. ]*$/i.test(n)});n.validator.unobtrusive.adapters.addBool("personname");n.validator.addMethod("phonenumber",function(n){return n===""?!0:/^(?:^[0-9(+](?:(?!--|  |\(\(|\)\)|\+\+|\.\.)[\-0-9()+. ])*[e]?[x]?[t]?[.]?[#]?[*]?[ ]?[0-9]*$)$/i.test(n)});n.validator.unobtrusive.adapters.addBool("phonenumber");n.validator.addMethod("requiredif",function(t,i,r){var f,e;return n(i).is("input:checkbox")?!0:(f=u(r.otherproperty),n(i).is("input:radio"))?n("input:radio[name='"+i.name+"']").is(":checked")?!0:f.toString().toLowerCase()!==r.otherpropertyvalue.toString().toLowerCase()?!0:!1:(e=n.trim(n(i).val()),e!==null&&e!=="")?!0:f.toString().toLowerCase()!==r.otherpropertyvalue.toString().toLowerCase()?!0:!1});n.validator.unobtrusive.adapters.add("requiredif",["otherproperty","otherpropertyvalue"],function(n){n.rules.requiredif={otherproperty:n.params.otherproperty,otherpropertyvalue:n.params.otherpropertyvalue};n.messages.requiredif=n.message});n.validator.addMethod("residencystatus",function(n){return/^(Citizen\/Permanent resident|Work permit|Long-term business visa|Other)*$/i.test(n)});n.validator.unobtrusive.adapters.addBool("residencystatus");n.validator.addMethod("singlelinetext",function(n){return/^[\-a-z0-9`~!@#$%^&*()_=+;:"',.\/? ]*$/i.test(n)});n.validator.unobtrusive.adapters.addBool("singlelinetext");n.validator.addMethod("title",function(n){return/^(Mr|Mrs|Miss|Ms|Other)*$/i.test(n)});n.validator.unobtrusive.adapters.addBool("title");n.validator.addMethod("yesno",function(t,i){return n(i).val()=="Yes"||n(i).val()=="No"});n.validator.unobtrusive.adapters.addBool("yesno")})(jQuery)