(function($){ // Multi Accord
	$.fn.extend({
		mAccord: function(options) {
			var defaults = {
			};
			var options = $.extend(defaults, options); 
			return this.each(function() {
				var o = options,
					trigger = jQuery(this).find(".accordion-heading"),
					content = jQuery(this).find(".accordion-content"),
					obj = $(trigger).prev(); 
				trigger.click(function (e) {
					e.stopPropagation();
					var target = jQuery(this).next(); 
					jQuery(this).addClass('active'),
						trigger.not(this).removeClass('active'),
						target.stop().delay(300).slideDown(); 
					if (target.is(':visible')) { 
						jQuery(this).removeClass('active'),
							target.stop().slideUp();
					} else if (content.not(target).is(':visible')){
						jQuery(content.not(target)).stop().slideUp();
					}
				});

			});
		}
	});
})(jQuery);

(function($) { 
	jQuery('.accordion-wrapper').mAccord();
})(jQuery); // Multi Accord End

jQuery(document).ready(function($){ // Wrap Contact US Words in Span on Header
	var pattern = /\b(Contact Us)/gi; // Words you want to wrap
	var replaceWith = '<strong>$1</strong>'; // Here's the wap
	jQuery('.wrap-last a').each(function(){
		jQuery(this).html(jQuery(this).html().replace(pattern,replaceWith));
	});
}); 

jQuery(document).ready(function( $ ) { // Wrap $ in Span on PPC Pricing Page
	$.fn.money = function() {
		return this.each(function() {
			var element = $(this);
			var html = element.html();
			element.html(html.replace(/\$/gi, '<span class="dollar-font">$</span>'));
		});
	}; 
	$('.package-wrapper-info').money();
});

jQuery(document).ready(function() {  // Archieve List Toggle
	jQuery('.archive-menu li ul').hide();
	jQuery('.archive-menu li a').click(function(){
		jQuery(this).parent().addClass('selected');
		jQuery(this).parent().children('ul').slideToggle(250);
		jQuery(this).parent().siblings().children('ul').hide(250);
		jQuery(this).parent().siblings().removeClass('selected');
	});
});

jQuery('.slider-for').slick({
	slidesToShow: 1,
	slidesToScroll: 1,
	arrows: false,
	fade: true,
	asNavFor: '.slider-nav'
});

jQuery('.slider-nav').slick({
	slidesToShow: 7,
	slidesToScroll: 1,
	asNavFor: '.slider-for',
	dots: false,
	focusOnSelect: true,
	accessibility: true,
	adaptiveHeight: true,
	centerMode: true,
	centerPadding: '0px',
	slidesPerRow: 1,
	slidesToShow: 7,
	responsive: [
		{
			breakpoint: 1200,
			settings: {
				slidesToShow: 5,
				slidesToScroll: 1
			},
		},
		{
			breakpoint: 991,
			settings: {
				slidesToShow: 3,
				slidesToScroll: 1,
			},
		},
		{
			breakpoint: 767,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1,
			}
		}
	],
});

jQuery("#review-slider").owlCarousel({
	autoplay: true,
	loop: true, /* use rewind if you don't want loop */
	margin: 0,
	/*
animateOut: 'fadeOut',
animateIn: 'fadeIn',
*/
	responsiveClass: true,
	autoHeight: true,
	autoplayTimeout: 7000,
	smartSpeed: 800,
	nav: false,
	autoplayHoverPause:true,	
	responsive: {
		0: {
			items: 1
		},

		600: {
			items: 2
		},

		1024: {
			items: 2
		},

		1366: {
			items: 2
		}
	}
});

jQuery("#stories-slider").owlCarousel({
	autoplay: true,
	loop: true, /* use rewind if you don't want loop */
	margin: 0,
	responsiveClass: true,
	autoHeight: true,
	autoplayTimeout: 7000,
	smartSpeed: 800,
	nav: false,
	autoplayHoverPause:true,
	responsive: {
		0: {
			items: 1
		},

		600: {
			items: 1
		},

		1024: {
			items: 1
		},

		1366: {
			items: 1
		}
	}
});

jQuery(".carousel-two").owlCarousel({
	autoplay: true,
	loop: true, /* use rewind if you don't want loop */
	margin: 0,
	responsiveClass: true,
	autoHeight: false,
	autoplayTimeout: 4000,
	smartSpeed: 1000,
	nav: true,
	dots: false,
	autoplayHoverPause:false,
	responsive: {
		0: {
			items: 1
		},

		600: {
			items: 1
		},

		1024: {
			items: 2
		},

		1366: {
			items: 2
		}
	}
});


