/* */
/* Used to avoid the message on the browser top with IE (block information about the user connected to Communicator, ...  */
/* */
function ProcessImn() {
}

function ProcessImnMarkers() {
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function StopFlashMovie(movieName) {
	var flashMovie=getFlashMovieObject(movieName);
	if(flashMovie) flashMovie.StopPlay();
}

function PlayFlashMovie(movieName) {
	var flashMovie=getFlashMovieObject(movieName);
	if(flashMovie) flashMovie.Play();
}

function mycarousel_initCallback(carousel)
{
  carousel.clip.hover(function() {
          carousel.stopAuto();
  }, function() {
          carousel.startAuto();
  });
};

function increaseFont() {
  $('html').css('font-size', 19);
  $.cookie('fontSize', 19, { expires: 7, path: '/' });
  $('.increaseFont').attr('style', 'cursor:not-allowed');
  $('.increaseFont').attr('title', '');
  $('.decreaseFont').attr('style', 'cursor:pointer');
  $('.decreaseFont').attr('title', $('.decreaseFont').attr('alt'));
}

function decreaseFont() {
  $('html').css('font-size', 16);
  $.cookie('fontSize', null, { path: '/' });
  $('.decreaseFont').attr('style', 'cursor:not-allowed');
  $('.decreaseFont').attr('title', '');
  $('.increaseFont').attr('style', 'cursor:pointer');
  $('.increaseFont').attr('title', $('.increaseFont').attr('alt'));
}

$(document).ready(function() {
  if ($.cookie('fontSize')) {
    increaseFont();
  } else {
    decreaseFont();
  }
  $(".decreaseFont").click(function() {
    decreaseFont();
  });
  $(".increaseFont").click(function() {
    increaseFont();
  });

  $("table.TopNavBar td:first img").hide();

  $(".slider").jCarouselLite({
    btnNext: ".next",
    btnPrev: ".prev",
    auto: 10000,
    speed: 1000
  });

  $(document).pngFix();
  
  $("#SearchText").focus(function() {
    if ($(this).val() == "Search") $(this).val("");
    if ($(this).val() == "Rechercher") $(this).val("");
  });
  $("#searchShowIntro").click(function() { $(".res_content").show(); });
  $("#searchHideIntro").click(function() { $(".res_content").hide(); });
  $(".hideLayer").click(function() {
    $("#layer").hide();
    PlayFlashMovie("flashhome");
    //$.cookie('layer', true, { expires: 300 });
  });
  if (!$.cookie('layer')) {
    $("#layer").css('display', 'block');
    StopFlashMovie("flashhome");
  } else {
    PlayFlashMovie("flashhome");
  }
});

function clickOnItem(indexItem) { 
	var url = trim(indexItem);	
	window.location.href=indexItem;  
}

// Supprime les espaces inutiles en début et fin de la chaîne passée en paramètre.
var regExpBeginning = /^\s+/;
var regExpEnd = /\s+$/; 
function trim(aString) {
    return aString.replace(regExpBeginning, "").replace(regExpEnd, "");
}
