{ if (!window.vahara) { window.vahara = {}; } var v = window.vahara; v.orbitId = '2'; v.serverUrl = 'https://o2hwi.vahara.com'; v.remoteSiteUrl = 'https://www.h-wire.com'; v.projectId = '6354'; v.remoteKey = '9lRfEE87nmnMKuzKEbECO5yQh5gosmAsnF82sgOddz0T4bCZLel6LKwviWGZ'; v.version = '18'; v.showEditButtons = false; v.techUser = 0; v.componentHtml = []; v.editorUseImageLibrary = 1; v.settings = {"editor_use_image_library":"1","new_user_registration_enabled":null,"payments_platform":null,"replicated_site":"0","replicated_site_type":null,"replicated_site_default_url":null,"store_checkout_page":null,"store_dscheckout_page":null,"store_shopping_page":null,"stripe_publishable_key":null,"image_host":"https:\/\/vahara-o2.imgix.net","image_host_type":"imgix","image_max_width":"1920","image_quality":"80","auth_must_verify_browser":null,"direct_scale_enabled":null,"brand_color_options":["#262262","#bf1e2e","#ffffff","#f4f4f4","#d1d1d1","#aaaaaa","#232323","#000000"],"froala_font_options":{"Open Sans":"Open Sans","Montserrat":"Montserrat","Gobold Uplow":"Gobold Uplow"},"froala_inline_styles":null,"froala_hide_font_size":"1","froala_hide_fonts":"1","representative_term":null,"default_customer_sponsor_id":null,"email_send_domains":null,"replicated_site_can_select_sponsor":null,"project_styles":[{"vw-p-sm":"Paragraph Small"},{"vw-p-rg":"Paragraph Regular"},{"vw-p-lg":"Paragraph Large"},{"vw-p-xl":"Paragraph XL"},{"vw-h-style-1":"Heading 1"},{"vw-h-style-2":"Heading 2"},{"vw-h-style-3":"Heading 3"},{"vw-h-style-4":"Heading 4"},{"vw-p-style-2":"Paragraph Style 2"},{"vw-p-style-3":"Paragraph Style 3"},{"vw-h-style-lg":"Large"},{"vw-h-style-xl":"X Large"},{"vw-h-style-xxl":"XX Large"},{"gobold-uplow-normal":"Gobold Uplow Font"}],"hide_remote_site_vahara_buttons":null,"google_maps_frontend_api_key":null,"nexiopay_pubkey":null,"remote_elements_off":"1"}; parent.postMessage({action: 'vahara-page-loaded', remotekey: v.remoteKey, projectId: v.projectId, link: window.location.href}, '*'); v.siteLibsLoaded = function (callback) { // If libs have loaded already, call the code now if (v.siteLibsLoadedFlag) { callback(); // If not, launch them when they are loaded } else { window.addEventListener('vaharaSiteLibsLoaded', function (e) { callback(); }); } }; v.loadScript = function (url, callback, appendToHead, discourageDuplicateInserts, disableVersionParam) { var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.src = url; js.id = 'script' + hashString(url); if(typeof disableVersionParam === undefined) disableVersionParam = false; if (!disableVersionParam && v.version) { if (js.src.indexOf('?') > 0) { js.src+= '&v=' + v.version; } else { js.src+= '?v=' + v.version; } } if(typeof appendToHead === undefined) appendToHead = false; if(typeof callback === 'function') { js.addEventListener('load', function (e) { callback(e); }, false); } if(discourageDuplicateInserts === true) { // Check if this script has already been inserted -- if so -- do not insert it again if(document.getElementById(js.id) !== null) { if(typeof callback === 'function') { callback(); } return; } } if(appendToHead === true) { document.getElementsByTagName('head')[0].appendChild(js); } else { document.body.appendChild(js); } }; // Find the script file for the current script // Put trimLevel = -1 to remove the script file name, trimLevel = -2 to remove the directory just above, -3 the directory above that, etc v.getCurrentScriptPath = function(trimLevel) { var script = ''; if (document.currentScript) { script = document.currentScript.src; } else { var scripts = document.getElementsByTagName("script"); script = scripts[scripts.length - 1].src; } scriptParts = script.split('/'); return scriptParts.slice(0, scriptParts.length + trimLevel).join('/'); }; // Load a CSS file v.loadCss = function (url) { var link = document.createElement("link"); link.href = url; link.type = "text/css"; link.rel = "stylesheet"; link.media = "screen,print"; if (v.version) { if (link.href.indexOf('?') > 0) { link.href+= '&v=' + v.version; } else { link.href+= '?v=' + v.version; } } // If IE do this differently if(typeof(Event) === 'function') { document.head.prepend(link); } else { document.head.insertBefore(link, document.head.children[0]); } }; // This callback will be triggered when google maps first loads v.triggerGoogleMapsLoadedEvent = function() { v.googleMapsLoaded = true; v.triggerEvent('vhGoogleMapsLoaded'); } // Load the google map API and Gmap v.loadGoogleMaps = function(callbackFunction) { if (v.googleMapsLoaded) { callbackFunction(); } else { // Load the map script with a callback to googleMapsLoaded v.loadScript('https://maps.google.com/maps/api/js?key=' + v.settings.google_maps_frontend_api_key + '&callback=window.vahara.triggerGoogleMapsLoadedEvent'); v.loadScript('https://cdnjs.cloudflare.com/ajax/libs/gmaps.js/0.4.25/gmaps.js', function() { v.googleMapsHelperLoaded = true; }); v.onEvent('vhGoogleMapsLoaded', function() { var loadedInterval = setInterval(function() { if (v.googleMapsHelperLoaded) { setTimeout(function() { callbackFunction(); }, 300); clearInterval(loadedInterval); } }, 20); }); } } v.loadHtml = function (url, callback) { var request = new XMLHttpRequest(); request.onreadystatechange = function() { window.r = request; if(request.readyState === 4) { if(request.status === 200) { // Insert the HTML into the top of the DOM var html = request.responseText; v.insertHtml(html, callback(html)); } } } request.withCredentials = true; // send cookies with HTML requests request.open('GET', url); request.send(null); }; v.insertHtml = function(html, callback) { var newDiv = document.createElement('vhc'); newDiv.innerHTML = html; newDiv.style.display = 'none'; document.body.insertBefore(newDiv, document.body.firstChild); var $ = window.vahara.jQuery; $(newDiv).find('.vh-component').each(function() { $item = $(this); var name = $item.attr('data-vh-component-label'); v.componentHtml[name] = $(this)[0].outerHTML; }); // Call the callback if there was one if (callback) { callback(html); } $(newDiv).remove(); }; v.insertCss = function(css) { var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = css; document.getElementsByTagName('head')[0].appendChild(style); }; v.triggerEvent = function(name, data) { //let vjWindow = window.vahara.jQuery(window)[0]; let vjWindow = window; var event = null; if(typeof(Event) === 'function') { event = new CustomEvent(name, {detail: data}); } else { event = document.createEvent('Event'); event.detail = data; event.initEvent(name, true, true); } vjWindow.dispatchEvent(event); }; v.onEvent = function(name, callback) { // sometimes jQuery isn't loaded yet when this is run //let vjWindow = window.vahara.jQuery(window)[0]; let vjWindow = window; vjWindow.addEventListener(name, function(e) { callback(e.detail); }, false); }; v.setCookie = function(key, value, days, secure, samesite) { if(typeof secure === "undefined" || secure === null) secure = ''; secure = secure === true ? 'secure;' : ''; if(typeof samesite === "undefined" || samesite === null) samesite = 'lax'; let expires = new Date(); if (days) { expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000)); document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + ';' + secure + ' SameSite=' + samesite + ';'; } else { document.cookie = key + '=' + value + ';expires=Fri, 30 Dec 9999 23:59:59 GMT;' + secure + ' SameSite=' + samesite + ';'; } }; v.getCookie = function(key) { let keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); return keyValue ? keyValue[2] : null; }; v.currencyWithComma = function(input) { var x = (input*1).toFixed(2); var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }; v.compileTemplate = function(templateClassOrJqueryElement, data) { let el = null; if (typeof templateClassOrJqueryElement === 'string' || templateClassOrJqueryElement instanceof String) { el = document.querySelector(templateClassOrJqueryElement); } else { el = templateClassOrJqueryElement[0]; } if(el !== null) { Handlebars.registerHelper('date', function(input) { return moment(input).format('MMM D, YYYY'); }); Handlebars.registerHelper('dateTime', function(input) { return moment(input).format('MMM D, YYYY - hh:mm a'); }); Handlebars.registerHelper('selectOption', function( value, options ) { let $el = window.vahara.jQuery('