jQuery(document).ready(function($){function affixedMenu(){$(window).scroll(function(){var mainMenu=(window.pageYOffset>=$('#ubc7-header').height()+$('#ubc7-unit').height()+$('#ubc7-global-menu').height()+$('#wpadminbar').height());$("#ubc7-unit-menu div.navbar-inner.expand").toggleClass('menu-affix',mainMenu);$(".unit-menu-full").toggleClass('menu-affix',mainMenu);});} $(window).scroll(function(){if($(this).width()>980){var quickjump=(window.pageYOffset>=$('header#ubc7-header').height()+$('div#ubc7-unit').height()+150);$(".quickjump").toggleClass('quickjump-affix',quickjump);} else{$(".quickjump").removeClass('quickjump-affix',quickjump);}});if($(window).width()>=980){affixedMenu();} $(window).resize(function(){$("#primary-secondary .sidenav").css("width",$("#primary-secondary").width());if($(window).width()>=980){affixedMenu();} else{$("#primary-secondary .sidenav").removeClass('sidebar-affix');}});$(window).scroll(function(){var scrollable=$("#container").height()-$("#primary-secondary").height();if($(window).width()>=768&&scrollable>500){var sidebar=(window.pageYOffset>300);$("#primary-secondary .sidenav").toggleClass('sidebar-affix',sidebar);$("#primary-secondary .sidenav").css("width",$("#primary-secondary").width());}});newsCarousel($('.news-wrapper .feed-view-blog'),$('.news-nav'));$(".news-wrapper .feed-shortcode").children(".post").each(function(){var tmpStr="";$(this).children(".entry-summary").children().each(function(){tmpStr+=" "+$(this).text();});var tmpArr=tmpStr.split(" ");var tmpImg=$(this).children(".entry-summary").find("img").attr("src");var readMore=" (Read More)";var max=120;var newStr="";if(tmpArr.length>=max){for(var i=0;i<=max;i++){newStr+=tmpArr[i]+" ";} $(this).children(".entry-summary").html("");$(this).children(".entry-summary").append("

"+newStr+"...

");} $(this).children(".entry-summary").children().css("display","block");});$(window).resize(function(){$(".news-wrapper").css("height",$(".news-wrapper .active").height()*1.2);});function cycleClass(current,nav){current.removeClass('active');if(nav==="next"){if(current.is(':last-child')){current.parent().children().first().addClass('active');} else{current.next().addClass('active');}} else{if(current.is(':first-child')){current.parent().children().last().addClass('active');} else{current.prev().addClass('active');}}} function newsCarousel(menu,nav){menu.children().first().addClass('active');nav.children('a').click(function(e){e.preventDefault();});nav.children('.next-post').click(function(e){cycleClass(menu.children('.active'),"next");});nav.children('.prev-post').click(function(e){cycleClass(menu.children('.active'),"prev");});} var urlHASH=$.trim(decodeURIComponent(window.location.hash.substr(1)));console.log(urlHASH);$(".accordion").find(".accordion-heading").each(function(){if($(this).children("a").text()==urlHASH){$(this).addClass("opened");$(this).children("a").click();}});$('.accordion-toggle').click(function(){$('.accordion-heading').removeClass('opened');$(this).parent('.accordion-heading').toggleClass('opened');});$('.accordion-heading').children(".opened").siblings(".accordion-toggle").addClass("toggle-opened");function uniformHeight(){var maxHeight=0;$('.action-wrapper ul li').children('a').each(function(){if($(this).height()>=maxHeight){maxHeight=$(this).height();}});maxHeight+=42;$('.action-wrapper ul li a').css('min-height',maxHeight);} if($(window).width()>=767){uniformHeight();} $(window).resize(function(){if($(window).width()>=767){uniformHeight();} else{$('.action-wrapper ul li a').css('min-height',0);}});function coolCalendar(){$('.calendar-wrapper ul').children('li').each(function(){var str=$(this).children('span').text().replace(',','');var array=str.split(" ");$(this).children('span').replaceWith("
"+""+array[0]+""+array[1]+""+array[2]+"
");});} coolCalendar();$('footer .ubc7-back-to-top .span2 a').text('Top');$('footer .ubc7-back-to-top .span2 a').attr("href","#");$(window).scroll(function(){if($(this).scrollTop()>=$('header#ubc7-header').height()+$('div#ubc7-unit').height()+2){$('footer .ubc7-back-to-top .span2').css('bottom','-80px');} else{$('footer .ubc7-back-to-top .span2').css('bottom','-150px');}});$('footer .ubc7-back-to-top span2 a').click(function(){$('body').animate({scrollTop:0},800);return false;});$(document).ready(function(){$(".scroll").click(function(event){event.preventDefault();var dest=0;if($(this.hash).offset().top>$(document).height()-$(window).height()){dest=$(document).height()-$(window).height();}else{dest=$(this.hash).offset().top-100;} $('html,body').animate({scrollTop:dest},800,'swing');});});$('.flexslider').append("
");var windowWidth=$(window).width()+50;var leftOffset=$('#ubc7-header').position().left-10;appendHtml('footer','full-length footer-full');$('.alt-color-wrapper').append("
");$('#ubc7-header').append("
");$('#ubc7-unit').append("
");$('#ubc7-unit-menu').append("
");$('.full-length').css({'left':leftOffset*-1,'width':windowWidth});$('.flexslider').css({'left':leftOffset*-1,'width':windowWidth,'max-height':windowWidth/3});$(window).resize(function(){leftOffset=$('#ubc7-header').position().left-10;windowWidth=$(window).width()+50;$('.full-length').css({'left':leftOffset*-1,'width':windowWidth,});$('.flexslider').css({'left':leftOffset*-1,'width':windowWidth,'max-height':windowWidth/3});});$("head").prepend(" ");$(".news-wrapper .feed-view-blog .post .entry-summary div img").parent().addClass("news-image");$(".news-wrapper .feed-view-blog .post .entry-summary div img").parent().siblings().nextAll().css("display","none");$(".calendar-wrapper .feed-shortcode").children(".event-rss-date").each(function(){$(this).children(".event-rss-item").children("li").children("a").attr("target","new");});function appendHtml(location,className,content){if(content===undefined){content="";} $(location).append("
"+content+"
");} var menuHeight=27;function dynamicScrolling(listHeight){$('#menu-custom-menu > li').hover(function(){if($(window).width()>=960){var menuSize=$(this).children('.btn-group').children('.dropdown-menu').children('li').length*listHeight;$(this).children('.btn-group').children('.dropdown-menu').css("height",menuSize-1);}},function(){if(!($(this).children('.btn-group').hasClass('open'))){$(this).children('.btn-group').children('.dropdown-menu').css("height",0);} $(window).click(function(){if(!($('#menu-custom-menu > li').children('.btn-group').hasClass('open'))&&$(window).width()>=960){$('#menu-custom-menu > li').children('.btn-group').children('.dropdown-menu').css("height",0);}});});} function defaultScrolling(){$('#menu-custom-menu > li').children('.btn-group').children('.dropdown-menu').css("height","auto");} if($(window).width()>=960){dynamicScrolling(menuHeight);} else{defaultScrolling();} $(window).resize(function(){if($(window).width()>=960){$('.dropdown-menu').css("height",0);dynamicScrolling(menuHeight);} else{defaultScrolling();}});$('.flexslider .slides a').click(function(e){e.preventDefault();});$.getScript("//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js",function(){var $container=$('#projects-container');$container.isotope({itemSelector:'.item',masonry:{columnWidth:'.sizer'}});projectFocuser(".meped-wrapper",".meped","blue-layout");projectFocuser(".commstrat-wrapper",".commstrat","blue-layout");projectFocuser(".sio-wrapper",".sio","blue-layout");projectFocuser(".rxapp-wrapper",".rxapp","blue-layout");function projectFocuser(project,item,color){$(project).hover(function(){$(this).children(".item").children(item).toggleClass(color);});}});$(window).load(function(){$(".flexslider .slides").children(".flex-slide").each(function(){});});$("a.disable-fancybox").click(function(e){var link=$(this).attr("href");e.preventDefault();console.log("FANCYBOX DISABLED");SaveToDisk(link,link);});function SaveToDisk(fileURL,fileName){if(!window.ActiveXObject){var save=document.createElement('a');save.href=fileURL;save.target='_blank';save.download=fileName||'unknown';var evt=new MouseEvent('click',{'view':window,'bubbles':true,'cancelable':false});save.dispatchEvent(evt);(window.URL||window.webkitURL).revokeObjectURL(save.href);} else if(!!window.ActiveXObject&&document.execCommand){var _window=window.open(fileURL,'_blank');_window.document.close();_window.document.execCommand('SaveAs',true,fileName||fileURL) _window.close();}}});