$(document).ready(function() {

  //otvírání a schovávání div na základě výběru selectu		
  $("div.schovka").hide();
  $("div.schovka.zobraz").show();
  
  $("#vyberovka a").click(function(){ 
    var zobraz = $(this).attr('href');
      $(zobraz).show().siblings().hide();
  });

  $("#kraje area").click(function(){ 
    var zobraz = $(this).attr('href');
      $(zobraz).show().siblings().hide();
  });
});

function extract() {
  var navi = document.getElementById('navi')
  var arey = navi.getElementsByTagName('area');
  for (var i = 0; i < arey.length; i++) {
      var x = document.createElement('span');
      x.className='popis';
      x.setAttribute('id','nazevkraje');
      arey[i].onmouseover=function(){
              var popisek=this.getAttribute('title');
              var imgsrc=this.getAttribute('rel');
              this.parentNode.appendChild(x);
              x.appendChild(document.createTextNode(popisek));
              document.getElementById("kraj").src='mapa/obrazky/kraj'+imgsrc +'.gif';
              }
      arey[i].onmouseout=function(){
              x.removeChild(x.childNodes[0]);
              this.parentNode.removeChild(x);
              document.getElementById("kraj").src='mapa/obrazky/kraj0.gif';
              }
      arey[i].onclick=function(){
              var popisek=this.getAttribute('title');
             // return false;
              }
  }
}
function addEvent(obj, evType, fn){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    return false;
  }
}
addEvent(window, 'load', extract);
