
var curItem = 0;
var curState = "NewItem";
var newsTitles = Array();
var newsLinks = Array();

newsTitles.push("SIGN UP NOW - IT'S FREE!");
newsLinks.push("/cms/index.cfm/path/97503/140759/");

newsTitles.push("mywirelessreminder.com™ NOW AVAILABLE IN THE UNITED KINGDOM");
newsLinks.push("/cms/index.cfm/path/97503/160656/");

newsTitles.push("REAL-TIME NOTIFICATION SERVICE");
newsLinks.push("/cms/index.cfm/path/97503/154395/");

newsTitles.push("NEW AFFILIATE PARTNERSHIP");
newsLinks.push("/cms/index.cfm/path/97503/129373/");

newsTitles.push("INTUITIVE SOLUTIONS LAUNCHES NEW SERVICE");
newsLinks.push("/cms/index.cfm/path/97503/107921/");

function startScroll()
{
	scroller = document.getElementById("Scroller");
	for(var i = 0; i < newsTitles.length; i = i + 1)
	{
		newItem = document.createElement("div");
		newItem.className = "ScrollItem";
		
		newLink = document.createElement("a");
		newLink.href = newsLinks[i];
		newLink.innerHTML = newsTitles[i];
		newItem.appendChild(newLink);
		
		scroller.appendChild(newItem);
	}
	curTimeout = setTimeout("scrollItem()", 2000);
}
function scrollItem()
{
	scroller = document.getElementById("Scroller");
	scrollerItem = scroller.childNodes[curItem];
	switch(curState)
	{
		case "NewItem":
			scrollerItem.style.left = "0px";
			if(scrollerItem.filters)
				scrollerItem.filters[0].apply();
			scrollerItem.style.visibility = "visible";
			if(scrollerItem.filters)
				scrollerItem.filters[0].play();
			curState = "ScrollItem";
			//Wait for fade period + scroll period
			curTimeout = setTimeout("scrollItem()", 2000);
		break;
		case "ScrollItem":
			if(scrollerItem.offsetLeft + scrollerItem.offsetWidth + 50 > 0)
			{
				//Subtract scroll speed
				scrollerItem.style.left = (scrollerItem.offsetLeft - 2) + "px";
				curTimeout = setTimeout("scrollItem()", 30);
			}
			else
			{
				//Move to next item
				scrollerItem.style.visibility = "hidden";
				if(curItem + 1 < scroller.childNodes.length)
					curItem++;
				else
					curItem = 0;
				curState = "NewItem";
				scrollItem();
			}
		break;
	}
}
function pauseScroll()
{
	clearTimeout(curTimeout);
}
function resumeScroll()
{
	curTimeout = setTimeout("scrollItem()", 30);
}
startScroll(); 