﻿$(document).ready(function () {

    var path = document.location.pathname;
    var indexVarmi = path.lastIndexOf("/");
    var sonuc = path.substring(indexVarmi + 1, path.length)
    if (sonuc.indexOf('index.aspx') == -1 && sonuc != "") {
        $('#panelBaslik').addClass("bosPanelBaslik");
        $('#panelBaslik').removeClass("panelBaslik");
    }
    MenuYukle();
    urunDuzenle();
    aGrup();
    detayTab();
    detAlt();
    kayarcik();
    haritaDuzenle();
    slideAyarla()
    onayAsamaDuzen();
    urResInit();
    odSecDuzenle();
    elf();
    regularInit();
    resimHoverZoom();
    odSlideYap();
    Anket(); AnketSonuc();
});

//*************************** GENEL DÜZENLEMELER *************************************//
function regularInit() {
    $('.YYBasTik').click(function () {
        $('#Panel1').slideToggle('fast');
    });

    $('.dBBRow').each(function () {
        if ($(this).find('span').length == 0) {
            $(this).remove();
        }
    });
    $('.digRes').find('a').click(function () {
        $('.tabBaslik').find('a[rel="tab2"]').trigger('click');
        $.scrollTo('#tab2', 500);
    });

    $('.odeTurOzet').find('span').click(function () {
        $('.tabBaslik').find('a[rel="tab3"]').trigger('click');
        $.scrollTo('#tab3', 500);
    });

}

//*************************** YAN MENÜ KONTROLÜ *************************************//
function menuInit() {
    $('.yanMenu').find('ul').each(function () {
        if ($(this).children('li').length <= 0) {
            $(this).remove();
        }
    });

    var config = {
        over: function () {
            $(this).children('ul').css('z-index', '9699');
            $(this).children('ul').fadeIn(500);
        },
        timeout: 800,
        out: function () {
            $(this).children('ul').delay().fadeOut(500);
        }
    };

    $('.yanMenu').find('li').each(function () {
        if ($(this).children('ul').length > 0) {
            $(this).addClass('altiVar');
            $(this).hoverIntent(config)
        }
    });
}

//*************************** ÜRÜN GÖRÜNTÜLEME KONTROLLERİ *************************************//

function urunDuzenle() {
    $('.urunKutusu').each(function () {
        if ($(this).children('.urun.uclu').length > 0) {
            $(this).children('.urun.uclu').each(function () {
                if ($(this).parent().children('.urun').index(this) % 3 == 2) {
                    $(this).before('<div class="dAyr"></div>');
                    if ($(this).parent().children('.urun').index(this) != $(this).siblings('.urun').length) {
                        $(this).after('<div class="yAyr"></div>');
                    }
                }
                if ($(this).parent().children('.urun').index(this) % 3 == 1) {
                    $(this).before('<div class="dAyr"></div>');
                }
            });
        }

        if ($(this).children('.urun.dortlu').length > 0) {
            $(this).children('.urun.dortlu').each(function () {
                if ($(this).parent().children('.urun').index(this) % 4 == 3) {
                    $(this).before('<div class="dAyr"></div>');
                    if ($(this).parent().children('.urun').index(this) != $(this).siblings('.urun').length) {
                        $(this).after('<div class="yAyr"></div>');
                    }
                }
                if ($(this).parent().children('.urun').index(this) % 4 == 1 || $(this).parent().children('.urun').index(this) % 4 == 2) {
                    $(this).before('<div class="dAyr"></div>');
                }
            });
        }

        if ($(this).children('.urun.ikili').length > 0) {
            $(this).children('.urun.ikili').each(function () {
                if ($(this).parent().children('.urun').index(this) % 2 == 1) {
                    $(this).before('<div class="dAyr"></div>');
                    if ($(this).parent().children('.urun').index(this) != $(this).siblings('.urun').length) {
                        $(this).after('<div class="yAyr"></div>');
                    }
                }
            });
        }
    });
}

//*************************** ARAMA SAYFASI ALT GRUPLAR - ÖZELLİKLER SLIDE KONTROL ******************************//

