;(function($, undefined) { var app = { vars: { animationSpeed: { in: 1000, out: 500 } }, dom: {}, utils: { rem: function(val) { var mul = parseInt(app.dom.$html.css('font-size')) / 10; return val * mul; }, msieversion: function() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) return true; else return false; }, t: function(key) { if (window._translations !== undefined && window._translations[key] !== undefined) { return window._translations[key]; } else { return key; } }, getScrollBarWidth: function() { var inner = document.createElement('p'); inner.style.width = "100%"; inner.style.height = "200px"; var outer = document.createElement('div'); outer.style.position = "absolute"; outer.style.top = "0px"; outer.style.left = "0px"; outer.style.visibility = "hidden"; outer.style.width = "200px"; outer.style.height = "150px"; outer.style.overflow = "hidden"; outer.appendChild (inner); document.body.appendChild (outer); var w1 = inner.offsetWidth; outer.style.overflow = 'scroll'; var w2 = inner.offsetWidth; if (w1 == w2) w2 = outer.clientWidth; document.body.removeChild (outer); return (w1 - w2); } }, dropkick: { init: function() { app.dom.$window.on('domready || ajaxload', function() { $('.select').dropkick({ mobile: true }); }) } }, bgSelect: { init: function () { app.dom.$window.on('domready ajaxload resize', function () { app.dom.$body.find('.section--home').each(function () { var background, $section = $(this), windowHeight, bg_desc = $section.data('desktop'), bg_mob = $section.data('mobile'); if (window.matchMedia('(max-width: 519px)').matches && bg_mob) { background = bg_mob; } else { background = bg_desc; } if (background !== undefined) { $(this).css('background-image', 'url(' + background + ')'); } }); }); } }, touchTest: { init: function() { app.dom.$body.on('touchstart', '.tiles-item-inner', function() { if (window.matchMedia('(max-width: 1199px)').matches) { var $this = $(this); app.dom.$body.find('.tiles-item-inner').not(this).removeClass('flipped'); if (!$this.hasClass('flipped')) { $this.addClass('flipped'); } else { $this.removeClass('flipped'); } } }); } }, ieFix: { init: function () { app.dom.$window.on('domready ajaxload', function() { if (!Modernizr["object-fit"]) { $('figure').each(function () { var $container = $(this), imgUrl = $container.find('img').prop('src'); if (imgUrl) { $container .css('backgroundImage', 'url(' + imgUrl + ')') .addClass('compat-object-fit') .children('img').hide(); } }); } }); } }, quotesSliderMobile: { init: function() { app.dom.$window.on('domready ajaxload resize', function () { if (window.matchMedia('(max-width: 1023px)').matches) { var maxHeight = 0; app.dom.$body.find('.slider.quotes').each(function(index, item) { var $this = $(item); maxHeight = 0; $this.find('.slide .container-column-top').each(function(index, item) { var $item = $(item); var currHeight = $item.outerHeight(); if(currHeight > maxHeight) { maxHeight = currHeight; } }); if (window.matchMedia('(min-width: 519px)').matches) { if ($this.hasClass('signature')) { $this.find('.slide .container-column-mobile').css({ 'height': maxHeight - 80, 'max-height': maxHeight - 80 }); } else { $this.find('.slide .container-column-mobile').css({ 'height': maxHeight, 'max-height': maxHeight }); } } $this.find('.slide .container-column-top').css({ 'height': maxHeight, 'max-height': maxHeight }); }); } }) } }, mobileSelect: { init: function() { app.dom.$body.on('change', '#select-steps', function(e) { var optionsVal = $(e.target).val(); var swiper = $('.section--technology-steps').find('[data-slider-steps]').data('swiperInstance'); swiper.slideTo(optionsVal); swiper.update(true); }); } }, customScrollbar: { init: function() { app.dom.$window.on('domready ajaxload', function() { app.dom.$body.find('.slide.mCustomScrollbar').mCustomScrollbar(); }); } }, fieldAnimation: { init: function() { app.dom.$window.on('ajaxload domready resize', function() { var banerEl, midEl, smallEl, homeEl; if (window.matchMedia('(min-width: 1024px)').matches) { banerEl = 14; midEl = 12; smallEl = 6; homeEl = 11; } else if (window.matchMedia('(min-width: 767px)').matches && window.matchMedia('(max-width: 1023px)').matches) { banerEl = 10; midEl = 8; smallEl = 4; homeEl = 7; } else { banerEl = 4; midEl = 2; smallEl = 2; homeEl = 2 } $('.overlay-baner').cooqui({ fps: 60, scale: 1, distance: 300, background: false, elementsX: banerEl, elementsY: banerEl, itemSize: 2, itemScale: 2.0, itemColors: ["#cccccc"], unique: false, }); $('.overlay-home').cooqui({ fps: 60, scale: 1, distance: 300, background: false, elementsX: homeEl, elementsY: homeEl, itemSize: 2, itemScale: 2, itemColors: ["#cccccc"], unique: false, }); $('.overlay-mid').cooqui({ fps: 60, scale: 1, distance: 300, background: false, elementsX: midEl, elementsY: midEl, itemSize: 2, itemScale: 1.0, itemColors: ["#cccccc"], unique: false, }); $('.overlay-small').cooqui({ fps: 60, scale: 1, distance: 300, background: false, elementsX: smallEl, elementsY: smallEl, itemSize: 2, itemScale: 1.0, itemColors: ["#cccccc"], unique: false, }); }); } }, locationsPosition: { init: function() { app.dom.$window.on('ajaxload domready resize', function() { var left, bottom, mobileLeft; $('.locations-city, .main-office-logo').each(function() { var $this = $(this); left = $this.data('left'); bottom = $this.data('bottom'); mobileLeft = $this.data('mobile-left'); if (mobileLeft !== undefined && (window.matchMedia('(max-width: 1023px)').matches && window.matchMedia('(min-width: 767px)').matches)) { $this.css({ 'left': mobileLeft + '%', 'bottom': bottom + '%' }); } else { $this.css({ 'left': left + '%', 'bottom': bottom + '%' }); } }); }); } }, formOverlay: { init: function() { app.dom.$body.on('success', '[data-form]', function() { $(this).parents('.section') .find('[data-form-overlay="' + $(this).data('form') + '"]') .addClass('is-visible'); $(this).parents('.section').find('.overlay-grid').cooqui({ fps: 60, scale: 1, distance: 300, background: false, spacingY: 95, spacingX: 94, itemSize: 2, itemScale: 2.0, itemColors: ["#cccccc"], unique: false, }); setTimeout(function() { $('.contact-form-overlay').removeClass('is-visible'); }, 3500) }); } }, preloader: { init: function() { app.preloader.$preloader = app.dom.$body.find('.preloader'); app.dom.$window.on('load ajaxload domready', function() { app.preloader.off(function() { $('html').addClass('loaded'); }); }); }, off: function(cb) { app.preloader.$preloader.stop().delay(500).transit({ opacity: 0 }, 1000, 'easeOutQuint', function() { app.preloader.$preloader.css('display', 'none'); app.dom.$window.trigger('preloader-hidden'); if ($.isFunction(cb)) { cb.call(this); } }); }, on: function(cb, delay) { app.preloader.$preloader.css('display', 'block'); app.preloader.$preloader.stop().delay(delay).transit({ opacity: 1 }, 1000, 'easeOutQuint', function() { if ($.isFunction(cb)) { cb.call(this); } }); } }, init: function() { app.dom.$window = $(window); app.dom.$document = $(document); app.dom.$html = $('html'); app.dom.$body = $('body'); app.baseUrl = app.dom.$body.attr('data-base-href'); }, run : function() { app.init(); for (var i in app) { if (typeof(app[i]) == 'object' && app[i].init !== undefined) { app[i].init(); } } app.dom.$window.trigger('domready'); } }; $(document).ready(function() { app.run(); }); })(window.jQuery);