File "scripts.js"

Full Path: /home/limout/public_html/nerduck-theme/js/scripts.js
File size: 30.52 KB
MIME-type: text/plain; charset=us-ascii
Charset: utf-8


jQuery(document).ready(function() {
	
	"use strict";
	
	jQuery('body').waitForImages({
		finished: function() {
			setTimeout( function(){
				jQuery("header,#pre-hero,#hero").removeClass("hidden");  
			} , 500 );
		},
	waitForAll: true
	});
	
	PageAnim();
	ImagesLoad();	
	HideShowMenu();
	HeroHeight();
	HeroScrollTop();
	FullScreenSlider();
	ClassicSlider();
	PageNav();
	MasonryPortfolio();
	ResponsiveMenu();
  	BackToTop();
	Blog();
	MagnificPopup();
	InitContactMap();
	AppearIteam();
	Shortcodes();
	VideoHeader();
});

jQuery(window).on( 'resize', function () {
	HeroHeight();	
});


/*--------------------------------------------------
Function Page Animation
---------------------------------------------------*/	


	function PageAnim() {
		
		var inDuration = 1;
		var loadingParentElement = 'body';
		if( typeof ClapatNerduckThemeOptions != 'undefined' ){
		
			if( ClapatNerduckThemeOptions.enable_preloader ){
				
				inDuration = 1500;
				loadingParentElement = 'html';
			}
		}
		
		jQuery(".animsition").animsition({
	  
		inClass               :   'fade-in',
		outClass              :   'fade-out',
		inDuration            :    inDuration,
		outDuration           :    400,
		linkElement           :   '.animation-link',
		// e.g. linkElement   :   'a:not([target="_blank"]):not([href^=#])'
		loading               :    true,
		loadingParentElement  :   loadingParentElement, //animsition wrapper element
		loadingClass          :   'animsition-loading',
		unSupportCss          : [ 'animation-duration',
								  '-webkit-animation-duration',
								  '-o-animation-duration'
								],
		//"unSupportCss" option allows you to disable the "animsition" in case the css property in the array is not supported by your browser.
		//The default setting is to disable the "animsition" in a browser that does not support "animation-duration".
		
		overlay               :   false,
		
		overlayClass          :   'animsition-overlay-slide',
		overlayParentElement  :   'body'
	  });
	
		
	}// End Page Animation
	
	
/*--------------------------------------------------
Function Images Load
---------------------------------------------------*/	


	function ImagesLoad() {	
	
		jQuery('body').waitForImages({
            finished: function() {

              all_images_loaded = 1;
              console.log('Images Load: All loaded');
              setTimeout( function(){ 
              	jQuery('.slides li, .hero-image, .item-content, .post-image').addClass('image-show');
              } , 1000 );
			  setTimeout( function(){ 			  
				jQuery('#main img').addClass('image-show');              
			  } , 500 );
            },
            each: function() {
              console.log('Images Load: Each loaded');
              
              setTimeout( function(){ 
                jQuery(this).addClass('image-show');
              } , 1000 );
            
            },
              waitForAll: true
            });

          load_once = 1;
          console.log('LOAD: First load');
		  
		  
	}// End Images Load


/*--------------------------------------------------
Function Slide Menu
---------------------------------------------------*/	


	function ResponsiveMenu() {

		jQuery(".flexnav").flexNav({
		  'animationSpeed':     400,            // default for drop down animation speed
		  'transitionOpacity':  false,           // default for opacity animation
		  'buttonSelector':     '#nav-menu', // default menu button class name
		  'hoverIntent':        false,          // Change to true for use with hoverIntent plugin
		  'hoverIntentTimeout': 150,            // hoverIntent default timeout
		  'calcItemWidths':     false,          // dynamically calcs top level nav item widths
		  'hover':              true            // would you like hover support?      
		});
		
		
		
		
			
			
				
			jQuery( '#nav-menu, #close-overlay-menu' ).on('click', function() {
					
					
					
			if( jQuery('header').hasClass('fullscreen-menu')) {
				
				jQuery('#overlay-menu').toggleClass('overlay-show');				
				jQuery('header').toggleClass('header-fixed');				
				jQuery( '#close-overlay-menu' ).on('click', function() {
					jQuery('#nav-menu').toggleClass('active');
					jQuery('.flexnav').toggleClass('flexnav-show');
				});
			
			}  else {
		
				jQuery('.clapat-menu-item').each(function(i){
					var menuitem = jQuery(this);
					setTimeout(function() {
						menuitem.toggleClass('menu-item-show');
					}, 100*i);
				});
				jQuery('nav').toggleClass('nav-show');
			
			}
			
			});
		
		

	
	}//End Slide Menu
	
	
