// JavaScript Document;

$lang = 'fr';
language();

//-----------------------------------------fonction-----------------------------------------

function cadre_hover(value)
{
	document.getElementById(value).style.color = '#16371b';

}
function cadre_hover_out(value)
{
	document.getElementById(value).style.color = '#bed6a6';
}

var xhr = null; 
function getXhr()
{
	if(window.XMLHttpRequest)xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject)
	{ 
		try
		{
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) 
		{
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else 
	{
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr = false; 
	} 
}
 
function ShowPage(page)
{
	getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
			document.getElementById('contenu').innerHTML=xhr.responseText;
			language();
		}
	}
	xhr.open("GET","ajax.php?page="+page,true);
	xhr.send(null);
}

function disp_menu(value)
{
	document.getElementById(value).style.backgroundColor = '#FFF';
	document.getElementById(value).style.color = '#2f7b28';
}
function disp_menu_none(value)
{
	document.getElementById(value).style.backgroundColor = 'transparent';
	document.getElementById(value).style.color = '#FFF';
}

sfHover = function() 
{
	var sfEls = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) 
	{
		sfEls[i].onmouseover=function() 
		{
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() 
		{
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function a_menu()
{
	$('#menu_g')
	.animate({
		paddingTop : '100px'
	},'slow');
	
	$('#bande_h')
	.animate({
		opacity : '1'
	},'slow');
	
	$('#contenu')
	.animate({
		opacity : '1'
	},'slow');
	
	$('#contenu2')
	.animate({
		opacity : '0.85'
	},'slow');
	
	$('#bande_b')
	.animate({
		opacity : '1',
		bottom : '50px'
	},'slow');
	
	$('#menu li ul li').css('opacity','1');
	
	$('#retour a').css('opacity','1');
	
	$("#menu li ul li").hover(function() {
		$(this).css('opacity','1');
	}, function(){
		$(this).css('opacity','1');
	});
}

function h_menu()
{
	$('#menu_g')
	.animate({
		paddingTop : '37%'
	},'slow');
	
	$('#bande_h')
	.animate({
		opacity : '0'
	},'slow');
	
	$('#contenu')
	.animate({
		opacity : '0'
	},'slow');
	
	$('#contenu2')
	.animate({
		opacity : '0'
	},'slow');
	
	$('#retour a')
	.animate({
		opacity : '0'
	},'slow');
	
	$('#bande_b')
	.animate({
		opacity : '0',
		bottom : '-30px'
	},'slow');
	
	$('#menu li ul li').css('opacity','0.5');
	
	$("#menu li ul li").hover(function() {
		$(this).css('opacity','1');
	}, function(){
		$(this).css('opacity','0.5');
	});
}

function fiche_agr(value,pixel,plus)
{
	if( $(value).css('height') != '55px')
	{	
		$(value)
		.animate({
			height : '55px'
		},'slow');
		
		$(plus).css('marginTop','-4px');
		$(plus).css('marginLeft','1px');
		$(plus).text('+');
	}
	else
	{	
		$(value)
		.animate({
			height : pixel
		},'slow');
	
		$(plus).css('marginTop','-4px');
		$(plus).css('marginLeft','2px');
		$(plus).text('-');
	}
}

function english()
{
	$lang = 'en';
	language();
}
function french()
{
	$lang = 'fr';
	language();
}

function language()
{
	if($lang == 'en')
	{
		$('.lang_fr').css('display','none');
		$('.lang_en').css('display','block');
	}
	if($lang == 'fr')
	{
		$('.lang_en').css('display','none');
		$('.lang_fr').css('display','block');
	}
}
