


$(document).ready(function(){ 
                     
        $(window).scroll(function(e){
            var py =($(document).scrollTop());
            h = 153 - py;                                 
            if(h<80) h = 80;                            
            $('.top .logoBar .logo').height(h);                                           
        }).scroll();
        
        
        var autoPlay=true;
        var currentIndex=0;
        
        $('.home .banners').hover(function(){
            autoPlay=false;
        },function(){
            autoPlay=true;
        });
        
        setInterval(function(){
            
            if(autoPlay){
                currentIndex++;
                if(currentIndex>2) currentIndex = 0;
               $('.home .banners a').eq(currentIndex).mouseover(); 
               autoPlay=true;
            }
            
        },6000);
        
        
        $('.home .more').click(function(){
            var h = $('.home .homeProducts2').height();
            $('.home .homeProducts2').height(0).css('display','block').animate({height:h},300);
            $('.home .more').hide();
        });
        
        
        $('.home .banners a').hover(function(){
            var id = $(this).attr('_id');
            
            currentIndex = $(this).index();
            
            $('.home .banners .images img').each(function(){
                if($(this).attr('_id')==id){
                    $(this).css('margin-top',444);
                     $(this).animate({opacity:1,'margin-top':0},{queue:false,duration:400});
                }else{
                    $(this).animate({opacity:0,'margin-top':-444},{queue:false,duration:400});
                }
            });
        
        $('.home .banners a').find('img').css('opacity',0.6)
        $('.home .banners a').find('.text').css('color','#7f7f7f');
            
            $(this).find('img').css('opacity',1);
            $(this).find('.text').css('color','#4d4d4d');
            
        },function(){
            
        }).eq(0).hover();
        
        
        $('.home .teamBlock .photo').hover(function(){
            $(this).find('.over').animate({height:50,'margin-top':-50},200);
        },function(){
            $(this).find('.over').animate({height:0,'margin-top':0},200);
        });

});


