 function imgCv_onMouseOver()
 {
    document.imgCv.src='NouveauTemplate2/images/imagesSiteGlobal/monCvBlanc.gif';
 }

 function imgCv_onMouseOut()
 {
    document.imgCv.src='NouveauTemplate2/images/imagesSiteGlobal/monCv.gif';
 } 
 
function imgCrea_onMouseOver()
 {
    document.imgCrea.src='NouveauTemplate2/images/imagesSiteGlobal/mesCreationsBlanc.gif';
 }

 function imgCrea_onMouseOut()
 {
    document.imgCrea.src='NouveauTemplate2/images/imagesSiteGlobal/mesCreations.gif';
 } 
 
  function imgContact_onMouseOver()
 {
    document.imgContact.src='NouveauTemplate2/images/imagesSiteGlobal/meContacterBlanc.gif';
 }

 function imgContact_onMouseOut()
 {
    document.imgContact.src='NouveauTemplate2/images/imagesSiteGlobal/meContacter.gif';
 } 
 
  function imgliens_onMouseOver()
 {
    document.imgliens.src='NouveauTemplate2/images/imagesSiteGlobal/MesLiensBlanc.gif';
 }

 function imgliens_onMouseOut()
 {
    document.imgliens.src='NouveauTemplate2/images/imagesSiteGlobal/MesLiens.gif';
 } 


    
 
 // Carroussel
var carroussel = {
  nbSlide : 0,
  nbCurrent : 1,
  elemCurrent : null,
  elem : null,
  timer : null,
  
  init : function(elem){
        this.nbSlide = elem.find('.slide').length;      
        // Créer la pagination
        elem.append('<div class="navigation"></div>');
        for(var i=1; i <= this.nbSlide; i++)
        {
          elem.find('.navigation').append('<div>'+i+'</div>');
        }
        //elem.find('.navigation div').click(function(){ carroussel.gotoSlide($(this).text())});
        elem.find('.navigation div').click(function(){ carroussel.gotoSlide($(this).html())});
        // Initialisation du caroussel
        this.elem = elem;
        elem.find(".slide").hide();
        elem.find(".slide:first").show();
        this.elemCurrent = elem.find(".slide:first");
        this.elem.find('.navigation div:first').addClass('active');
                
        // On crer le timer.
        carroussel.play();        
        // Stop quand on passe dessus.
        elem.mouseover(carroussel.stop);
        elem.mouseout(carroussel.play);
    },
    
    gotoSlide : function(num){
    	
    	if(num == this.nbCurrent)
    	{
    		return false;
    	}
    	/* Animation en fadeIn/fadeOut
    	this.elemCurrent.fadeOut();
    	this.elem.find('#slide'+num).fadeIn();
    	*/
    	/* Animation en slide */
    	var cssDep = {'left' : this.elem.width()};
    	var cssFin = {'left' : -this.elem.width()};
    	
    	this.elem.find('#slide'+num).show().css(cssDep);
    	
    	this.elem.find('#slide'+num).animate({'top':0, 'left':0}, 500);
    	this.elemCurrent.animate(cssFin, 500);
    	
    	this.elem.find('.navigation div').removeClass('active');
    	this.elem.find('.navigation div:eq('+(num-1)+')').addClass('active');
    	this.nbCurrent = num;
    	this.elemCurrent = this.elem.find('#slide'+num);
    	
    },
    
    next : function(){
    	var num = this.nbCurrent + 1;
    	if(num > this.nbSlide)
    	{
    		num = 1;
    	}
    	this.gotoSlide(num);
    	
    },
    
    prev : function(){
    	var num = this.nbCurrent - 1;
    	if(num < 1)
    	{
    		num = this.nbSlide;
    	}
    	this.gotoSlide(num);
    	
    }, 
    
    stop : function(){
    	window.clearInterval(carroussel.timer);
    },
    
    play : function(){
    	window.clearInterval(carroussel.timer);
    	carroussel.timer = window.setInterval('carroussel.next()', 8000);
    }
  }
