document.write ( "<style>.menuskin{ position:absolute; width:200px; z-index:100; visibility:hidden; }</style>" );

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers

var posx;
var posy;

if (ns4 || ns6)
	{
		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove = coordonnee;
	}

function coordonnee(e)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	
function showmenu(titre,contenu)
	{
		if (!document.all&&!document.getElementById&&!document.layers) return

		menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
		menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
		
		var contenuHTML = '<table border=0 cellspacing=1 bgcolor=#FFFFFF cellpadding=0>' +
						'<tr>' +
						'<td bgcolor=#33CC66>' +
						'<table cellspacing=0 cellpadding=2 border=0 class="txtgras">' +
						'<tr>' +
						'<td width="20px"></td><td valign=middle>' + titre + '</td><td width="20px"></td>' +
						'</tr>' +
						'</table>' +
						'</td>' +
						'</tr>' +
						'<tr>' +
						'<td><table cellspacing=0 cellpadding=2 border=0 class="txtstd"><tr><td width="10px"></td><td height=30>&nbsp;' + contenu + '</td><td width="10px"></td></tr></table></td>' +
						'</tr>' +
						'</table>';
		
		if (ie4||ns6)
			menuobj.innerHTML=contenuHTML
		else
			{
				menuobj.document.write('<layer name=popmenu bgColor=#E6E6E6 width=200>'+contenuHTML+'</layer>')
				menuobj.document.close()
			}
		
		menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.popmenu.document.width
		menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.popmenu.document.height
		eventX= ( ie4? event.clientX : (ns6||ns4) ? posx : 0 ) + 10
		eventY= ( ie4? event.clientY : (ns6||ns4) ? posy : 0 ) + 10
		
		//Find out how close the mouse is to the corner of the window
		var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
		var bottomedge=ie4? document.body.clientHeight-eventY : ns6 ? document.body.clientHeight+window.pageYOffset-eventY : window.innerHeight-eventY
		
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		//move the horizontal position of the menu to the left by it's width
		if (rightedge<menuobj.contentwidth)
			{
				eventX -= 20;
				
				menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth;
			menuobj.innerHTML += ""}
		else
			{
				
				menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX;
				menuobj.innerHTML += ""
				}

		//same concept with the vertical position
		if (bottomedge<menuobj.contentheight)
			{
				eventY -= 20;
				
				menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? eventY-menuobj.contentheight : eventY-menuobj.contentheight;
				menuobj.innerHTML += ""
				}
		else
			{	
				
				menuobj.thestyle.top=ie4? document.body.scrollTop+eventY : ns6? eventY : eventY
				menuobj.innerHTML += ""
				}

			
		menuobj.thestyle.visibility="visible"
		return false
	}

function hidemenu()
	{
		if ( window.menuobj && (ie4||ns6||ns4) )
			menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
	}

if (ie4||ns6) document.onclick=hidemenu