function aGrup() {
    $('.aGrup').children('h2').click(function () {
        $(this).parent().find('ul').slideToggle('fast');
    });
    $('.aGrup').find('ul').slideToggle('fast');
}

//*************************** ÜRÜN DETAYI TAB KONTROLLERİ *************************************//
function detayTab() {
    $('.tabCont').not(':first').hide();
    $('.tabBaslik').find('a').each(function () {
        var abc = $(this).attr('rel');
        $(this).click(function () {
            $('.tabBaslik').find('li').removeClass('selected');
            $(this).parent().addClass('selected');
            $('.tabCont').hide();
            $('#' + $(this).attr('rel')).show();
        });
    });
}

function detAlt() {
    $('.detAlt').find('li').each(function () {
        if ($(this).index() != $(this).parent().children().length - 1) {
            $(this).after('<div class="dAyr" style="height:50px; margin-top:10px !important"></div>');
        }
    });
}

//*************************** BİTEN AŞAMALARA TAMAM İKONU EKLE *************************************//

function onayAsamaDuzen() {
    $('.tamam').each(function () {
        $(this).append('<div class="tamamIs"></div>')
    });
}

// ***********************************  KREDİ KARTI ÖDEME SAYFASINDAKİ KLAVYE BAŞLIYOR. ****************************************************************
// ****************************************************************************************************************************************************
function elf() {
    $('.kkBox').each(function () {
        $(this).unbind();
        $('.keyPad').find('*').unbind();
    })
    $('input,select').not('.kkBox').click(function () {
        $('.keyPad').delay(500).fadeOut(200);
    });

    var tar;
    var kkgnmi = 4;
    $('.kkBox').each(function () {
        $(this).bind({
            change: function () {
                if ($(this).hasClass('gn')) {
                    kkgnmi = 3;
                }
                if ($(this).val().length >= kkgnmi) {
                    $(this).val($(this).val().substring(0, kkgnmi));
                    if ($(this).next().attr('class') == 'kkBox') {
                        $(this).next('.kkBox').focus();
                        tar = $(this).next('.kkBox');
                    }
                    else {
                        if ($(this).hasClass('gn') == false) {
                            $('.kkBox.gn').focus();
                            tar = $('.kkBox.gn');
                        }
                        else {
                            $(this).blur();
                        }
                    }
                }
            },

            keyup: function (e) {
                if ($(this).hasClass('gn')) {
                    kkgnmi = 3;
                }
                if ($(this).val().length >= kkgnmi) {
                    $(this).val($(this).val().substring(0, kkgnmi));
                    if ($(this).next().attr('class') == 'kkBox') {
                        $(this).next('.kkBox').focus();
                        tar = $(this).next('.kkBox');
                    }
                    else {
                        if ($(this).hasClass('gn') == false) {
                            $('.kkBox.gn').focus();
                            tar = $('.kkBox.gn');
                        }
                        else {
                            $(this).blur();
                        }
                    }
                }
            },

            select: function () { kkgnmi = 4; }

        });
    });

    $('.keyPad').hide();
    $('.kkBox').bind({
        click: function () { $('.keyPad').fadeIn('500'); tar = this; kkgnmi = 4; },
        focus: function () { $('.keyPad').fadeIn('500'); tar = this; kkgnmi = 4; }
    }
    );
    $('.kapaPad').bind('click', function () { $('.keyPad').fadeOut('200'); });
    $('.numara').each(function () {
        $(this).bind('click', function () {
            $(tar).val($(tar).val() + $.trim($(this).html()));
            $(tar).change();
        });
    })
}

// ***********************************  KREDİ KARI ÖDEME SAYFASINDAKİ KLAVYE BİTTİ. ****************************************************************
// ****************************************************************************************************************************************************

//****************************************************** SEÇTİKLERİMİZ SLIDE CONTROL BAŞLA *********************************************************************//

