function NewsArticle(headline, teaser, photo, photocaption, date, id)
{
	this.headline = headline;
	this.teaser = teaser;
	this.photo = photo;
	this.photocaption = photocaption;
	this.id = id;
	this.date = date;
	
	this.getHeadline = function()
	{
		return this.headline;
	}
	
	this.getTeaser = function()
	{
		return this.teaser;
	}
	
	this.getPhoto = function()
	{
		return this.photo;
	}
	
	this.getPhotoCaption = function()
	{
		return this.photocaption;
	}
	
	this.getId = function()
	{
		return this.id;
	}
	
	this.getDate = function()
	{
		return this.date;
	}
}

function BlurArticle(id)
{
	var source = articles[id];
	
	if( document.getElementById && source )
	{
		// set behind-image to the current image
		var tempsrc = GetElement("article-photo").src;
		GetElement("article-fadepair").src=tempsrc.length>0?tempsrc:source.getPhoto();
		// now full-alpha the front image (so we see the behind image)
		SetOpacity(0, "article-photo");
		
		// set the front image to the new one
		GetElement("article-photo").src = source.getPhoto();
		
		// and fade in the new image
		Fade("article-photo", 0, 100, 500);
		
		// swap textual elements
		GetElement("article-photo-caption").innerHTML = source.getPhotoCaption().length?source.getPhotoCaption():"&nbsp;";
		GetElement("article-headline").innerHTML = source.getHeadline();
		GetElement("article-date").innerHTML = source.getDate();
		GetElement("article-teaser").innerHTML = source.getTeaser() + ' <a href="dspArticle.cfm?news_id=' + source.getId() + '">MORE&gt;&gt;</a>';
	}
}

function GetElement(id)
{
	return document.getElementById(id);
}

/* slide show funcs */
var swapActive = true;
var delay = 8000;

function StartHeadlineTimer(idx)
{
	window.setTimeout("SwapHeadlines(" + idx + ");", delay);
}

function StopTimer()
{
	swapActive = false;
}

function SwapHeadlines(index)
{
	if( swapActive == true )
	{
		if( index >= sequence.length )
			index = 0;
			
		BlurArticle(sequence[index]);
		StartHeadlineTimer(index+1);
	}
}

// start slide show
StartHeadlineTimer(1);
