$(document).ready(function() {	

/*---------------------------------------------------------------------
------------------------------ Accueil --------------------------------
---------------------------------------------------------------------*/
	var t = parseInt($('.enter').css('top'));
	
	$('.enter').hover(function(){
	$(this).find('img').stop().animate({opacity : 0}, 250);
	}, function(){
	$(this).find('img').stop().animate({opacity : 1}, 800);			
	});
	
	fonctions = function(){
		carrouselActu.init($('#carrouselActu'));
		carrouselVisuel.initV($('#carrouselVisuel'));
		carrouselVisuel2.initV2($('#carrouselVisuel2'));
		carrouselRefs.init($('#carrouselRefs'));
		carrouselRVisuel.initRV($('#carrouselRVisuel'));
		carrouselRVisuel2.initRV2($('#carrouselRVisuel2'));
		carrouselRVisuel3.initRV3($('#carrouselRVisuel3'));
		carrouselRVisuel4.initRV4($('#carrouselRVisuel4'));
		carrouselRVisuel5.initRV5($('#carrouselRVisuel5'));
		carrouselRVisuel6.initRV6($('#carrouselRVisuel6'));
		carrouselRVisuel7.initRV7($('#carrouselRVisuel7'));
		carrouselRVisuel8.initRV8($('#carrouselRVisuel8'));
		carrouselClients.init($('#carrouselClients'));
		carrouselBlog.init($('#carrouselBlog'));
		$('#barre').show(0);
		$('#plogo').animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('#plogo2').animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('#mail').animate({opacity : 1, top : 10}, 500, 'easeOutQuad', function(){
		$('.l1 img').animate({opacity : 1}, 1000, 'easeOutQuad');
		$('.l2 img').delay(250).animate({opacity : 1}, 1000, 'easeOutQuad');
		$('.l3 img').delay(500).animate({opacity : 1}, 1000, 'easeOutQuad');});
		$('.tactu').animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('.tagence').delay(200).animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('.treferences').delay(400).animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('.tclients').delay(600).animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('.tcontact').delay(800).animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('.tblog').delay(1000).animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
		$('.footer').delay(1200).animate({opacity : 1, top : 0}, 500, 'easeOutQuad');
	};
	
	Load = function(){
	$('#accueil').animate({opacity : 1}, 1000, 'easeOutQuad');
	$('#acc').delay(800).animate({opacity : 1, top : 50}, 800, 'easeOutQuad',function(){	
		$('.enterF').click(function(){
			$('#plogo2').remove();
			$('.en').remove();
			$('#accueil').animate({opacity : 0}, 500, 'easeOutQuad', function(){
				$('#accueil').hide(0,function(){
					$('#site').show(0, function(){
					fonctions();
					});
				});
			});
		});
		$('.enterE').click(function(){
			$('#plogo').remove();
			$('.fr').remove();
			$('#accueil').animate({opacity : 0}, 500, 'easeOutQuad', function(){
				$('#accueil').hide(0,function(){
					$('#site').show(0, function(){
						fonctions();
						});
					});
				});
			});
		});
	};
	
	
/*---------------------------------------------------------------------
----------------------------- Structure -------------------------------
---------------------------------------------------------------------*/

	projekktor('video', {
		volume: 1,
    	playerFlashMP4: 'http://somnyum.com/test/ohmwork3.0/projekktor/jarisplayer.swf',
    	playerFlashMP3: 'http://somnyum.com/test/ohmwork3.0/projekktor/jarisplayer.swf'});
	
	projekktor('audio', {
		volume: 1,
    	playerFlashMP4: 'http://somnyum.com/test/ohmwork3.0/projekktor/jarisplayer.swf',
    	playerFlashMP3: 'http://somnyum.com/test/ohmwork3.0/projekktor/jarisplayer.swf'});
	
	$('.languette').hover(function(){
	$(this).find('img').stop().animate({opacity : 0}, 250);
	}, function(){
	$(this).find('img').stop().animate({opacity : 1}, 800);			
	});
	

	$('.ab').mouseover(function(){
        if($(this).attr('title')=='') return false;
        
        $('body').append('<span class="infobulle"></span>');
        var bulle = $('.infobulle:last');
        bulle.append($(this).attr('title'));
        $(this).attr('title','');
        var posTop = $(this).offset().top + 20;
        var posLeft = $(this).offset().left - $(this).width()/2;
        bulle.css({
            left:posLeft,
            top:posTop,
            opacity:0
        });
        bulle.animate({
            top:posTop+10,
            opacity:0.99
        },500, 'easeOutQuad');
	});
	
    
    $('.ab').mouseout(function(){
        var bulle = $('.infobulle:last');
        $(this).attr('title',bulle.text());
        bulle.animate(
            {
                top:bulle.offset().top+30,
                opacity:0
            },
            500,
            'easeInQuad',
            function(){
                bulle.remove();  
            }
        );
    });
	
	projekktorPause = function() {
	projekktor('*').each(function() {
    this.setPause();});
	};
	
	$('.rubrique').hover(function(){
	$(this).find('img').stop().animate({opacity : 0}, 250);
	}, function(){
	$(this).find('img').stop().animate({opacity : 1}, 800);			
	});
	
	
	$('.rubrique').click(function(){
	var contenu = $(this).next('div');
	var t = parseInt( $(this).next('div').css('top'));
	
	projekktorPause();
	
	if(contenu.is(':hidden')){
	$('.contenu:visible').slideUp(400, 'easeOutQuad');
	};
	contenu.slideDown(400, 'easeOutQuad',function(){
    	$(window).scrollTo(contenu, 400, 'easeInQuad');
	});
		
	$('.languette img').click(function(){
    contenu.slideUp(400,'easeOutQuad', function() {
	projekktorPause();});
	});});
	
	$('#plogo').click(function(){
	$('.contenu:visible').slideUp(400, 'easeOutQuad');
    $(window).scrollTo(0, 400, 'easeInQuad');
	projekktorPause();
	});
	
	$('#plogo2').click(function(){
	$('.contenu:visible').slideUp(400, 'easeOutQuad');
    $(window).scrollTo(0, 400, 'easeInQuad');
	projekktorPause();
	});
	
	$('.survol').hover(function(){
	$(this).find('img').stop().animate({opacity : 1}, 250);
	}, function(){
	$(this).find('img').stop().animate({opacity : 0}, 800);			
	});

	
/*---------------------------------------------------------------------
------------------------------- News ----------------------------------
---------------------------------------------------------------------*/
var carrouselActu = {
	 nbSlide: 0,
	 nbCurrent: 1,
	 elementCurrent: null,
	 elem: null,
	 timer: null,
	 
	 init: function(elem){ 
		 this.nbSlide = elem.find('.slide').length;
		 
	$('#carrouselActu').append('<div class="navigation"></div>');
	for(var i=1;i<=this.nbSlide;i++){
		elem.find('.navigation').append('<span>'+i+'</span>')
	}	 
	elem.find('.navigation span').click(function(){carrouselActu.gotoSlide($(this).text());})
	
		 this.elem = elem;
		 elem.find('.slide2').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide3').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide:first').animate({opacity:1});
		 this.elementCurrent = elem.find('.slide:first');
		 this.elem.find('.navigation span:first').addClass('active');
		 
		 /*carrouselActu.timer = window.setInterval(function(){carrouselActu.next()}, 6000);
		 
		 $('#carrouselActu').hover(function(){
			carrouselActu.stop();
			}, function(){
			carrouselActu.play();		
		});*/
	 },
	 
	 gotoSlide : function(num){
		 if(num==this.nbCurrent){return false;}
		 this.elementCurrent.animate({opacity:0, left:-60}, 300, function(){$(this).hide()});
		 this.elem.find('.slide'+num).delay(0).animate({left:60}).show(0).animate({opacity:1, left:0});
		 this.elem.find('.navigation span').removeClass('active');
		 this.elem.find('.navigation span:eq('+(num-1)+')').addClass('active');
		 this.nbCurrent = num; 
		 this.elementCurrent = this.elem.find('.slide'+num);
		 projekktorPause();
	 },
	 
	 next : function(){
		var num = Number(this.nbCurrent)+1;
		if(num > this.nbSlide){
			num = 1;
			} 
		this.gotoSlide(num);
	 },
	 
	 prev : function(){
		var num = Number(this.nbCurrent)-1;
		if(num < 1){
			num = this.nbSlide;
			} 
		this.gotoSlide(num);
	 },
	 
	 stop : function(){
		 window.clearInterval(carrouselActu.timer);
	 },
	 
	 play : function(){
		 window.clearInterval(carrouselActu.timer);
		 carrouselActu.timer = window.setInterval(function(){carrouselActu.next()}, 6000);
	 }
}

var carrouselVisuel = {
	 nbslideV: 0,
	 nbCurrentV: 1,
	 elemVentCurrentV: null,
	 elemV: null,
	 
	 initV: function(elemV){ 
		 this.nbslideV = elemV.find('.slideV').length;
		 
	$('#carrouselVisuel').append('<div class="navigationV"></div>');
	for(var i=1;i<=this.nbslideV;i++){
		elemV.find('.navigationV').append('<span>'+i+'</span>')
	}	 
	elemV.find('.navigationV span').click(function(){carrouselVisuel.gotoslideV($(this).text());})
	
		 this.elemV = elemV;
		 elemV.find('.slideV2').animate({bottom:30}, function(){$(this).hide()});
		 elemV.find('.slideV3').animate({bottom:30}, function(){$(this).hide()});
		 elemV.find('.slideV:first').animate({opacity:1});
		 this.elemVentCurrentV = elemV.find('.slideV:first');
		 this.elemV.find('.navigationV span:first').addClass('activeV');
	 },
	 
	 gotoslideV : function(numV){
		 if(numV==this.nbCurrentV){return false;}
		 this.elemVentCurrentV.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemV.find('.slideV'+numV).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemV.find('.navigationV span').removeClass('activeV');
		 this.elemV.find('.navigationV span:eq('+(numV-1)+')').addClass('activeV');
		 this.nbCurrentV = numV; 
		 this.elemVentCurrentV = this.elemV.find('.slideV'+numV);
		 projekktorPause();
	 }
}

var carrouselVisuel2 = {
	 nbslideV2: 0,
	 nbCurrentV2: 1,
	 elemV2entCurrentV2: null,
	 elemV2: null,
	 
	 initV2: function(elemV2){ 
		 this.nbslideV2 = elemV2.find('.slideV2').length;
		 
	$('#carrouselVisuel2').append('<diV2 class="navigationV"></diV2>');
	for(var i=1;i<=this.nbslideV2;i++){
		elemV2.find('.navigationV').append('<span>'+i+'</span>')
	}	 
	elemV2.find('.navigationV span').click(function(){carrouselVisuel2.gotoslideV2($(this).text());})
	
		 this.elemV2 = elemV2;
		 elemV2.find('.slideV22').animate({bottom:30}, function(){$(this).hide()});
		 elemV2.find('.slideV23').animate({bottom:30}, function(){$(this).hide()});
		 elemV2.find('.slideV2:first').animate({opacity:1});
		 this.elemV2entCurrentV2 = elemV2.find('.slideV2:first');
		 this.elemV2.find('.navigationV span:first').addClass('activeV');
	 },
	 
	 gotoslideV2 : function(numV2){
		 if(numV2==this.nbCurrentV2){return false;}
		 this.elemV2entCurrentV2.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemV2.find('.slideV2'+numV2).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemV2.find('.navigationV span').removeClass('activeV');
		 this.elemV2.find('.navigationV span:eq('+(numV2-1)+')').addClass('activeV');
		 this.nbCurrentV2 = numV2; 
		 this.elemV2entCurrentV2 = this.elemV2.find('.slideV2'+numV2);
		 projekktorPause();
	 }
}
/*---------------------------------------------------------------------
------------------------------ Agence ---------------------------------
---------------------------------------------------------------------*/

/*---------------------------------------------------------------------
------------------------------- Work ----------------------------------
---------------------------------------------------------------------*/
var carrouselRefs = {
	 nbSlide: 0,
	 nbCurrent: 1,
	 elementCurrent: null,
	 elem: null,
	 timer: null,
	 
	 init: function(elem){ 
		 this.nbSlide = elem.find('.slide').length;
		 
	$('#carrouselRefs').append('<div class="navigation"></div>');
	for(var i=1;i<=this.nbSlide;i++){
		elem.find('.navigation').append('<span>'+i+'</span>')
	}	 
	elem.find('.navigation span').click(function(){carrouselRefs.gotoSlide($(this).text());})
	
		 this.elem = elem;
		 elem.find('.slide2').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide3').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide4').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide5').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide6').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide7').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide8').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide9').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide10').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide11').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide12').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide13').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide14').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide15').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide:first').animate({opacity:1});
		 this.elementCurrent = elem.find('.slide:first');
		 this.elem.find('.navigation span:first').addClass('active');
		 
		 /*carrouselRefs.timer = window.setInterval(function(){carrouselRefs.next()}, 6000);
		 
		 $('#carrouselRefs').hover(function(){
			carrouselRefs.stop();
			}, function(){
			carrouselRefs.play();		
		});*/
	 },
	 
	 gotoSlide : function(num){
		 if(num==this.nbCurrent){return false;}
		 this.elementCurrent.animate({opacity:0, left:-60}, 300, function(){$(this).hide()});
		 this.elem.find('.slide'+num).delay(0).animate({left:60}).show(0).animate({opacity:1, left:0});
		 this.elem.find('.navigation span').removeClass('active');
		 this.elem.find('.navigation span:eq('+(num-1)+')').addClass('active');
		 this.nbCurrent = num; 
		 this.elementCurrent = this.elem.find('.slide'+num);
		 projekktorPause();
	 },
	 
	 next : function(){
		var num = Number(this.nbCurrent)+1;
		if(num > this.nbSlide){
			num = 1;
			} 
		this.gotoSlide(num);
	 },
	 
	 prev : function(){
		var num = Number(this.nbCurrent)-1;
		if(num < 1){
			num = this.nbSlide;
			} 
		this.gotoSlide(num);
	 },
	 
	 stop : function(){
		 window.clearInterval(carrouselRefs.timer);
	 },
	 
	 play : function(){
		 window.clearInterval(carrouselRefs.timer);
		 carrouselRefs.timer = window.setInterval(function(){carrouselRefs.next()}, 6000);
	 }
}