/*--------------------------------------------------
Function Hide Show Menu
---------------------------------------------------*/
	
	function HideShowMenu() {
			
			var didScroll;
			var lastScrollTop = 0;
			var delta = 5;
			var navbarHeight = jQuery('header').outerHeight();
			var navbarHideAfter = 20
			
			jQuery(window).scroll(function(event){
				didScroll = true;
			});
			
			
			if( jQuery('.scroll-hide').length > 0 ){
				
				setInterval(function() {
					if (didScroll) {
						hasScrolled();
						didScroll = false;
					}
				}, 100);
			
			}
		
			return false;
			
			function hasScrolled() {
				var st = jQuery(this).scrollTop();
				
				// Make sure they scroll more than delta
				if(Math.abs(lastScrollTop - st) <= delta)
					return;
				
				// If they scrolled down and are past the navbar, add class .nav-up.
				// This is necessary so you never see what is "behind" the navbar.
				if (st > lastScrollTop && st > navbarHideAfter){
					// Scroll Down
					if( jQuery('.scroll-hide').length > 0 ){
					jQuery('header').removeClass('nav-down').addClass('nav-up');
					}
				} else {
					// Scroll Up
					if( jQuery('.scroll-hide').length > 0 ){
					if(st + jQuery(window).height() < jQuery(document).height()) {
						jQuery('header').removeClass('nav-up').addClass('nav-down');
					}
					}
				}
				
				lastScrollTop = st;
			}
			
		
		
	}//End HideShowMenu	


	
/*--------------------------------------------------
Function Hero Height
---------------------------------------------------*/	
	
	function HeroHeight() {
		if( jQuery('#hero').length > 0 ){
			
			if (jQuery('#hero').hasClass('hero-small')) {
				var heights = window.innerHeight;
				document.getElementById("hero").style.height = heights * 0.5 + "px";
			}  else  {			
				var heights = window.innerHeight;
				document.getElementById("hero").style.height = heights + "px";
			} 
			
		}
		
		var winWidth = window.innerWidth;
			
		if (winWidth >= 1024) {
		
			if( jQuery('#overlay-menu').length > 0 ){			
				var heights = window.innerHeight;
				document.getElementById("overlay-menu").style.height = heights + "px";			
			}
		
		}
		
		if( jQuery('#video-container').length > 0 ){
		
			jQuery("#playmovie").css({'height':(jQuery("#hero").height()+'px')});
		
		}
		
	}//End HeroParallax
	
	
	
/*--------------------------------------------------
Function Hero Scroll Top
---------------------------------------------------*/	
	
	function HeroScrollTop() {
		
		var winWidth = window.innerWidth;
					
		if (winWidth >= 1024) {	
	
		jQuery( '#hero' ).on('click', function() {
                
              headerHeight = jQuery('#pre-hero').height();
              scrollPosition = jQuery(document).scrollTop();

              scrollDifference = headerHeight - scrollPosition;
                
              if (scrollDifference >= -180 && scrollDifference <= 150){
            

                if (scrollDifference == -24){}
                else{

                  jQuery("body, html").animate({
                    scrollTop: jQuery("#hero").offset().top
                  }, 600, 'easeInOutQuart');

                }

              }

              else{
                  
                  jQuery("body, html").animate({
                    scrollTop: jQuery("#hero").offset().top
                  }, 600, 'easeInOutQuart');

              }
		});
		
		}
			  
	}//End Hero Scroll Top		  
	
	
	
