function startGallery(){
    t=setTimeout('$("#promo .scrollable .next").click();',3000);
}

function stoper() {
    clearTimeout(t);
}

$(document).ready(function(){
    
    $("#promo-image").load(function(){
        startGallery();
    });
    
    $(".scrollable").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        auto: false,
        speed: 600,
        circular: true,
        scroll: 1,
        visible: 8
    });
    
    var promoSrc = '';
    
    // Switch promo image
    
    $(".scrollable .item").live('click',function(){
        promoSrc = $(this).find(".promo-thumbnail").attr("href");
        $("#promo-image").attr("src",promoSrc).load(function(){
            startGallery();
        });
        $(".scrollable .item").removeClass("active");
        $(this).addClass("active");
    });
    $(".promo-thumbnail").click(function(){
        $(this).parent().click();
        return false;
    });
    
    
    $(".job-toggle").toggle(
        function(){
            $(this).prev(".job-details").slideDown("fast");
            $(this).text("Свернуть вакансию");
        }, function(){
            $(this).prev(".job-details").slideUp("fast");
            $(this).text("Подробно о вакансии");
        }
    );
	
});
