window.onload = startup;

function startup() {
  initMaps('mainmenuMap');
}

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;
        }
      }
   }
}

// image swapping event handling
function imgSwap(evt) {
   evt = (evt) ? evt : event;                   // equalize event models
   var elem = (evt.target) ? evt.target : evt.srcElement;
   var imgClass = elem.parentNode.name;         // get map element name
   var coords = elem.coords.split(",");         // convert coords to clip
   var clipVal = "rect(" + coords[1] + "px " +
                           coords[2] + "px " +
                           coords[3] + "px " +
                           coords[0] + "px)";
   var imgStyle;
   
   switch (evt.type) {
/*      case "mousedown" :
         imgStyle = document.getElementById(imgClass + "Down").style;
         imgStyle.clip = clipVal;
         imgStyle.visibility = "visible";
         break;*/
      case "mouseout" :
         document.getElementById(imgClass + "Over").style.visibility = "hidden";
//         document.getElementById(imgClass + "Down").style.visibility = "hidden";
         break;
      case "mouseover" :
         imgStyle = document.getElementById(imgClass + "Over").style;
         imgStyle.clip = clipVal;
         imgStyle.visibility = "visible";
         break
/*      case "mouseup" :
         document.getElementById(imgClass + "Down").style.visibility = "hidden";
         break;*/
   }
   evt.cancelBubble = true;
   return false;
} 

function openComments (url, targetwindow) {
  commentWindow = window.open(url, targetwindow, 'width=490,height=550,scrollbars=yes,status=yes,resizable=yes');
  commentWindow.focus();
  return false;
}

function OpenTrackback (c) {
    window.open(c, 'trackback', 'width=480,height=480,scrollbars=yes,status=yes');
}
