

var currentPhoto = 0;

var secondPhoto = 1;



var currentOpacity = new Array();

var imageArray = new Array("images/main/HF2005-2.jpg", "images/main/HF2005-3.jpg", "images/main/HF2006-2.jpg", "images/main/HF2006-3.jpg", "images/main/HF2006-4.jpg", "images/main/HF2006-5.jpg",  "images/main/HF2006-6.jpg", "images/main/PT2006-1.jpg", "images/main/CC2006-1.jpg", "images/main/HF2006-2.jpg", "images/main/GW1.jpg", "images/main/TV2006-1.jpg", "images/main/THM-1.jpg", "images/main/VD-1.jpg", "images/main/VD-2.jpg" );



var FADE_STEP = 2;

var FADE_INTERVAL = 10;

var pause = false;



function init(id) {

	if(id == 'hf2005')
		imageArray = new Array("images/hf05/HF2005-1.jpg", "images/hf05/HF2005-2.jpg", "images/hf05/HF2005-3.jpg", "images/hf05/HF2005-4.jpg", "images/hf05/HF2005-5.jpg", "images/hf05/HF2005-6.jpg", "images/hf05/HF2005-7.jpg", "images/hf05/HF2005-8.jpg", "images/hf05/HF2005-9.jpg", "images/hf05/HF2005-10.jpg", "images/hf05/HF2005-11.jpg", "images/hf05/HF2005-12.jpg", "images/hf05/HF2005-13.jpg", "images/hf05/HF2005-14.jpg", "images/hf05/HF2005-15.jpg", "images/hf05/HF2005-16.jpg", "images/hf05/HF2005-17.jpg" );
	else if(id =='hf2006')
		imageArray = new Array( "images/hf06/HF2006-11.jpg", "images/hf06/HF2006-12.jpg", "images/hf06/HF2006-13.jpg", "images/hf06/HF2006-14.jpg", "images/hf06/HF2006-15.jpg", "images/hf06/HF2006-16.jpg", "images/hf06/HF2006-17.jpg", "images/hf06/HF2006-18.jpg", "images/hf06/HF2006-19.jpg", "images/hf06/HF2006-20.jpg", "images/hf06/HF2006-21.jpg", "images/hf06/HF2006-22.jpg", "images/hf06/HF2006-23.jpg", "images/hf06/HF2006-24.jpg", "images/hf06/HF2006-25.jpg", "images/hf06/HF2006-26.jpg" );
	else if(id =='hf2007')
		imageArray = new Array("images/hf07/HF2007-1.jpg", "images/hf07/HF2007-2.jpg", "images/hf07/HF2007-3.jpg", "images/hf07/HF2007-4.jpg", "images/hf07/HF2007-5.jpg", "images/hf07/HF2007-6.jpg", "images/hf07/HF2007-7.jpg", "images/hf07/HF2007-8.jpg", "images/hf07/HF2007-9.jpg", "images/hf07/HF2007-10.jpg", "images/hf07/HF2007-11.jpg", "images/hf07/HF2007-12.jpg", "images/hf07/HF2007-13.jpg", "images/hf07/HF2007-14.jpg", "images/hf07/HF2007-15.jpg", "images/hf07/HF2007-16.jpg", "images/hf07/HF2007-17.jpg" );
	else if(id =='hf2008')
		imageArray = new Array("images/hf08/HF-2008-1.jpg", "images/hf08/HF-2008-2.jpg", "images/hf08/HF-2008-3.jpg", "images/hf08/HF-2008-4.jpg", "images/hf08/HF-2008-5.jpg", "images/hf08/HF-2008-6.jpg", "images/hf08/HF-2008-7.jpg", "images/hf08/HF-2008-8.jpg", "images/hf08/HF-2008-9.jpg", "images/hf08/HF-2008-10.jpg", "images/hf08/HF-2008-11.jpg", "images/hf08/HF-2008-12.jpg", "images/hf08/HF-2008-13.jpg", "images/hf08/HF-2008-14.jpg", "images/hf08/HF-2008-15.jpg", "images/hf08/HF-2008-16.jpg", "images/hf08/HF-2008-17.jpg" );	
	
	currentOpacity[0]=99;

	for(i=1;i<imageArray.length;i++)currentOpacity[i]=0;

	mHTML="";

	for(i=0;i<imageArray.length;i++)mHTML+="<div id=\"photo\" name=\"photo\" class=\"mPhoto\"><img src=\"" + imageArray[i]  +"\" WIDTH=400 HEIGHT=300 ></div>";

	document.getElementById("mContainer").innerHTML = mHTML;



	if(document.all) {

		document.getElementsByName("photo")[currentPhoto].style.filter="alpha(opacity=100)";

	} else {

		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = .99;

	}



	mInterval = setInterval("crossFade()",FADE_INTERVAL);

}



function crossFade() {

	if(pause)return;



	currentOpacity[currentPhoto]-=FADE_STEP;

	currentOpacity[secondPhoto] += FADE_STEP;



	if(document.all) {

		document.getElementsByName("photo")[currentPhoto].style.filter = "alpha(opacity=" + currentOpacity[currentPhoto] + ")";

		document.getElementsByName("photo")[secondPhoto].style.filter = "alpha(opacity=" + currentOpacity[secondPhoto] + ")";

	} else {

		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = currentOpacity[currentPhoto]/100;

		document.getElementsByName("photo")[secondPhoto].style.MozOpacity =currentOpacity[secondPhoto]/100;

	}



	if(currentOpacity[secondPhoto]/100>=.98) {

		currentPhoto = secondPhoto;

		secondPhoto++;

		if(secondPhoto == imageArray.length)secondPhoto=0;

		pause = true;

		xInterval = setTimeout("pause=false",2000);

	}

}



function doPause()  {

	if(pause) {

		pause = false;

		document.getElementById("pauseBtn").value = "pause";

	} else {

		pause = true;

		document.getElementById("pauseBtn").value = "play";

	}

}

function mostrarElemento(idElem)
{
	document.getElementById(idElem).style.display = "block";
}

function ocultarElemento(idElem)
{
	document.getElementById(idElem).style.display = "none";
}
