$(document).ready( function()
{
	// -----------------------------------------------------------------------------------------
	// Effets sur les formulaires du site Internet
	// -----------------------------------------------------------------------------------------
	
	var backgroundColor_init = "#ffffff"; // Couleur de fond initiale des formulaires
	var borderColor_init = "#cccccc"; // Couleur de bordure initiale des formulaires
	
	var backgroundColor_modif = "#f3f5ff"; // Couleur de fond modifiée des formulaires
	var borderColor_modif = "#a5a5a5"; // Couleur de bordure modifiée des formulaires
		
		
	$("input, textarea").focus(function(){
		$(this).animate({ 
			backgroundColor: backgroundColor_modif,
			borderLeftColor: borderColor_modif,
			borderRightColor: borderColor_modif,
			borderTopColor: borderColor_modif,
			borderBottomColor: borderColor_modif
		  }, 250 );
	});
	 
	$("input, textarea").blur(function(){
		$(this).animate({ 
			backgroundColor: backgroundColor_init,
			borderLeftColor: borderColor_init,
			borderRightColor: borderColor_init,
			borderTopColor: borderColor_init,
			borderBottomColor: borderColor_init
		  }, 250 );
	});
	
	$(".submit").mouseover(function(){
		$(this).animate({ 
			backgroundColor: backgroundColor_modif,
			borderLeftColor: borderColor_modif,
			borderRightColor: borderColor_modif,
			borderTopColor: borderColor_modif,
			borderBottomColor: borderColor_modif
		  }, 250 );
	});
	 
	$(".submit").mouseout(function(){
		$(this).animate({ 
			backgroundColor: backgroundColor_init,
			borderLeftColor: borderColor_init,
			borderRightColor: borderColor_init,
			borderTopColor: borderColor_init,
			borderBottomColor: borderColor_init
		  }, 250 );
	});
	
	// -----------------------------------------------------------------------------------------
	// Scroll
	// -----------------------------------------------------------------------------------------
	
	// Permet de remonter en haut de la page :
	
	$("#haut_de_page a").click(function(){
		$("html, body").animate({ scrollTop: 0 }, "slow");
		return false;
	});
	
	// -----------------------------------------------------------------------------------------
	// Menu du haut
	// -----------------------------------------------------------------------------------------
		var timerMenuPresentation;
		var timerMenuPhoto;
		var timerMenuVideo;
		
		$("#mh_presentation a").mouseover(function(){
			if (timerMenuPresentation != null)
			{
				clearTimeout(timerMenuPresentation);
				timerMenuPresentation = null;
			}
			
			afficheMenuHaut('menu_presentation');
		});		
		$("#mh_photos a").mouseover(function(){
			if (timerMenuPhoto != null)
			{
				clearTimeout(timerMenuPhoto);
				timerMenuPhoto = null;
			}	
			
			afficheMenuHaut('menu_photos');
		});		
		$("#mh_videos a").mouseover(function(){
			if (timerMenuVideo != null)
			{
				clearTimeout(timerMenuVideo);
				timerMenuVideo = null;
			}	
			
			afficheMenuHaut('menu_videos');	
		});
		
		$("#mh_presentation a").mouseleave(function(){
			timerMenuPresentation = setTimeout("cacheMenuHaut('menu_presentation');",100);
		});		
		$("#mh_photos a").mouseleave(function(){
			timerMenuPhoto = setTimeout("cacheMenuHaut('menu_photos');",100);
		});		
		$("#mh_videos a").mouseleave(function(){
			timerMenuVideo = setTimeout("cacheMenuHaut('menu_videos');",100);
		});
		
		
		$("#menu_presentation").mouseover(function(){
			if (timerMenuPresentation != null)
			{
				clearTimeout(timerMenuPresentation);
				timerMenuPresentation = null;
			}
		});		
		$("#menu_photos").mouseover(function(){
			if (timerMenuPhoto != null)
			{
				clearTimeout(timerMenuPhoto);
				timerMenuPhoto = null;
			}
		});		
		$("#menu_videos").mouseover(function(){
			if (timerMenuVideo != null)
			{
				clearTimeout(timerMenuVideo);
				timerMenuVideo = null;
			}
		});
		$("#menu_presentation").mouseleave(function(){
			timerMenuPresentation = setTimeout(" cacheMenuHaut('menu_presentation');",100);
		});		
		$("#menu_photos").mouseleave(function(){
			timerMenuPhoto = setTimeout(" cacheMenuHaut('menu_photos');",100);
		});		
		$("#menu_videos").mouseleave(function(){
			timerMenuVideo = setTimeout(" cacheMenuHaut('menu_videos');",100);
		});
	
	// FIN Menu du haut
	// ---------------------------------------------------------------------------------------------------------------------------------------
	
	
	
	// -----------------------------------------------------------------------------------------
	// Diaporama de photos de la page d'accueil :
	// -----------------------------------------------------------------------------------------
	
		$("#conteneur_slider").mouseenter(function(){
			$("#statistiques_photos_accueil").slideDown("fast");
		});
		
		$("#conteneur_slider").mouseleave(function(){
			$("#statistiques_photos_accueil").slideUp("fast");
		});
		
		$("#statistiques_photos_accueil").animate({opacity: "0.6"}, "fast");
		
		$("#statistiques_photos_accueil").mouseenter(function() {
			$("#statistiques_photos_accueil").animate({
				opacity: "0.9",
				backgroundColor: "#1e7df1"
			}, "fast");
		});
		
		$("#statistiques_photos_accueil").mouseleave(function() {
			$("#statistiques_photos_accueil").animate({
				opacity: "0.6",
				backgroundColor: "#363636"
			}, "fast");
		});
	
	// FIN Diaporama de photos de la page d'accueil
	// ---------------------------------------------------------------------------------------------------------------------------------------
	
	
	
	
	// -----------------------------------------------------------------------------------------
	// Galerie de photos :
	// -----------------------------------------------------------------------------------------
	
	$("#description_photo_galerie").animate({opacity: "0.6"}, "fast");
	$("#titre_photo_galerie").animate({opacity: "0.9"}, "fast");
	
	// ---------------
	
	$("#conteneur_photo_cur img").mouseenter(function() {
		$("#description_photo_galerie").slideDown("fast");
		$("#titre_photo_galerie").slideDown("fast");
	});
	
	$("#conteneur_photo_cur").mouseleave(function() {
		$("#description_photo_galerie").slideUp("fast");
		$("#titre_photo_galerie").slideUp("fast");
	});
	
	// ---------------	
	
	$("#description_photo_galerie").mouseenter(function() {
		$("#description_photo_galerie").animate({
			opacity: "0.9",
			backgroundColor: "#fc8b2f"
		}, "fast");
	});
	
	$("#description_photo_galerie").mouseleave(function() {
		$("#description_photo_galerie").animate({
			opacity: "0.6",
			backgroundColor: "#363636"
		}, "fast");
	});
	
	// ---------------
	
	$("#conteneur_galerie_photo").mouseenter(function() {
		$("#photo_precedente").fadeIn("fast");
		$("#photo_suivante").fadeIn("fast");
		$("#zoom_photo").fadeIn("fast");
		$("#lien_photo").fadeIn("fast");
	});
	
	$("#conteneur_galerie_photo").mouseleave(function() {
		$("#photo_precedente").fadeOut("fast");
		$("#photo_suivante").fadeOut("fast");
		$("#zoom_photo").fadeOut("fast");
		$("#lien_photo").fadeOut("fast");
	});
	
	// FIN Galerie de photos
	// -----------------------------------------------------------------------------------------
	
	
	
	// -----------------------------------------------------------------------------------------
	// Apparition du formulaire de recherche :
	// -----------------------------------------------------------------------------------------
	
	$("#gauche").mouseenter(function(){
		$("#conteneur_zone_de_recherche").slideDown("fast");
	});
	
	$("#gauche").mouseleave(function(){
		$("#conteneur_zone_de_recherche").slideUp("fast");
	});
	
	// -----------------------------------------------------------------------------------------
	// Apparition des éléments "Lire la suite" et "Partager sur facebook" sur tous les .cadre
	// -----------------------------------------------------------------------------------------
	
	$(".cadre, .recherche_rapide_agenda").mouseenter(function(){
		var id_child=$(this).attr("id");
		$("#"+id_child+" .partager_facebook").show("fast");
		$("#"+id_child+" .lire_la_suite").show("fast");
	});
	
	$(".cadre, .recherche_rapide_agenda").mouseleave(function(){	
		var id_child=$(this).attr("id");
		$("#"+id_child+" .partager_facebook").hide("fast");
		$("#"+id_child+" .lire_la_suite").hide("fast");
	});
	
	// -----------------------------------------------------------------------------------------
	// Corners
	// -----------------------------------------------------------------------------------------
	
	// $(".tableau_de_bord, .pb_droit, .confirme, .erreur, .informations, .chargement, .ajoute, .mots_cles, .pager").corner("8px");
	
	$("#menu_1").corner("30px bottom");
	$("#menu_1").corner("5px top");
	$("#menu_1 li a").corner("3px");
	$("#menu_presentation, #menu_photos, #menu_videos").corner("8px bottom");
	
	// -----------------------------------------------------------------------------------------
	// Cycle
	// -----------------------------------------------------------------------------------------
	
	$(".img_sponsor").cycle({
		fx: 'scrollDown', 
		easing: 'bounceout', 
		delay: -2000,
		speed:1500
	});	
	
	$("#conteneur_sponsors_accueil").cycle({		
		/*fx:'zoom', 
		easing: 'bouncein', 
		delay:  -4000*/
	});
	
	// -----------------------------------------------------------------------------------------
	// Effet sur le menu de gauche
	// -----------------------------------------------------------------------------------------
	
	$("#menu_1 li a").mouseenter(function(){
	   $(this).animate({
		fontSize: "14px"
	  }, 80 );
	});
	
	$("#menu_1 li a").mouseleave(function(){
	   $(this).animate({
		fontSize: "12px"
	  }, 80 );
	});
	
	/*
	$("#milieu p a").hover(function(){
		$(this).fadeOut(50);
		$(this).fadeIn("fast");												   
	});*/

	// -----------------------------------------------------------------------------------------
	// LightBox
	// -----------------------------------------------------------------------------------------

	$("a.affichetoi").lightBox();
	
	// -----------------------------------------------------------------------------------------
	// Autres fonctions
	// -----------------------------------------------------------------------------------------
	
	// initialisation_de_la_taille_de_police();
});

/*
 * Fonction permettant d'afficher le menu situé en haut du site
 *
 */
function afficheMenuHaut(id)
{
	$("#"+id).show("drop",{ direction: "up" },250);
	$("#"+id).slideDown(250);
}

/*
 * Fonction permettant de cacher le menu situé en haut du site
 *
 */
function cacheMenuHaut(id)
{
	$("#"+id).hide("drop",{ direction: "up" },250);
	// $("#"+id).slideUp(250);
}

crazy_riders = new Image(); 
crazy_riders.src="templates/template1/images/crazy_riders_on.png"; 

radia_soudure = new Image(); 
radia_soudure.src="templates/template1/images/radia_soudure_on.png"; 
