var newsTickers = null; var isIE5, isIE55, isIE6; var isNN6, isNN7; var isOpera; ua = navigator.userAgent; if( ua.indexOf( "Opera" ) != -1 ){ isOpera = true; } else if( ua.indexOf( "MSIE" ) != -1 ){ vers = ua.substring( ua.indexOf( "MSIE" ) + 5, ua.indexOf( ";", ua.indexOf( "MSIE" ) ) ); if( vers == "6.0" ){ isIE6 = true; } else if( vers == "5.5" ){ isIE55 = true; } else if( vers == "5.0" ){ isIE5 = true; } } else if( ua.indexOf( "Netscape" ) != -1 ){ vers = ua.substring( ua.lastIndexOf( "/" ) + 1, ua.lastIndexOf( "/" ) + 4 ); if( ( vers == "7.0" ) || ( vers == "7.1" ) ){ isNN7 = true; } else if( ( vers == "6.0" ) || ( vers == "6.1" ) || ( vers == "6.2" ) ){ isNN6 = true; } } else if( ua.indexOf( "Mozilla" ) != -1 ){ vers = ua.substring( ua.indexOf( "rv:" ) + 3, ua.indexOf( "rv:" ) + 5 ); if( vers == "1." ){ isNN7 = true; } else if( ( vers == "0." ) ){ isNN6 = true; } else if( ua.indexOf( "Safari" ) ) isNN7 = true; } //--------------------------------------------------------------------------------------------------------- // newsName : unique name // newsWidth : width in pixels // newsHeight : height in pixels // newsPause : amount of time a single item is displayed in milliseconds // newStep : pixels to move the text while scrolling // newsSpeed : how fast the news is scrolled in milliseconds // initialPause : additional pause before the first scroll // imgsrc : the URL of the bullet to insert into text // // newsBackgroundPanel : to define the color of the background panel of the news, define a // style named .newsBackgroundPanel // newsItemPanel : to define the style of the panel in which the news is displayed in // ( background, text color, font, padding, etc ), define a style named .newsItemPanel // // newsImageClass : to define the style of the arrow in news is displayed in // ( background, text color, font, padding, etc ), define a style named .newsImageClass //--------------------------------------------------------------------------------------------------------- function newsTicker( newsName, newsWidth, newsHeight, newsPause, newsStep, newsSpeed, initialPause, imgsrc ){ this.name = newsName; this.width = newsWidth; this.height = newsHeight; this.pause = newsPause; this.step = newsStep; this.newsLength = 0; this.currentNews = 0; this.newsObjs = new Array(); this.imgsrc = imgsrc; this.divOffset = 0; this.scrollSpeed = newsSpeed; this.needToScroll = false; this.mouseOver = false; this.timeoutID = null; this.initPause = initialPause; // methods this.addNewsItem = addNewsItem; this.closeNewsItems = closeNewsItems; // register news ticker if( newsTickers == null ){ newsTickers = new Array(); } newsTickers[ newsTickers.length ] = this; this.tickerIndex = newsTickers.length - 1; document.writeln( "
" ); } function addNewsItem( text, link, target ){ this.newsLength++; if( isIE6 || isIE5 || isIE55 ){ document.writeln( "
" ); } else if ( isNN6 || isNN7 ){ document.writeln( "
" ); } else if( isOpera ){ document.writeln( "
" ); } else { document.writeln( "
" ); } if( ( this.imgsrc != "" ) && ( this.imgsrc != null ) ){ //imgtag = ""; imgtag = ""; } else { imgtag = ""; } if ( isNN6 || isNN7 ){ document.writeln( "
" + imgtag + "" + text + "
" ); } else { document.writeln( imgtag + "" + text + "" ); } document.writeln( "
" ); var div = document.getElementById( "nt_" + this.name + "_" + ( this.newsLength - 1 ) ); if( this.newsLength > 1 ){ div.style.top = this.height; } this.newsObjs[ this.newsObjs.length ] = div; } function closeNewsItems(){ document.writeln( "
" ); this.timeoutID = setTimeout( "changeNews(" + this.tickerIndex + ")", this.pause + this.initPause ); } function changeNews( tIndex ){ obj = newsTickers[ Number( tIndex ) ]; clearTimeout( obj.timeoutID ); obj.timeoutID = null; obj.needToScroll = true; if( !obj.mouseOver ){ if( obj.needToScroll ){ if( obj.divOffset > -obj.height ){ obj.divOffset -= obj.step; if( isNN6 || isNN7 ){ obj.newsObjs[ obj.currentNews ].style.top = obj.divOffset - ( obj.currentNews * obj.height ); obj.newsObjs[ ( obj.currentNews + 1 ) % obj.newsLength ].style.top = obj.divOffset - ( ( ( obj.currentNews + 1 ) % obj.newsLength ) * obj.height ) + obj.height; } else if( isOpera ){ obj.newsObjs[ obj.currentNews ].style.top = obj.divOffset - ( obj.currentNews * obj.height ); obj.newsObjs[ ( obj.currentNews + 1 ) % obj.newsLength ].style.top = obj.divOffset - ( ( ( obj.currentNews + 1 ) % obj.newsLength ) * obj.height ) + obj.height ; } else { obj.newsObjs[ obj.currentNews ].style.top = obj.divOffset; obj.newsObjs[ ( obj.currentNews + 1 ) % obj.newsLength ].style.top = obj.divOffset + obj.height; } obj.timeoutID = setTimeout( "changeNews(" + obj.tickerIndex + ")", obj.scrollSpeed ); } else { obj.needToScroll = false; obj.currentNews = ( obj.currentNews + 1 ) % obj.newsLength; obj.divOffset = 0; if( isNN6 || isNN7 || isOpera ){ obj.newsObjs[ obj.currentNews ].style.top = obj.divOffset - ( obj.currentNews * obj.height ); } else { obj.newsObjs[ obj.currentNews ].style.top = 0; } obj.timeoutID = setTimeout( "changeNews(" + obj.tickerIndex + ")", obj.pause ); } } } } function newsMouseIn( tIndex ){ obj = newsTickers[ Number( tIndex ) ]; obj.mouseOver = true; } function newsMouseOut( tIndex ){ obj = newsTickers[ Number( tIndex ) ]; obj.mouseOver = false; if( obj.needToScroll && !obj.timeoutID ){ changeNews( tIndex ); } }