(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(d){var c="ellipsis",b='<span style="white-space: nowrap;">',e={lines:"auto",ellipClass:"ellip",responsive:false};function a(h,q){var m=this,w=0,g=[],k,p,i,f,j,n,s;m.$cont=d(h);m.opts=d.extend({},e,q);function o(){m.text=m.$cont.text();m.opts.ellipLineClass=m.opts.ellipClass+"-line";m.$el=d('<span class="'+m.opts.ellipClass+'" />');m.$el.text(m.text);m.$cont.empty().append(m.$el);t()}function t(){if(typeof m.opts.lines==="number"&&m.opts.lines<2){m.$el.addClass(m.opts.ellipLineClass);return}n=m.$cont.height();if(m.opts.lines==="auto"&&m.$el.prop("scrollHeight")<=n){return}if(!k){return}s=d.trim(m.text).split(/\s+/);m.$el.html(b+s.join("</span> "+b)+"</span>");m.$el.find("span").each(k);if(p!=null){u(p)}}function u(x){s[x]='<span class="'+m.opts.ellipLineClass+'">'+s[x];s.push("</span>");m.$el.html(s.join(" "))}if(m.opts.lines==="auto"){var r=function(y,A){var x=d(A),z=x.position().top;j=j||x.height();if(z===f){g[w].push(x)}else{f=z;w+=1;g[w]=[x]}if(z+j>n){p=y-g[w-1].length;return false}};k=r}if(typeof m.opts.lines==="number"&&m.opts.lines>1){var l=function(y,A){var x=d(A),z=x.position().top;if(z!==f){f=z;w+=1}if(w===m.opts.lines){p=y;return false}};k=l}if(m.opts.responsive){var v=function(){g=[];w=0;f=null;p=null;m.$el.html(m.text);clearTimeout(i);i=setTimeout(t,100)};d(window).on("resize."+c,v)}o()}d.fn[c]=function(f){return this.each(function(){try{d(this).data(c,(new a(this,f)))}catch(g){if(window.console){console.error(c+": "+g)}}})}}));
jQuery(document).ready(function($){

$(".home .et_pb_slider .et_pb_slides .et_pb_slide_0").remove();
$(".home .et_pb_slider .et_pb_slides").append($(".home .et_pb_slider .et_pb_slides .et_pb_slide").sort(function () {
    return Math.random() - 0.5;
}));
$(function() {
	

	$('#press-holder .et_pb_post .entry-title a').each(function(  ) {
		let plink = $( this ).closest('.et_pb_post').find(' .post-content p').text();
  		$( this ).attr('href',plink).not('a[href*=gusdecool]').attr('target','_blank').attr('rel','noopener');
	});

 });
// Preloader
	// $(window).on('load', function () {
	//     if ($('.rsd-loader').length) {
	//       $('.rsd-loader').delay(100).fadeOut('slow', function () {
	//         $(this).remove();
	//       });
	//     }
	// });
	// $(function() {
	//    $('#top-menu a[href*="#"]:not([href="#"])').click(function() {
	// 	 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
	// 	   var target = $(this.hash);
	// 	   target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
	// 	   if (target.length) {
	// 		 $('html, body').animate({
	// 		   scrollTop: target.offset().top - 10
	// 		 }, 1000);
	// 		 return false;
	// 	   }
	// 	 }
	//    });
	//  });
	 
	 $(function(){
		 $('a[href^="#"]').click(function(){
			var target = $(this).attr('href');
			$('html, body').animate({scrollTop: $(target).offset().top}, 2000);
			return false;
		 });
	  });
 
		$('body').attr('data-aos-easing','ease', 'data-aos-duration','1200', 'data-aos-delay','0');
		$('.page-id-9328 .team-content p.et_pb_member_position').insertAfter('.team_middle .et_pb_team_member_description h1');
		
	    $( "#export_infrastructure .et_pb_post > a " ).each(function(){
		    $(this).next('h2').andSelf().wrapAll('<div class="export-img" />');
		});
		$( "#highlights-holder .blog_content h4 " ).each(function(){
			let linka = $(this).children('a').attr('href');
			$(this).next('.post-meta').andSelf().wrapAll('<a class="blog-det" href="'+linka+'"/>');
			
			
		});

		/* Fixing late sticky header issue */
	$(window).scroll(function(){
		var scroll = $(window).scrollTop();
	  
		if (scroll > 0) {
			$('#main-header').addClass('et-fixed-header');
			$('#top-header').addClass('et-fixed-header');
			$('.stiky-btn').addClass('et-fixed-header');
		}
		else {
			$('#main-header').removeClass('et-fixed-header');
			$('#top-header').removeClass('et-fixed-header');
			$('.stiky-btn').removeClass('et-fixed-header');
		}
  	});
	$(window).scroll(function(){
		var scroll = $(window).scrollTop();

		if (scroll > ( $('#et-boc .et_builder_inner_content').height() - 96 ) ) {
			$('.stiky-btn').addClass('et-fixed-header');
		}
		else {
			$('.stiky-btn').removeClass('et-fixed-header');
		}
	});
	  $( "#export_infrastructure .et_pb_row " ).wrapInner( "<div class='export_content' />");

	//   $('#export_infrastructure .et_pb_column').wrapAll('<div class=export_content></div>');
	  function teamImageResize() {
		var photoWidth = $('#export_infrastructure .export_content .et_pb_column .export-img').width();
		$('#export_infrastructure .export_content .et_pb_column .export-img').css('height', photoWidth/1.3 + 'px');
	  }
	
	  teamImageResize();
	  
	  $(window).resize(function() {
		teamImageResize();
	  });
	
	if (!$('.archive .featured-downloads .edd_downloads_list').length){
		$('.archive .featured-downloads').hide();
	}



// Get the navbar
	var navbar = document.getElementById("navbar-single");

// Get the offset position of the navbar
if (navbar){
	var sticky = navbar.offsetTop;
}

// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position
	function myFunction() {
		if (window.pageYOffset >= sticky) {
			navbar.classList.add("sticky")
			$('.single-download .holder-inner').addClass("whensticky");
		} else {
			navbar.classList.remove("sticky");
			$('.single-download .holder-inner').removeClass("whensticky");
		}
	}

	// When the user scrolls the page, execute myFunction
	window.onscroll = function() {
		if (navbar){myFunction()
	}};
	
});