function kayarcik() {
    try {
        $('#kayarPan1').children('img:first-child').fadeIn(25);
        $('#kayarPan1').children('img').each(function () {
            if ($(this).attr('rel').length > 8) {
                $(this).css('cursor', 'pointer');
                $(this).click(function () {
                    location.href = $(this).attr('rel');
                });
            }
        });


        if ($('#kayarPan1') == null) { return; }
        if ($('#kayarPan1').children('img:first-child').attr('rel').length > 8) {
            $('#kPanUrIsim1').html('<a href="' + $('#kayarPan1').children('img:first-child').attr('rel') + '" style="display:block;">' + $('#kayarPan1').children('img:first-child').attr('title') + '</a>').fadeIn();
        }
        else {
            $('#kPanUrIsim1').html($('#kayarPan1').children('img:first-child').attr('title')).fadeIn();
        }
        $('#kPanFiyat1').html($('#kayarPan1').children('img:first-child').attr('alt'));
        $('#kPanUrIsim1').fadeIn('500');
        $('#kPanFiyat1').fadeIn('500');

        fTm = setInterval('kIleri()', 7000);
        var nxRes1;
        var prRes1;


    } catch (e) {

    }


}

function kIleri() {
    clearInterval(fTm);
    var abcd = $('#kayarPan1').children('img:visible');
    if ($(abcd).index() == $(abcd).parent().children('img:last-child').index()) {
        nxRes1 = $(abcd).parent().children('img:first-child');
    }
    else {
        nxRes1 = $(abcd).next();
    }
    $('#kPanUrIsim1').fadeOut('500');
    $('#kPanFiyat1').fadeOut('500');
    $(abcd).hide('slide', { direction: 'left' }, 500)
    $(nxRes1).show('slide', { direction: 'right' }, 500);

    try {
        if (nxRes1.attr('rel').length > 8) {
            $('#kPanUrIsim1').html('<a href="' + nxRes1.attr('rel') + '" style="display:block;">' + nxRes1.attr('title') + '</a>').fadeIn();
        }
        else {
            $('#kPanUrIsim1').html(nxRes1.attr('title')).fadeIn();
        }
    } catch (e) {

    }

    $('#kPanFiyat1').html(nxRes1.attr('alt'));
    $('#kPanUrIsim1').fadeIn('500');
    $('#kPanFiyat1').fadeIn('500');
    fTm = setInterval('kIleri()', 7000);
}

function kGeri() {
    clearInterval(fTm);
    var abcd = $('#kayarPan1').children('img:visible');
    if ($(abcd).index() == $(abcd).parent().children('img:first-child').index()) {
        prRes1 = $(abcd).parent().children('img:last-child');
    }
    else {
        prRes1 = $(abcd).prev();
    }
    $('#kPanUrIsim1').fadeOut('500');
    $('#kPanFiyat1').fadeOut('500');
    $(abcd).hide('slide', { direction: 'left' }, 500)
    $(prRes1).show('slide', { direction: 'right' }, 500);

    try {
        if (prRes1.attr('rel').length > 8) {
            $('#kPanUrIsim1').html('<a href="' + prRes1.attr('rel') + '" style="display:block;">' + prRes1.attr('title') + '</a>').fadeIn();
        }
        else {
            $('#kPanUrIsim1').html(prRes1.attr('title')).fadeIn();
        }
    } catch (e) {

    }

    $('#kPanFiyat1').html(prRes1.attr('alt'));
    $('#kPanUrIsim1').fadeIn('500');
    $('#kPanFiyat1').fadeIn('500');
    fTm = setInterval('kIleri()', 7000);
}

function slideAyarla() {

    $('.solaKay').bind('click', function () { slide("left"); });
    $('.sagaKay').bind('click', function () { slide("right"); });

    //1 Evet, 0 Hayır

    var auto_slide = 1;
    var hover_pause = 1;
    var key_slide = 1;

    //Oto-Slide Hızı x/1000 sn
    var auto_slide_seconds = 5000;

    $('.slideIcKisim ul li:first').before($('.slideIcKisim ul li:last'));

    if (auto_slide == 1) {
        var timerSlideIcin = setInterval('slide("right")', auto_slide_seconds);
        $('#hidden_auto_slide_seconds').val(auto_slide_seconds);
    }

    if (hover_pause == 1) {
        $('.slideIcKisim ul').hover(function () {
            clearInterval(timerSlideIcin)
        }, function () {
            timerSlideIcin = setInterval('slide("right")', auto_slide_seconds);
        });

    }

    if (key_slide == 1) {
        $(document).bind('keypress', function (e) {
            if (e.keyCode == 37) {
                slide('left');
            } else if (e.keyCode == 39) {
                slide('right');
            }
        });

    }


};

