function getObj(id) {
  var obj = document.getElementById ? document.getElementById(id) : document.all[id];  
  return obj;
};

var mapa2 = { 
  region: [],
    
  init: function () {
    if(!getObj('mapa2')) return; 
    
    
    this.region[6] = 'praha';
    this.region[10] = 'jihomoravsky-kraj';
    this.region[7] = 'pardubicky-kraj';
    this.region[4] = 'moravskoslezsky-kraj';
    this.region[11] = 'kralovehradecky-kraj';
    this.region[14] = 'stredocesky-kraj';
    this.region[9] = 'vysocina';
    this.region[2] = 'jihocesky-kraj';
    this.region[1] = 'karlovarsky-kraj';
    this.region[5] = 'liberecky-kraj';
    this.region[13] = 'olomoucky-kraj';
    this.region[8] = 'plzensky-kraj';
    this.region[12] = 'ustecky-kraj';
    this.region[3] = 'zlinsky-kraj';

    this.box = getObj('mapa2');
    this.box.onmouseout = this.reset;
    
    var area = this.box.getElementsByTagName('area');        
    var i = 0, count = area.length;     
    for(i; i<count; i++) {
      area[i].onmouseover = this.setup;
    }
    
    this.width = this.box.clientWidth;
    this.height = this.box.clientHeight;    
  },
  
  setup: function () {  
    var i = 0, count = mapa2.region.length, k = 0; 
    for(i; i<count; i++) {
      if(this.id == mapa2.region[i]) {
        k = i;
      }    
    }
             
    mapa2.box.style.backgroundPosition = k < 8 ? '0px -' + (k * mapa2.height) + 'px' : '-' + mapa2.width + 'px -' + ((k-7) * mapa2.height) + 'px';
  },
  
  reset: function() { 
    this.style.backgroundPosition = '0px 0px';
  }
}
