//FICHIER JS POUR SKIN ROAD2LUXE
var obj = null;

$(document).ready(function() {
  $("#page-generale").css("min-height",jQuery(window).height());
  //Menu
  $('#nav li.menu a').each(function(index) {
	  if($(this).parent().hasClass('menu')) {
		  var largeur = $(this)[0].offsetWidth + 30;
		  var hauteur = $(this).parent()[0].offsetHeight;
		  if($(this).hasClass('mainMenuParentBtn')) {
			  var position = (largeur - 10)+'px 50%';
			  $(this).css('background-position',position);
			  largeur += 10;
		  }
		  $(this).parent()[0].style.width = largeur+'px';
		  $(this).parent().parent()[0].style.height = hauteur+'px';
	  }
	  
  });
  $('#nav li').hover(function() {
	  if(obj) {
		  obj.find('ul').fadeOut('fast');
		  obj = null;
	  }
	  $(this).find('ul').fadeIn('fast');
  }, function() {
	  obj = $(this);
	  setTimeout("checkHover()",400);
  });
  //SlideShow Accueil
  $('#slides').slides({
    preload: true,
    preloadImage: './libs/slidesJquery/source/img/loading.gif',
    play: 5000,
    pause: 2500,
    hoverPause: true
  });
  //Infos bulles
  $(".pictos li").tipsy({
    gravity: 's',
    opacity: 1
  });
  //Carousel sur page Détail circuit
  $('#newsCarousel').jcarousel({
    wrap: 'circular',
    auto: 4,
    scroll: 1
  });
});

function checkHover() {
	if(obj) { obj.find('ul').fadeOut('fast'); }
}
