$(document).ready(function(){


    $('#exp-Img1').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B2').stop().hide(200);
        $('#exp-B3').stop().hide(200, 
            function() {
                showExpertiseTxt(1, 'R');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt1').stop().hide(1, 
            function() {
                showExpertiseB(2, 'M');
                showExpertiseB(3, 'R');
            });
   
    });
    
    
    $('#exp-Img2').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B5').stop().hide(200);
        $('#exp-B6').stop().hide(200, 
            function() {
                showExpertiseTxt(2, 'R');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt2').stop().hide(1, 
            function() {
                showExpertiseB(5, 'M');
                showExpertiseB(6, 'R');
            });
        
    });
    
    
    $('#exp-Img3').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B1').stop().hide(200);
        $('#exp-B2').stop().hide(200, 
            function() {
                showExpertiseTxt(3, 'L');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt3').stop().hide(1, 
            function() {
                showExpertiseB(1, 'L');
                showExpertiseB(2, 'M');
            });
   
    });
    
    
    $('#exp-Img4').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B5').stop(1).hide(200);
        $('#exp-B6').stop(1).hide(200, 
            function() {
                showExpertiseTxt(4, 'R');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt4').stop().hide(1, 
            function() {
                showExpertiseB(5, 'M');
                showExpertiseB(6, 'R');
            });
   
    });
    
    
    $('#exp-Img5').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-Img1').stop().fadeTo(200, 0);
        $('#exp-Img2').stop().fadeTo(200, 0);
        $('#exp-Img3').stop().fadeTo(200, 0);
        $('#exp-Img4').stop().fadeTo(200, 0);
        $('#exp-Img6').stop().fadeTo(200, 0);
        $('#exp-Img7').stop().fadeTo(200, 0);
        $('#exp-Img8').stop().fadeTo(200, 0);
        $('#exp-Img9').stop().fadeTo(200, 0);
        
        $('#exp-TxtCentral').show(0, function() {
            $('#exp-TxtCentral').height(120);
            $('#exp-TxtCentral').width(728);
            $('#exp-TxtCentral').css({'opacity':1, 'padding':'20px 20px 20px 20px'});
            
        });
        
    }, function() {
    	$(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-TxtCentral').hide(0);
        
        $('#exp-Img1').stop().fadeTo(200, 1);
        $('#exp-Img2').stop().fadeTo(200, 1);
        $('#exp-Img3').stop().fadeTo(200, 1);
        $('#exp-Img4').stop().fadeTo(200, 1);
        $('#exp-Img6').stop().fadeTo(200, 1);
        $('#exp-Img7').stop().fadeTo(200, 1);
        $('#exp-Img8').stop().fadeTo(200, 1);
        $('#exp-Img9').stop().fadeTo(200, 1);
        
        
    });
    
    
    $('#exp-Img6').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B4').stop().hide(200);
        $('#exp-B5').stop().hide(200, 
            function() {
                showExpertiseTxt(6, 'L');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt6').stop().hide(1, 
            function() {
                showExpertiseB(4, 'L');
                showExpertiseB(5, 'M');
            });
   
    });
    
    
    $('#exp-Img7').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B8').stop().hide(200);
        $('#exp-B9').stop().hide(200, 
            function() {
                showExpertiseTxt(7, 'R');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt7').stop().hide(1, 
            function() {
                showExpertiseB(8, 'M');
                showExpertiseB(9, 'R');
            });
   
    });
    
    
    $('#exp-Img8').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B5').stop().hide(200);
        $('#exp-B6').stop().hide(200, 
            function() {
                showExpertiseTxt(8, 'R');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt8').stop().hide(1, 
            function() {
                showExpertiseB(5, 'M');
                showExpertiseB(6, 'R');
            });
   
    });
    
    
    $('#exp-Img9').hover(function() {
        $(this).stop(1);
        $(this).fadeTo(200,0);
        
        $('#exp-B7').stop().hide(200);
        $('#exp-B8').stop().hide(200, 
            function() {
                showExpertiseTxt(9, 'L');
            });
        
    }, function() {
        $(this).stop(1);
        $(this).fadeTo(200, 1);
        
        $('#exp-Txt9').stop().hide(1, 
            function() {
                showExpertiseB(7, 'L');
                showExpertiseB(8, 'M');
            });
   
    });
    
    
    
    function showExpertiseTxt(numBloc, position) {
        $('#exp-Txt'+numBloc).stop();
        
        $('#exp-Txt'+numBloc).show(200, function() {
            $('#exp-Txt'+numBloc).height(201);
            $('#exp-Txt'+numBloc).width(463);
            if (position=='L') {
                $('#exp-Txt'+numBloc).css({'opacity':1, 'margin-right':19, 'padding':'20px 20px 20px 20px'});
            } else if (position=='R') {
                $('#exp-Txt'+numBloc).css({'opacity':1, 'margin-left':19, 'padding':'20px 20px 20px 20px'});
            }
        });
    }
    
    
    
    function showExpertiseB(numBloc, position) {
        $('#exp-B'+numBloc).stop();
        
        $('#exp-B'+numBloc).show(200, function() {
            $('#exp-B'+numBloc).height(241);
            $('#exp-B'+numBloc).width(241);
            
            if (position =='L') {
                $('#exp-B'+numBloc).css({'opacity':1, 'float':'left'});
            } else if (position =='M') {
                $('#exp-B'+numBloc).css({'opacity':1, 'margin-left':20, 'margin-right':20});
            } else if (position =='R') {
                $('#exp-B'+numBloc).css({'opacity':1, 'float':'right'});
            }
            
        });
    }

});

