// JavaScript Document

var div_niv3 = false;

function RollOverSSMenu(IdObj,IdRub) 
{ 
	document.getElementById(IdObj).style.display='block';
	document.getElementById(IdObj).style.left=document.getElementById(IdRub).offsetLeft;
}

function RollOutSSMenu(IdObj,IdRub)
{ 
	document.getElementById(IdObj).style.display='none';
}

function RollOverSSMenu_niv3(IdObj,IdRub,IdRub1) 
{ 
	document.getElementById(IdObj).style.display='block';
	document.getElementById(IdObj).style.left = parseInt(jq("#"+IdRub1).width()) + 'px';
	document.getElementById(IdObj).style.top = '0px';
}

function RollOutSSMenu_niv3(IdObj,IdRub) 
{ 
	setTimeout(function(){
		if (div_niv3 == false) document.getElementById(IdObj).style.display='none';
	},50);
}

function set_div_niv3(action)
{
	if (parseInt(action) == 1)
		div_niv3 = true;
	else
		div_niv3 = false;
}

function topOfFooter(ecran_sup) // v1.1
{	
	var heightContenu = parseInt(jq('#ESP3').height());
	var heightFooter = parseInt(jq('#FOOTER').height());
	var topContenu = parseInt(jq('#ESP3').position().top);
	if (parseInt(ecran_sup) == 1)
		jq('#FOOTER').css('top',(heightContenu+topContenu+heightFooter-5)+'px');
	else
		jq('#FOOTER').css('top',(heightContenu+topContenu+heightFooter+35)+'px');
	jq('#FOOTER').css('visibility','visible');
}

function moveFooter() // v1.0
{
	topOfFooter();
	window.setTimeout("moveFooter();",10);
}

function esp3Resize() // v1.0
{
	var wind_y = (jq(window).height()-20);
	if (parseInt(jq("#CONTENU_FILLE").height())>parseInt(jq("#ESP3").height()))
		jq("#ESP3").height(jq("#CONTENU_FILLE").height());
	var heightEsp3 = parseInt(jq("#ESP3").height());
	var heightFooter = parseInt(jq("#FOOTER").height());
	var topContenu = parseInt(jq('#ESP3').position().top);
	var heigthBase = parseInt(jq("#ESP3").height())+20;
	
	var heightElements = parseInt(heigthBase) + parseInt(topContenu) + parseInt(heightFooter)+30;
	ecran_sup = 0;
	if (wind_y > heightElements){
		jq('#ESP3').height((wind_y-topContenu-heightFooter-10));
		ecran_sup = 1;
	}
	else{
		jq('#ESP3').height((heigthBase+20));
		ecran_sup = 0;
	}
	return ecran_sup;
}

// fonction appeler à l'ouverture de la page
function mainForPageLoad() // v1.0
{
	var ecran_sup = esp3Resize();	
	topOfFooter(ecran_sup);
}
