// JavaScript Document

$(document).ready(function(){

// Menu de navigation
	$(".subMenu").hide();
	$(".menu-nav > li").hover(function(){
		$(this).children('a').addClass('active');
		$(this).children('ul').show();

	},function(){
		$(this).children('a').removeClass('active');
		$(this).children('ul').hide();
	});

// Affichage content
	$("#content").css("margin-top", "1px")

// Afficher bouton print
	$(".print a").show();
	$(".nojs").hide();
	
// Onglets
	$(".items li").hover(
		function(){
			$(this).addClass("active");
		},
		function(){
			$(this).removeClass("active");
		}
	);
	
	$(".list_publi").each(function() {
		$(this).children(".item").hide();
		$(this).children(".item:eq(0)").show();
	});

	$(".items li a").click(function(){
		$(this).parent().siblings(".on").removeClass('on');
		$(this).parent().addClass('on');
		$(this).parent().parent().next(".list_publi").children(".item").hide();
		$(this.hash).show();
		this.blur();
		return false;
	});

// Table hidden
	$(".table .hidden tbody").hide();
	
	$(".table .hidden th a").click(function(){
		if($(this).parent().parent().parent().next("tbody").is(":hidden")) {
			$(this).parent().parent().parent().next("tbody").show();
			this.blur();
			return false;
		} else {
			$(this).parent().parent().parent().next("tbody").hide();
			this.blur();
			return false;
		}
	});
	
// SelectBox
	$('#selectbox-sites').selectbox();
	
/*

<div class="block_specifique">
	<ul class="roll_over_h">
		<li>
			<a  

*/

// RollOver
	$(".roll_over_h li a, .roll_over_v li a").hover(
		function(){
			if($(this).children('img').attr("src").indexOf("_on") == -1) {
				var newSrc = $(this).children('img').attr("src").replace("_off.png","_on.png");
				$(this).children('img').attr("src",newSrc);
			}
		},
		function(){
			var newSrc = $(this).children('img').attr("src").replace("_on.png","_off.png");
			$(this).children('img').attr("src",newSrc);
		}
	);
	
});

function switchMenu(obj, lien){
	var el = document.getElementById(obj);
	if(el.style.display != "block"){
		el.style.display = "block";
		lien.className = "lien-chevron-ouvert";
	}
	else
	{
		el.style.display = "none";
		lien.className = "lien-chevron-ferme";
	}
}
/************** Fonction pour ouvrir un site de la liste du footer ****************/
function openSite() {
	var url =this.form.elements['listesite'].value;
	window.open(url);
}

function noaccent(string) {
	var input =  'ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËéèêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ°’\'",; ';
	var output = 'AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn_______';
	for ( i=0; i<output.length; i++ ) {
		var reg = new RegExp("("+input[i]+")", "g");
		string = string.replace(reg,output[i]);
	}
	return string;
}

