=\'A\'&&a<=\'Z\')||(a>=\'a\'&&a<=\'z\')},1I:v(a){x(a>=\'0\'&&a<=\'9\')},2c:v(a){W(4 i=a.C-1;i>0;i--){4 j=1C.6e(1C.6f()*a.C);4 b=a[i];a[i]=a[j];a[j]=b}}});v 2z(a,b){$.1K(a,b);W(4 c 3W b){u(b[c]==D||b[c]==4e){a[c]=b[c]}}x a};$.6g.6=v(a){4 b=6h.3v.6i.6j(6k,1);u(a==\'6l\'){x $.6[\'2h\'+a+\'1n\'].1l($.6,[2[0]].4h(b))}x 2.1b(v(){3P a==\'3Q\'?$.6[\'2h\'+a+\'1n\'].1l($.6,[2].4h(b)):$.6.3z(2,a)})};$.6=6m 1n();$(v(){$(O.26).1s($.6.1L).4g($.6.46)})})(6n);',62,396,'||this||var||keypad||||||||||||||||||||||||if|function|_get|return|_input|||_mainDiv|length|null|false|div|else|disabled|button|top|attr|left|ui|css|document|true|class|addKeyDef|browser|_curInst|focus|data|for|_disabledFields|_inline|||_hideKeypad|markerClassName|_triggerClass|find|documentElement|val|_keypadShowing|SPACE|HALF_SPACE|readonly|each|width|outerWidth|_pos|name|input|type|hasClass|siblings|px|apply|createTextRange|Keypad|_selectValue|text|isRTL|target|append|push|nodeName|toLowerCase|settings|_updateKeypad|remove|outerHeight|opera|iframe|Math|substr|_specialKeys|the|all|isAlphabetic|isNumeric|_defaults|extend|mainDiv|_mainDivClass|_inlineClass|_coverClass|ucase|click|is|span|_showKeypad|img|title|addClass|_lastField|end|removeClass|parents|position|scrollLeft|scrollTop|version|effects|body|_setValue|_notifyKeypress|setSelectionRange|pos|state|_shuffle|_keyCode|CLOSE|CLEAR|BACK|_|regional|character|nbsp|showAnim|show|showOptions|duration|normal|useThemeRoller|prompt|separator|onKeypress|style|display|_appendClass|_disableClass|_inlineEntryClass|extendRemove|action|textarea|_setInput|bind|both|src|default|offset|height|_findPos|_getBorders|widget|msie|parseInt|max|_getIERange|corner|split|key|_isControl|clear|_clearValue|_backValue|SHIFT|_shiftKeypad|SPACE_BAR|space|ENTER||TAB|tab|qwertyAlphabetic|qwertyuiop|asdfghjkl|zxcvbnm|qwertyLayout|789|456|123|buttonText|buttonStatus|Close|Erase|showOn|buttonImage|buttonImageOnly|appendText|keypadClass|layout|keypadOnly|randomiseAlphabetic|randomiseNumeric|randomiseOther|randomiseAll|beforeShow|onClose|none|prototype|trigger|special|noHighlight|_attachKeypad|_connectKeypad|_disableKeypad|before|after|_doKeyDown|alt|saveReadonly|removeAttr|empty|removeData|opacity|cursor|children|map|_isDisabledKeypad|typeof|string|fixed|absolute|1000px|_checkOffset|_default|in|ec|storage|hidden|_generateHTML|parseFloat|border|window|while|hide|_checkExternalClick|andSelf|selectionStart|selectionEnd|insertValue|visible|_getIETextRange|break|undefined|_randomiseLayout|mousedown|concat|close|back|shift|spacebar|half|enter|x0D|x09|Open|closeText|closeStatus|clearText|Clear|clearStatus|backText|Back|backStatus|previous|spacebarText|spacebarStatus|Space|enterText|Enter|enterStatus|Carriage|tabText|tabStatus|Horizontal|shiftText|Shift|shiftStatus|Toggle|upper|lower|case|characters|alphabeticLayout|fullLayout|hasKeypad|popup|inline|keyentry|cover|setDefaults|throw|Only|keys|allowed|String|fromCharCode|code|id|keydown|html|setData|getData|_destroyKeypad|prev|unbind|_enableKeypad|relative|prepend|inArray|_changeKeypad|offsetHeight|block|auto|match|replace|content|rtl|thin|medium|thick|innerWidth|clientWidth|innerHeight|clientHeight|not|offsetLeft|margin|right|nodeType|nextSibling|slideDown|slideUp|fadeIn|fadeOut|keyCode|stop|DEL|BS|jquery|move|select|selection|createRange|duplicate|setEndPoint|EndToStart|compareEndPoints|StartToEnd|moveEnd|moveToElementText|maxlength|change|header|row|toUpperCase|charCodeAt|highlight|Status|Text|javascript|down|active|mouseup|mouseout|filter|continue|floor|random|fn|Array|slice|call|arguments|isDisabled|new|jQuery'.split('|'),0,{}));
/* http://keith-wood.name/keypad.html
   Turkish localisation for the jQuery keypad extension
   Written by Yücel Kandemir(yucel{at}21bilisim.com) September 2010. */