function slide(where) {
    var item_width = $('.slideIcKisim ul li').outerWidth() + 10;
    if (where == 'left') {
        var left_indent = parseInt($('.slideIcKisim ul').css('left')) + item_width;
    } else {
        var left_indent = parseInt($('.slideIcKisim ul').css('left')) - item_width;

    }


    $('.slideIcKisim ul:not(:animated)').animate({ 'left': left_indent }, 500, function () {
        if (where == 'left') {
            $('.slideIcKisim ul li:first').before($('.slideIcKisim ul li:last'));
        } else {
            $('.slideIcKisim ul li:last').after($('.slideIcKisim ul li:first'));
        }
        $('.slideIcKisim ul').css({ 'left': '0px' });
    });

}

//************************************************************* SITE HARITASI CONTROL BAŞLA ************************************************************************//
function haritaDuzenle() {
    $('.sitHar').find('li').addClass('duzeltik');
    var toplamKat = $('.sitHar').find('div').length;
    var bol = Math.ceil(toplamKat / 4);

    for (var im = 0; im < 4; im++) {
        $('.sitHar').append('<div class="haritaDivCont"></div>')
        for (var im2 = 0; im2 < bol; im2++) {
            $('.sitHar').children('.haritaDivCont:last-child').append($('.sitHar').children('div:first-child').not('.haritaDivCont'));
        }
    }


}

//************************************************************* ÖDEME SEÇENEKLERİ DÜZENİ BAŞLA ************************************************************************//
function odSecDuzenle() {
    var toplamKat = $('.odemeSecenekCont').find('.bankalar').length;
    var bol = Math.floor(toplamKat / 3);
    var it = 0;

    for (var im = 0; im < 3; im++) {
        $('.odemeSecenekCont').append('<div class="bankCont"></div>')
        for (var im2 = 0; im2 < bol; im2++) {
            $('.odemeSecenekCont').children('.bankCont:last-child').append($('.odemeSecenekCont').find('table').find('.bankalar:first'));
        }
    }

    do {
        it++
        it %= 3
        $('.odemeSecenekCont').children('.bankCont:nth-child(' + (it + 1) + ')').append($('.odemeSecenekCont').find('table').find('.bankalar:first'));
    }
    while ($('.odemeSecenekCont').find('table').find('.bankalar:first').length > 0);

    $('.odemeSecenekCont').children('table').remove();
}




//************************************************************* ÜRÜN DETAY RESİMLERİ DÜZENLE *********************************************************************//

function urResInit() {
    $('.resLoading').hide();
    $('.rIleri').click(resIleri);
    $('.rGeri').click(resGeri);
    if ($('.urResThumbCont').find('img').length > 0) {
        $('.urResThumbCont ul li:first').find('img').addClass('aktifRes');
        $('.urResBuyuk').find('.buyukRes').attr('src', $('.urResThumbCont ul li:first').find('img').attr('name'));
        if ($('.urResThumbCont').find('img.aktifRes').parent().next('li').length == 0) {
            $('.rIleri').hide();
        }

        if ($('.urResThumbCont').find('img.aktifRes').parent().prev('li').length == 0) {
            $('.rGeri').hide();
        }
    }

    $('.urResThumbCont').find('img').each(function () {
        $(this).bind({
            click: function () {
                if ($(this).hasClass('aktifRes') != true) {
                    $('.buyukRes').hide();
                    resGetir($(this).attr('name'));
                    $('.buyukRes').fadeIn('300');
                    $(this).addClass('aktifRes');
                }
                if ($('.urResThumbCont').find('img.aktifRes').parent().next('li').length == 0) {
                    $('.rIleri').fadeOut('fast');
                }
                else {
                    $('.rIleri').fadeIn('fast');
                }

                if ($('.urResThumbCont').find('img.aktifRes').parent().prev('li').length == 0) {
                    $('.rGeri').fadeOut('fast');
                }
                else {
                    $('.rGeri').fadeIn('fast');
                }

            }
        });
    });
}

