//document.write("<style type='text/css'>#thephoto {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_1 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_2 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_3 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_4 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_5 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_6 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_7 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_8 {visibility:hidden;}</style>");
document.write("<style type='text/css'>#thephoto_9 {visibility:hidden;}</style>");

function initThisImage(i,numPhotos) {
  if (i != 0) {
  	imageId = 'thephoto_'+i;
  	image = xGetElementById(imageId);
    if (image == null) return;
  }
  if (i == numPhotos)
    i = 1;
  else
    i++;
	imageId = 'thephoto_'+i;
	image = xGetElementById(imageId);
  if (image == null) return;
  image.style.visibility = "visible";
	setOpacity(image, 0);
	fadeIn(imageId,0);
  if (numPhotos > 1) {
    window.setTimeout("fadeOut(imageId,100)", 4000);
  	window.setTimeout("initThisImage('"+i+"',"+numPhotos+")", 4800);
  }
}
function initImage() {
	imageId = 'thephoto';
	image = xGetElementById(imageId);
  if (image == null) return;
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}
function initImageId(imageId) {
	image = xGetElementById(imageId);
  if (image == null) return;
  setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}
function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 15;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function fadeOut(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 15;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
		} else
  	  image.style.visibility = "hidden";
	}
}
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;
}