var images = new Array();
var width = new Array();
currentindex = 0;
interval = 5000;

images[0] = "/files/images/sponsors/sygentasmall.png";
images[1] = "/files/images/sponsors/diussmall.png";
images[2] = "/files/images/sponsors/ciesmall.png";
images[3] = "/files/images/sponsors/tgcsmall.png";
images[4] = "/files/images/sponsors/cupsmall.png";
images[5] = "/files/images/sponsors/bpsmall.png";

width[0] = 250;
width[1] = 119;
width[2] = 458;
width[3] = 147;
width[4] = 355;
width[5] = 56;


function tick(elementid)
{
	//$(elementid).src = images[4];

	//fadeOut(elementid);
	setTimeout("fadeOut('" + elementid + "')", interval);
	
	return false;
}

function fadeOut(elementid)
{
	//fade out
	new Effect.Opacity(elementid, {from: 1, to: 0, duration: 0.5});
	setTimeout("changeSrc('" + elementid + "')", 500);
}

function fadeIn(elementid)
{
	//fade in
	new Effect.Opacity(elementid, {from: 0, to: 1, duration: 0.5});
	tick(elementid);
}

function changeSrc(elementid)
{
	//go to next image
	currentindex++;
    if(currentindex == images.length) {
        currentindex = 0;
    }
	$(elementid).src = images[currentindex];
	$(elementid).width = width[currentindex];
	$(elementid).height = 75;
	fadeIn(elementid);
}