var currentIdExp = "Stage";
var currentIdOnglet = "OnglStage";
var isLibre = true;
$(function(){
// twitter !
$.getJSON("http://twitter.com/statuses/user_timeline/AlexGagnard.json?callback=?", function(data) { 
     $("#contenuTwitter").html(data[0].text); 
});

  carroussel.init($('#caroussel'));
  $('#'+currentIdOnglet).addClass('OngletActive'); 
  
  $('#OnglStage').click(function() { 
      if(currentIdExp != 'Stage' && isLibre == true)
      {
        isLibre = false;
        $('#'+currentIdExp).fadeOut('slow', function() {
        // Animation complete.
          $('#Stage').fadeIn('slow', function() {
            $('#'+currentIdOnglet).removeClass('OngletActive');
            currentIdExp =  'Stage';
            currentIdOnglet = "OnglStage";            
            $('#OnglStage').addClass('OngletActive');
            isLibre = true;
          });
        });
      }     
    });
  $('#OnglAuto').click(function() {
     if(currentIdExp != 'AutoEntrepreneur' && isLibre == true)
      {
        isLibre = false;
        $('#'+currentIdExp).fadeOut('slow', function() {      
          $('#AutoEntrepreneur').fadeIn('slow', function() {
            $('#'+currentIdOnglet).removeClass('OngletActive');
            currentIdExp =  'AutoEntrepreneur';
            currentIdOnglet = "OnglAuto";
            $('#OnglAuto').addClass('OngletActive');
            isLibre = true;
          });
        });
      }

  });
  $('#OnglSupinfo').click(function() {
    if(currentIdExp != 'Supinfo' && isLibre == true)
    {
      isLibre = false;
      $('#'+currentIdExp).fadeOut('slow', function() {
        $('#Supinfo').fadeIn('slow', function() {
          $('#'+currentIdOnglet).removeClass('OngletActive');
          currentIdExp =  'Supinfo';
          currentIdOnglet = "OnglSupinfo";
          $('#OnglSupinfo').addClass('OngletActive');
          isLibre = true;
        });
      });
    }

    });
  $('#OnglAutre').click(function() {
    if(currentIdExp != 'Autres' && isLibre == true)
    {
      isLibre = false;
      $('#'+currentIdExp).fadeOut('slow', function() {
        $('#Autres').fadeIn('slow', function() {
          $('#'+currentIdOnglet).removeClass('OngletActive');
          currentIdExp =  'Autres';
          currentIdOnglet = "OnglAutre";
          $('#OnglAutre').addClass('OngletActive');
          isLibre = true;
        });
      });
    }
  });
  
  test = false;
  $('.carreDescription').hover(
    function () {  // IN
      if (test == false)
      {
        test = true;
        $(this).find('.imgCache').fadeIn('slow');
        var idSansBlanc = $(this).attr('id');
        $('.contenuAllCarre').find('.carreDescription').each(function(){
          // Si l'id de l'élément courant != idSansBlanc, on affiche le carrée blanc.
          var thisIdEach = $(this).attr('id');
          if (thisIdEach != idSansBlanc)
          {
            $(this).find('.imgCacheBlanc').stop(true, true).fadeIn('slow');  
          }
        });
        test = false;
      }      
    }, 
    function () {  // OUT
      if(test == false)
      {
        test = true;
        $(this).find('.imgCache').fadeOut('slow');
        $('.contenuAllCarre').find('.carreDescription').each(function(){
          $(this).find('.imgCacheBlanc').stop(true, true).fadeOut('slow');
        });
        test = false;
      }
    }  
  );
  var idToShow = 0;
  $('.carreDescription').click(function(){
    idToShow = '#infos-' + $(this).attr('id');
    $('#fondNoirTransparent').fadeIn('fast');
    $(idToShow).fadeIn('slow', function(){
        $(idToShow).animate( { width:"450px" }, 300 )
                   .animate( { height:"215px" }, 500, function(){
                      $(idToShow).find('.descriptionInfosImg').fadeIn('slow');
                      $(idToShow).find('.descriptionInfosTitre').fadeIn('slow');
                      $(idToShow).find('.descriptionInfosTexte').fadeIn('slow');
                      $(idToShow).find('.descriptionInfosLien').fadeIn('slow');
                      $('#close').fadeIn('slow');            
                   });
    });
   }); 
  
  $('#close').hover(
    function () {  // IN
      $(this).find('.imgCache').stop().fadeIn('slow');
    },
    function () {  // IN
      $(this).find('.imgCache').stop().fadeOut('slow');
    }
  );
  
  $('#close').click(function(){    
    $(idToShow).fadeOut('slow');
    $('#close').fadeOut('slow');
    $(idToShow).css("width", "50px");
    $(idToShow).css("height", "50px");
    
    $(idToShow).find('.descriptionInfosImg').fadeOut('slow');
    $(idToShow).find('.descriptionInfosTitre').fadeOut('slow');
    $(idToShow).find('.descriptionInfosTexte').fadeOut('slow');
    $(idToShow).find('.descriptionInfosLien').fadeOut('slow');                                     
    $('#fondNoirTransparent').fadeOut('fast');
    
  });                  
             
});


            
  
