$(function() {
	// Menu
	$('#menu ul a.normal').mouseover(function() {
		$(this).animate({
		    opacity: 0.70,
		    paddingLeft: '+=7'
			}, 100);
	});
	$('#menu ul a.normal').mouseout(function() {
		$(this).animate({
		    opacity: 1,
		    paddingLeft: '0'
			}, 80);
	});
});

// Fonction pour connaitre la taille de la fenetre
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

// Fonction pour la taille du menu
function setMenu() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		var contenutHeight = document.getElementById('contenu').offsetHeight;
		
		if (windowHeight > contenutHeight) {
			
			$('#menu').height(windowHeight);
			$('#contenu').height(windowHeight);
		}
		else {
			$('#menu').height(contenutHeight);
		}
		
	}
}
function setMenu2() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		var contenutHeight = document.getElementById('contenu').offsetHeight;
		
		
		if (windowHeight > contenutHeight) {
			
			
			$('#menu').height(windowHeight);
			//$('#contenu').height(windowHeight);
			//var menuHeight = document.getElementById('menu').offsetHeight;
			//$('#contenu').height(windowHeight);
		}
		else {
			$('#menu').height(contenutHeight);
			//$('#contenu').height(contenutHeight);

		}		
	}
	return contenutHeight;
}

function addEvent(obj, event, fct) {
    if (obj.attachEvent) //Est-ce IE ?
        obj.attachEvent("on" + event, fct); //Ne pas oublier le "on"
    else
        obj.addEventListener(event, fct, true);
}

addEvent(window , "load", setMenu); //On les lance toutes les deux au chargement de la page

addEvent(window , "resize", setMenu); //On les lance toutes les deux au resize de la page


// la fonction qui lance les autres
function lancer(fct) {
    addEvent(window, "load", fct);
}

//------------------------------------------------------------
// Fonction pour les témoignage
//------------------------------------------------------------
function showTemoignage(id)
{
	$('div.conteneur-temoignage').hide();
	$('div.tempoignage-'+id).fadeIn();
	
	// Cas témoignage 1
	if ( id == 1 )
	{
		$boutonNext = 2;
		$boutonPrev = 11;
		$('span.fleche').html('<a class="temoignage-next" onclick="showTemoignage('+$boutonNext+')"></a> <a class="temoignage-prev" onclick="showTemoignage('+$boutonPrev+')"></a>');
	}
	
	// Cas témoignage 11
	else if ( id == 11 )
	{
		$boutonNext = 1;
		$boutonPrev = 10;
		$('span.fleche').html('<a class="temoignage-next" onclick="showTemoignage('+$boutonNext+')"></a> <a class="temoignage-prev" onclick="showTemoignage('+$boutonPrev+')"></a>');
	}
	else
	{
		$boutonNext = (id + 1);
		$boutonPrev = (id - 1);
		$('span.fleche').html('<a class="temoignage-next" onclick="showTemoignage('+$boutonNext+')"></a> <a class="temoignage-prev" onclick="showTemoignage('+$boutonPrev+')"></a>');
	}
}

//-------------------------------------------------------------
// Fonction pour l'identification client
//-------------------------------------------------------------
function validFormClient()
{
	$('#bloc-acces input').addClass("wrong");
}
