  



      var leftNavParentItemHref = null;
      function setLeftNavParent(parentItemHref) {
      }
$(document).ready(function(){
    // bootsrtap tab control setup
    $('.nav-tabs a').click(function (e) {
      e.preventDefault();
      $(this).tab('show');
    });
    // Manage HISTORY (back button behavior) for tabs
    // add a hash to the URL when the user clicks on a tab
    // relies on https://github.com/devote/HTML5-History-API/ to support pushState()
    $('a[data-toggle="tab"]').on('click', function(e) {
      history.pushState(null, null, $(this).attr('href'));
    });
    // // navigate to a tab when the history changes
    showTabFromUrl = function(e) {
      if (location.hash.substr(0,3)=="#/#") {
        hashToUse = location.hash.substr(2);
      } else {
        hashToUse = location.hash;
      }
      var activeTab = $('[href="' + hashToUse + '"]');
      if (activeTab.length) {
        activeTab.tab('show');
      } else {
        $('.nav-tabs a:first').tab('show');
      }
    }
    // cross-browser call to bind showTab
    if (!window.addEventListener) {
      window.attachEvent("popstate", showTabFromUrl);
    } else {
      window.addEventListener("popstate", showTabFromUrl, false);
    }

    showTabFromUrl();

  });// doc ready

/**
 * @summary Transforms all clicks on mailto <A> links into email form popups. NOTE: this is Removed temporarily
 *
 * Long. Transforms all clicks on mailto <A> links into email form popups. Whenever there is a click on a <a> tag that begins with "mailto", run the main function. The function builds a URL to the view that will show the form for the user, opens Colorbox to the view with some options for Colorbox that run scripts after the form is submitted. The Colorbox options are onComplete and onLoad. The onLoad function removes the default Colorbox close button. The onComplete function sets up a click handler when the user submits the form. This handler runs the AJAX connection to the URL in the form's action attribute. The AJAX connection uses the form's data in a serialized format. The success attribute of the AJAX connection displays a message to the user, as does the error function. These messages display inside the Colorbox window. 
 *
 */
$(document).ready(function() {
       console.log("document is ready");
	//center-for-housing-and-policy disable dupe carat (until I find a better way to do this logic)
	$('a[href="/center-for-housing-and-policy"]').closest('li.nav-item').removeClass('active').removeAttr('aria-current');

        $("#viz-viewer-toolbar").css("display", "none");

     $("#Element2").click(function() {
         
            $('#chart2Container').html('<tableau-viz id="tableauViz2" src="https://public.tableau.com/views/HOAMMetroView/Affordability?:language=en-US&publish=yes&:sid=&:redirect=auth&:display_count=n&:origin=viz_share_link" toolbar="no" width="1000" height="800"></tableau-viz>');

    });

      $("#Element1").click(function() {
         
            $('#chart1Container').html('<tableau-viz id="tableauViz" src="https://public.tableau.com/views/HOAMNationalView/Affordability?:language=en-US&:publish=yes&:embed=yes&:sid=&:redirect=auth&:display_count=n&:origin=viz_share_link&:toolbar=no" width="1000" height="800"></tableau-viz>');

    });

});

//$(window).load(function() {
$(window).on("load", function() {
  // executes when complete page is fully loaded, including all frames, objects and images
  console.log("window is loaded!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
   $("#viz-viewer-toolbar").css("display", "none");
});$(function() {
	const isNumericInput = (event) => {
		const key = event.keyCode;
		return ((key >= 48 && key <= 57) || // Allow number line
			(key >= 96 && key <= 105) // Allow number pad
		);
	};

	const isModifierKey = (event) => {
		const key = event.keyCode;
		return (event.shiftKey === true || key === 35 || key === 36) || // Allow Shift, Home, End
			(key === 8 || key === 9 || key === 13 || key === 46) || // Allow Backspace, Tab, Enter, Delete
			(key > 36 && key < 41) || // Allow left, up, right, down
			(
				// Allow Ctrl/Command + A,C,V,X,Z
				(event.ctrlKey === true || event.metaKey === true) &&
				(key === 65 || key === 67 || key === 86 || key === 88 || key === 90)
			)
	};

	const enforceFormat = (event) => {
		// Input must be of a valid number format or a modifier key, and not longer than ten digits
		if(!isNumericInput(event) && !isModifierKey(event)){
			event.preventDefault();
		}
	};

	const formatToPhone = (event) => {
		if(isModifierKey(event)) {return;}

		const target = event.target;
		const input = event.target.value.replace(/\D/g,'').substring(0,10); // First ten digits of input only
		const areaCode = input.substring(0,3);
		const middle = input.substring(3,6);
		const last = input.substring(6,10);

		if(input.length > 6){target.value = `${areaCode}-${middle}-${last}`;}
		else if(input.length > 3){target.value = `${areaCode}-${middle}`;}
		else if(input.length > 0){target.value = `${areaCode}`;}
	};

	let inputElements = document.querySelectorAll('.phone-number-formatting');

	inputElements.forEach((item) => {
		item.addEventListener('keydown',enforceFormat);
		item.addEventListener('keyup',formatToPhone);
	});
});
$(document).ready(function(){
    // bootsrtap tab control setup
    $('.nav-tabs a').click(function (e) {
      e.preventDefault();
      $(this).tab('show');
    });
    // Manage HISTORY (back button behavior) for tabs
    // add a hash to the URL when the user clicks on a tab
    // relies on https://github.com/devote/HTML5-History-API/ to support pushState()
    $('a[data-toggle="tab"]').on('click', function(e) {
      history.pushState(null, null, $(this).attr('href'));
    });
    // // navigate to a tab when the history changes
    showTabFromUrl = function(e) {
      if (location.hash.substr(0,3)=="#/#") {
        hashToUse = location.hash.substr(2);
      } else {
        hashToUse = location.hash;
      }
      var activeTab = $('[href="' + hashToUse + '"]');
      if (activeTab.length) {
        activeTab.tab('show');
      } else {
        $('.nav-tabs a:first').tab('show');
      }
    }
    // cross-browser call to bind showTab
    if (!window.addEventListener) {
      window.attachEvent("popstate", showTabFromUrl);
    } else {
      window.addEventListener("popstate", showTabFromUrl, false);
    }

    showTabFromUrl();

  });// doc ready

 