// Do not reference this script file directly via /rates.js // pull this resource from /mamscripts?siteId={yourGuid} to dynamically generate a script file for your site var MAM = { siteId: 'F1725FB8-439A-432D-92E9-73DC91F8A689', apiRootUrl : 'https://api.memberadvantagemortgage.com/', widgetRootUrl: 'https://widget.memberadvantagemortgage.com/', calcModalRendered: false, leadCaptureModalRenderStatus: 'none', validAreaCodes: [201,202,203,205,206,207,208,209,210,212,213,214,215,216,217,218,219,224,225,228,229,231,234,239,240,248,251,252,253,254,256,260,262,267,269,270,276,281,301,302,303,304,305,307,308,309,310,312,313,314,315,316,317,318,319,320,321,323,325,330,334,336,337,339,347,351,352,360,361,386,401,402,404,405,406,407,408,409,410,412,413,414,415,417,419,423,425,430,432,434,435,440,443,469,478,479,480,484,501,502,503,504,505,507,508,509,510,512,513,515,516,517,518,520,530,540,541,551,559,561,562,563,567,570,571,573,574,575,580,585,586,601,602,603,605,606,607,608,609,610,612,614,615,616,617,618,619,620,623,626,630,631,636,641,646,650,651,660,661,662,678,682,701,702,703,704,706,707,708,712,713,714,715,716,717,718,719,720,724,727,731,732,734,740,754,757,760,763,765,770,772,773,774,775,781,785,786,801,802,803,804,805,806,808,810,812,813,814,815,816,817,818,828,830,831,832,843,845,847,848,850,856,857,858,859,860,862,863,864,865,866,870,901,903,904,906,907,908,909,910,912,913,914,915,916,917,918,919,920,925,928,931,936,937,940,941,947,949,951,952,954,956,970,971,972,973,978,979,980,985,989], leadCapturePages : [1,2,3,4], configuration: {"siteId":"F1725FB8-439A-432D-92E9-73DC91F8A689","siteUrl":"https://www.mtcfederal.com/","name":"MTC FCU","institutionId":"MTC Federal Credit Union","lockPeriod":45,"widgets":{"paymentCalculator":{"title":"Payment Calculator","veteranQuestionText":"Are you Active Duty Military or a Veteran?","linkUrl":"LeadCapture","linkText":"Get Quote","serverConfig":{"products":{"30YRFXFNMA":{"name":"30 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000},"20YRFXFNMA":{"name":"20 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000},"15YRFXFNMA":{"name":"15 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000},"30VAFXFRANK":{"name":"VA 30 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000},"15VAFXFRANK":{"name":"VA 15 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000},"30FHAFXFHLMC":{"name":"FHA 30 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000},"15FHAFXFHLMC":{"name":"FHA 15 Year Fixed","useParRate":true,"ccFixed":3000,"ccVarPerc":0.00125,"ccVarThresh":150000}}}},"todaysRatesCards":{"products":[{"product":"15 Year Fixed","linkText":"Get Quote","linkUrl":"LeadCapture","description":"Save on interest compared to a 30-year fixed loan, and get a low, fixed monthly payment."},{"product":"30 Year Fixed","linkText":"Get Quote","linkUrl":"LeadCapture","description":"Enjoy a low, fixed monthly payment, and avoid paying mortgage insurance."},{"product":"5/1 Year ARM","linkText":"Get Quote","linkUrl":"LeadCapture","description":"Get our lowest rate available for the first five years of your mortgage."},{"product":"FHA 30 Year Fixed","linkText":"Get Quote","linkUrl":"LeadCapture","description":"Buy or refinance with more lenient credit requirements."},{"product":"VA 30 Year Fixed","linkText":"Get Quote","linkUrl":"LeadCapture","description":"Take advantage of benefits available to military veterans, active-duty service members and eligible surviving spouses."}]}}}, // injected from server paymentCalculatorConfig: {}, mortgageCalculatorConfig: {}, refinanceCalculatorConfig: {}, // Widgets renderRatesTable: function(target, instanceId, userConfig) { if (!instanceId) instanceId = 'todaysRatesTable'; var config = userConfig ? userConfig : this.configuration.widgets[instanceId]; if (!config || !config.products) { console.log("invalid rates table configuration"); return; } var itemsWithLeadCapture = null; config.products.filter(function(rate) { if (rate.linkUrl == "LeadCapture") itemsWithLeadCapture = rate; }); if (itemsWithLeadCapture && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render MAM vert table. `target` required but was not found'); return; } var vertApiEndpoint = this.apiRootUrl + 'rates/current/todaysRatesTable'; jQuery.ajax({ url: vertApiEndpoint, method: 'POST', type: 'POST', data: JSON.stringify({ siteId: this.siteId, config: config }), contentType: 'application/json', dataType: 'html', success: function (data) { jQuery(target).html(data); }, error: function (e) { console.error(e); jQuery(target).html(e.statusText); } }) }, renderRatesCards: function(target, instanceId, userConfig) { if (!instanceId) instanceId = 'todaysRatesCards'; var config = userConfig ? userConfig : this.configuration.widgets[instanceId]; if (!config || !config.products) { console.log("invalid rates cards configuration"); return; } var itemsWithLeadCapture = null; config.products.filter(function(rate) { if (rate.linkUrl == "LeadCapture") itemsWithLeadCapture = rate; }); if (itemsWithLeadCapture && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render MAM horiz table. `target` required but was not found'); return; } var horizApiEndpoint = this.apiRootUrl + 'rates/current/todaysRatesCards'; jQuery.ajax({ url: horizApiEndpoint, method: 'POST', type: 'POST', data: JSON.stringify({ siteId: this.siteId, config: config }), contentType: 'application/json', dataType: 'html', success: function (data) { jQuery(target).html(data); }, error: function (e) { console.error(e); jQuery(target).html(e.statusText); } }) }, renderPaymentCalculator: function ( target, instanceId, userConfig ) { if (!target) target = '#mam-calculator'; if (!instanceId) instanceId = 'paymentCalculator'; if (typeof instanceId === 'object' || !instanceId) { instanceId = 'paymentCalculator'; } this.paymentCalculatorConfig = userConfig ? userConfig : this.configuration.widgets[instanceId]; this.paymentCalculatorConfig.serverConfig.lockPeriod = this.configuration.lockPeriod; if ((!this.paymentCalculatorConfig || !this.paymentCalculatorConfig.linkUrl || this.paymentCalculatorConfig.linkUrl == 'LeadCapture') && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render calculator. `target` required but was not found.'); return; } jQuery(target).html(''); var that = this; var widgetRootUrl = that.widgetRootUrl + 'paymentCalculator/'; if (widgetRootUrl.indexOf('localhost') > -1) widgetRootUrl = that.widgetRootUrl; var script1 = document.createElement('script'); script1.src = widgetRootUrl + 'static/js/main.chunk.js'; document.getElementsByTagName('head')[0].appendChild(script1); var script2 = document.createElement('script'); script2.src = widgetRootUrl + 'static/js/runtime~main.js'; document.getElementsByTagName('head')[0].appendChild(script2); var script3 = document.createElement('script'); script3.src = widgetRootUrl + 'static/js/0.chunk.js'; document.getElementsByTagName('head')[0].appendChild(script3); if (target != '#mamcalc-modal-content') { jQuery.post({ url: this.apiRootUrl + 'paymentCalculator/event/impression', type: 'POST', data: JSON.stringify({ siteId: that.siteId }), contentType: 'application/json', }); } }, renderPaymentCalculatorModal: function( instanceId, userConfig ) { jQuery.ajax({ url: MAM.apiRootUrl + "calculatorModal.html", contentType: 'text/html', success: function (result) { jQuery('body').prepend(result); MAM.renderPaymentCalculator('#mamcalc-modal-content', instanceId, userConfig); MAM.calcModalRendered = true; }, error: function (e) { console.log(e); jQuery(target).html(e.statusText); } }) }, bindRates: function() { var that = this; var ratesEndpoint = this.apiRootUrl + 'rates/current/json/' + this.siteId; jQuery.ajax({ url: ratesEndpoint, method: 'GET', dataType: 'json', success: function (data) { var itemsBinded = []; jQuery("[mam-rate-product]").each(function () { var productName = jQuery(this).attr('mam-rate-product'); var product = null; data.rates.filter(function (rate) { if (rate.product == productName) product = rate; }) if (!product) { console.error('Product `' + productName + '` not found'); return; } var prop = jQuery(this).attr('mam-rate-property'); var val = prop == 'rate' ? product.rate : prop == 'apr' ? product.apr : prop == 'points' ? product.points : prop == 'payment' ? product.payment : 'mam-rate-product attribute required' ; itemsBinded.push({ product: productName, property: prop, }) if (jQuery(this).attr('mam-rate-formatter')) { var func = jQuery(this).attr('mam-rate-formatter'); val = eval(func)(val); } jQuery(this).html(val); }) jQuery.post({ url: that.apiRootUrl + 'rates/event/bindRates', type: 'POST', data: JSON.stringify({items: itemsBinded, siteId: that.siteId }), contentType: 'application/json', }); }, error: function (e) { console.error(e); } }) }, renderLeadCaptureModal: function( options ) { var that = this; MAM.leadCaptureModalRenderStatus = 'rendering'; if (options && options.pages) { MAM.leadCapturePages = options.pages; } // Load LeadCapture template jQuery.ajax({ url: MAM.apiRootUrl + "leadcapture/leadcapture.html", contentType: 'text/html', success: function (result) { jQuery('body').append(result); var pageCntLoaded = 0; for (var i = 0; i < MAM.leadCapturePages.length; i++) { var pageNumber = MAM.leadCapturePages[i].toString(); var pageName = "page" + (pageNumber < 10 ? "0" : "") + pageNumber.toString(); // Load/Insert each page jQuery.ajax({ url: MAM.apiRootUrl + "leadcapture/" + pageName + ".html?v=101", contentType: 'text/html', success: function (result) { jQuery('#mamleadcapture-pages').append(result); pageCntLoaded++; if (pageCntLoaded == MAM.leadCapturePages.length) { MAM.leadCaptureModalStep(1); MAM.leadCaptureModalRenderStatus = 'rendered'; } }, error: function (e) { console.log(e); } }) } }, error: function (e) { console.log(e); } }) }, renderMortgageCalculator: function ( target, instanceId, userConfig ) { if (!target) target = '#mam-mortgage-calculator'; if (!instanceId) instanceId = 'mortgageCalculator'; if (typeof instanceId === 'object' || !instanceId) { instanceId = 'mortgageCalculator'; } this.mortgageCalculatorConfig = userConfig ? userConfig : this.configuration.widgets[instanceId]; if ((!this.mortgageCalculatorConfig || !this.mortgageCalculatorConfig.linkUrl || this.mortgageCalculatorConfig.linkUrl == 'LeadCapture') && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render calculator. `target` required but was not found.'); return; } jQuery(target).html(''); var that = this; var widgetRootUrl = that.widgetRootUrl + 'mortgageCalculator/'; if (widgetRootUrl.indexOf('localhost') > -1) widgetRootUrl = that.widgetRootUrl; var script1 = document.createElement('script'); script1.src = widgetRootUrl + 'static/js/main.chunk.js'; document.getElementsByTagName('head')[0].appendChild(script1); var script2 = document.createElement('script'); script2.src = widgetRootUrl + 'static/js/runtime-main.js'; document.getElementsByTagName('head')[0].appendChild(script2); var script3 = document.createElement('script'); script3.src = widgetRootUrl + 'static/js/0.chunk.js'; document.getElementsByTagName('head')[0].appendChild(script3); }, renderRefinanceCalculator: function ( target, instanceId, userConfig ) { if (!target) target = '#mam-refinance-calculator'; if (!instanceId) instanceId = 'refinanceCalculator'; if (typeof instanceId === 'object' || !instanceId) { instanceId = 'refinanceCalculator'; } this.refinanceCalculatorConfig = userConfig ? userConfig : this.configuration.widgets[instanceId]; if ((!this.refinanceCalculatorConfig || !this.refinanceCalculatorConfig.linkUrl || this.refinanceCalculatorConfig.linkUrl == 'LeadCapture') && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render calculator. `target` required but was not found.'); return; } jQuery(target).html(''); var that = this; var widgetRootUrl = that.widgetRootUrl + 'refinanceCalculator/'; if (widgetRootUrl.indexOf('localhost') > -1) widgetRootUrl = that.widgetRootUrl; var script1 = document.createElement('script'); script1.src = widgetRootUrl + 'static/js/main.chunk.js'; document.getElementsByTagName('head')[0].appendChild(script1); var script2 = document.createElement('script'); script2.src = widgetRootUrl + 'static/js/runtime-main.js'; document.getElementsByTagName('head')[0].appendChild(script2); var script3 = document.createElement('script'); script3.src = widgetRootUrl + 'static/js/0.chunk.js'; document.getElementsByTagName('head')[0].appendChild(script3); }, // Calculator Modal calcModalShow: function() { jQuery.post({ url: this.apiRootUrl + 'paymentCalculator/event/impression', type: 'POST', data: JSON.stringify({ siteId: this.siteId }), contentType: 'application/json', }); jQuery('#mamcalc-modal').fadeIn(); }, calcModalClose: function() { jQuery('#mamcalc-modal').fadeOut('fast'); }, // Lead Capture Modal leadCaptureModalShow: function(contextParams) { this.calcModalClose(); // carry over hidden values Object.keys(contextParams).forEach(function(key) { jQuery("#mamleadcapture-form input[velocify-name='" + key + "']").val(contextParams[key]); }) jQuery('#mamleadcapture-modal').fadeIn(); }, leadCaptureModalClose: function() { jQuery('#mamleadcapture-modal').fadeOut('fast'); }, leadCaptureModalStep: function(direction) { var steps = MAM.leadCapturePages; var stepCnt = steps.length; var currentElem = jQuery('#mamleadcapture-modal-content [mamleadcapture-page].active'); var currentStep = Number(currentElem.attr('mamleadcapture-page')); var targetIndex = steps.indexOf(currentStep) + direction; var targetStep = steps[targetIndex]; var isFirstStep = steps.indexOf(targetStep) == 0; var isLastStep = steps.indexOf(targetStep) == steps.length - 1; jQuery('.mamleadcapture-validation').html(''); if (direction == 1) { var validationError = this.leadCaptureModalValidatePage(currentStep); if (validationError) { jQuery('.mamleadcapture-validation').html(validationError); return; } // track learn more progress if (MAM.leadCaptureModalRenderStatus == 'rendered') { var data = this.leadCaptureModalGetInputValues(currentStep); var leadCaptureId = jQuery('#mamleadcapture-modal-content input[velocify-name="LeadCaptureId"]').val(); data.siteId = MAM.siteId; data.page = currentStep; data.leadCaptureId = leadCaptureId; jQuery.post({ url: MAM.apiRootUrl + "event/leadcapturenext", data: data, success: function (result) { } }) } } jQuery('#mamleadcapture-modal-content [mamleadcapture-page]').removeClass('active'); jQuery('#mamleadcapture-modal-content [mamleadcapture-page="' + targetStep + '"]').addClass('active'); // update progress bar jQuery('#mamleadcapture-progressbar-fill').css('width', Number((targetIndex) * 100 / stepCnt) + "%"); // toggle action button visibilities if (isFirstStep) { jQuery('#mamleadcapture-btn-prev').hide(); jQuery('#mamleadcapture-btn-next').show(); jQuery('#mamleadcapture-btn-submit').hide(); } else if (isLastStep) { jQuery('#mamleadcapture-btn-prev').show(); jQuery('#mamleadcapture-btn-next').hide(); jQuery('#mamleadcapture-btn-submit').show(); } else { jQuery('#mamleadcapture-btn-prev').show(); jQuery('#mamleadcapture-btn-next').show(); jQuery('#mamleadcapture-btn-submit').hide(); } // if (MAM.leadCaptureModalRenderStatus == 'rendered') { // jQuery.get({ // url: MAM.apiRootUrl + "event/leadcapture?siteId=" + MAM.siteId + "&page=" + (targetIndex + 1), // success: function (result) { // } // }) // } }, leadCaptureModalSubmit: function() { jQuery('.mamleadcapture-validation').html(''); var currentElem = jQuery('#mamleadcapture-modal-content [mamleadcapture-page].active'); var currentStep = Number(currentElem.attr('mamleadcapture-page')); var validationError = this.leadCaptureModalValidatePage(currentStep); if (validationError) { jQuery('.mamleadcapture-validation').html(validationError); return; } var data = this.leadCaptureModalGetInputValues(currentStep); var leadCaptureId = jQuery('#mamleadcapture-modal-content input[velocify-name="LeadCaptureId"]').val(); data.siteId = MAM.siteId; data.page = currentStep; data.leadCaptureId = leadCaptureId; jQuery.post({ url: MAM.apiRootUrl + "event/leadcapturenext", data: data, success: function (result) { } }) jQuery("#mamleadcapture-form").submit(); jQuery("#mamleadcapture-modal-footer").hide(); jQuery('[mamleadcapture-page]').hide(); setTimeout(function() { jQuery('#mamleadcapture-confirm').fadeIn('slow'); }, 100); }, leadCaptureModalValidatePage: function(pageIndex) { var inputs = jQuery("[mamleadcapture-page='" + pageIndex + "'] [name]"); for (var i = 0; i < inputs.length; i++) { var name = jQuery(inputs[i]).attr('name'); var elem = jQuery("[mamleadcapture-page='" + pageIndex + "'] [name='" + name + "']"); // Required? if (elem.attr('required')) { var requiredMsg = elem.attr('required-message'); if (elem.attr('type') == 'radio') { if (!jQuery(elem).is(':checked')) { return requiredMsg; } } else { if (!elem.val()) { return requiredMsg; } } } // Phone ? if (elem.attr('type') == 'tel') { var phone = elem.val() .replace('(', "").replace(')', "") .replace(/-/g, "").replace(/ /g, ""); if (!(/^\d{10}$/.test(phone))) { return "Phone is invalid"; } var areaCode = phone.substring(0,3); if (this.validAreaCodes && this.validAreaCodes.indexOf(Number(areaCode)) == -1) { return "Invalid Area Code"; } } // Email ? if (elem.attr('type') == 'email') { if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(elem.val()))) { return "Email is invalid"; } } } return null; }, leadCaptureModalGetInputValues: function(pageIndex) { var inputs = jQuery("[mamleadcapture-page='" + pageIndex + "'] [name]"); var data = {}; for (var i = 0; i < inputs.length; i++) { var name = jQuery(inputs[i]).attr('name'); var field = jQuery(inputs[i]).attr('field'); var type = jQuery(inputs[i]).attr('type'); var elem; if (type == 'radio' || type == 'checkbox') { elem = jQuery("[mamleadcapture-page='" + pageIndex + "'] [name='" + name + "']:checked"); } else { elem = jQuery("[mamleadcapture-page='" + pageIndex + "'] [name='" + name + "']"); } data[field] = elem.val(); } return data; }, // Formatters (utilities) paymentFormatter: function(input) { if (!isNaN(input)) { return '$' + val.toFixed(2) } return ''; }, rateFormatter: function (input) { if (!isNaN(input)) { return input.toFixed(3) + '%'; } return ''; }, aprFormatter: function(input) { if (!isNaN(input)) { return input.toFixed(3) + '%'; } return ''; }, // Other showAssumptions: function() { var file = 'https://www.borrowercenter.memberadvantagemortgage.com/Assumptions.asp?siteId=' + this.siteId; msgWindow = window.open(file,'assumptionswin','toolbar=no,scrollbars=yes,width=550,height=350'); setTimeout("msgWindow.document.location.href='" + file + "';", 1000); msgWindow.focus(); }, // DEPRECATED, update instances to use renderRatesTable renderVertRates: function(target, rates) { var instanceId = 'todaysRatesTable'; var config = this.configuration.widgets[instanceId]; var itemsWithLeadCapture = null; config.products.filter(function(rate) { if (rate.linkUrl == "LeadCapture") itemsWithLeadCapture = rate; }); if (itemsWithLeadCapture && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render MAM vert table. `target` required but was not found'); return; } var vertApiEndpoint = this.apiRootUrl + 'rates/current/todaysRatesTable'; jQuery.ajax({ url: vertApiEndpoint, method: 'POST', type: 'POST', data: JSON.stringify({ siteId: this.siteId, config: config }), contentType: 'application/json', dataType: 'html', success: function (data) { jQuery(target).html(data); }, error: function (e) { console.error(e); jQuery(target).html(e.statusText); } }) }, // DEPRECATED, update instances to use renderRatesCards renderHorizRates: function(target, rates) { var instanceId = 'todaysRatesCards'; var config = this.configuration.widgets[instanceId]; var itemsWithLeadCapture = null; config.products.filter(function(rate) { if (rate.linkUrl == "LeadCapture") itemsWithLeadCapture = rate; }); if (itemsWithLeadCapture && MAM.leadCaptureModalRenderStatus == 'none') { MAM.renderLeadCaptureModal(); } if (!jQuery(target).length) { console.log('unable to render MAM horiz table. `target` required but was not found'); return; } var horizApiEndpoint = this.apiRootUrl + 'rates/current/todaysRatesCards'; jQuery.ajax({ url: horizApiEndpoint, method: 'POST', type: 'POST', data: JSON.stringify({ siteId: this.siteId, config: config }), contentType: 'application/json', dataType: 'html', success: function (data) { jQuery(target).html(data); }, error: function (e) { console.error(e); jQuery(target).html(e.statusText); } }) }, renderCalculator: function ( target, instanceId, userConfig ) { this.renderPaymentCalculator(target, instanceId, userConfig); }, renderCalculatorModal: function (instanceId, userConfig ) { this.renderPaymentCalculatorModal(instanceId, userConfig); }, } console.log('MAM loaded'); document.addEventListener("DOMContentLoaded", function() { jQuery(document).on('click', '[mam-c2a-Link]', function(e) { var product = jQuery(e.target).attr('mam-c2a-Product'); var link = jQuery(e.target).attr('mam-c2a-Link'); var siteId = jQuery(e.target).attr('mam-c2a-SiteId'); var widget = jQuery(e.target).attr('mam-c2a-Widget'); var todaysRatesLearnMoreClickUrl = MAM.apiRootUrl + 'rates/event/learnmore'; var data = { product: product, siteId: siteId, widget: widget }; var isHyperlink = true; if (link && link.toUpperCase() == 'LEADCAPTURE') { function uuidv4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } var product = jQuery(e.target).attr('mam-c2a-Product'); var widget = jQuery(e.target).attr('mam-c2a-Widget'); var institutionName = jQuery(e.target).attr('mam-c2a-InstitutionName'); var leadSource = jQuery(e.target).attr('mam-c2a-LeadSource'); var leadCaptureId = uuidv4(); //init new lead capture Id var params = { LeadCaptureId: leadCaptureId, Product: product, Widget: widget, InstitutionName: institutionName, LeadSource: leadSource, LoanAmount: '', PurchasePrice: '', DownPayment: '', }; data.leadCaptureId = leadCaptureId; MAM.leadCaptureModalShow(params); isHyperlink = false; } else if (link && link.toUpperCase() == 'SHOWCALCMODAL') { var product = jQuery(e.target).attr('mam-c2a-Product'); var widget = jQuery(e.target).attr('mam-c2a-Widget'); var institutionName = jQuery(e.target).attr('mam-c2a-InstitutionName'); var leadSource = jQuery(e.target).attr('mam-c2a-LeadSource'); var params = { Product: product, Widget: widget, InstitutionName: institutionName, LeadSource: leadSource, LoanAmount: '', PurchasePrice: '', DownPayment: '', }; MAM.calcModalShow(); isHyperlink = false; } jQuery.ajax({ url: todaysRatesLearnMoreClickUrl, method: 'POST', type: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'html', success: function (data) { if (isHyperlink) { window.location.href = link; } }, error: function (e) { } }) }) });