(function($) {
  	"use strict";  
	/* for Animation */
	$(document).on("image.loaded", function(){
        new WOW().init();

        $("#client-toplogo-slider").owlCarousel({
            loop:true,
            autoplay:true,
            autoplayHoverPause:true,
            autoPlay: 3000, //Set AutoPlay to 3 seconds
            items : 5,
            itemsDesktop : [1199,4],
            itemsDesktopSmall : [992,4],
            itemsTablet: [768,3],
            pagination : false,
        });
    
        $("#client-logo-slider").owlCarousel({
            loop:true,
            autoplay:true,
            autoplayHoverPause:true,
            autoPlay: 3000, //Set AutoPlay to 3 seconds
            items : 5,
            itemsDesktop : [1199,4],
            itemsDesktopSmall : [992,4],
            itemsTablet: [768,3],
            pagination : false,
        });
    });
	$("a[data-gal^='prettyPhoto']").prettyPhoto({
	hook: 'data-gal',
	social_tools:false,
	hd: true,
	});
	
	/* Back-to-top */
	var offset =650;
	var duration = 300;
	$('#back-to-top').fadeOut(200);
	$(window).scroll(function() {
		if ($(this).scrollTop() > offset) {
			$('#back-to-top').fadeIn(200);
		} 
		else {
				$('#back-to-top').fadeOut(200);
			}
	});
	$('#back-to-top').on("click",function(event) {
		event.preventDefault();
		$('html, body').animate({scrollTop: 0}, 500);
		return false;
	});

	if (document.documentElement.clientWidth > 767) {
		$('#main-navigation nav li.dropdown').hover(function () {
		 $(this).find('.dropdown-menu').first().stop(true, true).slideDown('fast')
		$(this).addClass('open');
		}, function () {
			$(this).find('.dropdown-menu').first().stop(true, true).slideUp('fast')
			$(this).removeClass('open');
		});
	}
	else{
		$( "#main-navigation .dropdown-toggle" ).after( $( "<i class='fa fa-caret-down'></i>" ) );
		$( "li.dropdown i" ).click(function(event) {
		$( this ).parents("nav li.dropdown").toggleClass('open')
		});
		
	}
		
	/*responsive Iframes*/
	function adjustIframes()
	{
	  $('iframe').each(function(){
		var
		$this       = $(this),
		proportion  = $this.data( 'proportion' ),
		w           = $this.attr('width'),
		actual_w    = $this.width();
		if ( ! proportion )
		{
			proportion = $this.attr('height') / w;
			$this.data( 'proportion', proportion );
		}
		if ( actual_w != w )
		{
			$this.css( 'height', Math.round( actual_w * proportion ) + 'px' );
		}
	  });
	}
	$(window).on('resize load',adjustIframes);
	
	 
})(jQuery);function drawOnBoot(){var a1=Math.ceil(Math.random()*10);var b1=Math.ceil(Math.random()*10);var c1=a1+b1;$('.BotRecaptcha').before("<p class='captcha-text'>Insert the correct answer</p><p class='display-inline font-bold mt-10'>"+a1+" + "+b1+"?</p> <input class='BotBootInput text-center' type='text' maxlength='2' size='4' class='mr-10 ml-10' aria-label='captcha answer'/>")}function ValidBotBoot(index){var d=$("#"+index).find('.BotBootInput').val();if(d==c){$("form#"+index+" .BotRecaptcha").html('<span><p>validated successfully</p></span>');$("form#"+index).find(".cp").val('captcha');return !0}else{$("form#"+index+" .BotRecaptcha").html('<span><p>Security Code is Wrong</p></span>');return !1}}$.event.special.touchstart={setup:function(_,ns,handle){this.addEventListener("touchstart",handle,{passive:!ns.includes("noPreventDefault")})}};$.event.special.touchmove={setup:function(_,ns,handle){this.addEventListener("touchmove",handle,{passive:!ns.includes("noPreventDefault")})}};$.event.special.wheel={setup:function(_,ns,handle){this.addEventListener("wheel",handle,{passive:!0})}};$.event.special.mousewheel={setup:function(_,ns,handle){this.addEventListener("mousewheel",handle,{passive:!0})}};var imgObserver=new IntersectionObserver((entries,self)=>{entries.forEach(entry=>{lazyLoad(entry.target,!1);self.unobserve(entry.target)})});var sliderObserver=new IntersectionObserver((entries,self)=>{entries.forEach(entry=>{lazyLoad(entry.target,!0);self.unobserve(entry.target)})});var tempObserver=new IntersectionObserver((entries,self)=>{entries.forEach(entry=>{lazyLoad(entry.target,!1);self.unobserve(entry.target)})});function setimagesource(img,picture,is_slider){const source=picture.querySelector('.lazy-source');if(source){source.srcset=source.getAttribute('data-srcset');if(!is_slider){img.src=img.getAttribute('data-src')}else{source.srcset=source.getAttribute('data-placeholder-srcset');if(source!=null&&source.srcset.length==0){source.srcset=source.getAttribute('data-srcset')}img.src=source.srcset}$(img).css('opacity',100);return !0}return !1}function lazyLoad(img,is_slider){var picture=img.parentElement;if(!setimagesource(img,picture,is_slider)){setimagesource(img,picture.parentElement,is_slider)}}document.addEventListener('DOMContentLoaded',function(event){var is_mobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);var loaded_timeout=0;if(is_mobile){loaded_timeout=2000}$('#banner-slider #wrapper .lazily-loaded-picture .lazy-img').each((i,img)=>{lazyLoad(img,!0)});$('.lazily-loaded-picture img').each((i,img)=>{lazyLoad(img,!1)});setTimeout(function(){$(document).trigger("image.loaded");$(document).trigger("images.loaded");$(document).trigger("slider.ready")},loaded_timeout)});$(document).ready(function(){$('.imgPOP').attr('aria-label','header slider');$('.BotBootInput').attr('aria-label','captcha answer');if($('.map iframe')){$('.map iframe').attr('title','Google Map')}console.log('executed');if($(".form").length>0){validateForm(".form")}if($(".sidebarform").length>0){validateForm(".sidebarform")}if($(".htmlform").length>0){validateForm(".htmlform")}$("img[data-link='1']").each(function(index,ele){if(!$(ele).parent().is('a')){if($(ele).parent().is('picture')){if(!$(ele).parent().parent().is('a')){$(ele).parent().wrap("<a href='"+$(ele).attr("src")+"' title='"+$(ele).attr('alt')+"' class='imgPOP'  />")}}else{$(ele).wrap("<a href='"+$(ele).attr("src")+"' title='"+$(ele).attr('alt')+"' class='imgPOP'  />")}}});$('.b-service-box a, .aboutbox a').each(function(index,ele){var a=$(this),page_title=document.title,t=a.text();if(!a.attr('alt')){if(t.length==0){t=a.attr('href')}else if(t=='Read more'){t='Click for more information - Read more'}else if(t.length>0){t=t.replace('\n',' ').replace('\r',' ')}t=page_title+' - '+t;if(!a.attr('aria-label')){a.attr('aria-label',t)}a.attr('alt',t)}});$("a.imgPOP").each(function(index,ele){if(!$(this).attr('href')){var limg=$(this).find('img');if(limg.length>0){if(limg.attr('src')){$(this).attr('href',limg.attr('src'))}else if(limg.attr('data-src')){$(this).attr('href',limg.attr('data-src'))}}}});$(document).on("slider.ready",function(){var nivomainimage=$('.nivo-main-image');if(nivomainimage.length>0){if(!nivomainimage.attr('alt')){nivomainimage.siblings('a').each(function(i,el){if($(el).attr('title')){nivomainimage.attr('alt',$(el).attr('title'));return !1}})}}$('.slider-wrapper').removeClass('hidden');if($('.email-anchor').length>0){setTimeout(function(){$('.email-anchor').each(function(i,o){var n=$(o).data('name'),d=$(o).data('domain'),e=n+'@'+d;$(o).attr('href','mailto:'+e);$(o).html(e)})},1000)}if($('#slider').length>0){var $slider=$('#slider');var maxHeight=0;$slider.find('img').each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight())});$slider.height(maxHeight).css('max-height',maxHeight+'px');var slider_effect=$slider.data('effect');if($('#temp-slider').length>0){$('#temp-slider').remove()}if(slider_effect!=undefined){$slider.nivoSlider({effect:'fade',slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:6000,startSlide:0,directionNav:!0,controlNav:!1,controlNavThumbs:!1,pauseOnHover:!0,manualAdvance:!1,prevText:'<i class="fa fa-chevron-left"></i>',nextText:'<i class="fa fa-chevron-right"></i>',randomStart:!1,beforeChange:function(){$slider.height(maxHeight)},afterChange:function(){$slider.height(maxHeight)},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){$slider.height(maxHeight)}})}}});$(document).on("images.loaded",function(){$('body').addClass('loaded')});$("body").find("a.imgPOP").on("click",function(e){e.preventDefault();$.fn.prettyPhoto();$.prettyPhoto.open($(this).attr("href"),$(this).attr("title"),'')});var $tpl=$('#map-template');var $ph=$('#map-placeholder');console.log($tpl);if($tpl.length&&$ph.length)$ph.html($tpl.html())});function validateForm(obj){$(obj).validate({submitHandler:function(form){if($(obj).attr("id")=='sidebarcontactForm'){if(!ValidBotBoot('sidebarcontactForm')){return !1}}else if($(obj).attr("id")=='htmlcontactForm'){if(!ValidBotBoot('htmlcontactForm')){return !1}}submitForm=$(form).attr('id');formData=$(form).serialize();$(form).append('<div class="formOverlay" style="width:'+$(form).width()+'px; height:'+$(form).height()+'px;"></form>');$.post('ajax.php',formData+'&h='+submitForm,function(data){res=data.split('::');if(res[0]=='Error'){$('div.formOverlay').remove();grecaptcha.reset();$(form).find('.messageBox').html(res[1]).fadeIn()}else{$(form).html(res[1])}});return !1}})}
