<!--//--><![CDATA[//><!--



function FeaturedStory(linkUrl, imagesect, headline, nutgraph)
{
	this.LinkUrl = linkUrl;
	this.imagesect = imagesect;
	this.Headline = headline;
	this.Nutgraph = nutgraph;
}

function Switch(featuredStoryIndex)
{
	FeaturedClick = 1;
	RotateStop();
	FeaturedStoryCurrentIndex = featuredStoryIndex;
	UpdateFeaturedStoryDisplay(featuredStoryIndex);
}

function SwitchPrevious()
{
	FeaturedClick = 1;
	RotateStop();
	RotatePrevious();
}

function SwitchNext()
{
	FeaturedClick = 1;
	RotateStop();
	RotateNext();
}

function RotatePlay()
{

	if (FeaturedClick == 0) {
		FeaturedStoryTimerId = window.setInterval('RotateNext()', FEATURED_STORY_ROTATE_INTERVAL);
	}

}

function RotateStop()
{

	if (FeaturedStoryTimerId != null)
	{
		window.clearInterval(FeaturedStoryTimerId);

		FeaturedStoryTimerId = null;
	}
}

function RotatePrevious()
{
	FeaturedStoryCurrentIndex--;

	if (FeaturedStoryCurrentIndex < 0)
	{
		FeaturedStoryCurrentIndex = FEATURED_STORY_COUNT - 1;
	}

	UpdateFeaturedStoryDisplay(FeaturedStoryCurrentIndex);
}

function RotateNext()
{
	FeaturedStoryCurrentIndex++;

	if (FeaturedStoryCurrentIndex == FEATURED_STORY_COUNT)
	{
		FeaturedStoryCurrentIndex = 0;
	}

	UpdateFeaturedStoryDisplay(FeaturedStoryCurrentIndex);
}

function UpdateFeaturedStoryDisplay(featuredStoryIndex)
{
	var headlineAnchor2 = document.getElementById('featuredstorylinkurl2');
	var slideshow = document.getElementById('featuredstoriesslideshownav');
	var nutgraph = document.getElementById('featuredstorynutgraph');
	var imagesect = document.getElementById('fsimgrpl');
	var slideshowAnchors = slideshow.getElementsByTagName('a');
	var highlightIndex = 0;
	var featuredStory = FeaturedStories[featuredStoryIndex];

	headlineAnchor2.href = featuredStory.LinkUrl;
	headlineAnchor2.innerHTML = featuredStory.Headline;
	nutgraph.innerHTML = featuredStory.Nutgraph;
	imagesect.innerHTML = featuredStory.imagesect;

	for (var anchorIndex = 0; anchorIndex < slideshowAnchors.length; anchorIndex++)
	{
		switch (slideshowAnchors[anchorIndex].className)
		{
			case 'sequenceoff':
			case 'sequenceon':
				if (highlightIndex == featuredStoryIndex)
				{
					slideshowAnchors[anchorIndex].className = 'sequenceon';
				}
				else
				{
					slideshowAnchors[anchorIndex].className = 'sequenceoff';
				}

				highlightIndex++;

				break;
		}
	}
}





//Featured Stories Slideshow on homepage
var FEATURED_STORY_ROTATE_INTERVAL = 10.0 * 1000; // milliseconds
var FEATURED_STORY_COUNT = 4;
var FeaturedStoryCurrentIndex = 0;
var FeaturedStoryTimerId = null;
var FeaturedClick = 0;
var FeaturedStories = new Array(FEATURED_STORY_COUNT);
var storyCount = 0;


function UpdateFeaturedVideoR(imageind, vidcont)
{
	var sectover = document.getElementById(vidcont);
	FeaturedStories[imageind].imagesect = sectover.innerHTML;
	sectover.innerHTML = '';
	UpdateFeaturedStoryDisplay(imageind);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(RotatePlay);





//--><!]]>