var carrouselRVisuel = {
	 nbslideRV: 0,
	 nbCurrentRV: 1,
	 elementCurrentRV: null,
	 elemRV: null,
	 
	 initRV: function(elemRV){ 
		 this.nbslideRV = elemRV.find('.slideRV2').length;
		 
	$('#carrouselRVisuel').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV;i++){
		elemRV.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV.find('.navigationRV span').click(function(){carrouselRVisuel.gotoslideRV($(this).text());})
	
		 this.elemRV = elemRV;
		 elemRV.find('.slideRV22').animate({bottom:30}, function(){$(this).hide()});
		 elemRV.find('.slideRV23').animate({bottom:30}, function(){$(this).hide()});
		 elemRV.find('.slideRV2:first').animate({opacity:1});
		 this.elementCurrentRV = elemRV.find('.slideRV2:first');
		 this.elemRV.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV : function(numRV){
		 if(numRV==this.nbCurrentRV){return false;}
		 this.elementCurrentRV.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV.find('.slideRV2'+numRV).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV.find('.navigationRV span:eq('+(numRV-1)+')').addClass('activeRV');
		 this.nbCurrentRV = numRV; 
		 this.elementCurrentRV = this.elemRV.find('.slideRV2'+numRV);
		 projekktorPause();
	 }
}

var carrouselRVisuel2 = {
	 nbslideRV2: 0,
	 nbCurrentRV2: 1,
	 elementCurrentRV2: null,
	 elemRV2: null,
	 
	 initRV2: function(elemRV2){ 
		 this.nbslideRV2 = elemRV2.find('.slideRV2').length;
		 
	$('#carrouselRVisuel2').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV2;i++){
		elemRV2.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV2.find('.navigationRV span').click(function(){carrouselRVisuel2.gotoslideRV2($(this).text());})
	
		 this.elemRV2 = elemRV2;
		 elemRV2.find('.slideRV22').animate({bottom:30}, function(){$(this).hide()});
		 elemRV2.find('.slideRV23').animate({bottom:30}, function(){$(this).hide()});
		 elemRV2.find('.slideRV24').animate({bottom:30}, function(){$(this).hide()});
		 elemRV2.find('.slideRV2:first').animate({opacity:1});
		 this.elementCurrentRV2 = elemRV2.find('.slideRV2:first');
		 this.elemRV2.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV2 : function(numRV2){
		 if(numRV2==this.nbCurrentRV2){return false;}
		 this.elementCurrentRV2.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV2.find('.slideRV2'+numRV2).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV2.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV2.find('.navigationRV span:eq('+(numRV2-1)+')').addClass('activeRV');
		 this.nbCurrentRV2 = numRV2; 
		 this.elementCurrentRV2 = this.elemRV2.find('.slideRV2'+numRV2);
		 projekktorPause();
	 }
}

var carrouselRVisuel3 = {
	 nbslideRV3: 0,
	 nbCurrentRV3: 1,
	 elementCurrentRV3: null,
	 elemRV3: null,
	 
	 initRV3: function(elemRV3){ 
		 this.nbslideRV3 = elemRV3.find('.slideRV3').length;
		 
	$('#carrouselRVisuel3').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV3;i++){
		elemRV3.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV3.find('.navigationRV span').click(function(){carrouselRVisuel3.gotoslideRV3($(this).text());})
	
		 this.elemRV3 = elemRV3;
		 elemRV3.find('.slideRV32').animate({bottom:30}, function(){$(this).hide()});
		 elemRV3.find('.slideRV33').animate({bottom:30}, function(){$(this).hide()});
		 elemRV3.find('.slideRV34').animate({bottom:30}, function(){$(this).hide()});
		 elemRV3.find('.slideRV3:first').animate({opacity:1});
		 this.elementCurrentRV3 = elemRV3.find('.slideRV3:first');
		 this.elemRV3.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV3 : function(numRV3){
		 if(numRV3==this.nbCurrentRV3){return false;}
		 this.elementCurrentRV3.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV3.find('.slideRV3'+numRV3).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV3.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV3.find('.navigationRV span:eq('+(numRV3-1)+')').addClass('activeRV');
		 this.nbCurrentRV3 = numRV3; 
		 this.elementCurrentRV3 = this.elemRV3.find('.slideRV3'+numRV3);
		 projekktorPause();
	 }
}

var carrouselRVisuel4 = {
	 nbslideRV4: 0,
	 nbCurrentRV4: 1,
	 elementCurrentRV4: null,
	 elemRV4: null,
	 
	 initRV4: function(elemRV4){ 
		 this.nbslideRV4 = elemRV4.find('.slideRV4').length;
		 
	$('#carrouselRVisuel4').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV4;i++){
		elemRV4.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV4.find('.navigationRV span').click(function(){carrouselRVisuel4.gotoslideRV4($(this).text());})
	
		 this.elemRV4 = elemRV4;
		 elemRV4.find('.slideRV42').animate({bottom:30}, function(){$(this).hide()});
		 elemRV4.find('.slideRV43').animate({bottom:30}, function(){$(this).hide()});
		 elemRV4.find('.slideRV44').animate({bottom:30}, function(){$(this).hide()});
		 elemRV4.find('.slideRV4:first').animate({opacity:1});
		 this.elementCurrentRV4 = elemRV4.find('.slideRV4:first');
		 this.elemRV4.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV4 : function(numRV4){
		 if(numRV4==this.nbCurrentRV4){return false;}
		 this.elementCurrentRV4.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV4.find('.slideRV4'+numRV4).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV4.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV4.find('.navigationRV span:eq('+(numRV4-1)+')').addClass('activeRV');
		 this.nbCurrentRV4 = numRV4; 
		 this.elementCurrentRV4 = this.elemRV4.find('.slideRV4'+numRV4);
		 projekktorPause();
	 }
}

var carrouselRVisuel5 = {
	 nbslideRV5: 0,
	 nbCurrentRV5: 1,
	 elementCurrentRV5: null,
	 elemRV5: null,
	 
	 initRV5: function(elemRV5){ 
		 this.nbslideRV5 = elemRV5.find('.slideRV5').length;
		 
	$('#carrouselRVisuel5').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV5;i++){
		elemRV5.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV5.find('.navigationRV span').click(function(){carrouselRVisuel5.gotoslideRV5($(this).text());})
	
		 this.elemRV5 = elemRV5;
		 elemRV5.find('.slideRV52').animate({bottom:30}, function(){$(this).hide()});
		 elemRV5.find('.slideRV53').animate({bottom:30}, function(){$(this).hide()});
		 elemRV5.find('.slideRV54').animate({bottom:30}, function(){$(this).hide()});
		 elemRV5.find('.slideRV55').animate({bottom:30}, function(){$(this).hide()});
		 elemRV5.find('.slideRV5:first').animate({opacity:1});
		 this.elementCurrentRV5 = elemRV5.find('.slideRV5:first');
		 this.elemRV5.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV5 : function(numRV5){
		 if(numRV5==this.nbCurrentRV5){return false;}
		 this.elementCurrentRV5.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV5.find('.slideRV5'+numRV5).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV5.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV5.find('.navigationRV span:eq('+(numRV5-1)+')').addClass('activeRV');
		 this.nbCurrentRV5 = numRV5; 
		 this.elementCurrentRV5 = this.elemRV5.find('.slideRV5'+numRV5);
		 projekktorPause();
	 }
}

var carrouselRVisuel6 = {
	 nbslideRV6: 0,
	 nbCurrentRV6: 1,
	 elementCurrentRV6: null,
	 elemRV6: null,
	 
	 initRV6: function(elemRV6){ 
		 this.nbslideRV6 = elemRV6.find('.slideRV6').length;
		 
	$('#carrouselRVisuel6').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV6;i++){
		elemRV6.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV6.find('.navigationRV span').click(function(){carrouselRVisuel6.gotoslideRV6($(this).text());})
	
		 this.elemRV6 = elemRV6;
		 elemRV6.find('.slideRV62').animate({bottom:30}, function(){$(this).hide()});
		 elemRV6.find('.slideRV6:first').animate({opacity:1});
		 this.elementCurrentRV6 = elemRV6.find('.slideRV6:first');
		 this.elemRV6.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV6 : function(numRV6){
		 if(numRV6==this.nbCurrentRV6){return false;}
		 this.elementCurrentRV6.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV6.find('.slideRV6'+numRV6).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV6.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV6.find('.navigationRV span:eq('+(numRV6-1)+')').addClass('activeRV');
		 this.nbCurrentRV6 = numRV6; 
		 this.elementCurrentRV6 = this.elemRV6.find('.slideRV6'+numRV6);
		 projekktorPause();
	 }
}

var carrouselRVisuel7 = {
	 nbslideRV7: 0,
	 nbCurrentRV7: 1,
	 elementCurrentRV7: null,
	 elemRV7: null,
	 
	 initRV7: function(elemRV7){ 
		 this.nbslideRV7 = elemRV7.find('.slideRV7').length;
		 
	$('#carrouselRVisuel7').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV7;i++){
		elemRV7.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV7.find('.navigationRV span').click(function(){carrouselRVisuel7.gotoslideRV7($(this).text());})
	
		 this.elemRV7 = elemRV7;
		 elemRV7.find('.slideRV72').animate({bottom:30}, function(){$(this).hide()});
		 elemRV7.find('.slideRV73').animate({bottom:30}, function(){$(this).hide()});
		 elemRV7.find('.slideRV74').animate({bottom:30}, function(){$(this).hide()});
		 elemRV7.find('.slideRV7:first').animate({opacity:1});
		 this.elementCurrentRV7 = elemRV7.find('.slideRV7:first');
		 this.elemRV7.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV7 : function(numRV7){
		 if(numRV7==this.nbCurrentRV7){return false;}
		 this.elementCurrentRV7.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV7.find('.slideRV7'+numRV7).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV7.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV7.find('.navigationRV span:eq('+(numRV7-1)+')').addClass('activeRV');
		 this.nbCurrentRV7 = numRV7; 
		 this.elementCurrentRV7 = this.elemRV7.find('.slideRV7'+numRV7);
		 projekktorPause();
	 }
}

var carrouselRVisuel8 = {
	 nbslideRV8: 0,
	 nbCurrentRV8: 1,
	 elementCurrentRV8: null,
	 elemRV8: null,
	 
	 initRV8: function(elemRV8){ 
		 this.nbslideRV8 = elemRV8.find('.slideRV8').length;
		 
	$('#carrouselRVisuel8').append('<div class="navigationRV"></div>');
	for(var i=1;i<=this.nbslideRV8;i++){
		elemRV8.find('.navigationRV').append('<span>'+i+'</span>')
	}	 
	elemRV8.find('.navigationRV span').click(function(){carrouselRVisuel8.gotoslideRV8($(this).text());})
	
		 this.elemRV8 = elemRV8;
		 elemRV8.find('.slideRV82').animate({bottom:30}, function(){$(this).hide()});
		 elemRV8.find('.slideRV83').animate({bottom:30}, function(){$(this).hide()});
		 elemRV8.find('.slideRV84').animate({bottom:30}, function(){$(this).hide()});
		 elemRV8.find('.slideRV85').animate({bottom:30}, function(){$(this).hide()});
		 elemRV8.find('.slideRV86').animate({bottom:30}, function(){$(this).hide()});
		 elemRV8.find('.slideRV8:first').animate({opacity:1});
		 this.elementCurrentRV8 = elemRV8.find('.slideRV8:first');
		 this.elemRV8.find('.navigationRV span:first').addClass('activeRV');
	 },
	 
	 gotoslideRV8 : function(numRV8){
		 if(numRV8==this.nbCurrentRV8){return false;}
		 this.elementCurrentRV8.animate({opacity:0, bottom:-30}, 300, function(){$(this).hide()});
		 this.elemRV8.find('.slideRV8'+numRV8).delay(0).animate({bottom:30}).show(0).animate({opacity:1, bottom:0});
		 this.elemRV8.find('.navigationRV span').removeClass('activeRV');
		 this.elemRV8.find('.navigationRV span:eq('+(numRV8-1)+')').addClass('activeRV');
		 this.nbCurrentRV8 = numRV8; 
		 this.elementCurrentRV8 = this.elemRV8.find('.slideRV8'+numRV8);
		 projekktorPause();
	 }
}



/*---------------------------------------------------------------------
------------------------------ Clients --------------------------------
---------------------------------------------------------------------*/
var carrouselClients = {
	 nbSlide: 0,
	 nbCurrent: 1,
	 elementCurrent: null,
	 elem: null,
	 timer: null,
	 
	 init: function(elem){ 
		 this.nbSlide = elem.find('.slide').length;
		 
	$('#carrouselClients').append('<div class="navigation"></div>');
	for(var i=1;i<=this.nbSlide;i++){
		elem.find('.navigation').append('<span>'+i+'</span>')
	}	 
	elem.find('.navigation span').click(function(){carrouselClients.gotoSlide($(this).text());})
	
		 this.elem = elem;
		 elem.find('.slide2').animate({bottom:30}, function(){$(this).hide()});
		 elem.find('.slide3').animate({bottom:30}, function(){$(this).hide()});
		 elem.find('.slide:first').animate({opacity:1});
		 this.elementCurrent = elem.find('.slide:first');
		 this.elem.find('.navigation span:first').addClass('active');
		 
		 carrouselClients.timer = window.setInterval(function(){carrouselClients.next()}, 4000);
		 
		 $('#carrouselClients .logos').mouseover(carrouselClients.stop);
		 $('#carrouselClients .logos').mouseout(carrouselClients.play);
		 $('#carrouselClients .navigation').mouseover(carrouselClients.stop);
		 $('#carrouselClients .navigation').mouseout(carrouselClients.play);
	 },
	 
	 gotoSlide : function(num){
		 if(num==this.nbCurrent){return false;}
		 this.elementCurrent.animate({opacity:0, bottom:30}, function(){$(this).hide()});
		 this.elem.find('.slide'+num).delay(500).show(0).animate({opacity:1, bottom:0});
		 this.elem.find('.navigation span').removeClass('active');
		 this.elem.find('.navigation span:eq('+(num-1)+')').addClass('active');
		 this.nbCurrent = num; 
		 this.elementCurrent = this.elem.find('.slide'+num);
	 },
	 
	 next : function(){
		var num = Number(this.nbCurrent)+1;
		if(num > this.nbSlide){
			num = 1;
			} 
		this.gotoSlide(num);
	 },
	 
	 prev : function(){
		var num = Number(this.nbCurrent)-1;
		if(num < 1){
			num = this.nbSlide;
			} 
		this.gotoSlide(num);
	 },
	 
	 stop : function(){
		 window.clearInterval(carrouselClients.timer);
	 },
	 
	 play : function(){
		 window.clearInterval(carrouselClients.timer);
		 carrouselClients.timer = window.setInterval(function(){carrouselClients.next()}, 4000);
	 }
}



/*---------------------------------------------------------------------
------------------------------- Agence --------------------------------
---------------------------------------------------------------------*/
$('#nico').hover(function(){
	$(".txtnico").stop().animate({opacity: 1, left:180}, 250);
	$(".txtfranck").stop().animate({opacity: 0, right:130}, 250);	
	});
	
$('#franck').hover(function(){	
	$(".txtfranck").stop().animate({opacity: 1, right:150}, 250);
	$(".txtnico").stop().animate({opacity: 0, left:160}, 250);		
	});

$('#contactAgence').hover(function(){	
	$(".txtfranck").stop().animate({opacity: 0, right:130}, 250);
	$(".txtnico").stop().animate({opacity: 0, left:160}, 250);		
	});
	
	
	
/*---------------------------------------------------------------------
------------------------------- Blog ----------------------------------
---------------------------------------------------------------------*/
var carrouselBlog = {
	 nbSlide: 0,
	 nbCurrent: 1,
	 elementCurrent: null,
	 elem: null,
	 timer: null,
	 
	 init: function(elem){ 
		 this.nbSlide = elem.find('.slide').length;
		 
	$('#carrouselBlog').append('<div class="navigation"></div>');
	for(var i=1;i<=this.nbSlide;i++){
		elem.find('.navigation').append('<span>'+i+'</span>')
	}	 
	elem.find('.navigation span').click(function(){carrouselBlog.gotoSlide($(this).text());})
	
		 this.elem = elem;
		 elem.find('.slide2').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide3').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide4').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide5').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide6').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide7').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide8').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide9').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide10').animate({left:60}, function(){$(this).hide()});
		 elem.find('.slide:first').animate({opacity:1});
		 this.elementCurrent = elem.find('.slide:first');
		 this.elem.find('.navigation span:first').addClass('active');
		 
		 carrouselBlog.timer = window.setInterval(function(){carrouselBlog.next()}, 4000);
		 
		 $('#carrouselBlog').hover(function(){
			carrouselBlog.stop();
			}, function(){
			carrouselBlog.play();		
		});
	 },
	 
	 gotoSlide : function(num){
		 if(num==this.nbCurrent){return false;}
		 this.elementCurrent.animate({opacity:0, left:-60}, 300, function(){$(this).hide()});
		 this.elem.find('.slide'+num).delay(0).animate({left:60}).show(0).animate({opacity:1, left:0});
		 this.elem.find('.navigation span').removeClass('active');
		 this.elem.find('.navigation span:eq('+(num-1)+')').addClass('active');
		 this.nbCurrent = num; 
		 this.elementCurrent = this.elem.find('.slide'+num);
	 },
	 
	 next : function(){
		var num = Number(this.nbCurrent)+1;
		if(num > this.nbSlide){
			num = 1;
			} 
		this.gotoSlide(num);
	 },
	 
	 prev : function(){
		var num = Number(this.nbCurrent)-1;
		if(num < 1){
			num = this.nbSlide;
			} 
		this.gotoSlide(num);
	 },
	 
	 stop : function(){
		 window.clearInterval(carrouselBlog.timer);
	 },
	 
	 play : function(){
		 window.clearInterval(carrouselBlog.timer);
		 carrouselBlog.timer = window.setInterval(function(){carrouselBlog.next()}, 4000);
	 }
}






/*---------------------------------------------------------------------
------------------------------ Footer ---------------------------------
---------------------------------------------------------------------*/
$('.formb').click(function(){
	if(!$('.form').val().match(/^[a-z0-9\-_.]+@[a-z0-9\-_.]+\.[a-z]{2,3}$/i)){
		$('.fr .notification').text('e-mail invalide');
		$('.en .notification').text('invalid e-mail');
		return false;
	} else {
		$('.fr .notification').text('');
		$('.en .notification').text('');
	}
});



$('.boiteForm').ajaxForm({ 
        // target identifies the element(s) to update with the server response 
        //target: '.notification', 
 
        // success identifies the function to invoke when the server response 
    success: function() { 
	$('.fr .form').val("Merci !");
	$('.en .form').val("Thank you !");
	}
}); 

$('#somnyum').hover(function(){
	$(this).find('img').stop().animate({opacity : 0}, 250);
	}, function(){
	$(this).find('img').stop().animate({opacity : 1}, 800);			
	});


});
