
	function FadePhoto()
	{
		currentIdx = -1;
		cycleTimer = null;
		useFilters = false;
		bAlt = true;
		
		useDynamic = (typeof(document.getElementById) != "undefined");
		
		if (useDynamic) 
		{
			if (typeof(document.getElementById("photoToFade1").filters)!= "undefined") 
				useFilters = true;
		}
		
		photoCache1 = new Array();
		photoCache1[0] = new Array("images/home1_1.jpg");
		photoCache1[1] = new Array("images/home1_2.jpg");
		photoCache1[2] = new Array("images/home1_3.jpg");
		
		photoCache2 = new Array();
		photoCache2[0] = new Array("images/home2_1.jpg");
		photoCache2[1] = new Array("images/home2_2.jpg");
		photoCache2[2] = new Array("images/home2_3.jpg");

		cycleImage();		
	}

	//Cycle through photos
	function cycleImage()
	{
		
		
		if (cycleTimer!=null) 
			clearTimeout(cycleTimer);
		
		if (bAlt)
		{
			var NextIdx = ++currentIdx; 
			if (NextIdx==photoCache1.length) 
				NextIdx=0;
				
			if (!useDynamic) 
			{
				document.images["photoToFade1"].src = photoCache1[NextIdx][0];
			} 
			else 
			{
				var container = document.getElementById("photoToFade1");
				var img = document.getElementById("photoToFade1");
				
				if (useFilters)	
					container.filters[0].apply();
					
				img.src = photoCache1[NextIdx][0];
				
				if (useFilters)
					container.filters[0].play();
			}
			currentIdx = NextIdx;
		}
		else
		{
			var NextIdx = ++currentIdx; 
			if (NextIdx==photoCache2.length) 
				NextIdx=0;
				
			if (!useDynamic) 
			{
				document.images["photoToFade2"].src = photoCache2[NextIdx][0];
			} 
			else 
			{
				var container = document.getElementById("photoToFade2");
				var img = document.getElementById("photoToFade2");
				
				if (useFilters)	
					container.filters[0].apply();
					
				img.src = photoCache2[NextIdx][0];
				
				if (useFilters)
					container.filters[0].play();
			}
			currentIdx = NextIdx;
		}
		bAlt = !bAlt;
		cycleTimer = setTimeout("cycleImage();",  3000);
	}

