function init()
{
	if (document.getElementById('map1')) {
	  loadAll(document.getElementById('map1'));

	}
}

window.onload = init;

function loadAll(arrayLoading)
{
	var areas = arrayLoading.getElementsByTagName('span');
	for(var i=0;i<areas.length;i++) areas[i].onmouseover = mouseIsOver;
	//document.getElementById('map1area').onmouseover = mouseIsOver;
}

function mouseIsOver()
{
	var area = this;

	var imginarea = this.getElementsByTagName('img');
	//console.info(imginarea);
	var coords = this.getAttribute('coords');
	var number = this.getAttribute('number');

	var x1 = parseInt(coords);
	coords = coords.substring(coords.indexOf(",") + 1);
	var y1 = parseInt(coords);
	coords = coords.substring(coords.indexOf(",") + 1);
	var x2 = parseInt(coords);
	coords = coords.substring(coords.indexOf(",") + 1);
	var y2 = parseInt(coords);

	var img = document.createElement("img");
	img.src = area.getAttribute("imgSrc");
	img.style.position = 'absolute';

	imginarea[0].style.zIndex = 2001 + parseInt(number);
	img.style.zIndex = 2000+ parseInt(number);
	img.id = 'tmpimg';


	img.style.left = x1 + 'px';
	img.style.top = y1 + 'px';
	/* img.style.height = y2 + 'px';
	img.style.width = x2 + 'px'; */

	area.parentNode.appendChild(img);

	area.onmouseout = function ()
	{
		if (document.getElementById('tmpimg')){
			this.parentNode.removeChild(img);
			//img.style.zIndex = 2000+ parseInt(number);
			imginarea[0].style.zIndex = parseInt(number);
		}

		setTimeout(function () { area.onmouseover = mouseIsOver; }, 50);
	};

	area.onmouseover = null;
}



