
var iDelay = 25;
var iDiff = 5;
var iCellWidth = 11;
var iMaxWidth = 550;
var cellP = null;
var tP = null;

function news_scroll(cellNameA) {

	clearTimeout(tP);

	if (cellP == null) {
		cellP = getElementByID(cellNameA);
	}

	if (cellP == null)
		exit;

	if (iCellWidth >= iMaxWidth) {
		iCellWidth = 0;
	}

	iCellWidth += iDiff;
	cellP.width = iCellWidth + "px";

	tP = setTimeout("news_scroll('" + cellNameA + "')", iDelay);

	return;
}

function news_shoot(cellNameA) {

	clearTimeout(tP);

	if (cellP == null)
		cellP = getElementByID(cellNameA);

	if (cellP == null)
		exit;

	if (iCellWidth >= iMaxWidth) {
		iCellWidth = 0;
	}

	iCellWidth += iDiff;
	cellP.width = iCellWidth + "px";

	tP = setTimeout("news_shoot('" + cellNameA + "')", iDelay);

	return;
}

function news_bounce(cellNameA) {

	clearTimeout(tP);

	if (cellP == null)
		cellP = getElementByID(cellNameA);

	if (cellP == null)
		exit;

	if (iCellWidth <= 10) {
		iDiff = -1 * iDiff;
	}
	if (iCellWidth >= iMaxWidth) {
		iDiff = -1 * iDiff;
	}

	iCellWidth += iDiff;
	cellP.width = iCellWidth + "px";

	tP = setTimeout("news_bounce('" + cellNameA + "')", iDelay);

	return;
}

// returns the document element with the given ID
function getElementByID(id) {

var i = 0;

	for (i=0; i<document.all.length; i++) {
		if (document.all[i].id == id)
			return document.all[i];
	}

	return null;
}
