{"version":3,"sources":["variables.js","functions.js","render-content.js","navigation.js","clone-nav.js","toggle.js","window.js","swf.js","sticky-footer.js","legacy.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"layout.js","sourcesContent":["$(document).ready(function() {\r\n\r\n\t/* Variables\r\n\t//////////////////////////////////////// */\r\n\r\n\tvar\r\n\r\n\t// Select some DOM Elements\r\n\tlogo = document.querySelector('.xs-company-logo'),\r\n\tcompanyName = document.querySelector('.xs-company-name'),\r\n\ttagLine = document.querySelector('.xs-company-tagline'),\r\n\tportraitImg = document.querySelector('.xs-profile-picture'),\r\n\r\n\tprimaryNav = document.querySelector('#xs-primary-nav .xs-primary-nav'),\r\n\tsidePrimaryNav = document.querySelector('.xs-side-primary-nav'),\r\n\tsecondaryNav = document.querySelector('.xs-secondary-nav'),\r\n\taltNav = document.querySelector('.xs-alt-nav'),\r\n\r\n\tfooterPhoneLink = document.querySelector('.xs-footer-phone'),\r\n\tfooterEmailLink = document.querySelector('.xs-footer-email'),\r\n\r\n\ttoggleNav = document.querySelector('.toggle-sidebar-menu'),\r\n\r\n\r\n\twindowWidth = $(window).width(),\r\n\r\n\tx, i,\r\n\r\n\t// namespace object for navigation arrays and page content\r\n\tXSITES = XSITES || {};","\r\n    /* Some Functions\r\n    //////////////////////////////////////// */\r\n\r\n    // Create a generic DOM Element\r\n    var createEl = function(el, elText, elClass) {\r\n        var newEl = document.createElement(el);\r\n        if (elText) {newEl.textContent = elText;}\r\n        if (elClass) {newEl.className = elClass;}\r\n        \r\n        return newEl;\r\n    };// /makeElem()\r\n\r\n\r\n    // Copy Color style to parent element\r\n    // referenced in Company Name and Tagline\r\n    var copyColor = function(colorData, el) {\r\n        var colorStart = colorData.indexOf('color=') + 7;\r\n        var colorEnd = colorStart + 7;// returning a hex value\r\n        var color = colorData.slice(colorStart, colorEnd);\r\n        el.style.color = color;\r\n    };// /copyColor()\r\n\r\n\r\n    // Copy Font size to parent element\r\n    // referenced in Company Name and Tagline\r\n    var copyFontSize = function(fontData, el) {\r\n        var sizeStart = fontData.indexOf('size=') + 6;\r\n        var sizeEnd = sizeStart + 2;\r\n        var fontSize = fontData.slice(sizeStart, sizeEnd);\r\n        el.style.fontSize = fontSize + \"px\";\r\n    };// /copyFontSize()\r\n\r\n\r\n    // Copy Font Family/Face to parent element\r\n    // referenced in Company Name and Tagline\r\n    var copyFontFace = function(fontData, el) {\r\n        var faceStart = fontData.indexOf('face=') + 6;\r\n        var faceEnd = fontData.indexOf(\"'>\");\r\n        var fontFace = fontData.slice(faceStart, faceEnd);\r\n        console.log(fontFace);\r\n        el.style.fontFamily = fontFace;\r\n    };// /copyFontFace()\r\n\r\n\r\n    // get just the text out of some html\r\n    // used here specifically for the <font> tags that xsites outputs from the wizard\r\n    var stripText = function(html) {\r\n       var tmp = document.createElement('div');\r\n       tmp.innerHTML = html;\r\n       return tmp.textContent || tmp.innerText || \"\";\r\n    };\r\n\r\n    // Smooth scrolling parallax for IE\r\n    if(navigator.userAgent.match(/Trident\\/7\\./)) { // if IE\r\n        $('body').on(\"mousewheel\", function () {\r\n            // remove default behavior\r\n            event.preventDefault(); \r\n\r\n            //scroll without smoothing\r\n            var wheelDelta = event.wheelDelta;\r\n            var currentScrollPosition = window.pageYOffset;\r\n            window.scrollTo(0, currentScrollPosition - wheelDelta);\r\n        });\r\n    }\r\n","\r\n// add page content from strAccountData\r\nvar renderPageContent = (function() {\r\n\r\n    'use strict';\r\n    \r\n    XSITES.pageContent = strAccountData[0];\r\n\r\n    // Get the Company Name Text with stripText() in functions.js\r\n    var companyNameText = decodeURIComponent(stripText(XSITES.pageContent.CompanyName));\r\n\r\n    // Add company Name\r\n    if ( XSITES.pageContent.DisplayCompName === 1 && companyName ) {\r\n        \r\n        if (companyName.classList) {\r\n            companyName.classList.add('xs-visible');\r\n        } else {\r\n            companyName.className += ' ' + 'xs-visible';\r\n        }\r\n\r\n        // Company Name Color\r\n        copyColor(XSITES.pageContent.CompanyName, companyName);\r\n\r\n        // Company name font size\r\n        copyFontSize(XSITES.pageContent.CompanyName, companyName);\r\n\r\n        // Company name font face/family\r\n        copyFontFace(XSITES.pageContent.CompanyName, companyName);\r\n\r\n        // if <b></b> Bold\r\n        if ( XSITES.pageContent.CompanyName.indexOf('</b>') > 0 ) {\r\n            companyName.style.fontWeight = \"bold\";\r\n        }\r\n\r\n        // if <i></i> Italic\r\n        if ( XSITES.pageContent.CompanyName.indexOf('</i>') > 0 ) {\r\n            companyName.style.fontStyle = \"italic\";\r\n        }\r\n\r\n        // if <u></u> Underline\r\n        if ( XSITES.pageContent.CompanyName.indexOf('</u>') > 0 ) {\r\n            companyName.style.textDecoration = \"underline\";\r\n        }\r\n\r\n        // companyName.innerHTML = decodeURIComponent(XSITES.pageContent.CompanyName).replace(/size=/g, 'data-size=').replace(/color=/g, 'data-color=');\r\n\r\n        companyName.innerHTML = companyNameText;\r\n    }\r\n\r\n    \r\n    // Company Motto/Tagline\r\n    if (XSITES.pageContent.CompanyTagline !== '' && tagLine ) {\r\n\r\n        if (tagLine.classList) {\r\n            tagLine.classList.add('show');\r\n        } else {\r\n            tagLine.className += ' ' + 'show';\r\n        }\r\n        \r\n        // Motto/Tagline Color\r\n        copyColor(XSITES.pageContent.CompanyTagline, tagLine);\r\n\r\n        // Company Motto/Tagline size\r\n        copyFontSize(XSITES.pageContent.CompanyTagline, tagLine);\r\n\r\n        // add Tagline\r\n        tagLine.innerHTML = decodeURIComponent(XSITES.pageContent.CompanyTagline).replace(/size=/g, 'data-size=').replace(/color=/g, 'data-color=');\r\n    }\r\n\r\n    // Get Company Logo URL\r\n    var companyLogoUrl = XSITES.pageContent.CompanyLogoURL;\r\n\r\n    // Company Logo\r\n    if ( XSITES.pageContent.DisplayLogo === 1 && logo && (/\\.(gif|jp?g|tiff|png)$/i).test(XSITES.pageContent.CompanyLogoURL)) {\r\n        logo.setAttribute('alt', companyNameText + \" Logo\");\r\n        logo.setAttribute('src', companyLogoUrl);\r\n    } else if ( XSITES.pageContent.DisplayLogo === 0 && logo || !(/\\.(gif|jp?g|tiff|png)$/i).test(XSITES.pageContent.CompanyLogoURL)) {\r\n        logo.style.display = 'none';\r\n    }\r\n\r\n    // Sidebar Photo/Portrait\r\n    if ( XSITES.pageContent.DisplayPortrait === 1 && portraitImg ) {\r\n        portraitImg.setAttribute('alt', companyNameText + \" Portrait Photo\");\r\n    } else if ( XSITES.pageContent.DisplayPortrait === 0 && portraitImg ) {\r\n        portraitImg.style.display = 'none';\r\n    }\r\n\r\n\r\n    // Footer Office Phone Button\r\n    if ( XSITES.pageContent.DisplayOfficePhone === true && XSITES.pageContent.Phone !== '' && footerPhoneLink ) {\r\n        var phoneText = document.createTextNode(XSITES.pageContent.Phone);\r\n        footerPhoneLink.appendChild(phoneText);\r\n        footerPhoneLink.setAttribute('href', 'tel:+1' + XSITES.pageContent.Phone);\r\n    } else if ( XSITES.pageContent.DisplayOfficePhone === false && footerPhoneLink ) {\r\n        footerPhoneLink.style.display = 'none';\r\n    }\r\n\r\n    // Footer Email Button\r\n    if ( XSITES.pageContent.DisplayPrimaryEmail === true && XSITES.pageContent.Email !== '' && footerEmailLink ) {\r\n        var emailText = document.createTextNode(XSITES.pageContent.Email);\r\n        footerEmailLink.appendChild(emailText);\r\n        footerEmailLink.setAttribute('href', 'mailto:' + XSITES.pageContent.Email);\r\n    } else if ( XSITES.pageContent.DisplayPrimaryEmail === false && footerEmailLink ) {\r\n        footerEmailLink.style.display = 'none';\r\n    }\r\n    \r\n}());// /renderPageItems() **immediately invoked**","\r\n    // Create navigation listitems\r\n    var createListItem = function ( anchor ) {\r\n\r\n        'use strict';\r\n\t\tif (!String.prototype.includes) {\r\n\t\t\tString.prototype.includes = function (str) {\r\n\t\t\t\tvar returnValue = false;\r\n\r\n\t\t\t\tif (this.indexOf(str) !== -1) {\r\n\t\t\t\t\treturnValue = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn returnValue;\r\n\t\t\t}\r\n\t\t}\r\n        var page = anchor.PageIndex;\r\n\r\n        // create a <li>\r\n        var listItem = document.createElement('li');\r\n        listItem.setAttribute('data-page', page);\r\n\r\n        // if there's a link add the link\r\n        if ( anchor.PageURL ) {\r\n            var theLink = createEl('a', anchor.DisplayPageName);\r\n            theLink.setAttribute('href', anchor.PageURL.includes('http:') || anchor.PageURL.includes('https:') ? anchor.PageURL : '/' + anchor.PageURL);\r\n            listItem.appendChild(theLink);  \r\n        }\r\n\r\n        // if indented add 'indent' class\r\n        if ( anchor.Indent === true ) {\r\n            if (listItem.classList) {\r\n                listItem.classList.add('indent');\r\n            } else {\r\n                listItem.className += ' ' + 'indent';\r\n            }\r\n        }\r\n        \r\n        // add Sub Nav <ul class=\"sub-nav\"> if menu HasChildren\r\n        if ( anchor.HasChildren !== 0 ) {\r\n            var elName = anchor.FileName.replace(/.x/g, '');\r\n            var subNav = document.createElement('ul');\r\n            subNav.setAttribute('id', 'sub-nav-' + elName);\r\n            subNav.className = 'sub-nav';\r\n\r\n            // add 'has-children' class to <li>\r\n            if (listItem.classList) {\r\n                listItem.classList.add('has-children');\r\n            } else {\r\n                listItem.className += ' ' + 'has-children';\r\n            }\r\n\r\n            // append the sub-nav <ul> to the <li>\r\n            listItem.appendChild(subNav);\r\n        }\r\n\r\n        // Connect the nested navigation to the parent\r\n        if ( anchor.Location == \"Child\" ) {\r\n            var parentName = anchor.Parent.replace(/.x/g, '');\r\n            listItem.setAttribute('data-parent', parentName);\r\n        }\r\n\r\n        return listItem;\r\n\r\n    };// /createListItem()\r\n\r\n\r\n    // Add primary navigation listitems to the ul\r\n    var createPrimaryNav = function () {\r\n        for ( i = 0, x = XSITES.collection.length; i < x; i++ ) {\r\n            primaryNav.appendChild( XSITES.collection[i] );\r\n        }\r\n    };// /createPrimaryNav()\r\n\r\n\r\n    // Add secondary navigation listitems to the ul\r\n    var createSecondaryNav = function () {        \r\n        for ( i = 0, x = XSITES.collection.length; i < x; i++ ) {\r\n            secondaryNav.appendChild( XSITES.collection[i] );\r\n        }\r\n        \r\n        // show secondary nav IF it has links\r\n        if ( XSITES.collection.length > 0 ) {\r\n            if (secondaryNav.classList) {\r\n                secondaryNav.classList.add('show');\r\n                toggleNav.classList.add('show');\r\n            } else {\r\n                secondaryNav.className += ' ' + 'show';\r\n                toggleNav.className += ' ' + 'show';\r\n            }\r\n        }\r\n    };// /createSecondaryNav()\r\n\r\n\r\n    // Add alt navigation listitems to the ul\r\n    var createAltNav = function () {\r\n        \r\n        for ( var i in XSITES.collection ) {\r\n            if (XSITES.collection.hasOwnProperty(i)) {\r\n                altNav.appendChild( XSITES.collection[i] );\r\n            }\r\n        }\r\n\r\n        // show secondary nav IF it has links\r\n        if ( XSITES.collection.length > 0 ) {\r\n            if (altNav.classList) {\r\n                altNav.classList.add('show');\r\n                toggleNav.classList.add('show');\r\n            } else {\r\n                altNav.className += ' ' + 'show';\r\n                toggleNav.className += ' ' + 'show';\r\n            }\r\n        }\r\n    };// /createAltNav()\r\n\r\n\r\n    // Add nested/child navigation listitems to the ul under the correct parent\r\n    var createChildNav = function () {\r\n        for ( i = 0, x = XSITES.collection.length; i < x; i++ ) {\r\n            var listElem = document.getElementById('sub-nav-' + XSITES.collection[i].getAttribute('data-parent'));\r\n            listElem && listElem.appendChild(XSITES.collection[i]);\r\n        }\r\n    };// /createChildNav()\r\n\r\n\r\n    // All organized content data\r\n    XSITES.organizedContent = {\r\n        primary: [],\r\n        secondary: [],\r\n        alt: [],\r\n        child: []\r\n    };\r\n\r\n\r\n    // Add navigation data to arrays based on location\r\n    for (i = 0, x = strPageData.length; i < x; i++ ) {\r\n        var locale = strPageData[i].Location.toLowerCase();\r\n        XSITES.organizedContent[locale].push( strPageData[i] );\r\n    }\r\n\r\n    \r\n    var buildNav = function ( target, location ) {\r\n        \r\n        XSITES.collection = [];\r\n        var anchor, page;\r\n\r\n        // Creates array of navigation objects with data\r\n        if (location == 'child') {\r\n        \r\n            for (i = 0, x = target.length; i < x; i++) {\r\n\r\n                anchor = target[i];\r\n                page = anchor.PageIndex;\r\n\r\n                // Add objects to array with data\r\n                XSITES.collection[i] = anchor;\r\n            } \r\n        \r\n        } else {\r\n        \r\n            for (i = 0, x = target.length; i < x; i++) {\r\n\r\n                anchor = target[i];\r\n                page = anchor.PageIndex;\r\n                \r\n                // Add objects to array with data by page number order\r\n                XSITES.collection[page] = anchor;\r\n            }       \r\n        \r\n        } \r\n\r\n        if (location == 'child') {\r\n            // Make list items of child navigation elements without spacers and with parent page data attached\r\n            for (i = 0, x = XSITES.collection.length; i < x; i++) {\r\n                if ( XSITES.collection[i] !== undefined ) {\r\n                    XSITES.collection[i] = createListItem(XSITES.collection[i]);\r\n                } \r\n            }\r\n        } else if (location == 'alt') {\r\n            // Make list items of alt navigation elements without spacers\r\n            for (i = 0, x = XSITES.collection.length; i < x; i++) {\r\n                if ( XSITES.collection[i] !== undefined ) {\r\n                    XSITES.collection[i] = createListItem(XSITES.collection[i]);\r\n                } \r\n            }\r\n\r\n            XSITES.collection.shift();\r\n        } else {\r\n            // Make list items of primary and secondary navigation elements with spacers\r\n            for (i = 1; i < XSITES.collection.length; i++) {\r\n                if ( XSITES.collection[i] === undefined ) {\r\n                    var spacer = document.createElement('li');\r\n                    spacer.className = 'spacer';\r\n\r\n                    XSITES.collection[i] = spacer;\r\n                } else {\r\n                    XSITES.collection[i] = createListItem(XSITES.collection[i]);\r\n                }\r\n            }\r\n\r\n            XSITES.collection.shift();\r\n        }  \r\n\r\n        // append the list item to the appropriate <ul>\r\n        if ( location == 'primary' && primaryNav ) {\r\n            createPrimaryNav();\r\n        } else if ( location == 'secondary'  && secondaryNav ){\r\n            createSecondaryNav();\r\n        } else if ( location == 'child' ) {\r\n            createChildNav();\r\n        } else if ( location == 'alt' && altNav ) {\r\n            createAltNav();\r\n        }\r\n\r\n    }; // /buildNav()\r\n\r\n\r\n    // Create arrays of data sorted by location\r\n    buildNav( XSITES.organizedContent.primary, 'primary' );\r\n    buildNav( XSITES.organizedContent.secondary, 'secondary' );\r\n    buildNav( XSITES.organizedContent.alt, 'alt' );\r\n    buildNav( XSITES.organizedContent.child, 'child' );\r\n\r\n","\r\n// clone the Primary Navigation and append items to sidebar\r\n\r\n// get the Primary Nav links\r\nvar primaryNavLis = document.querySelectorAll('#xs-primary-nav .xs-primary-nav li'),\r\n\r\n// document fragment to store the cloned links\r\ntempPrimaryNav = document.createDocumentFragment(),\r\n\r\ncopyLi;\r\n\r\n// Append each of the <li> to the sidebar \"primary\" navigation\r\nfor (i = 0, x = primaryNavLis.length; i < x; i++) {\r\n\tcopyLi = primaryNavLis[i].cloneNode(true);\r\n\ttempPrimaryNav.appendChild(copyLi);\r\n}\r\n\r\n// Append document fragment to the sidebar primary nav <ul class=\"xs-side-primary-nav\">\r\nsidePrimaryNav.appendChild(tempPrimaryNav);","\r\n\t// Toggle Sidebar\r\n\r\n\t$('.toggle-sidebar-menu, .overlay').on('click', function() {\r\n\t\t\r\n\t\t$('html, .canvas, .overlay, .xs-sidebar').toggleClass('active');\r\n\r\n\t\t// Scroll the sidebar back to the top\r\n\t\t$('.xs-sidebar').scrollTop(0);\r\n\t\r\n\t});","\r\n\t$(window).on('resize load', function() {\r\n\r\n\t\t// Check window width has actually changed and it's not just iOS triggering a resize event on scroll\r\n        if ( $(window).width() !== windowWidth ) {\r\n\r\n            // Update the window width for next time\r\n            windowWidth = $(window).width();\r\n\r\n            $('html, .overlay, .canvas, .xs-sidebar').removeClass('active');\r\n\r\n            // Scroll the sidebar back to the top\r\n            $('.xs-sidebar').scrollTop(0);\r\n\r\n        }\r\n\r\n        // <table> Add Horizontally scrolling div container to tables\r\n        $('.xs-page-content td table').each(function() {\r\n\r\n            var $tableWidth = $(this).width(),\r\n\r\n                $hasTableScroll = $(this).parent('div').hasClass('tableScroll');\r\n\r\n                // Get the width of the parent element\r\n                $parentWidth = $(this).parent().width();\r\n\r\n            // IF there isn't already a <div> wrapping the table AND the table is wider than the <article>\r\n            if ( !$hasTableScroll && $tableWidth > $parentWidth ) {\r\n                $(this).wrap('<div class=\"tableScroll\"></div>');\r\n\r\n            // OTHERWISE Remove the wrapping <div>\r\n            } else if ( $hasTableScroll && $tableWidth <= $parentWidth ) {\r\n                $(this).unwrap();\r\n            }\r\n        });// /tableScroll()\r\n\r\n\t});// /window.on resize load()\r\n\r\n}); // /document.ready","// Add wmode=\"transparent\" to Flash Movies/YouTubes so's the sub-nav fly-outs can be viewed over them\r\n    \r\n    // https://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html#main_Browser_support_for_Window_Mode__wmode__values\r\n    $(function () {\r\n        $('object').each(function () {\r\n            var wrap, clone;\r\n            \r\n            wrap = $('<div>').addClass('embed-wrapper');\r\n            \r\n            clone = $(this).clone();\r\n            clone.append(\r\n                $('<param>').attr({\r\n                    name: 'wmode',\r\n                    value: 'transparent'\r\n                })\r\n            ).find('embed').attr('wmode', 'transparent');\r\n    \r\n            $(this).before( wrap.append(clone) );\r\n            $(this).remove();\r\n        });\r\n\r\n        $('iframe[src*=\"youtube\"]').each(function () {\r\n            var src = $(this).attr('src');\r\n\r\n            src += (src.match(/\\?/g) ? '&' : '?' ) + \"wmode=transparent\";\r\n            \r\n            $(this).attr({\r\n                src: src,\r\n                wmode: \"Opaque\"\r\n            });\r\n        });\r\n    });","/**\r\n * Sticky footer bar for lead capture\r\n */\r\n\r\n\r\n/**\r\n * Validation JS\r\n *\r\n * @author Cassie Koelsch\r\n * @options\r\n *     success: function(){},\r\n *     failure: function(){},\r\n *     emails: [],\r\n *     required: []\r\n */\r\n$(function() {\r\n    $.fn.validation = function(options) {\r\n\r\n        var settings = $.extend({\r\n            success: function() {},\r\n            failure: function() {},\r\n            emails: [],\r\n            required: []\r\n        }, options);\r\n\r\n        return this.each(function() {\r\n\r\n            var Methods = {\r\n                /**\r\n                 * Array containing all form errors\r\n                 *\r\n                 *\r\n                 */\r\n\r\n                errors: [],\r\n                /**\r\n                 * Check for valid email address in required field\r\n                 *\r\n                 * @prams\r\n                 *      form: form being validated,\r\n                 *      fields: each field that is validated (input, textarea, etc.)\r\n                 */\r\n                validateEmail: function(form, fields) {\r\n                    fields.each(function() {\r\n                        var emailRegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i;\r\n\r\n                        // Here is where i do the magic tricks\r\n                        if (!emailRegExp.test($(this).val())) {\r\n                            var id = $(this).attr('id');\r\n                            var label = $(form).find('label[for=' + id + ']');\r\n\r\n                            $(this).addClass('error');\r\n                            $(label).addClass('error');\r\n                            $(this).tooltip('show');\r\n\r\n                            Methods.errors.push({\r\n                                label: $(label),\r\n                                field: $(this)\r\n                            });\r\n                        } else {\r\n                            $(this).tooltip('hide');\r\n                        }\r\n                    });\r\n                },\r\n\r\n                /**\r\n                 * Check for input in required field\r\n                 *\r\n                 * @prams\r\n                 *      form: form being validated,\r\n                 *      fields: each field that is validated (input, textarea, etc.)\r\n                 */\r\n                validateRequired: function(form, fields) {\r\n                    fields.each(function() {\r\n                        if ($(this).is(':checkbox')) {\r\n                            Methods.validateChecked(form, $(this));\r\n                        }\r\n\r\n                        if (!$(this).val()) {\r\n\r\n                            var id = $(this).attr('id');\r\n                            var label = $(form).find('label[for=' + id + ']');\r\n\r\n                            $(this).addClass('error');\r\n                            $(label).addClass('error');\r\n                            $(this).tooltip('show');\r\n\r\n                            Methods.errors.push({\r\n                                label: $(label),\r\n                                field: $(this)\r\n                            });\r\n                        } else if (!$(this).hasClass('error')) {\r\n                            $(this).tooltip('hide');\r\n                        }\r\n                    });\r\n                },\r\n                /**\r\n                 * Check for checked checkbox if checkbox is required\r\n                 *\r\n                 * @prams\r\n                 *      form: form being validated,\r\n                 *      field: the checkbox field that is being validated\r\n                 */\r\n                validateChecked: function(form, field) {\r\n                    if (!field.prop('checked')) {\r\n\r\n                        var id = field.attr('id');\r\n                        var label = $(form).find('label[for=' + id + ']');\r\n\r\n                        field.addClass('error');\r\n                        $(label).addClass('error');\r\n                        $(this).tooltip('show');\r\n\r\n                        Methods.errors.push({\r\n                            label: $(label),\r\n                            field: field\r\n                        });\r\n                    } else {\r\n                        $(this).tooltip('hide');\r\n                    }\r\n                },\r\n                /**\r\n                 * Reset errors on each submit\r\n                 *\r\n                 * @prams\r\n                 *      form: form being validated\r\n                 */\r\n                reset: function(form) {\r\n                    this.errors = Methods.errors = [];\r\n                    form.find('.error').removeClass('error');\r\n                },\r\n                /**\r\n                 * Return true if form has no errors\r\n                 *\r\n                 *\r\n                 */\r\n                isValid: function() {\r\n                    return (Methods.errors.length == 0)\r\n                }\r\n            }\r\n\r\n            $(this).attr('novalidate', true).on('submit', function(e) {\r\n                var emailFields = $('[required][type=email]').add(settings.emails);\r\n                var requiredFields = $('[required]').add(settings.required);\r\n\r\n                Methods.reset($(this));\r\n                Methods.validateEmail($(this), $(this).find(emailFields));\r\n                Methods.validateRequired($(this), $(this).find(requiredFields));\r\n\r\n                //If form is valid, call success function or if form is not valid call failure function\r\n                Methods.isValid() && settings.success({\r\n                    form: $(this),\r\n                    event: e\r\n                }) || !Methods.isValid() && settings.failure({\r\n                    form: $(this),\r\n                    event: e,\r\n                    errors: Methods.errors\r\n                })\r\n            })\r\n        });\r\n    }\r\n}(jQuery));\r\n\r\nfunction getFilename() {\r\n                var pathArray = window.location.pathname.split('/');\r\n                return pathArray[1];\r\n            }\r\n\r\n\r\n            //Call the validation function and send input to AJAX Call\r\n            $('#lead-form').validation({\r\n                failure: function(data) {\r\n                    data.event.preventDefault();\r\n                },\r\n                success: function(data) {\r\n                    data.event.preventDefault();\r\n                    var filename = getFilename() === \"\"?\"Home\":getFilename();\r\n                    console.log(filename);\r\n                    //AJAX Call Here \r\n                    $.ajax({\r\n                        url: \"/admin/wizard/ajax/request.aspx?application=CaptureLead\",\r\n                        method: \"POST\",\r\n                        cache: false,\r\n                        data: {\"pageName\": filename, \"name\": $('#inputName').val(), \"email\": $('#inputEmail').val(), \"question\": $('#inputQuestion').val() },\r\n                        success: function(msg) {\r\n                            //On success hide the form and show a thank you message\r\n                            $('#lead-form').hide();\r\n                            $('.sticky-footer').css(\"height\", \"55px\");\r\n                            $('.submit-message').fadeIn('slow');\r\n                            setTimeout(function() {\r\n                                $('.sticky-footer').fadeOut();\r\n                            }, 5000);\r\n                            setCookie(\"completedFooter\", true, 1);\r\n                        },\r\n                        error: function(msg) {\r\n                            alert(\"There was an error submitting your message. Please try again later.\");\r\n                            console.log(JSON.stringify(msg));\r\n                        }\r\n                    });\r\n\r\n        \r\n                }\r\n\r\n            });\r\n\r\n\r\n//Expands the sticky footer on mobile devices \r\n$(\".expand\").toggle(function() {\r\n    if ($(window).width() < 768) {\r\n        $('.sticky-footer').animate({\r\n            height: '260px',\r\n        });\r\n    }\r\n}, function() {\r\n    $('[data-toggle=\"tooltip\"]').tooltip('hide');\r\n    if ($(window).width() < 768) {\r\n        $('.sticky-footer').animate({\r\n            height: '55px',\r\n        });\r\n    }\r\n});\r\n\r\n$(window).resize(function() {\r\n    $('[data-toggle=\"tooltip\"]').tooltip(\"hide\");\r\n    $('.sticky-footer').css(\"height\", \"55px\");\r\n});\r\n\r\n\r\n//Set Cookie after submit\r\nfunction setCookie(cname, cvalue, exdays) {\r\n    var d = new Date();\r\n    d.setTime(d.getTime() + (exdays*24*60*60*1000));\r\n    var expires = \"expires=\"+ d.toUTCString();\r\n    document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\r\n}\r\n\r\n\r\n//Check for cookie and hide\r\nfunction getCookie(cname) {\r\n    var name = cname + \"=\";\r\n    var decodedCookie = decodeURIComponent(document.cookie);\r\n    var ca = decodedCookie.split(';');\r\n    for(var i = 0; i <ca.length; i++) {\r\n        var c = ca[i];\r\n        while (c.charAt(0) == ' ') {\r\n            c = c.substring(1);\r\n        }\r\n        if (c.indexOf(name) == 0) {\r\n            return c.substring(name.length, c.length);\r\n        }\r\n    }\r\n    return \"\";\r\n}\r\n\r\nif (getCookie(\"completedFooter\")) {\r\n    //hide sticky footer \r\n    $('.sticky-footer').css(\"display\", \"none\");\r\n}\r\n\r\n\r\n\r\n\r\n"," //override bootstrap table cellspacing for legacy tables :'(\r\n \t$(function () {\r\n        $('.xs-legacy-content table[cellspacing]').each(function() {\r\n           var space = $(this).attr('cellspacing') + 'px';\r\n           $(this).css('border-spacing', space);\r\n           $(this).css('border-collapse', 'separate');\r\n        });\r\n    });"]}