var browser = 0;
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var browserOS = 0;
var	XPos,YPos;
var Menu="";
var _XOff, _YOff;
var	MenuX1,MenuX2,MenuY1,MenuY2;

if ((browserName == "Netscape") && (browserVer >=2))
	browser = 1;
else if ((browserName == "Microsoft Internet Explorer") && (browserVer >=4)) {
	browser = 2;
	}

if (navigator.appVersion.indexOf("Win",0) > 0)
	browserOS = 1;
else if (navigator.appVersion.indexOf("Mac",0) > 0)
	browserOS = 2;


var XPos, YPos;
var timer = "";

function initHandleMouseMove() {
	if (browser != 1)
		return;
	
	window.captureEvents(Event.MOUSEMOVE);
	window.onMouseMove = handleMouseMove;
}

function handleMouseMove(evt) {
	var layer_document = window.top;
	var coordX;
	var coordZ;
	var coordT;
	
	// window.top.defaultStatus = layer_document.length;

	if ( layer_document.length != 0) {
		layer_document = layer_document.droite;
	}
	
	if (browser == 1) {
		XPos = evt.pageX;
		YPos = evt.pageY;
	}
	else if (browser == 2) {
		XPos = self.event.clientX;
		YPos = self.event.clientY;
	}
	
	return(true);
}

function getX(obj)
{
 return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}
function getW(obj)
{
	var w=0
	if (obj.parentElement==null)
		w = 0;
	else {
		while (obj) {
			if (obj.tagName == "DIV")
				w = parseInt(obj.offsetWidth)-30;
			obj = obj.parentElement;
		}
	}
	return w;
}

function getH(obj)
{
 return( obj.offsetParent==null ? obj.offsetHeight : obj.offsetHeight );
}

function getY(obj)
{
 return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}

function showMenu(mtitle,menu,niv) {

	var x = 1;
	var y = 0;
	
	if (browser == 1) {
		x += document.images[mtitle].x;
		y = y + document.images[mtitle].y + document.images[mtitle].height;
		document.layers[menu].moveTo(x,y);
		document.layers[menu].visibility = 'visible';

		Menu = menu;
		
		for(var i=1;i<5;i++){
			if (Menu != ch[i])
				effcalq(ch[i]);
		}
		
	}
	else if (browser == 2) {
		if (document.all[menu]){
			var obj = document.images[mtitle];
			x = getX(obj);
			if (niv==1)
				y = getY(obj)+ getH(obj);
			else
				y = getY(obj);
			x = x + getW(obj);
			document.all[menu].style.left = x;
			document.all[menu].style.top = y;
			document.all[menu].style.visibility = 'visible';
		
			Menu = menu;
		}
		hideExceptMenu(menu,niv);
	}
}


function hideExceptMenu(menu,niv){
	var i=0;
	var collectionDiv=document.all.tags('DIV');
	while (i<collectionDiv.length){
		if (collectionDiv[i].id!=menu){
			if (collectionDiv[i].style.zIndex==(niv+1)){
				collectionDiv[i].style.visibility = 'hidden';
			}
		}
		i++;
	}
}

function hideMenu(){
    timer = setTimeout('hide()',100);
}
   
function hide(){
	var i=0;
	var collectionDiv=document.all.tags('DIV');
	while (i<collectionDiv.length){
		collectionDiv[i].style.visibility = 'hidden';
		i++;
	}
}
function stopTimer(){
   clearTimeout(timer);
}