var regions = [79,10,42,76,101,74,174,85,24,148,94,150,139,152,5,274,74,229,109,233,0,0];

var goToRegion=0;

// ================================================================

function collapseAll(classname) {

var list = getElementsByClass(classname);
for (i=0;i<list.length;i++) list[i].style.display = 'none';
}

// ================================================================

function positionRect(reg) {

var x = regions[(2*(reg-1))];
var y = regions[(2*reg)-1];

document.getElementById('selector').style.display = "block";
document.getElementById('selector').style.top = y+"px";
document.getElementById('selector').style.left = x+"px";
goToRegion = reg;
}

// ================================================================

function setUpHotSpots(mapid) {

var el = document.getElementById(mapid).firstChild;

collapseAll('active');

while((el) && (el.nodeType !=1)) el=el.nextSibling;
while ((el) && (el.tagName == 'AREA')) {
    el.onmouseover = function() {
    var rexp = /region(.+)\.html/
    link = this.getAttribute('href');
    rf = rexp.exec(link);
    if (rf[1] > 0) {
       positionRect(rf[1]);
    }
    else hideRect();
   }
  do {el=el.nextSibling;} while((el) && (el.nodeType !=1));
  }
  setupTextRegions();
  positionRect(1);
  hideRect();

}

// ================================================================

function setupTextRegions() {

var el=document.getElementById('textregion').firstChild;
if (el.tagName == 'undefined') el=el.nextsibling;

while((el) && (el.nodeType !=1)) el=el.nextSibling;
while ((el) && (el.tagName == 'LI')) {
    a=el.firstChild;
    a.onmouseover = function() {
       this.style.border='white';
       var rexp = /region(.+)\.html/
       link = this.getAttribute('href');
       ref = rexp.exec(link);
       if (ref[1] > 0) positionRect(ref[1]);
    }
    el.onmouseout = function() { hideRect() }
  do {el=el.nextSibling;} while((el) && (el.nodeType !=1));
  }

}

// ================================================================

function hideRect() {
document.getElementById('selector').style.display = "none";
goToRegion = 0;
}

// ================================================================

function refer() {

var url = "region"+goToRegion+".html";
window.location = url;

}

