(function($) {
	"use strict";

	if ($('.home-slider').length) {
		$('.home-slider').owlCarousel({
			loop:true,
			margin:2,
			nav:true,
			smartSpeed: 500,
			autoplay: 5000,
			navText: [ '<span class="flaticon-arrows-1"></span>', '<span class="flaticon-arrows-2"></span>' ],
			responsive:{
				0:{
					items:1
				},
				600:{
					items:2
				},
				1024:{
					items:3
				},
				1200:{
					items:3
				}
			}
		});
	}

	$('#portfolioSlider').carousel();
	$('.partners-carousel').owlCarousel({
		loop:false,
		margin:20,
		nav:true,
		smartSpeed: 500,
		autoplay: 5000,
		navText: [ '<span class="flaticon-arrows-1"></span>', '<span class="flaticon-arrows-2"></span>' ],
		responsive:{
			0:{
				items:2
			},
			600:{
				items:3
			},
			1024:{
				items:4
			},
			1200:{
				items:5
			}
		}
	});

	$('.gallery-carousel').owlCarousel({
		loop:true,
		nav:true,
		smartSpeed: 500,
		autoplay: 1000,
		responsive:{
			0:{
				items:1,
				stagePadding: 0
			},
			600:{
				items:1,
				stagePadding: 30
			},
			1000:{
				items:1,
				stagePadding: 150
			}
		}
	});

	$('body').on('mouseenter mouseleave','.dropdown',function(e){
		var _d=$(e.target).closest('.dropdown');_d.addClass('show');
		setTimeout(function(){
			_d[_d.is(':hover')?'addClass':'removeClass']('show');
			$('[data-toggle="dropdown"]', _d).attr('aria-expanded',_d.is(':hover'));
		},300);
	});

	$(document).on('click', '[data-toggle="lightbox"]', function(event) {
		event.preventDefault();
		$(this).ekkoLightbox();
	});

	//Google Map Load
	if ($("#map").length) {
		var script = document.createElement('script');
		script.type = 'text/javascript';
		//script.src = 'https://maps.googleapis.com/maps/api/js?v=3&' + 'callback=initMap&key=AIzaSyBECQRA0rRYHpRl3XwEo7gN1YJvGnDghL8';
		script.src = 'https://api-maps.yandex.ru/2.1/?lang=' + $('#map').data('lang') + '&onload=initMap';
		document.body.appendChild(script);
	}

})(window.jQuery);

//Init Map
function initMap() {
	/*
	 var map = new google.maps.Map($('#map')[0], {
	 zoom: $('#map').data('zoom'),
	 center: {lat: $('#map').data('lat'), lng: $('#map').data('lng')},
	 scrollwheel: false,
	 mapTypeControl: false,
	 streetViewControl: false,
	 fullscreenControl: false,
	 styles: [{"featureType":"water","elementType":"geometry.fill","stylers":[{"color":"#d3d3d3"}]},{"featureType":"transit","stylers":[{"color":"#808080"},{"visibility":"off"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"visibility":"on"},{"color":"#b3b3b3"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#ffffff"},{"weight":1.8}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"color":"#d7d7d7"}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#ebebeb"}]},{"featureType":"administrative","elementType":"geometry","stylers":[{"color":"#a7a7a7"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"landscape","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#efefef"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#696969"}]},{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"visibility":"on"},{"color":"#737373"}]},{"featureType":"poi","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"poi","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road.arterial","elementType":"geometry.stroke","stylers":[{"color":"#d6d6d6"}]},{"featureType":"road","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"color":"#dadada"}]}]
	 });
	 */
	var myMap = new ymaps.Map("map", {
		center: [$('#map').data('lat'), $('#map').data('lng')],
		zoom: $('#map').data('zoom'),
		controls: ['zoomControl','trafficControl','routeButtonControl','fullscreenControl']
	});

	var myPlacemark = new ymaps.Placemark([$('#map').data('lat'), $('#map').data('lng')], {
		hintContent: $($('#map').data('hint')).text(),
		balloonContent: $($('#map').data('ballon')).html(),
		iconContent: "<img src='" + $('#map').data('marker') + "' width='17'>"
	},{
		preset: "islands#icon",
		iconColor: '#000000'
	});


	myMap.geoObjects.add(myPlacemark);
	myMap.behaviors.disable('scrollZoom');
	myMap.panes.get('ground').getElement().style.filter = 'grayscale(100%)';
}
