var index_anecdote = 1;
function record_slider(ind)
{
	    $.ajax({
            type: "GET",
            url: "../ajax/record_slide.php",
            data: "ind=" + ind ,
            success: function(html)
            {
					
	},
            dataType: "html"
             });
}
function show_anec(direction, max)
{
	$(".titre_anecdote").hide();
	$(".content_anecdote").hide();
	if (direction == "next")
	{
		if (index_anecdote < max)
			index_anecdote++;
		else
			index_anecdote = 1;
	}
	else if (direction == "prec")
	{
		if (index_anecdote > 1)
			index_anecdote--;
		else
			index_anecdote = max;
	}
	
    if (direction == "next" || direction == "prec")
    {
		$("#titre_anecdote_" + index_anecdote).show();
		$("#contenu_anecdote_" + index_anecdote).show();
	}
	else
	{
		$(".titre_anecdote").show();
		$(".content_anecdote").show();
	}
}
function show_contenu(index)
{
	$(".content_visits").hide();
	$("#contenu_visites_" + index).show(); 
	if (index != "3")
		 $("#show_map").hide();
	else
		 $("#show_map").show();
}
function set_language(lang)
{
	if (lang == 'fr') 
	{
		$('#lang_fr').attr('checked','checked');
		$('#lang_es').attr('checked','');
		$('#lang_uk').attr('checked','');
		$('#lang').val('fr');
	}
	else if (lang  == 'es')
	{
		$('#lang_es').attr('checked','checked');
		$('#lang_fr').attr('checked','');
		$('#lang_uk').attr('checked','');
		$('#lang').val('es');
	}
	else if (lang == "uk") 
	{
		$('#lang_uk').attr('checked','checked');
		$('#lang_fr').attr('checked','');
		$('#lang_es').attr('checked','');
		$('#lang').val('uk');
	}
	$('#choix_pays').submit();
}
function open_chapter(the_div)
{
	if (the_div == 'trad')
	{
		$('#chapitre_list').hide();
		$('#chapitre_shot').hide();
		$('#chapitre_' + the_div).show();
	}
	else if (the_div == 'shot')
	{
		$('#chapitre_trad').hide();
		$('#chapitre_list').hide();
		$('#chapitre_' + the_div).show();
	}
	else if (the_div == 'list')
	{
		$('#chapitre_trad').hide();
		$('#chapitre_shot').hide();
		$('#chapitre_' + the_div).show();
	}

	
}
function goToNext()
{
    var next_link = $("#accueil_links a.viewed").next("a").eq(0);
    if(!$(next_link).attr("id"))
    { // Si on ne trouve pas de prochain item, on revient au premier
        var next_link = $("#accueil_links a").eq(0);
    }
    setThematiqueDisplayed($(next_link).attr("id"));
}
function submit_recherches()
{
	
	$("#form_recherches").submit();
}
function print_fiche()
{
	$("#conteneur_page").jqprint({debug:true}); 
}
// Exécution globale
$(document).ready(function(){



    $("#top_menu a:not(.visited)").hover(
        function(){
            $(this).animate({borderTopWidth:"30px"},400);
        },
        function(){
            $(this).animate({borderTopWidth:"4px"},400);
        }
    );


    // Menu de l'accueil
    $('#accueil_content h1 a').css('opacity', 1.0)
              .hover(function(){ $(this).animate({opacity: 0.75},200);},
                     function(){$(this).animate({opacity: 1.0},200);});

});