/*--------------------------------------------------
Function Full Screen Slider
---------------------------------------------------*/	
		
	function FullScreenSlider() {
		
		if( jQuery('.clapat-slider').length > 0 ){

			var fullscreen_slider_transition    = "slide";
			var fullscreen_slider_auto          = true;
			var fullscreen_slider_speed         = 5000;
			var fullscreen_slider_direction     = "horizontal";
			if( typeof FullScreenSliderOptions != 'undefined' ){
				fullscreen_slider_transition    = FullScreenSliderOptions.slider_transition;
				fullscreen_slider_speed         = FullScreenSliderOptions.slider_speed;
				fullscreen_slider_auto          = FullScreenSliderOptions.slider_autoplay;
				fullscreen_slider_direction     = FullScreenSliderOptions.slider_direction;
			}
			
			jQuery('.clapat-slider').flexslider({
				animation: fullscreen_slider_transition,
				direction: fullscreen_slider_direction,
				slideshow: fullscreen_slider_auto,
				slideshowSpeed: fullscreen_slider_speed,
				animationSpeed: 1000,
				animationLoop: false,
				controlNav: true,
				directionNav: true,
				before: function(slider){
					jQuery(slider).find(".flex-active-slide").find('.clapat-caption').each(function(){
						jQuery(this).removeClass("animated");
					});
				 },				
				after: function(slider){
					jQuery(slider).find(".flex-active-slide").find('.clapat-caption').addClass("animated");
				},
				useCSS: true			
			});
		}
		
	
	}//End FullScreenSlider
	
	
	
/*--------------------------------------------------
Function Classic Slider
---------------------------------------------------*/	
		
	function ClassicSlider() {
		
		if( jQuery('.classic-slider').length > 0 ){	
			jQuery('.classic-slider').flexslider({
				animation: "slide",
				direction: "horizontal",
				animationSpeed: 1000,
				animationLoop: true,
				smoothHeight: false,
				controlNav: false,
				slideshow: false,						
			});
		}
		
	}//End ClassicSlider			
	
	
	
/*--------------------------------------------------
Function Page Navigation
---------------------------------------------------*/
	
	function PageNav() {

		jQuery(".page-nav").on({
			 mouseenter: function () {	 
				 jQuery(this).parent().parent().parent().addClass("page-nav-hover");
			 },
    		 mouseleave: function () {
				 jQuery(this).parent().parent().parent().removeClass("page-nav-hover");
			 }
		});
		 
	}//End Page Navigation	
	
	
	
	
/*--------------------------------------------------
Function Back To Top Button
---------------------------------------------------*/
	
	function BackToTop() {
	
		jQuery(window).scroll(function(){
			if(jQuery(window).scrollTop() + jQuery(window).height() == jQuery(document).height()) {
				jQuery('.scrolltotop').removeClass('hidden');
			} else {
				jQuery('.scrolltotop').addClass('hidden');
			}
		});
		
		//Click event to scroll to top
		jQuery('.scrolltotop').on('click', function(){
			jQuery('html, body').animate({scrollTop : 0},800);
			return false;
		});
		
		jQuery('.down-hero').on('click', function(){
			jQuery('html, body').animate({ scrollTop: jQuery("#hero").offset().top -120 }, 500);
			return false;
		});
	
	}//End BackToTop	
	
	
	
	
