<!-- Hide from older browsers...

function initMaps() {
   if (document.getElementById) {
      var mapIds = initMaps.arguments;    // pass string IDs of containing map elements
      var i, j, area, areas;
      for (i = 0; i < mapIds.length; i++) {
        areas = document.getElementById(mapIds[i]).getElementsByTagName("area");

        for (j = 0; j < areas.length; j++) {  // loop thru area elements
           area = areas[j];
           area.onmousedown = imgSwap;    // set event handlers
           area.onmouseout = imgSwap;
           area.onmouseover = imgSwap;
           area.onmouseup = imgSwap;
        }
      }
   }
}
                   
function findPosY(obj) {
	var posTop = 0;
	while (obj.offsetParent) {
		posTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return posTop;
}
function findPosX(obj) {
	var posLeft = 0;
	while (obj.offsetParent) {
		posLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return posLeft;
}                  
                 
// image swapping event handling
function imgSwap(evt) {
   evt = (evt) ? evt : event;                   // equalize event models
   var elem = (evt.target) ? evt.target : evt.srcElement;
   
   processElement(elem, evt.type);
   
   evt.cancelBubble = true;
   return false;
}

function processElement(elem, evttype)
{
   var imgClass = elem.parentNode.id;         // get map element name
   var coords = elem.coords.split(",");         // convert coords to clip
   var tmp = document.getElementById(imgClass+'Up');
   var offsetLeft = findPosX(tmp);
   var offsetTop = findPosY(tmp);
   var clipVal = elem.getAttribute('customclip');
   var leftVal = (elem.getAttribute('customleft')*1+offsetLeft*1)+'px';
   var topVal = (elem.getAttribute('customtop')*1+offsetTop*1)+'px';
   var imgStyle;
   var tblRow = document.getElementById(elem.getAttribute('tblRow'));


   switch (evttype) {
      case "mouseout" :
         document.getElementById(imgClass + "Over").style.visibility = "hidden";
         document.getElementById(imgClass + "Over").style.visibility = "hidden";
         if(tblRow)
         {
         	tblRow.bgColor= tblRow.getAttribute('offcolor'); //'#f5f5f5';
         }
         break;
      case "mouseover" :
         imgStyle = document.getElementById(imgClass + "Over").style;
         imgStyle.clip = clipVal;
         imgStyle.left = leftVal;
         imgStyle.top = topVal;
         imgStyle.visibility = "visible";
         if(tblRow)
         {
         	tblRow.bgColor= tblRow.getAttribute('oncolor'); //'#e4e4e4';
         }
         break;
   }

}

function prekoReda(el, tip)
{
	switch(tip)
	{
		case 'on':
			el.bgColor = el.getAttribute('oncolor');
			processElement(document.getElementById(el.getAttribute('areaID')), 'mouseover');
			break;
		case 'off':
			el.bgColor = el.getAttribute('offcolor');
			processElement(document.getElementById(el.getAttribute('areaID')), 'mouseout');
			break;
	}
}
// -->
