
var steps = 40;
var timeout = 50;

var i = steps;
var width_image;
var width_window;
var lmin;
var lmax;

/* http://pixy.cz/blogg/clanky/js-rozmery-okna.html */
function winW() {
   if (window.innerWidth)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerWidth;
   else if
   (document.documentElement &&
   document.documentElement.clientWidth)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerWidth */
      return document.documentElement.clientWidth;
   else if
   (document.body && document.body.clientWidth)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientWidth;
   else
      return null;
}

function mozart () {
  window.setTimeout ("move_mozart()", 100);
  var m = document.getElementById("mozart1");
  width_image = m.width;
  width_window = winW();
  // alert ("image=" + width_image + ", window=" + width_window);
  lmin = Math.round((width_window - width_image) / 2);
  lmax = width_window;
  // alert ("lmin=" + lmin + ":" + lmax);
}

function move_mozart () {
  var m = document.getElementById ("mozart1");
  if (i <= 0) {
    var c = document.getElementById ("container1");
    c.style.textAlign = "center";
    m.style.left = "auto";
    return;
  }
  var l = lmin + Math.round(((i-1)*(lmax-lmin))/steps);
  m.style.left = l + "px";
  m.style.visibility = "visible";
  i = i-1;
  window.setTimeout ("move_mozart()", timeout);
}
  