function resIleri() {
    var dibilcak = $('.urResThumbCont').find('img.aktifRes');
    if ($(dibilcak).parent().next('li').length > 0) {
        $('.buyukRes').hide();
        resGetir($(dibilcak).parent().next('li').find('img').attr('name'));
        $('.buyukRes').fadeIn('300');
        $(dibilcak).parent().next('li').find('img').addClass('aktifRes');
    }
    if ($('.urResThumbCont').find('img.aktifRes').parent().next('li').length == 0) {
        $('.rIleri').fadeOut('fast');
    }
    if ($('.urResThumbCont').find('img.aktifRes').parent().prev('li').length > 0) {
        $('.rGeri').fadeIn('fast');
    }
}

function resGeri() {
    var dibilcak = $('.urResThumbCont').find('img.aktifRes');
    if ($(dibilcak).parent().prev('li').length > 0) {
        $('.buyukRes').hide();
        resGetir($(dibilcak).parent().prev('li').find('img').attr('name'));
        $('.buyukRes').fadeIn('300');
        $(dibilcak).parent().prev('li').find('img').addClass('aktifRes');
    }
    if ($('.urResThumbCont').find('img.aktifRes').parent().next('li').length > 0) {
        $('.rIleri').fadeIn('fast');
    }

    if ($('.urResThumbCont').find('img.aktifRes').parent().prev('li').length == 0) {
        $('.rGeri').fadeOut('fast');
    }

}

function resGetir(getircek) {
    $('.aktifRes').removeClass('aktifRes');
    $('.buyukRes').attr('src', getircek);
}

//Serkan...................................................................................................↓
function MenuYukle() {
    $('#yanMenu').load("Handler/menuurungrup.htm", function () { menuInit(); $('#yanMenu').parent().css('overflow', 'auto'); $('#yanMenu').parent().css('overflow', 'visible') });
}

function sepeteEkle(urunid, txtmiktar, secenek, bu, evt) {
    var sec;
    var nocash = (new Date()).getTime();
    var txtdeger = document.getElementById(txtmiktar);
    //var seclbl = document.getElementById(secenek);
    var sonuc = (txtdeger != null) && (txtdeger.value != 0) && (isNumeric(txtdeger.value)) ? txtdeger.value : 1;
    if (txtdeger != null) {
        if (txtdeger.attributes["secenek"] != null) {
            sec = txtdeger.attributes["secenek"].value;
        } else {
            sec = 0;
        }
    } else {
        sec = 0;
    }
    var frame = document.getElementById($find('ModalPopupExtenderSepet')._OkControlID);
    frame.src = "Handler/sepetdet.aspx?nocash=" + nocash + "&urunid=" + urunid + "&miktar=" + sonuc + "&secenek=" + sec;
    $find('ModalPopupExtenderSepet').show();
}

function incele(urunid, bu, evt, tar) {
    location.href = "urun.aspx?urunid=" + urunid;
}

function haberVer(urunid, bu, evt) {
    $('#modalCaption').html("Haber Listem");
    $('.modalSepBut').remove();
    var frame = document.getElementById($find('ModalPopupExtenderSepet')._OkControlID);
    frame.src = "haberver.aspx?urunid=" + urunid;
    $find('ModalPopupExtenderSepet').show();
}

function haberVerUyar() {
    alert("Haber ver sistemini kullanmak için sitemize üye olunuz.");
}

function isNumeric(prm) {
    var Gecerlikaraketer = "0123456789";
    for (var i = 0; i < prm.length; i++) {
        var chr = prm.charAt(i);
        if (Gecerlikaraketer.indexOf(chr) == -1) {
            return false; //numeric değildir.
            break;
        } //if
    } //for
    return true; //if içine girmezse true alıcak. yani değer numeric tir
}

function SayisalDeger(nesne) {
    var Gecerlikaraketer = "0123456789";
    var Sayisal = true;
    var Kisim;

    for (i = 0; i < nesne.value.length && Sayisal == true; i++) {
        Kisim = nesne.value.charAt(i);
        if (Gecerlikaraketer.indexOf(Kisim) == -1) {
            nesne.value = nesne.value.substring(0, i);
            break;
        }
    }
    return Sayisal;
}

