$(function(){
    if($('.ecoton').length){
        setTimeout(function(){
            $('.ecoton')
                .css('opacity', 0)
                .show()
                .animate(
                    {
                        left: '100%',
                        opacity: 1
                    },
                    500
                );
        },
        2000);
    }
    if($('.ecoton_banner').length){
        $(document).on('scroll', function(){
            if(parseInt($(window).scrollTop() + parseInt($(window).height() - 130)) > parseInt($('.main_banners').offset().top) && !$('.ecoton_banner').hasClass('ecoton_banner_showed')){
                $('.ecoton_banner')
                    .addClass('ecoton_banner_showed')
                    .css('opacity', 0)
                    .show()
                    .animate(
                        {
                            left: '-100px',
                            opacity: 1
                        },
                        500,
                        function(){
                            $(this)
                                .css('z-index', 5)
                                .animate(
                                    {
                                        left: '-50px'
                                    },
                                    500,
                                    function(){
                                        
                                    }
                                );
                        }
                    );
            }
        });
    }
});
