
var newsboxArea		= null;
var found_newsbox	= false;
var found_news		= false;

// Find target NewsBox area ...
var newsboxArea		= document.getElementById( "newsbox" );
if ( newsboxArea != null ) {
	found_newsbox	= true;
} else {
alert('news area not found');
	found_newsbox	= false;
}

// NewsBox on this page?
if ( found_newsbox ) {
	// Find NewsBox data ...
	if ( newsboxData.length != 0 ) {
		found_news		= true;
	} else {
alert('no news found');
		found_news		= false;
	}
	if ( !found_news ) {
		newsboxArea.style.display = 'none';
	} else {
		var fade_started		= 0;
		newsboxArea.innerHTML	= newsboxData[0];
		var currentNews			= -1;
		setTimeout('showNextNews()',5000);
	}
}



function showNextNews() {
	if( currentNews == -1 ) {
		currentNews = 0;
	}
	currentNews++;

	if ( currentNews >= newsboxData.length ) {
		currentNews = 0;
	}

	fade_started		= 0;
	fadeTrans('newsbox', newsboxData[currentNews], 1200);

	setTimeout('showNextNews()',5000);
}


function fadeTrans(id1, txt1, t1)
{
  if(fade_started==0)
  {
    fade_started=1;
    opacity(id1,100,0,t1);
    setTimeout("fadeTrans('"+id1+"', '"+txt1+"', "+t1+")",t1);
  }
  else
  {
	newsboxArea.innerHTML = newsboxData[currentNews];
    opacity(id1, 0, 100, t1);
    setTimeout("fadeTransComplete()",t1);
  }
}
function fadeTransComplete()
{
  fade_started=0;
}

