nRow = 1;
pRow = 1;

function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if ( node == null )
	node = document;
  if ( tag == null )
	tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp('(^|\\\\s)'+searchClass+'(\\\\s|$)');
  for (i = 0, j = 0; i < elsLen; i++) {
	if ( pattern.test(els[i].className) ) {
		classElements[j] = els[i];
		j++;
	}
  }
  return classElements;
}
function hidePromo() {
  var c  = 0;
  var array1 = getElementsByClass('promo');

  while(c < array1.length){
    array1[c].style.display='none';
    c++;
  }
}
function showPromo(myDiv) {
  var mx = 'promo'+myDiv;
  document.getElementById(mx).style.display='';
}

function startPClock()
{
  showPHeadlines(pRow);
  var t=setTimeout("startPClock()",10000);
}
function showPHeadlines()
{
  pRow = pRow + 1;
  if (pRow > pTot)
  {
    pRow = 1;
  }
  hidePromo();
  showPromo(pRow);
}


function hideNewslines() {
  var c  = 0;
  var array1 = getElementsByClass('ndiv');

  while(c < array1.length){
    array1[c].style.display='none';
    c++;
  }
}
function showNewslines(myDiv) {
  var mx = 'ndiv'+myDiv;
  document.getElementById(mx).style.display='';
}

function startNClock()
{
  showNHeadlines(nRow);
  var t=setTimeout("startNClock()",10000);
}
function showNHeadlines()
{
  nRow = nRow + 1;
  if (nRow > nTot)
  {
    nRow = 1;
  }
  hideNewslines();
  showNewslines(nRow);
}
