var number = 0;
var first = true;
function changePic() {
var frame1 = document.getElementById('frame1'); //This is the picture frame
var frame2 = document.getElementById('frame2'); //This is the second picture frame
	frame1.style.backgroundImage = 'url(' + theFiles[number] + ')'; //Set the new picture
if(first != true) { // dont change picture first time
	number++; } //goto next picture
	if(number == (theFiles.length)) { //When the current picture is equal to the heighest in the array reset to 0
		number = 0; }
	frame2.style.backgroundImage = 'url(' + theFiles[number] + ')'; //Set the second picture
if(first != true) { // dont change opacity first time
	changeOpac(); } 
first = false;
	setTimeout('changePic();',time); //recall this function after xxxx milisec
}
var opacity = 10; //No opacity
function changeOpac() {
var frame1 = document.getElementById('frame1'); //This is the picture frame
opacity -= 1; // lower value
	if(opacity >= 0) { //when not fully invisible
		frame1.style.opacity = (opacity / 10);  //change opacity for non IE browsers
		frame1.style.filter = 'alpha(opacity=' + (opacity * 10) + ')'; //change opacity for IE browsers
		setTimeout('changeOpac();',60); //recall function 
	}
	else { 
		opacity = 10; }
}	 

