 var initialisations = function(){
     
    $('#global').delay(400).fadeTo(400,1, function() {
        $('.loader').css('display','none');
    });
    
    // Au survol du menu principal
    $('.off').each(function() {
	var opacity = 0.3, toOpacity = 1, duration = 250;
	$(this).css('opacity',opacity).hover(function() {
		$(this).fadeTo(duration,toOpacity);
	}, function() {
		$(this).fadeTo(duration,opacity);
	});
    });
		
    // Au survol des miniatures
    $('.thumb').each(function() {
            var visuel_path = $(this).attr('rel');
            var opacity = 0.5, toOpacity = 1, duration = 250;
            $(this).css('opacity',opacity).hover(function() {
                var splitChaine = visuel_path.split('@');
                $('#thumbs').find('p').html(splitChaine[1]);
                $('#thumbs').find('p').css('opacity',1);
		$(this).fadeTo(duration,toOpacity);
            }, function() {
		$(this).fadeTo(duration,opacity);
                $('#thumbs').find('p').css('opacity',0);
            });
    });
    
    $('#close').mouseenter(function() {
	$('#close img').rotate({animateTo:180, duration:800, angle:0})
	return false;
    });
    $('#close').mouseleave(function() {
	$('#close img').rotate({animateTo:-180, duration:800, angle:0})
	return false;
    });
    
    $('#titre').css('opacity',0.8)
    $('#player-box').mouseenter(function(){
       $('#titre').animate({'bottom':0}); 
    });
    $('#player-box').mouseleave(function(){
       $('#titre').animate({'bottom':-50}); 
    });
    
 } // fin initialisations()
 
 

 var show_video = function(path){
    var splitChaine = path.split('@');
    $('#player-box').fadeTo(400, 0, function() {
        $('#player-box').find('iframe').css('display','block');  
        $('#player-box').find('iframe').attr("src", 'http://player.vimeo.com/video/'+splitChaine[0]+'?portrait=0&amp;color=ffffff&amp;&autoplay=1;&loop=1;');
        $('#player-box').find('p').html(splitChaine[1]);
        $('#player-box').delay(800).fadeTo(400,1);
        $('#close img').css('display','block');
    });
 }
 
 
 
 $(document).ready(function(){
	
        
        if(currentPage=='index') {
 
            /* ********** INDEX ********** */
            var FullscreenrOptions = {  width: 1392, height: 928, bgID: '#background_flare' };
            jQuery.fn.fullscreenr(FullscreenrOptions);
            
            $('#global_intro').css('opacity',0);
            //$('#logo_intro').rotate(-90);
            $('#global_intro').delay(800).fadeTo(400,1, function() {
                $('.loader').css('display','none');
            });
            
            
            
            if(!$.browser.msie){
                var rotateDuration=1000;
                var section='void';
                var currentRotate=0;

                $('#m_experience').mouseenter(function() {
                    if(section=='studio') $('#logo_intro').rotate({animateTo:0, duration:rotateDuration, angle:-90});
                    else if(section!='experience' && section!='void') $('#logo_intro').rotate({animateTo:0, duration:rotateDuration});
                    section='experience';
                    return false;
                });

                $('#m_design').mouseenter(function() {
                    if(section!='design') $('#logo_intro').rotate({animateTo:90, duration:rotateDuration});
                    section='design';
                    return false;
                });

                $('#m_project').mouseenter(function() {
                    if(section=='studio') $('#logo_intro').rotate({animateTo:180, duration:rotateDuration, angle:270});
                    else if(section!='project') $('#logo_intro').rotate({animateTo:180, duration:rotateDuration});
                    section='project';
                    return false;
                });

                $('#m_studio').mouseenter(function() {
                    if(section=='experience') $('#logo_intro').rotate({animateTo:-90, duration:rotateDuration});
                    else if(section!='studio') $('#logo_intro').rotate({animateTo:270, duration:rotateDuration});

                    section='studio';
                    return false;
                });

                $('#m_society').mouseenter(function() {
                    $('#logo_intro').fadeTo(200,0);
                    $('#logo_blanc').fadeTo(200,1);
                    section='society';
                    return false;
                });
                $('#m_society').mouseleave(function() {
                    $('#logo_blanc').fadeTo(200,0);
                    $('#logo_intro').fadeTo(200,1);
                    //section='void';
                    return false;
                });
            }
        }
            /* ********** INDEX ********** */
            
            
            /* ********** DESIGN ********* */
            
            else if(currentPage=='design'){
                /*$(function() {
                    $('.scroll-pane').jScrollPane({showArrows: true});
		});*/
                
                $('#player-box').css('display','none');
                
                if($('.scroll-pane')){ // verifier si presence d'une classe deja cliqué ...
                $('.thumb').click( function() {     
                    $('.scroll-pane').fadeTo(400, 0, function() {
                        $(this).css('display','none');
                        $('.hline').css('display','none');
                    });
		});
                }
                
                var position=0;
                var decallage_legende=270;
                
                if ($.browser.mozilla == true) { 
                    $('.list01 li').css('margin-left','33px');
                    $('.list02 li').css('margin-left','30px');
                    $('.list03 li').css('margin-left','34px');
                }
                
                /* ********** LEGEND01 ********** */
                $('#legend01').css('visibility','hidden');
                
                
                // ========== AREA OF APPLICATIONS
                
                /* CORPORATE */
                $('#corporate').mouseenter(function() {
                        position = $('#corporate').position().left-decallage_legende;
                        $('#legend01').css('margin-left',position);
			$('#legend01').css('visibility','visible');
			$('#legend01').html('media lobby');
		});
                $('#corporate').mouseleave(function() {
			$('#legend01').css('visibility','hidden');
		});
                
                /* URBAN */
                $('#urban').mouseenter(function() {
                        position = $('#urban').position().left-decallage_legende;
                        $('#legend01').css('margin-left',position);
			$('#legend01').css('visibility','visible');
			$('#legend01').html('signage / media facade');
		});
                $('#urban').mouseleave(function() {
			$('#legend01').css('visibility','hidden');
		});
                
                /* HOSPITALITY */
                $('#hospitality').mouseenter(function() {
                        position = $('#hospitality').position().left-decallage_legende;
                        $('#legend01').css('margin-left',position);
			$('#legend01').css('visibility','visible');
			$('#legend01').html('luxury hotel industry');
		});
                $('#hospitality').mouseleave(function() {
			$('#legend01').css('visibility','hidden');
		});
                
                /* SCENOGRAPHY */
                $('#scenography').mouseenter(function() {
                        position = $('#scenography').position().left-decallage_legende;
                        $('#legend01').css('margin-left',position);
			$('#legend01').css('visibility','visible');
			$('#legend01').html('exhibition / public facilities');
		});
                $('#scenography').mouseleave(function() {
			$('#legend01').css('visibility','hidden');
		});
                
                /* ********** LEGEND02 ********** */
                $('#legend02').css('visibility','hidden');
                
                /* CONCEPTION */
                /*$('#conception').mouseenter(function() {
                        position = $('#conception').position().left-decallage_legende;
                        $('#legend02').css('margin-left',position);
			$('#legend02').css('visibility','visible');
			$('#legend02').html('strategic planning / rendering / planning');

		});
                $('#conception').mouseleave(function() {
			$('#legend02').css('visibility','hidden');
		});*/
                
                /* ENGINEERING */
                $('#engineering').mouseenter(function() {
                        position = $('#engineering').position().left-decallage_legende;
                        $('#legend02').css('margin-left',position);
			$('#legend02').css('visibility','visible');
			$('#legend02').html('interface / interaction / integration');
		});
                $('#engineering').mouseleave(function() {
			$('#legend02').css('visibility','hidden');
		});
                
                /* OVERSIGHT */
                /*$('#oversight').mouseenter(function() {
                        position = $('#oversight').position().left-decallage_legende;
                        $('#legend02').css('margin-left',position);
			$('#legend02').css('visibility','visible');
			$('#legend02').html('creative / technical');
		});
                $('#oversight').mouseleave(function() {
			$('#legend02').css('visibility','hidden');
		});*/
                
                /* RESEARCH */
                $('#research').mouseenter(function() {
                        position = $('#research').position().left-decallage_legende;
                        var titleW = $('#research').width();
                        
                        if ($.browser.mozilla==true) var decal=418;
                        else if($.browser.webkit==true) var decal=406;
                        
                        $('#legend02').html('concepts / software and devices / interface and automation');
                        var legendWidth = $('#legend02').width();
                        $('#legend02').css('margin-left',position+titleW-decal);
			$('#legend02').css('visibility','visible');
		});
                $('#research').mouseleave(function() {
			$('#legend02').css('visibility','hidden');
		});
          
                /* PROJECT MANAGEMENT */
                /*$('#projectmanagement').mouseenter(function() {
                        position = $('#projectmanagement').position().left-decallage_legende;
                        var titleW = $('#research').width();
                        
                        if ($.browser.mozilla==true) var decal=298;
                        else if($.browser.webkit==true) var decal=292;
                        
                        $('#legend02').html('coordination / production / operation');
                        var legendWidth = $('#projectmanagement').width();
                        $('#legend02').css('margin-left',position+titleW-decal);
			$('#legend02').css('visibility','visible');	
		});
                $('#projectmanagement').mouseleave(function() {
			$('#legend02').css('visibility','hidden');
		});*/
                
                /* ********** LEGEND03 ********** */
                $('#legend03').css('visibility','hidden');
                
                /* CREATION */
                /*$('#creation').mouseenter(function() {
                        position = $('#creation').position().left-decallage_legende;
                        $('#legend03').css('margin-left',position);
			$('#legend03').css('visibility','visible');
			$('#legend03').html('scenario / art direction');

		});
                $('#creation').mouseleave(function() {
			$('#legend03').css('visibility','hidden');
		});*/
                
                /* STUDIES */
                /*$('#studies').mouseenter(function() {
                        position = $('#studies').position().left-decallage_legende;
                        $('#legend03').css('margin-left',position);
			$('#legend03').css('visibility','visible');
			$('#legend03').html('conception / specifications');

		});
                $('#studies').mouseleave(function() {
			$('#legend03').css('visibility','hidden');
		});*/
                
                /* PROTOTYPING */
                $('#prototyping').mouseenter(function() {
                        position = $('#prototyping').position().left-decallage_legende;
                        $('#legend03').css('margin-left',position);
			$('#legend03').css('visibility','visible');
			$('#legend03').html('design / realisation');

		});
                $('#prototyping').mouseleave(function() {
			$('#legend03').css('visibility','hidden');
		});
                
                
                // ========== METHOD
                
                /* ********** LEGEND04 ********** */
                $('#legend04').css('visibility','hidden');
                
                /* PRELIMINARY */
                $('#preliminary').mouseenter(function() {
                        position = $('#preliminary').position().left-decallage_legende;
                        $('#legend04').css('margin-left',position);
			$('#legend04').css('visibility','visible');
			$('#legend04').html('conceptualisation and hypothesis / technical parameters / financial projections');

		});
                $('#preliminary').mouseleave(function() {
			$('#legend04').css('visibility','hidden');
		});
                
                /* FEASIBILITY */
                $('#feasibility').mouseenter(function() {
                        position = $('#feasibility').position().left-decallage_legende;
                        $('#legend04').css('margin-left',position);
			$('#legend04').css('visibility','visible');
			$('#legend04').html('rendering / planning and budget / impact study');

		});
                $('#feasibility').mouseleave(function() {
			$('#legend04').css('visibility','hidden');
		});
                
                /* IMPLEMENTATION */
                $('#implementation').mouseenter(function() {
                        position = $('#implementation').position().left-decallage_legende;
                        $('#legend04').css('margin-left',position);
			$('#legend04').css('visibility','visible');
			$('#legend04').html('production / installation / maintenance');

		});
                $('#implementation').mouseleave(function() {
			$('#legend04').css('visibility','hidden');
		});
                
                
                
                
                $('#'+filter).css('color','#fff');
          
            }
            /* ********** DESIGN ********* */

            if(currentPage!='index') {
                initialisations();

                if(no_video==false) $('#player-box').find('img').css('display','none');
                else $('#player-box').find('img').css('display','block');
                
                $('#close img').css('display','block');
                
                $('.t_vid').click( function(index) { 
                    var visuel_path = $(this).attr('rel');
                    show_video(visuel_path);
                });
                
                
                /*$('.t_img').click( function(index) { 
                    var visuel_path = $(this).attr('rel');
                    show_image(visuel_path);
                });*/	
            }
	

});

