// JavaScript Document
var backgroundSpeed = 10000;
var backgroundCount = 0;

photos = new Array(11);
photos[0] = new Image();
photos[0].src = 'http://www.theprompt.com/images/brainbows/4.jpg';
photos[1] = new Image();
photos[1].src = 'http://www.theprompt.com/images/brainbows/5.jpg';
photos[2] = new Image();
photos[2].src = 'http://www.theprompt.com/images/brainbows/3.jpg';
photos[3] = new Image();
photos[3].src = 'http://www.theprompt.com/images/brainbows/1.jpg';
photos[4] = new Image();
photos[4].src = 'http://www.theprompt.com/images/brainbows/2.jpg';
photos[5] = new Image();
photos[5].src = 'http://www.theprompt.com/images/brainbows/6.jpg';
photos[6] = new Image();
photos[6].src = 'http://www.theprompt.com/images/brainbows/7.jpg';
photos[7] = new Image();
photos[7].src = 'http://www.theprompt.com/images/brainbows/8.gif';
photos[8] = new Image();
photos[8].src = 'http://www.theprompt.com/images/brainbows/9.gif';
photos[9] = new Image();
photos[9].src = 'http://www.theprompt.com/images/brainbows/10.gif';
photos[10] = new Image();
photos[10].src = 'http://www.theprompt.com/images/brainbows/11.gif';

function nextImage() {
	var el = document.body.style.backgroundImage;
	if(el.style) {
		el.style.opacity = backgroundCount/10;
		el.style.filter = 'alpha(opacity=' + backgroundCount*10 + ')';
	}
	if(backgroundCount==(photos.length - 1))
		backgroundCount = 0;
	var bgImage = photos[backgroundCount].src;
	document.body.style.backgroundImage = "url(" + bgImage + ")";
	backgroundCount++;
}
function changeBackground() {
	if(backgroundChanging) {
		nextImage();
		setTimeout("changeBackground()",backgroundSpeed);
	}
}
function startChanging() {
	backgroundChanging = true;
	changeBackground();
}
function stopChanging() {
	backgroundChanging = false;
}
function fasterBackground() {
	if(backgroundSpeed>=200)
		backgroundSpeed = backgroundSpeed - 100;
}
function slowerBackground() {
	backgroundSpeed = backgroundSpeed + 100;
}
function setOpacity(id,value) {
	var el = document.getElementById(id);
	if(el.style) {
		el.style.opacity = value/10;
		el.style.filter = 'alpha(opacity=' + value*10 + ')';
	}
}
startChanging();


