(function(n){n.getAntiForgeryToken=function(n,t){var u,f,i,r;for(n=n&&typeof n==typeof window?n:window,t=t&&typeof t=="string"?"_"+t.toString():"",u="__RequestVerificationToken"+t,f=n.document.getElementsByTagName("input"),i=0;i<f.length;i++)if(r=f[i],r.type==="hidden"&&r.name===u)return{name:u,value:r.value}};n.getAntiForgeryTokenObject=function(){var i={},t=n.getAntiForgeryToken();if(t)return i[t.name]=t.value,i};n.appendAntiForgeryToken=function(t,i){return t&&typeof t!="string"&&(t=n.param(t)),i=i?i:n.getAntiForgeryToken(),t=t?t+"&":"",i?t+encodeURIComponent(i.name)+"="+encodeURIComponent(i.value):t};n.postAntiForgery=function(t,i,r,u){var f=n.getAntiForgeryToken();return i==null&&(i={}),i[f.name]=f.value,n.post(t,i,r,u)};n.postFileAntiForgery=function(t,i,r){var u=n.getAntiForgeryToken();return i==null&&(i={}),i.append(u.name,u.value),n.ajax({url:t,type:"POST",success:r,error:function(n){gcr.core.dialog.custom.displayAlertDialog("Unexpected error","An error has occurred, please try again","type-error");console.log(n)},data:i,cache:!1,contentType:!1,processData:!1})};n.ajaxAntiForgery=function(t){var i=t.token?t.token:n.getAntiForgeryToken(t.tokenWindow,t.appPath);return t.data=n.appendAntiForgeryToken(t.data,i),n.ajax(t)}})(jQuery),function(n){n.fn.exists=function(){return this.length!==0};n.fn.serializeObject=function(){var t={},i=this.serializeArray();return n.each(i,function(){t[this.name]?(t[this.name].push||(t[this.name]=[t[this.name]]),t[this.name].push(this.value||"")):t[this.name]=this.value||""}),t};n.extend({isTrue:function(t){return t===!0||t===1||t==="1"||n.type(t)=="string"&&(t.toLowerCase()=="true"||t.toLowerCase()=="y"||t.toLowerCase()=="yes")},isNullOrEmpty:function(t){return t===null||t===""||typeof t=="string"&&n.trim(t)===""||typeof t=="undefined"},valueOrDefault:function(t,i){return n.isNullOrEmpty(t)?i:t},endsWith:function(t,i){if(n.isNullOrEmpty(t)||n.isNullOrEmpty(i))return!1;var r=n.trim(t),u=r.length-i.length;return u>=0&&r.lastIndexOf(i)===u},beginsWith:function(t,i){if(n.isNullOrEmpty(t)||n.isNullOrEmpty(i))return!1;var r=n.trim(t);return r.indexOf(i)===0},ensureSuffix:function(t,i){if(n.isNullOrEmpty(t)||n.isNullOrEmpty(i))return t;var r=n.trim(t);return n.endsWith(r,i)?r:r.concat(i)},ensurePrefix:function(t,i){if(n.isNullOrEmpty(t)||n.isNullOrEmpty(i))return t;var r=n.trim(t);return n.beginsWith(r,i)?r:i.concat(r)},toPath:function(){var t=Array.prototype.slice.call(arguments,0);return n.ensurePrefix(t.join("/"),"/")},limitText:function(t,i,r){if(n.isNullOrEmpty(t)||t.length<=i)return t;var u=t.substring(0,i);return u=u.substring(0,Math.min(u.length,u.lastIndexOf(" "))),u.concat(n.valueOrDefault(r,"..."))},expandTemplate:function(t,i){i=n.extend(!0,{},i);var r=n.valueOrDefault(t,"");return n.each(i,function(n,t){var u=n.toLowerCase().indexOf("template")!=-1,i;u||(i=new RegExp("{"+n+"}","gi"),r=r.replace(i,t))}),r},generateListMarkup:function(t,i,r){if(i=n.extend(!0,[],i),i.length==0)return"";var u=n.isTrue(t)?n("<ol>"):n("<ul>");return n.each(i,function(t,i){n.isFunction(r)&&n("<li>").appendTo(u).append(r(i))}),u.wrap("<div>").parent().html()},stringFormat:function(n){for(var i,r,t=1;t<arguments.length;t++)i="\\{"+(t-1)+"\\}",r=new RegExp(i,"g"),n=n.replace(r,arguments[t]==null?"":arguments[t]);return n},formatName:function(t,i,r){r=n.extend(!0,{lastBeforeFirst:!0},r);var f=t,e=i,u=[],o=r.lastBeforeFirst?e:f,s=r.lastBeforeFirst?f:e,h=r.lastBeforeFirst?", ":" ";return n.isNullOrEmpty(o)||u.push(o),n.isNullOrEmpty(s)||u.push(s),u.join(h)},submitFormAction:function(t){n("<form>").attr("action",t).appendTo("body").submit()},submitWithParameters:function(t,i){var r;n.extend(!0,{method:"post",data:null},i);r=n("<form>").attr("method",i.method).attr("action",t);n.each(i.data,function(t,i){var u=n("<input>").attr("type","hidden").attr("name",t).val(i);r.append(u)});r.appendTo("body").submit()},submitWithParametersInNewWindow:function(t,i){var r;n.extend(!0,{method:"post",data:null},i);r=n("<form>").attr("method",i.method).attr("action",t).attr("target","_blank");n.each(i.data,function(t,i){var u=n("<input>").attr("type","hidden").attr("name",t).val(i);r.append(u)});r.appendTo("body").submit()},submitWithParametersInNewWindowHref:function(t,i){var r={},u;n.extend(!0,r,i);u=n.param(r);n.displayMessage(null,t+"?"+u)},shuffle:function(n){for(var t=n.length,r,i;0!==t;)i=Math.floor(Math.random()*t),t-=1,r=n[t],n[t]=n[i],n[i]=r;return n},tryParseJSON:function(n){try{var t=JSON.parse(n);if(t&&typeof t=="object"&&t!==null)return t}catch(i){}return null},getValue:function(n,t){for(var f,u=t.Name.split("."),i=null,r=0;r<u.length;++r)f=r,i=i==null?n[u[f]]:i[u[r]];return typeof i=="function"?i():i}})}(jQuery),function(n){n.ajaxCallWithAntiforgery=function(t,i,r,u){var f=t.token?t.token:n.getAntiForgeryToken(t.tokenWindow,t.appPath);t.data=n.appendAntiForgeryToken(t.data,f);t.async=!1;t.success=function(t){t.Status==gcr.corps.constants.responsestatuses.SUCCESS||t.Status==gcr.corps.constants.responsestatuses.INFORMATION?t.Code==gcr.corps.constants.responsecode.SESSIONEXPIRED?window.location.href=$helper.config.settings.Login+"?sessionExpired=true":n.isFunction(i)&&i(t):n.isFunction(r)?r(t):n.handleErrorResponseData(t,u)};t.error=function(t){var i="There was a problem performing the action. ";t.status===0?i+="Network connection problem. Please retry the operation again.  If the problem persists, try again later.":t.status==404?i+="The requested page was not found. Please retry the operation again.  If the problem persists, try again later.":t.status==500&&(i+="Internal Server Error Occured. Please retry the operation again.  If the problem persists, try again later.");n.displayMessageByStatus(gcr.corps.constants.responsestatuses.ERROR,i,null,u);n.isFunction(r)&&r()};n.ajax(t)}}(jQuery),function(n){n.handleErrorResponseData=function(t,i){var r=t.Message||"Failed to retrieve data.";n.displayMessageByStatus(gcr.corps.constants.responsestatuses.ERROR,r,null,i)}}(jQuery),function(n){n.hideBusy=function(){}}(jQuery),function(n){n.getPreviousIndex=function(t){var i;if(sessionStorage.getItem("Index")==null)i=n.getIndex(location.href,t),sessionStorage.setItem("Index",i);else{var r=n.getIndex(location.href,t),u=n.getIndex(document.referrer,t),f=u>r?u:r,e=sessionStorage.Index;sessionStorage.Index=e>f?e:f}return sessionStorage.Index};n.getIndex=function(t,i){var u=t.split("/"),f=u[u.length-1],c=u[u.length-2],e=n.parseJSON(sessionStorage[i]),o=0,h=e.length,r,s;if(f==undefined)return 0;for(r=0;r<h;r++)if(s=e[r],f.indexOf(s.action)!=-1){o=r+1;break}return o};n.prepareURL=function(n,t){for(var u="/",r=location.pathname.split("/"),i=0;i<r.length-2;i++)r[i]!==""&&(u+=r[i]+"/");return u+(n+"/"+t)}}(jQuery),function(n){___promptResp=!1;n.convertToDate=function(n){if(n!=null){var i,r,u=/Date\(([^)]+)\)/.exec(n),t=new Date(parseFloat(u[1]));return i=t.getDate()<10?i="0"+t.getDate():t.getDate(),r=t.getMonth()+1<10?r="0"+(t.getMonth()+1):t.getMonth()+1,r+"/"+i+"/"+t.getFullYear()}};n.convertToDateTime=function(n){if(n!=null){var i=/Date\(([^)]+)\)/.exec(n),t=new Date(parseFloat(i[1]));return t.toLocaleDateString()+" "+t.toLocaleTimeString()}};n.AcceptChanges=function(t){var i;i=t?n("."+t):n("body");n(i).find(":input:not(:button):not([type=hidden])").each(function(){if(this.type=="text"||this.type=="textarea"||this.type=="hidden")this.defaultValue=this.value;else if(this.type=="radio"||this.type=="checkbox")this.defaultChecked=this.checked;else if(this.type=="select-one"||this.type=="select-multiple")if(this.type=="select-multiple")n(this).attr("DefaultLength",this.length);else for(var t=0;t<this.length;t++)this.options[t].defaultSelected=this.options[t].selected})};n.IsModifiedCheck=function(t){var i=!1,r;return r=t?n("."+t).length>0?n("."+t):n("#reportDisplayPane").contents().find("."+t):n("body"),n(r).each(function(){n(this).find(":input:not(:button):not([type=hidden])").each(function(){if(!(this.name.indexOf("_input")>-1)){if((this.value.toString().indexOf("Select")>-1&&this.defaultValue.toString().indexOf("Select")==-1&&(this.defaultValue="-- Select --"),(this.type=="text"||this.type=="textarea"||this.type=="file")&&n.trim(this.defaultValue.toString())!=n.trim(this.value.toString()))||(this.type=="radio"||this.type=="checkbox")&&this.defaultChecked!=this.checked)return i=!0,!1;if(this.type=="select-one"||this.type=="select-multiple")if(this.type=="select-multiple"){if(n(this).attr("DefaultLength")!=this.length)return n(this).attr("id")=="allAvailableSubcriptionGroups"&&this.length!=n("#hdnSubscriptionLists").length?(i=!0,!1):n(this).attr("id")=="ddlAvailableRoles"&&this.length!=parseInt(n("#hdnAvailableRoles").val())?(i=!0,!1):(i=!0,!1)}else for(var t=0;t<this.length;t++)if(this.options[t].selected!=this.options[t].defaultSelected&&this.options[t].text.indexOf("Select")==-1)return i=!0,!1}})}),i};n.IsModified=function(t,i,r){var u=n.IsModifiedCheck(r);if(t)if(u)swal({html:!0,title:"",text:"Last changes are not saved on the screen, Do you want to continue?",type:"warning",showConfirmButton:!0,showCancelButton:!0,closeOnConfirm:!0,closeOnCancel:!0},function(n){n?(___promptResp=!0,i.click()):___promptResp=!1});else return!0;else return u;if(___promptResp)return ___promptResp=!1,!0};n.SetTempFormDirty=function(){n("#txtFormDirty").val()!="Y"&&n("#txtFormDirty").val("Y")};n.urlRedirectwithFormDirty=function(t,i){return n.IsModified(!0,t,"bodycontent")?(n.urlRedirect(i,!0),!0):!1};n.urlRedirect=function(n,t){if(t&&processDialog)if(window.parent.window.length>0){var i;processDialog&&(i=setTimeout(function(){window.parent.window.processDialog.dialog("open");clearTimeout(i)},0))}else processDialog.dialog("open");n!=""&&(window.location.href=n)};n.isInt=function(n,t,i){var r,f,u;if(i){if(r=i.which?i.which:i.keyCode,r==8)return!0;n=String.fromCharCode(r)}return f=/^\s*(\+|-)?\d+\s*$/,u=String(n).search(f)!=-1,t!=undefined&&this.isUnsInt(t)&&(u=Math.abs(parseInt(n))<=Math.pow(2,parseInt(t)-1)),u}}(jQuery);typeof gcr=="undefined"&&(gcr=$({}));typeof gcr.idls=="undefined"&&(gcr.idls=$({}));typeof gcr.corps=="undefined"&&(gcr.corps=$({}));typeof gcr.corps.commonScripts=="undefined"&&(gcr.corps.commonScripts=$({}));gcr.corps.commonScripts.load=function(){var n=this;n.convertToDate=function(n){var i,r,u=/Date\(([^)]+)\)/.exec(n),t=new Date(parseFloat(u[1]));return i=t.getDate()<10?i="0"+t.getDate():t.getDate(),r=t.getMonth()+1<10?r="0"+(t.getMonth()+1):t.getMonth()+1,r+"/"+i+"/"+t.getFullYear()};n.formatinTotalValue=function(n){var t=$(n).val();return t.trim()!=""&&$(n).val(parseFloat(t).toFixed(2)),!0};n.formatinTotalValueWithCommas=function(n){var t=$(n).val();return t.trim()!=""&&$(n).val(parseFloat(t.replace(/,/g,"")).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g,"$1,")),!0};n.convertToDateTime=function(n){var i=/Date\(([^)]+)\)/.exec(n),t=new Date(parseFloat(i[1]));return t.toLocaleDateString()+" "+t.toLocaleTimeString()}};typeof gcr.corps.entitysearch=="undefined"&&(gcr.corps.entitysearch=$({}));typeof gcr.corps.entitysearchresult=="undefined"&&(gcr.corps.entitysearchresult=$({}));gcr.corps.entitysearch.loadViewModel=function(n,t){function u(){$(".error").hide();i.HtmlElements.$txt_EntityName.focus()}function f(){e();o()}function e(){i.HtmlElements.$btn_Search.click(function(){v()?(isFormValid=!1,s()):swal({title:"",text:i.Validation.Message,type:"warning"},null)})}function o(){i.HtmlElements.$txt_AgentName.change(function(){i.HtmlElements.$txt_EntityName.val("");i.HtmlElements.$txt_PrincipalName.val("");i.HtmlElements.$txt_EntityID.val("")});i.HtmlElements.$txt_PrincipalName.change(function(){i.HtmlElements.$txt_AgentName.val("");i.HtmlElements.$txt_EntityName.val("");i.HtmlElements.$txt_EntityID.val("")});i.HtmlElements.$txt_EntityName.change(function(){i.HtmlElements.$txt_AgentName.val("");i.HtmlElements.$txt_PrincipalName.val("");i.HtmlElements.$txt_EntityID.val("")});i.HtmlElements.$txt_EntityID.change(function(){i.HtmlElements.$txt_PrincipalName.val("");i.HtmlElements.$txt_EntityName.val("");i.HtmlElements.$txt_AgentName.val("")})}function s(){h();ajaxSettings={type:"POST",url:i.URLs.GetSearchResults,datatype:"json",data:{model:n}};$.ajaxCallWithAntiforgery(ajaxSettings,l,a,null)}function h(){i.HtmlElements.$ddl_SearchType.val()=="Starts With"?(n.SearchCriteria.quickSearch.StartsWith=!0,n.SearchCriteria.quickSearch.Contains=!1,n.SearchCriteria.quickSearch.ExactMatch=!1):i.HtmlElements.$ddl_SearchType.val()=="Contains"?(n.SearchCriteria.quickSearch.Contains=!0,n.SearchCriteria.quickSearch.ExactMatch=!1,n.SearchCriteria.quickSearch.StartsWith=!1):i.HtmlElements.$ddl_SearchType.val()=="Exact Match"&&(n.SearchCriteria.quickSearch.ExactMatch=!0,n.SearchCriteria.quickSearch.StartsWith=!1,n.SearchCriteria.quickSearch.Contains=!1);n.SearchCriteria.quickSearch.BusinessName=i.HtmlElements.$txt_EntityName.val();n.SearchCriteria.quickSearch.AgentName=i.HtmlElements.$txt_AgentName.val();n.SearchCriteria.quickSearch.PrincipalName=i.HtmlElements.$txt_PrincipalName.val();n.SearchCriteria.quickSearch.BusinessId=i.HtmlElements.$txt_EntityID.val();n.SearchCriteria.advancedSearch.BusinessTypeID=i.HtmlElements.$ddl_EntityType.find(":selected").text();n.SearchCriteria.advancedSearch.BusinessStatusID=i.HtmlElements.$ddl_EntityStatus.find(":selected").text();n.SearchCriteria.advancedSearch.NameType=i.HtmlElements.$ddl_NameType.find(":selected").text();n.SearchCriteria.advancedSearch.County=i.HtmlElements.$txt_County.find(":selected").text();n.SearchCriteria.advancedSearch.Fields=c()}function c(){var n="";return n+="businessentitytype="+i.HtmlElements.$ddl_EntityType.val()+";",n+="businessstatus="+i.HtmlElements.$ddl_EntityStatus.val()+";",n+="nameType="+i.HtmlElements.$ddl_NameType.val()+";",n+="County="+i.HtmlElements.$txt_County.val()+";",n+="StreetAddress1=;",n+="city=;",n+="zipcode=;",n+="isSimilarSoundingBusiness=0;",n+="isSimilarSoundingAgent=0;",n+="isSimilarSoundingAgent=0;",n+"isSimilarSoundingPrincipal=0"}function l(n){i.HtmlElements.$container_EntitySearch.html(n.Data)}function a(n){swal({title:"",text:n.Message,type:"warning"},null)}function v(){var n=!1;return i.HtmlElements.$txt_EntityName.val().trim()!=""&&(n=!0),i.HtmlElements.$txt_AgentName.val().trim()!=""&&(n=!0),i.HtmlElements.$txt_PrincipalName.val().trim()!=""&&(n=!0),i.HtmlElements.$txt_EntityID.val().trim()!=""&&(n=!0),(i.HtmlElements.$ddl_EntityType.find(":selected").text()=="All"||i.HtmlElements.$ddl_EntityType.val().trim()!="")&&(n=!0),i.HtmlElements.$ddl_EntityStatus.val().trim()!=""&&(n=!0),i.HtmlElements.$ddl_NameType.val().trim()!=""&&(n=!0),i.HtmlElements.$txt_County.val().trim()!=""&&(n=!0),n}var r=this,i={DataModel:n,URLs:{GetSearchResults:t.GetSearchResults},HtmlElements:{$container_EntitySearch:$("#entity-search"),$div_AlertMessage:$("#div_alert-message"),$AlertMessage:$("#alert-message"),$ddl_SearchType:$("#SearchType"),$txt_EntityName:$("#quickSearch_BusinessName"),$txt_AgentName:$("#quickSearch_AgentName"),$txt_PrincipalName:$("#quickSearch_PrincipalName"),$txt_EntityID:$("#quickSearch_BusinessId"),$span_ValidationMessage:$("#span_validation-msg"),$ddl_EntityType:$("#advancedSearch_BusinessTypeID"),$ddl_EntityStatus:$("#advancedSearch_BusinessStatusID"),$ddl_NameType:$("#advancedSearch_NameType"),$txt_County:$("#advancedSearch_County"),$btn_Search:$("#btn_Search"),$div_SearchResults:$("#container_search-results")},Validation:{Message:"Please enter at least one option for search"}};r.Init=function(){u();f()};r.GetDataModel=function(){return i.DataModel};r.Init()};gcr.corps.entitysearchresult.loadViewModel=function(n,t){function u(){var n=i.DataModel.Message;n&&n!=""&&swal({title:"",text:n,type:"warning"},null)}function f(){i.HtmlElements.$btn_SearchReturn.click(function(){window.location=i.URLs.SearchReturn})}var r=this,i={DataModel:n,URLs:{GetSearchResults:t.GetSearchResults,SearchReturn:t.SearchReturn},HtmlElements:{$container_SearchResults:$("#container_search-results"),$div_SearchResults:$("#div_result-list"),$btn_SearchReturn:$("#btn_search")}};r.Init=function(){u();f()};r.Init()};typeof gcr.corps.exampleScript=="undefined"&&(gcr.corps.exampleScript=$({}));gcr.corps.exampleScript.loadViewModel=function(n,t){var i=this,r;alert("example script viewModel javascript called");r={CSS:{classes:{current:"current",scrollContainer:"scroll"},IDs:{hdnCompaintType:""}},labels:{previous:"back",next:"next",auto:"play"},constants:{amount:5,skin:"blue",autoplay:!1},UI:{$fullNameInputBox:t,$otherDomElement:"",$alertMessageDiv:$("#div-test-view-alert-section")}};r.UI.$fullNameInputBox.click(function(){alert("hello! the full name input box clicked")});i.exampleAjaxCallReturningApplicationError=function(n,t,u,f){$.ajaxCallWithAntiforgery({url:n,type:t,data:u,dataType:f},null,i.onExampleAjaxError,r.UI.$alertMessageDiv)};i.onExampleAjaxError=function(){alert("Do something custom after ajax fails")};i.exampleAjaxHttpPostWithAntiforgery=function(n,t,u,f){$.ajaxCallWithAntiforgery({url:n,type:t,data:u,dataType:f},i.antiForgeryHttpPostSuccess,null,r.UI.$alertMessageDiv)};i.antiForgeryHttpPostSuccess=function(){alert("Http Post with anti forgery success")};i.exampleAjaxCallReturningSuccess=function(n,t,u,f){$.ajaxCallWithAntiforgery({url:n,type:t,data:u,dataType:f},i.onExampleAjaxSuccess,null,r.UI.$alertMessageDiv)};i.onExampleAjaxSuccess=function(){alert("Do something after successful ajax call")}};gcr.corps.exampleScript.config={UI:{$alertMessageDiv:$("#div-test-view-alert-section")}};gcr.corps.exampleScript.exampleAjaxCallReturningNotSuccessResposne=function(n,t,i,r){$.ajaxCallWithAntiforgery({url:n,type:t,data:i,dataType:r},null,null,null)};typeof gcr.corps.modaccount=="undefined"&&(gcr.corps.modaccount=$({}));typeof gcr.corps.modaccount.accountinfo=="undefined"&&(gcr.corps.modaccount.accountinfo=$({}));typeof gcr.corps.modaccount.accountclosure=="undefined"&&(gcr.corps.modaccount.accountclosure=$({}));typeof gcr.corps.modaccount.makedeposit=="undefined"&&(gcr.corps.modaccount.makedeposit=$({}));gcr.corps.modaccount.accountinfo.loadViewModel=function(n,t){function h(){u();i.UI.$btnDashboard.click(function(){window.location=$helper.config.settings.ToDashboard})}function u(){i.UI.$btn_AddAuthorizedUser.click(function(){f(null)});$('input[name="btnEdit"]').click(function(){var n=w(parseInt($(this).prop("id")));f(n)});$('input[name="btnDelete"]').click(function(){v($(this))})}function f(n){var t={};n?t=n:(t.FirstName="",t.LastName="",t.MiddleName="");ajaxSettings={type:"POST",url:i.URLs.RenderDialog,datatype:"json",data:{model:t}};$.ajaxCallWithAntiforgery(ajaxSettings,c,null,null)}function c(n){i.Variables.DialogRender=n.Data;i.Variables.DialogRender!=null&&(i.UI.$dialog_AddAuthorizedUser.dialog(i.Variables.DialogSettings),i.UI.$dialog_AddAuthorizedUser.dialog("open"))}function l(n){alertSettings={title:"",text:n.Message,type:"success"};s(alertSettings,null)}function a(n){alertSettings={title:"",text:n.Message,type:"warning"};s(alertSettings,null)}function v(n){n.prop("id")==0?p(n):(ajaxSettings={type:"POST",url:i.URLs.DeleteAuthorizedUser,datatype:"json",data:{id:id}},$.ajaxCallWithAntiforgery(ajaxSettings,e,null,null))}function y(){ajaxSettings={type:"POST",url:i.URLs.GetAuthorizedUsers,datatype:"json",data:{model:i.Variables.DataModel.AuthorizedUserNames}};$.ajaxCallWithAntiforgery(ajaxSettings,e,null,null)}function e(n){$("#container_AuthorizedUsers").html(n.Data);u()}function p(n){var t=n.closest(".row").attr("name");i.Variables.DataModel.AuthorizedUserNames=$.grep(i.Variables.DataModel.AuthorizedUserNames,function(n){return n.UserName!=t});n.closest(".row").closest(".row").parent().parent().remove()}function o(){var t=i.UI.$dialog_AddAuthorizedUser,n=i.UI.$dialog_AddAuthorizedUser.data().uiDialog,r;n&&n.options.fluid==!0&&(r=$(window).width(),r<parseInt(n.options.maxWidth)+50?t.parent().css("max-width","90%"):t.parent().css("max-width",n.options.maxWidth+"px"),n.option("position",n.options.position))}function s(n,t){$.isFunction(t)||(t=null);swal(n,t)}function w(n){var t=$.grep(i.Variables.DataModel.AuthorizedUserNames,function(t){return t.ContactId===n});return t[0]}function b(){return{autoOpen:!1,width:"100%",maxWidth:"1000",fluid:!0,resizable:!1,title:"Add Authorized User",modal:!0,closeOnEscape:!1,open:function(){$(this).html(i.Variables.DialogRender);$(".ui-dialog-titlebar-close").hide()},beforeClose:function(){dialogVM&&(i.Variables.DataModel.AuthorizedUserNames.push(dialogVM.GetCurrentModelState()),y())},close:function(){}}}var r=this,i={Variables:{DataModel:n,DialogRender:null,DialogSettings:b()},UI:{$form_MODAccount:$("#MODAccountForm"),$dialog_AddAuthorizedUser:$("#dialog_AddAuthorizedUser"),$btn_AddAuthorizedUser:$("#btn_AddAuthorizedUser"),$div_AuthorizedUsers:$("#grid-result"),$btnDashboard:$("#btnDashboard"),$btnSave:$("#btnSubmit")},URLs:{SaveAccountInfo:t.SaveAccountInfo,RenderDialog:t.RenderDialog,GetAuthorizedUsers:t.GetAuthorizedUsers,DeleteAuthorizedUser:t.DeleteAuthorizedUser}};r.Init=function(){h()};r.SaveAccount=function(){var n=i.UI.$form_MODAccount.serializeObject();n.AuthorizedUserNames=i.Variables.DataModel.AuthorizedUserNames;ajaxSettings={type:"POST",url:i.URLs.SaveAccountInfo,datatype:"json",data:{model:n}};$.ajaxCallWithAntiforgery(ajaxSettings,l,a,null)};$(document).on("dialogopen",".ui-dialog",function(){o()});$(window).resize(function(){o()});r.Init()};gcr.corps.modaccount.accountclosure.loadViewModel=function(n,t){function r(){settings.Variables.DataModel.HasPendingClosingRequest&&(settings.UI.$chk_Accept.prop("checked",!0),swal({title:"",text:"A previous request to close account is pending",type:"success"},null))}function u(){settings.UI.$btn_Dashboard.click(function(){window.location=$helper.config.settings.ToDashboard});settings.UI.$btn_Submit.click(function(){setTimeout(f,0015)})}function f(){if(isValid){var n=settings.UI.$form.serializeObject();n.AccountNumber=settings.Variables.DataModel.AccountNumber;n.AccountHolderName=settings.Variables.DataModel.AccountHolderName;ajaxSettings={type:"POST",url:settings.URLs.CloseAccount,datatype:"json",data:{model:n}};$.ajaxCallWithAntiforgery(ajaxSettings,e,o,null)}}function e(n){swal({title:"",text:n.Message,type:"success"},function(){settings.UI.$container_AccountClosure.html(n.Data)})}function o(n){swal({title:"",text:n.Message,type:"warning"},null)}var i=this;settings={Variables:{DataModel:n},URLs:{CloseAccount:t.CloseAccount},UI:{$container_AccountClosure:$("#container_AccountClosure"),$form:$("#form_account-closure"),$chk_Accept:$("#IsTermsAccepted"),$btn_Dashboard:$("#btnDashboard"),$btn_Submit:$("#btnSubmit")}};i.Init=function(){r();u()};i.Init()};gcr.corps.modaccount.makedeposit.loadViewModel=function(){function i(){n.UI.$btn_Dashboard.click(function(){window.location=$helper.config.settings.ToDashboard});n.UI.$btn_Clear.click(function(){n.UI.$form.find("input").each(function(){$(this).val("")})});n.UI.$btn_AddToCart.click(function(){setTimeout(r,0015)})}function r(){isValid&&(ajaxSettings={type:"POST",url:$helper.config.settings.MakeDeposit,datatype:"json",data:{model:n.UI.$form.serializeObject()}},$.ajaxCallWithAntiforgery(ajaxSettings,u,f,null))}function u(t){n.UI.$txt_DepositAmount.val("");swal({title:"",text:t.Message,type:"success"},null)}function f(n){swal({title:"",text:n.Message,type:"warning"},null)}var t=this,n={UI:{$form:$("#form_AccountDeposit"),$txt_DepositAmount:$("#DepositAmount"),$btn_Dashboard:$("#btnDashboard"),$btn_Clear:$("#btnClear"),$btn_AddToCart:$("#btnSubmit")}};t.Init=function(){i()};t.Init()};typeof gcr=="undefined"&&(gcr={});typeof gcr.corps=="undefined"&&(gcr.corps=$({}));typeof gcr.corps.shared=="undefined"&&(gcr.corps.shared=$({}));typeof gcr.corps.shared.addressfields=="undefined"&&(gcr.corps.shared.addressfields=$({}));gcr.corps.shared.addressfields.addressfieldsModel=function(n,t,i,r,u,f){var e=this;settings={Validation:{TXT_ADDRESS_1:"{type:'required', msg:'Please enter an address'}",DD_COUNTRY:"{type:'required', msg:'Please enter a county'}",TXT_ZIP_5:"{type:'required', msg:'Please enter a zip code'}",TXT_CITY:"{type:'required', msg:'Please enter a city'}",DD_CITY:"{type:'required', msg:'Please select a city'}",DD_STATE:"{type:'required', msg:'Please select a state'}",TXT_OTHER_STATE:"{type:'required', msg:'Please enter a state'}",DD_COUNTY:"{type:'required', msg:'Please select a county'}",TXT_EMAIL:"{type:'required', msg:'Please enter an email address'}"}};e.modelName=n;e.displayType=t;e.ruleSetName=i;e.filterByState=r;e.filterOutsideOfState=u;e.disableValidation=f;e.GetCityCountyListByZipCode=$helper.config.settings.GetCityCountyListByZipCode;e.GetCityCountyListByState=$helper.config.settings.GetCityCountyListByState;e.setHTMLFields=function(n){e.modelName=n;e.htmlFields={DV_ZIP5:$("#"+e.modelName+"_DivZIP5"),DV_ZIP4:$("#"+e.modelName+"_DivZIP4"),DV_POSTALCODE:$("#"+e.modelName+"_DivpostalCode"),TR_ATTENTION_CONTENT:$("#tr"+e.modelName+"_Attention"),TXT_ATTENTION:$("#"+e.modelName+"_Attention"),TXT_ADDRESS_1:$("#"+e.modelName+"_StreetAddress1"),TXT_ADDRESS_2:$("#"+e.modelName+"_StreetAddress2"),DD_COUNTRY:$("#"+e.modelName+"_Country"),LBL_ZIP:$("#"+e.modelName+"_zipLabel"),TXT_ZIP_5:$("#"+e.modelName+"_Zip5"),TXT_ZIP_4:$("#"+e.modelName+"_Zip4"),TXT_POSTAL_CODE:$("#"+e.modelName+"_PostalCode"),TXT_CITY:$("#"+e.modelName+"_City"),DD_CITY:$("#"+e.modelName+"_CityDD"),LBL_STATE:$("#"+e.modelName+"_stateLabel"),LBL_ADDRESSLINE1:$("#"+e.modelName+"_StreetAddress1Label"),DD_STATE:$("#"+e.modelName+"_State"),TXT_OTHER_STATE:$("#"+e.modelName+"_OtherState"),LBL_COUNTY:$("#"+e.modelName+"_countyLabel"),DD_COUNTY:$("#"+e.modelName+"_County"),LBL_EMAIL:$("#"+e.modelName+"_emailAddressLabel"),TXT_EMAIL:$("#"+e.modelName+"_EmailAddress"),DD_CITYDESC:$("#"+e.modelName+"_CityDD option:selected"),DD_COUNTRYDESC:$("#"+e.modelName+"_Country option:selected"),DD_STATEDESC:$("#"+e.modelName+"_State option:selected"),DD_COUNTYDESC:$("#"+e.modelName+"_County option:selected"),HIDDEN_DISPLAY_NAME:$("#hdn"+e.modelName+"_DisplayName"),HIDDEN_ADDRESS_ID:$("#hdn"+e.modelName+"_AddressID"),HIDDEN_CITY:$("#hdn"+e.modelName+"_City"),HIDDEN_COUNTY:$("#hdn"+e.modelName+"_County"),HIDDEN_STATE:$("#hdn"+e.modelName+"_State"),HIDDEN_RULE_SET_NAME:$("#hdn"+e.modelName+"_RuleSetName"),HIDDEN_FILTER_BY_STATE:$("#hdn"+e.modelName+"_FilterByState"),HIDDEN_COUNTYORLOCALITY:$("#hdn"+e.modelName+"_CountyOrLocality"),HIDDEN_HASCOUNTY:$("#hdn"+e.modelName+"_hasCounty"),HIDDEN_ISEDIT:$("#hdn"+e.modelName+"_IsEdit"),HIDDEN_ValidationRequired:$("#hdn"+e.modelName+"_isvalidationRequired")};e.ruleSetName=e.htmlFields.HIDDEN_RULE_SET_NAME.val();e.filterByState=e.htmlFields.HIDDEN_FILTER_BY_STATE.val()};e.setHTMLFields(n);e.ValidatePOBox=function(){var r=e.htmlFields.TXT_ADDRESS_1.val(),i=e.htmlFields.TXT_ADDRESS_2.val(),n=e.htmlFields.TXT_ADDRESS_1.val().replace(/[^a-z0-9\s]/gi,"").replace(/[_\s]/g,""),t=i!=undefined&&i!=null&&i!=""?e.htmlFields.TXT_ADDRESS_2.val().replace(/[^a-z0-9\s]/gi,"").replace(/[_\s]/g,""):null;return n!=null?n.toLowerCase().indexOf("po box")>-1||n.toLowerCase().indexOf("pobox")>-1||n.toLowerCase().indexOf("p.o.box")>-1||n.toLowerCase().indexOf("p.o. box")>-1||n.toLowerCase().indexOf("p o box")>-1?r+" is not allowed, Please enter valid Address Line 1":t!=null?t.toLowerCase().indexOf("po box")>-1||t.toLowerCase().indexOf("pobox")>-1||t.toLowerCase().indexOf("p.o.box")>-1||t.toLowerCase().indexOf("p.o. box")>-1||t.toLowerCase().indexOf("p o box")>-1?i+" is not allowed, Please enter valid Address Line 2":"":"":""};e.ValidateEmail=function(){var n=e.htmlFields.TXT_EMAIL.val();return/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w+[a-zA-Z]{2,})*$/.test(n)};e.AddressCountryChange=function(n,t){e.setHTMLFields(t);n.value==$helper.enums.Locales.Countries.USA||n.value==null?(e.USACountry(t),e.htmlFields.DD_STATE.val("VA")):e.OtherCountry(t)};e.CityTextChange=function(n){e.setHTMLFields(n);e.htmlFields.HIDDEN_CITY.val("");e.htmlFields.HIDDEN_CITY.val(e.htmlFields.TXT_CITY.val())};e.RestrictSpecialChars=function(n){e.setHTMLFields(n);var t=e.htmlFields.TXT_CITY.val();t=t.replace(/[^a-zA-Z0-9 ]/g,"");e.htmlFields.TXT_CITY.val(t)};e.DropDownCityTextChange=function(n){e.setHTMLFields(n);e.htmlFields.TXT_CITY.val(e.htmlFields.DD_CITY.val())};e.DropDownCountyChange=function(n){e.setHTMLFields(n);e.htmlFields.HIDDEN_COUNTY.val(e.htmlFields.DD_COUNTY.val())};e.StateChange=function(n,t){e.setHTMLFields(t)};e.EmailChange=function(n,t){e.setHTMLFields(t);e.ValidateEmail(n)||swal({title:"",text:"Please enter a valid email address",type:"warning"},function(){e.htmlFields.TXT_EMAIL.val("")})};e.Zip5Change=function(n){var t=n;e.setHTMLFields(t);e.htmlFields.DD_COUNTRY.val()==$helper.enums.Locales.Countries.USA&&(e.htmlFields.TXT_ZIP_5.val()!=""?e.SetCitiesAndCountiesByZip(t):(e.htmlFields.DD_CITY.hide(),e.htmlFields.TXT_CITY.show(),e.htmlFields.DD_CITY.disableRule(),e.htmlFields.TXT_CITY.enableRule(),e.htmlFields.DD_CITY.html(""),e.htmlFields.TXT_CITY.text(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.TXT_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.HIDDEN_ValidationRequired.val()=="False"&&(e.htmlFields.TXT_CITY.disableRule(),e.htmlFields.TXT_ZIP_5.disableRule(),e.htmlFields.TXT_ADDRESS_1.disableRule()),e.htmlFields.DD_COUNTY.val(""),e.htmlFields.DD_COUNTY.is(":hidden")!=!0&&(e.htmlFields.DD_COUNTY.attr("rule")==undefined&&(e.htmlFields.DD_COUNTY.attr("disabledrule")!=undefined?e.htmlFields.DD_COUNTY.enableRule():e.htmlFields.DD_COUNTY.attr("rule","{'Locality', 'required'}")),e.htmlFields.DD_COUNTY.val(""))));(n.indexOf("MailingAddress")>0||n.indexOf("mailingAddress")>0)&&($("#newRAMailingAddressSection").find("input,textarea,select").removeAttr("rule"),$("#mailingAddressSection").find("input,textarea,select").removeAttr("rule"))};e.ValidatePOANDPMBBox=function(n){e.setHTMLFields(n.value);var i=e.htmlFields.TXT_ADDRESS_1.val(),t=e.htmlFields.TXT_ADDRESS_1.val().replace(/[^a-z0-9\s]/gi,"").replace(/[_\s]/g,"");return t!=null?t.toLowerCase().indexOf("po box")>-1||t.toLowerCase().indexOf("pobox")>-1||t.toLowerCase().indexOf("p.o.box")>-1||t.toLowerCase().indexOf("p.o. box")>-1||t.toLowerCase().indexOf("p o box")>-1||t.toLowerCase().indexOf("pmb")>-1||t.toLowerCase().indexOf("personalmailbox")>-1?i+" is not allowed, Please enter valid Address Line 1":"":""};e.USACountry=function(n){e.setHTMLFields(n);var i="#"+n,t=e.htmlFields.HIDDEN_FILTER_BY_STATE.val();e.htmlFields.DV_ZIP5.show();e.htmlFields.TXT_ZIP_5.show();(n.indexOf("SOPMailingAddress")!=-1||n.toLowerCase().indexOf("mailing")==-1)&&(e.htmlFields.TXT_ZIP_5.attr("rule","{'Zip code', 'required'}"),e.htmlFields.TXT_ZIP_5.show().enableRule());e.htmlFields.HIDDEN_ValidationRequired.val()=="False"&&(e.htmlFields.TXT_ZIP_5.disableRule(),e.htmlFields.TXT_CITY.disableRule(),e.htmlFields.TXT_ADDRESS_1.disableRule());e.htmlFields.DV_ZIP4.show();e.htmlFields.TXT_ZIP_4.show();e.htmlFields.DD_STATE.val(t);e.htmlFields.DD_STATE.show().enableRule();e.htmlFields.DD_STATE.val(t);e.htmlFields.DD_COUNTY.removeAttr("disabled");(n.indexOf("SOPMailingAddress")!=-1||n.toLowerCase().indexOf("mailing")==-1)&&(e.htmlFields.LBL_COUNTY.html(e.htmlFields.HIDDEN_COUNTYORLOCALITY.val()+': <span class="font_red control-label"> *<\/span>'),e.htmlFields.HIDDEN_HASCOUNTY.val()=="true"&&(e.htmlFields.HIDDEN_COUNTYORLOCALITY.val()=="County"?e.htmlFields.DD_COUNTY.attr("rule","{'County', 'required'}"):e.htmlFields.DD_COUNTY.attr("rule","{'Locality', 'required'}")),e.htmlFields.LBL_ZIP.html('Zip Code:<span class="font_red control-label clsIsRequired">*<\/span>'),e.htmlFields.LBL_STATE.html('State:<span class="font_red control-label clsIsRequired">*<\/span>'),e.htmlFields.LBL_ADDRESSLINE1.html('Address Line 1:<span class="font_red control-label clsIsRequired">*<\/span>'));e.htmlFields.LBL_ZIP.text("Zip Code:");e.htmlFields.LBL_STATE.text("State:");e.htmlFields.DV_POSTALCODE.hide();e.htmlFields.TXT_POSTAL_CODE.hide().DisableVal();e.htmlFields.TXT_POSTAL_CODE.val("");e.htmlFields.TXT_OTHER_STATE.hide().DisableVal();e.htmlFields.TXT_OTHER_STATE.val("");e.htmlFields.DD_CITY.hide().DisableVal();e.htmlFields.TXT_CITY.show().enableRule();e.htmlFields.TXT_CITY.val("");e.htmlFields.DD_COUNTRY.val($helper.enums.Locales.Countries.USA)};e.OtherCountry=function(n){e.htmlFields.HIDDEN_ValidationRequired.val()=="False"&&e.htmlFields.TXT_ADDRESS_1.enableRule();e.setHTMLFields(n);var t="#"+n,i=e.htmlFields.HIDDEN_FILTER_BY_STATE.val();e.htmlFields.DV_ZIP5.hide();e.htmlFields.TXT_ZIP_5.hide().DisableVal();e.htmlFields.TXT_ZIP_5.val("");e.htmlFields.DV_ZIP4.hide();e.htmlFields.TXT_ZIP_4.hide();e.htmlFields.TXT_ZIP_4.val("");e.htmlFields.DD_STATE.hide().DisableVal();e.htmlFields.DD_STATE.val("");e.htmlFields.LBL_ZIP.text("Postal Code:");e.htmlFields.LBL_STATE.text("Other State:");e.htmlFields.LBL_COUNTY.html(e.htmlFields.HIDDEN_COUNTYORLOCALITY.val()+":");e.htmlFields.DD_COUNTY.val("");e.htmlFields.DD_COUNTY.DisableVal();e.htmlFields.DD_COUNTY.attr("disabled","disabled");(n.indexOf("SOPMailingAddress")==0||n.indexOf("ApplicantInformationAddress")==0)&&(e.htmlFields.DD_COUNTY.hide(),e.htmlFields.LBL_COUNTY.html(" "));e.htmlFields.DV_POSTALCODE.show();e.htmlFields.TXT_POSTAL_CODE.show();e.htmlFields.TXT_POSTAL_CODE.val("");e.htmlFields.TXT_OTHER_STATE.show();e.htmlFields.TXT_OTHER_STATE.val("");e.htmlFields.DD_CITY.hide().DisableVal();e.htmlFields.TXT_CITY.val("");e.htmlFields.TXT_CITY.attr("readOnly",!1);e.htmlFields.TXT_CITY.show().enableRule();e.htmlFields.TXT_CITY.attr("rule")==undefined&&e.htmlFields.TXT_CITY.attr("rule","{'City', 'required'}")};e.SetCitiesAndCountiesByZip=function(n,t){e.setHTMLFields(n);var i=e.htmlFields.TXT_ZIP_5.val();if(i.length!=5&&(i=e.AddLeadingZeros(i),e.htmlFields.TXT_ZIP_5.val(i)),i.length==0)return!1;$.ajax({async:t==undefined?!0:t,url:e.GetCityCountyListByZipCode,type:"POST",data:{zip:i},success:function(t){var i=$.parseJSON(t.Data);if(i!=null){var f=e.ruleSetName,r=e.filterByState,u=e.filterOutsideOfState;f=="Default"?(i.CityList.length>1?(e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.append("<option value=''>-- Select --<\/option>"),$.each(i.CityList,function(n,t){e.htmlFields.DD_CITY.append("<option value='"+t.City+"'>"+$.trim(t.City)+"<\/option>")}),e.htmlFields.DD_CITY.attr("disabledrule")!=undefined?(e.htmlFields.DD_CITY.show().enableRule(),(n.indexOf("SOPMailingAddress")==0||n.indexOf("ServedAddress")==0||n.indexOf("CourtLocalityOtherAddress")==0)&&e.htmlFields.DD_CITY.show().enableRule()):(e.htmlFields.DD_CITY.attr("rule")==undefined&&e.htmlFields.DD_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.DD_CITY.show().enableRule()),e.htmlFields.HIDDEN_CITY.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.DD_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.DD_CITY.val(e.htmlFields.DD_CITY.find("option:nth-of-type(1)").val()),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.TXT_CITY.hide().DisableVal(),e.htmlFields.DD_STATE.val(""),e.htmlFields.HIDDEN_STATE.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.DD_STATE.val(e.htmlFields.HIDDEN_STATE.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.DD_STATE.val(i.CityList[0].State)):(e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.hide().DisableVal(),e.htmlFields.TXT_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.TXT_CITY.show().enableRule(),e.htmlFields.TXT_CITY.val(""),i.CityList.length>0?(e.htmlFields.HIDDEN_CITY.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.TXT_CITY.val(i.CityList[0].City),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.HIDDEN_CITY.val(e.htmlFields.TXT_CITY.val()),e.htmlFields.DD_STATE.val(""),e.htmlFields.HIDDEN_STATE.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.DD_STATE.val(e.htmlFields.HIDDEN_STATE.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.DD_STATE.val(i.CityList[0].State)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("");e.htmlFields.TXT_ZIP_5.attr("rule","{'Zip Code', 'required'}");e.htmlFields.DD_COUNTY.DisableVal()}),e.htmlFields.DD_STATE.val(r))),i.CountyList.length>1?e.htmlFields.DD_COUNTY.val(""):(e.htmlFields.DD_COUNTY.val(""),i.CountyList.length>0?e.htmlFields.DD_COUNTY.val(i.CountyList[0].CountyID):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("")}),e.htmlFields.DD_STATE.val(r)))):f=="FilterByState"?(i.CityList.length>0&&(i.CityList[0].State==r||r==""||r==null)?i.CityList.length>1?(e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.append("<option value=''>-- Select --<\/option>"),$.each(i.CityList,function(n,t){e.htmlFields.DD_CITY.append("<option value='"+t.City+"'>"+$.trim(t.City)+"<\/option>")}),e.htmlFields.DD_CITY.attr("disabledrule")!=undefined?(e.htmlFields.DD_CITY.show().removeAttr("disabledrule"),e.htmlFields.DD_CITY.attr("rule","{'City', 'required'}")):(e.htmlFields.DD_CITY.attr("rule")==undefined&&e.htmlFields.DD_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.DD_CITY.show().enableRule()),e.htmlFields.DD_CITY.val(""),e.htmlFields.TXT_CITY.hide().DisableVal(),e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.DD_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.DD_STATE.val(""),e.htmlFields.DD_STATE.val(i.CityList[0].State)):(e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.hide().DisableVal(),e.htmlFields.TXT_CITY.show().enableRule(),e.htmlFields.TXT_CITY.val(""),i.CityList.length>0?(e.htmlFields.TXT_CITY.val(i.CityList[0].City),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.HIDDEN_CITY.val(e.htmlFields.TXT_CITY.val()),e.htmlFields.DD_STATE.val(""),e.htmlFields.DD_STATE.val(i.CityList[0].State),e.htmlFields.TXT_CITY.show().removeAttr("disabledrule"),e.htmlFields.TXT_CITY.attr("rule","{'City', 'required'}")):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("")}),e.htmlFields.DD_STATE.val(r))):i.CityList.length>0?(n=="NewRAStatAgentPrincipalAddress"||n=="StatAgentPrincipalAddress"||n=="documentProcessingStep_CreateStatutoryAgentModal_PrincipalAddess"?swal({title:"",text:"Address is outside of Virginia.  Registered Office address must be in Virginia",type:"warning"},null):swal({title:"",text:"Zip Code falls outside the State of "+r+"\t\nPlease enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val(r)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val(r)),i.CountyList.length>0&&(i.CountyList[0].State==r||r==""||r==null)?i.CountyList.length>1?(e.htmlFields.DD_COUNTY.val(""),e.htmlFields.DD_COUNTY.val("")):(e.htmlFields.DD_COUNTY.val(""),i.CountyList.length>0?(e.htmlFields.DD_COUNTY.val(""),e.htmlFields.DD_COUNTY.val(i.CountyList[0].CountyID)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("")}),e.htmlFields.DD_STATE.val(r))):i.CountyList.length>0?(n=="NewRAStatAgentPrincipalAddress"||n=="StatAgentPrincipalAddress"||n=="documentProcessingStep_CreateStatutoryAgentModal_PrincipalAddess"?swal({title:"",text:"Address is outside of Virginia.  Registered Office address must be in Virginia",type:"warning"},null):swal({title:"",text:"Zip Code falls outside the State of "+r+"\t\nPlease enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val(r)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val(r))):f=="ForeignWorkFlow"&&(i.CityList.length>0&&(i.CityList[0].State!=u||u==""||u==null)?i.CityList.length>1?(e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.append("<option value=''>-- Select --<\/option>"),$.each(i.CityList,function(n,t){e.htmlFields.DD_CITY.append("<option value='"+t.City+"'>"+$.trim(t.City)+"<\/option>")}),e.htmlFields.DD_CITY.show().enableRule(),e.htmlFields.DD_CITY.val(""),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.HIDDEN_CITY.val(e.htmlFields.DD_CITY.val()),e.htmlFields.TXT_CITY.hide().DisableVal(),e.htmlFields.DD_STATE.val(""),e.htmlFields.DD_STATE.val(i.CityList[0].State)):(e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.hide().DisableVal(),e.htmlFields.TXT_CITY.show().enableRule(),e.htmlFields.TXT_CITY.val(""),i.CityList.length>0?(e.htmlFields.TXT_CITY.val(i.CityList[0].City),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.HIDDEN_CITY.val(e.htmlFields.TXT_CITY.val()),e.htmlFields.DD_STATE.val(""),e.htmlFields.DD_STATE.val(i.CityList[0].State)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("")}),e.htmlFields.DD_STATE.val(""))):i.CityList.length>0?(swal({title:"",text:"Zip Code falls within the State of "+u+"\t\nPlease enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val("")):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val("")),i.CountyList.length>0&&(i.CountyList[0].State!=u||u==""||u==null)?i.CountyList.length>1?(e.htmlFields.DD_COUNTY.val(""),e.htmlFields.DD_COUNTY.val("")):(e.htmlFields.DD_COUNTY.val(""),i.CountyList.length>0?e.htmlFields.DD_COUNTY.val(i.CountyList[0].CountyID):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("")}),e.htmlFields.DD_STATE.val(""))):i.CountyList.length>0?(swal({title:"",text:"Zip Code falls within the State of "+u+"\t\nPlease enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val("")):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},null),e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val("")));f=="FilterByStateAllowOthers"&&(i.CityList.length>1?(e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.append("<option value=''>-- Select --<\/option>"),$.each(i.CityList,function(n,t){e.htmlFields.DD_CITY.append("<option value='"+t.City+"'>"+$.trim(t.City)+"<\/option>")}),e.htmlFields.DD_CITY.attr("disabledrule")!=undefined?(e.htmlFields.DD_CITY.show().enableRule(),(n.indexOf("SOPMailingAddress")==0||n.indexOf("ServedAddress")==0||n.indexOf("CourtLocalityOtherAddress")==0)&&e.htmlFields.DD_CITY.show().enableRule()):(e.htmlFields.DD_CITY.attr("rule")==undefined&&e.htmlFields.DD_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.DD_CITY.show().enableRule()),e.htmlFields.HIDDEN_CITY.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.DD_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.DD_CITY.val(e.htmlFields.DD_CITY.find("option:nth-of-type(1)").val()),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.TXT_CITY.hide().DisableVal(),e.htmlFields.DD_STATE.val(""),e.htmlFields.HIDDEN_STATE.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.DD_STATE.val(e.htmlFields.HIDDEN_STATE.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.DD_STATE.val(i.CityList[0].State)):(e.htmlFields.DD_CITY.html(""),e.htmlFields.DD_CITY.hide().DisableVal(),e.htmlFields.TXT_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.TXT_CITY.show().enableRule(),e.htmlFields.TXT_CITY.val(""),i.CityList.length>0?(e.htmlFields.HIDDEN_CITY.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.TXT_CITY.val(i.CityList[0].City),e.htmlFields.HIDDEN_CITY.val(""),e.htmlFields.HIDDEN_CITY.val(e.htmlFields.TXT_CITY.val()),e.htmlFields.DD_STATE.val(""),e.htmlFields.HIDDEN_STATE.val()&&e.htmlFields.HIDDEN_ISEDIT.val()=="true"?(e.htmlFields.DD_STATE.val(e.htmlFields.HIDDEN_STATE.val()),e.htmlFields.HIDDEN_ISEDIT.val("false")):e.htmlFields.DD_STATE.val(i.CityList[0].State)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("");e.htmlFields.TXT_ZIP_5.attr("rule","{'Zip Code', 'required'}");e.htmlFields.DD_COUNTY.DisableVal()}),e.htmlFields.DD_STATE.val(r))),i.CountyList.length>1?(e.htmlFields.DD_COUNTY.val(""),e.htmlFields.DD_COUNTY.val("")):i.CountyList.length>0&&(e.htmlFields.DD_COUNTY.val(""),i.CountyList.length>0?(e.htmlFields.DD_COUNTY.val(""),e.htmlFields.DD_COUNTY.val(i.CountyList[0].CountyID)):(swal({title:"",text:"Please enter a valid Zip Code",type:"warning"},function(){e.htmlFields.TXT_ZIP_5.val("")}),e.htmlFields.DD_STATE.val(r))))}else e.htmlFields.TXT_ZIP_5.val(""),e.htmlFields.TXT_ZIP_4.val(""),e.htmlFields.TXT_CITY.val(""),e.htmlFields.DD_STATE.val(r)},error:function(){}})};e.AddLeadingZeros=function(n){return n=n.toString(),n.length!=0?n.length<5?e.AddLeadingZeros("0"+n,5):n:n};e.ZipvCodeValidate=function(n){e.setHTMLFields(n);var t=e.htmlFields.HIDDEN_DISPLAY_NAME.val();return $.trim(e.htmlFields.TXT_ZIP_5.val()).length<5&&$.trim(e.htmlFields.TXT_ZIP_5.val()).length>0?"Please enter a valid"+t+"  Zip Code":$.trim($(n+"_Zip5").val()).length==0?"Please Enter"+t+" Zip Code":""};e.GetAddressDataObject=function(n){return(e.setHTMLFields(n),e.ValidateAddressFieldsData(n)==!1)?!1:e.GetAddressObjectWithoutValidation(n)};e.GetAddressObjectWithoutValidation=function(n){e.modelName!==n&&e.setHTMLFields(n);return{Attention:e.htmlFields.TXT_ATTENTION.val()||"",ID:e.htmlFields.HIDDEN_ADDRESS_ID.val()||"",StreetAddress1:e.htmlFields.TXT_ADDRESS_1.val()||"",StreetAddress2:e.htmlFields.TXT_ADDRESS_2.val()||"",City:e.htmlFields.TXT_CITY.val()==""?e.htmlFields.DD_CITY.val()==""||e.htmlFields.DD_CITY.val()==null?"":e.htmlFields.DD_CITY.is(":disabled")?e.htmlFields.DD_CITYDESC.val():e.htmlFields.DD_CITY.val():e.htmlFields.TXT_CITY.val()||"",State:e.htmlFields.DD_STATE.is(":disabled")?e.htmlFields.DD_STATEDESC.val():e.htmlFields.DD_STATE.val()||"",OtherState:e.htmlFields.TXT_OTHER_STATE.val()||"",Zip5:e.htmlFields.TXT_ZIP_5.val()||"",Zip4:e.htmlFields.TXT_ZIP_4.val()||"",PostalCode:e.htmlFields.TXT_POSTAL_CODE.val()||"",Country:e.htmlFields.DD_COUNTRY.is(":disabled")?e.htmlFields.DD_COUNTRYDESC.val()==null?$helper.enums.Locales.Countries.USA:e.htmlFields.DD_COUNTRYDESC.val():e.htmlFields.DD_COUNTRY.val()==null?$helper.enums.Locales.Countries.USA:e.htmlFields.DD_COUNTRY.val()||"",County:{CountyId:e.htmlFields.DD_COUNTY.val()==null||e.htmlFields.DD_COUNTY.val()==undefined||e.htmlFields.DD_COUNTY.val()==""?e.htmlFields.DD_COUNTYDESC.val():e.htmlFields.DD_COUNTY.val(),CountyName:e.htmlFields.DD_COUNTY.find(":selected").text()||""},Email:e.htmlFields.TXT_EMAIL.val()||"",EmailAddress:e.htmlFields.TXT_EMAIL.val()||"",getFullAddress:function(){return this.StreetAddress1!=undefined&&this.StreetAddress1.trim()==""&&this.StreetAddress2!=undefined&&this.StreetAddress2.trim()==""&&this.Zip5!=undefined&&this.Zip5.trim()==""&&this.City!=undefined&&this.City.trim()==""?"No records to view.":this.Country==$helper.enums.Locales.Countries.USA?(this.StreetAddress1==""?"":this.StreetAddress1+", ")+(this.StreetAddress2.trim()==""?"":this.StreetAddress2+", ")+(this.City==""?"":this.City+", ")+(this.State==""?"":this.State+", ")+(this.Zip5==""?"":this.Zip5)+(this.Zip4==""?",":"- "+this.Zip4+", ")+(this.Country==""?"":this.Country):this.StreetAddress1+", "+(this.StreetAddress2!=undefined&&this.StreetAddress2.trim()!=""?this.StreetAddress2+", ":"")+this.City+", "+(this.OtherState!=undefined&&this.OtherState.trim()!=""?this.OtherState+", ":"")+(this.PostalCode!=undefined&&this.PostalCode.trim()!=""?this.PostalCode+", ":"")+this.Country},getFullAddressForMelissa:function(){return this.Country==$helper.enums.Locales.Countries.USA?(this.StreetAddress1==""?"":this.StreetAddress1+", ")+(this.StreetAddress2.replace(/\s+/g,"")==""?"":this.StreetAddress2+", ")+(this.City==""?"":this.City+", ")+(this.State==""?"":this.State+", ")+(this.Zip5==""?"":this.Zip5+", ")+(this.Country==""?"":this.Country):this.StreetAddress1+", "+(this.StreetAddress2!=undefined&&this.StreetAddress2.trim()!=""?this.StreetAddress2+", ":"")+this.City+", "+(this.OtherState!=undefined&&this.OtherState.trim()!=""?this.OtherState+", ":"")+(this.PostalCode!=undefined&&this.PostalCode.trim()!=""?this.PostalCode+", ":"")+this.Country},getFullAddressForAgent:function(){return console.log("I am in this function getFullAddressForAgent"),e.GetFullAddressWithoutNulls(this)}}};e.GetFullAddressWithoutNulls=function(n){var t="";return t=n.StreetAddress1,t+=(n.StreetAddress1==""?"":",")+n.StreetAddress2,t+=(n.StreetAddress2==""?"":",")+n.City,t+=(n.City==""?"":",")+n.State,t+=(n.State==""?"":",")+n.OtherState,t+=(n.OtherState==""?"":",")+n.PostalCode,t+=(n.PostalCode==""?"":",")+(n.PostalCode==""?n.Zip5:""),t+=(n.PostalCode!=""?"":n.Zip5==""?"":",")+(n.State!=""&&n.Country==""?$helper.enums.Locales.Countries.USA:n.Country),t=t==""?"NONE":t=="IN,USA"?"NONE":t,console.log("I am in this function"),t};e.ClearAddress=function(n){e.setHTMLFields(n);var t=e.htmlFields.HIDDEN_FILTER_BY_STATE.val();e.htmlFields.TXT_ATTENTION.val("");e.htmlFields.TXT_ADDRESS_1.val("");e.htmlFields.TXT_ADDRESS_2.val("");e.htmlFields.TXT_CITY.val("");e.htmlFields.DD_CITY.val("");e.htmlFields.DD_STATE.val(t);e.htmlFields.DD_COUNTY.val("");e.htmlFields.TXT_OTHER_STATE.val();e.htmlFields.TXT_ZIP_5.val("");e.htmlFields.TXT_ZIP_4.val("");e.htmlFields.TXT_POSTAL_CODE.val("");e.htmlFields.TXT_EMAIL.val("");e.htmlFields.DD_COUNTRY.val($helper.enums.Locales.Countries.USA).trigger("change")};e.IsExistingAddress=function(){return e.htmlFields.TXT_ATTENTION.val().length>0||e.htmlFields.TXT_ADDRESS_1.val().length>0||e.htmlFields.TXT_ADDRESS_2.val().length>0||e.htmlFields.TXT_ZIP_5.val>0||e.htmlFields.TXT_CITY.val().length>0};e.ValidateAddressFieldsData=function(n){e.setHTMLFields(n);var t="";return($.trim(e.htmlFields.TXT_ADDRESS_1.val())==""&&(t=t+"Please enter Address Line 1\n\t "),$.trim(e.htmlFields.DD_COUNTRY.val())==""&&(t=t+"Please select Country\n\t "),e.htmlFields.DD_COUNTRY.val()==$helper.enums.Locales.Countries.USA&&$.trim(e.htmlFields.TXT_ZIP_5.val())==""&&(t=t+"Please enter Zip Code\n\t "),$.trim(e.htmlFields.TXT_CITY.val())==""&&($.trim(e.htmlFields.DD_CITY.val())==""||e.htmlFields.DD_CITY.val()==null)&&e.htmlFields.DD_COUNTRY.val()!=$helper.enums.Locales.Countries.USA&&(t=t+"Please enter City\n\t "),e.htmlFields.DD_COUNTRY.val()==$helper.enums.Locales.Countries.USA&&$.trim(e.htmlFields.DD_STATE.val())==""&&(t=t+"Please select State\n\t "),$.trim(e.htmlFields.DD_COUNTY.val())==""&&(t=t+"Please select County\n\t "),e.htmlFields.TXT_EMAIL.hasClass("rule")&&$.trim(e.htmlFields.TXT_EMAIL.val())==""&&(t=t+"Please enter Email Address\n\t "),t!="")?(swal({title:"",text:t,type:"warning"}),!1):!0};e.PopulateAddressFields=function(n,t,i,r,u,f,o,s,h,c,l,a,v,y,p,w){console.log("I am there!!!-");e.setHTMLFields(n);e.ApplyDisplayType(t);e.htmlFields.TXT_ATTENTION.val(i);e.htmlFields.TXT_ADDRESS_1.val(r);e.htmlFields.TXT_ADDRESS_2.val(u);e.htmlFields.DD_COUNTRY.val(f).trigger("change");e.htmlFields.TXT_ZIP_5.val(o);f=="USA"?(e.SetCitiesAndCountiesByZip(n,!1),(s!=undefined||s!=null)&&e.AssignCityFields(s)):e.htmlFields.TXT_CITY.val(s);e.htmlFields.TXT_ZIP_4.val(y);e.htmlFields.DD_STATE.val(h);e.htmlFields.HIDDEN_STATE.val(h);e.htmlFields.DD_COUNTY.val(c);(c!=undefined||c!=null)&&(e.htmlFields.HIDDEN_COUNTY.val(c),e.htmlFields.DD_COUNTY.trigger("change"));e.htmlFields.TXT_POSTAL_CODE.val(a);e.htmlFields.TXT_OTHER_STATE.val(p);l!=undefined&&l!=""&&e.htmlFields.TXT_EMAIL.val(l.trim());e.htmlFields.HIDDEN_ISEDIT.val(w)};e.AssignCityFields=function(n){var i=e.htmlFields.DD_CITY.find("option"),t=!1;$(i).each(function(){var i=$(this).val();if(i!=undefined&&n.toUpperCase()==i.toUpperCase())return e.htmlFields.DD_CITY.val(i),e.htmlFields.TXT_CITY.val(i),e.htmlFields.HIDDEN_CITY.val(i),t=!0,!1});t||n==undefined||n==""||(e.htmlFields.TXT_CITY.val(n).show(),e.htmlFields.TXT_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.DD_CITY.hide().disableRule(),e.htmlFields.HIDDEN_CITY.val(n))};e.PopulateForeignAddressFields=function(n,t){e.setHTMLFields(n);$.isEmptyObject(t)||(typeof t.PostalCode!="undefined"&&e.htmlFields.TXT_POSTAL_CODE.val(t.PostalCode),typeof t.OtherState!="undefined"&&e.htmlFields.TXT_OTHER_STATE.val(t.OtherState))};e.ApplyRule=function(n){e.setHTMLFields(n);var t="#"+n,i=e.htmlFields.HIDDEN_DISPLAY_NAME.val();e.disableValidation||(t!="#NewResidentAgentPrincipalAddress"&&$(t+"_StreetAddress1").attr("rule","{'Address Line 1', 'required'}"),e.htmlFields.DD_COUNTRY.val()==$helper.enums.Locales.Countries.USA&&(e.htmlFields.DD_CITY.attr("rule","{'City', 'required'}"),e.htmlFields.DD_STATE.attr("rule","{'State', 'required'}"),$(t+"_Zip5").attr("rule","{'Zip Code', 'required'}"),e.htmlFields.HIDDEN_COUNTYORLOCALITY.val()=="County"?e.htmlFields.DD_COUNTY.attr("rule","{'County', 'required'}"):e.htmlFields.DD_COUNTY.attr("rule","{'Locality', 'required'}")),$(t+"_PostalCode").attr("disabledRule","{'Zip Code', 'required'}"),$(t+"_EmailAddress").attr("rule","{'Email Address', 'required'}"),e.htmlFields.DD_COUNTRY.attr("rule","{'Country', 'required'}"))};e.ApplyDisplayType=function(n){e.displayType=n;n=="Individual"?e.htmlFields.TR_ATTENTION_CONTENT.hide():n=="Entity"&&e.htmlFields.TR_ATTENTION_CONTENT.data("is-hidden")!=!0&&e.htmlFields.TR_ATTENTION_CONTENT.show()};e.ApplyDisplayType(e.displayType);e.ApplyRuleSet=function(n,t,i){e.ruleSetName=n==""?e.ruleSetName:n;e.filterByState=t;e.filterOutsideOfState=i;e.htmlFields.HIDDEN_RULE_SET_NAME.val(e.ruleSetName);e.htmlFields.HIDDEN_FILTER_BY_STATE.val(e.filterByState);var r=e.ruleSetName,u=e.filterByState,f=e.filterOutsideOfState;r=="Default"||(r=="FilterByState"?(console.log("Disabled the country and state drop down"),e.htmlFields.DD_COUNTRY.attr("disabled",!0),e.htmlFields.DD_STATE.attr("disabled",!0),e.htmlFields.DD_COUNTRY.css("color","graytext"),e.htmlFields.DD_STATE.css("color","graytext"),u==""&&console.log("No default state value provided")):r=="ForeignWorkFlow"?e.htmlFields.DD_STATE.val()==f&&e.htmlFields.DD_STATE.val(""):r=="FilterByStateAllowOthers"&&(console.log("Disabled the country  drop down"),e.htmlFields.DD_COUNTRY.attr("disabled",!0),e.htmlFields.DD_COUNTRY.css("color","graytext"),u==""&&console.log("No default FilterByStateAllowOthers value provided")))};e.Initialize=function(){if(e.htmlFields.DD_COUNTRY.val()==$helper.enums.Locales.Countries.USA)e.USACountry(e.modelName),e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val()),e.htmlFields.DD_COUNTY.val(e.htmlFields.HIDDEN_COUNTY.val());else{var n=e.htmlFields.TXT_POSTAL_CODE.val(),t=e.htmlFields.TXT_OTHER_STATE.val();e.OtherCountry(e.modelName);e.htmlFields.TXT_POSTAL_CODE.val(n);e.htmlFields.TXT_OTHER_STATE.val(t);e.htmlFields.TXT_CITY.val(e.htmlFields.HIDDEN_CITY.val());e.htmlFields.DD_COUNTY.val(e.htmlFields.HIDDEN_COUNTY.val())}e.ApplyRule(e.modelName);e.ApplyRuleSet(e.ruleSetName,e.filterByState,e.filterOutsideOfState);e.ApplyDisplayType();e.htmlFields.DD_COUNTRY.val()==$helper.enums.Locales.Countries.USA&&e.htmlFields.TXT_CITY==""&&e.htmlFields.TXT_ZIP_5.val()!=""&&e.Zip5Change(e.htmlFields.TXT_ZIP_5.val())};e.Initialize()};typeof gcr.corps.shoppingcart=="undefined"&&(gcr.corps.shoppingcart=$({}));typeof gcr.corps.shoppingcart.checkout=="undefined"&&(gcr.corps.shoppingcart.checkout=$({}));gcr.corps.shoppingcart.loadViewModel=function(n){function r(){t.UI.$btn_EditCartItem.click(function(){});t.UI.$btn_Checkout.click(function(n){if((n.preventDefault(),n.stopPropagation(),isNaN(parseFloat($("#cartTotal").html())))||parseFloat($("#cartTotal").html())<0)return!1;f()});t.UI.$btn_RemoveCartItem.click(function(){s($(this).closest("tr"))});t.UI.$btn_AddFiling.click(function(){})}function u(){var n=0,t=0;$("#tblResult").find("[id='itemAmount']").each(function(){n+=parseFloat($(this).attr("value")==""?0:$(this).attr("value"));t++});$("#cartTotal").text(n.toFixed(2))}function f(){ajaxSettings={type:"POST",cache:!1,url:$helper.config.settings.ValidatePreCheckout,datatype:"json"};$.ajaxCallWithAntiforgery(ajaxSettings,e,o,null)}function e(n){n.Data==""?(setTimeout(function(){processDialog.dialog("open")},0),window.location=$helper.config.settings.GotoPayment):(swal({title:"Alert",text:n.Data,type:"warning",showCancelButton:!1,confirmButtonText:"Ok",closeOnConfirm:!0,html:!0,customClass:"swal-width"}),$(".confirm").attr("title","Ok"))}function o(n){swal({title:"",text:n.Message,type:"warning"},null)}function s(n){swal({title:"",text:"Are you sure you want to delete this transaction?",type:"warning",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",closeOnConfirm:!0,closeOnCancel:!0},function(i){i&&(console.log(n.prop("id")),console.log(n.attr("businessid")),console.log(t.DataModel),$.ajax({type:"POST",url:$helper.config.settings.RemoveCartItem,datatype:"json",data:{cartItemID:n.prop("id"),BusinessID:n.attr("businessid")},success:function(n){n.IsSuccessful==!0?(setTimeout(function(){processDialog.dialog("open")},0),window.location.href=APP_ROOT+"ShoppingCart/Index"):swal({title:"",text:n.Message,type:"warning"},null)}}))})}var i=this,t={DataModel:n,UI:{$container_ShoppingCart:$("#container_ShoppingCart"),$btn_EditCartItem:$("#btn_Edit"),$btn_RemoveCartItem:$(".btn_Remove"),$btn_Checkout:$("#btn_Checkout"),$btn_AddFiling:$("#btn_AddFiling")}};i.Init=function(){r();u()};i.Init()};gcr.corps.shoppingcart.checkout.loadViewModel=function(){var n=this}