jQuery(document).ready(function ($) { $('#hidden').hide(); $('#removeExcess1').hide(); $('#removeExcess2').hide(); $('#removeExcess3').hide(); $('#dep1Address').hide(); $('#dep2Address').hide(); $('#monthlyRadio').hide(); $('#monthlyRadio').hide(); $('#quarterlyRadio').hide(); $('#annuallyRadio').hide(); $('#quarterlyTable').hide(); $('#annuallyTable').hide(); $('#subq1').hide(); $('#subq2').hide(); $('#subq3').hide(); $('#subq4').hide(); $('#subq5').hide(); $('#subq6').hide(); $('#subq7').hide(); $('#subq8').hide(); $('#subq9').hide(); $('#subq10').hide(); $('#subq11').hide(); $('#subq12').hide(); // $('#wireTrans').hide(); // $('#creditCardPayment').hide(); // $('#billingAddress').hide(); $('.metric').hide(); $('#metricWeight').hide(); $('#metricHeight').hide(); $('#expatContent').hide(); $('#individualsContent').show(); $('#familiesContent').hide(); $('#internationalContent').hide(); // $('#excess1').hide(); // $('#removeEvacButton').hide(); $('#person1RelevantAreaHeart').hide(); $('#person1Condition1Heart').hide(); $('#person1Condition2Heart').hide(); $('#person1RelevantAreaEndocrine').hide(); $('#person1Condition1Endocrine').hide(); $('#person1Condition2Endocrine').hide(); $('#heartSectionTop').hide(); $('#heartSection').hide(); $('#heartSectionBottom').hide(); $('#recalculateQuote').hide(); $('#priceOverlay').hide(); // $('#addBenefit1').hide(); $('#remove2').hide(); $('#remove3').hide(); $('#remove4').hide(); $('#selectionForm').change(function () { $('#price').hide(300); $('#hidden').show(300); }); $('#recalculateButton').click(function () { $('#price').show(300); $('#hidden').hide(300); }); $('#addExcess1').click(function () { $(this).hide(); $('#removeExcess1').show(); $('#price').hide(300); $('#hidden').show(300); }); $('#removeExcess1').click(function () { $(this).hide(); $('#addExcess1').show(); $('#price').hide(300); $('#hidden').show(300); }); $('#addExcess2').click(function () { $(this).hide(); $('#removeExcess2').show(); $('#price').hide(300); $('#hidden').show(300); }); $('#removeExcess2').click(function () { $(this).hide(); $('#addExcess2').show(); $('#price').hide(300); $('#hidden').show(300); }); $('#addExcess3').click(function () { $(this).hide(); $('#removeExcess3').show(); $('#price').hide(300); $('#hidden').show(300); }); $('#removeExcess3').click(function () { $(this).hide(); $('#addExcess3').show(); $('#price').hide(300); $('#hidden').show(300); }); /* $('#dep1').change(function() { if(this.value=="newAddress") { $('#dep1Address').show(); }else { $('#dep1Address').hide(); } }); $('#dep2').change(function() { if(this.value=="newAddress") { $('#dep2Address').show(); }else { $('#dep2Address').hide(); } }); */ var navBar = $( '
' ); navBar.insertBefore('.tableContent'); $('#monthlyTab').click(function () { if ($('#monthlyTable').is(':hidden')) { $('#price').hide(300); $('#hidden').show(300); } $(this).removeClass('tableTab').addClass('tableTabActive'); $('#quarterlyTab').removeClass('tableTabActive').addClass('tableTab'); $('#annuallyTab').removeClass('tableTabActive').addClass('tableTab'); $('#monthlyTable').show(); $('#quarterlyTable').hide(); $('#annuallyTable').hide(); return false; }); $('#quarterlyTab').click(function () { if ($('#quarterlyTable').is(':hidden')) { $('#price').hide(300); $('#hidden').show(300); } $(this).removeClass('tableTab').addClass('tableTabActive'); $('#monthlyTab').removeClass('tableTabActive').addClass('tableTab'); $('#annuallyTab').removeClass('tableTabActive').addClass('tableTab'); $('#monthlyTable').hide(); $('#quarterlyTable').show(); $('#annuallyTable').hide(); return false; }); $('#annuallyTab').click(function () { if ($('#annuallyTable').is(':hidden')) { $('#price').hide(300); $('#hidden').show(300); } $(this).removeClass('tableTab').addClass('tableTabActive'); $('#monthlyTab').removeClass('tableTabActive').addClass('tableTab'); $('#quarterlyTab').removeClass('tableTabActive').addClass('tableTab'); $('#monthlyTable').hide(); $('#quarterlyTable').hide(); $('#annuallyTable').show(); return false; }); $('[name=q1]').change(function () { if (this.id == 'q1Yes') { $('#subq1').show(); } else { $('#subq1').hide(); } }); $('[name=q2]').change(function () { if (this.id == 'q2Yes') { $('#subq2').show(); } else { $('#subq2').hide(); } }); $('[name=q3]').change(function () { if (this.id == 'q3Yes') { $('#subq3').show(); } else { $('#subq3').hide(); } }); $('[name=q4]').change(function () { if (this.id == 'q4Yes') { $('#subq4').show(); } else { $('#subq4').hide(); } }); $('[name=q5]').change(function () { if (this.id == 'q5Yes') { $('#subq5').show(); } else { $('#subq5').hide(); } }); $('[name=q6]').change(function () { if (this.id == 'q6Yes') { $('#subq6').show(); } else { $('#subq6').hide(); } }); $('[name=q7]').change(function () { if (this.id == 'q7Yes') { $('#subq7').show(); } else { $('#subq7').hide(); } }); $('[name=q8]').change(function () { if (this.id == 'q8Yes') { $('#subq8').show(); } else { $('#subq8').hide(); } }); $('[name=q9]').change(function () { if (this.id == 'q9Yes') { $('#subq9').show(); } else { $('#subq9').hide(); } }); $('[name=q10]').change(function () { if (this.id == 'q10Yes') { $('#subq10').show(); } else { $('#subq10').hide(); } }); $('[name=q11]').change(function () { if (this.id == 'q11Yes') { $('#subq11').show(); } else { $('#subq11').hide(); } }); $('[name=q12]').change(function () { if (this.id == 'q12Yes') { $('#subq12').show(); } else { $('#subq12').hide(); } }); /* jQuery('[name=paymentMethod]').click(function() { if(this.value == 'creditCard'){ jQuery('#creditCardPayment').show(); jQuery('#wireTrans').hide(); } else{ jQuery('#wireTrans').show(); jQuery('#creditCardPayment').hide(); } }); */ /* jQuery('#newAddress').change(function() { if(jQuery('#newAddress').is(":checked")){ jQuery('#billingAddress').show(); } else { jQuery('#billingAddress').hide(); } }); */ jQuery('[name=bmiSelector]').click(function () { if (this.value == 'imperial') { $('.metric').hide(); $('.imperial').show(); jQuery('#metricWeight').hide(); jQuery('#metricHeight').hide(); jQuery('#imperialWeight').show(); jQuery('#imperialHeight').show(); } else if (this.value == 'metric') { $('.metric').show(); $('.imperial').hide(); jQuery('#metricWeight').show(); jQuery('#metricHeight').show(); jQuery('#imperialWeight').hide(); jQuery('#imperialHeight').hide(); } }); /*var inputTags = document.getElementsByTagName('input'); for (var i=1;i' ); navBar.insertBefore('.tabTableContent'); $('#expatsTab').click(function () { $(this).removeClass('tabTableTab1').addClass('tabTableTab1Active'); $('#tab1').addClass('active'); $('#tab2').removeClass('active'); $('#tab3').removeClass('active'); $('#tab4').removeClass('active'); $('#individualsTab').removeClass('tabTableTab2Active').addClass('tabTableTab2'); $('#familiesTab').removeClass('tabTableTab3Active').addClass('tabTableTab3'); $('#intWorkersTab').removeClass('tabTableTab4Active').addClass('tabTableTab4'); $('#expatContent').show(); $('#individualsContent').hide(); $('#familiesContent').hide(); $('#internationalContent').hide(); return false; }); $('#individualsTab').click(function () { $(this).removeClass('tabTableTab2').addClass('tabTableTab2Active'); $('#tab2').addClass('active'); $('#tab1').removeClass('active'); $('#tab3').removeClass('active'); $('#tab4').removeClass('active'); $('#familiesTab').removeClass('tabTableTab3Active').addClass('tabTableTab3'); $('#expatsTab').removeClass('tabTableTab1Active').addClass('tabTableTab1'); $('#intWorkersTab').removeClass('tabTableTab4Active').addClass('tabTableTab4'); $('#familiesContent').hide(); $('#expatContent').hide(); $('#individualsContent').show(); $('#internationalContent').hide(); return false; }); $('#familiesTab').click(function () { $(this).removeClass('tabTableTab3').addClass('tabTableTab3Active'); $('#tab3').addClass('active'); $('#tab2').removeClass('active'); $('#tab1').removeClass('active'); $('#tab4').removeClass('active'); $('#expatsTab').removeClass('tabTableTab1Active').addClass('tabTableTab1'); $('#individualsTab').removeClass('tabTableTab2Active').addClass('tabTableTab2'); $('#intWorkersTab').removeClass('tabTableTab4Active').addClass('tabTableTab4'); $('#familiesContent').show(); $('#expatContent').hide(); $('#individualsContent').hide(); $('#internationalContent').hide(); return false; }); $('#intWorkersTab').click(function () { $(this).removeClass('tabTableTab4').addClass('tabTableTab4Active'); $('#tab4').addClass('active'); $('#tab2').removeClass('active'); $('#tab3').removeClass('active'); $('#tab1').removeClass('active'); $('#expatsTab').removeClass('tabTableTab1Active').addClass('tabTableTab1'); $('#individualsTab').removeClass('tabTableTab2Active').addClass('tabTableTab2'); $('#familiesTab').removeClass('tabTableTab3Active').addClass('tabTableTab3'); $('#internationalContent').show(); $('#expatContent').hide(); $('#individualsContent').hide(); $('#familiesContent').hide(); return false; }); $('.rollover').hover( function () { $(this).attr('src', $(this).attr('src').replace('.gif', '-hover.gif')); }, function () { $(this).attr('src', $(this).attr('src').replace('-hover.gif', '.gif')); } ); $('#person1Heart').click(function () { if ($('#person1RelevantAreaHeart').is(':hidden')) { $('#person1RelevantAreaHeart').show(); } else { $('#person1RelevantAreaHeart').hide(); $('#person1Condition1Heart').hide(); $('#person1Condition2Heart').hide(); } }); $('#addConditionHeart').click(function () { $('#person1Condition1Heart').show(); $('#person1Condition2Heart').show(); return false; }); $('#person1Endocrine').click(function () { if ($('#person1RelevantAreaEndocrine').is(':hidden')) { $('#person1RelevantAreaEndocrine').show(); } else { $('#person1RelevantAreaEndocrine').hide(); $('#person1Condition1Endocrine').hide(); $('#person1Condition2Endocrine').hide(); } }); $('#addConditionEndocrine').click(function () { $('#person1Condition1Endocrine').show(); $('#person1Condition2Endocrine').show(); return false; }); $('#person1Condition1HeartDelete').click(function () { $('#person1Condition1Heart').hide(); return false; }); $('#person1Condition2HeartDelete').click(function () { $('#person1Condition2Heart').hide(); return false; }); $('#person1Condition1EndocrineDelete').click(function () { $('#person1Condition1Endocrine').hide(); return false; }); $('#person1Condition2EndocrineDelete').click(function () { $('#person1Condition2Endocrine').hide(); return false; }); $('#heartButton').click(function () { $('#heartSectionTop').show(); $('#heartSection').show(); $('#heartSectionBottom').show(); $('#endocrineSectionTop').hide(); $('#endocrineSection').hide(); $('#endocrineSectionBottom').hide(); $(this).removeClass('medicalTabPast').addClass('medicalTabCurrent'); $('#endocrineButton').removeClass('medicalTabCurrent').addClass('medicalTabFuture'); }); $('#endocrineButton').click(function () { $('#heartSectionTop').hide(); $('#heartSection').hide(); $('#heartSectionBottom').hide(); $('#endocrineSectionTop').show(); $('#endocrineSection').show(); $('#endocrineSectionBottom').show(); $(this).removeClass('medicalTabFuture').addClass('medicalTabCurrent'); $('#heartButton').removeClass('medicalTabCurrent').addClass('medicalTabPast'); }); /* $("[name=internationalMedical]").click(function() { $('#recalculateQuote').show(300); $('#priceOverlay').fadeTo('slow', 0.5); }); $('[name=internationalMedicalPlus]').click(function() { $('#recalculateQuote').show(300); $('#priceOverlay').fadeTo('slow', 0.5); }); */ $('#recalculateQuoteBtn').click(function () { $('#recalculateQuote').hide(300); $('#priceOverlay').hide(300); }); /* $(".addBenefit").click(function() { $('#recalculateQuote').show(300); $('#priceOverlay').fadeTo('slow', 0.5); }); */ /* $('#addBenefit1').click(function(){ $('#remove1').show(300); $('#addBenefit1').hide(300); }); $('#addBenefit2').click(function(){ $('#remove2').show(300); $('#addBenefit2').hide(300); }); $('#addBenefit3').click(function(){ $('#remove3').show(300); $('#addBenefit3').hide(300); }); $('#addBenefit4').click(function(){ $('#remove4').show(300); $('#addBenefit4').hide(300); }); $('#remove1').click(function(){ $('#addBenefit1').show(300); $('#remove1').hide(300); }); $('#remove2').click(function(){ $('#addBenefit2').show(300); $('#remove2').hide(300); }); $('#remove3').click(function(){ $('#addBenefit3').show(300); $('#remove3').hide(300); }); $('#remove4').click(function(){ $('#addBenefit4').show(300); $('#remove4').hide(300); }); */ // CUSTOM TOOLTIP FUNCTIONALITY (function () { const OFFSET_X = 8; // pixels to the right of the icon const OFFSET_Y = 0; // fine-tune alignment (keep at 0 if you like) const BUMP_Y = -20; // << move the tooltip UP by 20px function showAndPlace(anchor, tooltip) { tooltip.style.display = 'block'; const aRect = anchor.getBoundingClientRect(); const parent = tooltip.offsetParent || document.documentElement; const pRect = parent.getBoundingClientRect(); const parentScrollLeft = parent === document.documentElement || parent === document.body ? window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0 : parent.scrollLeft; const parentScrollTop = parent === document.documentElement || parent === document.body ? window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 : parent.scrollTop; // Start by placing to the right so we can measure the tooltip let left = aRect.right - pRect.left + parentScrollLeft + OFFSET_X; tooltip.style.left = `${left}px`; // Measure tooltip to allow vertical centering const tRect = tooltip.getBoundingClientRect(); // Center vertically on the icon, then apply the bump let top = aRect.top - pRect.top + parentScrollTop + aRect.height / 2 - tRect.height / 2 + OFFSET_Y + BUMP_Y; tooltip.style.top = `${top}px`; // Flip horizontally if overflowing the right edge const parentRight = Math.min(window.innerWidth, pRect.right); if (tRect.right > parentRight - 8) { left = aRect.left - pRect.left + parentScrollLeft - tRect.width - OFFSET_X; tooltip.style.left = `${left}px`; } // Clamp vertically to viewport after the bump (optional) const pad = 8; const newTRect = tooltip.getBoundingClientRect(); if (newTRect.top < pad) { tooltip.style.top = parseFloat(tooltip.style.top) + (pad - newTRect.top) + 'px'; } else if (newTRect.bottom > window.innerHeight - pad) { tooltip.style.top = parseFloat(tooltip.style.top) - (newTRect.bottom - (window.innerHeight - pad)) + 'px'; } } function hide(tooltip) { tooltip.style.display = 'none'; } document.querySelectorAll('.tooltipAnchor').forEach((anchor) => { const tooltip = anchor.nextElementSibling?.classList.contains('tooltip') ? anchor.nextElementSibling : null; if (!tooltip) return; let hoverLock = false; anchor.addEventListener('mouseenter', () => { hoverLock = true; showAndPlace(anchor, tooltip); }); anchor.addEventListener('mouseleave', () => { hoverLock = false; setTimeout(() => !hoverLock && hide(tooltip), 40); }); anchor.addEventListener('focus', () => showAndPlace(anchor, tooltip)); anchor.addEventListener('blur', () => hide(tooltip)); tooltip.addEventListener('mouseenter', () => { hoverLock = true; }); tooltip.addEventListener('mouseleave', () => { hoverLock = false; hide(tooltip); }); const reposition = () => { if (tooltip.style.display !== 'none') showAndPlace(anchor, tooltip); }; window.addEventListener('scroll', reposition, { passive: true }); window.addEventListener('resize', reposition); if (tooltip.offsetParent && tooltip.offsetParent !== document.body && tooltip.offsetParent !== document.documentElement) { tooltip.offsetParent.addEventListener('scroll', reposition, { passive: true }); } }); })(); });