ns4Text = "No Newsticker on Netscape 4"; // Alternative text to display in Netscape 4. ns4URL = "#"; // URL of link in NS4. ns4Target = "_top"; //Don't forget to use String and "px" for all coordinates to make it work on xhtml strict page //Browser Sniffer var dmnt_isIE = (document.getElementById && document.all) ? true : false; var dmnt_isNS4 = (document.layers) ? true : false; var dmnt_isNS6 = (document.getElementById && !document.all) ? true : false; var dmnt_isLoaded = false; // Build the objScroll and place it on the page function buildScroller() { //Create element in which the Ticker is placed tickerspace = '
'; document.writeln(tickerspace); } function loadScroller(){ if(dmnt_isNS4){ //Only show Message that it does not work on NS 4 objScroll = '
' objScroll += '

'; if(ns4URL.toLowerCase() != "none"){ objScroll += '' + ns4Text + ''; } else{ objScroll += ns4Text; } objScroll += '

' } else{ //Works if Browser detected is not NS 4 objScroll = ''; objScroll += '
'; objScroll += '
'; objScroll += ''; if(Article[x][1].toLowerCase() != "none"){ //If a link is applied (which is always the case by now in Typo3) objScroll += '' + Article[x][0] + '<\/a>'; } else{ objScroll += Article[x][0]; } //End paragraph and table cell objScroll += '

<\/td>'; if(orientation.toLowerCase() == "vertical"){ //If vertical also close table line objScroll += '<\/tr>'; } if(objScrollDivider.toLowerCase() != "none"){ //Insert divider if set in config objScroll += '

' + objScrollDivider + '<\/p><\/td>'; } } //End For each article y++ } //End While objScroll += '<\/tr><\/table><\/div><\/div><\/td><\/tr><\/table>'; } // End is not NS4 document.getElementById("tickerspace").innerHTML = objScroll; setWidth(); } //End function loadScroller // Moving is more smooth if width / height (on vertical) is dividable by 2. function setWidth() { tableObj = (dmnt_isIE) ? document.all("ticker_table") : document.getElementById("ticker_table"); obj = (dmnt_isIE) ? document.all.div1 : document.getElementById("div1"); objWidth = (orientation.toLowerCase() == "horizontal") ? getOffset(tableObj, "width") : getOffset(tableObj, "height"); HalfWidth = Math.floor(objWidth / 2); if (orientation.toLowerCase() == "horizontal") { newWidth = (HalfWidth * 2) + 2; } else { //Bei vertikaler Anordnung nicht durch 2 teilen, damit es an jeder Stelle halten kann. newWidth = (HalfWidth) + 4; } //alert (objWidth); //alert (newWidth); obj.style.width = newWidth + "px"; moveObject(obj, newWidth); } // Move the layer by one pixel to the left function moveObject(obj, width) { maxLeft = (0 - (width / 2) + 2) / 2; if(orientation.toLowerCase() == "horizontal"){ if (parseInt(obj.style.left) <= maxLeft) { obj.style.left = "0px"; } else { obj.style.left = (parseInt(obj.style.left) - 1) + "px"; } } else{ if(obj.style.top == ""){ obj.style.top = 0 + "px"; } if (parseInt(obj.style.top) < (0 - (width / 2) + 6)){ obj.style.top = 0 + "px"; } else{ obj.style.top = (parseInt(obj.style.top) - 1) + "px"; } } if (obj.style.left == "-1px" || obj.style.top == "-1px") { //Am Beginn jeder News die definierte Pause timer = setTimeout ("moveObject(obj, " + width + ");", ticker_pause); } else { //Normaler move ohne große Pause timer = setTimeout ("moveObject(obj, " + width + ");", 100 - speed); } } // Get width and height of layer function getOffset(obj, dim) { if(dim == "width"){ oWidth = obj.offsetWidth; return oWidth; } else if(dim == "height"){ oHeight = obj.offsetHeight; return oHeight; } } function stopscroller() { clearTimeout(timer); }