// MOBILE ONLY // This function is called when the screen is tapped outside the vertical menu // the tap action will close the menu function collapseMenu() { document.getElementById('islbtoggle').checked = ''; } function saveFocusField(field_name) { sessionStorage.setItem("focused", field_name); } function setGeneratorFocusField() { if(screen.width >= 780) { var focus_field = sessionStorage.getItem("focused"); if(focus_field != '' && focus_field != null) { try{ document.getElementById(focus_field).focus(); if(document.getElementById(focus_field).tagName == 'input') { document.getElementById(focus_field).select(); } } catch(error){} } } } var loading_closed = 0; function loading() { loading_closed = 0; document.getElementById("loading_overlay").style.display = "block"; document.getElementById("loading").style.display = "block"; $("#loading_img").show().each(function() { this.offsetHeight; }).prop('src', '//stairbuilder.babinironworks.com/style/loading.gif'); $("#loading_overlay").delay(10000).fadeOut(); $("#loading").delay(10000).fadeOut(); } function closeLoading() { document.getElementById("loading_overlay").style.display = "none"; document.getElementById("loading").style.display = "none"; loading_closed = 1; } function cfLoading() { if ($("#contact_form")[0].checkValidity()) { document.getElementById("loading_overlay").style.display = "block"; document.getElementById("loading").style.display = "block"; $("#loading_img").show().each(function() { this.offsetHeight; }).prop('src', '//stairbuilder.babinironworks.com/style/loading.gif'); $("#loading_overlay").delay(10000).fadeOut(); $("#loading").delay(10000).fadeOut(); } } function highlightDiagramTerms(img) { // 1. Define which terms belong to which image diagram var diagramTerms = { 1: [ "stairwell", "nosing", "treadplate", "landing", "flight", "treadwidth", "stepriseindividualrise", "baseshoe", "finishedfloor", "treadstep", "steprunindividualrun", "treaddepth", "treadthickness", "riser", "spine", "totalrise" ], 2: [ "finishedfloor", "topnosingfloortrim", "topriserboardfasciaboard", "stringer", "rises", "treadstep", "totalrun", "topstringermount", "subfloor", "floorjoist", "headertopconnectionpoints", "flight", "totalrise" ], 3: [ "totalrun", "landing", "landingframe", "backwallstringerconnections", "totalrise", "flight" ] }; // 2. Clear out any terms highlighted from a previous click var previousImg = sessionStorage.getItem("active_diagram"); if (previousImg && diagramTerms[previousImg]) { diagramTerms[previousImg].forEach(function(term) { var titleElem = document.getElementById("title_" + term); var topElem = document.getElementById("top_" + term); if (titleElem) { titleElem.style.color = "#666666"; titleElem.style.background = "#ffffff"; } if (topElem) { topElem.innerHTML = ""; } }); } // 3. Highlight all terms for the newly clicked image diagram var termsToHighlight = diagramTerms[img]; if (termsToHighlight) { // Determine scroll position based on diagram number var scrollTarget = 0; if (img === 2) scrollTarget = 1000; if (img === 3) scrollTarget = 1800; termsToHighlight.forEach(function(term) { var titleElem = document.getElementById("title_" + term); var topElem = document.getElementById("top_" + term); if (titleElem) { titleElem.style.color = "#ffffff"; titleElem.style.background = "#1084b5"; } // Place "BACK TO DIAGRAM [img]" link on ALL highlighted definitions if (topElem) { topElem.innerHTML = "BACK TO DIAGRAM " + img + ""; } }); // 4. Smoothly scroll down to the definitions section var defsContainer = document.getElementById("definitions-section"); if (defsContainer) { defsContainer.scrollIntoView({ behavior: 'smooth' }); } // Save active diagram index in session storage sessionStorage.setItem("active_diagram", img); } } function positionModal() { var modal_position = sessionStorage.getItem("modal_pos"); try { document.getElementById('edit_modal').style.top = modal_position; document.getElementById('edit_modal').style.visibility = "visible"; } catch(error) { } } function encodeChars(text) { var map = { '&': 'mnbamp', '<': 'mnbpb', '>': 'mnbgb', '"': 'dblqu', "'": 'sglqu' }; return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } function openViewer(url, is_label, tok, ssn, app_code) { key = Math.floor((Math.random()*1000000) +1); add_authenticators = key; if(is_label) { add_authenticators = "tok="+tok+"&ssn="+ssn+"&app_code="+app_code; } if (typeof(pdfViewer) == 'undefined' || pdfViewer.closed) { //create new, since none is open pdfViewer = window.open(url+"?"+add_authenticators,'fullsize','left=0,top=0,width=900,height=600,directories=no, titlebar=no, status=no, menubar=no, scrollbars=yes, resizable=yes,toolbar=no'); if (pdfViewer == null || typeof(pdfViewer)=='undefined') { document.getElementById("system_overlay").style.visibility = "visible"; document.getElementById("system_modal").style.visibility = "visible"; document.getElementById("system_modal").style.height = "190px"; document.getElementById("system_modal").innerHTML= "
Cannot display the document.
Try disabling your pop-up blocker.
Don't have a PDF reader?
Get the Adobe Reader here
Cannot display the document.
Try disabling your pop-up blocker.
Don't have a PDF reader?
Get the Adobe Reader here