//Připojení události po načtení stránky
  addEvent(window, 'load', init_me);
  //Contejner for EOLAS fix
  var objects;
  // Contejner for 
  var replacedFlashs= new Array(); 
  /** 
  *  Priradi urcite udalosti objektu zadanou obsluznou funkci. Rozhodne 
  *  automaticky, zda pouzit attachEvent, nebo addEventListener. Resi problem 
  *  s pouzitim this uvnitr obsluzne funkce. 
  *  @param obj Objekt, u nehoz chceme udalost obsluhovat. 
  *  @param event Udalost, jiz hodlame obslouzit&nbsp;&ndash; ve formatu click, load apod. 
  *               (nikoliv onclick, onload). 
  *  @param funct Nazev obsluzne funkce. 
  */  
  function addEvent(obj, event, funct) {  
    if (obj.attachEvent) { //IE  
      obj['e' + event + funct] = funct;  
      obj['x' + event + funct] = function() {  
        obj['e' + event + funct](window.event);  
      }  
      obj.attachEvent('on' + event, obj['x' + event + funct]);  
    } else // other browser  
      obj.addEventListener(event, funct, false);  
  }   

  function init_me() {
    //Fix EOLAS "bug"
    if(document.all) { //IE only
      objects = document.getElementsByTagName("object");
      for (var i=0; i<objects.length; i++)
        window.setTimeout("eolas_fix(" + i + ")", 1);
      try {
  				a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
          for (var i=0; i<replacedFlashs.length; i++)
            window.setTimeout("flashReplace(" + i + ")", 1);
  	  }
  		catch(e) {}
      
    } 
  }

    
  //Fix EOLAS "bug"
  function eolas_fix(i)
  {
    objects[i].outerHTML = objects[i].outerHTML;
  }
  
  //Open "a" tag's href to new window.
  function new_win(elem) {
    var win = window.open(elem.href, 'mmwin');
    return (typeof win == 'object' ? false : true);
  }
  
  //Open "a" tag's href to new window.
  function new_win_viz(elem) {
    var win = window.open(elem.href, 'mmviz', 'resizable,scrollbars=yes');
    return (typeof win == 'object' ? false : true);
  }

  function regFlashReplace(elementId, size, flashUrl, flashParams, flashVars) {
    var temp = new Array();
    temp['elementId'] = elementId;
    temp['size'] = size;
    temp['flashUrl'] = flashUrl;
    temp['flashParams'] = flashParams;
    temp['flashVars'] = flashVars;
    replacedFlashs[replacedFlashs.length] = temp;
  }
  
  function flashReplace(num) {
    var elem = document.getElementById(replacedFlashs[num]['elementId']);
    
    att = ' width="' + replacedFlashs[num]['size'][0] + '"';
    att += ' height="' + replacedFlashs[num]['size'][1] + '"';
    
    par = '<param name="movie" value="' + replacedFlashs[num]['flashUrl'] + '" />';
    
    params =  replacedFlashs[num]['flashParams'].replace(/&amp;/g, '&').split('&');
    for (var i=0; i<params.length; i++) {
      paramx = params[i].split('=');
      par += '<param name="' + paramx[0] + '" value="' + paramx[1] + '" />';
    }
    par += '<param name="flashvars" value="' + replacedFlashs[num]['flashVars'] + '" />';
    elem.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
  }
  
