AOS.init({
/*easing: 'ease-in-out-sine'*/
//easing: 'ease-out-back',
duration: 1000
});
$("img.unveilImage").unveil(200);
$(".default_office img").unveil(200, function() {
$(this).load(function() {
console.log("default office loaded");
$("footer .office_info img").trigger('unveil');
});
});
$(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[data-id='"+$(this).data("id")+"']").addClass("current");
$(".highlight-image-container-home").removeClass("current");
$(".highlight-image-container-home[data-id='"+$(this).data("id")+"']").addClass("current");
$("#home #nav_numbers li").removeClass("current");
$("#home #nav_numbers li[data-id='"+$(this).data("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_main_body li[data-id='"+$(this).data("id")+"']").addClass("current");
$("#nav_numbers li").removeClass("current");
$("#nav_numbers li[data-id='"+$(this).data("page-id")+"']").addClass("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-home").hover(function() {
$("#nav_main_home li").removeClass("current");
$("#nav_main_home li[data-id='"+$(this).data("id")+"']").addClass("current");
$("#nav_numbers li").removeClass("current");
$("#nav_numbers li[data-id='"+$(this).data("id")+"']").addClass("current");
$(".highlight-image-container-home").removeClass("current");
$(".highlight-image-container-home[data-id='"+$(this).data("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").hover(function(){
$(".curve-menu-img").attr("src",$(".curve-menu-img").attr("data-src"));
$(".menu-cs-big-image[data-id=01] img").attr("src",$(".menu-cs-big-image[data-id=01] img").attr("data-src"));
$(".menu-cs-big-image[data-id=02] img").attr("src",$(".menu-cs-big-image[data-id=02] img").attr("data-src"));
$(".menu-cs-big-image[data-id=03] img").attr("src",$(".menu-cs-big-image[data-id=03] img").attr("data-src"));
$(".menu-cs-big-image[data-id=04] img").attr("src",$(".menu-cs-big-image[data-id=04] img").attr("data-src"));
$(".menu-cs-big-image[data-id=05] img").attr("src",$(".menu-cs-big-image[data-id=05] img").attr("data-src"));
$(".menu-cs-big-image[data-id=06] img").attr("src",$(".menu-cs-big-image[data-id=06] img").attr("data-src"));
$(".menu-cs-big-image[data-id=07] img").attr("src",$(".menu-cs-big-image[data-id=07] img").attr("data-src"));
$(".menu-cs-big-image[data-id=08] img").attr("src",$(".menu-cs-big-image[data-id=08] img").attr("data-src"));
$(".menu-cs-big-image[data-id=09] img").attr("src",$(".menu-cs-big-image[data-id=09] img").attr("data-src"));
$(".menu-cs-big-image[data-id=10] img").attr("src",$(".menu-cs-big-image[data-id=10] img").attr("data-src"));
$(".menu-cs-big-image[data-id=11] img").attr("src",$(".menu-cs-big-image[data-id=11] img").attr("data-src"));
$(".menu-cs-big-image[data-id=12] img").attr("src",$(".menu-cs-big-image[data-id=12] img").attr("data-src"));
$(".menu-cs-big-image[data-id=13] img").attr("src",$(".menu-cs-big-image[data-id=13] img").attr("data-src"));
$(".menu-cs-big-image[data-id=14] img").attr("src",$(".menu-cs-big-image[data-id=14] img").attr("data-src"));
$(".menu-cs-big-image[data-id=15] img").attr("src",$(".menu-cs-big-image[data-id=15] img").attr("data-src"));
$(".menu-cs-big-image[data-id=16] img").attr("src",$(".menu-cs-big-image[data-id=16] img").attr("data-src"));
});
$(".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();
$(".nav-and-language a i.fa-envelope").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();
$(".nav-and-language a i.fa-envelope").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() {
if ($('body').attr('data-language-page-name')==''){
$('.slideshow_text').html($('body').attr('data-page-name'));
}else{
$('.slideshow_text').html($('body').attr('data-language-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=1714224285';
$('.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()*.5);
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_this_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, ' '));
};
function newsletterSticky() {
if ($(window).width() >= 768) {
$("#newsletter").sticky({topSpacing:30,bottomSpacing:700});
}
else {
$("#newsletter").unstick();
}
}
$(document).ready(function(){
var available_height = parseInt($(window).height()-60);
var full_width_video_height = parseInt(($(window).width() * 1080)/1920);
var full_height_video_width = parseInt((($(window).height()-60) * 1920)/1080);
if (full_width_video_height > available_height){
var full_height_video_margin_left = ($(window).width() - full_height_video_width) / 2;
$("iframe.iframe-video").css("width",full_height_video_width + "px");
$("iframe.iframe-video").css("height",available_height + "px");
$("iframe.iframe-video").css("margin-left",full_height_video_margin_left + "px");
$(".video-js:not(.streamvidplayer)").css("padding-top","0");
$(".video-js:not(.streamvidplayer)").css("height",available_height+"px");
$(".cs-video").css("background-color","#000000");
$(".cs-video").css("height",available_height + "px");
$(".cs-video").css("padding-bottom",0);
$(".cs-video-img").css("padding-bottom",0);
$(".cs-video-img").css("height",available_height + "px");
}
if ($("#stream-body #newsletter").length) {
newsletterSticky();
$(window).on("resize", function() {
newsletterSticky();
});
}
});