function stopVideo() {
    var $iframe = $('#videoModal iframe');
    var src = $iframe.attr('src');
    $iframe.attr('src', ''); 
    $iframe.attr('src', src); 
}
$("body").on('click', '.youtubevideomodal', function(e) { 	
	e.preventDefault();
	var datavideo = $(this).attr("data-video");
	$('.videomodaliframe').attr('src',datavideo);
	$('#videoModal').modal('show');
});
$("body").on('click', '.belgemodal', function(e) { 	
	e.preventDefault();
    var databelge = $(this).attr("data-belge");
    var fileExtension = databelge.split('.').pop().toLowerCase();
    $('#belgeModal').modal('show');
    $('#belgeModal').find('.modal-body').html(databelge);
    if (fileExtension === 'pdf') {
    $('#belgeModal').modal('show');
    var currentUrl = window.location.origin + window.location.pathname;
  
var pdfUrl = currentUrl + '/images/' + databelge; 
$('#belgeModal').modal('show');
$('#belgeModal').find('.modal-body').html('');
    } else {
        $('#belgeModal').modal('show');
        $('#belgeModal').find('.modal-body').html('
');
    }
});
$("body").on('click', '.close', function(e) {
    e.preventDefault();	
    $('#videoModal').modal('hide');
	stopVideo();
});
$("body").on('click', '.closeCustom', function(e) {
    e.preventDefault();	
    $('#belgeModal').modal('hide');
});
$('#videoModal').on('hidden.bs.modal', function () {
    stopVideo();
});
(function () {
  const importantParams = ['gclid', 'gad_source', 'fbclid', 'ttclid', 'ttclid2', 'gad_campaignid', 'gtm_debug', 'channel','ref', 'sms', 'coupon', 'utm_source', 'kampanya'];
  const urlParams = new URLSearchParams(window.location.search);
  const hasImportant = importantParams.some(p => urlParams.has(p));
  if (!hasImportant) return;
  const paramString = window.location.search;
  document.querySelectorAll('a[href]').forEach(link => {
    const href = link.getAttribute('href');
    if (!href) return;
    if (!href.endsWith('.html') && !href.endsWith('.php')) return;
    const existingParams = new URLSearchParams(href.split('?')[1] || '');
    if (importantParams.some(p => existingParams.has(p))) return;
    const separator = href.includes('?') ? '&' : '?';
    link.setAttribute('href', href + separator + paramString.slice(1));
  });
})();
$(document).ready(function(){	
//!function(){"use strict";let t=document.querySelectorAll(".requires-validation");Array.from(t).forEach(function(t){t.addEventListener("submit",function(e){t.checkValidity()||(e.preventDefault(),e.stopPropagation()),t.classList.add("was-validated")},!1)})}();
!function(){"use strict";let t=document.querySelectorAll(".requires-validation");Array.from(t).forEach((function(t){t.addEventListener("submit",(function(e){t.checkValidity()?Swal.fire({html:' Lütfen Bekleyiniz
',buttons:!1,showCancelButton:!1,showConfirmButton:!1,allowOutsideClick:!1,timer:5e3,timerProgressBar:!0}).then((t=>{t.dismiss===Swal.DismissReason.timer&&console.log("Süre doldu, uyarı kapandı")})):(e.preventDefault(),e.stopPropagation()),t.classList.add("was-validated")}),!1)}))}();
$("#sehir").on("change",function(){var i=$(this).val();$("#ilce").attr("disabled",!1).html(''),$.getJSON("json/il-ilce.json",function(e){$("#ilce").append(''),$.each(e,function(e,n){var o="";n.il==i&&(o+='",$("#ilce").append(o))})})});
function setCookie(name, value, days) {
    var expires = "";
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days*24*60*60*1000));
        expires = "; expires=" + date.toUTCString();
    }
    document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0) === ' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}
function kisasiparis(){
    
}
$(".tel-mask").inputmask({
    mask: "0(*99) 999-9999",
    greedy: false,
    definitions: {
        '*': { validator: "[1-8]" }
    },
    clearIncomplete: true,
    oncomplete: function() {
        kisasiparis(); 
    }
});
kargofirma_();		
$("body").on('change', 'input[name="adet"],input[name="odeme"]', function() { kargofirma_(); });		
$("body").on('click', '.kargofirmakampanyaustbuton', function() { $('html').animate({scrollTop: $('#contact_form').offset().top}, 300); });
		
function kargofirma_(){
			
		  
}
	  
$("label.block").click(function(){$("html").animate({scrollTop:$(".scroolposition1").offset().top},300);var i=$(this);$(".block").each(function(){$(i).data("image")!=$(this).data("image")?($(this).children("img.showz").show(),$(this).children("img.none").hide()):($(this).children("img.showz").hide(),$(this).children("img.none").show())})});
	  
$(".siparisbuton").click(function(){var i=$("#contact_form");$(".contentimg"),i.find(":input").on("invalid",function(n){var t=$(this),f=i.find(":invalid").first();if(t[0]===f[0]){var o=t.offset().top-0,c=window.pageYOffset-0;if(o>c&&o