// JavaScript Document

function SmallGrantsSlideshow( imageID, creditID)
{
	this.image_element = document.getElementById(imageID);
	this.credit_element = document.getElementById(creditID);
	this.images = new Array();
}
							

SmallGrantsSlideshow.prototype.addImage = function( filename, credit )
{
	var img = new Object();
	img.filename = filename;
	img.credit = credit;
	this.images.push(img);
}

SmallGrantsSlideshow.prototype.showImage = function( index )
{
	var nextIndex = (index + 1) % this.images.length;
	window.setTimeout( 'slideshow.showImage(' + nextIndex + ')', 3000 );
	this.image_element.src = 'http://www.sog.unc.edu/programs/civiced/programs/images/small_grants_slideshow/' + this.images[index].filename;
	var credit = this.images[index].credit;
	if(  credit != '' ) credit = 'Photo by ' + credit;
	this.credit_element.innerHTML = credit;
}

SmallGrantsSlideshow.prototype.start = function()
{
	this.showImage(0);
}