/*--------------------------------------------------
Function Masonry Portfolio
---------------------------------------------------*/	
		
	function MasonryPortfolio() {	
	
		if( jQuery('#portfolio-wrap').length > 0 ){	
		
			var $container = jQuery('#portfolio');
		
			$container.isotope({
				layoutMode: 'packery',
			  itemSelector: '.item',
			  gutter:0,
			  transitionDuration: "0.5s"
			});
			
			jQuery('#filters a').on('click', function(){
				jQuery('#filters a').removeClass('active');
				jQuery(this).addClass('active');
				var selector = jQuery(this).attr('data-filter');
				$container.isotope({ filter: selector });		
				return false;
			});
				
			
			
			jQuery(document).scroll(function () {
				if(jQuery('.auto-construct').length > 0 ){
					var y = jQuery(this).scrollTop();
					var t = jQuery('#portfolio').offset().top + jQuery('#portfolio').height() - window.innerHeight;
					if (y > t) {
						jQuery('#portfolio').removeClass('auto-construct')
					} 
				}
			});
			
			jQuery(window).on( 'resize', function () {
			
				var winWidth = window.innerWidth;
				columnNumb = 1;			
				var attr_col = jQuery('#portfolio').attr('data-col');
					
				 if (winWidth >= 1466) {
					
					jQuery('#main').css( {width : 100  + '%'});
					jQuery('#portfolio-wrap').css( {width : jQuery('#main').width() + 40 + 'px'});
					jQuery('#portfolio-wrap.no-gutter').css( {width : 100  + '%'});			
					var portfolioWidth = jQuery('#portfolio-wrap').width();
					
					if (typeof attr_col !== typeof undefined && attr_col !== false) {
						columnNumb = jQuery('#portfolio').attr('data-col');
					} else columnNumb = 3;
					
					postHeight = window.innerHeight
					postWidth = Math.floor(portfolioWidth / columnNumb)			
					$container.find('.item').each(function () { 
						jQuery('.item').css( { 
							width : postWidth - 40 + 'px',
							height : postHeight * 0.5 - 40 + 'px',
							margin : 20 + 'px' 
						});
						jQuery('.no-gutter .item').css( {
							width : postWidth  + 'px',
							height : postHeight * 0.5  + 'px',
							margin : 0 + 'px' 
						});
						jQuery('.item.wide').css( { 
							width : postWidth * 2 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide').css( { 
							width : postWidth * 2 + 'px'  
						});
						jQuery('.item.tall').css( {
							height : postHeight * 1 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.tall').css( {
							height : postHeight * 1  + 'px'  
						});
						jQuery('.item.wide-tall').css( {
							width : postWidth * 2 - 40 + 'px',
							height : postHeight * 1 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide-tall').css( {
							width : postWidth * 2 + 'px',
							height : postHeight * 1  + 'px'  
						});
					});
					
					
				} else if (winWidth > 1024) {
					
					jQuery('#main').css( {width : 100  + '%'});
					jQuery('#portfolio-wrap').css( {width : jQuery('#main').width() + 40 + 'px'});
					jQuery('#portfolio-wrap.no-gutter').css( {width : 100  + '%'});			
					var portfolioWidth = jQuery('#portfolio-wrap').width();
								
					if (typeof attr_col !== typeof undefined && attr_col !== false) {
						columnNumb = jQuery('#portfolio').attr('data-col');
					} else columnNumb = 3;
					
					postHeight = window.innerHeight
					postWidth = Math.floor(portfolioWidth / columnNumb)			
					$container.find('.item').each(function () { 
						jQuery('.item').css( { 
							width : postWidth - 40 + 'px',
							height : postHeight * 0.5 - 40 + 'px',
							margin : 20 + 'px' 
						});
						jQuery('.no-gutter .item').css( {
							width : postWidth  + 'px',
							height : postHeight * 0.5  + 'px',
							margin : 0 + 'px' 
						});
						jQuery('.item.wide').css( { 
							width : postWidth * 2 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide').css( { 
							width : postWidth * 2 + 'px'  
						});
						jQuery('.item.tall').css( {
							height : postHeight * 1 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.tall').css( {
							height : postHeight * 1  + 'px'  
						});
						jQuery('.item.wide-tall').css( {
							width : postWidth * 2 - 40 + 'px',
							height : postHeight * 1 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide-tall').css( {
							width : postWidth * 2 + 'px',
							height : postHeight * 1  + 'px'  
						});
					});
					
					
				} else if (winWidth > 767) {
					
					jQuery('#main').css( {width : 100  + '%'});
					jQuery('#portfolio-wrap').css( {width : jQuery('#main').width() + 40 + 'px'});
					jQuery('#portfolio-wrap.no-gutter').css( {width : 100  + '%'});			
					var portfolioWidth = jQuery('#portfolio-wrap').width();
					
					columnNumb = 2;
					postWidth = Math.floor(portfolioWidth / columnNumb)			
					$container.find('.item').each(function () { 
						jQuery('.item').css( { 
							width : postWidth - 40 + 'px',
							height : postWidth * 0.75 - 40 + 'px',
							margin : 20 + 'px' 
						});
						jQuery('.no-gutter .item').css( {
							width : postWidth  + 'px',
							height : postWidth * 0.75  + 'px',
							margin : 0 + 'px' 
						});
						jQuery('.item.wide').css( { 
							width : postWidth * 2 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide').css( { 
							width : postWidth * 2 + 'px'  
						});
						jQuery('.item.tall').css( {
							height : postWidth * 1.5 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.tall').css( {
							height : postWidth * 1.5  + 'px'  
						});
						jQuery('.item.wide-tall').css( {
							width : postWidth * 2 - 40 + 'px',
							height : postWidth * 1.5 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide-tall').css( {
							width : postWidth * 2 + 'px',
							height : postWidth * 1.5  + 'px'  
						});
					});
					
					
				}	else if (winWidth > 479) {
					
					jQuery('#main').css( {width : 100  + '%'});
					jQuery('#portfolio-wrap').css( {width : jQuery('#main').width() - 40 + 'px'});
					jQuery('#portfolio-wrap.no-gutter').css( {width : 100  + '%'});			
					var portfolioWidth = jQuery('#portfolio-wrap').width();
					
					columnNumb = 1;
					postWidth = Math.floor(portfolioWidth / columnNumb)			
					$container.find('.item').each(function () { 
						jQuery('.item').css( { 
							width : postWidth - 40 + 'px',
							height : postWidth * 0.75 - 40 + 'px',
							margin : 20 + 'px' 
						});
						jQuery('.no-gutter .item').css( {
							width : postWidth  + 'px',
							height : postWidth * 0.75  + 'px',
							margin : 0 + 'px' 
						});
						jQuery('.item.wide').css( { 
							width : postWidth - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide').css( { 
							width : postWidth + 'px'  
						});
						jQuery('.item.tall').css( {
							height : postWidth * 1.5 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.tall').css( {
							height : postWidth * 1.5  + 'px'  
						});
						jQuery('.item.wide-tall').css( {
							width : postWidth - 40 + 'px',
							height : postWidth * 0.75 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide-tall').css( {
							width : postWidth  + 'px',
							height : postWidth * 0.75  + 'px'  
						});
					});
					
					
				}
				
				else if (winWidth <= 479) {
					
					jQuery('#main').css( {width : 100  + '%'});
					jQuery('#portfolio-wrap').css( {width : jQuery('#main').width() - 40 + 'px'});
					jQuery('#portfolio-wrap.no-gutter').css( {width : 100  + '%'});			
					var portfolioWidth = jQuery('#portfolio-wrap').width();
					
					columnNumb = 1;
					postWidth = Math.floor(portfolioWidth / columnNumb)			
					$container.find('.item').each(function () { 
						jQuery('.item').css( { 
							width : postWidth - 40 + 'px',
							height : postWidth * 0.75 - 40 + 'px',
							margin : 20 + 'px' 
						});
						jQuery('.no-gutter .item').css( {
							width : postWidth  + 'px',
							height : postWidth * 0.75  + 'px',
							margin : 0 + 'px' 
						});
						jQuery('.item.wide').css( { 
							width : postWidth - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide').css( { 
							width : postWidth + 'px'  
						});
						jQuery('.item.tall').css( {
							height : postWidth * 1.5 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.tall').css( {
							height : postWidth * 1.5  + 'px'  
						});
						jQuery('.item.wide-tall').css( {
							width : postWidth - 40 + 'px',
							height : postWidth * 0.75 - 40 + 'px'  
						});
						jQuery('.no-gutter .item.wide-tall').css( {
							width : postWidth + 'px',
							height : postWidth * 0.75  + 'px'  
						});
					});
					
					
				}		
				return columnNumb;
				
			
			}).resize();
		
			jQuery("#all").trigger('click');
			
		}
	
	}//End MasonryPortfolio	
	
	
	
