jQuery(document).ready( function () {
    
/*
    $('a').click(function(){
    	to_hide = $('#corps').children('.montrer');
		to_hide.addClass("cacher");
    	to_hide.removeClass("montrer");
    	
    	to_show = $('div[info='+ $(this).html() +']');
    	to_show.addClass("montrer");
    	to_show.removeClass("cacher");
    	
    })
*/
//	$("#breadCrumb").jBreadCrumb();

	// FIL D'ARIANNE
	print_breadcrumb ();
	
	// SURVOLE
	jQuery(".bandeau_menu").hover(
		function(){
			jQuery(this).children("a").css("color","#f88906");
		}, 
		function (){
			jQuery(this).children("a").css("color","black");
		}
	)
	
	jQuery("div[info='ACTUALITES']").hover(
		function(){
			jQuery(this).children("a").children("span").css("color","#f88906");
		}, 
		function (){
			jQuery(this).children("a").children("span").css("color","grey");
		}
	)
	
	jQuery(".mini_box_actu").hover(
		function(){
			jQuery(this).children("span").css("color","#f88906");
		}, 
		function (){
			jQuery(this).children("span").css("color","grey");
		}
	)
	
	// ACTU
	actu();
});

var tab_co = {
		"":"",
		"actualites":"actualit&eacute;",
		"entreprises":"entreprises & ce",
		"particuliers":"particuliers",
		"karts":"nos karts",
		"circuit":"section course",
		"galeries":"galeries",
		"contact":"contact",
		"boutique":"boutique",
		"actu_circuit":"actualit&eacute;s circuit",
		"calendrier":"calendrier 2010",
		"photos":"photos",
		"videos":"videos",
		"partenaires":"partenaires",
		"pilote":"notre pilote",
		"service":"service course",
		"confiance":"leurs confiances",
		"livreor":"livre d'or"
};

function print_breadcrumb () {
	var str = (window.location.pathname).split("/");
	var link = str[str.length-1];
	var sub_link = link.split(".");
	var href = "<a class='breadcrumb_a  breadcrumb_last' href='./"+ link +"'>";
	var barre = "";
	if ( link != "") {
		barre = " / ";
	}
	var pre_link = "";
	if ( (sub_link[0] == "calendrier") || (sub_link[0] == "actu_circuit") ) {
		pre_link = " / <a class='breadcrumb_a' href='./actualites.php'> actualit&eacute;s </a>";
	}
	if ( (sub_link[0] == "photos") || (sub_link[0] == "videos") ) {
		pre_link = " / <a class='breadcrumb_a' href='./galeries.php'> galeries </a>";
	}
	if ( (sub_link[0] == "pilote") || (sub_link[0] == "service") || (sub_link[0] == "confiance") ) {
		pre_link = " / <a class='breadcrumb_a' href='./circuit.php'> section course </a>";
	}
	jQuery('#breadcrumb').append( pre_link + barre + href + tab_co[sub_link[0]] + "</a>");
}

function actu(){
	jQuery(".clic_actu_left").click(
		function(){
			/*recuperer l'actu en cours d'affichage */
			actu_show = jQuery("#actu_right .show_actu");
			id_show = actu_show.attr('id');
			actu_show.removeClass("show_actu");
			actu_show.addClass("hide_actu");	
			/* faire apparaitre l'actu selectionner */
			name_id = jQuery(this).attr('id');
			id = get_id(name_id);
			new_show = jQuery("#actu_right_"+id);
			new_show.removeClass("hide_actu");
			new_show.addClass("show_actu");	
		}
	)
	jQuery(".clic_actu_left").hover(
		function(){
			jQuery(this).children("b").css("color","#f88906");
		}, 
		function (){
			jQuery(this).children("b").css("color","black");
		}
	)
}

function get_id (name){
	name_split = name.split("_");
	return name_split[2];
}