jQuery(document).ready(function($){
	function checkPosition(){
		if (window.matchMedia('(max-width: 767px)').matches) {
			jQuery(".edd_download_purchase_form").addClass('stiky-btn');
		} else {
			jQuery(".edd_download_purchase_form").removeClass('stiky-btn');
		};

	}


	checkPosition();
	jQuery( window ).resize(function() {
		checkPosition();
	});
	
	/*$('#eric_smith .et_pb_member_social_links').append('<li><a href="http://epcrisks.com/" class="" style="line-height: 1.1;">EPCRisks.com</a></li>');*/
	
	/*$('.edd_cat').append($('<p>Form access information, email us at info@webberresearch.com</p>'));*/
	$('.single-download .edd_downloads_list .edd_download_excerpt p').ellipsis({ lines: 4 });
	
	$('div.pagination a').on('click', function(e) {e.stopImmediatePropagation();});
	
		//live
	$('#edd-purchase-button').attr('disabled', true);
	$('input[name="cfm_accept_toc"]').change(function(){
			if ($(this).is(":checked")) {
				$('#edd-purchase-button').attr('disabled', false);
			} else {
				$('#edd-purchase-button').attr('disabled', true);
			}
	})

	
	// $(".menu-item-8935 > a").click(function (){
	// 	$('html, body').animate({
	// 		scrollTop: $("#contact_us").offset().top
	// 	}, 2000);
	// });

	/* Owl Carusel */
	jQuery('.owl-carousel').owlCarousel({
		dots: true,
		loop: true,
		margin: 40,
		autoplay:true,
		autoplayTimeout:5000,
		autoplayHoverPause:true,
		animateOut:true,
		animateIn: true,

		responsive: {
			0: {
				items: 2
			},
			768: {
				items: 4
			},
			981: {
				items: 6
			}
		}
	});
})





