/**
 *  Script qui gère la partie services du site.
 *  @author ZEZUKA Clément <clemzezuk@gmail.com>
 */
$(function(){
    
    //	Méthode appelée au survol d'un service.
    $('.box_services').hover(
        function() {
            $(this).find('img.over').stop().animate({opacity:1},500);  
        },
        function() {  
            $(this).find('img.over').stop().animate({opacity:0},500);
        }
    );
    
    //  Méthode appelée au clique d'un service.
    $('.box_services').click(function() {
        var id = $(this).index() + 1;
        $.post(
            "ajax/services.php", 
            {id:id},
            function(data) {
                $('#view_competences').stop().animate({height:"100%"},1000,"easeOutExpo");
                $('#close_competences').fadeIn(500);
                $('#next_competences').css({top:($(window).height()-120)/2}).fadeIn(500);
                $('#prev_competences').css({top:($(window).height()-120)/2}).fadeIn(500);
                $('#lines_skills').fadeIn(500);
                $("#rond_etapes").empty().append(1).fadeIn();
                $('#title_level').empty().append('<img src="images/competences/level_' + data.image + '.png" />').fadeIn();
                $('#container_skills').empty().append(data.content).fadeIn();
                $('#container_skills > .skills_text').each(function(i){
                    if (i == 0 || i == 1) {
                        $(this).animate({opacity:1});
                    } else {
                        $(this).animate({opacity:.1});
                    } 
                });
            },
            "json"
        );
    });
    
});
