var intCase = 1; var imgSrc; var intervalCase; var activeImage = 0; if (typeof(autoSlideImages) == "undefined" || autoSlideImages == true) intervalCase = window.setInterval(slideCase, 3000); // vitrini otomatik döndür $(document).ready(function(){ //libraries if (document.getElementById('tabs')) $("#tabs").tabs({ remote: true, load: function(){ if (imgSrc!=undefined && imgSrc!=''){ document.previewImg.src=imgSrc; imgSrc = ''; } } }); if ($('#mycarousel li').length > 1) $('#mycarousel').jcarousel({ auto: 0, wrap: 'last' }); if (prettyOpts !== false) $("a[rel^='no_rel_method']").prettyPhoto(prettyOpts); if (zoomOpts !== false) $(function() { $("#main-image").jqzoom(zoomOpts)}); //events $("#wrap, #wrap2").mouseover(stopSlide); $("#tavsiye-et").click(function(){ $("#tavsiye-form").show(); $("#tavsiye-form").trigger('click'); return false; }); $(".SepetEkle").live("click", function() { var altUrunId = $('#AltUrunId').val(); if (document.getElementById('AltUrunId') && (altUrunId == '' || altUrunId <= 0)) { altUrunId = -1; } var adet = $('#Adet').val(); if (isNaN(adet)) adet = 1; if ($(this).attr('alt') == 'satin-al') sepeteEkle.onSuccess = sepeteGit; sepeteEkle($('#urun-id').val(), altUrunId, adet); sepeteEkle.onAlturunAlert = null; return false; }); //büyük resim değişme olayı if (typeof(clickActionSlide) != "undefined" && clickActionSlide == true) { $(".kl>img").click(slideReady); $("#wrap2 a").click(showJqLightbox); $(".kl").click(function(){ return false; }); } else { $(".kl>img").mouseover(slideReady); $(".kl, #wrap2 a").click(showJqLightbox); } //tür1 varsa resmini seçili yap if (document.getElementById('alt-grup-1') && $('#alt-grup-1').val() > 0) changePictureByType($('#alt-grup-1').val(), true); //$("#wrap").mouseout(function(){ intervalCase = window.setInterval(slideCase,3000); }) // adet kontrolleri $('.Arti,.Eksi').live('click', function() { var artis_miktari = $(this).attr('alt') || 1; var adet_deger = $('#Adet').val(); adet_deger = adet_deger.replace(',','.'); adet_deger = parseFloat(adet_deger); artis_miktari = artis_miktari - 0; adet_deger = adet_deger - 0; if ((adet_deger + artis_miktari) <= 0) return false; ondalik_adet = artis_miktari - Math.floor(artis_miktari); ondalik_adet = ondalik_adet.toString().length - 2; if (ondalik_adet < 0) ondalik_adet = 0; var tot = round(adet_deger + artis_miktari, 2); $('#Adet').val(tot); tot = tot.toString(); if (tot.length > 3) $('#Adet').css('width', tot.length * 7); return false; }); $('input:#Adet').live('click', function() { $(this).select(); }) $('input:#Adet').live('change', function() { var deger = $(this).val(); deger = $(this).val(); deger = deger.replace(',','.'); deger = deger.replace('-',''); if (deger <= 0 || isNaN(deger)) $(this).val(1); else $(this).val(deger); }); $('input:#Adet').live('keydown', function(e) { var deger = $(this).val(); if (deger.length > 2 && deger.length <= 5) $(this).css('width', deger.length * 10); }); $('input:#Adet').live('blur', function(e) { var deger = parseFloat($(this).val()); var artis = $('.Arti').attr('alt') || 1; deger -= 0; artis -= 0; if (artis == 0) return false; var carpan = Math.ceil(deger / artis); $(this).val(round(carpan * artis, 4)); }); initSubProdutTypes(); var hash = window.location.hash; if (hash.substr(0, 4) == '#tab') { var selectTab = hash.replace('#tab', ''); $('#tabs').tabs('select', selectTab); window.location.hash = ''; } }); function changePictureByType(typeId, contiuneSlide) { if (typeof(imagesFromType) != "undefined" && imagesFromType == true) { if ($('#alt-grup-1').val() == typeId) { //tür resimleri sadece 1.grup türlerinde çalışır. $('#mycarousel li').hide(); $('#mycarousel .show-case-mini-holder-' + typeId).show(); } } $('#wrap img').each(function(i) { if ($(this).attr('rel') == typeId) { var el = $('#'+$(this).attr('id')); activeImage = i; intCase = i + 1; if (contiuneSlide !== true) stopSlide(); slideAction(el); return false; } }); }; function initSubProdutTypes(grNumber) { if (isNaN(grNumber)) { initSubProdutTypes(1); initSubProdutTypes(2); return true; } var grType = parseInt($('#group' + grNumber + '-type').val()); switch (grType) { case 1 : $("#alt-grup-"+grNumber).live("change", function() { changePictureByType($(this).val()); subProductTypes(); }); break; case 2 : $("input:radio[name=alt_grup_" + grNumber + "]").live("click", function() { changePictureByType($("#group" + grNumber + "-wrapper input[type='radio']:checked").val()); subProductTypes(); }); break; case 3 : case 4 : case 5 : $("#group" + grNumber + "-wrapper a").live("click", function() { changePictureByType($(this).attr('href').replace('#', '')); $("#group" + grNumber + "-wrapper a").removeClass('alturun_secili'); $(this).addClass('alturun_secili'); subProductTypes(); return false; }); break; case 6 : var settings = { 'templateItem' : '
  • ${name}
  • ', 'height' : '35px', 'allowFilter' : false, 'class' : 'big-image' }; window.cbAnime = $( "#combobox-tmpl-anime" ).comboboxtmpl( settings ); $(window.cbAnime).live( 'comboboxtmplchange', function ( event, ui ) { if ($('#sub-flow').attr('start') == 'true') { changePictureByType($(ui).attr('data-value')); subProductTypes(); } $('#sub-flow').attr('start', 'true'); }); break; case 7 : var settings = { 'templateItem' : '
  •  ${name}
  • ', 'height' : '20px', 'allowFilter' : false, 'class' : 'big-image' }; window.cbAnime = $( "#combobox-tmpl-anime" ).comboboxtmpl( settings ); $(window.cbAnime).live( 'comboboxtmplchange', function ( event, ui ) { if ($('#sub-flow').attr('start') == 'true') { changePictureByType($(ui).attr('data-value')); subProductTypes(); } $('#sub-flow').attr('start', 'true'); }); break; default: break; } return false; } function subProductTypes() { var tur1Id = getSelectedTypeId(1); var tur2Id = getSelectedTypeId(2); if (tur1Id > 0 || tur2Id > 0) subProduct('', tur1Id, tur2Id); } function subProduct(id,tur1Id,tur2Id) { var h = $('#fiyat-form-ajax').height()+50, w = $('#fiyat-form-ajax').width(),x,y,ld,p; var grType = parseInt($('#group1-type').val()); ld = 'ajax-loader.gif'; if (grType == '3' && $("#group1-wrapper .alturun_secili").length > 0) { var el = $("#group1-wrapper .alturun_secili"); p = el.position(); x = p.left + el.width() / 2 - 4 + 'px'; y = p.top + el.height() / 2 + 14 + 'px'; } else if (grType == '1') { p = $("#alt-grup-1").position(); x = p.left + $("#alt-grup-1").width() / 2 + 'px'; y = p.top + $("#alt-grup-1").height() / 2 + 'px'; ld = 'ajax-loader.gif'; } if (x == null || y == null) { x = 'center'; y = '200px;' } $('#fiyat-form-ajax').append('
    '); $.ajax({ type: "POST", url: "ajax.php", data : "m=Block&fn=subProductPrice&spId=" + id + '&prId=' + $('#urun-id').val()+'&tur1Id=' + tur1Id + '&tur2Id=' + tur2Id, success: function(cevap) { $("#fiyat-form-ajax").html(cevap); } }); } function getSelectedTypeId(grNumber) { var grType = parseInt($('#group' + grNumber + '-type').val()); switch (grType) { case 1 : return $("#alt-grup-" + grNumber).val(); case 2 : return $("#group" + grNumber + "-wrapper input[type='radio']:checked").val(); case 3 : case 4 : case 5 : var id = $("#group" + grNumber + "-wrapper .alturun_secili").attr('href'); if (id != '' && id != null) return id.replace('#', ''); else return ''; case 6 : case 7 : return $(".jqcmbx-ul .active").attr('data-value'); break; default: return false; } } //functions function showJqLightbox() { if (prettyOpts === false) return false; stopSlide(); $.prettyPhoto.open(images,titles,descri); $.prettyPhoto.changePage(activeImage); return false; } function stopSlide() { if (intervalCase != undefined) clearInterval(intervalCase); } function slideCase() { var i=0; $(".kl>img").each(function(){ if (intCase == i) { slideAction($(this)); activeImage = intCase; intCase++; return false; } i++; }); if (i == intCase) intCase=0; } function slideReady() { stopSlide(); var activeEl = $(this); $(".kl>img").each(function(i){ if (activeEl.attr('id') == $(this).attr('id')) { activeImage = i; return false; } }); slideAction(activeEl); return false; } function slideAction(el) { var orj_src = el.attr("src"); var new_src = ''; if ($('#u-mrw').val() == 1) { new_src = orj_src.replace('FK','F' + imageSize); } else { new_src = orj_src.replace('\/K\/','\/'+ imageSize +'\/'); } $("#show-case").hide().attr('src', new_src).fadeIn(250); if (zoomOpts !== false) { new_src = orj_src.replace('K','B'); $('#main-image').attr('href', new_src); } } function yorumEkleFormuGoster(id) { $.ajax({ type: "POST", url: "ajax.php", data : "m=Block&fn=commentWrite&prId="+id, success: function(cevap) { $(".TabYorumlar").html(cevap); } }); } function yorumYaz(id) {yorumEkleFormuGoster(id);} function yorumEkle(id) {yorumEkleFormuGoster(id);} function yorumKaydet(prId) { if ( $("#YeniYorum textarea").val() == '') { $('#YeniYorum textarea').parent().append('Lütfen yorumunuzu giriniz'); return false; } $.ajax({ type : "POST", url : "ajax.php", data : { m : 'Block', fn : 'commentSave', prId : prId, Derece : $("#ddlStars").val(), Baslik : $("#YeniYorum input[name=Baslik]").val(), Yorum : $("#YeniYorum textarea").val(), IsimGorun:$('#YeniYorum input:radio:checked').val() }, success: function (cevap) { $("#YeniYorum").html('

    ' + cevap + '

    '); } }); } function yorumOyla(prId, yorumId,cevap) { $.ajax({ type: "POST", url: "ajax.php", data : "m=Block&fn=commentVote&prId="+prId+"&c="+cevap+"&cId="+yorumId, success: function(cevap) { var text=""; if ( cevap == "1") text = "Teşekkürler Yorum Oylamanız Kaydedilmiştir."; else text = 'Üye Girişi Yapınız'; $("#EvetHayir"+yorumId).hide().addClass('yorum-uyari').html(text).fadeIn(); } }); } function tavsiyeEt(prId) { var isValid = true; if ($("#recipient").val() != '' && validateEmail($("#recipient").val()) == false) { isValid = false; } $.ajax({ type: "POST", url: "ajax.php", data : "m=Block&fn=adviceProduct&prId="+prId+"&name="+$("#name").val()+ "&sender="+$("#sender").val()+"&fr_name="+$("#fr_name").val()+ "&recipient="+$("#recipient").val()+"&message="+$("#message").val(), success: function(r) { var h = r.split("~|~"); if ( h[0] == 'Hata' ) { $(".yorum-uyari").each(function(){ $(this).html(""); }); for (var i=1;iMesajınız başarıyla gönderildi.

    '); } } }); return false; }