/*********

DEFINITION DES VAIABLES DE BASE

*****************/




dom = document.getElementById;

id_time = "";



        

/********

AFFICHAGE DES SOUS MENUS

********/



// Menu du haut

function SousMenu (menu, msg, pos, ouvre_div, ferme_div)

{

	if(dom)

	{
		killFenetre();
		clearTimeout(id_time);
		
		
		var d = document.getElementById(msg);
		if (d) {
			hauteur = document.getElementById(menu).clientHeight*(-1);
			hauteur += "px";			
			d.style.marginTop = hauteur;
			d.style.display='block';
			d.style.zIndex=200;

		}


		
	}

}


/***************************************
Fonction de recherche de position
****************************************/

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}



/********
INVISIBILITE DES SOUS MENUS
********/

function killFenetre()
{
	if(dom)
	{
		for (var i = 1; i<=nb_elts_tab; i++) {
			if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
		}
	}
}

/********
Enregistrement du time_out pour cacher les sous-menus
********/
function enr_timeout(num)
{
	id_time = setTimeout("killFenetre()",500);
}

document.onclick = killFenetre;


/*********************************************************
Elements illicopage ajoutes pas SE
**********************************************************/
function winOpen(url, largeur, hauteur){
      gauche = (screen.width/2)-(largeur/2);
      haut = (screen.height/2)-(hauteur/2);
      window.open(url,"popup","height="+hauteur+",width="+largeur+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = yes,fullscreen = no,top ="+haut+",left ="+gauche);
   }

function ChangeMessage(message,champ)
{
	var msg2 = message.replace(/\&gt\;/gi, ">");
	msg2 = msg2.replace(/\&lt\;/gi, "<");

  if(document.getElementById)
    document.getElementById(champ).innerHTML = msg2;
}
