// JavaScript Document

function initImage() {
		  imageId = 'thephoto';
		  image = document.getElementById(imageId);
		  setOpacity(image, 0);
		  image.style.visibility = 'visible';
		  fadeIn(imageId,0);
		}
		
		//The setOpacity function is passed an object and an opacity value. It then sets the opacity of the supplied object using four proprietary ways. It also prevents a flicker in Firefox caused when opacity is set to 100%, by setting the value to 99.999% instead.
		
		function setOpacity(obj, opacity) {
		  var browser =navigator.appName;
		  opacity = (opacity == 100)?99.999:opacity;
		  ///alert(browser);
		  if(browser=="Microsoft Internet Explorer"){
		  // IE/Win
		  obj.style.filter = "alpha(opacity:"+opacity+")";
		  }else{
		  // 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;
		  }
		}
		
		//The fadeIn function uses a Timeout to call itself every 100ms with an object Id and an opacity. The opacity is specified as a percentage and increased 10% at a time. The loop stops once the opacity reaches 100%:
		
		function fadeIn(objId,opacity) {
		  var obj;
		  if (document.getElementById(objId)) {
				obj = document.getElementById(objId);
			if (opacity <= 100) {
			  setOpacity(obj, opacity);
			  opacity += 5;
			  window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
			}
		  }
		}
		
		function fadeOut(objId,opacity) {
		  if (document.getElementById(objId)) {
			obj = document.getElementById(objId);
			if (opacity > 0) {
			  setOpacity(obj, opacity);
			  opacity -= 5;
			  window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
			}
		  }
		}

