//général
function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	}
	else {
	 if (document.documentElement&&
	   document.documentElement.clientHeight) {
		 windowHeight = document.documentElement.clientHeight;
	}
	else {
	 if (document.body&&document.body.clientHeight) {
		 windowHeight=document.body.clientHeight;
	  }
	 }
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth)=='number') {
		windowWidth=window.innerWidth;
	}
	else {
	 if (document.documentElement&&
	   document.documentElement.clientWidth) {
		 windowWidth = document.documentElement.clientWidth;
	}
	else {
	 if (document.body&&document.body.clientWidth) {
		 windowWidth=document.body.clientWidth;
	  }
	 }
	}
	return windowWidth;
}

function showpopDesc(idpopdesc,e,sens,pop_w) {

	var posx = 0;
	var posy = 0;
	var h_nav = getWindowHeight();
	var w_nav = getWindowWidth();
	
	if (!pop_w) var pop_w = 300;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) {
		posx = e.clientX + document.documentElement.scrollLeft;
		posy = e.clientY + document.documentElement.scrollTop;
	}

	document.getElementById(idpopdesc).style.display='block';
	
	var w = document.getElementById(idpopdesc).offsetWidth;
	var testw = ((posx - w/2 - 5) > 0 && (posx + w/2 + 20) < w_nav);	// on peut le placer au centre
	var testw1 = ((posx - w - 5) < 0 && (posx + w + 20) < w_nav);	// il y a plutôt de la place à droite
	var testw2 = ((posx - w - 5) > 0 && (posx + w + 20) > w_nav);	// il y a plutôt de la place à gauche
	l = posx - (testw ? w/2 : (testw2 ? w : (testw1 ? 0 : w/2)));
	
	var h = document.getElementById(idpopdesc).offsetHeight;
	var testh = ((parseInt(posy) + parseInt(h) + 25) > parseInt(h_nav));
	t = parseInt(posy) + (testh ? (-1)*(parseInt(h) + 25) : 15)
	
	with (document.getElementById(idpopdesc).style) {
		left = l+"px";
		top = t+"px";
	}
}
	
function hidepopDesc(idpopdesc) {
	with (document.getElementById(idpopdesc).style) {
		display='none';
	}
}

