
function max(a, b) { return (a>b)?a:b; }

function windowresize() {
  var o = document.getElementById("bgimg");
  var ww = window.innerWidth;
  var wh = window.innerHeight;
  var scalex = window.innerWidth/2496;
  var scaley = window.innerHeight/1664;
  var scale = max(scalex, scaley);
  o.style.width = (2496*scale)+"px";
  o.style.height = (1664*scale)+"px";
  o.style.margin = "0";
  o.style.left = -Math.round((2496*scale-ww)/2)+"px";
  o.style.top = -Math.round((1664*scale-wh)/2)+"px";

  /*
  var o2= document.getElementById("oeffnungszeiten");
  if (o2) {
    o2.innerHTML="ww/wh: "+ww+"/"+wh+"<br />w/h: "+o.style.width+"/"+o.style.height+"<br />left/top: "+o.style.left+"/"+o.style.top+"<br />-"+Math.round((1664*scale-wh)/2)+"px";
  }
  */
}

window.addEventListener("resize", windowresize, true);
windowresize();

