function initActions()
{
	var areas = cssQuery('map > area');
	for (var i = 0 ; i < areas.length ; i++)  {
		areas[i].onmouseout = function()  {
			var limplantation = findCoordonnees(this);
			hideCoordonnees(limplantation);
			return false;
		};
	};
	for (var i = 0 ; i < areas.length ; i++)  {
		areas[i].onmouseover = function()  {
			var limplantation = findCoordonnees(this);
			showCoordonnees(limplantation,this);
			return false;
		};
	};
};
function findCoordonnees(implantation) {
	return  implantation.href.split("#")[1];
};
function hideAll(elements) {
	for (var i = 0 ; i < elements.length ; i++)  {
		elements[i].style.display="none";
	};
	return; 		
};
function hideCoordonnees(idImplantation) {
	var object = document.getElementById(idImplantation);
	//changeOpacity(idImplantation,90,0,500);
	object.style.display="none";
	return; 		
};
function showCoordonnees(idImplantation,area) {
	var object = document.getElementById(idImplantation);
	var offset = 10;
	var xy=area.coords.split(",");
	var x = parseInt(xy[0]);
	var y = parseInt(xy[1]);
	if (x > 163) {
		var xright = 326-x+offset;
		object.style.right=xright+"px";
	}
	else {
		var xleft = x+offset;
		object.style.left=xleft+"px";
	}
	if (y > 157) {
		var ybottom = 334-y+offset;
		object.style.bottom=ybottom+"px";
	}
	else {
		var ytop = y+offset;
		object.style.top=ytop+"px";
	}
	setOpacity(0,idImplantation);
	object.style.display="block";
	changeOpacity(idImplantation,0,90,600);
	return; 		
};

function setOpacity(value,id)
{
var object = document.getElementById(id);
	object.style.opacity = value/100;
	object.style.filter = 'alpha(opacity=' + value + ')';
}

function changeOpacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;

    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("setOpacity(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("setOpacity(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}
window.onload = initActions;