var canvasWidth  = window.innerWidth  ? window.innerWidth  : document.documentElement.clientWidth;
var canvasHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;

function sizeWindow() {
   var h = document.getElementById("precontent").offsetHeight + document.getElementById("postcontent").offsetHeight;
   if (canvasHeight - h > 200 && canvasWidth >= document.body.offsetWidth) {
       document.getElementById("logo1").style.marginRight = "0";
       document.getElementById("contentarea").style.height = (canvasHeight - h) + "px";
       document.documentElement.style.overflowY = "hidden";
   } else {
       document.getElementById("logo1").style.marginRight = document.getElementById("contentarea").currentStyle
                             ? document.getElementById("contentarea").currentStyle.paddingRight
                             : getComputedStyle(document.getElementById("contentarea"),null).paddingRight;
       document.getElementById("contentarea").style.height = "auto";
       document.documentElement.style.overflowY = "scroll";
   }
}

function orsz() {
   var w = window.innerWidth  ? window.innerWidth  : document.documentElement.clientWidth;
   var h = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;
   if (w != canvasWidth || h != canvasHeight) {
      canvasWidth  = w;
      canvasHeight = h;
      sizeWindow();
   }
}

function ofld() {
   if (typeof AudioPlayer == "object") {
   	 AudioPlayer.setup("../wpap/player.swf", {width: 290, transparentpagebg: "yes", animation: "no", noinfo: "yes"});
   	 AudioPlayer.embed("wpap", {soundFile: "../recordings/" + encodeURIComponent(document.title.replace(/,/g,"")) + ".mp3"});
   }
}

function owld() {
   ofld();
   sizeWindow();
   window.onresize = orsz;
}

window.onload = parent.frames.length ? ofld : owld;
