{"version":3,"file":"main.min.js","sources":["scripts/main.min.js"],"sourcesContent":["/**************************************************************************\r\nName: main.js\r\nDescription: Site scripting.\r\nDate Created: 09/27/2012 by Kyle Brickman\r\nModified: 02/16/2015 by Roxanne Martinez - added Redactor\r\n**************************************************************************/\r\n\r\n/* Site navigation */\r\nloadEvents.push(function(){\r\n\t(function($, window, document, undefined){\r\n\t\t/* Controls the visibility of the header bar when scrolling */\r\n\t\t'use strict';\r\n\r\n\t\tvar elSelector = 'header .flexnav',\r\n\t\t\telClassHidden = 'nav-hidden',\r\n\t\t\tthrottleTimeout = 500,\r\n\t\t\t$element = $(elSelector),\r\n\t\t\t$hMenu = $('.mNavMenu');\r\n\r\n\t\tif(!$element.length) return true;\r\n\r\n\t\tvar $window\t\t\t= $(window),\r\n\t\t\twHeight\t\t\t= 0,\r\n\t\t\twScrollCurrent\t= 0,\r\n\t\t\twScrollBefore\t= 0,\r\n\t\t\twScrollDiff\t\t= 0,\r\n\t\t\t$document\t\t= $(document),\r\n\t\t\tdHeight\t\t\t= 0,\r\n\r\n\t\t\tthrottle = function(delay, fn)\r\n\t\t\t{\r\n\t\t\t\tvar last, deferTimer;\r\n\t\t\t\treturn function()\r\n\t\t\t\t{\r\n\t\t\t\t\tvar context = this, args = arguments, now = +new Date;\r\n\t\t\t\t\tif(last && now < last + delay)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tclearTimeout(deferTimer);\r\n\t\t\t\t\t\tdeferTimer = setTimeout(function(){ last = now; fn.apply(context, args); }, delay);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlast = now;\r\n\t\t\t\t\t\tfn.apply(context, args);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t};\r\n\r\n\t\t$window.on('scroll', throttle(throttleTimeout, function(){\r\n\t\t\tdHeight\t\t\t= $document.height();\r\n\t\t\twHeight\t\t\t= $window.height();\r\n\t\t\twScrollCurrent\t= $window.scrollTop();\r\n\t\t\twScrollDiff\t\t= wScrollBefore - wScrollCurrent;\r\n\r\n\t\t\tif ($element.hasClass('active')) return;\r\n\r\n\t\t\tif(wScrollCurrent <= 0) {// scrolled to the very top; element sticks to the top\r\n\t\t\t\t$element.removeClass(elClassHidden);\r\n\t\t\t\t$hMenu.removeClass('is-up');\r\n\t\t\t}\r\n\r\n\t\t\telse if(wScrollDiff > 0 && $element.hasClass(elClassHidden)) { // scrolled up; element slides in\r\n\t\t\t\t$element.removeClass(elClassHidden);\r\n\t\t\t\t$hMenu.removeClass('is-up');\r\n\t\t\t}\r\n\r\n\t\t\telse if(wScrollDiff < 0) // scrolled down\r\n\t\t\t{\r\n\t\t\t\tif(wScrollCurrent + wHeight >= dHeight && $element.hasClass(elClassHidden)) { // scrolled to the very bottom; element slides in\r\n\t\t\t\t\t$element.removeClass(elClassHidden);\r\n\t\t\t\t\t$hMenu.removeClass('is-up');\r\n\t\t\t\t}\r\n\r\n\t\t\t\telse { // scrolled down; element slides out\r\n\t\t\t\t\t$element.addClass(elClassHidden);\r\n\t\t\t\t\t$hMenu.addClass('is-up');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\twScrollBefore = wScrollCurrent;\r\n\t\t}));\r\n\r\n\t})(jQuery, window, document);\r\n\r\n\tvar nav = {\r\n\t\tinputClick : 'click',\r\n\t\tinputUp : window.PointerEvent ? 'pointerup' : window.MSPointerEvent ? 'MSPointerUp' : 'mouseup touchend touchcancel',\r\n\t\tinputEnter : window.PointerEvent ? 'pointerenter' : window.MSPointerEvent ? 'MSPointerEnter' : 'mouseover touchstart',\r\n\t\tinputMove : window.PointerEvent ? 'pointermove' : window.MSPointerEvent ? 'MSPointerMove' : 'mousemove touchmove',\r\n\r\n\t\tisStockAndroid : null != navigator.userAgent.toLowerCase().match(/android/) &&\r\n\t\t\t\t\t\t null == navigator.userAgent.toLowerCase().match(/chrome/) &&\r\n\t\t\t\t\t\t null == navigator.userAgent.toLowerCase().match(/firefox/) &&\r\n\t\t\t\t\t\t null == navigator.userAgent.toLowerCase().match(/opera/),\r\n\r\n\t\tcalculate : function()\r\n\t\t{\r\n\t\t\t///* Landscape */\r\n\t\t\tif ($('.mobile-block').css(\"display\") == \"none\")\r\n\t\t\t{\r\n\t\t\t\t$('.mobile-block').attr(\"disabled\", \"disabled\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$('.mobile-block').removeAttr(\"disabled\");\r\n\t\t\t}\r\n\r\n\t\t\tif ($('.tablet-block').css(\"display\") == \"none\")\r\n\t\t\t{\r\n\t\t\t\t$('.tablet-block').attr(\"disabled\", \"disabled\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$('.tablet-block').removeAttr(\"disabled\");\r\n\t\t\t}\r\n\r\n\t\t\tif ($('.desktop-block').css(\"display\") == \"none\")\r\n\t\t\t{\r\n\t\t\t\t$('.desktop-block').attr(\"disabled\", \"disabled\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$('.desktop-block').removeAttr(\"disabled\");\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tsetTrap : function()\r\n\t\t{\r\n\t\t\tvar link = $(this);\r\n\r\n\t\t\tlink.attr('data-trap', 'true');\r\n\t\t},\r\n\r\n\t\tshowNavPrimaryLink : function(evt)\r\n\t\t{\r\n\t\t\tvar link = $(this);\r\n\r\n\t\t\tif(link.hasClass('hover'))\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// nav.hideNavPrimaryLink();\r\n\r\n\t\t\tlink.addClass('hover');\r\n\t\t},\r\n\r\n\t\thideNavPrimaryLink : function(evt)\r\n\t\t{\r\n\t\t\tvar link = $('.mNavListLink.hover, .mNavListLinkText'),\r\n\t\t\t\ttgt = link.filter(evt.target),\r\n\t\t\t\tnotTgt = link.not(evt.target);\r\n\r\n\t\t\tif(evt && notTgt.length <= 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tnotTgt.removeClass('hover');\r\n\t\t},\r\n\r\n\t\ttoggleDropdown : function(evt){\r\n\t\t\t/* Show or hide a mobile sub-menu */\r\n\t\t\tlet parentNavItem = jQuery(evt.target).closest(\".mNavListItem\");\r\n\t\t\tif(parentNavItem.length > 0){\r\n\t\t\t\tparentNavItem.toggleClass(\"active\");\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\ttogglePortrait : function(evt){\r\n\t\t\t/* Toggles the mobile navigation menu */\r\n\t\t\tevt.preventDefault();\r\n\t\t\tevt.stopPropagation();\r\n\r\n\t\t\tlet newNav = $(this).siblings('.mNavList, .mNavSecondary'),\r\n\t\t\t\tprimaryBody = $('.primary-body'),\r\n\t\t\t\ttertiaryNavs = $('.mNavSecondItem');\r\n\r\n\t\t\tnewNav.toggleClass('active');\r\n\r\n\t\t\tprimaryBody.removeClass('nav-active');\r\n\t\t\tif (newNav.hasClass('active')) {\r\n\t\t\t\tprimaryBody.addClass('nav-active');\r\n\t\t\t\t//Fix for when the navigation is hidden after the user scrolls down\r\n\t\t\t\tlet flexnavElem = newNav.closest(\".flexnav\");\r\n\t\t\t\tflexnavElem.css(\"transition\", \"none\");\r\n\t\t\t\twindow.requestAnimationFrame(()=>{\r\n\t\t\t\t\tflexnavElem.removeClass(\"nav-hidden\");\r\n\t\t\t\t\twindow.requestAnimationFrame(()=>{\r\n\t\t\t\t\t\tflexnavElem.removeAttr(\"style\");\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\ttertiaryNavs.removeClass('active');\r\n\r\n\t\t\treturn false;\r\n\t\t},\r\n\r\n\t\thideNav : function(evt){\r\n\t\t\t/* Closes the mobile navigation menu */\r\n\t\t\tevt.preventDefault();\r\n\t\t\tevt.stopPropagation();\r\n\r\n\t\t\tvar newNav = $('.mNavList, .mNavSecondary, .mNavSecondItem'),\r\n\t\t\t\tprimaryBody = $('.primary-body');\r\n\r\n\t\t\tnewNav.removeClass('active');\r\n\t\t\tprimaryBody.removeClass('nav-active');\r\n\r\n\t\t\treturn false;\r\n\t\t},\r\n\r\n\t\thovGen : function(evt)\r\n\t\t{\r\n\t\t\tvar link = $(this);\r\n\r\n\t\t\tif(link.hasClass('hover'))\r\n\t\t\t\treturn;\r\n\r\n\t\t\tlink.addClass('hover');\r\n\t\t},\r\n\r\n\t\thideHovGen : function(evt)\r\n\t\t{\r\n\t\t\tvar link = $('.hovEvt');\r\n\r\n\t\t\tif(evt && $('.hovEvt').filter(evt.target).length)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tlink.removeClass('hover');\r\n\t\t},\r\n\r\n\t\thideHovGen2 : function(evt){\r\n\t\t\tlet target = $(evt.target);\r\n\t\t\tlet targetParent = target.parent('.hovTN');\r\n\t\t\tlet targetAncestor = target.parentsUntil('.hovTN').parent('.hovTN');\r\n\r\n\t\t\tif(evt && (target.hasClass('hovTN') || targetParent.length > 0 || targetAncestor.length > 0)){\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t$('.hovTN').removeClass('hover');\r\n\t\t},\r\n\r\n\t\tinit : function(){\r\n\t\t\tlet self = this;\r\n\t\t\tself.calculate();\r\n\t\t\t$(window).on('resize orientationchange', self.calculate);\r\n\r\n\t\t\t$('.mNavToggleButton').on(self.inputClick, self.togglePortrait);\r\n\t\t\t$('.mNavCloseButton').on(self.inputClick, self.hideNav);\r\n\r\n\t\t\t$('body').on(self.inputUp + ' ' + self.inputMove, self.hideNavPrimaryLink);\r\n\t\t\t$('body').on(self.inputUp + ' ' + self.inputMove, self.hideHovGen);\r\n\t\t\t$('body').on(self.inputUp + ' ' + self.inputMove, self.hideHovGen2);\r\n\t\t\t$('.mNavListLink').on(self.inputEnter, self.showNavPrimaryLink);\r\n\t\t\t$('.hovEvt').on(self.inputEnter, self.hovGen);\r\n\t\t\t$('.hovTN').on(self.inputEnter, self.hovGen);\r\n\t\t\t$('.hasDropdown > button.mNavListLink').on(self.inputClick, self.toggleDropdown)\r\n\t\t}\r\n\t}\r\n\t\r\n\tnav.init();\r\n});\r\n\r\n/* IE 10 fix */\r\nif (navigator.appVersion.indexOf('MSIE 10') != -1)\r\n{\r\n\t$('html').addClass('is-ie');\r\n\t$('html').addClass('is-ie10');\r\n\t$('html').addClass('lt-ie11');\r\n}\r\n\r\n/* IE 11 fix */\r\nif (navigator.appVersion.indexOf('Trident') != -1 && navigator.appVersion.indexOf('rv:11') != -1)\r\n{\r\n\t$('html').addClass('is-ie');\r\n\r\n\tif (navigator.appVersion.indexOf('rv:11') != -1)\r\n\t\t$('html').addClass('is-ie11');\r\n}\r\n\r\n/* Legacy Android fix */\r\nif(/android/i.test(navigator.userAgent))\r\n{\r\n\t$('html').addClass('is-android');\r\n\r\n\tif(!/chrome/i.test(navigator.userAgent) &&\r\n\t\t!/firefox/i.test(navigator.userAgent) &&\r\n\t\t!/opera/i.test(navigator.userAgent))\r\n\t\t$('html').addClass('is-legacy-android');\r\n}\r\n\r\nif(/ip(hone|od|ad)/i.test(navigator.userAgent))\r\n{\r\n\t$('html').addClass('is-ios');\r\n\r\n\ttry{\r\n\t\tif(6 >= parseInt(navigator.appVersion.match(/OS (\\d+)_(\\d+)_?(\\d+)?/)[1]))\r\n\t\t\t$('html').addClass('is-legacy-ios');\r\n\t}\r\n\tcatch{}\r\n}\r\n\r\n /* Windows touch device support */\r\n/* Support for full site's top navigation on touch devices */\r\nif(navigator.msMaxTouchPoints > 0 || navigator.maxTouchPoints > 0){ $('html').addClass('touch'); }\r\n\r\n/* Redactor plugin storage\r\n\r\n/* Displays site navigation dropdown if wireless */\r\nloadEvents.push(function(){\r\n\t$(window).on('resize', function(evt){\r\n\t\t$('nav ul.sections').addClass('hiddenNav');\r\n\t\tupdateTinyMCE();\r\n\t});\r\n\twindow.setTimeout(updateTinyMCE, 500);\r\n\r\n\t$(document).mouseup(function (e)\r\n\t{\r\n\t\tvar container = $(\"header.landscape\");\r\n\r\n\t\tif (container.hasClass(\"active\") && !container.is(e.target) && container.has(e.target).length === 0)\r\n\t\t{\r\n\t\t\ttoggleContactForm();\r\n\t\t}\r\n\t});\r\n});\r\n\r\n/* Resizes fieldsets to maximum row height */\r\nvar resizeFieldsets = function()\r\n{\r\n\tvar fieldsets = $('fieldset').not('.controls');\r\n\tvar currentTop = 0;\r\n\tvar currentHeight = 0;\r\n\r\n\tfieldsets.height('auto');\r\n\r\n\tfor(var i = 0; i < fieldsets.length; i++)\r\n\t{\r\n\t\tvar thisTop = $(fieldsets[i]).offset().top;\r\n\t\tvar thisHeight = $(fieldsets[i]).height();\r\n\r\n\t\tif(thisTop == currentTop)\r\n\t\t{\r\n\t\t\tif(thisHeight > currentHeight)\r\n\t\t\t{\r\n\t\t\t\tcurrentHeight = thisHeight;\r\n\r\n\t\t\t\tfor(var j = i; j >= 0; j--)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($(fieldsets[j]).offset().top == thisTop)\r\n\t\t\t\t\t\t$(fieldsets[j]).height(currentHeight);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(thisHeight < currentHeight)\r\n\t\t\t{\r\n\t\t\t\t$(fieldsets[i]).height(currentHeight);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcurrentTop = thisTop;\r\n\t\t\tcurrentHeight = thisHeight;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvar updateTinyMCE = function()\r\n{\r\n\t$('div.column.span_1_1 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .99, 0)})\r\n\t$('div.column.span_2_2 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .99, 0)})\r\n\t$('div.column.span_3_3 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .99, 0)})\r\n\tif($(window).width() > 568){\r\n\t\t$('div.column.span_1_2 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .49, 20)})\r\n\t\t$('div.column.span_2_3 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .65, 20)})\r\n\t\t$('div.column.span_1_3 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .32, 20)})\r\n\t}else{\r\n\t\t$('div.column.span_1_2 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .99, 0)})\r\n\t\t$('div.column.span_2_3 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .99, 0)})\r\n\t\t$('div.column.span_1_3 span.mceEditor table.mceLayout').each(function(){ resizeTinyMCE(this, .99, 0)})\r\n\t}\r\n}\r\n\r\nvar resizeTinyMCE = function(instance, percentage, offset)\r\n{\r\n\tvar mceLayout = $(instance);\r\n\tvar mceContainer = $('fieldset.controls').last();\r\n\tvar mceColumn = $(instance).parent().parent().parent();\r\n\tvar mceTextarea = $(instance).parent().siblings('textarea');\r\n\r\n\t//update width of the tinyMCE toolbar\r\n\tif(mceTextarea.hasClass('featureText')){\r\n\t\tif(mceColumn.width() < 315){\r\n\t\t\tmceLayout.find('td.mceToolbar td').each(function(){ $(this).css({ 'display': 'table-row', 'float' : 'left' }); });\r\n\t\t\tmceLayout.find('td.mceToolbar td:nth-of-type(11)').each(function(){ $(this).css({ 'clear' : 'left' }); });\r\n\t\t}else{\r\n\t\t\tmceLayout.find('td.mceToolbar td').each(function(){ $(this).css({ 'display': 'table-cell', 'float' : 'none' }); });\r\n\t\t\tmceLayout.find('td.mceToolbar td:nth-of-type(11)').each(function(){ $(this).css({ 'clear' : 'none' }); });\r\n\t\t}\r\n\t}else if(mceTextarea.hasClass('tinymceSmall')){\r\n\t\tif(mceColumn.width() < 385){\r\n\t\t\tmceLayout.find('td.mceToolbar td').each(function(){ $(this).css({ 'display': 'table-row', 'float' : 'left' }); });\r\n\t\t\tmceLayout.find('td.mceToolbar td:nth-of-type(11)').each(function(){ $(this).css({ 'clear' : 'left' }); });\r\n\t\t}else{\r\n\t\t\tmceLayout.find('td.mceToolbar td').each(function(){ $(this).css({ 'display': 'table-cell', 'float' : 'none' }); });\r\n\t\t\tmceLayout.find('td.mceToolbar td:nth-of-type(11)').each(function(){ $(this).css({ 'clear' : 'none' }); });\r\n\t\t}\r\n\t}else if(mceTextarea.hasClass('tinymceLarge')){\r\n\t\tif(mceColumn.width() < 735){\r\n\t\t\tmceLayout.find('td.mceToolbar td').each(function(){ $(this).css({ 'display': 'table-row', 'float' : 'left' }); });\r\n\t\t\tmceLayout.find('td.mceToolbar td:nth-of-type(11)').each(function(){ $(this).css({ 'clear' : 'left' }); });\r\n\t\t}else{\r\n\t\t\tmceLayout.find('td.mceToolbar td').each(function(){ $(this).css({ 'display': 'table-cell', 'float' : 'none' }); });\r\n\t\t\tmceLayout.find('td.mceToolbar td:nth-of-type(11)').each(function(){ $(this).css({ 'clear' : 'none' }); });\r\n\t\t}\r\n\t}\r\n\r\n\tmceLayout.width(mceContainer.width() * percentage - offset);\r\n}\r\n\r\nloadEvents[loadEvents.length] = function(){\r\n\tif($('fieldset').not('.controls').length)\r\n\t{\r\n\t\t$(window).on('orientationchange resize', resizeFieldsets);\r\n\t\tresizeFieldsets();\r\n\t}\r\n\r\n\t$('.posAwareButton').on('mouseenter', function(e) {\r\n\t\tvar parentOffset = $(this).offset(),\r\n\t\t\trelX = e.pageX - parentOffset.left,\r\n\t\t\trelY = e.pageY - parentOffset.top;\r\n\t\t$(this).find('.paBG').css({top:relY, left:relX})\r\n\t}).on('mouseout', function(e) {\r\n\t\tvar parentOffset = $(this).offset(),\r\n\t\t\trelX = e.pageX - parentOffset.left,\r\n\t\t\trelY = e.pageY - parentOffset.top;\r\n\t\t$(this).find('.paBG').css({top:relY, left:relX})\r\n\t});\r\n}\r\n\r\nloadEvents[loadEvents.length] = function(){\r\n\t$('div.homeBanner div.scroll a').click(function(e){\r\n\t\te.preventDefault();\r\n\t\t$('html,body').animate({ 'scrollTop' : $('div.homeBanner').outerHeight() }, 1000);\r\n\t});\r\n}\r\n\r\n/* Slideshows */\r\nloadEvents[loadEvents.length] = function(){\r\n\tvar debounceTimer = new Date().getTime();\r\n\tvar runningDebounce = null;\r\n\t//update homepage services\r\n\t$(window).on('resize orientationchange', function(evt){\r\n\t\tif($('.hpSlideshow .serviceCategory').length > 0 && $('.hpSlideshow .serviceCategory').eq(0).innerWidth() < (0.8 * $('.ourServices .servicesContent').outerWidth())){\r\n\t\t\t$('.hpSlideshow .serviceCategory').attr('style', '');\r\n\t\t}\r\n\t\t//Resize the Our Work slideshow if needed\r\n\t\tconst debounceMinTime = 250;\r\n\t\tif(runningDebounce === null){\r\n\t\t\tif(new Date().getTime() - debounceTimer >= debounceMinTime){\r\n\t\t\t\t//The resizing can be run immediately\r\n\t\t\t\tresizeOurWorkSlideshow();\r\n\t\t\t\tdebounceTimer = new Date().getTime();\r\n\t\t\t}\r\n\t\t\telse{\t//Wait until the debounce time is reached\r\n\t\t\t\trunningDebounce = window.setTimeout(()=>{\r\n\t\t\t\t\tresizeOurWorkSlideshow();\r\n\t\t\t\t\tdebounceTimer = new Date().getTime();\r\n\t\t\t\t\trunningDebounce = null;\r\n\t\t\t\t}, (debounceTimer + debounceMinTime) - new Date().getTime());\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\tfunction resizeOurWorkSlideshow(){\r\n\t\tlet slideTextArea = jQuery(\".workDetails .ourWorkTextArea\");\r\n\t\tif(jQuery(window).width() <= 768){\r\n\t\t\tlet maxHeight = 0;\r\n\t\t\tslideTextArea.find(\".workDetailsContent.slide\").each((i,e)=>{\r\n\t\t\t\t//Find the height of the tallest slide\r\n\t\t\t\tmaxHeight = Math.max(e.clientHeight, maxHeight);\r\n\t\t\t});\r\n\t\t\tslideTextArea.css(\"height\", `${maxHeight}px`);\r\n\t\t}\r\n\t\telse{\t//Clear the set height on the text area\r\n\t\t\tslideTextArea.css(\"height\", \"\");\r\n\t\t}\r\n\t}\r\n\tresizeOurWorkSlideshow();\t//Run on page load\r\n\r\n\t// hide arrows anytime there is only one slide or zero slides\r\n\t$('.slideshowLeft,.slideshowRight').each(function(){\r\n\t\tvar slides = $(this).closest('.hpSlideshow').find('.slide');\r\n\r\n\t\tif(slides.length < 2) $(this).hide();\r\n\t});\r\n\r\n\t$('.slideshowLeft,.slideshowRight').click(function(evt){\r\n\t\tevt.preventDefault();\r\n\r\n\t\tlet slides = $(this).closest('.hpSlideshow').find('.slide');\r\n\t\tlet slides2 = $(this).closest('.hpSlideshow').find('.imgSlide');\r\n\t\tlet slide = slides.filter('.active');\r\n\t\tlet index = slide.prevAll().length;\r\n\r\n\t\tif($(this).hasClass('slideshowRight')){\r\n\t\t\tvar newIndex = index - 1;\r\n\t\t\tvar direction = -1;\r\n\t\t}else{\r\n\t\t\tvar newIndex = index + 1;\r\n\t\t\tvar direction = 1;\r\n\t\t}\r\n\r\n\t\tif(newIndex < 0) newIndex = slides.length - 1;\r\n\t\tif(newIndex >= slides.length) newIndex = 0;\r\n\r\n\t\tslides.eq(newIndex).css('left', -1 * (direction * 100) + '%');\r\n\t\tslides.filter('.active').animate({left: (direction *100) + '%'});\r\n\t\tslides.eq(newIndex).animate({left: '0%'});\r\n\t\tslides2.eq(newIndex).css('left', -1 * (direction * 100) + '%');\r\n\t\tslides2.filter('.active').animate({left: (direction * 100) + '%'});\r\n\t\tslides2.eq(newIndex).animate({left: '0%'});\r\n\r\n\t\tslides.filter('.active').removeClass('active');\r\n\t\tslides2.filter('.active').removeClass('active');\r\n\t\tslides.eq(newIndex).addClass('active');\r\n\t\tslides2.eq(newIndex).addClass('active');\r\n\t});\r\n}\r\n\r\nloadEvents[loadEvents.length] = function(){\r\n\t// $('.mNavListLinkContact').click(function(event) {\r\n\t// \tif (jQuery(window).width() <= 768) {\r\n\t// \t\treturn true;\r\n\t// \t}\r\n\t// \telse {\r\n\t// \t\tevent.preventDefault();\r\n\t// \t\ttoggleContactForm();\r\n\t// \t\twindow.setTimeout(()=>{jQuery(this).removeClass(\"isShrinkingUnderline\")},10);\r\n\t// \t\treturn false;\r\n\t// \t}\r\n\t// });\r\n}\r\n/* Homepage touch support for plus icons - http://www.hnldesign.nl/work/code/mouseover-hover-on-touch-devices-using-jquery/ - need fix for MS pointer events (ex: surface tablet) */\r\n$('div.taphover').on(\"touchstart MSPointerEnter\", function (e) {\r\n\t'use strict'; //satisfy code inspectors\r\n\tvar link = $(this); //preselect the link\r\n\tif (link.hasClass('hover')) {\r\n\t\treturn true;\r\n\t} else {\r\n\t\tlink.addClass('hover');\r\n\t\t$('div.taphover').not(this).removeClass('hover');\r\n\t\te.preventDefault();\r\n\t\treturn false; //extra, and to make sure the function has consistent return points\r\n\t}\r\n});\r\n\r\n/* Slide in animation on scroll */\r\nvar animateSlideIn = function() {\r\n\tlet windowHeight = jQuery(window).height();\r\n\t$(\".animationElement,.toolTip,.blockBlue,.customerRatingGraph\").not(\".inView\").each(function(i, el) {\r\n\t\tlet elem = jQuery(el);\r\n\t\tif(visible(elem, true)){\r\n\t\t\telem.trigger(\"partialScrolledIntoView\");\r\n\t\t\t//Check if the element is 1/5 in view\r\n\t\t\tlet elemPositioning = elem[0].getBoundingClientRect();\r\n\t\t\tif(windowHeight - elemPositioning.top >= (elemPositioning.height / 5)\r\n\t\t\t\t|| elemPositioning.top < (windowHeight / 2)){\t//The top of the element is halfway up the viewport\r\n\t\t\t\telem.addClass(\"inView\").trigger(\"scrolledIntoView\");\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nloadEvents.push(function(){\r\n\t//Trigger slide in elements which wouldn't otherwise be triggerable\r\n\twindow.requestAnimationFrame(()=>{\r\n\t\tjQuery(\".animationElement\").each(function(i,e){\r\n\t\t\tif(e.outerHeight > (window.innerHeight * 0.9)\r\n\t\t\t\t|| (e.getBoundingClientRect().top || 0) < 0){\r\n\t\t\t\te.classList.add(\"inView\");\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\t//Trigger the scroll listener on page load in case there are animated elements in view already\r\n\twindow.setTimeout(()=>{\r\n\t\tanimateSlideIn();\r\n\t}, 50);\r\n});\r\n\r\nvar trackManBun = function() {\r\n\t$(\".manbun\").each(function(i, el) {\r\n\t\tvar el = $(el);;\r\n\t\tif (visible(el,false) && !el.hasClass('inView') && $(window).width() > 815) {\r\n\t\t\tel.addClass(\"inView\");\r\n\r\n\t\t\tvar eventCategory = 'Visitor',\r\n\t\t\t\teventAction = 'Homepage View',\r\n\t\t\t\teventLabel = 'Man Bun in view';\r\n\t\t\ttrackGaEvent(eventCategory, eventAction, eventLabel);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n$(window).scroll(animateSlideIn);\r\n$(window).on('orientationchange resize', trackManBun);\r\n$(window).scroll(trackManBun);\r\n$(document).ready(function() {\r\n\t/* Google Analytics Event Tracking Code */\r\n\t$('.mNav a.logo').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'A-VIBE Logo Click');\r\n\t});\r\n\r\n\t$('.mNavList a').on('click', function(e) {\r\n\t\tlet el = $(this);\r\n\t\tlet eventAction = 'Main Navigation Click';\r\n\t\tlet paths = getPaths();\r\n\t\tlet referer = paths.referer;\r\n\t\tlet currentPath = paths.currentPath;\r\n\r\n\t\tif(el.attr('href') == undefined) {\r\n\t\t\tif(!el.parent().hasClass('active')) {\r\n\t\t\t\tlet eventLabelText = 'Tertiary Nav Opened';\r\n\t\t\t\ttrackLinkClick(el, eventAction, referer, currentPath, false, eventLabelText);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if($(window).width() > 768 && el.attr('href').indexOf('contact') > -1) {\r\n\t\t\tlet eventLabelText = 'Form Opened';\r\n\t\t\ttrackLinkClick(el, eventAction, referer, currentPath, false, eventLabelText);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tgetLinkData(e, el, eventAction);\r\n\t\t}\r\n\r\n\t\t/* Navigation link click animation */\r\n\t\tif(!el.parent().hasClass(\"projectContactButton\")){\r\n\t\t\tel.addClass(\"isShrinkingUnderline\");\r\n\t\t}\r\n\t});\r\n\r\n\t$('.mNavList .mNavSecondaryToggle').on('click', function() {\r\n\t\tlet el = $(this).parent();\r\n\t\tlet eventAction = 'Main Navigation Click';\r\n\t\tlet paths = getPaths();\r\n\t\tlet referer = paths.referer;\r\n\t\tlet currentPath = paths.currentPath;\r\n\t\tlet eventLabelText = 'Secondary Nav Opened';\r\n\r\n\t\ttrackLinkClick(el, eventAction, referer, currentPath, false, eventLabelText);\r\n\t});\r\n\r\n\t$('a.plusContent').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'Homepage Banner Plus Click');\r\n\t});\r\n\r\n\t$('.homeBanner a.posAwareButton').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'Homepage Banner Scroll Button Click');\r\n\t});\r\n\r\n\t$('.section.main article a').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'Main Content Link Click');\r\n\t});\r\n\r\n\t$('a.ctaLink').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'CTA Button Click');\r\n\t});\r\n\r\n\t$('footer a').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'Footer Link Click');\r\n\t});\r\n\r\n\t$('.contactArea a:not(.closeContact)').on('click', function(e) {\r\n\t\tgetLinkData(e, $(this), 'Contact Area Link Click');\r\n\t});\r\n\r\n\t$('#contactForm, #portraitContactForm, #stayInformedForm, #consultationForm').on('focusout', function(evt) {\r\n\t\tlet form = jQuery(this);\r\n\r\n\t\tif(evt.relatedTarget === null || (!form.has(evt.relatedTarget) && !jQuery(evt.relatedTarget).is(\"[type='submit']\"))){\r\n\t\t\ttrackContactForm(form, 'Contact Form Abandoned');\r\n\t\t}\r\n\t});\r\n});\r\n\r\n\r\n/* Supports tree-like tables */\r\nvar toggleChildRows = function(evt)\r\n{\r\n\tevt.preventDefault();\r\n\r\n\tvar parentA = $(this);\r\n\tvar parentTR = parentA.parent().parent();\r\n\tvar parentTBODY = parentTR.parent();\r\n\tvar parentTABLE = parentTBODY.parent();\r\n\tvar parentID = parentTR.attr('data-id');\r\n\tvar parentTABLENUM = -1;\r\n\r\n\tif(parentTABLE.parents('.pinned').length){\r\n\t\tvar parentTABLENUM = parentTABLE.parents('.pinned').attr('tablenum');\r\n\t\tif(typeof parentTABLENUM != 'undefined' && parentTABLENUM !== false){\r\n\t\t\tparentTABLE = $('div.pinned[tablenum=\"' + parentTABLENUM + '\"] table,div.scrollable[tablenum=\"' + parentTABLENUM + '\"] table');\r\n\t\t\tparentTBODY = $('div.pinned[tablenum=\"' + parentTABLENUM + '\"] table tbody,div.scrollable[tablenum=\"' + parentTABLENUM + '\"] table tbody');\r\n\t\t}\r\n\t}\r\n\r\n\tif('Collapse' == parentA.attr('title'))\r\n\t{\r\n\t\tvar children = $('tr', parentTBODY).filter('[data-parent^=\"' + parentID + '\"]');\r\n\r\n\t\tchildren.hide();\r\n\r\n\t\t$('a.collapse', children).removeClass('collapse').addClass('expand').attr('title', 'Expand').text('Expand');\r\n\t\tparentA.removeClass('collapse').addClass('expand').attr('title', 'Expand').text('Expand');\r\n\t}\r\n\telse\r\n\t{\r\n\t\tvar children = $('tr', parentTBODY).filter('[data-parent=\"' + parentID + '\"]');\r\n\r\n\t\tchildren.show();\r\n\t\tparentA.removeClass('expand').addClass('collapse').attr('title', 'Collapse').text('Collapse');\r\n\t}\r\n\r\n\t// Candy striping support\r\n\tif(!parentTABLE.hasClass('nostripe'))\r\n\t{\r\n\t\t$('tr').removeClass();\r\n\r\n\t\tvar stripeIndex = 0;\r\n\t\tif(parentTABLE.parents('.pinned').length){\r\n\t\t\t$('tr', $('div.pinned[tablenum=\"' + parentTABLENUM + '\"] table tbody')).not(':hidden').each(function(index){\r\n\t\t\t\tstripeIndex += 1;\r\n\t\t\t\t$(this).addClass(0 == stripeIndex % 2 ? 'evenChild' : 'oddChild');\r\n\t\t\t});\r\n\t\t\tstripeIndex = 0;\r\n\t\t\t$('tr', $('div.scrollable[tablenum=\"' + parentTABLENUM + '\"] table tbody')).not(':hidden').each(function(index){\r\n\t\t\t\tstripeIndex += 1;\r\n\t\t\t\t$(this).addClass(0 == stripeIndex % 2 ? 'evenChild' : 'oddChild');\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\t$('tr', parentTBODY).not(':hidden').each(function(index){\r\n\t\t\t\tstripeIndex += 1;\r\n\t\t\t\t$(this).addClass(0 == stripeIndex % 2 ? 'evenChild' : 'oddChild');\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\twriteTreeSessionStorage(parentTABLE);\r\n}\r\n\r\nvar writeTreeSessionStorage = function(parentTABLE)\r\n{\r\n\t// HTML5 session storage\r\n\tif('undefined' !== typeof(Storage))\r\n\t{\r\n\t\tvar path = window.location.pathname.replace(/\\//g, '_');\r\n\t\tvar dataID = [];\r\n\t\tvar dataStatus = [];\r\n\r\n\r\n\t\tsessionStorage[ 'tree' + path ] = '';\r\n\r\n\t\t$('tr[data-id]', parentTABLE).each(function(index){\r\n\t\t\tdataID[ dataID.length] = $(this).attr('data-id');\r\n\t\t\tdataStatus[dataStatus.length] = $('a', $(this)).first().hasClass('collapse');\r\n\t\t})\r\n\r\n\t\tdataID = dataID.join(',');\r\n\t\tdataStatus = dataStatus.join(',');\r\n\r\n\t\tsessionStorage[ 'tree' + path ] += dataID + '|';\r\n\t\tsessionStorage[ 'tree' + path ] += dataStatus + '|';\r\n\t}\r\n};\r\n\r\nvar readTreeSessionStorage = function(parentTABLE)\r\n{\r\n\tvar path = window.location.pathname.replace(/\\//g, '_');\r\n\r\n\t// HTML5 session storage\r\n\tif('undefined' !== typeof(Storage) && sessionStorage[ 'tree' + path ])\r\n\t{\r\n\t\tvar dataID = sessionStorage[ 'tree' + path ].split('|')[0].split(',');\r\n\t\tvar dataStatus = sessionStorage[ 'tree' + path ].split('|')[1].split(',');\r\n\r\n\t\t$('tr[data-id]', parentTABLE).hide();\r\n\t\t$('tr[data-id] a.inline.collapse').text('Expand').attr('title', 'Expand').removeClass('collapse').addClass('expand');\r\n\t\t$('tr[data-id]', parentTABLE).first().show();\r\n\r\n\t\tfor(var i = 0; i < dataID.length; i++)\r\n\t\t{\r\n\t\t\tif('true' === dataStatus[i])\r\n\t\t\t\t$('tr[data-id=\"' + dataID[i] + '\"] a.inline.expand').trigger('click');\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$('a.inline.collapse', parentTABLE).first().trigger('click').trigger('click');\r\n\t}\r\n}\r\n\r\n/* Displays a confirmation banner */\r\nvar displayConfirmationBanner = function(evt)\r\n{\r\n\tevt.preventDefault();\r\n\r\n\tvar target = $(evt.target);\r\n\tvar banner = $('
');\r\n\tvar yesButton = $('');\r\n\tvar noButton = $('');\r\n\tvar after = $('article h2');\r\n\r\n\tif(!after.length)\r\n\t\tafter = $('article h1');\r\n\r\n\tafter = after.first();\r\n\r\n\tbanner.addClass('banner');\r\n\tbanner.addClass('example');\r\n\tbanner.text(target.attr('data-message') ? target.attr('data-message') : target.attr('title') ? target.attr('title') : target.attr('href'));\r\n\r\n\tyesButton.val('Yes'); yesButton.attr('type', 'button');\r\n\t noButton.val('No'); noButton.attr('type', 'button');\r\n\r\n\tyesButton.on('click', function(evt){\r\n\t\tif(undefined != target.attr('data-submit') && 'true' == target.attr('data-submit'))\r\n\t\t\ttarget.closest('form').get(0).submit()\r\n\t\telse\r\n\t\t\twindow.location = target.attr('href');\r\n\r\n\t\tcloseAlertBanner(evt);\r\n\t});\r\n\tnoButton.on('click', closeAlertBanner);\r\n\r\n\t noButton.prependTo(banner);\r\n\tyesButton.prependTo(banner);\r\n\r\n\tbanner.insertAfter(after);\r\n\r\n\tbanner.animate({ top: 0, marginBottom: 0 }, 400);\r\n\r\n\t$(\"html, body\").animate({ scrollTop: 0 }, 100);\r\n};\r\n\r\n/* Displays an alert banner */\r\nvar displaySuccessBanner = function(msg){ displayAlertBanner(msg, 'success'); };\r\nvar displayWarningBanner = function(msg){ displayAlertBanner(msg, 'warning'); };\r\nvar displayFailureBanner = function(msg){ displayAlertBanner(msg, 'failure'); };\r\nvar displayExampleBanner = function(msg){ displayAlertBanner(msg, 'example'); };\r\n\r\nvar displayAlertBanner = function(msg, type)\r\n{\r\n\tconsole.log(msg);\r\n\tvar banner = $('');\r\n\tvar close = $('');\r\n\tvar after = $('article h2');\r\n\tvar article = $('article');\r\n\r\n\tif(!after.length)\r\n\t\tafter = $('article h1');\r\n\r\n\tafter = after.first();\r\n\r\n\tif(undefined == type || ('example' != type && 'success' != type && 'warning' != type && 'failure' != type))\r\n\t\ttype = 'example';\r\n\r\n\tbanner.addClass('banner');\r\n\tbanner.addClass(type);\r\n\tbanner.html(msg);\r\n\r\n\tclose.addClass('close' + type);\r\n\tclose.addClass('icon');\r\n\tclose.text('Close');\r\n\tclose.attr('href', '#');\r\n\tclose.attr('title', 'Close');\r\n\tclose.on('click', closeAlertBanner);\r\n\r\n\tclose.prependTo(banner);\r\n\r\n\tbanner.prependTo(article);\r\n\r\n\t//banner.insertAfter(after);\r\n\r\n\tbanner.animate({ top: 0, marginBottom: 10 }, 400);\r\n\r\n\t$(\"html, body\").animate({ scrollTop: 0 }, 100);\r\n};\r\n\r\n/* Closes an alert or confirmation banner */\r\nvar closeAlertBanner = function(evt)\r\n{\r\n\tevt.preventDefault();\r\n\r\n\tvar target = $(evt.target);\r\n\tvar banner = target.parent();\r\n\r\n\tbanner.animate({ top: -150, marginBottom: -42 }, 400, function(){ banner.remove(); });\r\n}\r\n\r\n/* Template support - DO NOT REMOVE */\r\nwindow.jQuery || document.write('