PageSourceSearch

https://www.healthinsurance.org/wp-content/themes/hio/assets/calculator_subsidy.sherpa/js/calc.js?ver=4.0.750

js healthinsurance.org collected 2026-10-02 03:08:35 UTC 30,782 bytes, 990 lines download raw bytes

1// wp-content\themes\hio\assets\calculator_subsidy.sherpa\js\calc.js
2String.prototype.endsWith = function(suffix) {
3	return this.indexOf(suffix, this.length - suffix.length) !== -1;
4};
5
6String.prototype.trim = function () {
7	return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
8};
9
10String.prototype.padLeft = function (/*string*/ _string, /*integer*/ _length) {
11	var x = this;
12	while (x.length < _length) {x = _string + x;}
13	return x;
14};
15
16String.prototype.toTitleCase = function () {
17	return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
18}
19
20function stringToFloat(str){
21	if(str === null){
22		str='';
23	}
24	str = str.toString().replace(/[^\d\.]+/g, "");
25	return parseFloat(str);
26}
27
28function addCommas(str) {
29	// normalize string...
30	str = str.toString().replace(/[^\d\.]+/g, "");
31	var strArray = str.split('.');
32	var strInteger = strArray[0];
33	var strDecimal = strArray.length > 1 ? ('.' + strArray[1]) : '';
34	var strNew = strInteger.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
35	strNew += strDecimal;
36
37	return strNew;
38}
39
40function toCurrency(str, round){
41	str = (typeof str !== 'undefined' ? str : '');
42	if(round === undefined){ round = 0;};
43	str = stringToFloat(str).toFixed(round);
44	return ('$' + addCommas(str));
45}
46
47function expandedMedicaidCheck(state){
48	// states without medicaid expansion
49	var states_without_medicaid_expansion = [
50		'AL',
51		'FL',
52		'GA',
53		'ID',
54		'KS',
55		'ME',
56		'MO',
57		'MS',
58		'MI',
59		'NE',
60		'NC',
61		'OK',
62		'SC',
63		'SD',
64		'TN',
65		'TX',
66		'UT',
67		'VA',
68		'WI',
69		'WY'
70	];
71
72	if(typeof state === 'undefined' || state.length === 0){
73		return false;
74	}
75
76	return (jQuery.inArray(state, states_without_medicaid_expansion) == -1);
77}
78function removeEmptyDependents() {
79// censusData.dependentAges=[];
80	jQuery('.dependent.ageBlock').each(function( index ) {
81		value = jQuery(this).children('.ageField').val();
82		if(value.length == 0) {
83			jQuery(this).remove();
84		} else {
85//       censusData.dependentAges.push(value);
86		}
87	});
88
89	if(jQuery('.ageBlock').length == 1) {
90		jQuery('#dependentsAgeLabel').remove();
91	}
92
93	sortDependents();
94}
95
96function getDependents() {
97	censusData.dependentAges=[];
98	jQuery('.dependent.ageBlock').each(function( index ) {
99		value = jQuery(this).children('.ageField').val();
100		if(value.length > 0) {
101			censusData.dependentAges.push(value);
102		}
103	});
104}
105
106function sortDependents() {
107	// this will sort (re-assign the values) to the dependent ages.
108	getDependents();
109
110	censusData.dependentAges.sort(function(a,b){return a - b}); // sort by number rather than lexigraphically
111	censusData.dependentAges.reverse();
112
113	i = 0;
114	jQuery('.dependent.ageBlock').each(function( index ) {
115		jQuery(this).children('.ageField').val(censusData.dependentAges[i]);
116		i++;
117	});
118}
119
120function calculate() {
121
122	addDependentButtonCheck();
123
124	// gather form values into censusData object.
125	censusData.zip = jQuery('#zipcode').val();
126	censusData.countyFIPS = jQuery('#county').val();
127
128	censusData.taxableIncome = stringToFloat(jQuery('#taxableIncome').val());
129
130	//
131	censusData.ages = JSON.parse(JSON.stringify(censusData.dependentAges));
132
133	if(jQuery('.primary.ageBlock').children('.ageField').val().length > 0) {
134		censusData.ages.push(jQuery('.primary.ageBlock').children('.ageField').val());
135	}
136	//
137
138	censusData.ages.sort(function(a,b){return a - b}); // sort by number rather than lexigraphically
139	censusData.ages.reverse();
140
141	if(censusData.zip === '' || censusData.zip.length !== 5 || zipData.State === undefined || (zipData.State !== undefined && zipData.State.length == 0) || censusData.ages.length == 0) {
142		resetPlans();
143		return false;
144	}
145
146	/*********************************************************************
147	 Get individual costs...
148	 sets:
149	 plan_cost
150	 users[{age:age,cost:cost}]
151	 *********************************************************************/
152	// reset to defaults
153	calcData = {
154		'householdSize':0
155		,  'child_count':0
156		,  'adult_count':0
157		,  'child_count_IRS':0
158		,  'medicaid_eligible_flag':false
159		,  'medicaid_percentage':0
160		,  'chip_eligible_flag':false
161		,  'subsidy_amount':0
162		,  'penalty_amount':0
163		,  'users':[]
164		,  'expanded_medicaid_state': 0 // expandedMedicaidCheck(state);
165	};
166
167	calcData.users=[];
168
169
170
171	if(censusData.ages.length > jQuery('#householdSize').val()){
172		jQuery('#householdSize').val( censusData.ages.length );
173	}
174
175
176	calcData.householdSize = jQuery('#householdSize').val();
177
178// console.log(calcData.householdSize);
179
180	calcData.expanded_medicaid_state = expandedMedicaidCheck(zipData.State);
181
182	let ffmStates = ['AL', 'AK', 'AZ', 'AR', 'DE', 'FL', 'HI', 'IN', 'IA', 'KS', 'LA', 'MI', 'MS', 'MO', 'MT', 'NE', 'NH', 'NC', 'ND', 'OH', 'OK', 'OR', 'SC', 'SD', 'TN', 'TX', 'UT', 'WV', 'WI', 'WY'];
183	let ideonStates = ['CA', 'KY'];
184	let statesMissingStartingZero = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT'];
185
186	if(ffmStates.includes(zipData.State)){
187		if (!censusData.countyFIPS) {
188			censusData.countyFIPS = zipData.StateFIPS + zipData.primary_county_fips;
189		}
190		if(statesMissingStartingZero.includes(zipData.State)){
191			censusData.countyFIPS = '0' + censusData.countyFIPS;
192		}
193
194		healthCareCensus = {
195			household: {
196				income: censusData.taxableIncome,
197				people: []
198			},
199			market: 'Individual',
200			place: {
201				countyfips: censusData.countyFIPS,
202				state: zipData.State,
203				zipcode: censusData.zip
204			}
205		};
206
207		let mecApplicantsNo = calcData.householdSize - censusData.ages.length;
208
209		for (var i = 0; i < censusData.ages.length; i++) {
210			thisAge = censusData.ages[i];
211			healthCareCensus.household.people.push({'age': thisAge, 'aptc_eligible': true});
212		}
213
214		if(mecApplicantsNo > 0) {
215			for (var i = 0; i < mecApplicantsNo; i++) {
216				thisAge = censusData.ages[i];
217				healthCareCensus.household.people.push({'age': 21, 'has_mec': true});
218			}
219		}
220
221		getHealthCareSubsidy(healthCareCensus);
222
223	} else {
224		if (!censusData.countyFIPS) {
225			censusData.countyFIPS = zipData.StateFIPS + zipData.primary_county_fips;
226		}
227		if(statesMissingStartingZero.includes(zipData.State)){
228			censusData.countyFIPS = '0' + censusData.countyFIPS;
229		}
230
231		ideonCensus = {
232			applicants: [],
233			zip_code: censusData.zip,
234			fips_code: censusData.countyFIPS,
235			household_income: censusData.taxableIncome,
236			household_size: calcData.householdSize,
237			market: 'individual',
238		};
239
240		for (var i = 0; i < censusData.ages.length; i++) {
241			thisAge = censusData.ages[i];
242			if(thisAge > 18) {
243				ideonCensus.applicants.push({'age': thisAge, 'smoker': false, 'child': false});
244			} else {
245				ideonCensus.applicants.push({'age': thisAge, 'smoker': false, 'child': true});
246			}
247		}
248
249		getIdeonSubsidy(ideonCensus);
250
251	}
252
253//     else {
254//
255//        sherpaCensus = {
256//           zip_code: censusData.zip,
257//           fip_code: censusData.countyFIPS,
258//           household_income: censusData.taxableIncome,
259//           household_size: calcData.householdSize,
260//           apply_for_subsidy: true,
261//           applicants: []
262//        };
263// //  censusData.ages
264//        for (var i = 0; i < censusData.ages.length; i++) {
265//           thisAge = censusData.ages[i];
266//           sherpaCensus.applicants.push({'age': thisAge, 'relationship': 'dependent'});
267//        }
268//        //console.log(JSON.stringify(sherpaCensus));
269//        getSherpaSubsidy(sherpaCensus);
270//     }
271}
272
273
274function getSherpaSubsidy(census_data){
275
276	jQuery.getJSON(settingsCalc['healthsherpaURL'],census_data,
277		function(data) {
278			//console.log(JSON.stringify(data));
279			if('error' in data){
280				alert('Error: Could not find rates for your location.');
281			} else {
282				calcData.subsidy_amount = data.subsidy;
283				calcData.penalty_amount    = data.penalty;
284				calcData.medicaid_eligible_flag = data.medicaid;
285				calcData.medicaid_percentage = data.medicaid_percentage;
286				calcData.chip_eligible_flag = data.chip;
287				showResults();
288				SherpaData = data;
289
290				if (data.response_code !== 200 ) {
291					jQuery.ajax({
292						type: "POST",
293						url: settingsCalc.ajaxurl,
294						dataType:"json",
295						data: {
296							"action": "ihc_healthsherpa_api_fail_email",
297							"security": settingsCalc.security,
298							"response_code": data.response_code
299						},
300						success: function(data) {
301
302						}
303					});
304				}
305			}
306		}
307	);
308
309}
310
311function getHealthCareSubsidy(healthCareCensus){
312
313	jQuery.ajax({
314		type: "POST",
315		url: settingsCalc.ajaxurl,
316		dataType:"json",
317		data: {
318			"action": "ihc_get_healthcare_subsidy",
319			"security": settingsCalc.security,
320			"applicant_data": healthCareCensus
321		},
322		success: function(data) {
323			calcData.subsidy_amount = data.subsidy;
324			calcData.penalty_amount    = data.penalty;
325			calcData.medicaid_eligible_flag = data.medicaid;
326			calcData.medicaid_percentage = data.medicaid_percentage;
327			calcData.chip_eligible_flag = data.chip;
328			showResults();
329		}
330	});
331
332}
333
334function getIdeonSubsidy(ideonCensus){
335
336	jQuery.ajax({
337		type: "POST",
338		url: settingsCalc.ajaxurl,
339		dataType:"json",
340		data: {
341			"action": "ihc_get_ideon_subsidy",
342			"security": settingsCalc.security,
343			"applicant_data": ideonCensus
344		},
345		success: function(data) {
346			calcData.subsidy_amount = data.subsidy;
347			calcData.penalty_amount    = data.penalty;
348			calcData.medicaid_eligible_flag = data.medicaid;
349			calcData.medicaid_percentage = data.medicaid_percentage;
350			calcData.chip_eligible_flag = data.chip;
351			showResults();
352		}
353	});
354
355}
356
357function addExtraMargin() {
358	let subsidyCalcDesc = jQuery('.homepage-new .subsidy_calc_desc');
359	let subsidyCalcResultsWrapper = jQuery('.homepage-new .calculator-section #results_wrapper.show-results');
360	let dependents_rows = jQuery('.dependent.ageBlock').length / 3;
361	if (jQuery(window).width() > 1024) {
362		if (subsidyCalcDesc && subsidyCalcResultsWrapper.hasClass('show-results')) {
363			if(dependents_rows == 0) {
364				subsidyCalcDesc.removeClass('increase-margin');
365				subsidyCalcDesc.css('margin-bottom', '450px');
366			} else if(dependents_rows > 0 && dependents_rows <= 1){
367				subsidyCalcDesc.removeClass('increase-margin');
368				subsidyCalcDesc.css('margin-bottom', '550px');
369			} else if (dependents_rows <= 2){
370				subsidyCalcDesc.removeClass('increase-margin');
371				subsidyCalcDesc.css('margin-bottom', '600px');
372			} else if (dependents_rows <= 3){
373				subsidyCalcDesc.removeClass('increase-margin');
374				subsidyCalcDesc.css('margin-bottom', '650px');
375			}else if(dependents_rows < 4){
376				subsidyCalcDesc.removeClass('increase-margin');
377				subsidyCalcDesc.css('margin-bottom', '700px');
378			}
379		} else if(subsidyCalcDesc){
380			if(dependents_rows == 0) {
381				subsidyCalcDesc.removeClass('increase-margin');
382				subsidyCalcDesc.css('margin-bottom', '180px');
383			} else if(dependents_rows > 0 && dependents_rows <= 1){
384				subsidyCalcDesc.css('margin-bottom', '300px');
385			} else if (dependents_rows <= 2){
386				subsidyCalcDesc.css('margin-bottom', '350px');
387			} else if (dependents_rows <= 3){
388				subsidyCalcDesc.css('margin-bottom', '400px');
389			}else if(dependents_rows < 4){
390				subsidyCalcDesc.css('margin-bottom', '450px');
391			}
392		}
393	}
394}
395
396
397/*********************************************
398 End Calculator Functions
399 *********************************************/
400
401var calcDB = {
402	'ages' : {} // DB lookup
403}
404
405var zipData = {};
406
407var config = {
408	'maxChildren' : 3 // maximum number of children that will calc toward deduction
409	,  'maxChildAge' : 20 // max age of a person to still be considered a child for health care reform.
410	,  'maxChildAgeIRS' : 18 // max age of a person to still be considered a child for health care reform.
411	,  'maxDependents' : 11
412	,  'uniform_family_tier_states' : {
413		'NY': {    'single_parent_and_children':1.7,  'family':2.85 },
414		'VT': {    'single_parent_and_children':1.93, 'family':2.81 },
415	}
416}
417
418// init form vars...
419var censusData = {
420	'zip':''
421	,  'countyFIPS':''
422// ,   'primaryAge':0
423	,  'dependentAges':[]
424	,  'ages':[]
425	,  'taxableIncome':50000
426};
427
428// var db_flag = false;
429var calcData={};
430
431jQuery('#btnAddDependent').click(function($){
432
433	/**********************************************************************************
434	 Build dependent form piece...
435	 **********************************************************************************/
436
437	let familyAgeGroup = document.getElementById("family_ages_section");
438	familyAgeGroup.classList.add("family_ages_group");
439
440	if(jQuery('.dependent.ageBlock').length < config.maxDependents) {
441		btnRemoveDependent = jQuery('<div class="btnRemoveDependent"></div>'); // <input type="button" name="removeDependent" class="btnRemoveDependent button" value="X" />
442
443		newDependentHTML = '<div class="dependent ageBlock">';
444
445		newDependentHTML += '<select name="age" id="age' + (jQuery('.ageBlock').length + 1) + '" class="dependent ageField">';
446		newDependentHTML += '<option value="">Age</option>';
447
448		for ($i = 0; $i <= 64; $i++) {
449			newDependentHTML += ('<option value="' + $i + '">' + ($i > 0 ? ($i + ' year' + ($i > 1 ? 's' : '')) : '< 12 months') + '</option>');
450		}
451
452		newDependentHTML += '</select></div>';
453		newDependent = jQuery(newDependentHTML).append(btnRemoveDependent);
454
455		jQuery(newDependent).appendTo('#agesWrapper');
456
457		// needed to add style to new button.
458		jQuery('.ageBlock').trigger("create");
459
460		if (jQuery('.dependent.ageBlock').length == config.maxDependents) {
461			jQuery('#btnAddDependent').hide();
462		}
463
464		sortDependents();
465		addExtraMargin();
466	}
467
468});
469
470
471function showResults() {
472
473	jQuery('#shop_for_health_plans').attr('data-galabel', zipData.state);
474
475	resetPlans();
476
477	if(calcData.medicaid_eligible_flag && calcData.subsidy_amount == 0){
478
479		if(zipData.State === 'MN'){
480			setResult('medicaid-MN');
481			jQuery('#shop_for_health_plans').attr('data-gaevent', 'Medicaid-MN');
482		} else if(zipData.State === 'NY'){
483			setResult('medicaid-NY');
484			jQuery('#shop_for_health_plans').attr('data-gaevent', 'Medicaid-NY');
485		} else {
486			setResult('medicaid');
487
488			jQuery('#shop_for_health_plans').attr('data-gaevent', 'Medicaid');
489		}
490
491		// medicaid enrollment route page
492		jQuery('#shop_for_health_plans').attr('href',(settingsCalc.medicaidUrl));
493
494	} else {
495		// update button
496		jQuery('#shop_for_health_plans').html('Find Plans');
497		if(jQuery('#shop_for_health_plans').attr('href')) {
498			jQuery('#shop_for_health_plans').removeAttr('href');
499		}
500
501		// 2020
502		subsidy_states_array = ['AK','AL','AR','AZ','DE','FL','GA','HI','IA','IL','IN','KS','KY','LA','ME','MI','MO','MS','MT','NC','ND','NE','NH','NM','OH','OK','OR','SC','SD','TN','TX','UT','VA','WI','WV','WY'];
503		// 2019
504		//subsidy_states_array = ['AL','AK','AR','DE','FL','GA','HI','IL','IN','IA','KS','KY','LA','ME','MI','MS','MO','MT','NE','NV','NH','NJ','NM','NC','ND','OK','OR','PA','SC','SD','TN','TX','UT','VA','WV','WI','WY'];
505		// 2018
506		// subsidy_states_array = ['AL','AK','AZ','AR','DE','FL','GA','HI','IL','IN','IA','KS','LA','ME','MI','MS','MO','MT','NE','NV','NH','NJ','NM','NC','ND','OH','OK','OR','PA','SC','SD','TN','TX','UT','VA','WI','WY'];
507
508
509
510		// if(subsidy_states_array.indexOf(zipData.State) >= 0){
511		//     jQuery('#shop_for_health_plans').attr('href', ('/quotes/?-quote&type=subsidy-calculator&x-source=subsidy-calculator&zip=' + zipData.zip));
512		// } else {
513		//     jQuery('#shop_for_health_plans').attr('href', ('/quotes/?-quote&type=health-insurance&x-source=subsidy-calculator&zip=' + zipData.zip));
514		// }
515		//
516
517		let zip =  jQuery('#zipcode').val();
518		let zip3 = zip.substr(0, 3);
519
520		if(calcData.subsidy_amount > 0){
521			setResult('subsidy');
522			jQuery('#shop_for_health_plans').attr('data-gaevent', 'Subsidy');
523		} else {
524			jQuery('#shop_for_health_plans').attr('data-gaevent', 'No Subsidy');
525			setResult('no-subsidy');
526		}
527
528		let subsidy_not_available_states = ['CA', 'CO', 'CT', 'DC', 'GA', 'ID', 'IL', 'KY', 'ME', 'MD', 'MA', 'MN', 'NV', 'NJ', 'NM', 'NY', 'PA', 'RI', 'VT', 'VA', 'WA'];
529		if(subsidy_not_available_states.includes(zipData.State)){
530			setResult('no-subsidy-data-in-your-state');
531			jQuery('#results_wrapper #resultsBlock .amount#subsidy').hide();
532			jQuery('#shop_for_health_plans').attr('data-gaevent', 'No Subsidy');
533		} else {
534			jQuery('#results_wrapper #resultsBlock .amount#subsidy').show();
535		}
536
537
538
539
540	}
541}
542jQuery('#shop_for_health_plans').on('click',function(event){
543	if(!(calcData.medicaid_eligible_flag && calcData.subsidy_amount == 0)){
544		event.preventDefault();
545		let zip = jQuery('#zipcode').val();
546		product = 'health-insurance';
547		countyDropdown = jQuery(this).find('select[name="county-select"]').val();
548
549		quotingRedirection(zip, product, countyDropdown);
550	}
551});
552
553
554function resetPlans() {
555	setResult('incomplete');
556}
557
558function setResult(result_type) {
559	//check if the lang is en or es
560	if(document.documentElement.lang.toLowerCase().includes("en")) {
561		response_options = {
562			'incomplete': {
563				'title': 'Estimated monthly subsidy',
564				'amount': '$0',
565				'message': 'Provide information above to get an estimate.',
566				'button_label': 'Find plans',
567				'notice': null
568			},
569			'subsidy': {
570				'title': 'Estimated monthly subsidy',
571				'amount': toCurrency(calcData.subsidy_amount / 12),
572				'message': ('Your subsidy would reduce your premium by ' + toCurrency(calcData.subsidy_amount) + '/year.'),
573				'button_label': 'Find plans',
574				'notice': ("If you don't purchase ACA-compliant health insurance, it appears you will pay a penalty estimated at " + toCurrency(calcData.penalty_amount) + ".")
575			},
576			'no-subsidy': {
577				'title': 'No subsidy',
578				'amount': toCurrency(calcData.subsidy_amount / 12),
579				'message': 'Take a look at your premium and benefit options.',
580				'button_label': 'Find plans',
581				'notice': ("If you don't purchase ACA-compliant health insurance, it appears you will pay a penalty estimated at " + toCurrency(calcData.penalty_amount) + ".")
582			},
583			'no-subsidy-data-in-your-state': {
584				'title': 'Because this state utilizes a state-based Marketplace, subsidy data is not available.',
585				'amount': '$0',
586				'message': 'Click “Find plans” to take a look at premium and benefit options offered by our agency partners.',
587				'button_label': 'Find plans',
588				'notice': ("If you don't purchase ACA-compliant health insurance, it appears you will pay a penalty estimated at " + toCurrency(calcData.penalty_amount) + ".")
589			},
590
591			'medicaid': {
592				'title': 'You may be eligible <br>for Medicaid.',
593				'amount': null,
594				'message': 'Click “Find Medicaid” for <br>information on your state.',
595				'button_label': 'Find Medicaid',
596				'notice': null
597			},
598			'medicaid-NY': {
599				'title': 'You may be eligible <br>for New York\'s Essential Plan.',
600				'amount': null,
601				'message': 'Click “Essential Plan” to learn more.',
602				'button_label': 'Essential Plan',
603				'notice': null
604			},
605			'medicaid-MN': {
606				'title': 'You may be eligible <br>for MinnesotaCare.',
607				'amount': null,
608				'message': 'Click “MinnesotaCare” to learn more.',
609				'button_label': 'MinnesotaCare',
610				'notice': null
611			},
612
613		}
614	} else {
615		response_options = {
616			'incomplete': {
617				'title': 'Subsidio mensual estimado',
618				'amount': '$0',
619				'message': 'Proporcione la información anterior para obtener una estimación.',
620				'button_label': 'Buscar planes',
621				'notice': null
622			},
623			'subsidy': {
624				'title': 'Subsidio mensual estimado',
625				'amount': toCurrency(calcData.subsidy_amount / 12),
626				'message': ('Tu subsidio reduciría tu prima en ' + toCurrency(calcData.subsidy_amount) + '/año.'),
627				'button_label': 'Buscar planes',
628				'notice': ("If you don't purchase ACA-compliant health insurance, it appears you will pay a penalty estimated at " + toCurrency(calcData.penalty_amount) + ".")
629			},
630			'no-subsidy': {
631				'title': 'No subsidio',
632				'amount': toCurrency(calcData.subsidy_amount / 12),
633				'message': 'Echa un vistazo a tus opciones de prima y beneficios.',
634				'button_label': 'Buscar planes',
635				'notice': ("If you don't purchase ACA-compliant health insurance, it appears you will pay a penalty estimated at " + toCurrency(calcData.penalty_amount) + ".")
636			},
637			'no-subsidy-data-in-your-state': {
638				'title': 'Debido a que este estado utiliza un Mercado de seguros basado en las reglas del estado, los datos de subsidios no están disponibles.',
639				'amount': '$0',
640				'message': 'Haga clic en “Buscar planes” para ver las opciones de primas y beneficios ofrecidas por nuestras agencias asociadas.',
641				'button_label': 'Buscar planes',
642				'notice': ("If you don't purchase ACA-compliant health insurance, it appears you will pay a penalty estimated at " + toCurrency(calcData.penalty_amount) + ".")
643			},
644
645			'medicaid': {
646				'title': 'Es posible que seas elegible <br>para Medicaid.',
647				'amount': null,
648				'message': 'Haz clic en “Buscar Medicaid” para <br>obtener información sobre tu estado.',
649				'button_label': 'Buscar Medicaid',
650				'notice': null
651			},
652			'medicaid-NY': {
653				'title': 'Puedes ser elegible para el Plan Esencial de Nueva York.',
654				'amount': null,
655				'message': 'Haz clic en “Plan Esencial” para obtener más información.',
656				'button_label': 'Essential Plan',
657				'notice': null
658			},
659			'medicaid-MN': {
660				'title': 'Puedes ser elegible <br>para MinnesotaCare.',
661				'amount': null,
662				'message': 'Haz clic en “MinnesotaCare” para obtener más información.',
663				'button_label': 'MinnesotaCare',
664				'notice': null
665			},
666
667		}
668	}
669
670	jQuery('#resultsBlock').removeClass('medicaid');
671	jQuery('#resultsBlock').removeClass('disabled');
672
673	result = response_options[result_type];
674
675	if(result_type == 'incomplete'){
676		jQuery('#resultsBlock').addClass('disabled');
677	} else if(result_type == 'medicaid'){
678		jQuery('#resultsBlock').addClass('medicaid');
679	}
680
681	if(result.title != jQuery('#resultsBlock .resultsBlock_title').html()){
682		jQuery('#resultsBlock .resultsBlock_title').html(result.title);
683	}
684
685	if(result.title != jQuery('#resultsBlock h2').html()){
686		jQuery('#resultsBlock h2').html(result.title);
687	}
688
689	if(result.amount == null){
690		jQuery('#resultsBlock #subsidy').hide();
691	} else {
692		jQuery('#resultsBlock #subsidy').show();
693		if(result.message != jQuery('#subsidyAmount').html()){
694			jQuery('#subsidyAmount').html(result.amount);
695		}
696	}
697
698	if(result.message == null){
699		jQuery('#resultsBlock p.message').hide();
700	} else {
701		jQuery('#resultsBlock p.message').show();
702		if(result.message != jQuery('#resultsBlock p.message').html()){
703			jQuery('#resultsBlock p.message').html(result.message);
704		}
705	}
706
707
708	if( calcData.chip_eligible_flag == true || calcData.medicaid_eligible_flag == true){
709		// if(document.documentElement.lang.toLowerCase().includes("en")) {
710		//     jQuery('#resultsBlock p.message').html(jQuery('#resultsBlock p.message').html() + ' In addition, some members of the household may be eligible for Medicaid or CHIP.');
711		// } else {
712		//     jQuery('#resultsBlock p.message').html(jQuery('#resultsBlock p.message').html() + ' Además, algunos miembros del hogar pueden ser elegibles para Medicaid o CHIP.');
713		// }
714		if (document.documentElement.lang.toLowerCase().includes("en")) {
715			let medicaidMessage = `
716            <div class="medicaid-chip-notice">
717               <span class="notice-title" style="font-size: 1.2rem;font-weight: 700;margin-top: 20px !important;display: inline-block;">
718                  Some members of your household may be eligible for Medicaid and/or CHIP
719               </span>
720               <p>
721                  Medicaid and CHIP are free or low-cost, state-run health insurance programs available to people with a low income or qualifying medical needs.
722               </p>
723               <p>
724                  <a href="/medicaid/" class="medicaid-chip-link hio-btn hio-btn--text-link">
725                     Learn more about Medicaid and CHIP eligibility in your state by utilizing our state-by-state guides.
726                  </a>
727               </p>
728            </div>
729         `;
730
731			jQuery('#resultsBlock p.message').append(medicaidMessage);
732
733		} else {
734			let medicaidMessage = `
735            <div class="medicaid-chip-notice">
736               <span class="notice-title" style="font-size: 1.2rem;font-weight: 700;margin-top: 20px !important;display: inline-block;"
737                  Algunos miembros de su hogar pueden ser elegibles para Medicaid y/o CHIP
738               </span>
739               <p>
740                  Medicaid y CHIP son programas estatales de seguro médico gratuitos o de bajo costo disponibles para personas con bajos ingresos o con necesidades médicas que califican.
741               </p>
742               <p>
743                  <a href="/medicaid/" class="medicaid-chip-link">
744                     Obtenga más información sobre la elegibilidad para Medicaid y CHIP en su estado utilizando nuestras guías estatales.
745                  </a>
746               </p>
747            </div>
748         `;
749
750			jQuery('#resultsBlock p.message').append(medicaidMessage);
751
752		}
753		//
754		jQuery('#resultsBlock p.message').show();
755	}
756
757
758	if(result.button_label == null){
759		jQuery('#resultsBlock p.call_to_action').hide();
760	} else {
761		jQuery('#resultsBlock p.call_to_action').show();
762		if(result.button_label != jQuery('#shop_for_health_plans').html()){
763			jQuery('#shop_for_health_plans').html(result.button_label);
764		}
765	}
766
767}
768
769
770function addDependentButtonCheck(){
771	if(jQuery('.dependent.ageBlock').length < config.maxDependents) {
772		jQuery('#btnAddDependent').show();
773	} else {
774		jQuery('#btnAddDependent').hide();
775	}
776}
777
778// Calculate Button (not currently in use)
779jQuery('#btnCalculate').click(function($){
780	removeEmptyDependents();
781	calculate();
782});
783
784
785jQuery('#healthInsCalcForm .ageField, #healthInsCalcForm select:not(#paymentFrequency, #county), #healthInsCalcForm #state').change(function(){
786	removeEmptyDependents();
787	calculate();
788});
789
790jQuery("#agesWrapper").on("change", ".dependent.ageField", function(){
791	getDependents();
792	calculate();
793});
794
795jQuery("#householdSize").on("change", ".dependent.ageField", function(){
796	calculate();
797});
798
799
800jQuery('#agesWrapper').on("click", ".btnRemoveDependent", function($){
801	let agesWrapper =  document.getElementById("agesWrapper");
802
803	jQuery(this).parents('.ageBlock').remove();
804
805	if(!agesWrapper.hasChildNodes()) {
806		let familyAgeGroup = document.getElementById("family_ages_section");
807		familyAgeGroup.classList.remove("family_ages_group");
808	}
809
810	addDependentButtonCheck();
811
812	if(jQuery('.ageBlock').length == 1) {
813		jQuery('#dependentsAgeLabel').remove();
814	}
815	addExtraMargin()
816	getDependents();
817	if(jQuery(this).prev('.ageField').val().length) {
818		calculate();
819	}
820});
821if(document.getElementById("taxableIncome")) {
822	jQuery("#taxableIncome").keyup(function ($) {
823		if (stringToFloat(jQuery("#taxableIncome").val()) >= 0) {
824			jQuery('#incomeSlider').slider("value", stringToFloat(jQuery("#taxableIncome").val()));
825			setIncomeSliderPosition();
826			removeEmptyDependents();
827			calculate();
828		}
829	});
830}
831jQuery("#incomeSlider:not(.acaAaffordabilityIncomeSlider)").slider({
832	range: "min",
833	value: jQuery('#taxableIncome:not(.acaAaffordabilityTaxableIncome)').val(),
834	min: 0,
835	max: 150000,
836	step: 1000,
837	slide: function(event, ui) {
838		// $( "#taxableIncome" ).val(ui.value);
839		incomeSliderActiveFlag = true;
840		jQuery('#taxableIncome:not(.acaAaffordabilityTaxableIncome)').val(toCurrency(ui.value));
841		jQuery('#taxableIncome:not(.acaAaffordabilityTaxableIncome)').trigger("change")
842
843		var delay = function() {
844			var handleIndex = jQuery(ui.handle).data('index.uiSliderHandle');
845
846		};
847
848		// wait for the ui.handle to set its position
849		setTimeout(delay, 5);
850	},
851	stop: function(event, ui) {
852		removeEmptyDependents();
853		calculate();
854	}
855});
856
857//ACA Affordability Calculator
858if(jQuery(".acaAaffordabilityIncomeSlider").length) {
859	jQuery(".acaAaffordabilityIncomeSlider").slider({
860		range: "min",
861		value: jQuery('.acaAaffordabilityTaxableIncome').val(),
862		min: 0,
863		max: 150000,
864		step: 1000,
865		slide: function (event, ui) {
866			// $( "#taxableIncome" ).val(ui.value);
867			incomeSliderActiveFlag = true;
868			jQuery('.acaAaffordabilityTaxableIncome').val(toCurrency(ui.value));
869			jQuery('.acaAaffordabilityTaxableIncome').trigger("change")
870
871			var delay = function () {
872				var handleIndex = jQuery(ui.handle).data('index.uiSliderHandle');
873
874			};
875
876			// wait for the ui.handle to set its position
877			setTimeout(delay, 5);
878		},
879		stop: function (event, ui) {
880			removeEmptyDependents();
881			calculate();
882		}
883	});
884}
885
886if(document.getElementById("taxableIncome")) {
887	function setIncomeSliderPosition() {
888		if(jQuery("#taxableIncome:not(.acaAaffordabilityTaxableIncome)").length) {
889			jQuery('#incomeSlider:not(.acaAaffordabilityIncomeSlider)').slider("value", stringToFloat(jQuery("#taxableIncome:not(.acaAaffordabilityTaxableIncome)").val()));
890			jQuery('#taxableIncome:not(.acaAaffordabilityTaxableIncome)').val(toCurrency(jQuery("#taxableIncome:not(.acaAaffordabilityTaxableIncome)").val()));
891		}
892		//ACA Affordability Calculator
893		if(jQuery(".acaAaffordabilityTaxableIncome").length) {
894			jQuery('.acaAaffordabilityIncomeSlider').slider("value", stringToFloat(jQuery(".acaAaffordabilityTaxableIncome").val()));
895			jQuery('.acaAaffordabilityTaxableIncome').val(toCurrency(jQuery(".acaAaffordabilityTaxableIncome").val()));
896		}
897	};
898}
899// jQuery(window).bind("load resize", function(){
900//     if(document.getElementById("taxableIncome")) {
901//        setIncomeSliderPosition();
902//     }
903// });
904
905jQuery('#healthInsCalcForm').submit(function(){
906	calculate();
907	return false;
908});
909
910if(document.getElementById("taxableIncome")) {
911	calculate();
912}
913
914function init_tooltip(){
915
916	var className = 'right';
917	var position = { my: 'left center', at: 'right center', collision: 'none' };
918
919	if( jQuery( document ).width() < 700){
920		var className = 'bottom';
921		var position = { my: 'center top', at: 'center bottom', collision: 'fit' };
922	}
923
924	jQuery('#income_tool_tip').tooltip('option', 'position', position);
925	jQuery('#income_tool_tip').tooltip('option', 'tooltipClass', className);
926
927}
928
929// When the page is ready
930jQuery(document).ready(function($){
931
932	let zipCode = $('#zipcode'),
933		incomeTooltip = $('#income_tool_tip');
934
935	incomeTooltip.tooltip();
936	init_tooltip();
937
938	$( window ).resize(function() {
939		if( $(".ui-tooltip").length > 0 ){
940			incomeTooltip.tooltip("close");
941			init_tooltip();
942			incomeTooltip.tooltip("open");
943		}
944	});
945	if(document.getElementById("taxableIncome")) {
946		setIncomeSliderPosition();
947	}
948
949	if(valid_zip(zipCode.val())){
950		zipData = getZipData(zipCode.val());
951	}
952
953	zipCode.on("input", function() {
954
955		if($(this).val().length == 5) {
956			if (valid_zip($(this).val())) {
957				zipData = getZipData($(this).val());
958			} else {
959				calculate();
960				alert('Invalid Zip Code.');
961			}
962		} else {
963			resetPlans();
964		}
965
966	});
967
968	setTimeout(function(){
969		if(zipCode) {
970			zipCode.trigger('input');
971		}
972		if(document.getElementById("taxableIncome")) {
973			setIncomeSliderPosition();
974		}
975	}, 1);
976
977	zipCode.on("change", function() {
978
979		if (!valid_zip($(this).val())) {
980			alert('Invalid Zip Code.');
981		}
982
983	});
984
985	$('#county').change(function() {
986		calculate();
987	});
988
989});
990 

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.