// JavaScript Document

jQuery.fn.shake = function(intShakes,intDistance,intDuration) {
  this.each(function() {
	var jqNode = $(this);
	  jqNode.css({position: 'relative'});
		  for (var x=1; x<=intShakes; x++) {
			jqNode.animate({ left: (intDistance * -1) },(((intDuration / intShakes) / 4)))
			.animate({ left: intDistance },((intDuration/intShakes)/2))
			.animate({ left: 0 },(((intDuration/intShakes)/4)));
	         }
  });
  return this;
}


jQuery.fn.flashimg = function(thespeed,theopacity) {
  this.each(function() {
    var jqItem = $(this);

	   function hideDiv(){
				jqItem.animate({ 
						opacity: theopacity
					  }, thespeed, function(){ showDiv(); });
	  
		   }
	   function showDiv(){
				jqItem.animate({ 
						opacity: "1"
					  }, thespeed, function(){ hideDiv(); });
		   }
			
	 hideDiv();
		  
   });
  
 return this;
}


 $(document).ready(function() {
							
       //$("#wrapper").dropShadow();
			 
			 
	   $("a[@href*=#]").click(function(){
				 alert('Bientot!');
				 return false;
		 })
	   
	  //  $('#body2655 #content ul').toggleElements(); 
	  
				  $('#body2655 #content div.faq').makeFAQ({
					  indexTitle: "My Index",
					  displayIndex: false,
					  faqHeader: "h3"
				  });
			 
			  moveUp();
			  
			 // $("img#rabais").flashimg(500,0.5);
			  $("img#rabais").rotateimage(1000,2000);
			  
	          $('#imgwrapper a').lightBox();
			  
/*			 $('#wrapper').append("<div id='animation'><ul></ul></div>");  
			 $('#animation ul').append("<li><img title='L'astuce vous attend' src='images/1.jpg'></li>"); 
			 $('#animation ul').append("<li><img title='L'astuce vous attend' src='images/2.jpg'></li>"); 
			 $('#animation ul').append("<li><img title='L'astuce vous attend' src='images/3.jpg'></li>"); 
			 $('#animation ul').append("<li><img title='L'astuce vous attend' src='images/3.jpg'></li>"); 

			 $('#animation ul').innerfade({
				  speed: 500,
				  timeout: 3000,
				  containerheight: '469px'
			  });
			 
			 
			   setTimeout("hideAnimation();", 9000);*/

			  $('#imgwrapper').cycle({ 
				  fx: 'scrollLeft'
			  });

//			  $('#imgwrapper').cycle({ 
//				  fx: 'custom', 
//				  cssBefore: {  
//					  top:  0, 
//					  left: 0, 
//					  width: 0, 
//					  height: 0,  
//					  zIndex: 1  
//				  }, 
//				  animIn:  {  
//					  width: 265, 
//					  height: 298  
//				  }, 
//				  animOut: {  
//					  top:  200, 
//					  left: 200, 
//					  width: 0, 
//					  height: 0 
//				  }, 
//				  cssAfter: {  
//					  zIndex: 0  
//				  }, 
//				  delay: -1000 
//			  });

})
 
 function hideAnimation(){ 
  document.location.href = './Accueil_P2654.html'
	  // $("#animation").hide("slow",function(){
	  //   $("#content").show("slow");
	  // });
   }
   
   
 function moveUp(){
		  $("#header img").animate({ 
				  marginLeft: "-10px",
				  marginTop: "-10px"
				}, 800, function(){ moveDown(); });

}
 function moveDown(){
		  $("#header img").animate({ 
				  marginLeft: "10px",
				  marginTop: "10px"
				}, 800, function(){ moveUp(); });
}

		jQuery.preloadImages = function()
		{
		  for(var i = 0; i<arguments.length; i++)
		  {
			jQuery("<img>").attr("src", arguments[i]);
		  }
		}
		
		$.preloadImages(
		"images/1.jpg",
		"images/2.jpg",
		"images/3.jpg",
		"images/l-astuce.png",
		"images/menudroite.png",
		"images/menugauche.png",
		"images/reservation.png",
		"images/fleche.png", 
		"images/bg.jpg"
		);	 

						   
