  WebFontConfig = {
  	google: {
  		families: ['Roboto:300,400,700&display=swap&subset=latin-ext']
  	}
  };
  (function () {
  	var wf = document.createElement('script');
  	wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  	wf.type = 'text/javascript';
  	wf.async = 'true';
  	var s = document.getElementsByTagName('script')[0];
  	s.parentNode.insertBefore(wf, s);
  })();


  Element.prototype.remove = function () {
  	this.parentElement.removeChild(this);
  }
  NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
  	for (var i = this.length - 1; i >= 0; i--) {
  		if (this[i] && this[i].parentElement) {
  			this[i].parentElement.removeChild(this[i]);
  		}
  	}
  };
  document.addEventListener("DOMContentLoaded", function (event) {

  	if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || screen.width <= 768) {
  		document.getElementsByClassName("hidden-xs").remove();
  		console.log('desktoptakiler kalktı');
		$(".mobile-header").show();
		$("#header").hide();
		$(".mobile-header").prepend($(".video-holder"));
		$(".mobile-header").prepend($(".topform"));
		$(".mobile-header").prepend($(".counter-holder"));
		$(".mobile-header").prepend($(".slogan"));
		$("vslider").slick('unslick');
  		//TOP FİXED MOBİL
  			$(window).scroll(function () {
  				var scrollval = $(window).scrollTop();
  				if (scrollval > 700) {
  					//$('.fixed-top').addClass('active');
  					//$(".top-counter").prepend($(".counter-wrapper"));
				$('.gotop').show();
  				} else {
  					//$(".counter-holder").prepend($(".counter-wrapper"));
  					//$('.fixed-top').removeClass('active');
					$('.gotop').hide();
  				}
  			});
  		//TOP FİXED
  	} else {
  		document.getElementsByClassName("hidden-lg").remove();
  		console.log('mboildekiler kalktı');
  		//PARALLAX
  		function parallax() {
  			window.onscroll = function () {
  				var speed = 2.0;
  				var myElement = document.getElementById("header");
  				var myElement2 = document.getElementById("scrol");
  				myElement.style.backgroundPosition = (-window.pageXOffset / speed) + "px " + (-window.pageYOffset / speed) + "px";
  				myElement2.style.top = (-window.pageYOffset / speed * 0.3 + 100) + "px ";
  			}
  		}
  		parallax();
  		//PARALLAX

  		//TOP FİXED DESKTOP
  		$(window).scroll(function () {
  			var scrollval = $(window).scrollTop();
  			if (scrollval > 450) {
  				$('.fixed-top').addClass('active');
  				$(".top-counter").prepend($(".counter-wrapper"));
  			} else {
  				$(".counter-holder").prepend($(".counter-wrapper"));
  				$('.fixed-top').removeClass('active');
  			}
  		});
  		//TOP FİXED


  	}

  });


  $(document).ready(function () {


	
  	//POPFORM
  	$(".showform").click(function () {
  		$('.popform').addClass('active');
  		$(".popform").prepend($(".footerformpop"));
  		$(".footerformpop").prepend($(".closeform"));

  	});
  	$(".closeform").click(function () {
  		$('.popform').removeClass('active');
  		$(".footer-form").prepend($(".footerformpop"));
  		$(".popform").prepend($(".closeform"));

  	});
  	//POPFORM

	
  	//LAZY 
  	$('.lazy').Lazy({
  		// your configuration goes here
	
  		scrollDirection: 'vertical',
  		effect: 'fadeIn',
  		visibleOnly: true,
		onError: function (element) {
  			console.log('error loading ' + element.data('src'));
  		},
			  callback_load: function () {
				AOS.refresh();
			  }
  	});
	
			//Animate
	AOS.init({
		   duration: 600,
		   disable: false,
		   once: true,

	});
	
  	//TIMER

  /*	let year = 2019;
  	let month = 9;
  	let day = 25;


  	function countdown() {

  		const now = new Date();
  		let eventDate = new Date(year, month, day);

  		let currentTime = now.getTime();
  		let eventTime = eventDate.getTime();

  		let remTime = eventTime - currentTime;

  		let s = Math.floor(remTime / 1000);
  		let m = Math.floor(s / 60);
  		let h = Math.floor(m / 60);
  		let d = Math.floor(h / 24);

  		h = h % 24;
  		m = m % 60;
  		s = s % 60;

  		h = (h < 10) ? "0" + h : h;
  		m = (m < 10) ? "0" + m : m;
  		s = (s < 10) ? "0" + s : s;

  		document.getElementById("days").innerText = d;
  		document.getElementById("days").textContent = d;
  		document.getElementById("hours").innerText = h;
  		document.getElementById("hours").textContent = h;
  		document.getElementById("minutes").innerText = m;
  		document.getElementById("minutes").textContent = m;
  		document.getElementById("seconds").innerText = s;
  		document.getElementById("seconds").textContent = s;

  		setTimeout(countdown, 1000);

  	}

  	countdown();
*/

  	//TIMER

  	function phone_validate(phno) {
  	var regexPattern = new RegExp(/^[0-9-+-\s]+$/); // regular expression pattern
  		return regexPattern.test(phno);
  	}


  	//TEL INPUT 2********************************************
  	$(".contact_form").each(function () {
  		var currentForm = $(this);
  		$('.error_Msg', currentForm).hide();
  		currentForm.on('submit', function (event) {
  			var input = $(".adsoyad", currentForm);
  			if (/\d/.test(input.val())) { // Ad soyad içerisinde numara olamaz
  				input.addClass('error');
				$('.admessage').show();
				$('.ad2message').hide();
				$('.phmessage').hide();
  			} /*else
  			if (input.val().search(" ") === -1) { // Ad soyad en az iki kelimeden oluşmalıdır
  				input.addClass('error');
				$('.admessage').hide();
				$('.ad2message').show();
				$('.phmessage').hide();
  			}*/ else {
  				input.removeClass('error');
  				input = $(".telefon", currentForm);
  				var data = input.val();
  				if (phone_validate(data) && data.length > 9) {
  					$('.error_Msg').hide();
  					input.removeClass('error');
  					$('button', currentForm).attr('disabled', 'disabled');
  					return true; // hides error msg if validation is true
  				} else {
					$('.admessage').hide();
					$('.ad2message').hide();
  					$('.phmessage').show(); // shows validation msg if validation is false

  				}
  			}
  			event.preventDefault();
  			return false;
  		});

  	});

  	//TEL INPUT 2********************************************
	
  	//VİDEO SLİDER********************************************
	//$('.vslider').slick({
	//  slidesToShow: 1,
	//  infinite:false,
	//  swipe:false,
	//  lazyLoad: 'ondemand'
	//	});
  	//VİDEO SLİDER********************************************
	  			$(window).scroll(function () {
  				var scrollvalb = $(window).scrollTop();
  				if (scrollvalb > 1500) {
					
			
	
	
  				}
  			});
		  	//BEFOREAFTER SLİDER********************************************
					$('.before-after').slick({
					  slidesToShow: 3,
					  centerMode: true,
					  lazyLoad: 'ondemand',
						responsive: [
							{
							  breakpoint: 1024,
							  settings: {
								slidesToShow: 3,
								slidesToScroll: 1,
								infinite: true
							  }
							},
							{
							  breakpoint: 600,
							  settings: {
								slidesToShow: 1,
								slidesToScroll: 1
							  }
							},
							{
							  breakpoint: 480,
							  settings: {
								slidesToShow: 1,
								slidesToScroll: 1
							  }
							}
							// You can unslick at a given breakpoint now by adding:
							// settings: "unslick"
							// instead of a settings object
						  ]
				  
				  
						});
					//BEFOREAFTER SLİDER********************************************
	
	//INTL*********************************************
    var input = document.querySelector("#phone");
    var country = document.querySelector("#country");
    var countryData = window.intlTelInputGlobals.getCountryData();

    var iti = window.intlTelInput(input, {
      // allowDropdown: false,
      autoHideDialCode: false,
      autoPlaceholder: "on",
      // dropdownContainer: document.body,
      // excludeCountries: ["us"],
      // formatOnDisplay: false,
      geoIpLookup: function (callback) {
        $.get("https://api.ipgeolocation.io/ipgeo?apiKey=6fe879f09f9a4d0e9178277171ba6e46&fields=geo", function () {}, "json").always(function (resp) {
          var countryCode = (resp && resp.country_code2) ? resp.country_code2 : "";
          callback(countryCode);
        });
      },
      // hiddenInput: "full_number",
      initialCountry: "auto",
      // localizedCountries: { 'de': 'Deutschland' },
      nationalMode: false,
      // onlyCountries: ['us', 'gb', 'ch', 'ca', 'do'],
      // placeholderNumberType: "MOBILE",
      preferredCountries: ['tr', 'gb', 'fr', 'sa', 'us', 'de', 'se', 'be', 'kw', 'ae', 'qa', 'nl'],
      separateDialCode: false,
      utilsScript: "material/js/intl/js/utils.js",
    });

    input.addEventListener('countrychange', function (e) {
      var countryname = iti.getSelectedCountryData().name;
      country.value = countryname.replace(/.+\((.+)\)/, "$1");
    });


    var input2 = document.querySelector("#phone2");
    var countryf = document.querySelector("#country2");
    var iti2 = window.intlTelInput(input2, {
      // allowDropdown: false,
      autoHideDialCode: false,
      autoPlaceholder: "on",
      // dropdownContainer: document.body,
      // excludeCountries: ["us"],
      // formatOnDisplay: false,
      geoIpLookup: function (callback) {
		    callback(countryCode);
      },
      // hiddenInput: "full_number",
      initialCountry: "auto",
      // localizedCountries: { 'de': 'Deutschland' },
      nationalMode: false,
      // onlyCountries: ['us', 'gb', 'ch', 'ca', 'do'],
      // placeholderNumberType: "MOBILE",
      preferredCountries: ['tr', 'gb', 'fr', 'sa', 'us', 'de', 'se', 'be', 'kw', 'ae', 'qa', 'nl'],
      separateDialCode: false,
      utilsScript: "material/js/intl/js/utils.js",
    });

    input2.addEventListener('countrychange', function (e) {
      var countryname2 = iti2.getSelectedCountryData().name;
      countryf.value = countryname2.replace(/.+\((.+)\)/, "$1");
    });
    //INTL*********************************************
  	//YOUTUBE********************************************
	// VIDEO 2
	//$('.ytvideo[data-video]').click(function() {
	//
	//var $this = $(this);
	//var width = $this.outerWidth();
	//var height = $this.outerHeight();
	//$('.youtube',$this).hide();
	//$this.append('<iframe width="'+width+'" height="'+height+'" src="https://www.youtube.com/embed/' + $this.data("video") + '?autoplay=1"></iframe>');
	//});
	//
	//$('.vslider').on('beforeChange', function(event, slick, currentSlide, nextSlide){
	//$('.ytvideo iframe').remove();
	//$('.ytvideo .youtube').show();
	//
	//});
  	//YOUTUBE********************************************
	
	
  	//GOTOP********************************************
	 $('.gotop').click(function(){
	   $('html, body').animate({scrollTop:0}, 'slow');
	 });
 
  	//GOTOP********************************************

  });