jQuery(".owl-one1").owlCarousel({
	autoplay: true,
	loop: true, /* use rewind if you don't want loop */
	margin: 0,
	responsiveClass: true,
	autoHeight: false,
	autoplayTimeout: 15000,
	smartSpeed: 800,
	nav: true,
	dots: false,
	autoplayHoverPause:true,
	responsive: {
		0: {
			items: 1
		},

		600: {
			items: 1
		},

		1024: {
			items: 1
		},

		1366: {
			items: 1
		}
	}
});

jQuery(".owl-one2").owlCarousel({
	autoplay: true,
	loop: true, /* use rewind if you don't want loop */
	margin: 0,
	responsiveClass: true,
	autoHeight: false,
	autoplayTimeout: 15000,
	smartSpeed: 800,
	nav: true,
	dots: false, 
	autoplayHoverPause:true,
	responsive: {
		0: {
			items: 1
		},

		600: {
			items: 1,
			slideBy: 1
		},

		1024: {
			items: 2,
			slideBy: 2
		},

		1366: {
			items: 2,
			slideBy: 2
		}
	}
});

jQuery('.search-toggle').addClass('closed'); // Search Functions
jQuery('.search-toggle .search-icon').click(function(e) {
	if (jQuery('.search-toggle').hasClass('closed')) {
		jQuery('.search-toggle').removeClass('closed').addClass('opened');
		jQuery('.search-toggle, .search-container').addClass('opened');
		jQuery('#search-terms').focus();
	} else {
		jQuery('.search-toggle').removeClass('opened').addClass('closed');
		jQuery('.search-toggle, .search-container').removeClass('opened');
	}
});

function myFunction() { // Location Accordion
	var element = document.getElementById("location-footer");
	element.classList.toggle("mystyle");
}
jQuery("#location-footer").click(function(){
	jQuery("#location-details").toggle();
});

jQuery('.accordion-wrapper .accordion-inner:first-child .accordion-heading').addClass('active');

jQuery(document).ready(function () {
	 
	jQuery('#verticalTab').easyResponsiveTabs({
		type: 'vertical',
		width: 'auto',
		fit: true,
		event: 'mouseover'
	});

	jQuery('.project-wrapper-click').click(function() {
		jQuery(this).next('.project-modal-box').addClass('project-modal-open'); 
		return false;
	}); 

	jQuery('.project-popup-close').click(function() {
		jQuery(this).parents('.project-modal-box').removeClass('project-modal-open'); 
		return false;
	});  

	jQuery('.blog-comment form p.comment-notes').wrapAll('<div class="comment-full-field" />'); 
	jQuery('.blog-comment form p.comment-form-author, .blog-comment form p.comment-form-email, .blog-comment form p.comment-form-url, .blog-comment form p.comment-form-cookies-consent').wrapAll('<div class="comment-left-field" />');
	jQuery('.blog-comment form p.comment-form-comment, .blog-comment form p.form-submit').wrapAll('<div class="comment-right-field" />');

});

jQuery(function() {
	jQuery('.animate-type').animatedHeadline({
		animationType: 'type'
	});
}); 

jQuery('.case-study-template-default a').on('click', function() {  
	jQuery('html, body').animate({scrollTop: $(this.hash).offset().top - 150}, 0);
	return false;
}); 

jQuery(function() { // Find the First Paragraph on Blogs Single and Increased the Font Size Jquery
  jQuery(".blog-listing-content").each(function() {
    jQuery(this).find("p:first").addClass("big-font");
  });
});

window.onload = function(){ 

	var anchorsa = document.querySelectorAll("a[href*='tel:1877-777-0720']"); // For Phone Number
	for (var a=0; a<anchorsa.length; a++){
		anchorsa[a].setAttribute("onclick", "ga('send', 'event', 'Phone Call Tracking', 'Click to Call', '877-777-0720');");
	}
	
	var anchorsb = document.querySelectorAll("a[href*='tel:1250-380-0898']"); // For Phone Number
	for (var b=0; b<anchorsb.length; b++){
		anchorsb[b].setAttribute("onclick", "ga('send', 'event', 'Victoria Phone Call Tracking', 'Click to Call', '250-380-0898');");
	}
	
	var anchorsc = document.querySelectorAll("a[href*='tel:1877-292-7467']"); // For Phone Number
	for (var c=0; c<anchorsc.length; c++){
		anchorsc[c].setAttribute("onclick", "ga('send', 'event', 'Canada Phone Call Tracking', 'Click to Call', '877-292-7467');");
	}
	
	var anchorsd = document.querySelectorAll("a[href*='tel:1877-644-7467']"); // For Phone Number
	for (var d=0; d<anchorsd.length; d++){
		anchorsd[d].setAttribute("onclick", "ga('send', 'event', ''US Phone Call Tracking', 'Click to Call', '877-644-7467');");
	} 

}	