<!--
/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

// Specify speed of scroll. Larger=faster (ie: 5)
var scrollSpeed = cache = 510;

// Specify intial delay before scroller starts scrolling (in miliseconds):
var initialDelay = 0;

// Window height
/*
if(document.all)
  var windowHeight = document.body.clientHeight;
else
  var windowHeight = window.innerHeight;
*/  
// die 140 sind der Versatz von oben, wo der Ticker startet
var windowHeight = -60 + document.getElementById("scroller-container").offsetHeight;

document.write('<style>#content-center{min-height:'+ (self.innerHeight-205) +'px;}</style>');

//document.getElementById('infoLayer3').innerHTML = "WindowHeight:"+windowHeight;

function initializeScroller() {
  dataObj = document.all ? document.all.dataContainer : document.getElementById("dataContainer");
  dataObj.style.top = "60px";
  setTimeout("doMain()", 1000);
}
function doMain(){
  setTimeout("fade()", 9500);
  setTimeout("updateMarkenNeuprodukte()", 9800);
  setTimeout("appear()", 30);
  setTimeout("doMain()", 10000);
}

function getDataHeight() {
  theLength = dataObj.offsetHeight - windowHeight;
  //document.getElementById('infoLayer1').innerHTML = "Length: " + theLength;
  if (theLength == 0)
    setTimeout("getDataHeight()", 10);
  else if(theLength < 0) {
    scrollSpeed = 0;
    cache = 0;
  } else
  setTimeout("fade()", 9500);
  setTimeout("updateMarkenNeuprodukte()", 10000);
  setTimeout("appear()", 30);
}


function sleep(ms){ 
var zeit=(new Date()).getTime(); 
var stoppZeit=zeit+ms; 
while((new Date()).getTime()<stoppZeit){}; 
}
function fade(){
  new Effect.Fade('dataContainer', {duration:0.3});
}
function appear(){
  new Effect.Appear('dataContainer', {duration:0.3});
}
function scrollDiv() {
  dataObj.style.top = parseInt(dataObj.style.top) - scrollSpeed + "px";
  //document.getElementById('infoLayer2').innerHTML = "Style-Top: " + dataObj.style.top;
  if(parseInt(dataObj.style.top) <= theLength * (-1)) {
    scrollSpeed = -scrollSpeed;
    cache = -cache;
  }
  if(parseInt(dataObj.style.top) > 140) {
    
    scrollSpeed = -scrollSpeed;
    cache = -cache;
  }
/*  setTimeout("fade()", 9500);
  setTimeout("scrollDiv()", 10000);
  setTimeout("appear()", 30);*/
  setTimeout("fade()", 9500);
  setTimeout("updateMarkenNeuprodukte()", 10000);
  setTimeout("appear()", 30);
}
function updateMarkenNeuprodukte(){
  new Ajax.Updater('dataContainer', '/test/test.php', {asynchronous:true, evalScripts:true}); return false;
  
  return false;
  
}

if (window.addEventListener)
  window.addEventListener("load", initializeScroller, false);
else if (window.attachEvent)
  window.attachEvent("onload", initializeScroller);
else
  window.onload=initializeScroller;



//-->
