AOS.init({ /*easing: 'ease-in-out-sine'*/ //easing: 'ease-out-back', duration: 1000 }); $(document).ready(function(){ adjustTitles(); $(".highlight-image-overlay").hover(function() { $("#number_side").html($(this).data("id")); }); $(".synced-number-links li").hover(function() { $("#nav_main_home li").removeClass("current"); $("#nav_main_home li[data-id='"+$(this).data("id")+"']").addClass("current"); $("#nav_main_body li").removeClass("current"); $("#nav_main_body li[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $("#nav_numbers li").removeClass("current"); $("#nav_numbers li[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $(".highlight-image-container").removeClass("current"); $(".highlight-image-container[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $(".highlight-image-container-home").removeClass("current"); $(".highlight-image-container-home[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $("#number_side").html($(this).data("id")); $("#number_side_wwd").html($(this).data("id")); }); $(".highlight-image-container").hover(function() { $("#nav_main_home li").removeClass("current"); $("#nav_main_home li[data-id='"+$(this).data("id")+"']").addClass("current"); $("#nav_main_body li").removeClass("current"); $("#nav_main_body li[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $("#nav_numbers li").removeClass("current"); $("#nav_numbers li[data-id='"+$(this).data("page-id")+"']").addClass("current"); $(".highlight-image-container").removeClass("current"); $(".highlight-image-container[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $(".highlight-image-container-home").removeClass("current"); $(".highlight-image-container-home[data-page-id='"+$(this).data("page-id")+"']").addClass("current"); $("#number_side").html($(this).data("id")); $("#number_side_wwd").html($(this).data("id")); }); $("#section_careers .open-jobs .job-link").click(function() { if($(this).hasClass('current')) { $(this).removeClass("current"); $(this).next('.job-description').slideUp(); }else{ //$("#section_careers .open-jobs .job-link").removeClass("current"); //$("#section_careers .open-jobs .job-description").slideUp(); $(this).addClass("current"); $(this).next().slideDown(); } }); $(".top-nav-numbers #nav_numbers li").hover(function() { $(".top-nav-numbers #nav_numbers li").removeClass("current"); $(this).addClass("current"); $(".menu-cs-big-image").hide(); $(".menu-cs-big-image[data-id="+$(this).data("id")+"]").show(); $(".menu-cs-text").hide(); $(".menu-cs-text[data-id="+$(this).data("id")+"]").show(); }); $(".leadership-link-names span").hover(function() { $(".leadership-link-names span").removeClass("current"); $(".leadership-bio-text div.bio").removeClass("current"); $(this).addClass("current"); $(".leadership-bio-text div.bio[data-id='"+$(this).data("id")+"']").addClass("current"); //$("col-xs-4.col-xs-offset-5.no_pad_right.leadership-bio-text").css("height","50em"); $(".leadership-thumbnail").attr("src",($(".leadership-thumbnail").attr("data-image"+$(this).data("id")))); $(".leadership-big-bio-img").attr("src",($(".leadership-big-bio-img").attr("data-image"+$(this).data("id")))); }); $(".cs-leadership-bio-row .bio-links-names div, .cs-leadership-bio-row .bio-img img").mouseenter(function() { var id = $(this).attr('data-id'); $(".cs-leadership-bio-row .bio-links-names div").removeClass('strike-through'); $(".cs-leadership-bio-row .bio-links-names div[data-id='"+id+"']").addClass('strike-through'); $(".cs-leadership-bio-row .bio-img").removeClass('dim'); $(".cs-leadership-bio-row .bio-img img[data-id='"+id+"']").closest('.bio-img').addClass('dim'); }); $(".cs-leadership-bio-row .bio-links-names div, .cs-leadership-bio-row .bio-img img").mouseout(function() { $(".cs-leadership-bio-row .bio-img").removeClass('dim'); $(".cs-leadership-bio-row .bio-links-names div").removeClass('strike-through'); }); $(".cs-leadership-bio-row .bio-links-names div, .cs-leadership-bio-row .bio-img img").click(function() { var id = $(this).attr('data-id'); if($(".cs-leadership-bio-row .bio-links-names div[data-id='"+id+"']").hasClass('current')) { return; } $(".cs-leadership-bio-row .bio-links-names div").removeClass('strike-through').removeClass('current'); $(".cs-leadership-bio-row .bio-links-names div[data-id='"+id+"']").addClass('current'); $(".cs-leadership-bio-row .bio-img").removeClass('dim').removeClass('current'); $(".cs-leadership-bio-row .bio-img img[data-id='"+id+"']").closest('.bio-img').addClass('current'); $(".cs-bio-text").not(".cs-bio-text-"+id).fadeOut(function() { $(".cs-bio-text-"+id).fadeIn(); }); }); $(".hamburger").click(function(){ if ($(this).hasClass("active")){ $('#menu').css('overflow','hidden'); $("#menu").css("height","0"); $("#nav_language").show(); $(".hamburger").removeClass("active"); $(document).unbind('scroll'); $('body').css({'overflow':'visible'}); $('.menu-search-trigger').show(); $('.country-button-wrap').show(); $('.nav-and-language .dropdown-toggle-mobile').show(); }else{ $('.start-arrow').hide(); $('#menu').css('overflow-x','hidden'); $('#menu').css('overflow-y','auto'); $("#nav_language").hide(); $("#menu").css("height","calc(100% - 60px)"); $(".hamburger").addClass("active"); $('body').css({'overflow':'hidden'}); $(document).bind('scroll',function () {window.scrollTo(0,0);}); $('.menu-search-trigger').hide(); $('.country-button-wrap').hide(); $('.nav-and-language .dropdown-toggle-mobile').hide(); } }); $("#nav_countries li.region_names").hover(function() { $("footer #nav_countries li.region_names span").removeClass("current"); console.log($(this)); $(this).find("span").addClass("current"); $("footer .region_city_images").removeClass("visible_region"); $("footer .region_city_links").removeClass("visible_region"); $(".region"+$(this).data("regionid")).addClass("visible_region"); }); $("#nav_cities li").hover(function() { $(".region"+$(this).data("regionid")+" #nav_cities li").removeClass("current"); $(this).addClass("current"); $("footer .region"+$(this).data("regionid")+" .office_info").removeClass("visible_office"); $("footer .office_info[data-id="+$(this).data("id")+"]").addClass("visible_office"); }); $('#stream_nav .fa-search').hover(function() { $('#stream_nav #search-string').fadeIn(); }); /* $("#home-video").bind("ended", function() { $("#home-video").fadeOut(); $("#home-video-background").fadeIn(); $(".page-id-14 #view_more").animate({opacity:1,margin: "-50px 0 0 -100px"}, 1000, function() {}); $('#view_more').addClass('aos-animate'); }); */ $('.region-trigger').click( function(e) { e.preventDefault(); var region = $(this).attr('data-group'); if($(this).hasClass('collapsed')) { $(this).removeClass('collapsed'); }else{ $(this).addClass('collapsed'); } $('.jobs_group_'+region).slideToggle(); }); $('.u-accordion-trigger').click( function(e) { e.preventDefault(); var which = $(this).attr('data-group'); if($(this).hasClass('collapsed')) { $(this).removeClass('collapsed'); }else{ $(this).addClass('collapsed'); } $('.u-accordion-content-'+which).slideToggle(); }) var findvar = getUrlParameter('find'); var triggername = getUrlParameter('name'); if(findvar!='') { var target = $('span[data-name="'+triggername+'"]'); target.trigger('mouseenter'); window.find(findvar); } }); $(window).ready(function() { setTimeout(fadeSlideshowText, 3500); balanceRightSideLabel(); }); $(window).resize(function() { adjustTitles(); balanceRightSideLabel(); }); function fadeSlideshowText () { if(!$('body').hasClass('parent-id-3')) { // not contact city pages $('.slideshow_text').fadeOut('slow', function() { $('.slideshow_text').html($('body').attr('data-page-name')); $('.slideshow_text').fadeIn('slow'); }); } } $(document).ready(function() { $('.setFirstAjax,.setPrevAjax,.setCountAjax,.setNextAjax,.setLastAjax').click(function(e) { var active = parseInt($('.pagination').attr('data-active-page')); var maxpage = parseInt($('.setLastAjax').attr('data-max-page')); var action = $(this).attr('data-page'); switch(action) { case 'first': var newActive = 1; break; case 'prev': var newActive = (active - 1); if(newActive<0) { newActive=1; } break; case 'next': var newActive = (active + 1); if(newActive>maxpage) { newActive=maxpage; } break; break; case 'last': var newActive = maxpage; break; break; default: var newActive = parseInt(action); break; } $('.streamSet').hide(function() { }); $('.theset'+newActive).show(); if($('.setWrap'+newActive).html().trim() == '' || $('.setWrap'+newActive).html() == '') { var qs = window.location.search var ajaxurl = '/inc/ajax.stream-page.php?start='+newActive+'&'+qs.replace('?','')+'&u=1513408210'; $('.setWrap'+newActive).html('') .load(ajaxurl); } $('.pagination li.active').removeClass('active'); $('.pagination .set'+newActive).closest('li').addClass('active'); $('.pagination').attr('data-active-page',newActive); // float indicator in middle $('.pagination .setCountAjax').closest('li').addClass('hide'); if(newActive>=5 && newActive<=(maxpage-3)) { $('.pagination .set'+(newActive-1)).closest('li').removeClass('hide'); $('.pagination .set'+(newActive-2)).closest('li').removeClass('hide'); $('.pagination .set'+(newActive-3)).closest('li').removeClass('hide'); $('.pagination .set'+(newActive)).closest('li').removeClass('hide'); $('.pagination .set'+(newActive+1)).closest('li').removeClass('hide'); $('.pagination .set'+(newActive+2)).closest('li').removeClass('hide'); $('.pagination .set'+(newActive+3)).closest('li').removeClass('hide'); }else if(newActive>(maxpage-3)) { $('.pagination .set'+(maxpage)).closest('li').removeClass('hide'); $('.pagination .set'+(maxpage-1)).closest('li').removeClass('hide'); $('.pagination .set'+(maxpage-2)).closest('li').removeClass('hide'); $('.pagination .set'+(maxpage-3)).closest('li').removeClass('hide'); $('.pagination .set'+(maxpage-4)).closest('li').removeClass('hide'); $('.pagination .set'+(maxpage-5)).closest('li').removeClass('hide'); $('.pagination .set'+(maxpage-6)).closest('li').removeClass('hide'); }else{ $('.pagination .set1').closest('li').removeClass('hide'); $('.pagination .set2').closest('li').removeClass('hide'); $('.pagination .set3').closest('li').removeClass('hide'); $('.pagination .set4').closest('li').removeClass('hide'); $('.pagination .set5').closest('li').removeClass('hide'); $('.pagination .set6').closest('li').removeClass('hide'); $('.pagination .set7').closest('li').removeClass('hide'); } }); }); function readMore(id) { if($('.'+id+'.text_block_read_more').hasClass('open')) { $('.'+id+'.text_block_2').slideUp('slow'); $('.'+id+'.text_block_read_more a').html('READ MORE'); $('.'+id+'.text_block_read_more').removeClass('open'); }else{ $('.'+id+'.text_block_2').slideDown('slow'); $('.'+id+'.text_block_read_more a').html('SHOW LESS'); $('.'+id+'.text_block_read_more').addClass('open'); } } function fixSlideshow(slideshowId) { var bgw = 1600; var bgh = 973; var imgw = 1151; var imgh = 646; var imgt = 97; //slide padding var imgct = 53; //caption padding var imgpt = 770; //pager padding var winw = ($(slideshowId).width()*.7); if (winw>800){ var newBGWidth = parseInt(winw); var newBGHeight = parseInt((bgh*winw)/bgw); var newSlideWidth = parseInt((winw*imgw)/bgw); var newSlideHeight = parseInt((((bgh*winw)/bgw)*imgh)/bgh)+1; var newSlidePaddingTop = parseInt((((((bgh*winw)/bgw)*imgh)/bgh)*imgt)/imgh); var newCaptionPaddingTop = parseInt((((((bgh*winw)/bgw)*imgh)/bgh)*imgct)/imgh); var newPagerPaddingTop = parseInt((((((bgh*winw)/bgw)*imgh)/bgh)*imgpt)/imgh); var newBGMarginBottom = parseInt((bgh*0)); }else{ var newBGWidth = parseInt(winw); var newBGHeight = parseInt((bgh*winw)/bgw); var newSlideWidth = parseInt(winw); var newSlideHeight = parseInt((winw*imgh)/imgw); var newSlidePaddingTop = parseInt(30); var newCaptionPaddingTop = parseInt(0); var newPagerPaddingTop = parseInt((newSlideHeight*imgpt)/imgh); var newBGMarginBottom = parseInt((bgh*0)); } $(slideshowId).css({"height": newBGHeight+"px","margin-bottom":newBGMarginBottom+"px"}); $(slideshowId+" .desktop-slideshow-caption").css({"top": newCaptionPaddingTop+"px"}); $(slideshowId+" .desktop-slideshow-bg img").css({"width": newBGWidth+"px","height":newBGHeight+"px"}); $(slideshowId+" .desktop-slideshow-inner").css({"width": newSlideWidth +"px","height": newSlideHeight + "px","padding-top":newSlidePaddingTop+"px"}); $(slideshowId+" .desktop-slideshow-inner img").css({"width": newSlideWidth +"px","height": newSlideHeight + "px"}); $(slideshowId+" .desktop-slideshow-inner .cs-video").css({"width": newSlideWidth +"px","height": newSlideHeight + "px"}); $(slideshowId+" .desktop-slideshow-inner .cs-video-img").css({"width": newSlideWidth +"px","height": newSlideHeight + "px"}); $(slideshowId+" .cycle-pager").css({"top": newPagerPaddingTop+"px"}); $(slideshowId+" div[data-cycle-timeout]").cycle(); $(slideshowId+" div[data-cycle-timeout]").css({"height": newSlideHeight+"px"}); current_height = $(".desktop-slideshow-innter-container").css("height"); //console.log(current_height); } function fixSlideshows() { $(".desktop-slideshow").each(function() { fixSlideshow("#"+$(this).attr("id")); }); } function adjustTitles() { if($(window).width() > 1100 && !$('body').hasClass('page-id-1') ) { $('.animate_sliding_title_1').not('.coe-sections .animate_sliding_title_1').each(function() { var width = $(this).width(); $(this).siblings('.animate_sliding_title_2').css('display','inline'); var shift = ($(this).siblings('.animate_sliding_title_2').width() * .25); $(this).siblings('.animate_sliding_title_2').css('display','inline-block'); $(this).siblings('.animate_sliding_title_2').css('padding-left',(width-shift-175)+'px'); $(this).siblings('h1').css('display','inline'); shift = ($(this).siblings('h1').width() * .25); $(this).siblings('h1').css('display','inline-block'); $(this).siblings('h1').css('padding-left',(width-shift-175)+'px'); }); $('.div_animate_1').each(function() { var width = $(this).width(); $(this).siblings('.animate_sliding_title_2').css('display','inline'); var shift = ($(this).siblings('.animate_sliding_title_2').width() * .25); $(this).siblings('.animate_sliding_title_2').css('display','inline-block'); $(this).siblings('.animate_sliding_title_2').css('padding-left',(width-shift-175)+'px'); $(this).siblings('h1').css('display','inline'); shift = ($(this).siblings('h1').width() * .25); $(this).siblings('h1').css('display','inline-block'); $(this).siblings('h1').css('padding-left',(width-shift-175)+'px'); }); } (function(){ var setCookie = function (cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; }; var getCookie = function (cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; }; var cookieName = 'is_behind_firewall'; if (!getCookie(cookieName)) { $("") .on('load', function () { setCookie(cookieName, 'no', 10); console.log('Firewall test: No firewalls detected') }) .on('error', function () { //non image or timeout setCookie(cookieName, 'yes', 10); console.log('Firewall test: You are behind the Great Firewall of China'); location.reload(); }) }else{ console.log('Firewall test: is behind firewall? ',getCookie(cookieName)); } })(); } function balanceRightSideLabel() { //center right side text which always seems off unlike left $('.cs-label-right').each(function() { var textw = $(this).width(); var sectionh = $(this).closest('section').height(); var adjust = parseInt((sectionh - textw) / 2); //console.log('tw:'+textw+' sh:'+sectionh+' adj:'+adjust); $(this).css('margin-top',((textw/2)+adjust)+'px'); }); } function getUrlParameter(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(location.search); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); };