/* FitVids 1.1 */ !function(t){"use strict";t.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var r=document.head||document.getElementsByTagName("head")[0],a=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}",d=document.createElement("div");d.innerHTML='

x

",r.appendChild(d.childNodes[1])}return e&&t.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var a=t(this).find(e.join(","));a=a.not("object object"),a=a.not(r),a.each(function(e){var i=t(this);if(!(i.parents(r).length>0||"embed"===this.tagName.toLowerCase()&&i.parent("object").length||i.parent(".fluid-width-video-wrapper").length)){i.css("height")||i.css("width")||!isNaN(i.attr("height"))&&!isNaN(i.attr("width"))||(i.attr("height",9),i.attr("width",16));var a="object"===this.tagName.toLowerCase()||i.attr("height")&&!isNaN(parseInt(i.attr("height"),10))?parseInt(i.attr("height"),10):i.height(),d=isNaN(parseInt(i.attr("width"),10))?i.width():parseInt(i.attr("width"),10),o=a/d;if(!i.attr("id")){var h="fitvid"+e;i.attr("id",h)}i.wrap('
').parent(".fluid-width-video-wrapper").css("padding-top",100*o+"%"),i.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto); jQuery(document).ready(function($){ /* STICKY HEADER */ var stickymenu = document.getElementById("header") var stickymenuoffset = stickymenu.offsetTop var scrolltimer window.addEventListener("scroll", function(e){ requestAnimationFrame(function(){ if (window.pageYOffset > stickymenuoffset){ stickymenu.classList.add('sticky'); document.getElementById("gotop").classList.add('active'); } else{ stickymenu.classList.remove('sticky'); document.getElementById("gotop").classList.remove('active'); } }) }); $('.wrap').fitVids(); $('.flexslider').flexslider({ animation: "slide", animationLoop: true, itemWidth: 290, itemMargin: 10, minItems: 2, maxItems: 2, controlNav: true, directionNav: true }); $(".validate").validate( ); // Show header search box $("#nav li.search a").on('click', function() { //$("#nav").addClass("hidden"); $("#nav #searchform").fadeIn(0); $("#nav #searchform #text").focus(); }); // Hide header search box on click outside $(document).mouseup(function (e) { var container = $("#nav #searchform"); if (!container.is(e.target) && container.has(e.target).length === 0) {// ... nor a descendant of the container container.hide(); //$("#nav").removeClass("hidden"); } }); function openFancybox() { setTimeout( function() { $('#newsletter-fancy').trigger('click'); }, 1500); } /* var visited = $.cookie('visited'); if (visited == 'yes') { return false; } else { openFancybox(); } */ openFancybox(); $(".popup, .fancybox, #newsletter-fancy").fancybox({ width : '590', height : '750', maxWidth : '99%', maxHeight : '99%', toolbar : false, smallBtn : true, iframe : { preload : true } }); /***** Mobile Nav *******/ et_duplicate_menu( $('#nav'), $('#header .mobile_nav'), 'mobile_menu', 'et_mobile_menu' ); function et_duplicate_menu( menu, append_to, menu_id, menu_class ){ var $cloned_nav; menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( append_to ); $cloned_nav = append_to.find('> ul'); //$cloned_nav.find('.menu_slide').remove(); $cloned_nav.find('li:first').addClass('et_first_mobile_item'); append_to.click( function(){ if ( $(this).hasClass('closed') ){ $(this).removeClass( 'closed' ).addClass( 'opened' ); $cloned_nav.slideDown( 500 ); } else { $(this).removeClass( 'opened' ).addClass( 'closed' ); $cloned_nav.slideUp( 500 ); } return false; } ); append_to.find('a').click( function(event){ event.stopPropagation(); } ); } $(".et_mobile_menu .with-side > a").click(function(){ //alert ("!!"); var ul = $(this).next("ul"); if ( ul.hasClass('closed') ){ ul.slideDown( 500 ); ul.removeClass( 'closed' ).addClass( 'opened' ); } else { ul.slideUp( 500 ); ul.removeClass( 'opened' ).addClass( 'closed' ); } e.preventDefault(); event.stopPropagation(); }); jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 1100, margin: 0 }, settings); return this.each(function(){ var caller = this jQuery(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = jQuery(caller).attr("href") var destination = jQuery(elementClick).offset().top - settings.margin; jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { window.location.hash = elementClick }); return false; }) }) } $("a.anchor").anchorAnimate({ speed : 500, margin: 0 }) });