/*--------------------------------------------------
Function Blog
---------------------------------------------------*/	
		
	function Blog() {		
		
		var heights = window.innerHeight;
		jQuery('.post-image').css({'height': heights / 2 + 'px'});
		jQuery('.post-image.inside-post').css({'height': heights / 1.5  + 'px'});
		
		jQuery( '.post-image' ).each(function (e) { 
                
              jQuery(this).on('click', function(e) {

                  jQuery("body, html").animate({
                    scrollTop: jQuery(this).offset().top
                  }, 600, 'easeInOutQuart');

            });    
		});
	
	}//End Blog
	
	
/*--------------------------------------------------
	Function Contact Map & Init Contact Map
---------------------------------------------------*/	

	function ContactMap() {	
		
		if( jQuery('#map_canvas').length > 0 ){
			
			var map_marker_image 	= 'images/marker.png';
			var map_address 		= 'New York City'
			var map_zoom			= 16;
			var marker_title 		= 'Hello Friend!';
			var marker_text			= 'Here we are. Come to drink a coffee!';
			var map_type			= google.maps.MapTypeId.SATELLITE;
			
			if( typeof ClapatMapOptions != 'undefined' ){
			
				map_marker_image 	= ClapatMapOptions.map_marker_image;
				map_address 		= ClapatMapOptions.map_address;
				map_zoom			= Number(ClapatMapOptions.map_zoom);
				marker_title 		= ClapatMapOptions.marker_title;
				marker_text			= ClapatMapOptions.marker_text;
				if( ClapatMapOptions.map_type == 0 ){
				
					map_type = google.maps.MapTypeId.SATELLITE;
				}
				else{
				
					map_type = google.maps.MapTypeId.ROADMAP;
				}
				
			}
					
			var settings = {
				zoom: map_zoom,
				center: new google.maps.LatLng(43.270441,6.640888),
				mapTypeControl: false,
				scrollwheel: false,
				draggable: true,
				panControl:false,
				scaleControl: false,
				zoomControl: false,
				streetViewControl:false,
				navigationControl: false,
				mapTypeId: map_type};		
			var map = new google.maps.Map(document.getElementById("map_canvas"), settings);	
			google.maps.event.addDomListener(window, "resize", function() {
				var center = map.getCenter();
				google.maps.event.trigger(map, "resize");
				map.setCenter(center);
			});	
			var contentString = '<div id="content-map-marker" style="text-align:left; padding-top:10px; padding-left:10px">'+
				'<div id="siteNotice">'+
				'</div>'+
				'<h4 id="firstHeading" class="firstHeading" style="color:#000; margin-bottom:0px;"><strong>' + marker_title + '</strong></h4>'+
				'<div id="bodyContent">'+
				'<p style="font-family:Verdana; color:#999; font-size:12px; margin-bottom:10px">' + marker_text + '</p>'+
				'</div>'+
				'</div>';
			var infowindow = new google.maps.InfoWindow({
				content: contentString
			});	
			var companyImage = new google.maps.MarkerImage(map_marker_image,
				new google.maps.Size(58,63),<!-- Width and height of the marker -->
				new google.maps.Point(0,0),
				new google.maps.Point(35,20)<!-- Position of the marker -->
			);
			
			var latitude = 43.270441;
			var longitude = 6.640888;
			var geocoder = new google.maps.Geocoder();
			geocoder.geocode({'address':map_address}, function(results, status) {
				if(status == google.maps.GeocoderStatus.OK) {
				
					map.setCenter(results[0].geometry.location);
					
					latitude = results[0].geometry.location.lat();
					longitude = results[0].geometry.location.lng();
					
					var companyPos = new google.maps.LatLng(latitude, longitude);	
					var companyMarker = new google.maps.Marker({
										position: companyPos,
										map: map,
										icon: companyImage,               
										title:"Our Office",
										zIndex: 3});	
									google.maps.event.addListener(companyMarker, 'click', function() {
										infowindow.open(map,companyMarker);
									});	
				}
			});
			
		}
		
		return false
		
	} // End ContactMap

	function InitContactMap() {
		
		if( jQuery('#map_canvas').length > 0 ){
			
			if (typeof google != 'undefined' && typeof google.maps != 'undefined'){
				
				// google maps already loaded, call the function which draws the map
				ContactMap();
				
			} else {
			
				var script = document.createElement('script');
				script.type = 'text/javascript';
				script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' +
							'&callback=ContactMap';
				document.body.appendChild(script);
			}
			
		}
	} // End InitContactMap	
	
