function GetRandom(min, max)
{
	if (min > max)
		return -1;

	if (min == max)
		return min;

	return min + parseInt(Math.random() * (max-min+1));
}

var newsticker_scroller = document.getElementById("newsticker_scroller");
var pos_counter = 0;
var pos_waiter = 0;
var newsticker_data_counter = 0;

function ScrollNewsticker()
{
	if (pos_counter == 0 && pos_waiter == 0)
		pos_waiter = 80;

	if (pos_waiter != 0)
		pos_waiter--;

	if (pos_waiter == 0)
	{
		pos_counter++;

		if (pos_counter == 25)
		{
			if (newsticker_data_counter < newsticker_data.length-1)
				newsticker_data_counter++;
			else
				newsticker_data_counter = 0;

			newsticker_scroller.innerHTML = newsticker_data[newsticker_data_counter];
			pos_counter = -25;
		}

		newsticker_scroller.style.top = parseInt(pos_counter) + "px";
		newsticker_scroller.style.visibility = "visible";
	}
}

document.write("<div id=\"string_size\"></div>");

newsticker_data = newsticker_scroller.innerHTML.split("||");
newsticker_data_counter = GetRandom(0, newsticker_data.length-1);
newsticker_scroller.innerHTML = newsticker_data[newsticker_data_counter];
pos_counter = -25;

setInterval("ScrollNewsticker()", 50);