//Dropdownlistten seçilen il e göre ilçe gelirken loading Çıkar...       
function loading(bu, alan) {
    var span = document.getElementById(alan);
    var path = "";  //"http://" + location.host + "/www.e-ticaretyolu.com/"; /// <reference path="../../ajax-loader.gif" />
    span.style.background = "url(" + path + "ajax-loader.gif) no-repeat center center";
}
//************************************************
//modal Adres Yeni
function YeniAdres(bu, prm1) {

    switch (prm1) {
        case "T":
            $('#modalCaption').html("Teslimat Adresi Tanımlama");
            break;
        case "F":
            $('#modalCaption').html("Fatura Adresi Tanımlama");
            break;
    }
    var frame = document.getElementById($find('ModalPopupExtenderAdres')._OkControlID);
    frame.src = "Handler/adrestanim.aspx?adresTur=" + prm1;
    $find('ModalPopupExtenderAdres').show();
}

function DigerAdresler(bu, prm1) {
    var frame = document.getElementById($find('ModalPopupExtenderAdres')._OkControlID);
    switch (prm1) {
        case "T":
            $('#modalCaption').html("Teslimat Adresilerim");
            frame.src = "Handler/teslimatadres.aspx";
            break;
        case "F":
            $('#modalCaption').html("Fatura Adresilerim");
            frame.src = "Handler/faturaadres.aspx";
            break;
    }
    $find('ModalPopupExtenderAdres').show();
}
function SendParemeterToServer(prm1, prm2) {
    //prm1 == >> secili adresin id si
    //prm2 == >> T : teslimat, F : Fatura
    switch (prm2) {
        case "T":
            __doPostBack("TeslimatCallBack", prm1);
            break;
        case "F":
            __doPostBack("FaturaCallBack", prm1);
            break;
    }
    $find('ModalPopupExtenderAdres').hide();
}

function yeniKayitIdParemeterToClient(prm1, prm2, prm3) {
    //prm1 ==> Yeni kayit edilen adresin id si
    //prm2 ==> Yeni kayit edilen adresin teslimat mı fatura adresi mi
    //prm3 ==> Teslimat ID, Teslimat adresi kayıt esnasında fatura adresini de teslimat adresi gibi isteyebilir.Eğer öyle olursa prm3'e ait bir değer olur. Aksi halde null gelir
    switch (prm2) {
        case "T":
            if (prm3 != null) {
                //buraya girince parametreler değişiyio
                //prm1==> fatid
                //prm2==> tesid
                __doPostBack("YeniAdresTesveFatBirlikteCallBack", prm1 + "-" + prm3);
            } else {
                __doPostBack("YeniAdresTeslimatCallBack", prm1);
            }
            break;
        case "F":
            __doPostBack("YeniAdresFaturaCallBack", prm1);
            break;
    }
    $find('ModalPopupExtenderAdres').hide();

}

function ThreeDOdeme(bu, chkID) {
    //chkID ==> Null ise visible false demektir.Sozlesme Çıkmayacak Yoluna devam edicek
    //Şayet Null değilse if bloğuna gir. Kontrol et.
    if (chkID != null) {
        var ck = document.getElementById(chkID);
        if (ck == null) { return; } //null ise çık.
        if (!ck.checked) {
            alert('Sözleşme onayı gereklidir.');
            return;
        }
    }

    var frame = document.getElementById($find('ModalPopupExtender3D')._OkControlID);
    frame.src = "3D/3Dgate.aspx";
    $find('ModalPopupExtender3D').show();
    return false;
}
function ModalClose() {
    $find('ModalPopupExtender3D').hide();
    __doPostBack("ModalClose", "");

} //Bank geriDönüş Modal Kapa
//****************************************************************************
function JsSozlesme() {
    window.showModalDialog("Handler/sozlesme.ashx", "", "dialogWidth:auto; dialogHeight:auto;status:no;resizable:yes;scroll:yes");
}