(function($) { // hide the namespace
	$.keypad.regional['tr'] = {
		buttonText: '...', buttonStatus: 'Aç',
		closeText: 'Kapat', closeStatus: 'Klavyeyi Kapatır',
		clearText: 'Sil', clearStatus: 'İçerisini Temizler',
		backText: 'Geri Al', backStatus: 'Son Karakteri Siler.',
		shiftText: 'Büyüt', shiftStatus: 'Büyük Harfle Yazmak İçin Seçiniz.',
		spacebarText: ' ', spacebarStatus: '',
		enterText: 'Enter', enterStatus: '',
		tabText: '›', tabStatus: '',
    	alphabeticLayout: $.keypad.qwertyAlphabetic,
	    fullLayout: $.keypad.qwertyLayout,
    	isAlphabetic: $.keypad.isAlphabetic,
	    isNumeric: $.keypad.isNumeric,
    	isRTL: false};
	$.keypad.setDefaults($.keypad.regional['tr']);
})(jQuery);
// jQuery Mask Plugin v1.14.15
// github.com/igorescobar/jQuery-Mask-Plugin
var $jscomp={scope:{},findInternal:function(a,l,d){a instanceof String&&(a=String(a));for(var p=a.length,h=0;hd?g=10*e:f>=g&&f!==d?c.maskDigitPosMapOld[g]||(f=g,g=g-(l-h)-a,c.maskDigitPosMap[g]&&(g=f)):g>f&&
(g=g+(h-l)+m)}return g},behaviour:function(f){f=f||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,m.byPassKeys)){var e=c.getMasked(),g=c.getCaret();setTimeout(function(){c.setCaret(c.calculateCaretPosition())},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(g);return c.callbacks(f)}},getMasked:function(a,b){var g=[],d=void 0===b?c.val():b+"",n=0,h=e.length,q=0,l=d.length,k=1,r="push",p=-1,t=0,y=[],v,z;f.reverse?(r="unshift",k=-1,v=0,n=h-1,q=l-1,z=function(){return-1<
n&&-1',e.titleMarkup='\n  
\n',e.textMarkup='\n  
',e.footerMarkup='\n  
\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.CONFIRM_KEY="confirm",e.CANCEL_KEY="cancel";var r={visible:!0,text:null,value:null,className:"",closeModal:!0},i=Object.assign({},r,{visible:!1,text:"Cancel",value:null}),a=Object.assign({},r,{text:"OK",value:!0});e.defaultButtonList={cancel:i,confirm:a};var s=function(t){switch(t){case e.CONFIRM_KEY:return a;case e.CANCEL_KEY:return i;default:var n=t.charAt(0).toUpperCase()+t.slice(1);return Object.assign({},r,{text:n,value:t})}},c=function(t,e){var n=s(t);return!0===e?Object.assign({},n,{visible:!0}):"string"==typeof e?Object.assign({},n,{visible:!0,text:e}):o.isPlainObject(e)?Object.assign({visible:!0},n,e):Object.assign({},n,{visible:!1})},l=function(t){for(var e={},n=0,o=Object.keys(t);n=0&&w.splice(e,1)}function s(t){var e=document.createElement("style");return t.attrs.type="text/css",l(e,t.attrs),i(t,e),e}function c(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",l(e,t.attrs),i(t,e),e}function l(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function u(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var l=h++;n=g||(g=s(e)),o=f.bind(null,n,l,!1),r=f.bind(null,n,l,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=c(e),o=p.bind(null,n,e),r=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),o=d.bind(null,n),r=function(){a(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}function f(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=x(e,r);else{var i=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function d(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function p(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=y(o)),r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var m={},b=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),v=function(t){var e={};return function(n){return void 0===e[n]&&(e[n]=t.call(this,n)),e[n]}}(function(t){return document.querySelector(t)}),g=null,h=0,w=[],y=n(15);t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");e=e||{},e.attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||(e.singleton=b()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=r(t,e);return o(n,e),function(t){for(var i=[],a=0;athis.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return!1;for(var r=0|e,i=Math.max(r>=0?r:o-Math.abs(r),0);i=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(19),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function o(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n',e.default=e.modalMarkup},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.OVERLAY,i='\n  
';e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.ICON;e.errorIconMarkup=function(){var t=r+"--error",e=t+"__line";return'\n    \n      
\n  '},e.warningIconMarkup=function(){var t=r+"--warning";return'\n    \n       \n  '},e.successIconMarkup=function(){var t=r+"--success";return'\n    
\n    
\n  '}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.CONTENT;e.contentMarkup='\n  \n\n  
\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.BUTTON_CONTAINER,i=o.default.BUTTON,a=o.default.BUTTON_LOADER;e.buttonMarkup='\n  \n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=n(2),i=n(0),a=i.default.ICON,s=i.default.ICON_CUSTOM,c=["error","warning","success","info"],l={error:r.errorIconMarkup(),warning:r.warningIconMarkup(),success:r.successIconMarkup()},u=function(t,e){var n=a+"--"+t;e.classList.add(n);var o=l[t];o&&(e.innerHTML=o)},f=function(t,e){e.classList.add(s);var n=document.createElement("img");n.src=t,e.appendChild(n)},d=function(t){if(t){var e=o.injectElIntoModal(r.iconMarkup);c.includes(t)?u(t,e):f(t,e)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=n(4),i=function(t){navigator.userAgent.includes("AppleWebKit")&&(t.style.display="none",t.offsetHeight,t.style.display="")};e.initTitle=function(t){if(t){var e=r.injectElIntoModal(o.titleMarkup);e.textContent=t,i(e)}},e.initText=function(t){if(t){var e=document.createDocumentFragment();t.split("\n").forEach(function(t,n,o){e.appendChild(document.createTextNode(t)),n0}).forEach(function(t){b.classList.add(t)})}n&&t===c.CONFIRM_KEY&&b.classList.add(s),b.textContent=r;var g={};return g[t]=i,f.setActionValue(g),f.setActionOptionsFor(t,{closeModal:p}),b.addEventListener("click",function(){return u.onAction(t)}),m},p=function(t,e){var n=r.injectElIntoModal(l.footerMarkup);for(var o in t){var i=t[o],a=d(o,i,e);i.visible&&n.appendChild(a)}0===n.children.length&&n.remove()};e.default=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),r=n(4),i=n(2),a=n(5),s=n(6),c=n(0),l=c.default.CONTENT,u=function(t){t.addEventListener("input",function(t){var e=t.target,n=e.value;a.setActionValue(n)}),t.addEventListener("keyup",function(t){if("Enter"===t.key)return s.onAction(o.CONFIRM_KEY)}),setTimeout(function(){t.focus(),a.setActionValue("")},0)},f=function(t,e,n){var o=document.createElement(e),r=l+"__"+e;o.classList.add(r);for(var i in n){var a=n[i];o[i]=a}"input"===e&&u(o),t.appendChild(o)},d=function(t){if(t){var e=r.injectElIntoModal(i.contentMarkup),n=t.element,o=t.attributes;"string"==typeof n?f(e,n,o):e.appendChild(n)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=function(){var t=o.stringToNode(r.overlayMarkup);document.body.appendChild(t)};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=n(6),i=n(1),a=n(3),s=n(0),c=s.default.MODAL,l=s.default.BUTTON,u=s.default.OVERLAY,f=function(t){t.preventDefault(),v()},d=function(t){t.preventDefault(),g()},p=function(t){if(o.default.isOpen)switch(t.key){case"Escape":return r.onAction(a.CANCEL_KEY)}},m=function(t){if(o.default.isOpen)switch(t.key){case"Tab":return f(t)}},b=function(t){if(o.default.isOpen)return"Tab"===t.key&&t.shiftKey?d(t):void 0},v=function(){var t=i.getNode(l);t&&(t.tabIndex=0,t.focus())},g=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l),n=e.length-1,o=e[n];o&&o.focus()},h=function(t){t[t.length-1].addEventListener("keydown",m)},w=function(t){t[0].addEventListener("keydown",b)},y=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l);e.length&&(h(e),w(e))},x=function(t){if(i.getNode(u)===t.target)return r.onAction(a.CANCEL_KEY)},_=function(t){var e=i.getNode(u);e.removeEventListener("click",x),t&&e.addEventListener("click",x)},k=function(t){o.default.timer&&clearTimeout(o.default.timer),t&&(o.default.timer=window.setTimeout(function(){return r.onAction(a.CANCEL_KEY)},t))},O=function(t){t.closeOnEsc?document.addEventListener("keyup",p):document.removeEventListener("keyup",p),t.dangerMode?v():g(),y(),_(t.closeOnClickOutside),k(t.timer)};e.default=O},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(3),i=n(37),a=n(38),s={title:null,text:null,icon:null,buttons:r.defaultButtonList,content:null,className:null,closeOnClickOutside:!0,closeOnEsc:!0,dangerMode:!1,timer:null},c=Object.assign({},s);e.setDefaults=function(t){c=Object.assign({},s,t)};var l=function(t){var e=t&&t.button,n=t&&t.buttons;return void 0!==e&&void 0!==n&&o.throwErr("Cannot set both 'button' and 'buttons' options!"),void 0!==e?{confirm:e}:n},u=function(t){return o.ordinalSuffixOf(t+1)},f=function(t,e){o.throwErr(u(e)+" argument ('"+t+"') is invalid")},d=function(t,e){var n=t+1,r=e[n];o.isPlainObject(r)||void 0===r||o.throwErr("Expected "+u(n)+" argument ('"+r+"') to be a plain object")},p=function(t,e){var n=t+1,r=e[n];void 0!==r&&o.throwErr("Unexpected "+u(n)+" argument ("+r+")")},m=function(t,e,n,r){var i=typeof e,a="string"===i,s=e instanceof Element;if(a){if(0===n)return{text:e};if(1===n)return{text:e,title:r[0]};if(2===n)return d(n,r),{icon:e};f(e,n)}else{if(s&&0===n)return d(n,r),{content:e};if(o.isPlainObject(e))return p(n,r),e;f(e,n)}};e.getOpts=function(){for(var t=[],e=0;e');
      $(".piyasa-indirim").each(function() {
        if ($(this).text() == "%" || !$(this).text()) $(this).remove();
      });
    });
  }
}
function ajaxLoaderDiv() {
  return '';
}
function sepetAdetGuncelle(lineID, adet) {
  // $('.basket-wrap:first').html(ajaxLoaderDiv());
  url =
    "page.php?act=sepet&op=guncelle&lineID=" +
    lineID +
    "&adet=" +
    adet +
    "&viewPopup=1&isAjax=1";
  $.get(url, function(data) {
    sepetHTMLGuncelle(data);
  });
}
function sepetSecimGuncelle(paytype, taksit) {
  // return;
  // $('.basket-wrap:first').html(ajaxLoaderDiv());
  url =
    "page.php?act=sepet&paytype=" +
    paytype +
    "&taksit=" +
    taksit +
    "&viewPopup=1&isAjax=1";
  $.get(url, function(data) {
    sepetHTMLGuncelle(data);
  });
}
function sepetSatirSil(lineID, urunID) {
  // $('.basket-wrap:first').html(ajaxLoaderDiv());
  url =
    "page.php?act=sepet&op=sil&lineID=" +
    lineID +
    "&urunID=" +
    urunID +
    "&viewPopup=1&isAjax=1";
  $.get(url, function(data) {
    sepetHTMLGuncelle(data);
  });
}
function sepetBosalt() {
  // $('.basket-wrap:first').html(ajaxLoaderDiv());
  url = "page.php?act=sepet&op=bosalt&viewPopup=1&isAjax=1";
  $.get(url, function(data) {
    sepetHTMLGuncelle(data);
  });
}
function sepetHTMLGuncelle(dataHTML) {
  if (
    $(dataHTML)
      .find(".basket-wrap:first")
      .html() != null
  )
    $(".basket-wrap:first").html(
      $(dataHTML)
        .find(".basket-wrap:first")
        .html()
    );
  var url = "include/ajaxLib.php?act=sepetGoster";
  $.get(url, function(data) {
    updateSepetBilgi("#toplamFiyat", "ModulFarkiIle");
    updateSepetBilgi("#toplamUrun", "toplamUrun");
    $("#sepetGoster .basket-wrap").html(
      $(data)
        .find(".basket-wrap")
        .html()
    );
    if (
      $(dataHTML)
        .find(".basket-wrap:first")
        .html() == null
    ) {
      $(".basket-wrap:first").html(
        $(data)
          .find(".basket-wrap:first")
          .html()
      );
    }
  });
}
function sepetAdresHTMLGuncelle() {
  var url = "page.php?act=satinal&op=adres";
  $.get(url, function(data) {
    $(".basket-wrap").html(
      $(data)
        .find(".basket-wrap")
        .html()
    );
  });
}
function goUrun(urunID) {
  if (!urunID) return;
  url = "include/ajaxLib.php?act=getUrunLink&urunID=" + urunID;
  $.get(url, function(data) {
    window.location.href = data;
  });
}
function goCat(catID) {
  if (!catID) return;
  url = "include/ajaxLib.php?act=getCategoryLink&catID=" + catID;
  $.get(url, function(data) {
    window.location.href = data;
  });
}
function urunListAjax(id, catID, order, limit, urunlist, urunlistshow) {
  url =
    "include/ajaxLib.php?act=urunList&catID=" +
    catID +
    "&orderBy=" +
    encodeURIComponent(order) +
    "&limit=" +
    limit +
    "&urunlist=" +
    encodeURIComponent(urunlist) +
    "&urunlistshow=" +
    encodeURIComponent(urunlistshow);
  $.get(url, function(data) {
    $("#" + id).html(data);
  });
}
function kategoriListAjax(id, parentID) {
  url = "include/ajaxLib.php?act=kategoriListOption&parentID=" + parentID;
  $.get(url, function(data) {
    $("#" + id).html(data);
  });
}
function shopPHPPaymentStep2(formID) {
  if (typeof myShopPHPPaymentStep2 == "function") {
    return myShopPHPPaymentStep2(formID);
  }
  if ($(".new-addres-item").length && !$(".addres-item.active").length) {
    alerter.show("Lütfen önce adres girişinizi yazın.");
    return;
  }
  $("#shopphp-payment-body-step3")
    .html("")
    .css("minHeight", "auto");
  $("#shopphp-payment-body-step2")
    .show()
    .html(ajaxLoaderDiv());
  if ($("#shopphp-payment-body-step2").length)
    $(window).scrollTop($("#shopphp-payment-body-step2").offset().top);
  $.ajax({
    type: "POST",
    url: "page.php?act=satinal&op=adres&viewPopup=1&isAjax=1",
    data: $("#" + formID).serialize(),
    success: function(response) {
      if ($("#shopphp-payment-body-step2").length)
        $("#shopphp-payment-body-step1").hide("fast");
      sepetAdresHTMLGuncelle();
      $.get("include/ajaxLib.php?act=siparisOdemeSecim", function(data) {
        if ($("#shopphp-payment-body-step2").length)
          $("#shopphp-payment-body-step2").html(data);
        else window.location.href = "page.php?act=satinal&op=secim";
        return;
      });
    }
  });
  return false;
}
function shopPHPPaymentStep3(selectedPayType) {
  if (!$("#shopphp-payment-body-step3").length) {
    window.location.href =
      "page.php?act=satinal&op=odeme&paytype=" +
      encodeURIComponent(selectedPayType);
    return;
  }
  $("#shopphp-payment-body-step3")
    .show()
    .html(ajaxLoaderDiv());
  $(window).scrollTop($("#shopphp-payment-body-step3").offset().top);
  $.ajax({
    type: "GET",
    url:
      "page.php?act=satinal&op=odeme&paytype=" +
      encodeURIComponent(selectedPayType) +
      "&viewPopup=1&isAjax=1",
    success: function(response) {
      $("#shopphp-payment-body-step1").hide("fast");
      $("#shopphp-payment-body-step2").hide("fast");
      if (
        $(response)
          .find("#shopphp-payment-body-step3")
          .html() == null
      ) {
        window.location.href =
          "page.php?act=satinal&op=odeme&paytype=" +
          encodeURIComponent(selectedPayType);
        return;
      }
      $("#shopphp-payment-body-step3").html(
        $(response)
          .find("#shopphp-payment-body-step3")
          .html()
      );
      $("#shopphp-payment-body-step3").css("minHeight", "600px");
      bindCCFunctions();
    }
  });
  return false;
}
function urunAjax(urunID, loadID, listTemp, showTemp) {
  if (!listTemp) listTemp = "empty";
  if (!$(".urun-ajax-" + urunID).length) return;
  $.get(
    "include/ajaxLib.php?act=tek-urun&purunID=" +
      urunID +
      "&urunID=" +
      loadID +
      "&list-temp=" +
      listTemp +
      "&show-temp=" +
      showTemp,
    function(data) {
      $(".urun-ajax-" + urunID).html($(data).html());
    }
  );
}
function urunFiyat(urunID, obj) {
  $.get("include/ajaxLib.php?act=urunFiyat&urunID=" + urunID, function(data) {
    $(obj).val(data);
  });
}
function odemeKontrol(alt) {
  if ($("#odeme-onay").length && !$("#odeme-onay").is(":checked")) {
    alerter.show(alt);
    return false;
  }
  return true;
}
function gfUrunFormSubmit(formID, urunID) {
  var dataSerialize = $("#" + formID).serialize();
//  $("#" + formID).html(ajaxLoaderDiv());
  $.ajax({
    type: "POST",
    url: "page.php?act=urunDetay&urunID=" + urunID + "&getOnlyResponse=1",
    data: dataSerialize,
    success: function(response) {
      $("#" + formID).html(response);
    }
  });
  return false;
}
function gfSiteFormSubmit(formID, act, data) {
  var dataSerialize = $("#" + formID).serialize();
  $("#" + formID).html(ajaxLoaderDiv());
  $.ajax({
    type: "POST",
    url: "page.php?act=" + act + "&getOnlyResponse=1&data=" + data,
    data: dataSerialize,
    success: function(response) {
      $("#" + formID).html(response);
    }
  });
  return false;
}
function sepetEkleKontrol() {
  sepetEkleKontrolValue = true;
  if (typeof preSepetEkleKontrol == "function") {
    preSepetEkleKontrol();
  }
  if (sepetEkleKontrolValue && typeof preSepetEkleKontrol2 == "function") {
    preSepetEkleKontrol2();
  }
  updateSecimURL();
  if ($("#urunKurallari").length) {
    if (!$("#urunKurallari").is(":checked")) {
      alerter.show(lang_onaySepet);
      sepetEkleKontrolValue = false;
    }
  }
  for (var i = 1; i <= 2; i++) {
    if (
      sepetEkleKontrolValue &&
      $(".urunSecim_ozellik" + i + "detay li").length > 1 &&
      !$(".urunSecim_ozellik" + i + "detay li.selected").length
    ) {
      alerter.show(lang_urunVarSecim);
      sepetEkleKontrolValue = false;
    }
  }
  for (var i = 1; i <= 2; i++) {
    if (
      sepetEkleKontrolValue &&
      $("select[name=ozellik" + i + "detay] option").length > 1 &&
      !$("select[name=ozellik" + i + "detay]").val()
    ) {
      alerter.show(lang_urunVarSecim);
      sepetEkleKontrolValue = false;
    }
  }
  for (var i = 1; i <= 2; i++) {
    if (
      sepetEkleKontrolValue &&
      $("#urunSecim_ozellik" + i + "detay").length &&
      !$("#urunSecim_ozellik" + i + "detay").val()
    ) {
      alerter.show(lang_urunVarSecim);
      sepetEkleKontrolValue = false;
    }
  }
  return sepetEkleKontrolValue;
}
function urunTooltip(urunAdi, gosterim) {
  if (gosterim <= 1) return;
  var str = lang_urunDefaIncelendi;
  str = str.replace(/%gosterim%/i, gosterim).replace(/%urunadi%/i, urunAdi);
  $('' + str + "
").appendTo("body");
  $("#urunTooltip").fadeTo("fast", 0.7);
  setTimeout(function() {
    $("#urunTooltip").fadeTo("fast", 0, function() {
      $(this).remove();
    });
  }, 5000);
}
function ebultenSubmit(objid) {
  var email = $("#" + objid).val();
  $.ajax({
    url: "include/ajaxLib.php?act=ebulten&email=" + encodeURIComponent(email),
    success: function(data) {
      alerter.show(data);
      $("#" + objid).val("");
    }
  });
  return false;
}
function azalt(input) {
  var eskiDeger = input.value,
    yeniDeger = parseInt(input.value) - 1;
  input.value = yeniDeger < 1 ? eskiDeger : yeniDeger;
  return false;
}
function arttir(input) {
  input.value = parseInt(input.value) + 1;
  return false;
}
function setImageMaxSideSize(selector, maxWidthSet, maxHeightSet) {
  $(selector).each(function() {
    var maxWidth = maxWidthSet; // Max width for the image
    var maxHeight = maxHeightSet; // Max height for the image
    var ratio = 0; // Used for aspect ratio
    var width = $(this).width(); // Current image width
    var height = $(this).height(); // Current image height
    // Check if the current width is larger than the max
    if (width > maxWidth) {
      ratio = maxWidth / width; // get ratio for scaling image
      $(this).css("width", maxWidth); // Set new width
      $(this).css("height", "auto"); // Scale height based on ratio
      height = height * ratio; // Reset height to match scaled image
      width = width * ratio; // Reset width to match scaled image
    }
    // Check if current height is larger than max
    if (height > maxHeight) {
      ratio = maxHeight / height; // get ratio for scaling image
      $(this).css("height", maxHeight); // Set new height
      $(this).css("width", "auto"); // Scale width based on ratio
      width = width * ratio; // Reset width to match scaled image
      height = height * ratio; // Reset height to match scaled image
    }
  });
}
function ajaxKarsilastir() {
  $.ajax({
    url: "include/ajaxLib.php?act=ajaxKarsilastir",
    success: function(data) {
      window.location.href = "page.php?act=karsilastir&" + data;
      // pencereAc('compare.php?' + data ,800,400);
    }
  });
  return false;
}
function karsilastirmaEkle(urunID) {
  $.ajax({
    url: "include/ajaxLib.php?CookieInsertUrunID=" + encodeURIComponent(urunID),
    success: function(data) {
      $.ajax({
        url: "include/ajaxLib.php?act=karsilastrimaListem",
        success: function(data) {
          $("#karsilastirmaListeBlock").html(data);
          alerter.show(lang_karsilastirmaEklendi);
        }
      });
    }
  });
  return false;
}
function karsilastirmaKaldir(urunID) {
  $.ajax({
    url: "include/ajaxLib.php?CookieRemoveUrunID=" + encodeURIComponent(urunID),
    success: function(data) {
      $.ajax({
        url: "include/ajaxLib.php?act=karsilastrimaListem",
        success: function(data) {
          $("#karsilastirmaListeBlock").html(data);
          alerter.show(lang_karsilastirmaKaldirildi);
        }
      });
    }
  });
  return false;
}
function alarmEkle(ftype, urunID) {
  $.ajax({
    url:
      "include/ajaxLib.php?ftype=" +
      encodeURIComponent(ftype) +
      "&urunID=" +
      encodeURIComponent(urunID),
    success: function(data) {
      alerter.show(lang_listeEklendi);
    }
  });
  return false;
}
function updateAnaResim(url, width) {
  return;
}
function uyelikIptal(str) {
  if (confirm(str))
    window.location.href = siteDizini + "page.php?act=logout&remove=true";
}
function updateOptionList(obj, stok) {
  if ($(obj) == null || stok == "") return;
  $(obj)
    .find("option")
    .remove();
  var maxSatis = $(obj)
    .parent()
    .prop("max");
  if (maxSatis) stok = Math.min(stok, maxSatis);
  stok = Math.min(stok, 100);
  for (var i = 0; i <= stok; i++) {
    if (i) $("" + i + " ").appendTo(obj);
  }
}
function moneyFormat3(num) {
  var p = num.toFixed(2).split(".");
  return (
    "" +
    p[0]
      .split("")
      .reverse()
      .reduce(function(acc, num, i, orig) {
        return num + (i && !(i % 3) ? "," : "") + acc;
      }, "") +
    "." +
    p[1]
  );
}
function updateShopPHPUrunFiyat(fark) {
  if (isNaN(fark)) fark = 0;
  $("#shopPHPUrunFiyatOrg").text(moneyFormat(shopPHPUrunFiyatOrg + fark));
  $("#shopPHPUrunFiyatT").text(
    moneyFormat((shopPHPUrunFiyatOrg + fark) / shopPHPFiyatCarpanT)
  );
  $("#shopPHPUrunFiyatOrg_KH").text(
    moneyFormat((shopPHPUrunFiyatOrg + fark) / (1 + shopPHPUrunKDV))
  );
  $("#shopPHPUrunFiyatYTL").text(
    moneyFormat((shopPHPUrunFiyatOrg + fark) * shopPHPFiyatCarpan)
  );
  $("#shopPHPUrunFiyatYTL_KH").text(
    moneyFormat(
      ((shopPHPUrunFiyatOrg + fark) * shopPHPFiyatCarpan) / (1 + shopPHPUrunKDV)
    )
  );
  $("#shopPHPHavaleIndirim").text(
    moneyFormat(
      (shopPHPUrunFiyatOrg + fark) *
        shopPHPFiyatCarpan *
        (1 - shopPHPHavaleIndirim)
    )
  );
  $("#shopPHPTekCekimOran").text(
    moneyFormat(
      (shopPHPUrunFiyatOrg + fark) *
        shopPHPFiyatCarpan *
        (1 - shopPHPTekCekimOran)
    )
  );
  if (paytrURL)
    $("#paytr_taksit_guncelle").html(
      '
'
    );
}
var shopPHPUrunFiyatOrg2 = 0;
function updateUrunSecim(urunID, varID, varName, widthDetay, widthList, obj) {
  if (!shopPHPUrunFiyatOrg2) shopPHPUrunFiyatOrg2 = shopPHPUrunFiyatOrg;
  if ($(obj).hasClass("disabled")) {
    alerter.show(lang_secimStokYok);
    return false;
  }
  if (varID == "ozellik1detay") {
    $(".urunSecim.urunSecim_ozellik2detay li")
      .removeClass("disabled")
      .removeClass("selected")
      .removeAttr("disabled");
    $(".urunSecim.urunSecim_ozellik2detay li").each(function() {
      var url =
        "include/ajaxLib.php?act=varStokKontrol&urunID=" +
        encodeURIComponent(urunID) +
        "&var1=" +
        encodeURIComponent($(obj).data("value")) +
        "&var2=" +
        encodeURIComponent($(this).data("value"));
      var li = this;
      $.get(url, function(data) {
        if (trim(data) == "-1")
          $(li)
            .attr("disabled", "disabled")
            .addClass("disabled");
      });
    });
  } else if (
    varID == "ozellik2detay" &&
    !$(".urunSecim.urunSecim_ozellik1detay li.selected").length &&
    !$(".urunSecim.urunSecim_" + urunID + "_ozellik1detay li.selected").length
  ) {
    alerter.show(lang_urunAnaVarSecim);
    return;
  }
  $(obj)
    .parent()
    .find("li")
    .removeClass("selected");
  $(obj).addClass("selected");
  var fark = 0;
  $("select").each(function() {
    if (
      parseFloat(
        $(this)
          .find("option:selected")
          .attr("fark")
      ) > 0
    )
      fark += parseFloat(
        $(this)
          .find("option:selected")
          .attr("fark")
      );
  });
  url =
    "include/ajaxLib.php?act=varStokKontrol&urunID=" +
    encodeURIComponent(urunID) +
    "&var1=" +
    encodeURIComponent(
      $(".urunSecim.urunSecim_ozellik1detay li.selected").data("value")
    ) +
    "&var2=" +
    encodeURIComponent(
      $(".urunSecim.urunSecim_ozellik2detay li.selected").data("value")
    );
  $.get(url, function(data) {
    fark += parseFloat(data);
    shopPHPUrunFiyatOrg = shopPHPUrunFiyatOrg2 + fark;
    if (fark) updateShopPHPUrunFiyat(0);
    else updateShopPHPUrunFiyat(0);
  });
  url =
    "include/ajaxLib.php?act=varKodKontrol&urunID=" +
    encodeURIComponent(urunID) +
    "&var1=" +
    encodeURIComponent(
      $(".urunSecim.urunSecim_ozellik1detay li.selected").data("value")
    ) +
    "&var2=" +
    encodeURIComponent(
      $(".urunSecim.urunSecim_ozellik2detay li.selected").data("value")
    );
  $.get(url, function(data) {
    if (data) $("#spUrunKodu").text(data);
  });
  updateOptionList(".urunSepeteEkleAdet", $(obj).attr("stok"));
  $("#urunSecim_" + varID).val(varName);
  updateSecimURL();
  updateVarResim(urunID, varID, varName);
  //  window.open(url);
}
function updateVarResim(urunID, varID, varName) {
  // alert(urunID + '-' + varID + '-' + varName);
  var url =
    "include/ajaxLib.php?ajax=1&act=urunResimListContainer&urunID=" +
    encodeURIComponent(urunID);
  $.get(url, function(data) {
    $("#urunResimListContainer").html(data);
    //	alert(data);
    var widthDetay = 600;
    varID = varID.replace(/ozellik/i, "").replace(/detay/i, "");
    var url =
      "include/ajaxLib.php?act=urunSecenekSecim&urunID=" +
      encodeURIComponent(urunID) +
      "&urunVarID=" +
      encodeURIComponent(varID) +
      "&urunVarName=" +
      encodeURIComponent(varName) +
      "&r=" +
      Math.floor(Math.random() * 99999);
    $(".lightbox .fancybox").attr("href", "include/resize.php?path=" + url);
    $.ajax({
      url: url,
      success: function(data) {
        $("#loading").remove();
        $("#urunResimListContainer img")
          .parent()
          .parent()
          .hide();
        var obj = jQuery.parseJSON(data);
        var url = "";
        if (obj.resim1) {
          $("#urunResimListContainer img:eq(0)")
            .parent()
            .parent()
            .show();
          url = "images/urunler/" + obj.resim1;
          $(".lightbox:first").attr("href", url);
          $(".lightbox:first img")
            .attr(
              "src",
              "include/resize.php?path=" + url + "&width=" + widthDetay
            )
            .attr("data-zoom-image", url);
          $("#urunResimListContainer img:first")
            .attr("src", "include/resize.php?path=" + url + "&width=300")
            .parent()
            .attr("data-zoom-image", url)
            .attr(
              "data-image",
              "include/resize.php?path=" + url + "&width=" + widthDetay
            )
            .unbind("click");
        }
        if (obj.resim2) {
          $("#urunResimListContainer img:eq(1)")
            .parent()
            .parent()
            .show();
          url = "images/urunler/" + obj.resim2;
          $("#urunResimListContainer img:eq(1)")
            .show()
            .attr("src", "include/resize.php?path=" + url + "&width=300")
            .parent()
            .attr("data-zoom-image", url)
            .attr(
              "data-image",
              "include/resize.php?path=" + url + "&width=" + widthDetay
            )
            .unbind("click");
        } else
          $("#urunResimListContainer img:eq(1)")
            .parent()
            .parent()
            .hide();
        if (obj.resim3) {
          $("#urunResimListContainer img:eq(2)")
            .parent()
            .parent()
            .show();
          url = "images/urunler/" + obj.resim3;
          $("#urunResimListContainer img:eq(2)")
            .show()
            .attr("src", "include/resize.php?path=" + url + "&width=300")
            .parent()
            .attr("data-zoom-image", url)
            .attr(
              "data-image",
              "include/resize.php?path=" + url + "&width=" + widthDetay
            )
            .unbind("click");
        } else
          $("#urunResimListContainer img:eq(2)")
            .parent()
            .parent()
            .hide();
        if (obj.resim4) {
          $("#urunResimListContainer img:eq(3)")
            .parent()
            .parent()
            .show();
          url = "images/urunler/" + obj.resim4;
          $("#urunResimListContainer img:eq(3)")
            .show()
            .attr("src", "include/resize.php?path=" + url + "&width=300")
            .parent()
            .attr("data-zoom-image", url)
            .attr(
              "data-image",
              "include/resize.php?path=" + url + "&width=" + widthDetay
            )
            .unbind("click");
        } else
          $("#urunResimListContainer img:eq(3)")
            .parent()
            .parent()
            .hide();
        if (obj.resim5) {
          $("#urunResimListContainer img:eq(4)")
            .parent()
            .parent()
            .show();
          url = "images/urunler/" + obj.resim5;
          $("#urunResimListContainer img:eq(4)")
            .parent()
            .parent()
            .show()
            .attr("src", "include/resize.php?path=" + url + "&width=300")
            .parent()
            .attr("data-zoom-image", url)
            .attr(
              "data-image",
              "include/resize.php?path=" + url + "&width=" + widthDetay
            )
            .unbind("click");
        } else $("#urunResimListContainer img:eq(4)").hide();
        $("#urunResimListContainer img").bind("click", function(e) {});
        galeri = [];
        var i = 0;
        $.each($("#urunResimListContainer a"), function() {
          galeri.push(
            $("#urunResimListContainer a")
              .eq(i)
              .attr("data-zoom-image")
          ),
            i++;
        });
        galeri[0] = $(".lightbox a")
          .eq(0)
          .attr("href");
        $(".zoomContainer").remove();
        if (!isMobile) {
          $(".lightbox img").unbind("click");
          $(".lightbox img").removeData("elevateZoom");
          $(".lightbox img").removeData("zoomImage");
          $(".lightbox:first img").elevateZoom({
            gallery: "urunResimListContainer",
            easing: true
          });
          $(".lightbox:first img").bind("click", function(e) {
            var ez = $(".lightbox:first img").data("elevateZoom");
            $.fancybox(ez.getGalleryList());
            return false;
          });
        }
      }
    });
  });
}
function sepeteEkleLink(urunID, obj) {
  updateSecimAppendURL(urunID);
  if (sepetEkleKontrol()) {
    window.location.href =
      siteDizini +
      "page.php?act=sepet&op=ekle&adet=" +
      urunSepeteEkleAdet +
      secimURL +
      "&urunID=" +
      urunID;
    return false;
  }
}
function hemenAlLink(urunID, obj) {
  updateSecimAppendURL(urunID);
  if (sepetEkleKontrol()) {
    window.location.href =
      siteDizini +
      "page.php?act=sepet&op=ekle&adet=" +
      urunSepeteEkleAdet +
      secimURL +
      "&urunID=" +
      urunID +
      "&hemenal=true";
    return false;
  }
}
function ajaxFiyatGuncelle(urunID)
{
  updateSecimURL();
  urunSepeteEkleAdet = $(".urunSepeteEkleAdet_" + urunID).val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = $(".urunSepeteEkleAdet").val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = 1;
  var url =
  "include/ajaxLib.php?ajax=1&act=sepetEkle&urunID=" +
  encodeURIComponent(urunID) +
  "&adet=" +
  encodeURIComponent(urunSepeteEkleAdet) +
  "&" +
  secimURL + '&showprice=true';
  $.get(url, function(data) {
    var m = data.split("|");
    m[0] = parseFloat(m[0]);
    m[1] = parseFloat(m[1]);
    $("#shopPHPUrunFiyatOrg").text(moneyFormat(m[1]));
    $("#shopPHPUrunFiyatT").text(
      moneyFormat(m[1])
    );
    $("#shopPHPUrunFiyatOrg_KH").text(
      moneyFormat((m[1]) / (1 + shopPHPUrunKDV))
    );
    $("#shopPHPUrunFiyatYTL").text(
      moneyFormat(m[0])
    );
    $("#shopPHPUrunFiyatYTL_KH").text(
      moneyFormat(
        ((m[1]) * 1) / (1 + shopPHPUrunKDV)
      )
    );
    $("#shopPHPHavaleIndirim").text(
      moneyFormat(
        (m[1]) *
          1 *
          (1 - shopPHPHavaleIndirim)
      )
    );
    $("#shopPHPTekCekimOran").text(
      moneyFormat(
        (m[1]) *
          1 *
          (1 - shopPHPTekCekimOran)
      )
    );
  });
}
function sepeteEkle(urunID, obj) {
  if (typeof mySepeteEkle == "function") {
    return mySepeteEkle(urunID, obj);
  }
  updateSecimURL();
  urunSepeteEkleAdet = $(".urunSepeteEkleAdet_" + urunID).val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = $(".urunSepeteEkleAdet").val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = 1;
  sepetEkleKontrol();
  if (sepetEkleKontrolValue) {
    var url =
      "include/ajaxLib.php?ajax=1&act=sepetEkle&urunID=" +
      encodeURIComponent(urunID) +
      "&adet=" +
      encodeURIComponent(urunSepeteEkleAdet) +
      "&" +
      secimURL;
    $.get(url, function(data) {
      if (data == "urun_link")
        window.location.href =
          siteDizini +
          "page.php?act=sepet&op=ekle&adet=" +
          urunSepeteEkleAdet +
          "&urunID=" +
          urunID;
      else if (data == "urun_var")
        alerter.show("Ürün daha önce sepetinize eklenmiş");
      else if (data == "urun_stok_yok")
        alerter.show("Ürün stoklarımızda bulunmamaktadır.");
      else {
        swal({
          text: "Ürün sepetinize eklendi.",
          timer: 1500,
          type: "info",
          icon: "success",
          button: lang_OK,
          showConfirmButton: false,
          showCancelButton: false
        });
        sepetHTMLGuncelle("");
        $(".urunSecim li").removeClass("selected");
        $(
          "#urunSecim_ozellik1detay,#urunSecim_ozellik2detay,#urunSecim_ozellik3detay"
        ).val("");
      }
      secimURL = "";
    });
  }
  return false;
}
function updateSepetBilgi(selector, act) {
  var url = "include/ajaxLib.php?act=sepetBilgi&op=" + encodeURIComponent(act);
  $.get(url, function(data) {
    $(selector).html(data);
  });
}
function multiSepetEkle() {
  //$(obj).parent().html(lang_lutfenBekleyin);
  var url =
    "include/ajaxLib.php?act=sepetEkle&urunID=" +
    encodeURIComponent($("#relUrunID").val()) +
    "&adet=" +
    encodeURIComponent(urunSepeteEkleAdet) +
    "&ajax=1";
  //window.open(url);
  $.get(url, function(data) {
    //alert(data);
    $("#sepetGoster").html(data);
  });
  for (var i = 0; i <= 10; i++) {
    if (
      $("#adet_" + i).val() &&
      $("#adet_" + i).val() >= 1 &&
      $("#adet_" + i).is(":checked")
    ) {
      var url =
        "include/ajaxLib.php?act=sepetEkle&urunID=" +
        encodeURIComponent($("#relUrunID").val()) +
        "&adet=" +
        $("#adet_" + i).val() +
        "&beraberUrunler=" +
        $("#adet_" + i).attr("urunID") +
        "&ekle_adet_" +
        $("#adet_" + i).attr("urunID") +
        "=" +
        $("#adet_" + i).val() +
        "&relUrunID=" +
        $("#relUrunID").val();
      $.get(url, function(data) {
        //alert(url + ' : ' + data);
        $("#sepetGoster").html(data);
      });
    }
  }
  setTimeout(function() {
    window.location.href = siteDizini + "page.php?act=sepet&x=1";
  }, 2000);
  return false;
}
function changeSPSlide(obj, num, total) {
  num = Math.round(num % total);
  $(obj)
    .find(".spSlide")
    .hide("fast");
  $(obj)
    .find(".spSlide:eq(" + num + ")")
    .fadeIn("slow");
  setTimeout(function() {
    changeSPSlide(obj, num + 1, total);
  }, 5000);
}
function tckimlikkontorolu(KimlikNo) {
  KimlikNo = String(KimlikNo);
  if (!KimlikNo.match(/^[0-9]{11}$/)) return false;
  pr1 = parseInt(KimlikNo.substr(0, 1));
  pr2 = parseInt(KimlikNo.substr(1, 1));
  pr3 = parseInt(KimlikNo.substr(2, 1));
  pr4 = parseInt(KimlikNo.substr(3, 1));
  pr5 = parseInt(KimlikNo.substr(4, 1));
  pr6 = parseInt(KimlikNo.substr(5, 1));
  pr7 = parseInt(KimlikNo.substr(6, 1));
  pr8 = parseInt(KimlikNo.substr(7, 1));
  pr9 = parseInt(KimlikNo.substr(8, 1));
  pr10 = parseInt(KimlikNo.substr(9, 1));
  pr11 = parseInt(KimlikNo.substr(10, 1));
  if ((pr1 + pr3 + pr5 + pr7 + pr9 + pr2 + pr4 + pr6 + pr8 + pr10) % 10 != pr11)
    return false;
  if (
    ((pr1 + pr3 + pr5 + pr7 + pr9) * 7 + (pr2 + pr4 + pr6 + pr8) * 9) % 10 !=
    pr10
  )
    return false;
  if (((pr1 + pr3 + pr5 + pr7 + pr9) * 8) % 10 != pr11) return false;
  return true;
}
function teklifFiyatGuncelle() {
  var ToplamKDVDahil = 0;
  var ToplamKDVHaric = 0;
  var KDVDahil = 0;
  var KDVHaric = 0;
  var KDV = 0;
  $("table.teklif tr.teklifSatir").each(function() {
    KDV = $(this)
      .find(".kdv")
      .text()
      .replace(/\%/i, "");
    KDVDahil =
      $(this)
        .find(".adet")
        .val() *
      $(this)
        .find(".fiyat")
        .val()
        .replace(/,/i, "");
    KDVHaric = KDVDahil / (1 + KDV / 100);
    ToplamKDVDahil += KDVDahil;
    ToplamKDVHaric += KDVHaric;
    $(this)
      .find(".toplam")
      .text(moneyFormat(KDVDahil));
  });
  $("#kdvdahil").html(moneyFormat(ToplamKDVDahil));
  $("#kdvharic").html(moneyFormat(ToplamKDVHaric));
  $("#toplamkdv").html(moneyFormat(ToplamKDVDahil - ToplamKDVHaric));
  $("#toplamytl").html(moneyFormat(ToplamKDVDahil));
  $("#dolar").html(moneyFormat(ToplamKDVDahil / dolar));
  $("#euro").html(moneyFormat(ToplamKDVDahil / euro));
}
function setSCity(city) {
  $.ajax({
    url: "include/ajaxLib.php?act=setCitySession&city=" + city,
    type: "GET",
    success: function(data) {
      //alert(data);
      window.location.reload();
    }
  });
}
function setSCountry(cnt) {
  $.ajax({
    url: "include/ajaxLib.php?act=setCountrySession&cnt=" + cnt,
    type: "GET",
    success: function(data) {
      //alert(data);
      window.location.reload();
    }
  });
}
function setFilterSession() {
  var seoURLAdd = "";
  var queryFilter = "";
  $("input.filterCheck").each(function() {
    if ($(this).is(":checked")) {
      queryFilter +=
        "queryFilter[]=" +
        $(this).attr("filterKey") +
        "::" +
        $(this).attr("filterValue") +
        "&";
      if (seoURLAdd) seoURLAdd += "-";
      seoURLAdd +=
        $(this).attr("filterKey") + "_" + $(this).attr("filterValue");
    }
  });
  if ($("#fiyat_slider3").length)
    queryFilter +=
      "queryFilter[]=" +
      $("#fiyat_slider3").attr("filterKey") +
      "::" +
      $("#fiyat_slider3")
        .val()
        .replace(";", " - ") +
      "&";
  $.ajax({
    url: "include/ajaxLib.php?act=setFilterSession",
    type: "POST",
    data: queryFilter,
    success: function(data) {
      //alert(data);
      data = decodeEntities(data);
      window.location.href = data;
      return;
      var url = window.location.href;
      url = url.replace(/page=[0-9]*/i, "page=1&");
      url = url.replace(/-p.[0-9]*\-/i, "_filter__" + seoURLAdd + "-p1-");
      // window.location.href = data;
    }
  });
}
function decodeEntities(html) {
  var txt = document.createElement("textarea");
  txt.innerHTML = html;
  return txt.value;
}
var mouseX, mouseY;
$(document)
  .mousemove(function(e) {
    mouseX = e.pageX;
    mouseY = e.pageY;
  })
  .mouseover(); // call the handler immediately
function bindCCFunctions() {
  $("input.cardno").bind("keydown", function(event) {
    if (event.keyCode == 32) {
      return false;
    }
  });
  //$('input[name$="cardno"],input.cardno').keypad({keypadOnly:false});
  $(".card-number").change(function() {
    if ($(this).hasClass("est-card-number")) return;
    if ($(this).val().length == 4) {
      $(this)
        .next()
        .focus();
    }
  });
  $(".card-number").keyup(function() {
    if ($(this).hasClass("est-card-number")) return;
    if ($(this).val().length == 4) {
      $(this)
        .next()
        .focus();
    }
  });
  $("span.button")
    .parents("form:first")
    .submit(function() {
      if (!stopSubmit)
        $(this)
          .find("span.button")
          .html(lang_lutfenBekleyin);
    });
}
function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if (new Date().getTime() - start > milliseconds) {
      break;
    }
  }
}
function saveSiparisForm(formID, op) {
  if (!formID) return;
  $.ajax({
    type: "POST",
    url: "page.php?act=satinal&op=adres",
    data: $("#" + formID).serialize(),
    success: function(response) {
      $.ajax({
        type: "GET",
        url: "page.php?act=onay&tp=" + op + "&viewPopup=1&r=" + Math.random(),
        success: function(response) {
          $(".fancybox-inner textarea").html(
            $(response)
              .find("textarea")
              .html()
          );
        }
      });
    }
  });
}
$(document).ready(function() {
  // device detection
  if (
    /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(
      navigator.userAgent
    ) ||
    /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
      navigator.userAgent.substr(0, 4)
    )
  )
    isMobile = true;
  $('#gf_email').keyup(function( e )
  {
      if(e.which === 32)
          return false;
  });
  $("#gf_ceptel,#gf_evtel,#gf_istel,.input-tel input").mask("(Z00) 000-0000", {
    translation: {
      Z: {
        pattern: /[1-9]/,
        optional: false
      }
    }
  });
  $("#gf_ebulten,#ebultenSMS").val("1");
  if (
    $(".basket-wrap")
      .parent()
      .width() < 1000
  )
    $(".basket-wrap").addClass("basket-tek");
  $(".basket-wrap").css("visibility", "visible");
  alerter = new Alerter();
  $("input[name=odemeSelect]:checked").click();
  $("#gf_odemeTipi").change(function() {
    sepetSecimGuncelle($(this).val(), 0);
  });
  $(".karlastirma-liste-checkbox").click(function() {
    if ($(this).is(":checked"))
      karsilastirmaEkle(
        $(this)
          .attr("id")
          .replace("k_", "")
      );
    else
      karsilastirmaKaldir(
        $(this)
          .attr("id")
          .replace("k_", "")
      );
  });
  // $('.qty').change(function() { sepetAdetGuncelle($(this).attr('id').replace('sepetadet_',''),$(this).val()); return false; });
  // $('ul.urunSecim_ozellik1detay li').addClass('renk filterCheck').each(function() { $(this).addClass($(this).attr('value')); })
  $("#gf_ceptel_alanKodu,#gf_istel_alanKodu,#gf_evtel_alanKodu").keyup(function(
    e
  ) {
    if ($(this).val().length == 4)
      $(
        "#" +
          $(this)
            .attr("id")
            .replace("alanKodu", "tel")
      ).focus();
  });
  $("input[name=uye-tipi]").click(function() {
    $(".bireysel,.kurumsal").hide();
    var className = $(this).attr("id");
    $("." + className).show();
  });
  $("input[name=uye-tipi]:first").click();
  $("#urunsirala input").click(function() {
    $("#urunsirala").submit();
  });
  $("a.viewStnOB").fancybox({
    beforeLoad: function() {
      var formID = $("a.viewStnOB")
        .parent()
        .attr("formID");
      saveSiparisForm(formID, "onsatis");
    },
    scrolling: "no",
    padding: 10,
    centerOnScroll: true,
    href: "page.php?act=onay&tp=onsatis&viewPopup=1&r=" + Math.random(),
    type: "ajax"
  });
  $("a.viewStnSAK").fancybox({
    beforeLoad: function() {
      var formID = $("a.viewStnSAK")
        .parent()
        .attr("formID");
      saveSiparisForm(formID, "satinalma");
    },
    scrolling: "no",
    padding: 10,
    centerOnScroll: true,
    href: "page.php?act=onay&tp=satinalma&viewPopup=1&r=" + Math.random(),
    type: "ajax"
  });
  $("#shopphp-payment-title-step1").click(function() {
    $("#shopphp-payment-body-step2,#shopphp-payment-body-step3").hide("fast");
    if ($("#shopphp-payment-body-step1").find("input").length) {
      $("#shopphp-payment-body-step1").show("fast");
    } else {
      $("#shopphp-payment-body-step1")
        .show("fast")
        .html(ajaxLoaderDiv());
      $.get("include/ajaxLib.php?act=viewForm", function(data) {
        $("#shopphp-payment-body-step1").html(data);
      });
    }
  });
  $("#shopphp-payment-title-step2").click(function() {
    if ($("#shopphp-payment-body-step1").find(".sf-button").length) {
      $("#shopphp-payment-body-step1")
        .find(".sf-button")
        .click();
    } else {
      $("#shopphp-payment-body-step2")
        .show("fast")
        .html(ajaxLoaderDiv());
      $.get("include/ajaxLib.php?act=siparisOdemeSecim", function(data) {
        $("#shopphp-payment-body-step2")
          .show("fast")
          .html(data);
        if ($(data).find("input").length)
          $("#shopphp-payment-body-step1,#shopphp-payment-body-step3").hide(
            "fast"
          );
      });
    }
  });
  $("select[name=ozellik2detay] option").attr("disabled", "disabled");
  $("select[name=ozellik2detay] option:first").removeAttr("disabled");
  $("select[name=ozellik1detay]").change(function() {
    $("select[name=ozellik2detay] option").attr("disabled", "disabled");
    $("select[name=ozellik2detay] option:first").removeAttr("disabled");
    $("select[name=ozellik2detay] option").each(function() {
      $("select[name=ozellik2detay]").prop("selectedIndex", 0);
      var url =
        "include/ajaxLib.php?act=varStokKontrol&urunID=" +
        $("select[name=ozellik1detay]").attr("urunID") +
        "&var1=" +
        encodeURIComponent($("select[name=ozellik1detay]").val()) +
        "&var2=" +
        encodeURIComponent($(this).attr("value"));
      var opt = this;
      //	window.open(url);
      $.get(url, function(data) {
        if (trim(data) != "-1") $(opt).removeAttr("disabled");
      });
      url =
        "include/ajaxLib.php?act=varKodKontrol&urunID=" +
        encodeURIComponent($("select[name=ozellik1detay]").attr("urunID")) +
        "&var1=" +
        encodeURIComponent($("select[name=ozellik1detay]").val()) +
        "&var2=" +
        encodeURIComponent($(this).attr("value"));
      $.get(url, function(data) {
        if (data) $("#spUrunKodu").text(data);
      });
    });
  });
  $("select.urunSecim").change(function() {
    updateVarResim(
      $(this).attr("urunID"),
      $(this).attr("varID"),
      $(this).val()
    );
    ajaxFiyatGuncelle($(this).attr("urunID"));
  });
  $(".filterComboSelect").change(function() {
    var id = $(this).attr("formid");
    $("#" + id).submit();
  });
  $('input[type="submit"]').click(function() {
    $(this).removeAttr("disabled");
  });
  $("div.button").click(function() {
    $(this)
      .find("input")
      .removeAttr("disabled")
      .click();
  });
  $(".dec,.azalt").click(function() {
    var simdiAdet = parseFloat($(".urunSepeteEkleAdet").val());
    if (simdiAdet > 1) simdiAdet--;
    $(".urunSepeteEkleAdet").val(simdiAdet);
    return false;
  });
  $(".inc,.arttir").click(function() {
    var simdiAdet = parseFloat($(".urunSepeteEkleAdet").val());
    simdiAdet++;
    $(".urunSepeteEkleAdet").val(simdiAdet);
    return false;
  });
  $("#fatura").click(function() {
    if ($(this).is(":checked")) $(".fatura").show();
    else $(".fatura").hide();
  });
  $("#vergi").click(function() {
    if ($(this).is(":checked")) $(".vergi").show();
    else $(".vergi").hide();
  });
  $('input[type="password"]').val("");
  $(".tooltip").tooltipster({ animation: "slide", speed: 100 });
  $(".iconListe")
    .parent()
    .css({ position: "relative" });
  $("#filterContainer input.filterCheck").change(function() {
    setFilterSession();
  });
  $("#gf_password").reviewPassword({
    preventWeakSubmit: false
  });
  $("#gf_kargoFirmaID,#gf_city,#gf_semt").change(function() {
    if ($("#gf_kargoFirmaID").val() != "") {
      $.ajax({
        url:
          "include/ajaxLib.php?act=kargoTutar&kargoFirmaID=" +
          $("#gf_kargoFirmaID").val() +
          "&data_country=" +
          encodeURIComponent($("#gf_country").val()) +
          "&data_city=" +
          encodeURIComponent($("#gf_city").val()) +
          "&data_semt=" +
          encodeURIComponent($("#gf_semt").val()) +
          "&r=" +
          Math.random(),
        success: function(data) {
          $("#gf_info_kargoFirmaID")
            .removeClass("sf-icon")
            .html(data);
        }
      });
    } else $("#gf_info_kargoFirmaID").html("");
  });
  $(".multiSepetCheckbox").each(function() {
    msc++;
    $(this).attr("id", "adet_" + msc);
  });
  $(".multiSepetCheckbox").click(function() {
    $("#caprazToplamAdet").text($(".multiSepetCheckbox:checked").length);
    var toplam = 0;
    $(".multiSepetCheckbox:checked").each(function() {
      toplam += parseFloat($(this).attr("kazanc"));
    });
    $("#caprazToplamKazanc").text(moneyFormat(toplam));
  });
  $("li[disabled=disabled]").addClass("disabled");
  $("table.teklif input").keyup(teklifFiyatGuncelle);
  $("#arttir,#azalt").click(function() {
    var obj = this;
    $("table.teklif .fiyat").each(function() {
      if ($(obj).prop("id") == "arttir")
        $(this).val(moneyFormat($(this).val() * (1 + $("#oran").val() / 100)));
      else
        $(this).val(moneyFormat($(this).val() * (1 - $("#oran").val() / 100)));
    });
    teklifFiyatGuncelle();
  });
  $(".MenuContainer").show();
  $(".HarfListe .Harf:last").css({ borderRight: "none" });
  $(".SubMenuItem a").each(function() {
    $(this).css({ marginLeft: $(this).prop("level") * 10 + "px" });
    if ($(this).prop("level") == 1)
      $(this).css({ padding: "0", background: "none" });
  });
  $(".FilitreKategori").css({
    width: $(".FilitreKategoriListe").width() / 3 - 40 + "px"
  });
  $("body").css("overflowX", "hidden");
  $(".spSlides").each(function() {
    var totalSlides = $(this)
      .find(".spSlide")
      .size();
    changeSPSlide(this, 0, totalSlides);
  });
  $("#detailSearchKey,.detailSearchKey").autocomplete(
    "include/ajaxLib.php?act=arama",
    {
      minChars: 2,
      width: 300,
      multiple: false,
      matchContains: true,
      formatItem: formatItem,
      formatResult: formatResult,
      selectFirst: false
    }
  );
  if (!isMobile) {
    $("a.fancybox-iframe").fancybox({
      type: "iframe",
      autoSize: true,
      afterLoad: function() {
        $.extend(this, {});
      },
      afterClose: function() {
        sepetHTMLGuncelle("");
      }
    });
    $(".lightbox:first").each(function() {
      $(this)
        .find("img:first")
        .attr("data-zoom-image", $(this).attr("href"));
    });
    $(".lightbox:first img").elevateZoom({
      gallery: "urunResimListContainer",
      easing: true
    });
    $(".lightbox:first img").bind("click", function(e) {
      var ez = $(".lightbox:first img").data("elevateZoom");
      $.fancybox(ez.getGalleryList());
      return false;
    });
    if ($(".lightbox img").length == 0)
      $(".lightbox").fancybox({
        openEffect: "elastic",
        closeEffect: "elastic",
        helpers: { title: { type: "inside" } }
      });
  } else {
    $("#urunResimListContainer a").click(function() {
      $(".lightbox:first img").attr("src", $(this).attr("data-zoom-image"));
    });
    $(".lightbox").removeAttr("href");
  }
  $("#imgSepetGoster,.imgSepetGoster").click(function() {
    if ($("body").width() < 700) {
      window.location.href = "page.php?act=sepet";
      return true;
    }
    if (!$("#sepetGoster").is(":visible")) {
      $("#sepetGoster").slideDown(200);
      $("#sepetGoster").css({
        top: mouseY + 40 + "px",
        left: mouseX - parseInt($("#sepetGoster").width()) + "px"
      });
    } else {
      $("#sepetGoster").slideUp(200);
    }
    return false;
  });
  $(".imgCaptchaRefresh").click(function() {
    $(this)
      .parent()
      .find(".imgCaptcha")
      .attr({ src: "include/create_captcha.php?u=1&" + Math.random() });
  });
  $("#gf_country,#gf_country2").change(function() {
    formCountryChange(this);
  });
  $("#gf_city,#gf_city2").change(function() {
    formCityChange(this);
  });
  $("#gf_semt").change(function() {
    if (!$("#gf_semt2").html()) return;
    var errorID = $(this)
      .prop("id")
      .replace(/gf_/i, "error_");
    $("#" + errorID).text("");
    $(".generatedForm .button").show();
    if (
      $(this)
        .find("option:selected")
        .attr("kargo") == 0
    ) {
      $("#" + errorID).text(" " + lang_ilceGonderimYok);
      $(".generatedForm .button").hide();
    }
    if (
      $(this)
        .find("option:selected")
        .attr("fiyatfarki") != 0 &&
      $(this)
        .find("option:selected")
        .attr("fiyatfarki")
    ) {
      var str = lang_ilceKargoFark;
      str = str.replace(
        /%fark%/i,
        $(this)
          .find("option:selected")
          .attr("fiyatfarki")
      );
      $("#" + errorID).text(" " + str);
    }
  });
  if ($("#gf_city").html()) formCityChange($("#gf_city"));
  if ($("#gf_country").html()) formCountryChange($("#gf_country"));
  $(".fillAddress").change(function() {
    var preFix = $(this).attr("addressPrefix");
    var pars = "act=addressList&adresID=" + encodeURIComponent($(this).val());
    $.ajax({
      url: "include/ajaxLib.php?" + pars,
      success: function(data) {
        var dataArray = data.split("||");
        $("#gf_address" + preFix).val(dataArray[0]);
        $("#gf_city" + preFix).val(dataArray[1]);
        var pars = "act=town&cityID=" + dataArray[1];
        $.ajax({
          url: "include/ajaxLib.php?" + pars,
          success: function(data) {
            $("#gf_semt" + preFix).html(data);
            $("#gf_semt" + preFix).val(dataArray[2]);
          }
        });
      }
    });
  });
  $(".sepeteEkleAdet").click(function() {
    $(this).val("");
  });
  //$('.sepeteEkleAdet[max=0]').attr('disabled','disabled');
  $(".sepeteEkleAdet").keyup(function(e) {
    var key = e.charCode || e.keyCode || 0;
    var total = $(this).val();
    urunSepeteEkleAdet = total;
    return;
    var OK =
      key == 8 ||
      key == 9 ||
      key == 46 ||
      (key >= 37 && key <= 40) ||
      (key >= 48 && key <= 57) ||
      (key >= 96 && key <= 105);
    if (is_int(total)) {
      OK = true;
      urunSepeteEkleAdet = total;
      return true;
    }
    if (OK) {
      if (parseInt(total) > $(this).prop("max")) {
        $(this).val($(this).prop("max"));
        alerter.show(lang_urunStoguAsanDeger);
        urunSepeteEkleAdet = $(this).val();
        return false;
      }
      urunSepeteEkleAdet = total;
      return true;
    } else return false;
  });
  bindCCFunctions();
  $(".urunSecimTable select").change(updateSecimURL);
  updateSecimURL();
  if (pushAlert.length > 0) alerter.show(pushAlert);
  $('a[href="#"]').click(function() {
    return false;
  });
  $(".piyasa-indirim").each(function() {
    if ($(this).text() == "%" || !$(this).text()) $(this).remove();
  });
  $(".fancybox").fancybox({
    afterLoad: function() {
      this.wrap.find(".fancybox-inner").css({
        overflowY: "auto",
        overflowX: "hidden"
      });
    }
  });
});
function adresSil(obj) {
  if (
    !confirm(
      "Bu adres silmek istediğinizden emin misiniz? Bu işlem geri alınamaz."
    )
  )
    return;
  $.ajax({
    url:
      "include/mod_SiparisAdresSecim.php?deleteAjaxAddressID=" +
      $(obj).attr("addressID"),
    type: "GET",
    success: function(data) {
      window.location.reload();
    }
  });
  return false;
}
function adresKayit(obj, formID) {
  var checkFor = [
    "name",
    "lastname",
    "city",
    "semt",
    "address",
    "baslik",
    "ceptel"
  ];
  for (i = 0; i < checkFor.length; i++) {
    if (
      !$(formID)
        .find("[name='" + checkFor[i] + "']")
        .val()
    ) {
      alerter.show(lang_eksiksizDoldurun);
      $(formID)
        .find("[name='" + checkFor[i] + "']")
        .focus();
      return false;
    }
  }
  $.ajax({
    url:
      "include/mod_SiparisAdresSecim.php?setAjaxAddressID=" +
      $(obj).attr("addressID"),
    type: "POST",
    data: $(formID).serialize(),
    success: function(data) {
      window.location.reload();
    }
  });
  return false;
}
function adresGuncelle(obj) {
  $.fancybox({
    autoSize: true,
    href:
      "include/mod_SiparisAdresSecim.php?getAjaxAddressID=" +
      $(obj).attr("addressID"),
    type: "ajax"
  });
  return false;
}
function updateSecimAppendURL(urunID) {
  urunSepeteEkleAdet = $(".urunSepeteEkleAdet_" + urunID).val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = $(".urunSepeteEkleAdet").val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = $(".sepeteEkleAdet").val();
  if (!urunSepeteEkleAdet) urunSepeteEkleAdet = 1;
  secimURLAppend = "";
  if ($(".urunSecim.urunSecim_" + urunID + "_ozellik1detay li.selected").length)
    secimURLAppend +=
      "&ozellik1detay=" +
      encodeURIComponent(
        $(".urunSecim.urunSecim_" + urunID + "_ozellik1detay li.selected").attr(
          "value"
        )
      );
  if ($(".urunSecim.urunSecim_" + urunID + "_ozellik2detay li.selected").length)
    secimURLAppend +=
      "&ozellik2detay=" +
      encodeURIComponent(
        $(".urunSecim.urunSecim_" + urunID + "_ozellik2detay li.selected").attr(
          "value"
        )
      );
}
function updateSecimURL() {
  if ($(".urunSepeteEkleAdet").length > 0)
    urunSepeteEkleAdet = parseFloat($(".urunSepeteEkleAdet").val());
  secimURL = "";
  if ($("#urunSecim_ozellik1detay").val())
    secimURL =
      "&ozellik1detay=" +
      encodeURIComponent($("#urunSecim_ozellik1detay").val());
  if ($("#urunSecim_ozellik2detay").val())
    secimURL +=
      "&ozellik2detay=" +
      encodeURIComponent($("#urunSecim_ozellik2detay").val());
  if ($("#urunSecim_ozellik3detay").val())
    secimURL +=
      "&ozellik3detay=" +
      encodeURIComponent($("#urunSecim_ozellik3detay").val());
  if ($("#urunSecim_ozellik4detay").val())
    secimURL +=
      "&ozellik4detay=" +
      encodeURIComponent($("#urunSecim_ozellik4detay").val());
  if ($("#urunSecim_ozellik5detay").val())
    secimURL +=
      "&ozellik5detay=" +
      encodeURIComponent($("#urunSecim_ozellik5detay").val());
  if ($("#freeID").val())
    secimURL += "&freeID=" + encodeURIComponent($("#freeID").val());
  if ($("#combineID").val())
    secimURL += "&combineID=" + encodeURIComponent($("#combineID").val());
  secimURL += secimURLAppend;
}
function formCountryChange(obj) {
  if (!$(obj).val()) return;
  var cityID = $(obj)
    .attr("id")
    .replace(/country/i, "city");
  $("#" + cityID).html("" + lang_yukleniyor + " ");
  var semtID = $(obj)
    .attr("id")
    .replace(/country/i, "semt");
  if ($(obj).val() != "1")
    $("#" + semtID)
      .html("")
      .parent()
      .hide();
  else {
    $("#" + semtID)
      .parent()
      .show();
    $("#" + semtID).html("");
  }
  var pars = "act=city&cID=" + $(obj).val();
  $.ajax({
    url: "include/ajaxLib.php?" + pars,
    success: function(data) {
      var selected = $("#" + cityID).attr("secili");
      $("#" + cityID).html(data);
      $("#" + cityID + " option[value='" + selected + "']").attr(
        "selected",
        "selected"
      );
      if (isMobile) $("#" + cityID).selectmenu("refresh", true);
    }
  });
  return true;
}
function formCityChange(obj) {
  if (!$(obj).val()) return;
  var semtID = $(obj)
    .attr("id")
    .replace(/city/i, "semt");
  $("#" + semtID).html("" + lang_yukleniyor + " ");
  var pars = "act=town&for=" + semtID + "&cityID=" + $(obj).val();
  if ($("#" + semtID).attr("filter") == "true") pars += "&valid=true";
  $.ajax({
    url: "include/ajaxLib.php?" + pars,
    success: function(data) {
      var selected = $("#" + semtID).attr("secili");
      $("#" + semtID).html(data);
      $("#" + semtID + " option[value='" + selected + "']").attr(
        "selected",
        "selected"
      );
      if (isMobile) $("#" + semtID).selectmenu("refresh", true);
    }
  });
  return true;
}
function trim(stringToTrim) {
  return stringToTrim.replace(/^\s+|\s+$/g, "");
}
function checkSimpleCaptcha(formID) {
  var pars = "txtCaptcha=" + $("." + formID + "_txtCaptcha").val();
  $.ajax({
    url: "include/ajaxLib.php?act=simplecaptcha",
    type: "POST",
    data: pars,
    success: function(data) {
      data = trim(data);
      if (data == "false" || !data) {
        alerter.show("Güvenlik kodu hatalı.");
      } else {
        $(".formdeger").val(data);
        $("#" + formID).submit();
      }
    }
  });
}
function checkCaptcha(formID) {
  var pars =
    "recaptcha_challenge_field=" +
    $("#recaptcha_challenge_field").val() +
    "&recaptcha_response_field=" +
    $("#recaptcha_response_field").val();
  $.ajax({
    url: "include/ajaxLib.php?act=captcha",
    type: "POST",
    data: pars,
    success: function(data) {
      data = trim(data);
      if (data == "false" || !data) {
        alerter.show("Güvenlik kodu hatalı.");
        Recaptcha.reload();
      } else {
        $(".formdeger").val(data);
        $("#" + formID).submit();
      }
    }
  });
}
var ArkadasimaGonderWidth = 450;
var ArkadasimaGonderHeight = 440;
function arkadasimaGonderPopup(urunID) {
  window.open(
    "popup.php?act=arkadasimaGonder&urunID=" + urunID,
    "_blank",
    "width=" + ArkadasimaGonderWidth + ",height=" + ArkadasimaGonderHeight
  );
  return false;
}
function formatItem(row) {
  return (
    '' +
      lang_lutfenBekleyin +
      " 
";
    //alert(secilenUrunArray.length);
    for (var i = 0; i < secilenUrunArray.length; i++) {
      var url =
        "include/ajaxLib.php?act=teklifEkle&urunID=" +
        secilenUrunArray[i] +
        "&adet=" +
        secilenAdetArray[i];
      //window.open(url);
      if (i < secilenUrunArray.length - 1) {
        $.get(url, function(data) {});
      } else {
        $.get(url, function(data) {
          window.location = siteDizini + "page.php?act=tekliflerim";
        });
      }
    }
    window.location = siteDizini + "page.php?act=tekliflerim";
  }
}
function hizliUrunGoster(urunID) {
  if (isMobile) return goUrun(urunID);
  $.fancybox({
    type: "iframe",
    autoSize: true,
    href: "popup.php?act=urunDetay&urunID=" + urunID,
    afterClose: function() {
      sepetHTMLGuncelle("");
    }
  });
  return false;
}
function quickLogin(name, password) {
  var url =
    "include/ajaxLib.php?act=quickCheckUser&username=" +
    encodeURIComponent(name) +
    "&password=" +
    encodeURIComponent(password);
  $.get(url, function(data) {
    if (data) {
      location.reload(true);
    } else alerter.show(lang_hataliKullaniciVeyaSifre);
  });
  return false;
}
function quickRegister(name, lastname, email, password, gsm, sex, rule) {
  if (!name || !lastname || !email || !password || !gsm || !sex) {
    alerter.show(lang_eksiksizDoldurun);
    return false;
  }
  if (!rule) {
    alerter.show("Lütfen kurallar bölümünü onaylayın.");
    return false;
  }
  var url =
    "include/ajaxLib.php?act=quickRegister&name=" +
    encodeURIComponent(name) +
    "&lastname=" +
    encodeURIComponent(lastname) +
    "&email=" +
    encodeURIComponent(email) +
    "&pass=" +
    encodeURIComponent(password) +
    "&gsm=" +
    encodeURIComponent(gsm) +
    "&sex=" +
    encodeURIComponent(sex);
  $.get(url, function(data) {
    if (data == "ue") alerter.show(lang_epostaDahaOnceAlinmis);
    else {
      quickLogin(email, password);
    }
  });
  return false;
}
function quickContact(
  name,
  nameValidate,
  email,
  emailValidate,
  tel,
  telValidate,
  msg,
  msgValidate
) {
  var stop = false;
  if (nameValidate && !name) stop = true;
  else if (emailValidate && !email) stop = true;
  else if (telValidate && !tel) stop = true;
  else if (msgValidate && !msg) stop = true;
  if (stop) alerter.show(lang_eksiksizDoldurun);
  else if (emailValidate && !Validate_Email_Address(email))
    alerter.show(lang_hataliEposta);
  else {
    $.ajax({
      url:
        "include/ajaxLib.php?act=quickContact&urunID=0&namelastname=" +
        encodeURIComponent(name) +
        "&ceptel=" +
        encodeURIComponent($("#tel").val()) +
        "&email=" +
        encodeURIComponent($("#xemail").val()),
      success: function(data) {
        alerter.show(lang_iletisimOK);
      }
    });
  }
  return false;
}
function teklifSepetEkle() {
  $(".teklifInfoTable").html('' +
      lang_lutfenBekleyin +
      " 
";
    //alert(secilenUrunArray.length);
    for (var i = 0; i < secilenUrunArray.length; i++) {
      var url =
        "include/ajaxLib.php?act=sepetEkle&urunID=" +
        encodeURIComponent(secilenUrunArray[i]) +
        "&adet=" +
        encodeURIComponent(secilenAdetArray[i]);
      if (i < secilenUrunArray.length - 1) {
        $.get(url, function(data) {});
      } else {
        $.get(url, function(data) {
          setTimeout(function() {
            window.location.href = siteDizini + "page.php?act=sepet";
          }, 2000);
        });
      }
    }
    // window.location = 'page.php?act=sepet';
  }
}
function updateSubMarka(sID) {
  document.getElementById("opt3").options.length = 1;
  document.getElementById("opt3").options[0].text = lang_lutfenBekleyin;
  var pars = "act=topSubMarka&catID=" + sID;
  $.ajax({
    url: "include/ajaxLib.php?act=topSubMarka&catID=" + sID,
    success: function(data) {
      upOptions("opt3", data);
    }
  });
  topCatID =
    document.getElementById("opt2").selectedIndex >= 0
      ? document.getElementById("opt2").options[
          document.getElementById("opt2").selectedIndex
        ].value
      : document.getElementById("opt1").options[
          document.getElementById("opt1").selectedIndex
        ].value;
}
function upOptions(id, result) {
  document.getElementById(id).options.length = 0;
  var optsArray = result.split("||");
  for (var i = 0; i < optsArray.length; i++) {
    var optDataArray = optsArray[i].split("$$");
    optDataArray[1] = optDataArray[1].replace("'", "'");
    document.getElementById(id).options[
      document.getElementById(id).options.length
    ] = new Option(optDataArray[1], optDataArray[0]);
  }
}
// Üst Kategori Listesi Fonksiyonları
var toplamkdvdahil = 0;
var toplamkdvharic = 0;
var toplamkdv = 0;
var KDVHaricArray = new Array();
function updateToplam() {
  var is = document.getElementsByTagName("input");
  toplamkdvdahil = 0;
  toplamkdvharic = 0;
  toplamkdv = 0;
  for (var i = 0; i < is.length; i++) {
    if (is[i].id.indexOf("fiyat_") == 0) {
      var realID = is[i].id.replace("fiyat_", "");
      toplamkdvdahil += parseFloat(is[i].value);
      if (KDVHaricArray[realID])
        toplamkdvharic += parseFloat(KDVHaricArray[realID]);
    }
  }
  toplamkdv = toplamkdvdahil - toplamkdvharic;
  document.getElementById("kdvdahil").innerHTML = moneyFormat(toplamkdvdahil);
  //document.getElementById('kdvharic').innerHTML = moneyFormat(toplamkdvharic);
  document.getElementById("toplamytl").innerHTML = moneyFormat(toplamkdvdahil);
  //document.getElementById('toplamkdv').innerHTML = moneyFormat(toplamkdv);
  document.getElementById("dolar").innerHTML = moneyFormat(
    toplamkdvdahil / dolar
  );
  document.getElementById("euro").innerHTML = moneyFormat(
    toplamkdvdahil / euro
  );
  if (document.getElementById("havaleile"))
    document.getElementById("havaleile").innerHTML = moneyFormat(
      toplamkdvdahil - toplamkdvdahil * havaleindirim
    );
}
function updateKategori(urunID) {
  var url = "include/ajaxLib.php";
  var catID = 0;
  var data = "";
  var myAjax = new Array();
  for (var i = 2; i <= updatekategori; i++) {
    catID = catNum[i];
    var pars =
      "act=updateKategori&urunID=" +
      urunID +
      "&catID=" +
      catID +
      "&randID=" +
      Math.floor(Math.random() * 1000000);
    var target = "catNum_" + i;
    if (urunID > 0) {
      pcTopLoading(i);
      $("#" + target).load("include/ajaxLib.php?" + pars);
    }
    up("adet_" + catID, 0);
    up("fiyat_" + catID, 0);
    document.getElementById("detail_href_" + catID).href = "#";
    document.getElementById("detail_href_" + catID).target = "_self";
    ch("stok_" + catID, "stok_def_" + catID);
    KDVHaricArray[catID] = 0;
  }
  updateToplam();
}
function pcTopLoading(i) {
  document.getElementById("catNum_" + i).innerHTML =
    '%urunadi%  son 24 saatte %gosterim%  defa incelendi.';
var lang_karsilastirmaEklendi = 'Ürün karşılaştırma listesine eklendi.';
var lang_listeEklendi = 'Ürün listenize eklendi.';
var lang_secimStokYok = 'İlgili seçim stokta bulunmamaktadır.';
var lang_ilceGonderimYok = 'Bu ilceye gonderimimiz yoktur.';
var lang_ilceKargoFark = 'Bu ilceye %fark% TL kargo farki uygulanmaktadır.';
var lang_hataliKullaniciVeyaSifre = 'Hatalı kullanıcı adı ve/veya şifre';
var lang_eksiksizDoldurun = 'Lütfen bilgileri eksiksiz doldurun';
var lang_hataliEposta = 'Hatalı e-posta adresi.';
var lang_iletisimOK = 'Sizinle ek kısa sürede iletişime geçeceğiz. Teşekkürler.';
var lang_sifreGuvenligi = 'Şifre Güvenliği';
var lang_karsilastirmaKaldirildi = 'Ürün karşılaştırma listenizden kaldırıldı.';
var lang_OK = 'Tamam';
var siteDizini = '/';