<!--
	stopWaitTime = 3500 // wait between news items scrolling
	scrollSpeed = 5; // 10 is slowest, 5 highest
	stopSpacing = 13;
	globalBaseNews = "base";
	var newsItems = new Array();
	var newsId = new Array();
	var newsTop = new Array();
	var nextStop = new Array();
	var newsWidth = new Array();
	var newsHeight = new Array();
	var newsLeft = new Array();
	var newsScrolling = new Array();
	var clipTop = new Array();
	var scrollThread = new Array();
	var totalNews = 0;
	var newsCopying = false;
	var noNewsCopy = false;
	
	function IdExists(id) {
		var i = 0;
		
		while (1) {
			if (!newsCopying) {
				 noNewsCopy = true;
				 break;
			}
		}
		for (i=0; i<totalNews; ++i) {
			if (newsId == id) {
				noNewsCopy = false;
				return i;
			}
		}
		noNewsCopy = false;
		return -1;
	}
	
	function stopScrollingNews(id) {
		var idx = 0;
		if ((idx = IdExists(id)) == -1) return;
		if (scrollThread[idx] && newsScrolling[idx]) clearTimeout(scrollThread[idx]);
		newsScrolling[idx] = false;
	}
	
  function scrollNews(id, onetime) {
		var idx = 0;
		if (!document.getElementById) return;
		if (!id) return;
		if ((idx = IdExists(id)) == -1) return;
		if (!onetime) onetime = false;
		
		var newsDiv = document.getElementById(newsId[idx]).style;
		newsDiv.clip = "rect(" + clipTop[idx] + "px " + (newsWidth[idx] + newsLeft[idx]) + "px " + (clipTop[idx] + newsHeight[idx]) + "px 0px)";
		newsDiv.pixelTop = newsTop[idx] - clipTop[idx];
		if (clipTop[idx] == 0) newsDiv.pixelTop = newsTop[idx];
		
		if (clipTop[idx] >= nextStop) {
			nextStop[idx] = clipTop[idx] + newsHeight[idx] + stopSpacing;
			if (nextStop[idx] >= newsHeight[idx] * newsItems[idx]) nextStop[idx] = 0;
			clipTop[idx] += 1;
			if (clipTop[idx] + newsHeight[idx] + stopSpacing >= newsHeight[idx] * newsItems[idx]) clipTop[idx] = 0;
      newsDiv.visibility='visible';
			if (!onetime) scrollThread[idx] = setTimeout('scrollNews("'+id+'")', stopWaitTime);
			else newsScrolling[idx] = false;
		} else {
    	clipTop[idx] += 1; 
      newsDiv.visibility='visible';
      if (!onetime) scrollThread[idx] = setTimeout('scrollNews("'+id+'")', scrollSpeed);
			else newsScrolling[idx] = false;			
		}
  }

	function toggleScrollingNews(id, button) {
		var idx = 0;
		if ((idx = IdExists(id)) == -1) return;
		// Keeping this function thread safe
		if (newsScrolling[idx]) {
			stopScrollingNews(id);
			if (button && document.getElementById) document.getElementById(button).innerHTML = ">";
		} else {
			newsScrolling[idx] = true;
			scrollNews(id);
			if (button && document.getElementById) document.getElementById(button).innerHTML = "||";
		}
	}
	
	function goNext(idx) {
		clipTop[idx] = nextStop[idx];
		nextStop[idx] = clipTop[idx] + newsHeight[idx] + stopSpacing;
		if (nextStop[idx] >= newsHeight[idx] * newsItems[idx]) nextStop[idx] = 0; 
	}
	
	function nextNewsItem(id) {
		var idx = 0;
		var wasScrolling = true;
		if ((idx = IdExists(id)) == -1) return;
		// Keeping this function thread safe
		if (newsScrolling[idx]) stopScrollingNews(id);
		else wasScrolling = false;
		goNext(idx);
		newsScrolling[idx] = true;
		if (!wasScrolling) scrollNews(id, true);
		else scrollNews(id);				
	}

	// This function adds news to the array and sctarts the scroller
	// baseNews allows you to reposition one news clip over another news section
	// pass no baseNews if you want the news clip to stay put on the screen
	// (tip: these news clips must have same width)
	function addNews(items, id, baseNews) {
		var idx = 0;
		if (!baseNews) baseNews = id;
		else globalBaseNews = id;
		// Check to make sure this is a new news clipping
		if ((idx = IdExists(id)) == -1) {
			if (totalNews > 10) return;
			idx = totalNews;			 
			++totalNews;
		} else return;
		newsItems[idx] = items;
		newsId[idx] = id;
		
		if (!document.getElementById) return;
		newsTop[idx] = getAbsoluteY(document.getElementById(baseNews));
		newsWidth[idx] = getAbsoluteWidth(document.getElementById(baseNews));
		newsHeight[idx] = (getAbsoluteHeight(document.getElementById(id)) / newsItems) - stopSpacing;
		newsLeft[idx] = getAbsoluteX(document.getElementById(baseNews));
		document.getElementById(id).style.pixelLeft = newsLeft[idx];
		document.getElementById(id).style.pixelTop = newsTop[idx];
		clipTop[idx] = 0;
		nextStop[idx] = 0;
		scrollThread[idx] = 0;
		newsScrolling[idx] = true;
		scrollNews(id);
	}
	
	function copyNews(newIdx, currentIdx, decrementNews) {
		while (1) {
			if (!noNewsCopy) {
				newCopying = true;
				break;
			}
		}
		if (decrementNews) totalNews--;
		else {
    	newsItems[newIdx] = newsItems[currentIdx];
    	newsId[newIdx] = newsId[currentIdx];
    	newsTop[newIdx] = newsTop[currentIdx];
    	nextStop[newIdx] = nextStop[currentIdx];
    	newsWidth[newIdx] = newsWidth[currentIdx];
    	newsHeight[newIdx] = newsHeight[currentIdx];
    	newsLeft[newIdx] = newsLeft[currentIdx];
    	newsScrolling[newIdx] = newsScrolling[currentIdx];
    	clipTop[newIdx] = clipTop[currentIdx];
    	scrollThread[newIdx] = scrollThread[currentIdx];
		}
		newsCopying = false;;
	}
	
	// This function hides news and deletes it from the array 
	function deleteNews(id) {
		var i, idx = 0;
		if ((idx = IdExists(id)) == -1) return;
		stopScrollingNews(id);
		document.getElementById(newsId[idx]).style.pixelTop = newsTop[idx];
		if (document.getElementById) document.getElementById(newsId[idx]).style.visibility = "hidden";
  	for (i=idx; i<(totalNews-1); i++) copyNews(i, i+1, false);
		copyNews(0, 0, true);
	}
	
-->
