// Fonctions de la HP
// Sitex
// Hervé FRACKOWIAK
// 02/12/2009


//No Conflict - Afin d'utiliser le $j
var $j = jQuery.noConflict();


//Variable Globale
var timerNav = 0;
var timerBg = 0;
var pointeurBg = 0;


//Au chargement de la page
$j(document).ready(function(){

  //Zone Recrutement
  $j("#recrutement").hover(
    function(){
      $j(".infos",this).animate({"height":"161px"},"normal");
    },
    function(){
      $j(".infos",this).animate({"height":"31px"},"normal");
    }
  );
  
  /* Zone Defilement */
  $j("#menu .defilement .contenu .scroll").width(($j("#menu .defilement .contenu .scroll .realisation.active").length*91)-1);
  $j("#menu .defilement .contenu .scroll .realisation.active:last").css("marginRight","0px");
  
  //Navigation Gauche
  $j("#menu .defilement .navG").hover(
    function(){
      timerNav = setInterval("goGauche()",10);
    },
    function(){
      clearInterval(timerNav);
    }
  );
  
  //Navigation Droite
  $j("#menu .defilement .navD").hover(
    function(){
      timerNav = setInterval("goDroite()",10);
    },
    function(){
      clearInterval(timerNav);
    }
  );
  
  //Hover sur les realisations
  $j("#menu .defilement .contenu .realisation").hover(
    function(){
      $j(".img",this).hide();
      $j(".txt",this).show();
    },
    function(){
      $j(".img",this).show();
      $j(".txt",this).hide();
    }
  );
  
  //Changement du fond de la HP
  //goBg();
  
  /* /Zone Defilement */
});


function goBg() {

	//$j("#background img:first").slideUp(980);

	/*clearInterval(timerBg);
	$j("#background img").fadeTo(2000,0.2, 
		function(){
			$j(this).attr('src', imagesBg[pointeurBg]);
			
			$j(this).fadeTo(2000,1, function(){
				//alert(pointeurBg);
				timerBg = setInterval("goBg()",5000);
			});
			
			if (pointeurBg == (imagesBg.length-1)) 
				pointeurBg = 0;
			else
				pointeurBg++;
		}
	);*/
}

//Allez ŕ gauche
function goGauche()
{
  $j("#menu .defilement .contenu").scrollLeft($j("#menu .defilement .contenu").scrollLeft()-2);
}

//Allez ŕ droite
function goDroite()
{
  $j("#menu .defilement .contenu").scrollLeft($j("#menu .defilement .contenu").scrollLeft()+2);
}