/*--------------------------------------------------
Function AppearIteam
---------------------------------------------------*/	
		
	function AppearIteam() {		
		
		jQuery('.has-animation').each(function() {	
			jQuery(this).appear(function() {
				jQuery(this).addClass('animate-in');
			});
		
		});		
	
	}//End AppearIteam	
	
	
/*--------------------------------------------------
Function Shortcodes
---------------------------------------------------*/	
		
	function Shortcodes() {	
	
		//Progress bar animations	
		jQuery('.progress-bar li').each(function(i){		
			jQuery(this).appear(function(){			
				var percent = jQuery(this).find('span').attr('data-width');
				var $endNum = parseInt(jQuery(this).find('span strong i').text());
				var $that = jQuery(this);			
				jQuery(this).find('span').animate({
					'width' : percent + '%'
				},1600, function(){
				});			
				jQuery(this).find('span strong').animate({
					'opacity' : 1
				},1400);			
				jQuery(this).find('span strong i').countTo({
					from: 0,
					to: $endNum,
					speed: 1200,
					refreshInterval: 30,
					onComplete: function(){}
				});	 
				if(percent == '100'){
					$that.find('span strong').addClass('full');
				}	
			});
		});	
		
		
		// Accordion	  
		jQuery('dl.accordion dt').filter(':first-child').addClass('accordion-active');
		jQuery('dd.accordion-content').filter(':nth-child(n+3)').slideUp(1).addClass('hide');		
		jQuery('dl.accordion').on('click', 'dt', function() {
			jQuery(this).addClass('accordion-active').next().slideDown(200).siblings('dd.accordion-content').slideUp(200).prev().removeClass('accordion-active');						
		});	
		jQuery('dl.accordion').on('click', 'dt.accordion-active', function() {
			jQuery(this).removeClass('accordion-active').siblings('dd.accordion-content').slideUp(200);
		});
		
		
		// Toggle	
		jQuery(".toggle_container").hide(); 
		jQuery("span.toggle-title").on('click', function(){
			jQuery(this).toggleClass("toggle-active").next().slideToggle("normal");
			return false; 
		});
		
		
		// Tabs	
		jQuery(".tab_container").hide(); 
		jQuery("ul.tabs li:first").addClass("tab-active").show(); 
		jQuery(".tab_container:first").show(); 		
		jQuery("ul.tabs li").on('click', function() {
			jQuery("ul.tabs li").removeClass("tab-active"); 
			jQuery(this).addClass("tab-active"); 
			jQuery(".tab_container").hide(); 
			var activeTab = jQuery(this).find("a").attr("href"); 
			jQuery(activeTab).fadeIn(); 
			return false;
		});
			
			
		// Milestone counters
		jQuery('.clapat-counter').each(function() {
			jQuery(this).appear(function() {
				var $endNum = parseInt(jQuery(this).find('.number').text());
				jQuery(this).find('.number').countTo({
					from: 0,
					to: $endNum,
					speed: 1500,
					refreshInterval: 30
				});
			},{accX: 0, accY: 0});
		});
		
		
		//Fading Out AlertBox
		jQuery('.shortcode_alertbox').find('.box_close').on('click', function(){
			jQuery(this).parents('.alertboxes').animate({opacity:0},300).animate({height:"0px"});
		});
		
		
		// Radial Counters	
		if( jQuery('.radial-counter').length > 0 ){		
			jQuery(".knob").knob({
				width: 140,
				height: 140,
				fgColor: '#eee',
				bgColor: '#fff',
				inputColor: '#fff',
				dynamicDraw: true,
				thickness: 0.05,
				tickColorizeValues: true,
				skin:'tron',
				readOnly:true,
			});	
			jQuery(".knob").appear(function(e){			
				var $this = jQuery(this);
				var myVal = $this.attr("data-gal");	
			   jQuery({value: 0}).animate({value: myVal}, {
				   duration: 2000,
				   easing: 'swing',
				   step: function () {
					   $this.val(Math.ceil(this.value)).trigger('change');
				   }
			   })			
			});	
		}
		
	
	}//End Shortcodes	
	
	
	
