document.write ( "<style>.menuskin{ position:relative; 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 drc(contenu,titre)
	{
		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=0 cellpadding=0 width=200 class=bodyline>' +
			'<tr>' +
			'<td width=198 colspan=2>' +
			'<table cellspacing=0 cellpadding=0 border=0>' +
			'<tr>' +
			'<td valign=middle class=row1>&nbsp;<img src="modules/evenements/images/puce.gif" width=13 height=13 align=bottom></td>' +
			'<td valign=middle width=100% class=row1>&nbsp;<span class=titre><b>' + titre + '</b></span></td>' +
			'</tr>' +
			'</table>' +
			'</td>' +
			'</tr>' +
			'<tr class=bodyline><td colspan=2 width=100% class=row2></td>' +
			'</tr>' +
			'<tr>' +
			'<td width=2 class=body></td><td height=30 valign=top>' + contenu + '</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 -= 200;
				
				menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth;
			menuobj.innerHTML += ""}
		else
			{
				eventX -= 200;
				
				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 -= 100;
				
				menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? eventY-menuobj.contentheight : eventY-menuobj.contentheight;
				menuobj.innerHTML += ""
				}
		else
			{
				eventY -= 100;	
				
				menuobj.thestyle.top=ie4? document.body.scrollTop+eventY : ns6? eventY : eventY
				menuobj.innerHTML += ""
				}

			
		menuobj.thestyle.visibility="visible"
		return false
	}

function nd()
	{
		if ( window.menuobj && (ie4||ns6||ns4) )
			menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
	}

if (ie4||ns6) document.onclick=nd
