// JavaScript Document
pic1= new Image(); 
pic2= new Image(); 
pic3= new Image(); 
pic1.src="http://www.dalbr.com/images/photo1.png";
pic2.src="http://www.dalbr.com/images/photo2-1.jpg";
pic3.src="http://www.dalbr.com/images/photo3-1.jpg";

var imageLocations0 = new Array("photo1.png","photo2.png","photo3-1.png")
var imageLocations1 = new Array("photo2.png","photo3.png","photo1.png")
var imageLocations2 = new Array("photo3.png","photo1.png","photo2.png")
var currentImg0 = 0;
var currentImg1 = 0;
var currentImg2 = 0;

function callFadeOut0 () {
	window.setTimeout("fadeOut(\"thephoto0\",100)",9500);
} // end function
function startUpRotation0() {
	imageId = 'thephoto0';
	document.getElementById("photoHolder0").innerHTML="<img src='http://www.dalbr.com/images/"+imageLocations0[currentImg0]+"' alt='Photo' name=\"thephoto0\" id='thephoto0' />";
	currentImg0++;
	if (currentImg0>=imageLocations0.length) {currentImg0=0}
	window.setTimeout("startUpRotation0()", 11100);
	callFadeOut0 ()
	initImage0();
} // end function
function initImage0() {
  imageId = 'thephoto0';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}


function callFadeOut1 () {
	window.setTimeout("fadeOut(\"thephoto1\",100)",9500);
} // end function
function startUpRotation1() {
	imageId = 'thephoto1';
	document.getElementById("photoHolder1").innerHTML="<img src='http://www.dalbr.com/images/"+imageLocations1[currentImg1]+"' alt='Photo' name=\"thephoto1\" id='thephoto1' />";
	currentImg1++;
	if (currentImg1>=imageLocations1.length) {currentImg1=0}
	window.setTimeout("startUpRotation1()", 11100);
	callFadeOut1 ()
	initImage1();
} // end function
function initImage1() {
  imageId = 'thephoto1';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}


function callFadeOut2 () {
	window.setTimeout("fadeOut(\"thephoto2\",100)",9500);
} // end function
function startUpRotation2() {
	imageId = 'thephoto';
	document.getElementById("photoHolder2").innerHTML="<img src='http://www.dalbr.com/images/"+imageLocations2[currentImg2]+"' alt='Photo' name=\"thephoto2\" id='thephoto2' />";
	currentImg2++;
	if (currentImg2>=imageLocations2.length) {currentImg2=0}
	window.setTimeout("startUpRotation2()", 11100);
	callFadeOut2 ()
	initImage2();
} // end function
function initImage2() {
  imageId = 'thephoto2';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}
function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;

  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";

  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;

  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;

  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}
function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity < 100) {
      setOpacity(obj, opacity);
      opacity += 5;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 75);
    }
  }
}
function fadeOut(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity > 0) {
      setOpacity(obj, opacity);
      opacity -= 5;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 75);
    }
  }
}

function fadeOutFirst(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity > 0) {
      setOpacity(obj, opacity);
      opacity -= 5;
      window.setTimeout("fadeOutFirst('"+objId+"',"+opacity+")", 75);
    } // end if
	else {
		switch (objId) {
			case "thephoto0": startUpRotation0(); break;
			case "thephoto1": startUpRotation1(); break;
			case "thephoto2": startUpRotation2(); break;
		} // end switch
	} // end else
  } // end if
} // end function


