text: (function($) { "use strict";
  
  	
  	//Navigation
  	
  	jQuery(document).ready(function($){
  		//if you change this breakpoint in the style.css file (or _layout.scss if you use SASS), don't forget to update this value as well
  		var MqL = 1170;
  		//move nav element position according to window width
  		moveNavigation();
  		$(window).on('resize', function(){
  			(!window.requestAnimationFrame) ? setTimeout(moveNavigation, 300) : window.requestAnimationFrame(moveNavigation);
  		});
  
  		//mobile - open lateral menu clicking on the menu icon
  		$('.cd-nav-trigger').on('click', function(event){
  			event.preventDefault();
  			if( $('.cd-main-content').hasClass('nav-is-visible') ) {
  				closeNav();
  				$('.cd-overlay').removeClass('is-visible');
  			} else {
  				$(this).addClass('nav-is-visible');
  				$('.cd-primary-nav').addClass('nav-is-visible');
  				$('.cd-main-header').addClass('nav-is-visible');
  				$('.cd-main-content').addClass('nav-is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
  					$('body').addClass('overflow-hidden');
  				});
  				toggleSearch('close');
  				$('.cd-overlay').addClass('is-visible');
  			}
  		});
  
  		//open search form
  		$('.cd-search-trigger').on('click', function(event){
  			event.preventDefault();
  			toggleSearch();
  			closeNav();
  		});
  
  		//close lateral menu on mobile 
  		$('.cd-overlay').on('swiperight', function(){
  			if($('.cd-primary-nav').hasClass('nav-is-visible')) {
  				closeNav();
  				$('.cd-overlay').removeClass('is-visible');
  			}
  		});
  		$('.nav-on-left .cd-overlay').on('swipeleft', function(){
  			if($('.cd-primary-nav').hasClass('nav-is-visible')) {
  				closeNav();
  				$('.cd-overlay').removeClass('is-visible');
  			}
  		});
  		$('.cd-overlay').on('click', function(){
  			closeNav();
  			toggleSearch('close')
  			$('.cd-overlay').removeClass('is-visible');
  		});
  
  
  		//prevent default clicking on direct children of .cd-primary-nav 
  		$('.cd-primary-nav').children('.has-children').children('a').on('click', function(event){
  			event.preventDefault();
  		});
  		//open submenu
  		$('.has-children').children('a').on('click', function(event){
  			if( !checkWindowWidth() ) event.preventDefault();
  			var selected = $(this);
  			if( selected.next('ul').hasClass('is-hidden') ) {
  				//desktop version only
  				selected.addClass('selected').next('ul').removeClass('is-hidden').end().parent('.has-children').parent('ul').addClass('moves-out');
  				selected.parent('.has-children').siblings('.has-children').children('ul').addClass('is-hidden').end().children('a').removeClass('selected');
  				$('.cd-overlay').addClass('is-visible');
  			} else {
  				selected.removeClass('selected').next('ul').addClass('is-hidden').end().parent('.has-children').parent('ul').removeClass('moves-out');
  				$('.cd-overlay').removeClass('is-visible');
  			}
  			toggleSearch('close');
  		});
  
  		//submenu items - go back link
  		$('.go-back').on('click', function(){
  			$(this).parent('ul').addClass('is-hidden').parent('.has-children').parent('ul').removeClass('moves-out');
  		});
  
  		function closeNav() {
  			$('.cd-nav-trigger').removeClass('nav-is-visible');
  			$('.cd-main-header').removeClass('nav-is-visible');
  			$('.cd-primary-nav').removeClass('nav-is-visible');
  			$('.has-children ul').addClass('is-hidden');
  			$('.has-children a').removeClass('selected');
  			$('.moves-out').removeClass('moves-out');
  			$('.cd-main-content').removeClass('nav-is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
  				$('body').removeClass('overflow-hidden');
  			});
  		}
  
  		function toggleSearch(type) {
  			if(type=="close") {
  				//close serach 
  				$('.cd-search').removeClass('is-visible');
  				$('.cd-search-trigger').removeClass('search-is-visible');
  			} else {
  				//toggle search visibility
  				$('.cd-search').toggleClass('is-visible');
  				$('.cd-search-trigger').toggleClass('search-is-visible');
  				if($(window).width() > MqL && $('.cd-search').hasClass('is-visible')) $('.cd-search').find('input[type="search"]').focus();
  				($('.cd-search').hasClass('is-visible')) ? $('.cd-overlay').addClass('is-visible') : $('.cd-overlay').removeClass('is-visible') ;
  			}
  		}
  
  		function checkWindowWidth() {
  			//check window width (scrollbar included)
  			var e = window, 
  				a = 'inner';
  			if (!('innerWidth' in window )) {
  				a = 'client';
  				e = document.documentElement || document.body;
  			}
  			if ( e[ a+'Width' ] >= MqL ) {
  				return true;
  			} else {
  				return false;
  			}
  		}
  
  		function moveNavigation(){
  			var navigation = $('.cd-nav');
  			var desktop = checkWindowWidth();
  			if ( desktop ) {
  				navigation.detach();
  				navigation.insertBefore('.cd-header-buttons');
  			} else {
  				navigation.detach();
  				navigation.insertAfter('.cd-main-content');
  			}
  		}
  
  
  	
  	//Parallax
  	
  
  			$('.parallax-about').parallax("50%", 0.4);
  
    
    
  
  	//Top Page Slider
  
  	 
  	  $("#owl-top-page-slider").owlCarousel({
  		 
  		navigation: false, 
  		slideSpeed : 300,
  		autoPlay : 3000,
  		singleItem:true
  	 
  	  });
  	 
  
  		
  	//Colorbox single project pop-up
  
  		$(".group1").colorbox({rel:'group1', transition:"fade", maxWidth:'95%', maxHeight:'95%'});
  		$(".youtube").colorbox({iframe:true, innerWidth:940, innerHeight:450});
  		$(".vimeo").colorbox({iframe:true, innerWidth:940, innerHeight:450});
  
  	
  
  
  		
  
  	/* Portfolio Sorting */
  
  
  
  		(function ($) { 
  		
  		
  			var container = $('#projects-grid-masonry');
  			
  			
  			function getNumbColumns() { 
  				var winWidth = $(window).width(), 
  					columnNumb = 1;
  				
  				
  				if (winWidth > 1500) {
  					columnNumb = 3;
  				} else if (winWidth > 1200) {
  					columnNumb = 3;
  				} else if (winWidth > 900) {
  					columnNumb = 2;
  				} else if (winWidth > 600) {
  					columnNumb = 2;
  				} else if (winWidth > 300) {
  					columnNumb = 1;
  				}
  				
  				return columnNumb;
  			}
  			
  			
  			function setColumnWidth() { 
  				var winWidth = $(window).width(), 
  					columnNumb = getNumbColumns(), 
  					postWidth = Math.floor(winWidth / columnNumb);
  
  			}
  			
  			$('#portfolio-filter #filter a').click(function () { 
  				var selector = $(this).attr('data-filter');
  				
  				$(this).parent().parent().find('a').removeClass('current');
  				$(this).addClass('current');
  				
  				container.isotope( { 
  					filter : selector 
  				});
  				
  				setTimeout(function () { 
  					reArrangeProjects();
  				}, 300);
  				
  				
  				return false;
  			});
  			
  			function reArrangeProjects() { 
  				setColumnWidth();
  				container.isotope('reLayout');
  			}
  			
  			
  			container.imagesLoaded(function () { 
  				setColumnWidth();
  				
  				
  				container.isotope( { 
  					itemSelector : '.portfolio-box-3', 
  					layoutMode : 'masonry', 
  					resizable : false 
  				} );
  			} );
  			
  			
  		
  			
  		
  			$(window).on('debouncedresize', function () { 
  				reArrangeProjects();
  				
  			} );
  			
  		
  		} )(jQuery);
  	} );
  
  
  
  
  
  	/* DebouncedResize Function */
  		(function ($) { 
  			var $event = $.event, 
  				$special, 
  				resizeTimeout;
  			
  			
  			$special = $event.special.debouncedresize = { 
  				setup : function () { 
  					$(this).on('resize', $special.handler);
  				}, 
  				teardown : function () { 
  					$(this).off('resize', $special.handler);
  				}, 
  				handler : function (event, execAsap) { 
  					var context = this, 
  						args = arguments, 
  						dispatch = function () { 
  							event.type = 'debouncedresize';
  							
  							$event.dispatch.apply(context, args);
  						};
  					
  					
  					if (resizeTimeout) {
  						clearTimeout(resizeTimeout);
  					}
  					
  					
  					execAsap ? dispatch() : resizeTimeout = setTimeout(dispatch, $special.threshold);
  				}, 
  				threshold : 150 
  			};
  		} )(jQuery);
  		
  
  
  
  
  	
    })(jQuery); 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
  
  
  
  
  
  	