var opacityStepSize=5; // 100 full opacity
var frameTransitionTime=2000; // 1000 per second
var width=120,height=120;
var imageList=new Array();
if (document.images) {
	imageList[0]=new frame("http://www.prototec.co.nz/banners/database1-120x120.png",2000);
imageList[1]=new frame("http://www.prototec.co.nz/banners/database2-120x120.png",2000);
imageList[2]=new frame("http://www.prototec.co.nz/banners/database3-120x120.png",6000);
	document.write('<div id="prototecJSDiv" style="width:'+width+'px; height:'+height+'px; background-image:url('+imageList[1].img.src+')"><img id="prototecJSImg" src="'+imageList[0].img.src+'" width="'+width+'" height="'+height+'" border="0"/></div>');
	setTimeout('opacityUpdate()',imageList[0].time);
	document.getElementById('prototecJSDiv').style.backgroundImage="url("+imageList[1].img.src+")";
}
else document.write('<img src="database120x120.gif" width="120" height="120" />');
var currentFrame=0,currentOpacity=100,currentDirection=-1,nextFrame=1;
function frame(url,time) { this.time=time; this.img=new Image(); this.img.src=url; }
function opacityUpdate() {
	currentOpacity+=currentDirection*opacityStepSize;
	if(currentOpacity>=0 && currentOpacity<=100) {
		document.getElementById('prototecJSImg').style.opacity=currentOpacity/100;
		document.getElementById('prototecJSImg').style.filter="alpha(opacity="+(currentOpacity)+")"; // Stupid IE
		setTimeout('opacityUpdate()',Math.floor(frameTransitionTime*opacityStepSize/100));
	} else {
		if(currentDirection<0) document.getElementById('prototecJSImg').src=imageList[nextFrame].img.src;
		else document.getElementById('prototecJSDiv').style.backgroundImage="url("+imageList[nextFrame].img.src+")";
		setTimeout('opacityUpdate()',imageList[currentFrame].time);
		currentDirection=-currentDirection;
		currentFrame=nextFrame;
		nextFrame=(currentFrame+1)%(imageList.length);
}	}