function siparis() {
    var dsos = document.getElementById("loadingSiparis");
    dsos.src = "../ajax-loader.gif";
    dsos.style.display = "block";
    var bekleyiniz = document.getElementById("bekleyiniz");
    bekleyiniz.style.display = "block";
    bekleyiniz.innerHTML = "Şu anda bu <b style='color:red;'>" + bekleyiniz.innerText +
"</b> Ip adresi ile işlem yapmaktasınız.<br/>İşlem Güvenliğiniz için IP adresiniz saklanmaktadır.<br/><b>Siparişiniz Alınırken Bekleyiniz...</b>"
}

function resimHoverZoom() {
    var resimConfig = {
        over: function () {
            $(this).css('position', 'absolute');
            $(this).css('display', 'inline-block');
            $(this).css('z-index', '9999');
            $(this).parents('.thumbNail').css('z-index', '999');
            $(this).animate({
                width: '150px',
                height: '200px',
                left: '-50px',
                top: '-75px'
            }, 500);
        },
        timeout: 300,
        out: function () {
            $(this).animate({
                width: '30px',
                height: '40px',
                left: '0px',
                top: '0px'
            }, 300, function () {
                $(this).css('position', 'relative');
                $(this).css('display', 'inline');
                $(this).css('z-index', '0');
                $(this).parents('.thumbNail').css('z-index', '0');
            });
        }
    };

    $(".habUC").find('img').each(function () {
        $(this).hoverIntent(resimConfig);
    });
}

function odSlideYap() {
    $('.odSecIc').not(':first').hide();
    var ayT = setInterval(function () { $('.odSecIc').each(function () { $(this).slideToggle(); }) }, 5000);
}


function ListSepeteEkle(urunid, txtmiktar, lblmsg, bu, evt) {
    var txtdeger = document.getElementById(txtmiktar);
    var sonuc = (txtdeger != null) && (txtdeger.value != 0) && (isNumeric(txtdeger.value)) ? txtdeger.value : 1;
    var lblmsj = document.getElementById(lblmsg);
    $.ajax({
        type: "POST",
        url: "Handler/sepetdet.aspx",
        data: "urunid=" + urunid + "&liste=yes&miktar=" + sonuc + "&secenek=0",
        success: function (data) {
            lblmsj.innerHTML = "Eklendi!";
        }
    });

}


//Anket Oylaması WS

function Anket() {

    $('input[value="Oy Ver"]').click(function (e) {
        e.preventDefault();
        var rbid = $('input[value="Oy Ver"]').attr("rb");
        var rb = document.getElementById(rbid);
        var chks = $(rb).find("input:radio:checked").length;
        if (chks == 0) {
            alert("Seçim Yapınız!");
        } else {
            var chkval = $(rb).find("input:radio:checked").val();
            var masid = chkval.split(",")[0];
            var secimid = chkval.split(",")[1];
            DataGonder(masid, secimid);
        }

    });

    function DataGonder(masterid, secimid) {
        $.ajax({
            type: "POST",
            url: "Handler/Anket.ashx",
            data: "masterid=" + masterid + "&secenekid=" + secimid,
            success: function (data) {
                if (data) {
                    alert("Anketimize Katılıdığınız için teşekkür ederiz!");
                    $('input[value="Oy Ver"]').remove();
                }
                else { }
            },
            error: function () {
                alert("İşlem esnasında beklenmedik bir hata ile karşılaştık!");
            }
        });
    }
}
//Anket Sonuç
function AnketSonuc() {
    $('input[value="Sonuçlar"]').click(function (e) {
        e.preventDefault();
        var masterid = $(this).attr("masid");
        window.open("Handler/anketsonuc.ashx?masterid=" + masterid, "", "width=400,height=400");
    });
}

function SessionTimeOut(redirektLink) {
    alert("Üzgünüz! Siparişiniz zaman aşımına uğradı.İlgili sayfaya yönlendiriliyorsunuz!");
    location.href = redirektLink;
}

function Ariza() {
    window.showModalDialog("Handler/ariza.aspx", "", "dialogWidth:auto; dialogHeight:auto;status:no;resizable:yes;scroll:yes");
}