/*--------------------------------------------------
Function VideoHeader
---------------------------------------------------*/
	
	function VideoHeader() {
		
		if( jQuery('#video-container').length > 0 ){
		
			var onMobile = false;
				if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { onMobile = true; }
		
				if( ( onMobile === false ) ) {
		
					jQuery(".player").mb_YTPlayer();
							
					
					jQuery('#playmovie').on('click', function() {			
							jQuery('#playmovie').addClass('hidden-play');
							setTimeout(function(){
								jQuery('#playmovie').fadeOut();	
							}, 600);
							jQuery('#bgndVideo').playYTP();
										
					});			
					
					jQuery('#stopmovie').on('click', function() {			
						jQuery('#playmovie').fadeIn(1);
						setTimeout(function(){
							jQuery('#playmovie').removeClass('hidden-play');				
							jQuery('#bgndVideo').pauseYTP();				
						}, 100);
					});	
			
				} else {
				
					/* as a fallback we add a special class to the header which displays a poster image */ 
					
					
					/* hide player */
					jQuery(".player").hide();
					
					jQuery(".play-box").hide();
					
				}
				
		}
				 
	}//End VideoHeader
	
/*--------------------------------------------------
Function MagnificPopup
---------------------------------------------------*/	
	
	function MagnificPopup() {	
	
		var mfp = jQuery('.mfp-gallery');
		if(mfp.length) {
			mfp.each(function(index, element) {
				jQuery(element).magnificPopup({
					  delegate: 'a.mf-zoom',
					  type: 'image',
					  image: {
						  markup: '<div class="mfp-figure">'+
									'<div class="mfp-close"></div>'+
									'<div class="mfp-img"></div>'+
								  '</div>' +
								  '<div class="mfp-bottom-bar">'+
									'<div class="mfp-title"></div>'+
									'<div class="mfp-counter"></div>'+
								  '</div>', // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button
						
						  cursor: 'mfp-zoom-out-cur', // Class that adds zoom cursor, will be added to body. Set to null to disable zoom out cursor. 
						  
						  titleSrc: 'title', // Attribute of the target element that contains caption for the slide.
						  // Or the function that should return the title. For example:
						  // titleSrc: function(item) {
						  //   return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';
						  // }
						
						  verticalFit: true, // Fits image in area vertically
						
						  tError: '<a href="%url%">The image</a> could not be loaded.' // Error message
						},
						gallery: {
						  enabled:true,
						  tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter
						},
					  mainClass: 'mfp-zoom-in',
					  tLoading: '',
					  removalDelay: 300, //delay removal by X to allow out-animation
					  callbacks: {
						imageLoadComplete: function() {
						  var self = this;
						  setTimeout(function() {
							self.wrap.addClass('mfp-image-loaded');
						  }, 16);
						},
						close: function() {
						  this.wrap.removeClass('mfp-image-loaded');
						}
					  },
					  closeBtnInside: false,
					  closeOnContentClick: true,
					  midClick: true
					});
			});	
		}
		
	}//End MagnificPopup