
	// ticker setup
	var charDelay = 50; 
	var storyDelay = 3000;
	var numStories = 0;
	// two dimensional array to hold stories and links 
	var storyMatrix = new Array(); 
	storyMatrix[0] = new Array();
	storyMatrix[1] = new Array();

	var xmlFile = "http://www.reefertrends.com/rss/reefer.xml";

	addLoadEvent(importXML);
	
	function addLoadEvent(func)
	{
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function')
	  {
		window.onload = func;
	  }
	  else
	  {
		window.onload = function()
		{
		  oldonload();
		  func();
		}
	  }
	}
	
	function importXML()
	{
		if (document.implementation && document.implementation.createDocument)
		{
			xmlReq = new XMLHttpRequest();
			xmlReq.open("GET", xmlFile, true);
			xmlReq.onreadystatechange = function()
			{
				if (xmlReq.readyState == 4)
				{
					xmlDoc = xmlReq.responseXML.documentElement;
					createTable();
			  	}
 			}
 			xmlReq.send(null)
		}
		else if (window.ActiveXObject)
		{
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.onreadystatechange = function () {
				if (xmlDoc.readyState == 4) createTable()
			};
			xmlDoc.load(xmlFile);
		}
		else
		{
			document.getElementById("tickerHREF").innerHTML = "Sorry, your Browser does not support this feature . . .";
			return;
		}
		setTimeout('InitTicker()', 1000);
	}
	
	function createTable()
	{
		var x = xmlDoc.getElementsByTagName('item');
		for (j=0;j<x[0].childNodes.length;j++)
		{
			if (x[0].childNodes[j].nodeType != 1) continue;
		}
		for (i=0;i<x.length;i++)
		{
			for (j=0;j<x[i].childNodes.length;j++)
			{
				if (x[i].childNodes[j].nodeType != 1) continue;
				if (x[0].childNodes[j].nodeName == "title")
				{
					storyMatrix[0][i] = x[i].childNodes[j].firstChild.nodeValue; 
				}
				else if (x[0].childNodes[j].nodeName == "link")
				{
					storyMatrix[1][i] = x[i].childNodes[j].firstChild.nodeValue; 
				}
			}
		}
		numStories = x.length;
	}

	function InitTicker()
	{
		// Default values 
		currentStory = -1; 
		currentLength = 0; 
		//The top stories anchor tag
		oAnchor = document.getElementById("tickerHREF"); 
		NewsTicker(); 
	}
	
	function NewsTicker()
	{
		var delay; 
		// Get next story if title is done from previous 
		if (currentLength == 0)	// length of title being written out 
		{
			currentStory++; currentStory = currentStory % numStories; // use HTML entity for quotes so we don't mess up the anchor 
			currentTitle = storyMatrix[0][currentStory].replace(/&quot;/g,'"');
			oAnchor.href = storyMatrix[1][currentStory];
		} 
		// Write title to anchor 
		oAnchor.innerHTML = currentTitle.substring(0, currentLength) + "_"; 
		// adjust length of substring and set delays 
		if (currentLength != currentTitle.length)
		{ 
			currentLength++; delay = charDelay; 	
		}
		else
		{ 
			oAnchor.innerHTML = oAnchor.innerHTML.substring(0, currentLength); 
			currentLength = 0; delay = storyDelay; 
		}
		
		// Recurse ticker 
		setTimeout("NewsTicker()", delay); 
	}

