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' : '
' + 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;i