
function delayed()
{   
  document.body.scrollTop = 0;
}

function delayed_window()
{
  window.scrollTo(0,0);
}

var ADBOXSIZE = 600
//const var ADBOXSIZE = 600;

function jsSetElementSizes(windowInnerHeight)
{
    var element = document.getElementById("contentboxid");
    var elHeight = windowInnerHeight - 168;
    element.style.height = String(elHeight)+"px";

    var element = document.getElementById("navcontainerid");
    var elHeight = windowInnerHeight - 6;
    if (elHeight > 800)
      elHeight = 800;
    element.style.height = String(elHeight)+"px";

    var element = document.getElementById("adboxid");
    var elHeight = windowInnerHeight - 151;
    if (elHeight > ADBOXSIZE)
      elHeight = ADBOXSIZE;
    element.style.height = String(elHeight)+"px";
}

function jsSetElementSizesIE5(windowInnerHeight)
{
    var element = document.getElementById("contentboxid");
    var elHeight = windowInnerHeight - 148;
    element.style.height = String(elHeight)+"px";

    var element = document.getElementById("navcontainerid");
    var elHeight = windowInnerHeight - 6;
    if (elHeight > 800)
      elHeight = 800;
    element.style.height = String(elHeight)+"px";

    var element = document.getElementById("adboxid");
    var elHeight = windowInnerHeight - 148;
    if (elHeight > ADBOXSIZE)
      elHeight = ADBOXSIZE;
    element.style.height = String(elHeight)+"px";
}

var currentClientHeight = 0;

function iphone_resize()
{
  var newHeight = document.documentElement.clientHeight;
  if (newHeight != currentClientHeight)
  {
    jsSetElementSizes(newHeight);
    currentClientHeight = newHeight;
  }
}

if (navigator.userAgent.indexOf("iPod")!=-1 || navigator.userAgent.indexOf("iPhone")!=-1)
{
  setInterval('iphone_resize()', 250);
}

function jsResizeBody()
{
  if (navigator.appName.indexOf("Explorer") != -1)
  {
    if (navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1)
    {
      jsSetElementSizesIE5(document.body.clientHeight);
    }
    else
    {
      if (document.documentElement && document.documentElement.clientHeight)
       // Explorer 6 Strict Mode
      {
        jsSetElementSizes(document.documentElement.clientHeight);
      }
      else if (document.body) // andere Explorer
      {
        jsSetElementSizes(document.body.offsetHeight);
      }
      //delayCtr = 0;
      //interval = setInterval('delayed_window()',40);
    }
  }
  else
  {
    if (navigator.appName.indexOf("Opera") != -1)
    {
      jsSetElementSizes(window.innerHeight);
    }
    else
    {
      jsSetElementSizes(document.documentElement.clientHeight);
    }
  }


  window.scrollTo(0,0);
  
}


function infoBarHighlight(tagID)
{
  document.getElementById(tagID).className="infobarentryhighlight";
}

function infoBarNormal(tagID)
{
  document.getElementById(tagID).className="infobarentry";
}

function setTitle(titleString)
{
  document.title = titleString;
}

function closeMovie(divId)
{
  var tochange = document.getElementById (divId);
  tochange.innerHTML = "";
  tochange.className = "videobodyalt";
}


function showMovie(divId, movieName, movieWidth, movieHeight)
{
  var tochange = document.getElementById (divId);
  
  if (navigator.appName.indexOf("Explorer") != -1)
  {
    var htmlString = '<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
    htmlString = htmlString + 'width="' + String(movieWidth) + '" ';
    htmlString = htmlString + 'height="' + String(movieHeight) + '">';
    htmlString = htmlString + '<param name="movie" value="/flashplayer/flvplayer.swf" />';
    htmlString = htmlString + '<param name="flashvars" ';
    htmlString = htmlString + 'value="file=/' + movieName + '&autostart=1" /><param name="allowfullscreen" value="true" /></object>';
  }
  else
  {
    var htmlString = '<object type="application/x-shockwave-flash" data="/flashplayer/flvplayer.swf" ';
    htmlString = htmlString + 'width="' + String(movieWidth) + '" ';
    htmlString = htmlString + 'height="' + String(movieHeight) + '">';
    htmlString = htmlString + '<param name="flashvars" ';
    htmlString = htmlString + 'value="file=/' + movieName + '&autostart=1" /><param name="allowfullscreen" value="true" /></object>';
  }
  htmlString = htmlString + '<div class="videoclose" onclick="closeMovie(\'' + divId + '\')"><div class="videocloseicon"><img src="images/CloseIcon.png" /></div><div class="videoclosetext">Video schließen</div></div>';
  tochange.innerHTML = htmlString;
  
  tochange.className = "videobody";
  tochange.style.top = String((window.innerHeight - 400) / 2)+"px";
  tochange.style.left = "270px";//(windowInnerWidth - 460) / 2;

/*
  var tochange = document.getElementById ('machWasId');
  
  var neuesObject = document.createElement("object");
  neuesObject.type = "application/x-shockwave-flash";
  neuesObject.data = "/flashplayer/flvplayer.swf";
  neuesObject.width = "600";
  neuesObject.height = "368";
  //neuesObject.type = "CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000";
  //neuesObject.setAttribute('classid', 'CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000');

  var param3 = document.createElement("param");
  param3.name = "movie";
  param3.value = "/flashplayer/flvplayer.swf";
  neuesObject.appendChild(param3);
  
  var param1 = document.createElement("param");
  param1.name = "flashvars";
  param1.value = "file=/movies/test.flv";
  neuesObject.appendChild(param1);

  var param2 = document.createElement("param");
  param2.name = "allowfullscreen";
  param2.value = "true";
  neuesObject.appendChild(param2);

  var param4 = document.createElement("param");
  param4.name = "autoplay";
  param4.value = "true";
  neuesObject.appendChild(param4);
  
  tochange.appendChild(neuesObject);
  */
  
}
