﻿jQuery(document).ready(function () {

    Kaydir("duyuru");
    Kaydir("serisonu");
    Kaydir("yeniurun");

    var item_count = jQuery("#cs-buttons-content_slider a").size();

    for (var i = 0; i < item_count; i++) {
        jQuery("#cs-buttons-content_slider a").eq(i).attr("href", jQuery("#content_slider a").eq(i).attr("href"));
    }

});

function Kaydir(el) {
    var count = jQuery("#" + el + " .con").size();
    var queue = 0;
    var baslangic = true;

    //jQuery(".home_box div div").hide();
    jQuery("#" + el + " .con").eq(0).css("top", "0");

    theInvertal = setInterval(function () {
        if (queue != 0)
            jQuery("#" + el + " .con").eq(queue - 1).animate({ top: -100 }, "slow", function () { $(this).css({ "top": "200px" }) });
        else if (queue == 0 && baslangic == false)
            jQuery("#" + el + " .con").eq(count - 1).animate({ top: -100 }, "slow", function () { $(this).css({ "top": "200px" }) });

        jQuery("#" + el + " .con").eq(queue).animate({ top: 0 }, "slow");

        if ((count - 1) == queue) {
            queue = 0;
        }
        else
            queue++;

        if (baslangic)
            baslangic = false;

    }, 7000);

    if (count == 1)
        clearInterval(theInvertal);
}


//jQuery(document).ready(function () {
//    jQuery('#yeniurun, #duyuru, #kampanya').bxSlider({
//        speed: 8000,
//        displaySlideQty: 1, // How many pictures to show
//        moveSlideQty: 1, // how many pictures to move in 1 slide
//        auto: true,
//        controls: false,
//        mode: 'vertical'
//    });
//});
