// JavaScript Document

var div_niv3 = false;

/*function partenaire(){
	jq('#partenaire').jcarousel({
		scroll: 1,
		visible: 1,
		auto: 3,
		wrap: "circular",
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	
}

function publication(){
	jq('#publication').jcarousel({
		vertical: true,
		scroll: 1,
		auto: 4,
		wrap: "circular",
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
			
}*/

function RollOverSSMenu(IdObj,IdRub) 
{ 
	document.getElementById(IdObj).style.display='block';
	document.getElementById(IdObj).style.color='#351601';
	document.getElementById(IdObj).style.left = parseInt(jq("#"+IdRub).position().left) +  'px';
	
}

function RollOutSSMenu(IdObj)
{ 
	document.getElementById(IdObj).style.display='none';
}

function RollOverSS2Menu(IdObj,IdRub,IdRub1) 
{ 
	document.getElementById(IdObj).style.display='block';
	document.getElementById(IdObj).style.color='#351601';
	document.getElementById(IdObj).style.left = parseInt(jq("#"+IdRub).width()) + 'px';
	document.getElementById(IdObj).style.top = (18 * IdRub1) +'px';
}

function RollOutSS2Menu(IdObj) 
{ 
	document.getElementById(IdObj).style.display='none';
}

function set_div_niv3(action)
{
	if (parseInt(action) == 1)
		div_niv3 = true;
	else
		div_niv3 = false;
}

function topOfFooter() // v1.1
{
	var topEsp3 = document.getElementById("CONTENU").offsetTop;
	var heightEsp3 = document.getElementById("CONTENU").offsetHeight;
	//alert(heightEsp3);
	//alert(topEsp3);

	document.getElementById("FOOTER").style.top = ((heightEsp3 * 1) - 42 * 1) + "px";
	document.getElementById("FOOTER").style.visibility = 'visible';
}

function moveFooter() // v1.0
{
	topOfFooter();
	window.setTimeout("moveFooter();",10);
}

function esp3Resize() // v1.0
{
	var wind_y;
	if (document.documentElement != null)
		wind_y =  document.documentElement.clientHeight;
	wind_y = wind_y - 203;
	var heightEsp3 = document.getElementById("ESP3").offsetHeight;
	if (document.getElementById("ESP2") != null)
		var heightEsp2 = document.getElementById("ESP2").offsetHeight;
	var heightFooter = document.getElementById("FOOTER").offsetHeight;
	if (document.getElementById("ENCART1") != null)
		var heightEncart = document.getElementById("ENCART1").offsetHeight;
	else
		var heightEncart = 0;
	if (document.getElementById("fil_ariane_actu") != null)
		var heightAriane = document.getElementById("fil_ariane_actu").offsetHeight;
	else
		var heightAriane = 0;
	if ( jq('.actu_encart') != null )
		var heightActuEncart = jq(".actu_encart").height();
	else
		var heightActuEncart = 0;
	if (heightActuEncart > heightEncart)
		var encart = heightActuEncart + heightAriane;
	else
		var encart = heightEncart + heightAriane;
	if (encart > heightEsp2)
		encart = encart;
	else
		encart = heightEsp2;
	//alert(wind_y);
	//alert(heightEsp3+heightFooter+heightAriane);
	//alert(jq("#ESP3").outerHeight());
	//alert(heightEsp2);
	//alert(heightEncart);
	//alert(heightFooter);
	//alert(heightActuEncart);
	//alert(heightAriane);
	//alert(encart);
	if ((heightEsp3/*+heightFooter*/+heightAriane) > (encart+10))
	{
		//alert("1");
		if (wind_y > (heightEsp3+heightFooter+heightAriane))
		{
			//alert("11");
			document.getElementById("CONTENU").style.height = ""+wind_y+"px";
		}
		else
		{
			//alert("12");
			document.getElementById("CONTENU").style.height = ""+parseInt(heightEsp3 + heightFooter + heightAriane + 5)+"px";
		}
	}
	else
	{
		//alert("2");
		if (wind_y > (encart+heightFooter))
		{
			//alert("21");
			document.getElementById("CONTENU").style.height = ""+wind_y+"px";
		}
		else
		{
			//alert("22");
			document.getElementById("CONTENU").style.height = ""+parseInt(encart + heightFooter + 10)+"px";
		}
	}
	var heightBody = parseInt(jq('#Menu').height()) + parseInt(jq('#BANDEAU').height()) + parseInt(jq('#CONTENU').height()) + parseInt(jq('#FOOTER').height());
	var heightDocument = parseInt(jq(window).height());
	if (heightDocument < heightBody)
		jq('#background').height((heightBody+5));
	else
		jq('#background').height((heightDocument));
	/*alert(heightBody);
	alert(heightDocument);*/
}

// fonction appeler à l'ouverture de la page
function mainForPageLoad() // v1.0
{
	esp3Resize();	
	topOfFooter();
}
