PageSourceSearch

https://noel-cerneux.fr/wp-content/themes/thegov/js/theme-addons.js?ver=bed9662efb0aee25231f157017e5b204

js noel-cerneux.fr collected 2026-10-02 21:19:11 UTC 79,272 bytes, 2,325 lines download raw bytes

1"use strict";
2// Accordion 
3function thegov_accordion_init() {
4    var item = jQuery('.wgl-accordion');
5
6    item.each(function(){
7        var header = jQuery(this).find('.wgl-accordion_header');
8        var content = jQuery(this).find('.wgl-accordion_content');
9        var acc_type = jQuery(this).data('type');
10        var speed = 400;
11        header.off("click");
12
13        header.each(function(){
14            if (jQuery(this).data('default') == 'yes') {
15                jQuery(this).addClass('active');
16                jQuery(this).next().slideDown(speed);
17            }
18        })
19
20        header.on('click', function(e){
21            e.preventDefault();
22            var $this = jQuery(this);
23    
24            if (acc_type == 'accordion') {
25                $this.toggleClass('active');
26                $this.next().slideToggle(speed);
27                content.not($this.next()).slideUp(speed);
28                header.not($this).removeClass('active');
29            } else if (acc_type == 'toggle'){
30                $this.toggleClass('active');
31                $this.next().slideToggle(speed);
32            }
33    
34        })
35
36    })
37
38}
39// Services Accordion
40function thegov_services_accordion_init() {
41    var item_module = jQuery('.wgl-accordion-services');
42
43    item_module.each(function(){
44        var item = jQuery(this).find('.wgl-services_item');
45        jQuery(this).find('.wgl-services_item:first-child').addClass('active');
46
47        item.on('mouseover', function(e){
48            jQuery(this).addClass('active').siblings().removeClass('active');
49        })
50    })
51}
52(function ($) {
53    jQuery(document).ready(function () {
54        thegov_ajax_load();
55    });
56
57    function thegov_ajax_load() {
58        var i, section;
59        var sections = document.getElementsByClassName('wgl_cpt_section');
60        for (i = 0; i < sections.length; i++) {
61            section = sections[i];
62            var infinity_item = section.getElementsByClassName('infinity_item');
63            var load_more = section.getElementsByClassName('load_more_item');
64            if (infinity_item.length || load_more.length) {
65                thegov_ajax_init(section);
66            }
67        }
68    }
69
70    var wait_load = false;
71    var offset_items = 0;
72    var js_offset;
73
74    function thegov_ajax_query(grid, section, request_data) {
75        if (wait_load) return;
76        wait_load = true;
77        request_data['offset_items'] = request_data.js_offset
78            ? request_data.js_offset
79            : offset_items;
80        request_data['items_load'] = request_data.items_load;
81        request_data['js_offset'] = request_data.js_offset
82            ? request_data.js_offset
83            : offset_items;
84
85        //For the mode_security enabled, removed sql request
86        if (request_data.query && request_data.query.request) {
87            delete request_data.query.request;
88        }
89
90        $.post(
91            wgl_core.ajaxurl,
92            {
93                action: 'wgl_ajax',
94                data: request_data,
95                nonce: wgl_core.nonce,
96            },
97            function (response, status) {
98                var resp, new_items, load_more_hidden, count_products;
99                resp = document.createElement('div');
100                resp.innerHTML = response;
101                new_items = $('.item', resp);
102                count_products = $('.woocommerce-result-count', resp);
103
104                load_more_hidden = $('.hidden_load_more', resp);
105
106                if (load_more_hidden.length) {
107                    jQuery(section)
108                        .find('.load_more_wrapper')
109                        .fadeOut(300, function () {
110                            $(this).remove();
111                        });
112                } else {
113                    jQuery(section)
114                        .find('.load_more_wrapper .load_more_item')
115                        .removeClass('loading');
116                }
117
118                jQuery(section)
119                    .find('.woocommerce-result-count')
120                    .html(jQuery(count_products).html());
121
122                if ($(grid).hasClass('carousel')) {
123                    $(grid).find('.slick-track').append(new_items);
124                    $(grid).find('.slick-dots').remove();
125                    $(grid).find('.wgl-carousel_slick').slick('reinit');
126                } else if ($(grid).hasClass('grid')) {
127                    new_items = new_items.hide();
128                    $(grid).append(new_items);
129                    new_items.fadeIn('slow');
130                } else {
131                    var items = jQuery(new_items);
132                    jQuery(grid).append(items).isotope('appended', items);
133                    jQuery(grid)
134                        .imagesLoaded()
135                        .always(function () {
136                            jQuery(grid).isotope('layout');
137                            updateFilter();
138                        });
139                }
140
141                //Call vc waypoint settings
142                if (typeof jQuery.fn.waypoint === 'function') {
143                    jQuery(grid)
144                        .find(
145                            '.wpb_animate_when_almost_visible:not(.wpb_start_animation)'
146                        )
147                        .waypoint(
148                            function () {
149                                jQuery(this).addClass(
150                                    'wpb_start_animation animated'
151                                );
152                            },
153                            { offset: '100%' }
154                        );
155                }
156
157                //Call video background settings
158                if (typeof jarallax === 'function') {
159                    thegov_parallax_video();
160                } else {
161                    jQuery.getScript(wgl_core.JarallaxPluginVideo, function () {
162                        jQuery
163                            .getScript(wgl_core.JarallaxPlugin, function () {})
164                            .always(function (s, Status) {
165                                jQuery(grid)
166                                    .find('.parallax-video')
167                                    .each(function () {
168                                        jQuery(this).jarallax({
169                                            loop: true,
170                                            speed: 1,
171                                            videoSrc:
172                                                jQuery(this).data('video'),
173                                            videoStartTime:
174                                                jQuery(this).data('start'),
175                                            videoEndTime:
176                                                jQuery(this).data('end'),
177                                        });
178                                    });
179                            });
180                    });
181                }
182
183                //Call slick settings
184                if (jQuery(grid).find('.wgl-carousel_slick').size() > 0) {
185                    jQuery
186                        .getScript(wgl_core.slickSlider)
187                        .always(function (s, Status) {
188                            jQuery(grid)
189                                .find('.wgl-carousel_slick')
190                                .each(function () {
191                                    destroyCarousel(jQuery(this));
192                                    slickCarousel(jQuery(this));
193                                    if (jQuery(grid).hasClass('blog_masonry')) {
194                                        jQuery(grid).isotope('layout');
195                                    }
196                                });
197                        });
198                }
199
200                thegov_scroll_animation();
201                //Update Items
202                var offset_data = $('.js_offset_items', resp);
203                request_data.js_offset = parseInt(offset_data.data('offset'));
204
205                wait_load = false;
206            }
207        );
208    }
209
210    function thegov_ajax_init(section) {
211        offset_items = 0;
212        var infinity_item;
213        var grid, form, data_field, data, request_data, load_more;
214
215        //if Section CPT return
216        if (section == undefined) return;
217
218        //Get grid CPT
219        grid = section.getElementsByClassName('container-grid');
220        if (!grid.length) return;
221        grid = grid[0];
222
223        //Get form CPT
224        form = section.getElementsByClassName('posts_grid_ajax');
225        if (!form.length) return;
226        form = form[0];
227
228        //Get field form ajax
229        data_field = form.getElementsByClassName('ajax_data');
230        if (!data_field.length) return;
231        data_field = data_field[0];
232
233        data = data_field.value;
234        data = JSON.parse(data);
235        request_data = data;
236
237        infinity_item = section.getElementsByClassName('infinity_item');
238
239        if (infinity_item.length) {
240            infinity_item = infinity_item[0];
241            if (jQuery(infinity_item).is_visible()) {
242                //Add pagination
243                offset_items = request_data.post_count;
244                thegov_ajax_query(grid, section, request_data);
245            }
246            var lastScrollTop = 0;
247
248            jQuery(window).on('resize scroll', function () {
249                if (jQuery(infinity_item).is_visible()) {
250                    var st = jQuery(this).scrollTop();
251                    if (st > lastScrollTop) {
252                        //Add pagination
253                        offset_items = request_data.post_count;
254                        thegov_ajax_query(grid, section, request_data);
255                    }
256                    lastScrollTop = st;
257                }
258            });
259        }
260
261        load_more = section.getElementsByClassName('load_more_item');
262        if (load_more.length) {
263            load_more = load_more[0];
264            load_more.addEventListener(
265                'click',
266                function (e) {
267                    //Add pagination
268                    offset_items = request_data.post_count;
269                    e.preventDefault();
270                    jQuery(this).addClass('loading');
271                    thegov_ajax_query(grid, section, request_data);
272                },
273                false
274            );
275        }
276    }
277
278    function slickCarousel(grid) {
279        jQuery(grid).slick({
280            draggable: true,
281            fade: true,
282            speed: 900,
283            cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)',
284            touchThreshold: 100,
285        });
286    }
287    function destroyCarousel(grid) {
288        if (jQuery(grid).hasClass('slick-initialized')) {
289            jQuery(grid).slick('destroy');
290        }
291    }
292
293    function updateFilter() {
294        jQuery('.isotope-filter a').each(function () {
295            var data_filter = this.getAttribute('data-filter');
296            var num = jQuery(this)
297                .closest('.wgl_portfolio_list')
298                .find('.wgl_portfolio_list-item')
299                .filter(data_filter).length;
300            jQuery(this).find('.number_filter').text(num);
301
302            if (jQuery(this).parent().hasClass('shop__filter')) {
303                var num_product = jQuery(this)
304                    .closest('.wgl-products-catalog')
305                    .find('.product')
306                    .filter(data_filter).length;
307                jQuery(this).find('.number_filter').text(num_product);
308            }
309        });
310    }
311})(jQuery);
312
313function thegov_scroll_animation(){
314  var portfolio = jQuery('.wgl-portfolio_container');
315  var shop = jQuery('.wgl-products.appear-animation');
316
317  //Scroll Animation
318  (function($) {
319
320      var docElem = window.document.documentElement;
321
322      function getViewportH() {
323        var client = docElem['clientHeight'],
324          inner = window['innerHeight'];
325        
326        if( client < inner )
327          return inner;
328        else
329          return client;
330      }
331
332      function scrollY() {
333        return window.pageYOffset || docElem.scrollTop;
334      }
335
336      // http://stackoverflow.com/a/5598797/989439
337      function getOffset( el ) {
338        var offsetTop = 0, offsetLeft = 0;
339        do {
340          if ( !isNaN( el.offsetTop ) ) {
341            offsetTop += el.offsetTop;
342          }
343          if ( !isNaN( el.offsetLeft ) ) {
344            offsetLeft += el.offsetLeft;
345          }
346        } while( el = el.offsetParent )
347
348        return {
349          top : offsetTop,
350          left : offsetLeft
351        }
352      }
353
354      function inViewport( el, h ) {
355        var elH = el.offsetHeight,
356          scrolled = scrollY(),
357          viewed = scrolled + getViewportH(),
358          elTop = getOffset(el).top,
359          elBottom = elTop + elH,
360          h = h || 0;
361
362        return (elTop + elH * h) <= viewed && (elBottom - elH * h) >= scrolled;
363      }
364
365      function extend( a, b ) {
366        for( var key in b ) { 
367          if( b.hasOwnProperty( key ) ) {
368            a[key] = b[key];
369          }
370        }
371        return a;
372      }
373
374      function AnimOnScroll( el, options ) {  
375        this.el = el;
376        this.options = extend( this.defaults, options );
377        if(this.el.length){
378          this._init();
379        }      
380      }
381
382      AnimOnScroll.prototype = {
383        defaults : {
384          viewportFactor : 0
385        },
386        _init : function() {
387          this.items = Array.prototype.slice.call( jQuery(this.el ).children() );
388          this.itemsCount = this.items.length;
389          this.itemsRenderedCount = 0;
390          this.didScroll = false;
391          this.delay = 100;
392          
393
394          var self = this;
395
396          if(typeof imagesLoaded === 'function'){
397            imagesLoaded( this.el, this._imgLoaded(self));
398          }else{
399            this._imgLoaded(self);
400          } 
401          
402        },
403        _imgLoaded : function(self) {
404          
405          var interval;
406
407              // the items already shown...
408              self.items.forEach( function( el, i ) {
409                if( inViewport( el ) ) {
410
411                  self._checkTotalRendered();
412                  if(!jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport( el, self.options.viewportFactor )){
413                    self._item_class(jQuery(el), self.delay, interval );
414                    self.delay += 200;
415                    setTimeout( function() {
416                      self.delay = 100;
417                    }, 200 );                    
418                  }
419                }
420              } );
421
422              // animate on scroll the items inside the viewport
423              window.addEventListener( 'scroll', function() {
424                self._onScrollFn();
425              }, false );
426              window.addEventListener( 'resize', function() {
427                self._resizeHandler();
428              }, false );          
429        },
430
431        _onScrollFn : function() {
432          var self = this;
433          if( !this.didScroll ) {
434            this.didScroll = true;
435            setTimeout( function() { self._scrollPage(); }, 60 );
436          }
437        },
438        _item_class : function(item_array, delay, interval) {
439
440          interval = setTimeout(function(){
441            if ( item_array.length) {
442              jQuery(item_array).addClass( 'animate' );
443            } else {
444              clearTimeout( interval );
445            }
446          }, delay);   
447           
448        },
449
450        _scrollPage : function() {
451          var self = this;
452          var interval;
453
454          this.items.forEach( function( el, i ) {
455            if( !jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport( el, self.options.viewportFactor ) ) {
456              setTimeout( function() {
457                var perspY = scrollY() + getViewportH() / 2;
458
459                self._checkTotalRendered();
460                self._item_class(jQuery(el), self.delay, interval);
461                self.delay += 200;
462                setTimeout( function() {
463                  self.delay = 100;
464                }, 200 );
465
466              }, 25 );
467            }
468          });
469          this.didScroll = false;
470        },
471        _resizeHandler : function() {
472          var self = this;
473          function delayed() {
474            self._scrollPage();
475            self.resizeTimeout = null;
476          }
477          if ( this.resizeTimeout ) {
478            clearTimeout( this.resizeTimeout );
479          }
480          this.resizeTimeout = setTimeout( delayed, 1000 );
481        },
482        _checkTotalRendered : function() {
483          ++this.itemsRenderedCount;
484          if( this.itemsRenderedCount === this.itemsCount ) {
485            window.removeEventListener( 'scroll', this._onScrollFn );
486          }
487        }
488      }
489
490      // add to global namespace
491      window.AnimOnScroll = AnimOnScroll;
492
493  })(jQuery);
494
495  new AnimOnScroll( portfolio, {} );
496  new AnimOnScroll( shop, {} );
497    
498} 
499// Scroll Up button
500function thegov_scroll_up() {
501	(function($) {
502		$.fn.goBack = function (options) {
503			var defaults = {
504				scrollTop: jQuery(window).height(),
505				scrollSpeed: 600,
506				fadeInSpeed: 1000,
507				fadeOutSpeed: 500
508			};
509			var options = $.extend(defaults, options);
510			var $this = $(this);
511			$(window).on('scroll', function () {
512				if ($(window).scrollTop() > options.scrollTop) {
513					$this.addClass('active');
514				} else {
515					$this.removeClass('active');
516				}
517			})
518			$this.on('click', function () {
519				$('html,body').animate({
520					'scrollTop': 0
521				}, options.scrollSpeed)
522			})
523		}
524	})(jQuery);
525
526	jQuery('#scroll_up').goBack();
527};
528function thegov_blog_masonry_init () {
529  if (jQuery(".blog_masonry").length) {
530    var blog_dom = jQuery(".blog_masonry").get(0);
531    var $grid = imagesLoaded( blog_dom, function() {
532      // initialize masonry
533      //* Wrapped in a short timeout function because $grid.imagesLoaded doesn't reliably lay out correctly
534      setTimeout(function(){
535        jQuery(".blog_masonry").isotope({
536              layoutMode: 'masonry',
537              masonry: {
538                  columnWidth: '.item',
539              },
540          itemSelector: '.item',
541          percentPosition: true
542        });
543        jQuery(window).trigger('resize');
544      }, 250);
545    });
546  }
547}
548// wgl Carousel List
549function thegov_carousel_slick () {
550  var carousel = jQuery('.wgl-carousel_slick');
551  if (carousel.length !== 0 ) {
552    carousel.each(function(item, value){     
553      if (jQuery(this).hasClass('slick-initialized')) {
554        jQuery(this).slick('destroy');
555      }    
556      if(jQuery(this).hasClass('fade_slick')){
557        jQuery(this).slick({
558          draggable: true,
559          fade: true, 
560          speed: 900,
561          cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)',
562          touchThreshold: 100
563        });
564      }else{
565        jQuery(this).slick({});
566      }
567
568    });  
569
570  jQuery('.carousel-filter a').on('click', function(e){
571    e.preventDefault();
572
573    var filterClass = jQuery(this).data('filter');
574    jQuery(this).parent().find('a').removeClass('active');
575    jQuery(this).addClass('active');
576
577    jQuery(this).closest('.wgl_cpt_section').find ('.wgl-carousel_slick').slick('slickUnfilter');
578    jQuery(this).closest('.wgl_cpt_section').find ('.wgl-carousel_slick').slick('slickFilter', jQuery(filterClass));
579  }); 
580
581  }  
582}
583
584function thegov_circuit_services() {
585  if (jQuery('.thegov_module_circuit_services').length) {
586    jQuery('.thegov_module_circuit_services').each(function(){
587      var $circle = jQuery(this).find('.services_item-icon');
588
589      var agle = 360 / $circle.length;
590      var agleCounter = -1;
591
592      $circle.each(function() {
593        var $this = jQuery(this);
594
595        jQuery(this).parents('.services_item-wrap:first-child').addClass('active');
596        $this.on('mouseover', function(){
597          jQuery(this).parents('.services_item-wrap').addClass('active').siblings().removeClass('active');
598        })
599
600        var percentWidth = (100 * parseFloat($this.css('width')) / parseFloat($this.parent().css('width')));
601        var curAgle = agleCounter * agle;
602        var radAgle = curAgle * Math.PI / 180;
603        var x = (50 + ((50 - (percentWidth / 2)) * Math.cos(radAgle))) - (percentWidth / 2);
604        var y = (50 + ((50 - (percentWidth / 2)) * Math.sin(radAgle))) - (percentWidth / 2);
605            
606        $this.css({
607          left: x + '%',
608          top: y + '%'
609        });
610        
611        agleCounter++;
612      });
613
614    });
615  }
616}
617function thegov_circuit_services_resize (){
618  if (jQuery('.thegov_module_circuit_services').length) {
619    setTimeout(function(){
620      jQuery('.thegov_module_circuit_services').each(function(){
621        var $this = jQuery(this);
622        var wwidth = $this.width();
623        if (wwidth < 370){
624          $this.removeClass('tablet_resp').addClass('mobile_resp');
625        } else if (wwidth < 460) {
626          $this.removeClass('mobile_resp').addClass('tablet_resp');
627        } else {
628          $this.removeClass('tablet_resp mobile_resp');
629        }
630      });
631    }, 1);
632  }
633}
634/*!
635 * JavaScript Cookie v2.2.0
636 * https://github.com/js-cookie/js-cookie
637 *
638 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
639 * Released under the MIT license
640 */
641;(function (factory) {
642    var registeredInModuleLoader;
643    if (typeof define === 'function' && define.amd) {
644        define(factory);
645        registeredInModuleLoader = true;
646    }
647    if (typeof exports === 'object') {
648        module.exports = factory();
649        registeredInModuleLoader = true;
650    }
651    if (!registeredInModuleLoader) {
652        var OldCookies = window.Cookies;
653        var api = window.Cookies = factory();
654        api.noConflict = function () {
655            window.Cookies = OldCookies;
656            return api;
657        };
658    }
659}(function () {
660    function extend () {
661        var i = 0;
662        var result = {};
663        for (; i < arguments.length; i++) {
664            var attributes = arguments[ i ];
665            for (var key in attributes) {
666                result[key] = attributes[key];
667            }
668        }
669        return result;
670    }
671
672    function decode (s) {
673        return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
674    }
675
676    function init (converter) {
677        function api() {}
678
679        function set (key, value, attributes) {
680            if (typeof document === 'undefined') {
681                return;
682            }
683
684            attributes = extend({
685                path: '/'
686            }, api.defaults, attributes);
687
688            if (typeof attributes.expires === 'number') {
689                attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
690            }
691
692            // We're using "expires" because "max-age" is not supported by IE
693            attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
694
695            try {
696                var result = JSON.stringify(value);
697                if (/^[\{\[]/.test(result)) {
698                    value = result;
699                }
700            } catch (e) {}
701
702            value = converter.write ?
703                converter.write(value, key) :
704                encodeURIComponent(String(value))
705                    .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
706
707            key = encodeURIComponent(String(key))
708                .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
709                .replace(/[\(\)]/g, escape);
710
711            var stringifiedAttributes = '';
712            for (var attributeName in attributes) {
713                if (!attributes[attributeName]) {
714                    continue;
715                }
716                stringifiedAttributes += '; ' + attributeName;
717                if (attributes[attributeName] === true) {
718                    continue;
719                }
720
721                // Considers RFC 6265 section 5.2:
722                // ...
723                // 3.  If the remaining unparsed-attributes contains a %x3B (";")
724                //     character:
725                // Consume the characters of the unparsed-attributes up to,
726                // not including, the first %x3B (";") character.
727                // ...
728                stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
729            }
730
731            return (document.cookie = key + '=' + value + stringifiedAttributes);
732        }
733
734        function get (key, json) {
735            if (typeof document === 'undefined') {
736                return;
737            }
738
739            var jar = {};
740            // To prevent the for loop in the first place assign an empty array
741            // in case there are no cookies at all.
742            var cookies = document.cookie ? document.cookie.split('; ') : [];
743            var i = 0;
744
745            for (; i < cookies.length; i++) {
746                var parts = cookies[i].split('=');
747                var cookie = parts.slice(1).join('=');
748
749                if (!json && cookie.charAt(0) === '"') {
750                    cookie = cookie.slice(1, -1);
751                }
752
753                try {
754                    var name = decode(parts[0]);
755                    cookie = (converter.read || converter)(cookie, name) ||
756                        decode(cookie);
757
758                    if (json) {
759                        try {
760                            cookie = JSON.parse(cookie);
761                        } catch (e) {}
762                    }
763
764                    jar[name] = cookie;
765
766                    if (key === name) {
767                        break;
768                    }
769                } catch (e) {}
770            }
771
772            return key ? jar[key] : jar;
773        }
774
775        api.set = set;
776        api.get = function (key) {
777            return get(key, false /* read as raw */);
778        };
779        api.getJSON = function (key) {
780            return get(key, true /* read as json */);
781        };
782        api.remove = function (key, attributes) {
783            set(key, '', extend(attributes, {
784                expires: -1
785            }));
786        };
787
788        api.defaults = {};
789
790        api.withConverter = init;
791
792        return api;
793    }
794
795    return init(function () {});
796}));
797// wgl Countdown function init
798function thegov_countdown_init () {
799    var countdown = jQuery('.wgl-countdown');
800    if (countdown.length !== 0 ) {
801        countdown.each(function () {
802            var data_atts = jQuery(this).data('atts');
803            var time = new Date(+data_atts.year, +data_atts.month-1, +data_atts.day, +data_atts.hours, +data_atts.minutes);
804            jQuery(this).countdown({
805                until: time,
806                padZeroes: true,
807                format: data_atts.format ? data_atts.format : 'yowdHMS',
808                labels: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2],data_atts.labels[3],data_atts.labels[4],data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]],
809                labels1: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2], data_atts.labels[3], data_atts.labels[4], data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]]
810            });
811        });
812    }
813}
814// wgl Counter
815function thegov_counter_init() {
816	var counters = jQuery('.wgl-counter');
817	if ( counters.length ) {
818		counters.each(function() {
819			var counter = jQuery(this).find('.wgl-counter_value-wrap .wgl-counter_value.value-placeholder');
820			counter.appear(function() {
821				var max = jQuery(this).data('end-value'),
822				from = jQuery(this).data('start-value'),
823				speed = jQuery(this).data('speed');
824				counter.countTo({
825					from: from,
826					to: max,
827					speed: speed,
828					refreshInterval: 10
829				});
830			});
831		});
832	}
833}
834
835
836function thegov_dynamic_styles(){
837    var style = jQuery('#thegov-footer-inline-css');
838
839    (function($) {
840
841        $.fn.wglAddDynamicStyles = function() {        
842
843            if (this.length === 0) { return this; }
844            
845            return this.each(function () {
846                var $style = '',
847                self = jQuery(this);
848
849                var init = function() {
850                    $style += self.text();
851                    self.remove();
852                    appendStyle(); 
853                },
854                appendStyle = function(){    
855                    jQuery('head').append('<style type="text/css">'+$style+'</style>');
856                };
857                
858                /*Init*/
859                init();
860            });
861
862        };
863    })(jQuery);
864
865    style.wglAddDynamicStyles();
866    
867} 
868function thegov_events_masonry_init () {
869  if (jQuery(".events_masonry").length) {
870    var events_dom = jQuery(".events_masonry").get(0);
871    var $grid = imagesLoaded( events_dom, function() {
872      // initialize masonry
873      jQuery(".events_masonry").isotope({
874            layoutMode: 'masonry',
875            masonry: {
876                columnWidth: '.item',
877            },
878        itemSelector: '.item',
879        percentPosition: true
880      });
881      jQuery(window).trigger('resize');
882    
883    });
884  }
885}
886//https://gist.github.com/chriswrightdesign/7955464
887function mobilecheck() {
888    var check = false;
889    (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
890    return check;
891}
892
893//Add Click event for the mobile device
894var click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click';
895
896function initClickEvent(){
897    click =  mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click';
898}
899jQuery(window).on('resize', initClickEvent);
900
901/*
902 ** Plugin for counter shortcode
903 */
904(function($) {
905    "use strict";
906
907    $.fn.countTo = function(options) {
908        // merge the default plugin settings with the custom options
909        options = $.extend({}, $.fn.countTo.defaults, options || {});
910
911        // how many times to update the value, and how much to increment the value on each update
912        var loops = Math.ceil(options.speed / options.refreshInterval),
913            increment = (options.to - options.from) / loops;
914
915        return $(this).each(function() {
916            var _this = this,
917                loopCount = 0,
918                value = options.from,
919                interval = setInterval(updateTimer, options.refreshInterval);
920
921            function updateTimer() {
922                value += increment;
923                loopCount++;
924                $(_this).html(value.toFixed(options.decimals));
925
926                if (typeof(options.onUpdate) === 'function') {
927                    options.onUpdate.call(_this, value);
928                }
929
930                if (loopCount >= loops) {
931                    clearInterval(interval);
932                    value = options.to;
933
934                    if (typeof(options.onComplete) === 'function') {
935                        options.onComplete.call(_this, value);
936                    }
937                }
938            }
939        });
940    };
941
942    $.fn.countTo.defaults = {
943        from: 0,  // the number the element should start at
944        to: 100,  // the number the element should end at
945        speed: 1000,  // how long it should take to count between the target numbers
946        refreshInterval: 100,  // how often the element should be updated
947        decimals: 0,  // the number of decimal places to show
948        onUpdate: null,  // callback method for every time the element is updated,
949        onComplete: null  // callback method for when the element finishes updating
950    };
951})(jQuery);
952
953/*
954 ** Plugin for slick Slider
955 */
956function thegov_slick_navigation_init (){
957  jQuery.fn.thegov_slick_navigation = function (){
958    jQuery(this).each( function (){
959      var el = jQuery(this);
960      jQuery(this).find('span.left_slick_arrow').on("click", function() {
961        jQuery(this).closest('.wgl_cpt_section').find('.slick-prev').trigger('click');
962      });
963      jQuery(this).find('span.right_slick_arrow').on("click", function() {
964        jQuery(this).closest('.wgl_cpt_section').find('.slick-next').trigger('click');
965      });
966    });
967  }
968}
969
970/*
971 ** Plugin IF visible element
972 */
973function is_visible_init (){
974  jQuery.fn.is_visible = function (){
975    var elementTop = jQuery(this).offset().top;
976    var elementBottom = elementTop + jQuery(this).outerHeight();
977    var viewportTop = jQuery(window).scrollTop();
978    var viewportBottom = viewportTop + jQuery(window).height();
979    return elementBottom > viewportTop && elementTop < viewportBottom;
980  }
981}
982
983/*
984 ** Preloader
985 */
986jQuery(window).load(function(){
987    jQuery('#preloader-wrapper').fadeOut();
988});
989// wgl image comparison
990function thegov_image_comparison () {
991	var item = jQuery('.wgl-image_comparison.cocoen');
992	if (item.length !== 0 ) {
993		item.each(function(){
994			jQuery(this).cocoen();
995		});      
996	}  
997}
998
999// wgl Image Layers
1000function thegov_img_layers() {
1001	jQuery('.wgl-image-layers').each(function() {
1002		var container = jQuery(this);
1003		var initImageLayers = function(){
1004			container.appear(function() {
1005				container.addClass('img-layer_animate');
1006            },{done:true})
1007		}
1008		initImageLayers();
1009		// jQuery(window).on('resize', initImageLayers);
1010		// jQuery(window).on('load', initImageLayers);
1011	});
1012}
1013function thegov_isotope () {
1014  if (jQuery(".isotope").length) {
1015
1016    var portfolio_dom = jQuery(".isotope").get(0);
1017
1018    var $grid = imagesLoaded( portfolio_dom, function() {
1019      // initialize masonry
1020      var mode = jQuery(".isotope").hasClass('fit_rows') ? 'fitRows' : 'masonry';
1021      //* Wrapped in a short timeout function because $grid.imagesLoaded doesn't reliably lay out correctly
1022      setTimeout(function(){
1023        jQuery(".isotope").isotope({
1024              layoutMode: mode,
1025              percentPosition: true,
1026              itemSelector: '.wgl-portfolio-list_item, .item',
1027              masonry: {
1028                  columnWidth: '.wgl-portfolio-list_item-size, .wgl-portfolio-list_item, .item',
1029              }
1030        }).isotope( 'layout' );
1031
1032        jQuery(window).trigger('resize');
1033      }, 250);
1034    });
1035
1036    jQuery(".isotope-filter a").each(function(){
1037      var data_filter = this.getAttribute("data-filter");
1038      var num = jQuery(this).closest('.wgl-portfolio').find('.wgl-portfolio-list_item').filter( data_filter ).length;
1039      jQuery(this).find('.number_filter').text( num );
1040
1041    });
1042
1043
1044    var $filter = jQuery(".isotope-filter a");
1045    $filter.on("click", function (e){
1046      e.preventDefault();
1047      jQuery(this).addClass("active").siblings().removeClass("active");
1048
1049      var filterValue = jQuery(this).attr('data-filter');
1050
1051      jQuery(this).closest('.wgl_cpt_section').find('.isotope').isotope({ filter: filterValue });
1052
1053    });
1054  }
1055}
1056
1057function thegov_menu_lavalamp(){
1058  var lavalamp = jQuery('.menu_line_enable > ul');
1059  if (lavalamp.length !== 0) {
1060    lavalamp.each(function(){
1061        var $this = jQuery(this);
1062        $this.lavalamp({
1063          easing: 'easeInOutCubic',
1064          duration: 600,
1065        });
1066    });
1067  }
1068}
1069
1070(function($, window) {
1071    var Lavalamp = function(element, options) {
1072        this.element = $(element).data('lavalamp', this);
1073        this.options = $.extend({}, this.options, options);
1074
1075        this.init();
1076    };
1077
1078    Lavalamp.prototype = {
1079        options: {
1080            current:   '.current-menu-ancestor,.current-menu-item,.current-category-ancestor,.current-page-ancestor,.current_page_parent',
1081            items:     'li',
1082            bubble:    '<div class="lavalamp-object"></div>',
1083            animation: false,
1084            blur:      $.noop,
1085            focus:     $.noop,
1086            duration:  600,
1087        },
1088        easing:      'ease',    // Easing transition
1089        duration:    700,       // Duration of animation
1090        element: null,
1091        current: null,
1092        bubble:  null,
1093        _focus:  null,
1094        init: function() {
1095            var resizeTimer,
1096                self = this,
1097                child = self.element.children('li');
1098
1099            this.onWindowResize = function() {
1100                if (resizeTimer) {
1101                    clearTimeout(resizeTimer);
1102                }
1103
1104                resizeTimer = setTimeout(function() {
1105                    self.reload();
1106                }, 100);
1107            };
1108
1109            $(window).bind('resize.lavalamp', this.onWindowResize);
1110
1111            $(child).addClass('lavalamp-item');
1112
1113            this.element
1114                .on('mouseenter.lavalamp', '.lavalamp-item' , function() {
1115                    self.current.each(function() {
1116                      self.options.blur.call(this, self);
1117                    });
1118
1119                    self._move($(this));              
1120                })
1121                .on('mouseleave.lavalamp', function() {
1122                    if (self.current.index(self._focus) < 0) {
1123                        self._focus = null;
1124
1125                        self.current.each(function() {
1126                            self.options.focus.call(this, self);
1127                        });
1128
1129                        self._move(self.current);
1130                    }
1131                });
1132
1133            this.bubble = $.isFunction(this.options.bubble)
1134                              ? this.options.bubble.call(this, this.element)
1135                              : $(this.options.bubble).prependTo(this.element);
1136
1137            self.element.addClass('lavalamp');
1138            self.element.find('.lavalamp-object').addClass(self.options.easing);
1139
1140            this.reload(); 
1141
1142            self.element.addClass("lavalamp_animate")
1143        },
1144        reload: function() {
1145            this.current = this.element.children(this.options.current);
1146
1147            if (this.current.size() === 0) {
1148                this.current = this.element.children().not('.lavalamp-object').eq(0);
1149            }
1150
1151            this._move(this.current, false);
1152        },
1153        destroy: function() {
1154            if (this.bubble) {
1155                this.bubble.remove();
1156            }
1157
1158            this.element.unbind('.lavalamp');
1159            $(window).unbind('resize.lavalamp', this.onWindowResize);
1160        },
1161        _move: function(el, animate) {
1162            var pos = el.position();
1163            pos.left = pos.left + parseInt(el.children('a').css('paddingLeft'))
1164
1165            var properties = {
1166                    transform: 'translate('+pos.left+'px,'+pos.top+'px)',
1167                    width:  '25px',
1168                };
1169
1170            this._focus = el;
1171            
1172            // Check for CSS3 animations
1173            if(this.bubble.css('opacity') === "0"){
1174              this.bubble.css({
1175                WebkitTransitionProperty: "opacity",
1176                msTransitionProperty: "opacity",
1177                MozTransitionProperty: "opacity",
1178                OTransitionProperty: "opacity",
1179                transitionProperty: "opacity",  
1180                WebkitTransitionDuration: '0s',
1181                msTransitionDuration: '0s',
1182                MozTransitionDuration: '0s',
1183                OTransitionDuration: '0s',
1184                transitionDuration: '0s',
1185
1186              });
1187            }else{
1188              this.bubble.css({
1189                WebkitTransitionProperty: "all",
1190                msTransitionProperty: "all",
1191                MozTransitionProperty: "all",
1192                OTransitionProperty: "all",
1193                transitionProperty: "all", 
1194                WebkitTransitionDuration: this.options.duration / 1000 + 's',
1195                msTransitionDuration: this.options.duration / 1000 + 's',
1196                MozTransitionDuration: this.options.duration / 1000 + 's',
1197                OTransitionDuration: this.options.duration / 1000 + 's',
1198                transitionDuration: this.options.duration / 1000 + 's',                
1199              })
1200            }
1201            
1202            this.bubble.css(properties);
1203        }
1204    };
1205
1206    $.fn.lavalamp = function(options) {
1207        if (typeof options === 'string') {
1208            var instance = $(this).data('lavalamp');
1209            return instance[options].apply(instance, Array.prototype.slice.call(arguments, 1));
1210        } else {
1211            return this.each(function() {
1212                var instance = $(this).data('lavalamp');
1213
1214                if (instance) {
1215                    $.extend(instance.options, options || {});
1216                    instance.reload();
1217                } else {
1218                    new Lavalamp(this, options);
1219                }
1220            });
1221        }
1222    };
1223})(jQuery, window);
1224
1225
1226(function( $ ) {
1227
1228  $(document).on('click', '.sl-button', function() {
1229    var button = $(this);
1230    var post_id = button.attr('data-post-id');
1231    var security = button.attr('data-nonce');
1232    var iscomment = button.attr('data-iscomment');
1233    var allbuttons;
1234    if ( iscomment === '1' ) { /* Comments can have same id */
1235      allbuttons = $('.sl-comment-button-'+post_id);
1236    } else {
1237      allbuttons = $('.sl-button-'+post_id);
1238    }
1239    var loader = allbuttons.next('#sl-loader');
1240    if (post_id !== '') {
1241      $.ajax({
1242        type: 'POST',
1243        url: wgl_core.ajaxurl,
1244        data : {
1245          action : 'thegov_like',
1246          post_id : post_id,
1247          nonce : security,
1248          is_comment : iscomment,
1249        },
1250        beforeSend:function(){
1251          loader.html('&nbsp;<div class="loader">Loading...</div>');
1252        },  
1253        success: function(response){
1254          var icon = response.icon;
1255          var count = response.count;
1256          allbuttons.html(icon+count);
1257          if(response.status === 'unliked') {
1258            var like_text = wgl_core.like;
1259            allbuttons.prop('title', like_text);
1260            allbuttons.removeClass('liked');
1261          } else {
1262            var unlike_text = wgl_core.unlike;
1263            allbuttons.prop('title', unlike_text);
1264            allbuttons.addClass('liked');
1265          }
1266          loader.empty();         
1267        }
1268      });
1269
1270    }
1271    return false;
1272  });
1273
1274})( jQuery );
1275function thegov_link_scroll () {
1276    jQuery('a.smooth-scroll, .smooth-scroll').on('click', function(event){
1277    	var href;
1278    	if(this.tagName == 'A') {
1279    		href = jQuery.attr(this, 'href');
1280    	} else {
1281    		var that = jQuery(this).find('a');
1282    		href = jQuery(that).attr('href');
1283    	}
1284        jQuery('html, body').animate({
1285            scrollTop: jQuery( href ).offset().top
1286        }, 500);
1287        event.preventDefault();
1288    });
1289}
1290//WGL MEGA MENUS GET AJAX POSTS
1291( function ($){
1292
1293  jQuery(document).ready(function (){ 
1294    
1295    thegov_ajax_mega_menu_init();
1296  
1297  });
1298  
1299  var megaMenuAjax = false;
1300  var node_str = '<div class="mega_menu_wrapper_overlay">'; 
1301  node_str  += '<div class="preloader_type preloader_dot">';
1302  node_str  += '<div class="mega_menu_wrapper_preloader wgl_preloader dot">';
1303  node_str  += '<span></span>';
1304  node_str  += '<span></span>'; 
1305  node_str  += '<span></span>'; 
1306  node_str  += '</div>';
1307  node_str  += '</div>';
1308  node_str  += '</div>';
1309
1310  function thegov_ajax_mega_menu_init ( ){
1311
1312    var grid, mega_menu_item, mega_menu_item_parent;
1313 
1314    mega_menu_item = document.querySelectorAll('li.mega-menu ul.mega-menu.sub-menu.mega-cat-sub-categories li');
1315    mega_menu_item_parent = document.querySelectorAll('li.mega-menu.mega-cat');
1316
1317    if ( mega_menu_item.length ){
1318
1319      for (var i = 0; i < mega_menu_item.length; i++) {
1320
1321        // Define an anonymous function here, to make it possible to use the i variable.
1322        (function (i) {
1323          var grid = mega_menu_item[i].closest('.mega-menu-container').getElementsByClassName( 'mega-ajax-content' );
1324          thegov_ajax_mega_menu_event(mega_menu_item[i], grid);
1325        }(i));
1326      }
1327    }     
1328
1329    if ( mega_menu_item_parent.length ){
1330
1331      for (var i = 0; i < mega_menu_item_parent.length; i++) {
1332
1333        // Define an anonymous function here, to make it possible to use the i variable.
1334        (function (i) {
1335          var grid = mega_menu_item_parent[i].getElementsByClassName( 'mega-ajax-content' );
1336          thegov_ajax_mega_menu_event(mega_menu_item_parent[i], grid);
1337        }(i));
1338      }
1339    }     
1340  }
1341
1342  function thegov_ajax_mega_menu_event(item, grid){
1343    var request_data = {};
1344
1345
1346    item.addEventListener( 'mouseenter', function ( e ){
1347      var not_uploaded = true;
1348      if(!this.classList.contains("mega-menu")){
1349
1350        if( this.classList.contains("is-active") && this.classList.contains("is-uploaded")){
1351          return;
1352        } 
1353
1354        var item_el = this.closest('ul.mega-menu').querySelectorAll( 'li.menu-item' );    
1355        for (var i = 0; i < item_el.length; i++){
1356          item_el[i].classList.remove('is-active');
1357        }
1358
1359        this.classList.add("is-active");
1360
1361        $( grid ).find('.ajax_menu').removeClass('fadeIn-menu').hide();
1362        
1363        if( ! $(grid).find('.loader-overlay').length ){
1364          $(grid).addClass('is-loading').append( node_str );
1365        }
1366
1367        $( grid ).find("[data-url='" + this.getAttribute('data-id') + "']").show(400, function(){
1368          jQuery(this).addClass('fadeIn-menu');
1369          if($(grid).hasClass('is-loading')){
1370            $(grid).removeClass('is-loading').find('.mega_menu_wrapper_overlay').remove();
1371          }
1372        });           
1373
1374      }else{
1375        var item_el = this.querySelectorAll( 'ul.mega-menu li.menu-item' );     
1376        for (var i = 0; i < item_el.length; i++){
1377          if(item_el[i].classList.contains('is-active')){
1378            $( grid ).find("[data-url='" + item_el[i].getAttribute('data-id') + "']").show().addClass('fadeIn-menu');               
1379            if($( grid ).find("[data-url='" + item_el[i].getAttribute('data-id') + "']").length == 0){
1380              not_uploaded = true;
1381            }else{
1382              not_uploaded = false;
1383            }
1384            
1385          }
1386        }
1387      }
1388
1389      var item_menu = this;
1390
1391      if(!this.classList.contains("is-uploaded") && not_uploaded){
1392
1393            // Create request
1394            request_data.id = parseInt(this.getAttribute('data-id'));
1395            request_data.posts_count = parseInt(this.getAttribute('data-posts-count'));
1396            request_data.action = 'wgl_mega_menu_load_ajax';
1397
1398            e.preventDefault(); 
1399
1400            if( megaMenuAjax && megaMenuAjax.readyState != 4 ){
1401              megaMenuAjax.abort();
1402            }
1403
1404            megaMenuAjax = $.ajax({
1405              url : wgl_core.ajaxurl,
1406              type: 'post',
1407              data: request_data,
1408              nonce: wgl_core.nonce,
1409              beforeSend: function(response){
1410                if( ! $(grid).find('.loader-overlay').length ){
1411                  $(grid).addClass('is-loading').append( node_str );
1412                }
1413              },
1414              success: function( response, status ){
1415                item_menu.classList.add('is-uploaded');
1416
1417                var response_container, new_items, identifier, response_wrapper;
1418                response_container = document.createElement( "div" );
1419                response_wrapper = document.createElement( "div" );
1420                response_wrapper.classList.add("ajax_menu");
1421
1422                response_container.innerHTML = response;            
1423                identifier = $( ".items_id", response_container );
1424
1425                response_wrapper.setAttribute('data-url', $(identifier).data('identifier'));
1426
1427                new_items = $( response_wrapper ).append($('.item', response_container ));
1428
1429                $('.ajax_menu').removeClass('fadeIn-menu').hide();
1430                new_items = new_items.hide();
1431                $( grid ).append( new_items );
1432                new_items.show().addClass('fadeIn-menu');
1433                if(typeof jarallax === 'function'){
1434                  thegov_parallax_video();
1435                }else{
1436                  jQuery.getScript(wgl_core.JarallaxPluginVideo, function()
1437                  {
1438                   jQuery.getScript(wgl_core.JarallaxPlugin, function()
1439                   {
1440                   }).always(function( s, Status ) {
1441                    jQuery(grid).find('.parallax-video').each(function() {
1442                      jQuery( this ).jarallax( {
1443                        loop: true,
1444                        speed: 1,
1445                        videoSrc: jQuery( this ).data( 'video' ),
1446                        videoStartTime: jQuery( this ).data( 'start' ),
1447                        videoEndTime: jQuery( this ).data( 'end' ),
1448                      } );    
1449                    });
1450                  });
1451                 });         
1452                }            
1453              },
1454              error: function( response ){
1455                item_menu.classList.remove('is-uploaded');
1456              },
1457              complete: function( response ){
1458                $(grid).removeClass('is-loading').find('.mega_menu_wrapper_overlay').remove();
1459              },
1460            });
1461          }
1462
1463
1464        }, false );       
1465}
1466
1467}(jQuery));
1468function thegov_message_anim_init(){
1469	jQuery('body').on('click', '.message_close_button', function(e){    
1470       jQuery(this).closest('.thegov_module_message_box.closable').slideUp(350);
1471    })
1472} 
1473
1474function thegov_mobile_header(){
1475	var menu = jQuery('.wgl-mobile-header .mobile_nav_wrapper');
1476
1477	//Create plugin Mobile Menu
1478	(function($) {
1479
1480		$.fn.wglMobileMenu = function(options) {
1481			var defaults = {
1482				"toggleID"   	: ".mobile-hamburger-toggle",
1483				"switcher"      : ".button_switcher",
1484				"back"      	: ".back",
1485				"overlay"       : ".wgl-menu_overlay",
1486				"anchor"		: ".menu-item > a[href*=\\#]"
1487	    	};
1488
1489		    if (this.length === 0) { return this; }
1490
1491		    return this.each(function () {
1492		    	var wglMenu = {}, ds = $(this).find('.primary-nav > ul');
1493			    var sub_menu = jQuery('.mobile_nav_wrapper .primary-nav > ul ul');
1494			    var m_width = jQuery('.mobile_nav_wrapper').data( "mobileWidth" );
1495			    var m_toggle = jQuery('.mobile-hamburger-toggle');
1496			    var body = jQuery('body');
1497
1498			    //Helper Menu
1499				var open = "is-active",
1500			    openSubMenu = "show_sub_menu",
1501			    mobile_on = "mobile_switch_on",
1502			    mobile_switcher = "button_switcher";
1503
1504			    var init = function() {
1505			    	wglMenu.settings = $.extend({}, defaults, options);
1506			    	createButton();
1507			    	showMenu();
1508			    	addPerfectScroll();
1509			    },
1510			    showMenu = function(){
1511			    	if (jQuery(window).width() <= m_width) {
1512			    		if (!$('body').hasClass(mobile_on)) {
1513			    			create_nav_mobile_menu();
1514			    		}
1515					}else{
1516						reset_nav_mobile_menu();
1517					}
1518			    },
1519			    create_nav_mobile_menu = function() {
1520			    	sub_menu.removeClass(openSubMenu);
1521					ds.hide().addClass(mobile_on);
1522					body.removeClass(mobile_on);
1523			    },
1524			    reset_nav_mobile_menu = function() {
1525					sub_menu.removeClass(openSubMenu);
1526					body.removeClass(mobile_on);
1527					ds.show().removeClass(mobile_on);
1528					m_toggle.removeClass(open);
1529					jQuery('.' + mobile_switcher) .removeClass('is-active');
1530			    },
1531			    createButton = function() {
1532		  			ds.find('.menu-item-has-children').each(function() {
1533		  				jQuery(this).find('> a').append('<span class="'+ mobile_switcher +'"></span>');
1534		  			});
1535		        },
1536		        addPerfectScroll = function() {
1537		  			new PerfectScrollbar('#wgl-perfect-container', {
1538                    	wheelSpeed: 6,
1539                    	suppressScrollX: true
1540                	});
1541		        },
1542			    toggleMobileMenu = function(e) {
1543			    	//jQuery(m_toggle).toggleClass(open);
1544			    	ds.toggleClass(openSubMenu);
1545			    	body.toggleClass(mobile_on);
1546			    },
1547			    hideSubMenu = function(e) {
1548			    	if(!jQuery('.button_switcher').is(e.target)){
1549			    		if ( jQuery('body').hasClass(mobile_on) ){
1550					    	jQuery('.mobile_nav_wrapper .menu-item-has-children').find('.sub-menu').stop(true).slide
1550Up(450).removeClass(openSubMenu);
1551					    	jQuery('.mobile_nav_wrapper .menu-item-has-children').find('.button_switcher').removeClass(open);
1552
1553							if (jQuery(e.target).closest('.wgl-mobile-header').length && body.hasClass(mobile_on)) {
1554								toggleMobileMenu();
1555							}
1556			    		}
1557			    	}
1558			    },
1559			    showSubMenu = function(e) {
1560			    	e.preventDefault();
1561			    	var item = jQuery(this).parents('li');
1562
1563			    	if(!jQuery(this).hasClass(open)){
1564			    		jQuery('.mobile_nav_wrapper .menu-item-has-children').not(item).find('.sub-menu').stop(true).slideUp(450).removeClass(openSubMenu);
1565			    		jQuery('.mobile_nav_wrapper .menu-item-has-children').not(item).find('.button_switcher').removeClass(open);
1566			    		jQuery('.mobile_nav_wrapper .menu-item-has-children').not(item).find('a[href*=\\#]').removeClass(open);
1567
1568			    		jQuery(this).parent().prev('.sub-menu').stop(true).slideDown(450).addClass(openSubMenu);
1569			    		jQuery(this).parent().next('.sub-menu').stop(true).slideDown(450).addClass(openSubMenu);
1570			    	}else{
1571			    		jQuery(this).parent().prev('.sub-menu').stop(true).slideUp(450).removeClass(openSubMenu);
1572			    		jQuery(this).parent().next('.sub-menu').stop(true).slideUp(450).removeClass(openSubMenu);
1573			   		 }
1574
1575			    	jQuery(this).toggleClass(open);
1576			    },
1577			    eventClose = function(e) {
1578                    var container = $("#wgl-perfect-container");
1579
1580                    if (!container.is(e.target) && container.has(e.target).length === 0) {
1581                    	if ($('body').hasClass(mobile_on)) {
1582							toggleMobileMenu();
1583                    	}
1584
1585                    }
1586                },
1587			    goBack = function(e) {
1588			    	e.preventDefault();
1589			    	jQuery(this).closest( '.sub-menu' ).removeClass(openSubMenu);
1590			    	jQuery(this).closest( '.sub-menu' ).prev( 'a' ).removeClass(open);
1591			    	jQuery(this).closest( '.sub-menu' ).prev( 'a' ).find('.' + mobile_switcher).removeClass(open);
1592			    };
1593
1594			    /*Init*/
1595			    init();
1596
1597			    jQuery(wglMenu.settings.toggleID).on(click, toggleMobileMenu);
1598			    jQuery(wglMenu.settings.overlay).on(click, eventClose);
1599
1600			    //switcher menu
1601			    jQuery(wglMenu.settings.switcher).on(click, showSubMenu);
1602			    jQuery(wglMenu.settings.anchor).on('touchend mouseup', hideSubMenu);
1603
1604			    //Go back menu
1605			    jQuery(wglMenu.settings.back).on(click, goBack);
1606
1607		    	jQuery( window ).resize(
1608		    		function() {
1609		    			showMenu();
1610		    		}
1611		    	);
1612		    });
1613
1614		};
1615	})(jQuery);
1616
1617	menu.wglMobileMenu();
1618
1619}
1620// wgl Page Title Parallax
1621function thegov_page_title_parallax() {
1622    var page_title = jQuery('.page-header.page_title_parallax')
1623    if (page_title.length !== 0 ) {
1624        page_title.paroller();
1625    }
1626}
1627
1628// wgl Extended Parallax
1629function thegov_extended_parallax() {
1630    var item = jQuery('.extended-parallax')
1631    if (item.length !== 0 ) {
1632        item.each( function() {
1633            jQuery(this).paroller();
1634        })
1635    }
1636}
1637// wgl Portfolio Single Parallax
1638function thegov_portfolio_parallax() {
1639    var portfolio = jQuery('.wgl-portfolio-item_bg.portfolio_parallax')
1640    if (portfolio.length !== 0 ) {
1641        portfolio.paroller();
1642    }
1643}
1644
1645function thegov_parallax_video () {
1646	jQuery( '.parallax-video' ).each( function() {
1647		jQuery( this ).jarallax( {
1648			loop: true,
1649			speed: 1,
1650			videoSrc: jQuery( this ).data( 'video' ),
1651			videoStartTime: jQuery( this ).data( 'start' ),
1652			videoEndTime: jQuery( this ).data( 'end' ),
1653		} );
1654	} );
1655}
1656function particles_custom () {
1657    jQuery('.particles-js').each(function () {
1658        var id = jQuery(this).attr('id');
1659        var type = jQuery(this).data('particles-type');
1660        var color_type = jQuery(this).data('particles-colors-type');
1661        var color = jQuery(this).data('particles-color');
1662        var color_line = jQuery(this).data('particles-color');
1663        var number = jQuery(this).data('particles-number');
1664        var lines = jQuery(this).data('particles-line');
1665        var size = jQuery(this).data('particles-size');
1666        var speed = jQuery(this).data('particles-speed');
1667        var hover = jQuery(this).data('particles-hover');
1668        var hover_mode = jQuery(this).data('particles-hover-mode');
1669        switch (type) {
1670            case 'particles':
1671                type = 'circle';
1672                break;
1673            case 'hexagons':
1674                type = 'polygon';
1675                break;
1676            default:
1677                type = 'circle';
1678                break;
1679        }
1680        if (color_type == 'random_colors') {
1681            color = color.split(',');
1682            color_line = color[0]
1683        }
1684        
1685        particlesJS(
1686            id, {
1687                "particles":{
1688                    "number":{
1689                        "value":number,
1690                        "density":{
1691                            "enable":true,
1692                            "value_area":800
1693                        }
1694                    },
1695                    "color":{
1696                        "value": color
1697                    },
1698                    "shape":{
1699                        "type":type,
1700                        "polygon":{
1701                            "nb_sides":6
1702                        },
1703                    },
1704                    "opacity":{
1705                        "value":1,
1706                        "random":true,
1707                        "anim":{
1708                            "enable":false,
1709                            "speed":1,
1710                            "opacity_min":0.1,
1711                            "sync":false
1712                        }
1713                    },
1714                    "size":{
1715                        "value":size,
1716                        "random":true,
1717                        "anim":{
1718                            "enable":false,
1719                            "speed":30,
1720                            "size_min": 1,
1721                            "sync":false
1722                        }
1723                    },
1724                    "line_linked":{
1725                        "enable":lines,
1726                        "distance":150,
1727                        "color":color_line,
1728                        "opacity":0.4,
1729                        "width":1
1730                    },
1731                    "move":{
1732                        "enable":true,
1733                        "speed":speed,
1734                        "direction":"none",
1735                        "random":false,
1736                        "straight":false,
1737                        "out_mode":"out",
1738                        "bounce":false,
1739                        "attract":{
1740                            "enable":false,
1741                            "rotateX":600,
1742                            "rotateY":1200
1743                        }
1744                    }
1745                },
1746                "interactivity":{
1747                    "detect_on":"canvas",
1748                    "events":{
1749                        "onhover":{
1750                            "enable":hover,
1751                            "mode":hover_mode
1752                        },
1753                        "onclick":{
1754                            "enable":true,
1755                            "mode":"push"
1756                        },
1757                        "resize":true
1758                    },
1759                    "modes":{
1760                        "grab":{
1761                            "distance":150,
1762                            "line_linked":{
1763                                "opacity":1
1764                            }
1765                        },
1766                        "bubble":{
1767                            "distance":200,
1768                            "size":size*1.6,
1769                            "duration":20,
1770                            "opacity":1,
1771                            "speed":30
1772                        },
1773                        "repulse":{
1774                            "distance":80,
1775                            "duration":0.4
1776                        },
1777                        "push":{"particles_nb":4},
1778                        "remove":{"particles_nb":2}
1779                    }
1780                },
1781                "retina_detect":true
1782            });
1783        var update;
1784        update = function() {
1785            requestAnimationFrame(update); 
1786        }; 
1787        requestAnimationFrame(update);
1788    })
1789}
1790//http://brutaldesign.github.io/swipebox/
1791function thegov_videobox_init () {
1792	var gallery = jQuery(".videobox, .swipebox, .gallery a[href$='.jpg'], .gallery a[href$='.jpeg'], .gallery a[href$='.JPEG'], .gallery a[href$='.gif'], .gallery a[href$='.png']");
1793	if (gallery.length !== 0 ) {
1794        gallery.each(function() {
1795            jQuery(this).attr('data-elementor-open-lightbox', 'yes');
1796        });
1797	}
1798}
1799// wgl Progress Bars
1800function thegov_progress_bars_init(e) {
1801
1802    var item = jQuery('.wgl-progress_bar');
1803    
1804    if (item.length) {
1805        item.each(function() {
1806            var item = jQuery(this),
1807                slidable_label = false,
1808                item_label = item.find('.progress_label_wrap'),
1809                bar = item.find('.progress_bar'),
1810                data_width = bar.data('width'),
1811                counter = item.find('.progress_value'),
1812                duration = parseFloat(bar.css('transition-duration'))*1000,
1813                interval = Math.floor(duration/data_width),
1814                temp = 0;
1815                if (item.hasClass('dynamic-value')) {
1816                    slidable_label = true;
1817                }
1818            if(!e){
1819                item.appear(function() {
1820					bar.css('width',data_width+'%');
1821                    if ( slidable_label == true ) {
1822                        item_label.css('width', data_width+'%');
1823                    }
1824                    var recap = setInterval( function() {
1825                        counter.text(temp);
1826                        temp++;
1827                    }, interval);
1828                    var stopCounter = setTimeout(function() {
1829                        clearInterval(recap);
1830                        counter.text(data_width);
1831                    }, duration);
1832                });                
1833            } else {
1834                bar.css('width',data_width+'%');
1835                if ( slidable_label ) {
1836                    item_label.css('width', data_width+'%');
1837                }
1838                var recap = setInterval( function() {
1839                    counter.text(temp);
1840                    temp++;
1841                }, interval);
1842                var stopCounter = setTimeout(function() {
1843                clearInterval(recap);
1844                counter.text(data_width);
1845                }, duration);               
1846            }
1847        });
1848    }
1849}
1850function thegov_search_init(){
1851
1852    //Create plugin Search
1853    (function($) {
1854
1855        $.fn.wglSearch = function(options) {        
1856            var defaults = {
1857                "toggleID"      : ".header_search-button",
1858                "closeID"      : ".header_search-close",
1859                "searchField"   : ".header_search-field",
1860                "body"          : "body > *:not(header)",
1861            }; 
1862            
1863            if (this.length === 0) { return this; }
1864            
1865            return this.each(function () {
1866                var wglSearch = {}, s = $(this);
1867                var openClass = 'header_search-open',
1868                searchClass = '.header_search';
1869
1870                var init = function() {
1871                    wglSearch.settings = $.extend({}, defaults, options);
1872                },
1873                open = function () {
1874                    $(s).addClass(openClass);
1875                    setTimeout(function(){
1876                        $(s).find('input.search-field').focus();
1877                    }, 100);
1878                    return false;
1879                },                
1880                close = function () {
1881                    jQuery(s).removeClass(openClass);
1882                },
1883                toggleSearch = function(e) {
1884                    if (!$(s).closest(searchClass).hasClass(openClass)) {
1885                        open();
1886                    }else{
1887                        close();
1888                    }
1889                },
1890                eventClose = function(e) {
1891                    var element = jQuery(searchClass);
1892                    if(!$(e.target).closest('.search-form').length){
1893                        if ($(element).hasClass(openClass)) {
1894                            close();
1895                        }                        
1896                    }
1897                };
1898
1899                /*Init*/
1900                init();
1901
1902                if(jQuery(this).hasClass('search_standard')){
1903                    jQuery(this).find(wglSearch.settings.toggleID).on(click, toggleSearch);
1904                }else{
1905                    jQuery(wglSearch.settings.toggleID).on(click, toggleSearch);
1906                    jQuery(wglSearch.settings.searchField).on(click, eventClose);
1907                }
1908            
1909                jQuery(wglSearch.settings.body).on(click, eventClose);
1910                
1911            });
1912
1913        };
1914
1915    })(jQuery);
1916
1917    jQuery('.header_search').wglSearch();
1918
1919}
1920// Select Wrapper
1921function thegov_select_wrap() {
1922	jQuery('select:not([multiple])').each(function () {
1923        jQuery(this).wrap("<div class='select__field'></div>");
1924    });
1925}
1926
1927function thegov_side_panel_init(){
1928
1929    //Create plugin Side Panel
1930    (function($) {
1931
1932        $.fn.wglSidePanel = function(options) {        
1933            var defaults = {
1934                "toggleID"      : ".side_panel-toggle",
1935                "closeID"      : ".side-panel_close",
1936                "closeOverlay"  : ".side-panel_overlay",
1937                "body"          : "body > *:not(header)",
1938                "sidePanel"    : "#side-panel .side-panel_sidebar"
1939            };
1940            
1941            if (this.length === 0) { return this; }
1942            
1943            return this.each(function () {
1944                var wglSidePanel = {}, s = $(this);
1945                var openClass = 'side-panel_open',
1946                wglScroll,
1947                sidePanelClass = '.side_panel';
1948
1949                var init = function() {
1950                    wglSidePanel.settings = $.extend({}, defaults, options);
1951                },
1952                open = function () {
1953                    if(!$('#side-panel').hasClass('side-panel_active')){
1954                        $('#side-panel').addClass('side-panel_active');
1955                    }
1956
1957                    $('#side-panel').addClass(openClass);
1958                    $(s).addClass(openClass);
1959                    $('body').addClass('side-panel_active');
1960                    
1961                    var wglClassAnimated = $('#side-panel').find('section.elementor-element').data('settings');
1962                    if(wglClassAnimated && wglClassAnimated.animation){
1963                        $('#side-panel').find('section.elementor-element').removeClass('elementor-invisible').addClass('animated').addClass(wglClassAnimated.animation);
1964                    }
1965                },                
1966                close = function () {
1967                    $(s).removeClass(openClass);
1968                    $('#side-panel').removeClass(openClass);
1969                    $('body').removeClass('side-panel_active');
1970                    var wglClassAnimated = $('#side-panel').find('section.elementor-element').data('settings');
1971                    if(wglClassAnimated && wglClassAnimated.animation){
1972                        $('#side-panel').find('section.elementor-element').removeClass(wglClassAnimated.animation);
1973                    }
1974                },
1975
1976                togglePanel = function(e) {
1977                    e.preventDefault();
1978                    wglScroll = $(window).scrollTop();
1979
1980                    if (!$(s).closest(sidePanelClass).hasClass(openClass)) {
1981                        open();                    
1982                        jQuery(window).scroll(function(){
1983                            if(450 < Math.abs(jQuery(this).scrollTop() - wglScroll)){
1984                                close();
1985                            }
1986                        });
1987                    }else{
1988                        
1989                    }
1990                },
1991                closePanel = function(e){
1992                    e.preventDefault();
1993                    if ($(s).closest(sidePanelClass).hasClass(openClass)) {
1994                        close();
1995                    }
1996                },
1997                eventClose = function(e) {
1998                    var element = $(sidePanelClass),
1999                    container = $("#side-panel");
2000
2001                    if (!container.is(e.target) && container.has(e.target).length === 0) 
2002                    {
2003                        if ($(element).hasClass(openClass)) {
2004                            close();
2005                        }   
2006                    }  
2007                };
2008
2009                /*Init*/
2010                init();
2011
2012                jQuery(wglSidePanel.settings.toggleID).on(click, togglePanel);            
2013                jQuery(wglSidePanel.settings.body).on(click, eventClose);
2014                jQuery(wglSidePanel.settings.closeID).on(click, closePanel);
2015                jQuery(wglSidePanel.settings.closeOverlay).on(click, closePanel);
2016
2017                new PerfectScrollbar('#side-panel', {
2018                    wheelSpeed: 6,
2019                    suppressScrollX: true
2020                });
2021            });
2022
2023        };
2024
2025    })(jQuery);
2026
2027    jQuery('.side_panel').wglSidePanel();
2028
2029}
2030function thegov_skrollr_init(){
2031    var blog_scroll = jQuery('.blog_skrollr_init');
2032    if (blog_scroll.length) {
2033   		if(!(/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera)){ 
2034	      // wgl Skrollr
2035	      skrollr.init({
2036	        smoothScrolling: false,
2037	        forceHeight: false
2038	      });  
2039  		}
2040    }
2041}
2042
2043function thegov_split_slider() {
2044
2045    var split_slider = jQuery('.thegov_module_split_slider');
2046    if ( split_slider.length ) {
2047
2048        split_slider.each(function() {
2049            jQuery(this).height(jQuery(window).height()).addClass('slider_initialized');
2050
2051            jQuery(this).multiscroll({
2052                easing: 'easeInOutQuart',
2053                navigation: true,
2054                sectionSelector: '.thegov_split_slider-section',
2055                leftSelector: '.thegov_split_slider-left',
2056                rightSelector: '.thegov_split_slider-right',
2057                afterRender: function () {
2058                    var cloneLeft = jQuery(this).closest('.thegov_split_slider-left > .thegov_split_slider-section');
2059                    var cloneRight = jQuery(this).closest('.thegov_split_slider-right  > .thegov_split_slider-section');
2060                    cloneRight = Array.prototype.reverse.apply(cloneRight);
2061
2062                    var responsive = jQuery(this).closest('.thegov_module_split_slider-wrapper').find('.thegov_module_split_slider-responsive'); 
2063                    for(var i = 0; i < cloneLeft.length; i++){
2064                        jQuery(responsive).append(jQuery(cloneLeft[i]).clone(true));
2065                        jQuery(responsive).append(jQuery(cloneRight[i]).clone(true));
2066                    }
2067                    jQuery('body').addClass('ms-initialized');
2068                    thegov_progress_bars_init(true);
2069                }
2070            });
2071        });
2072 
2073        if (jQuery(window).width() <= 1024) {
2074            jQuery.fn.multiscroll.destroy();
2075        } else {
2076            jQuery.fn.multiscroll.build();
2077        }
2078
2079        jQuery(window).resize(function () {
2080            if (jQuery(window).width() <= 1024) {
2081                jQuery.fn.multiscroll.destroy();
2082            } else {
2083                jQuery.fn.multiscroll.build();
2084            }
2085
2086        });
2087    }
2088}
2089
2090function thegov_sticky_init(){
2091
2092	var section = '.wgl-sticky-header';
2093	var top = jQuery(section).height();
2094	var data = jQuery(section).data('style');
2095
2096	//For Follow In up
2097	var previousScroll = 0;
2098
2099	function init(element){        
2100		if(!element){
2101			return;
2102		}
2103
2104		var y = jQuery(window).scrollTop();
2105		if(data == 'standard'){
2106	        if ( y >= top ) {   
2107	            jQuery(section).addClass( 'sticky_active' );
2108	        } else {
2109	            jQuery(section).removeClass('sticky_active');
2110	        }   			
2111		}else{
2112	        if(y > top) {
2113	            if (y > previousScroll) {
2114	                jQuery(section).removeClass('sticky_active');
2115	            } else {
2116	                jQuery(section).addClass( 'sticky_active' );
2117	            }
2118	        } else {
2119	             jQuery(section).removeClass('sticky_active');
2120	        }
2121	        previousScroll = y;
2122		}
2123    };   
2124
2125    if ( jQuery( '.wgl-sticky-header' ).length !== 0 ) {
2126    	jQuery( window ).scroll(
2127    		function() {
2128    			init(jQuery(this));
2129    		}
2130    	);
2131
2132    	jQuery( window ).resize(
2133    		function() {
2134    			init(jQuery(this));
2135    		}
2136    	);
2137    }
2138} 
2139function thegov_sticky_sidebar() {
2140  if (jQuery('.sticky-sidebar').length) {
2141    jQuery('body').addClass('sticky-sidebar_init');
2142    jQuery('.sticky-sidebar').each(function(){
2143      jQuery(this).theiaStickySidebar({
2144        additionalMarginTop: 30,
2145        additionalMarginBottom: 30
2146      });
2147    });
2148  }
2149
2150  if (jQuery('.sticky_layout .info-wrapper').length) {
2151    jQuery('.sticky_layout .info-wrapper').each(function(){
2152      jQuery(this).theiaStickySidebar({
2153        additionalMarginTop: 150,
2154        additionalMarginBottom: 150
2155      });
2156    });
2157  }
2158} 
2159// Accordion 
2160function thegov_striped_services_init() {
2161    var item_wrap = jQuery('.wgl-striped-services');
2162
2163    item_wrap.each(function(){
2164        var item = jQuery(this).find('.service-item');
2165
2166        item.on('mouseenter', function(e){
2167            item_wrap.addClass('onhover');
2168            jQuery(this).addClass('active');
2169        })
2170        item.on('mouseleave', function(e){
2171            item_wrap.removeClass('onhover');
2172            jQuery(this).removeClass('active');
2173        })
2174    })
2175
2176}
2177// Tabs
2178function thegov_tabs_init() {
2179	if (jQuery('.wgl-tabs').length) {
2180		jQuery('.wgl-tabs').each(function(){
2181			var $this = jQuery(this);
2182		
2183			var tab = $this.find('.wgl-tabs_headings .wgl-tabs_header');
2184			var	data = $this.find('.wgl-tabs_content-wrap .wgl-tabs_content');
2185			
2186			tab.filter(':first').addClass('active');
2187
2188			data.filter(':not(:first)').hide();
2189			tab.each(function(){
2190				var currentTab = jQuery(this);
2191
2192				currentTab.on('click tap', function(){
2193					var id = currentTab.data('tab-id');
2194				
2195					currentTab.addClass('active').siblings().removeClass('active');
2196					jQuery('.wgl-tabs .wgl-tabs_content[data-tab-id='+id+']').slideDown().siblings().slideUp();			
2197				});
2198			});
2199		})
2200	}
2201}
2201
2202		
2203function thegov_text_background() {
2204
2205    var anim_text = jQuery('.wgl-animation-background-text');
2206    if ( anim_text.length ) {
2207
2208
2209		anim_text.each(function(index){
2210			var paralax_text = jQuery('<div class="wgl-background-text"/>');
2211
2212			jQuery(this).find(">div:eq(0)").before(paralax_text);
2213			var text = window.getComputedStyle(this,':before').content;
2214
2215			text = text.slice(1, -1);
2216
2217			paralax_text.addClass('element-'+ index);
2218			paralax_text.attr('data-info', index);
2219		  	
2220		  	jQuery(this).find(paralax_text).html(text.replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>"));
2221
2222		  	var self = jQuery(this);
2223
2224		  	anim_text.appear(function() {
2225
2226		  		if(typeof anime === 'function'){
2227
2228		  			var item_anime = jQuery(this).find('.wgl-background-text').data('info');
2229
2230		  			if(item_anime === index){
2231			  			anime.timeline({loop: false})
2232			  			.add({
2233			  				targets: '.element-'+ index + ' .letter',
2234			  				translateY: [100,0],
2235			  				translateZ: 0,
2236			  				opacity: [0,1],
2237			  				easing: "easeOutExpo", 
2238			  				duration: 1400,
2239			  				delay: function(el, i) {
2240			  					return 0 + 350 * i;
2241			  				}
2242			  			});			  				
2243		  			}
2244
2245
2246		  		}
2247		  	}); 		  		
2248		  	
2249
2250		});
2251    }
2252}
2253// WGL Time Line Vertical appear
2254function thegov_init_timeline_appear() {
2255
2256    var item = jQuery('.wgl-timeline-vertical.appear_anim .time_line-item');
2257
2258    if (item.length) {
2259        item.each(function() {
2260            var item = jQuery(this);
2261            item.appear(function() {
2262                item.addClass('item_show');
2263            });
2264        });
2265    }
2266}
2267function thegov_woocommerce_helper(){
2268    jQuery('body').on('click', '.quantity.number-input span.minus', function(e){    
2269        this.parentNode.querySelector('input[type=number]').stepDown();
2270        if(document.querySelector('.woocommerce-cart-form [name=update_cart]')){
2271            document.querySelector('.woocommerce-cart-form [name=update_cart]').disabled = false;
2272        }
2273    }); 
2274    
2275    jQuery('body').on('click', '.quantity.number-input span.plus', function(e){    
2276        this.parentNode.querySelector('input[type=number]').stepUp();
2277        if(document.querySelector('.woocommerce-cart-form [name=update_cart]')){
2278            document.querySelector('.woocommerce-cart-form [name=update_cart]').disabled = false;
2279        }
2280    }); 
2281
2282    jQuery('ul.wgl-products li a.add_to_cart_button.ajax_add_to_cart').on( "click", function() {
2283        jQuery(this).closest('li').addClass('added_to_cart_item');
2284    });
2285}
2286
2287function thegov_woocommerce_login_in() {
2288
2289	if (jQuery('header .login-in').length) {
2290		var mc = jQuery('header .login-in'),
2291			icon = mc.find('a.login-in_link'),
2292			overlay = mc.find('div.overlay');
2293
2294		icon.on('click tap', function(e) { 
2295			e.preventDefault();
2296			mc.toggleClass('open_login'); 
2297		});
2298
2299		overlay.on('click tap', function(e) { 
2300			if(!jQuery(e.target).closest('.modal_content').length && !jQuery(e.target).is('.modal_content')){
2301			 	mc.removeClass('open_login'); 
2302			}
2303		});
2304
2305	};
2306};
2307
2308
2309function thegov_woocommerce_mini_cart() {
2310
2311	if (jQuery('header .mini-cart').length) {
2312		jQuery('header .mini-cart').prepend('<div class="mini_cart-overlay"></div>');
2313
2314		var mc = jQuery('header .mini-cart'),
2315			icon = mc.find('a.woo_icon'),
2316			overlay = mc.find('div.mini_cart-overlay');
2317
2318		icon.on('click tap', function() { mc.toggleClass('open_cart'); });
2319		overlay.on('click tap', function() { mc.removeClass('open_cart'); });
2320		jQuery('body').on('click', 'header a.close_mini_cart', function(){
2321			mc.removeClass('open_cart');
2322		});
2323	};
2324};
2325

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.