PageSourceSearch

https://www.iab.com/wp-content/themes/iab/assets/js/custom_scripts.js?var=26-24-09-07-57-58

js iab.com collected 2026-09-24 08:03:48 UTC 55,009 bytes, 1,500 lines download raw bytes

1/**
2 * Custom Javascript - Specifically one-off and non-global functions
3 */
4
5var isTouchDevice = ('ontouchstart' in window || 'onmsgesturechange' in window);
6
7$(document).ready(function() {
8    if( $('.slider-tabs').length ){
9        initTabSlider();
10    }
11    if( $('.modal-target').length ){
12        initImageModal();
13    }
14    if( $('.tabbed-content-ui').length ){
15        initTabbedContentUI(true)
16    }
17
18    if( $('section#timeline').length ){
19        initAnniversaryTimeline();
20    }
21
22    if( $('#new-ad-portfolio').length ){
23        initNewAdPortfolio();
24    }
25
26    if( $('.headshot-tiles').length ){
27        initHeadshotTiles();
28    }
29
30    if( $('.faq-wrapper').length ){
31        initFAQAccordion();
32    }
33
34    if( $('body.page-template-page-creative-showcase-cross-platform').length ){
35        initCrossPlatformCreativeShowcase();
36    } else if( $('#creative-showcase').length ){
37        initCreativeShowcase();
38    } else if( $('#filterable-grid').length ){
39        initCreativeShowcase();
40    }
41
42    if( $('body').hasClass('page-template-page-single-page-event-template') ){
43        initSinglePageEventTemplate();
44    }
45
46    if( $('#recertification').length ){
47        //initRecertification();
48        $('.event-month-wrapper').each(function(){
49            var numActive = $(this).find('.article-list__row.certificate-active').length;
50            if(numActive<1){
51                $(this).hide();
52            }
53        });
54    }
55
56    if( $('body').hasClass('category-learning') ){
57        $('.has-sublinks .arrow-wrapper').click(function(){
58            var li = $(this).parent();
59            li.toggleClass('closed').toggleClass('open');
60            $('.' + li.attr('id')).slideToggle();
61        });
62    }
63
64    if( $('body').hasClass('category-certification') || $('body').hasClass('iab-digital-media-sales-certification-overview') || $('body').hasClass('iab-ad-ops-certification-overview') || $('body').hasClass('iab-data-solutions-certification-overview') ){
65        //initModalAlert( 'Temporary Registration Issues', 'We are currently having an issue with our registration system. If you are having a problem resetting your password reach out to <a href="mailto:[email protected]" target="_blank">[email protected]</a>. <br />We apologize for any inconvenience.' );
66    }
67
68    if( $('body').hasClass('category-learning') || $('body').hasClass('about-iab-digital-leadership-program') || $('body').hasClass('advprogrammatic') ){
69        //initModalAlert( 'Temporary Registration Issues', 'We are currently having an issue with our registration system.  To register for a class please email us at <a href="mailto:[email protected]" target="_blank">[email protected]</a>.  <br />We apologize for any inconvenience' );
70    }
71});
72
73function trace(msg){
74    if(console){
75        console.log(msg);
76    }
77}
78
79function addZero(i) {
80    if (i < 10) {
81        i = "0" + i;
82    }
83    return i;
84}
85
86function formatAMPM(hours) {
87    return hours >= 12 ? 'PM' : 'AM';
88}
89
90//
91// initTabSlider - configures a tab-like user interface with a sliding indicator; the html must match a specific template
92//
93function initTabSlider(){
94
95    $(".slider-tabs>ul li a").click(function(event) {
96        event.preventDefault();
97        $(this).parent().addClass("current");
98        $(this).parent().siblings().removeClass("current");
99        var tab = $(this).attr("href");
100        var tabNumber = tab.replace("#", "").replace("tab-", "");
101        $(".slider-tabs>div>div").not(tab).css("display", "none");
102        $(tab).fadeIn();
103
104        $('.slider-arrow').animate({
105            width: $(this).parent().width(),
106            left: $(this).parent().position().left
107        }, 1000, function() {
108            // Animation complete.
109        });
110
111        history.replaceState(undefined, undefined, '#' + tabNumber);
112        //$('.slider-arrow').css('width', $(this).parent().width()).css('left', $(this).parent().position().left);
113    });
114    function selectTab( id ){
115        var newID = id.replace('#','').replace('tab-','');
116        var link = $('a[href="#tab-' + newID + '"]');
117        $(link).click();
118    }
119    $('.slider-select').change(function(){
120        selectTab( $(this).val() );
121    });
122    if(document.location.hash){
123        var hashNumber = document.location.hash.replace('#','');
124        selectTab( '#tab-' + hashNumber );
125        setTimeout(function(){
126            window.scrollTo(0,0);
127        }, 1);
128    } else {
129        $(".slider-tabs>ul li:first-child a").click();
130    }
131
132}
133
134//
135// initImageModal - add a click event on any image with modal-target class, when clicked the image shows full screen over a shaded layer
136//
137function initImageModal(){
138    // I was just using this when the cache on the site was enabled during testing - these css rules are already in custom_styles.css
139    //var style = $('<style>div#modal-bg { display:none;cursor:pointer;position: fixed;width:100%;height: 100%;top:0;left: 0;background: rgba(0,0,0,.5);z-index: 999998;min-height: 1000px;}.modal-target{cursor:pointer;}.modal-big{display:none;position:fixed;width:100%;height:100%;top:0;left: 0;z-index: 999999;text-align:center;}.modal-big img {max-width:90%;margin:20px auto 0;}</style>');
140    //$('html > head').append(style);
141
142    $('body').append('<div id="modal-bg"></div>');
143
144    var i = 1;
145    var i = 1;
146    $('.modal-target').each(function(){
147        $(this).addClass('modal-small-' + i).data('count', i);
148        var src = $(this).attr('src');
149        $('body').append('<div class="modal-big modal-big-' + i + '"><img src="' + src + '" /></div>');
150        $(this).click(function(){
151            var count = $(this).data('count');
152            //trace( 'clicked target - showing [' + count + ']' );
153            $('#modal-bg').fadeIn();
154            $('.modal-big-' + count).fadeIn();
155        });
156        i++;
157    });
158
159    $('#modal-bg,.modal-big').click(function(){
160        $('.modal-big').fadeOut();
161        $('#modal-bg').fadeOut();
162    });
163}
164
165//
166//
167//
168function initModalAlert( title, content ){
169    $('body').append('<div id="modal-alert"><h4>' + title + '</h4><p>' + content + '</p><div id="close-alert">Close</div></div>');
170    $('body').append('<div id="modal-bg"></div>');
171    $('#modal-bg,#close-alert').click(function(){
172        $('#modal-alert').fadeOut();
173        $('#modal-bg').fadeOut();
174    });
175    $('#modal-bg,#modal-alert').fadeIn();
176}
177
178//
179//
180//
181function initTabbedContentUI( slider ){
182    var listItems = $('.tabbed-content-ui>ul>li');
183    var contentDivs = $('.tabbed-content-ui>.content>div');
184
185    listItems.each(function(){
186        function activateEvent( target ){
187            var number = $( ".tabbed-content-ui>ul>li" ).index( target );
188            if( $(window).width() < 761 ){
189                window.location = contentDivs.eq( number).find('a').attr('href');
190            } else {
191                if( !contentDivs.eq( number).is(':visible') ){
192                    selectTab( number );
193                }
194            }
195        }
196        $(this).mouseover(function(){
197            activateEvent( this );
198        });
199        $(this).click(function(){
200            //activateEvent( this );
201            var number = $( ".tabbed-content-ui>ul>li" ).index( this );
202            window.location = contentDivs.eq( number).find('a').attr('href');
203        });
204    });
205
206    // properly init (since its already showing, can't just selectTab()
207    var first = listItems.eq(0);
208    $('.slider').animate({
209        left: (first.position().left + first.width()/2 - 30)
210    }, 200, function(){});
211
212    function selectTab( number ) {
213        contentDivs.fadeOut(500);
214        contentDivs.eq(number).fadeIn(500);
215
216        var li = listItems.eq(number);
217        $('.slider').animate({
218            left: (li.position().left + li.width() / 2 - 30)
219        }, 500, function () {
220        });
221        var id = li.find('img').attr('id');
222        $('.content').removeClass().addClass('content').addClass(id);
223        $('.slider').removeClass().addClass('slider').addClass(id);
224    }
225}
226
227
228jQuery(document).ready(function($){
229
230    /*filter certificate events*/
231
232   // $(".filtercertificate #true").on("click", function(e){
233    $(document).on('click', '.filtercertificate #true', function(e){
234
235        if(this.checked) {
236            $(this).attr('checked','checked');
237            $('.certificate-disable').fadeOut();
238            /*$('.event-month-wrapper').each(function(){
239                var numActive = $(this).find('.article-list__row.certificate-active').length;
240                if(numActive<1){
241                    $(this).fadeOut();
242                }
243            });*/
244            //alert("Checkbox is checked.");
245        } else {
246            $(this).removeAttr('checked');
247            $('.certificate-disable').fadeIn();
248            /*$('.event-month-wrapper').fadeIn();*/
249           // alert("Checkbox is unchecked.");
250        }
251    });
252
253
254    var getUrlParameter = function getUrlParameter(sParam) {
255    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
256            sURLVariables = sPageURL.split('&'),
257            sParameterName,
258            i;
259
260        for (i = 0; i < sURLVariables.length; i++) {
261            sParameterName = sURLVariables[i].split('=');
262
263            if (sParameterName[0] === sParam) {
264                return sParameterName[1] === undefined ? true : sParameterName[1];
265            }
266        }
267    };
268
269    var tech = getUrlParameter('pryear');
270    //trace(tech);
271
272    if(tech !=null) { // year is in url with get
273        $( ".blocktext a" ).each(function() {
274            var $aval = $( this ).html();
275            if($aval == tech){ // if is  parrameter
276                $(this).addClass('active');
277            }
278        });
279    }else{ // is not in url with get
280
281        var href = location.href.split('/');
282        var $year_string = href[href.length - 2 ].match(/\d+/);
283        //console.log("not in url" +  $year_string);
284
285        $( ".blocktext a" ).each(function() {
286            var $aval = $( this ).html();
287            if($aval == $year_string){ // if is  parrameter
288                $(this).addClass('active');
289            }
290        });
291
292    }
293
294});
295
296//
297// initAnniversaryTimeline - anniversary timeline
298//
299function initAnniversaryTimeline(){
300    $('.flik-timeline').flikScrollEffect();
301
302    $('section#timeline,section#timeline div#flik-timeline-overscroll').addClass('loaded');
303
304    // set variable for use in a couple places below
305    var firstItemLeftEdgeStartingPosition = parseFloat($('.flik-timeline-item:first').offset().left);
306    //trace('firstItemLeftEdgeStartingPosition is [' + firstItemLeftEdgeStartingPosition + ']' );
307
308    // set up click events
309    var leftArrow = $('.left-arrow-wrapper');
310    leftArrow.click(function(){
311        //trace( 'click left' );
312        slide('left');
313    });
314    leftArrow.mouseenter(function(){
315        //trace( 'mouseover left' );
316        slide('left');
317        if(!isMobile()){
318            leftTimer = setInterval(function(){
319                slide('left');
320            }, 400);
321        }
322    });
323    leftArrow.mouseleave(function(){
324        //trace( 'mouseout left' );
325        clearInterval(leftTimer);
326        //slide('left','easeOutCubic', 400);
327    });
328
329    var rightArrow = $('.right-arrow-wrapper');
330    rightArrow.click(function(){
331        //trace( 'click right' );
332        slide('right');
333    });
334    rightArrow.mouseenter(function(){
335        //trace( 'mouseover right' );
336        slide('right');
337        if(!isMobile()){
338            rightTimer = setInterval(function(){
339                slide('right');
340            }, 400);
341        }
342    });
343    rightArrow.mouseleave(function(){
344        //trace( 'mouseout right' );
345        clearInterval(rightTimer);
346        //slide('right','easeOutCubic', 400);
347    });
348
349    //run some functions when the div scrolls - make sure we haven't reached the edge and update the year nav
350    $('div#flik-timeline-overscroll').scroll(function() {
351        hasEdgeBeenReached( 'left' );
352        hasEdgeBeenReached( 'right' );
353        updateYear();
354    });
355
356    //jump to year
357    $('.year-row span').each(function(){
358        $(this).click(function(){
359            $('.selected').removeClass('selected');
360            $(this).addClass('selected');
361            jumpToYear($(this).data('year'));
362        });
363    });
364
365    function isMobile(){
366        return ($(window).width() < 500);
367    }
368    function hasEdgeBeenReached( edge, increment ){
369        var firstItemLeftEdge = parseFloat($('.flik-timeline-item:first').offset().left);
370        var lastItemRightEdge = parseFloat($('.flik-timeline-item:last').offset().left) + parseFloat($('.flik-timeline-item:last').width());
371        var rightEdgeOfWindow = ( $('#flik-timeline-overscroll').width() + $('#flik-timeline-overscroll').offset().left )
372        //trace( 'in hasEdgeBeenReached: firstItemLeftEdge = [' + firstItemLeftEdge + '] and lastItemRightEdge = ['+lastItemRightEdge+'] and firstItemLeftEdgeStartingPosition =['+firstItemLeftEdgeStartingPosition+'] and rightEdgeOfWindow = ['+rightEdgeOfWindow+']' );
373        if( edge == 'left' ){
374            if( firstItemLeftEdge > firstItemLeftEdgeStartingPosition ){
375                //trace('left edge has been reached, stop scrolling: firstItemLeftEdge = [' + firstItemLeftEdge + ']');
376                navigationArrows('left',true);
377                return true;
378            } else {
379                //trace('left edge not reached, keep scrolling = [' + firstItemLeftEdge + '] and lastItemRightEdge = [' + lastItemRightEdge + ']');
380                navigationArrows('left',false);
381                return false;
382            }
383        } else {
384            if( lastItemRightEdge < rightEdgeOfWindow ){
385                //trace('right edge has been reached, stop scrolling');
386                navigationArrows('right',true);
387                return true;
388            } else {
389                //trace('right edge not reached, keep scrolling');
390                navigationArrows('right',false);
391                return false;
392            }
393        }
394    }
395    function navigationArrows(direction,endReached){
396        if(direction == 'left'){
397            if(endReached){
398                if($('.left-arrow-wrapper.arrow-wrapper').hasClass('visible')){
399                    $('.left-arrow-wrapper.arrow-wrapper').fadeOut( null, function() {
400                        $(this).removeClass('visible');
401                    });
402                }
403                if(!$('.right-arrow-wrapper.arrow-wrapper').hasClass('visible')){
404                    $('.right-arrow-wrapper.arrow-wrapper').fadeIn( null, function() {
405                        $(this).addClass('visible');
406                    });
407                }
408            } else {
409                if(!$('.left-arrow-wrapper.arrow-wrapper').hasClass('visible')){
410                    $('.left-arrow-wrapper.arrow-wrapper').fadeIn( null, function() {
411                        $(this).addClass('visible');
412                    });
413                }
414                if(!$('.right-arrow-wrapper.arrow-wrapper').hasClass('visible')){
415                    $('.right-arrow-wrapper.arrow-wrapper').fadeIn( null, function() {
416                        $(this).addClass('visible');
417                    });
418                }
419            }
420        } else {
421            if(endReached){
422                if(!$('.left-arrow-wrapper.arrow-wrapper').hasClass('visible')){
423                    $('.left-arrow-wrapper.arrow-wrapper').fadeIn( null, function() {
424                        $(this).addClass('visible');
425                    });
426                }
427                if($('.right-arrow-wrapper.arrow-wrapper').hasClass('visible')){
428                    $('.right-arrow-wrapper.arrow-wrapper').fadeOut(null, function() {
429                        $(this).removeClass('visible');
430                    });
431                }
432            } else {
433                if(!$('.left-arrow-wrapper.arrow-wrapper').hasClass('visible')){
434                    $('.left-arrow-wrapper.arrow-wrapper').fadeIn( null, function() {
435                        $(this).addClass('visible');
436                    });
437                }
438                if(!$('.right-arrow-wrapper.arrow-wrapper').hasClass('visible')){
439                    $('.right-arrow-wrapper.arrow-wrapper').fadeIn( null, function() {
440                        $(this).addClass('visible');
441                    });
442                }
443            }
444        }
445    }
446    function jumpToYear(year){
447        //trace('jump to year: [' + year + ']');
448
449        var found = false;
450        var isFirst = false;
451        var isLast = false;
452        $('.flik-timeline-item').each(function(){
453            //trace('loop')
454            if( $(this).data('date').indexOf(year) > -1 ){
455                //trace('found');
456                //$(this).addClass('found');
457                var leftPosition = parseFloat($(this).position().left);
458                if($(this).is(':first-child')){
459                    isFirst = true;
460                } else if($(this).is(':last-child')) {
461                    isLast = true;
462                }
463                if(!isFirst){
464                    leftPosition = leftPosition-90;
465                }
466                //trace('leftPosition is [' + leftPosition + ']');
467                $('ul.flik-timeline.flik-timeline-7').animate({
468                    left:(-1 * leftPosition)
469                },{
470                    easing: 'linear',
471                    duration: 400,
472                    speed: 'fast',
473                    complete:function(){
474                        //trace('done animating');
475                        hasEdgeBeenReached('left');
476                    }
477                });
478                found = true;
479                return false;
480            }
481        });
482        if(!found){
483            $('.flik-timeline-item').each(function(){
484                //trace('loop2')
485                if( $(this).data('date').indexOf(year+1) > -1 ){
486                    //trace('found');
487                    $(this).addClass('found');
488                    var leftPosition = parseFloat($(this).position().left);
489                    //trace('leftPosition is [' + leftPosition + ']');
490                    if($(this).is(':first-child')){
491                        isFirst = true;
492                    } else if($(this).is(':last-child')) {
493                        isLast = true;
494                    }
495                    if(!isFirst){
496                        leftPosition = leftPosition-90;
497                    }
498                    $('ul.flik-timeline.flik-timeline-7').animate({
499                        left:(-1 * leftPosition)
500                    },{
501                        easing: 'linear',
502                        duration: 400,
503                        speed: 'fast',
504                        complete:function(){
505                            //trace('done animating');
506                            hasEdgeBeenReached('left');
507                        }
508                    });
509                    found = true;
510                    return false;
511                }
512            });
513        }
514        if(!found){
515            $('.flik-timeline-item').each(function(){
516                //trace('loop3')
517                if( $(this).data('date').indexOf(year+2) > -1 ){
518                    //trace('found');
519                    $(this).addClass('found');
520                    var leftPosition = parseFloat($(this).position().left);
521                    //trace('leftPosition is [' + leftPosition + ']');
522                    if($(this).is(':first-child')){
523                        isFirst = true;
524                    } else if($(this).is(':last-child')) {
525                        isLast = true;
526                    }
527                    if(!isFirst){
528                        leftPosition = leftPosition-90;
529                    }
530                    $('ul.flik-timeline.flik-timeline-7').animate({
531                        left:(-1 * leftPosition)
532                    },{
533                        easing: 'linear',
534                        duration: 400,
535                        speed: 'fast',
536                        complete:function(){
537                            //trace('done animating');
538                            hasEdgeBeenReached('left');
539                        }
540                    });
541                    found = true;
542                    return false;
543                }
544            });
545        }
546        if(isFirst){
547            //trace('is first');
548            navigationArrows('left',true);
549        } else if(isLast) {
550            //trace('is last');
551            navigationArrows('right',true);
552        }
553    }
554    function slide(direction, ease, duration, increment){
555        if(!ease){
556            ease = 'linear';
557        }
558        if(!duration){
559            duration = 400;
560        }
561        if(!increment){
562            increment = 150;
563        }
564
565        //trace( 'Slide - direction: [' + direction + '] - ease: [' + ease + '] - duration: [' + duration + '] - increment: [' + increment + ']' );
566
567        if( !hasEdgeBeenReached(direction, increment)){
568
569            var firstItemLeftEdge = parseFloat($('.flik-timeline-item:first').offset().left);
570            var lastItemLeftEdge = parseFloat($('.flik-timeline-item:last').offset().left);
571            var lastItemRightEdge = lastItemLeftEdge + parseFloat($('.flik-timeline-item:last').width());
572            var rightEdgeOfWindow = ($('#flik-timeline-overscroll').width() + $('#flik-timeline-overscroll').offset().left);
573            var leftEdgeOfWindow = $('#flik-timeline-overscroll').offset().left;
574            if(!firstItemLeftEdge){
575                firstItemLeftEdge = 0;
576            }
577            //trace('firstItemLeftEdge is [' + firstItemLeftEdge + '] and lastItemLeftEdge = ['+lastItemLeftEdge+'] and lastItemRightEdge = ['+lastItemRightEdge+']');
578            $('ul.flik-timeline.flik-timeline-7').stop( true, true );
579            if(direction == 'right'){
580                if( (lastItemRightEdge - increment) < rightEdgeOfWindow ){
581                    //trace('this will go too far right!');
582                    increment = lastItemRightEdge - rightEdgeOfWindow;
583                    clearInterval(rightTimer);
584                }
585                //trace('firstItemLeftEdge is [' + firstItemLeftEdge + '] and increment is [' + increment + ']');
586
587                $('ul.flik-timeline.flik-timeline-7').animate({left:'-='+increment},{ easing: ease,duration: duration, speed: 'slow'});
588            } else {
589                if( firstItemLeftEdge + increment > leftEdgeOfWindow ){
590                    increment = leftEdgeOfWindow - firstItemLeftEdge;
591                    //trace('this will go too far left! new increment is [' + increment + ']');
592                    $('ul.flik-timeline.flik-timeline-7').animate({left:0},{ easing: ease,duration: duration, speed: 'slow'});
593                    clearInterval(leftTimer);
594                } else {
595                    $('ul.flik-timeline.flik-timeline-7').animate({left:'+='+increment},{ easing: ease,duration: duration, speed: 'slow'});
596
597                }
598
599                //trace('firstItemLeftEdge is [' + firstItemLeftEdge + '] and increment is [' + increment + ']');
600
601            }
602            updateYear();
603        }
604    }
605    function updateYear(){
606        var timelineLeftEdge = $('#flik-timeline-overscroll').offset().left;
607        var timelineWidth = $('ul.flik-timeline').innerWidth();
608        var timelineCenter = timelineLeftEdge + (timelineWidth/2);
609        //trace( 'timelineCenter is [' + timelineCenter + ']' );
610        $('.flik-timeline-item').each(function(){
611            //
612            var itemLeft = $(this).offset().left;
613            var itemWidth = $(this).width();
614            var itemRight = itemLeft + itemWidth;
615            if( ( timelineCenter > itemLeft ) && ( timelineCenter < itemRight ) ){
616                //trace( 'found the center item! left is [' + itemLeft + '] and right is [' + itemRight + ']' );
617                //$(this).css('border-top','5px solid yellow');
618                var date = $(this).data('date');
619                var year = date.replace(/\D/g,'');;
620                //trace('year is [' + year + ']');
621                $('.selected').removeClass('selected');
622                $('.year-row span[data-year="' + year + '"]').addClass('selected');
623            }
624        });
625    }
626}
627
628//
629// initRecertification - recertification
630//
631function initRecertification(){
632
633}
634
635function showCityClasses( target ){
636    //trace('now in showCityClasses, target is [' + target + ']')
637    $('.class-location').hide();
638    $('.class-location.' + target ).show();
639}
640
641//
642// initNewAdPortfolioLEAN - initializing the New Ad Portfolio LEAN page,
643//
644function initNewAdPortfolioLEAN(){
645    var thumbs = $('#gallery').slippry({
646        slippryWrapper: '<div class="slippry_box thumbnails" />',
647        transition: 'horizontal',
648        pager: false,
649        auto: false,
650        captions: false,
651        onSlideBefore: function (el, index_old, index_new) {
652            $('.thumbs a img').removeClass('active');
653            $('img', jQuery('.thumbs a')[index_new]).addClass('active');
654        }
655    });
656    $('.thumbs a').unbind('click').click(function () {
657        thumbs.goToSlide($(this).data('slide'));
658        return false;
659    });
660}
661
662//
663// initNewAdPortfolio - initializing the New Ad Portfolio page, including a custom slider and other functionality
664//
665var center_slide = 1;
666var counter = 1;
667var slider_wrapper_width = $('.slider-wrapper').width();
668var autoPlay;
669
670function initNewAdPortfolio() {
671    $('.subnav-close').click(function(){
672        $('section#new-ad-portfolio-subnav').toggleClass('mobile-nav-open')
673    });
674
675    /* Device Slider */
676
677    //var center_slide = 1;
678    //var counter = 1;
679    //var slider_wrapper_width = $('.slider-wrapper').width();
680    //var autoPlay;
681
682    $(window).resize(function(){
683        slider_wrapper_width = $('.slider-wrapper').width();
684        positionAd();
685        if($(window).width() > 736 ){
686            initSlider();
687        }
688    });
689
690    function slide( direction ){
691        var increment;
692        if($(window).width() < 550 ){
693            increment = slider_wrapper_width;
694        } else {
695            increment = slider_wrapper_width/2;
696        }
697        center_slide += 1;
698        /*if(direction == 'previous'){
699            var next_slide_img_position = $('.devices div[data-device="' + (center_slide - 1) + '"] img').position();
700            var next_slide_img_width = $('.devices div[data-device="' + (center_slide - 1) + '"] img').width();
701            $( ".devices" ).animate({
702                left: "+=" + increment
703            }, 400, function() {
704                positionAd();
705            });
706            center_slide -= 1;
707
708            $('.ad.current').removeClass('current').fadeOut();
709            $('.ad[data-device="' + (center_slide) + '"]').addClass('current').fadeIn();
710
711            ads.animate({
712                left:  next_slide_img_position.left,
713                top: next_slide_img_position.top,
714                width: next_slide_img_width
715            }, 800, function() {});
716        //} else if( direction == 'next' && (center_slide != $('.devices div.device').length)) {
717        } else {*/
718
719        var next_slide = $('.devices div[data-device="' + center_slide + '"] img');
720        var next_slide_img_position = next_slide.position();
721        var next_slide_img_width = next_slide.width();
722        $( ".devices" ).animate({
723            left: "-=" + increment
724        }, 400, function() {
725            positionAd();
726            //trace('counter is [' + counter + ']');
727            if(counter > 1){
728                $('.devices .device:last').after($('.devices .device').eq(center_slide-2).clone());
729                $('.devices .device:last').attr('data-device', counter+3);
730                $('.ads .ad:last').after($('.ads .ad').eq(center_slide-2).clone());
731                $('.ads .ad:last').attr('data-device', counter+3);
732            }
733        });
734        counter++;
735
736        $('.ad.current').removeClass('current').animate({ opacity: 0 }, 300, function() {});
737        $('.ad[data-device="' + (center_slide) + '"]').addClass('current').animate({ opacity: 1 }, 300, function() {});
738
739        var ads = $('.ads');
740        ads.animate({
741            left:  next_slide_img_position.left,
742            top: next_slide_img_position.top,
743            width: next_slide_img_width
744        }, 800, function() {});
745
746        //trace('center_slide is [' + center_slide + ']');
747        //trace('ad.current.index is [' + $('.ad.current').index() + ']');
748
749        /*} else {
750            center_slide = 1;
751            var next_slide_img_position = $('.devices div[data-device="' + (center_slide) + '"] img').position();
752            var next_slide_img_width = $('.devices div[data-device="' + (center_slide) + '"] img').width();
753            $( ".devices" ).animate({
754                left: 0
755            }, 400, function() {
756                positionAd();
757            });
758
759            $('.ad.current').removeClass('current').fadeOut();
760            $('.ad[data-device="' + (center_slide) + '"]').addClass('current').fadeIn();
761
762            ads.animate({
763                left:  next_slide_img_position.left,
764                top: next_slide_img_position.top,
765                width: next_slide_img_width
766            }, 800, function() {});
767        }*/
768
769        $('.devices .center').removeClass('center');
770        $('.devices div[data-device="' + (center_slide) + '"]').addClass('center');
771
772    }
773
774    function positionAd(){
775        var img_position = $('.devices div.center img').position();
776        var img_width = $('.devices div.center img').width();
777        $( ".ads" ).stop(true,false).animate({
778            width: img_width,
779            left: img_position.left,
780            top: img_position.top
781        }, 200, function() {});
782    }
783
784    function updateSlideInfo(){
785        $('.devices').removeClass('center');
786        $('.devices div[data-device="' + (center_slide) + '"]').addClass('center');
787    }
788
789    function initSlider(){
790        if($(window).width() < 550 ){
791            $('.devices>div').width( slider_wrapper_width );
792        } else {
793            $('.devices>div').width( slider_wrapper_width/2 );
794        }
795        var img_position = $('.devices div.center img').position();
796        var img_width = $('.devices div.center img').width();
797        if (img_position) {
798            $('.ads').stop().css({
799                "width": img_width,
800                "left": img_position.left,
801                "top": img_position.top
802            });
803        }
804        clearInterval(autoPlay);
805        autoPlay = setInterval(function(){ slide('next') }, 2400);
806    }
807
808    function stopAutoPlay() {
809        clearInterval(autoPlay);
810    }
811
812    if($(window).width() > 736 ) {
813        initSlider();
814    }
815
816    /* Galleries */
817
818    function initRatioGallery( startNum ){
819        console.log('in initRatioGallery - startNum is [' + startNum + ']');
820        if(!startNum){
821            startNum = 1;
822        }
823        $('.ratio-gallery-wrapper,.backdrop').fadeIn();
824        var ratio_thumbs = $('#ratio-gallery').slippry({
825            slippryWrapper: '<div class="slippry_box thumbnails" />',
826            transition: 'horizontal',
827            pager: false,
828            auto: false,
829            captions: false,
830            start: startNum,
831            onSlideBefore: function (el, index_old, index_new) {
832                $('.ratio-gallery-wrapper .thumbs a img').removeClass('active');
833                $('img', $('.ratio-gallery-wrapper .thumbs a')[index_new]).addClass('active');
834            }
835        });
836        $('.ratio-gallery-wrapper .thumbs a').unbind('click').click(function () {
837            ratio_thumbs.goToSlide($(this).data('slide'));
838            return false;
839        });
840    }
841
842    function initLEANGallery( startNum ){
843        if(!startNum){
844            startNum = 1;
845        }
846        $('.lean-gallery-wrapper,.backdrop').fadeIn();
847        var lean_thumbs = $('#lean-gallery').slippry({
848            slippryWrapper: '<div class="slippry_box thumbnails" />',
849            transition: 'horizontal',
850            pager: false,
851            auto: false,
852            captions: false,
853            start: startNum,
854            onSlideBefore: function (el, index_old, index_new) {
855                $('.lean-gallery-wrapper .thumbs li a').removeClass('active');
856                $('.lean-gallery-wrapper .thumbs li').eq(index_new).find('a').addClass('active');
857            }
858        });
859        $('.lean-gallery-wrapper .thumbs a').unbind('click').click(function () {
860            lean_thumbs.goToSlide($(this).data('slide'));
861            return false;
862        });
863    }
864
865    function initNewMediaGallery( startNum ){
866        if(!startNum){
867            startNum = 1;
868        }
869        $('.newmedia-gallery-wrapper,.backdrop').fadeIn();
870        var newmedia_thumbs = $('#newmedia-gallery').slippry({
871            slippryWrapper: '<div class="slippry_box thumbnails" />',
872            transition: 'horizontal',
873            pager: false,
874            auto: false,
875            captions: false,
876            start: startNum,
877            onSlideBefore: function (el, index_old, index_new) {
878                $('.newmedia-gallery-wrapper .thumbs a img').removeClass('active');
879                $('img', $('.newmedia-gallery-wrapper .thumbs a')[index_new]).addClass('active');
880            }
881        });
882        $('.newmedia-gallery-wrapper .thumbs a').unbind('click').click(function () {
883            newmedia_thumbs.goToSlide($(this).data('slide'));
884            return false;
885        });
886    }
887
888        //set click event for initializing galleries
889    $('.ratio-gallery-links span,.ratio-gallery-link').click(function(){
890        initRatioGallery( $(this).data('slide') );
891    });
892    $('.lean-gallery-link').click(function(){
893      console.log('test');
894        initLEANGallery();
895    });
896    $('.newmedia-gallery-link').click(function(){
897        initNewMediaGallery();
898    });
899    if( document.URL.indexOf('show=newmediagallery') > -1 ){
900        initNewMediaGallery();
901    } else if( document.URL.indexOf('show=leangallery') > -1 ){
902        initLEANGallery();
903    } else if( document.URL.indexOf('show=ratiogallery') > -1 ){
904        initRatioGallery();
905    }
906
907        //When to close overlays
908    $('.backdrop,.overlay-close').click(function(){
909        $('.overlay-wrapper,.backdrop').fadeOut();
910    });
911}
912
913//
914// initHeadshotTiles - initializing the user interface for Data Rockstars and Native Predictions (News) item
915//
916var currentHeadshot = null;
917
918function initHeadshotTiles(){
919    var maxNumberHeadshots = $('.tile.headshot').length;
920    $('.tiles-wrapper .tile.headshot, .tiles-wrapper .tile.link.open_headshot').click(function(){
921        $wrapper = $(this).closest('.tiles-wrapper');
922        var id = $(this).data('id');
923        currentHeadshot = id;
924        $('.backdrop').fadeIn();
925        $wrapper.find('.tile-dialog.dialog-' + id).fadeIn();
926    });
927    $('.backdrop,.dialog-close').click(function(){
928        $('.tile-dialog').fadeOut();
929        $('.backdrop').fadeOut();
930        currentHeadshot = null;
931    });
932    if( document.URL.indexOf('winner=') > -1 ){
933        var winnerName = getUrlParameter('winner');
934        $('.tiles-wrapper .tile[data-shortname="' + winnerName + '"]').click();
935    } else if( document.URL.indexOf('show=') > -1 ){
936        var showTarget = getUrlParameter('show');
937        $('.tiles-wrapper .tile[data-shortname="' + showTarget + '"]').click();
938    }
939    $('.dialog-prev').click(function(){
940        $wrapper = $('.tile-dialog:visible').closest('.tiles-wrapper');
941        var maxNumberHeadshots = $wrapper.find('.tile.headshot').length;
942        if(currentHeadshot == 1){
943            currentHeadshot = maxNumberHeadshots;
944        } else {
945            currentHeadshot--;
946        }
947        $('.tile-dialog').fadeOut();
948        $wrapper.find('.tile[data-id="' + currentHeadshot + '"]').click();
949    });
950    $('.dialog-next').click(function(){
951        $wrapper = $('.tile-dialog:visible').closest('.tiles-wrapper');
952        var maxNumberHeadshots = $wrapper.find('.tile.headshot').length;
953        if( currentHeadshot == maxNumberHeadshots ){
954            currentHeadshot = 1;
955        } else {
956            currentHeadshot++;
957        }
958        $('.tile-dialog').fadeOut();
959        $wrapper.find('.tile[data-id="' + currentHeadshot + '"]').click();
960    });
961}
962
963//
964// getUrlParameter - a subroutine to get a parameter's value from the URL
965//
966var getUrlParameter = function getUrlParameter(sParam) {
967    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
968        sURLVariables = sPageURL.split('&'),
969        sParameterName,
970        i;
971    for (i = 0; i < sURLVariables.length; i++) {
972        sParameterName = sURLVariables[i].split('=');
973        if (sParameterName[0] === sParam) {
974            return sParameterName[1] === undefined ? true : sParameterName[1];
975        }
976    }
977};
978
979//
980// initFAQAccordion - Initializing the Q&A accordion
981//
982function initFAQAccordion(){
983    $('.faq-question').click(function(){
984        if( !$(this).hasClass('open') ){
985            $('.faq-answer.open').slideUp();
986            $('.open').removeClass('open');
987            $(this).addClass('open').next('.faq-answer').slideDown().addClass('open');
988        } else {
989            $('.faq-answer.open').slideUp();
990            $('.open').removeClass('open');
991        }
992    });
993}
994
995//
996// initCreativeShowcase - initializing the Creative Lab page
997//
998function initCreativeShowcase(){
999    $('.campaign-tile').click(function(){
1000        var count = $(this).data('count');
1001        if( $(this).data('clickevent') == 'overlay' || !$(this).data('clickevent')){
1002            $('.campaign-dialog[data-count="' + count + '"]').addClass('current').fadeIn();
1003            $('.backdrop').fadeIn();
1004            setCampaignSlideshowHeight();
1005        } else if( $(this).data('clickevent') == 'int_link' ){
1006            window.open($(this).data('url'));
1007        } else if( $(this).data('clickevent') == 'ext_link' ){
1008            window.open($(this).data('url'), '_blank');
1009        }
1010        if( typeof ga !== 'undefined' ) {
1011            if( $(this).find('.campaign-tile-title').length || $(this).data('url').length ){
1012                var title;
1013                if( $(this).find('.campaign-tile-title').length ){
1014                    title = $(this).find('.campaign-tile-title').text();
1015                } else {
1016                    title = $(this).data('url');
1017                }
1018                ga('send', 'event', document.title, 'click', title);
1019            }
1020        }
1021    });
1022    $('.backdrop,.close-dialog').click(function(){
1023        $('.campaign-dialog').removeClass('current').fadeOut();
1024        $('.backdrop').fadeOut();
1025    });
1026    $('.campaign-dialog-prev').click(function(){
1027        var curid = $('.campaign-dialog.current').data('count');
1028        var maxnum = $('.campaign-dialog').length;
1029        var nextid;
1030        if(curid == 1){
1031            nextid = maxnum;
1032        } else {
1033            nextid = curid-1;
1034        }
1035        $('.campaign-dialog.current').removeClass('current').fadeOut();
1036        $('.campaign-dialog[data-count="' + nextid + '"]').addClass('current').fadeIn();
1037    });
1038    $('.campaign-dialog-next').click(function(){
1039        var curid = $('.campaign-dialog.current').data('count');
1040        var maxnum = $('.campaign-dialog').length;
1041        var nextid;
1042        if(curid == maxnum){
1043            nextid = 1;
1044        } else {
1045            nextid = curid+1;
1046        }
1047        $('.campaign-dialog.current').removeClass('current').fadeOut();
1048        $('.campaign-dialog[data-count="' + nextid + '"]').addClass('current').fadeIn();
1049    });
1050    if( $('body').hasClass('page-template-page-inside-influence') ){
1051        $('.campaign-dialog .prev.campaign-dialog-prev,.campaign-dialog .next.campaign-dialog-next').css('top',$(window).height()*.3);
1052    }
1053    if( !isTouchDevice ){
1054        $('.filter-row .filter').hover(
1055            function() {
1056                $( this ).addClass( "open" );
1057                trace( 'desktop hover: add "open" now' );
1058            }, function() {
1059                $( this ).removeClass( "open" );
1060                trace( 'desktop hover: remove "open" now' );
1061            }
1062        );
1063    } else {
1064        $('.filter-row .filter').on('click', function(e) {
1065            if (e.target !== this){
1066                trace('mobile click hit child element, not toggling');
1067                return;
1068            }
1069            $(this).toggleClass('open');
1070            trace( 'mobile click: toggle "open" now' );
1071        });
1072    }
1073
1074    if( $.urlParam('show') ){
1075        $( '.filter-row .filter ul li.' + $.urlParam('show') + ' ' ).not( '.category-title' ).addClass('selected');
1076        filterCampaigns( $.urlParam('show') );
1077    }
1078
1079    $('.filter-row .filter ul li').click(function(){
1080        if( $(this).hasClass('selected') ){
1081            $(this).removeClass('selected');
1082        } else {
1083            $(this).siblings('li.selected').removeClass('selected');
1084            $(this).toggleClass('selected');
1085        }
1086        filterCampaigns( $(this).data('type') );
1087        trace( 'remove "open" now' );
1088        $('.filter-row .filter.open').removeClass('open');
1089    });
1090
1091    $('.viewall').click(function(){
1092        filterCampaigns( 'clear' );
1093    });
1094
1095    $('.slideshow-wrapper').each(function(){
1096        var el = $(this);
1097        var count = el.find('.slideshow').attr('id').replace('slideshow','');
1098        el.find('.slideshow-nav .button').click(function(){
1099            if( !$(this).hasClass('current') ){
1100                el.find('.button.current').removeClass('current');
1101                $(this).addClass('current');
1102                campaignSlideshow( $(this).index(), count);
1103            }
1104        });
1105    });
1106
1107    if( $.urlParam('v') ){
1108        $('.campaign-tile[data-count="' + $.urlParam('v') + '"]').click();
1109    }
1110
1111    if( $.urlParam('c') ){
1112        $('.filter.categories ul li[data-value="' + $.urlParam('c') + '"]').click();
1113    }
1114
1115    var div, n,
1116        v = document.getElementsByClassName("youtube-player");
1117    for (n = 0; n < v.length; n++) {
1118        div = document.createElement("div");
1119        div.setAttribute("data-id", v[n].dataset.id);
1120        div.innerHTML = youtubeEmbedThumb(v[n].dataset.id);
1121        div.onclick = youtubeEmbedIframe;
1122        v[n].appendChild(div);
1123    }
1124
1125    function youtubeEmbedThumb(id) {
1126        var thumb = '<img src="https://i.ytimg.com/vi/ID/hqdefault.jpg">',
1127            play = '<div class="play"></div>';
1128        return thumb.replace("ID", id) + play;
1129    }
1130
1131    function youtubeEmbedIframe() {
1132        var iframe = document.createElement("iframe");
1133        var embed = "https://www.youtube.com/embed/ID?autoplay=0";
1134        iframe.setAttribute("src", embed.replace("ID", this.dataset.id));
1135        iframe.setAttribute("frameborder", "0");
1136        iframe.setAttribute("allowfullscreen", "1");
1137        this.parentNode.replaceChild(iframe, this);
1138    }
1139
1140    function filterCampaigns( type ){
1141        var urlparam = '';
1142
1143        if( type == 'clear' || $('.filter-row .filter ul li.selected').length < 1 ){
1144
1145            $('.selected').removeClass('selected');
1146            $('.campaign-tile').each(function(){
1147                $(this).fadeIn();
1148            });
1149
1150        } else {
1151
1152            $('.campaign-tile').each(function(){
1153                $(this).fadeIn();
1154            });
1155
1156            $('.filter-row .filter').each(function(){
1157                var thisType = $(this).data('type');
1158                var numberSelected = $(this).find('.selected').length;
1159
1160                if( numberSelected < 1 ){
1161                    return true;
1162                }
1163
1164                var type = $(this).data('type');
1165
1166                var valuesArray = [];
1167                $('li[data-type="' + type + '"].selected').each(function(){
1168                    valuesArray.push( $(this).data('value').toString() );
1169                });
1170
1171                $('.campaign-tile').each(function(){
1172
1173                    var curValuesArray = $(this).attr('data-' + type).replace(' ','').split(',');
1174
1175                    var pass = false;
1176                    for (var i = 0; i < curValuesArray.length; ++i) {
1177                        if( ($.inArray( curValuesArray[i], valuesArray) !== -1) || ( curValuesArray[i] == valuesArray ) ){
1178                            pass = true;
1179                        } else {
1180                            //trace('fail..');
1181                        }
1182                    }
1183
1184                    if( pass ){
1185                        //$(this).fadeIn();
1186                    } else {
1187                        $(this).fadeOut();
1188                    }
1189                });
1190
1191            });
1192
1193            if( $('.campaign-tile:visible').length < 1 ){
1194                $('.no-results').fadeIn();
1195            } else {
1196                $('.no-results').fadeOut();
1197            }
1198        }
1199    }
1200
1201    function campaignSlideshow( change, count ){
1202        var $wrapper = $('#slideshow' + count);
1203        var currentSlideNum = $wrapper.find('.current').index();
1204        var targetSlideNum = null;
1205        var totalSlideCount = $wrapper.find('li').length - 1;
1206
1207        if( change == 'prev' ){
1208            if( currentSlideNum == 0 ){
1209                targetSlideNum = totalSlideCount;
1210            } else {
1211                targetSlideNum = currentSlideNum - 1;
1212            }
1213        } else if ( change == 'next' ){
1214            if( currentSlideNum == totalSlideCount ){
1215                targetSlideNum = 0;
1216            } else {
1217                targetSlideNum = currentSlideNum + 1;
1218            }
1219        } else {
1220            targetSlideNum = change;
1221        }
1222
1223        $wrapper.find('li').eq(targetSlideNum).addClass('nextUp');
1224        $wrapper.find('li.current').fadeOut().removeClass('current');
1225        $wrapper.find('li.nextUp').fadeIn(null,function(){
1226            setCampaignSlideshowHeight();
1227            setTimeout(function(){
1228                setCampaignSlideshowHeight();
1229            }, 2000);
1230        }).addClass('current').removeClass('nextUp');
1231    }
1232
1233    function setCampaignSlideshowHeight(){
1234        $('.slideshow:visible').each(function(){
1235            var count = $(this).attr('id').replace('slideshow','');
1236            var slideHeight = null;
1237            var $currentSlide = $('#slideshow' + count + ' li.current');
1238
1239            if( $currentSlide.find('div.youtube-player').length ) {
1240                slideHeight = $currentSlide.find('div.youtube-player').outerHeight();
1241            } else if( $currentSlide.find('img').length ){
1242                slideHeight = $currentSlide.find('img').height();
1243            } else if( $currentSlide.find('iframe').length ) {
1244                slideHeight = $currentSlide.find('iframe').height();
1245            }
1246
1247            if( slideHeight > 0 ){
1248                $('#slideshow' + count).height( slideHeight ).css('min-height',0);
1249            } else {
1250                $('#slideshow' + count).css('min-height','315px');
1251            }
1252        });
1253    }
1254}
1255
1256//
1257// initCrossPlatformCreativeShowcase - initializing the Creative Lab Cross Platform page
1258//
1259function initCrossPlatformCreativeShowcase(){
1260        //init jquery ui tabs in each campaign dialog
1261    $('.campaign-tab-wrapper').each(function(){
1262        var curId = $(this).attr('id');
1263        $('#' + curId).tabs();
1264    });
1265
1266        //init click event on campaign thumb
1267    $('.campaign-tile').click(function(){
1268        var count = $(this).data('count');
1269        $('.campaign-dialog[data-count="' + count + '"]').addClass('current').fadeIn(null,function(){
1270            $(this).height(  $(this).height( $(window).outerHeight()*.8 ) );
1271            $('html').addClass('fixed-scroll');
1272        });
1273        $('.backdrop').fadeIn();
1274        setCampaignSlideshowHeight();
1275    });
1276
1277        //init click event to close dialog
1278    $('.backdrop,.close-dialog').click(function(){
1279        $('.campaign-dialog').fadeOut();
1280        $('.backdrop').fadeOut();
1281        $('html').removeClass('fixed-scroll');
1282    });
1283
1284        //init slideshow and slideshow nav
1285    $('.slideshow-wrapper').each(function(){
1286        var el = $(this);
1287        var id = el.find('.slideshow').attr('id');
1288        el.find('.slideshow-nav .button').click(function(){
1289            if( !$(this).hasClass('current') ){
1290                el.find('.button.current').removeClass('current');
1291                $(this).addClass('current');
1292                campaignSlideshow( $(this).index(), id);
1293            }
1294        });
1295    });
1296
1297        // set up youtube video player
1298    var div, n,
1299        v = document.getElementsByClassName("youtube-player");
1300    for (n = 0; n < v.length; n++) {
1301        div = document.createElement("div");
1302        div.setAttribute("data-id", v[n].dataset.id);
1303        div.innerHTML = youtubeEmbedThumb(v[n].dataset.id);
1304        div.onclick = youtubeEmbedIframe;
1305        v[n].appendChild(div);
1306    }
1307
1308    function youtubeEmbedThumb(id) {
1309        var thumb = '<img src="https://i.ytimg.com/vi/ID/hqdefault.jpg">',
1310            play = '<div class="play"></div>';
1311        return thumb.replace("ID", id) + play;
1312    }
1313
1314    function youtubeEmbedIframe() {
1315        var iframe = document.createElement("iframe");
1316        var embed = "https://www.youtube.com/embed/ID?autoplay=0";
1317        iframe.setAttribute("src", embed.replace("ID", this.dataset.id));
1318        iframe.setAttribute("frameborder", "0");
1319        iframe.setAttribute("allowfullscreen", "1");
1320        this.parentNode.replaceChild(iframe, this);
1321    }
1322
1323    function campaignSlideshow( change, id ){
1324        var $wrapper = $('#' + id);
1325        var currentSlideNum = $wrapper.find('.current').index();
1326        var targetSlideNum = null;
1327        var totalSlideCount = $wrapper.find('.slide').length - 1;
1328
1329        if( change == 'prev' ){
1330            if( currentSlideNum == 0 ){
1331                targetSlideNum = totalSlideCount;
1332            } else {
1333                targetSlideNum = currentSlideNum - 1;
1334            }
1335        } else if ( change == 'next' ){
1336            if( currentSlideNum == totalSlideCount ){
1337                targetSlideNum = 0;
1338            } else {
1339                targetSlideNum = currentSlideNum + 1;
1340            }
1341        } else {
1342            targetSlideNum = change;
1343        }
1344
1345        $wrapper.find('.slide').eq(targetSlideNum).addClass('nextUp');
1346        $wrapper.find('.slide.current').fadeOut().removeClass('current');
1347        $wrapper.find('.slide.nextUp').fadeIn(null,function(){
1348            setCampaignSlideshowHeight();
1349            setTimeout(function(){
1350                setCampaignSlideshowHeight();
1351            }, 2000);
1352        }).addClass('current').removeClass('nextUp');
1353    }
1354
1355    function setCampaignSlideshowHeight(){
1356        $('.slideshow:visible').each(function(){
1357            var id = $(this).attr('id');
1358            var slideHeight = null;
1359            var $currentSlide = $('#' + id + ' .slide.current');
1360
1361            if( $currentSlide.find('div.youtube-player').length ) {
1362                slideHeight = $currentSlide.find('div.youtube-player').outerHeight();
1363            } else if( $currentSlide.find('img').length ){
1364                slideHeight = $currentSlide.find('img').height();
1365            } else if( $currentSlide.find('iframe').length ) {
1366                slideHeight = $currentSlide.find('iframe').height();
1367            }
1368
1369            if( slideHeight > 0 ){
1370                $('#' + id).height( slideHeight ).css('min-height',0);
1371            } else {
1372                $('#' + id).css('min-height','315px');
1373            }
1374        });
1375    }
1376}
1377
1378/**
1379 * Get a URL parameter
1380 * $.urlParam('member')
1381 */
1382$.urlParam = function(name){
1383    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
1384    if (results==null){
1385        return null;
1386    }
1387    else{
1388        return results[1] || 0;
1389    }
1390};
1391
1392//
1393// initSinglePageEventTemplate - initializing code for the single page event template
1394//
1395function initSinglePageEventTemplate(){
1396    var nav = $('.page-nav');
1397    var offset = $('.page-nav').offset().top;
1398
1399    $(window).scroll(function() {
1400        if( $(this).scrollTop() > offset ) {
1401            nav.addClass('page-nav-stuck');
1402        } else {
1403            nav.removeClass('page-nav-stuck');
1404        }
1405    });
1406
1407    $("a.nav-link").on('click', function(event) {
1408        if (this.hash !== "") {
1409            event.preventDefault();
1410            var hash = this.hash;
1411            if( hash.length ){
1412                $('html, body').animate({
1413                    scrollTop: $(hash).offset().top-200
1414                }, 800, function(){
1415                    window.location.hash = hash;
1416                });
1417            }
1418        }
1419    });
1420
1421    $('.mobile-menu-btn').click(function(){
1422        $('.page-nav-wrapper').css('top', $('.page-nav').height() + $('.page-nav').position().top );
1423        $('.page-nav-wrapper').toggleClass('visible');
1424        $('.mobile-menu-btn').toggleClass('open');
1425    });
1426
1427    $('.page-nav-wrapper a.nav-link').click(function(){
1428        $('.page-nav-wrapper').removeClass('visible');
1429    });
1430
1431    $('.speaker').click(function(){
1432        var count = $(this).data('count');
1433        var $wrapper = $(this).closest('section');
1434        $wrapper.find('.speaker-' + count).fadeIn(null, function(){
1435            var $target = $('.speaker-' + count);
1436            var pageNavHeight = $('.page-nav').height() + $('.page-nav').position().top;
1437            $target.css({
1438                'top': pageNavHeight + 25,
1439                'height': $(window).height() - pageNavHeight - 30
1440            });
1441        });
1442    });
1443    $('.close-speaker-dialog').click(function(){
1444        $('.speaker-dialog').fadeOut();
1445    });
1446    $('.logo-dialog-link.has-dialog').click(function(){
1447        var count = $(this).data('count');
1448        $('.logo-' + count).fadeIn();
1449    });
1450    $('.close-logo-dialog').click(function(){
1451        $('.logo-dialog').fadeOut();
1452    });
1453
1454    var wrapper = $('#slider');
1455    setHeight(wrapper);
1456    var slider = wrapper.unslider({
1457        autoplay: true,
1458        delay: 5000,
1459        nav: true,
1460        arrows: false,
1461        animation: 'fade',
1462        animateHeight: true
1463    });
1464    wrapper.height('initial');
1465    setTimeout(function(){ setHeight(wrapper); }, 3000);
1466    $('#slider ul li').show();
1467
1468    function setHeight(target){
1469        var height = 150;
1470        target.find('li').each(function(){
1471            if( $(this).height() > height ){
1472                height = $(this).height();
1473            }
1474        });
1475        target.height( height );
1476    }
1477
1478    /**
1479     * Ensure the first tab of an agenda always loads.
1480     */
1481    $('#agenda #tab__1').on('click touchend', function() {
1482      if (typeof $('#agenda #tab__1__content') != 'undefined') {
1483        $('#agenda #tab__1__content').addClass('active');
1484      }
1485    });
1486}
1487
1488jQuery( document ).ready(function() {
1489    jQuery("#module-hero-module__footer-container-mobile-id").on("shown", function() {
1490        jQuery('.module-hero-module__footer-header-action-mobile i')
1491            .removeClass()
1492            .addClass('bold iabicon-arrow-in-circle-up');
1493    });
1494
1495    jQuery("#module-hero-module__footer-container-mobile-id").on("hidden", function() {
1496        jQuery('.module-hero-module__footer-header-action-mobile i')
1497            .removeClass()
1498            .addClass('bold iabicon-arrow-in-circle-down');
1499    });
1500});

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.