var currentActive = -1;
	
	var opacStart = 100;
	var state_min = 40;
	var state_max = 100;


	function opacity(id, opacStart, opacEnd, millisec)
	{
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;

		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd)
		{
			//for(i = opacStart; i >= opacEnd; i--)
			//{
			//	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			//	timer++;
			//}

			changeOpac(opacEnd, id);

		}
		
		else if(opacStart < opacEnd)
		{
			//for(i = opacStart; i <= opacEnd; i++)
			//{
			//	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			//	timer++;
			//}
			changeOpac(opacEnd, id);
		}
	}

	function changeOpac(opacity, id) {

	    var object = document.getElementById(id).style;
	    object.opacity = (opacity / 100);
	    object.MozOpacity = (opacity / 100);
	    object.KhtmlOpacity = (opacity / 100);
	    object.filter = "alpha(opacity=" + opacity + ")";
	}
	
	function fadeAll(teamPhotoId) {
		
		for (var i = 0; i< cntTeam; i++)
		{
			var ctrlId = "teamPhoto" + i
			opacity(ctrlId, state_max, state_min, 1)
		 }
		 setVisibility('biog', 'block')
		
		// now show all correclt tinted pics
		document.getElementById("dlTeam").style.display = 'block'
	} 
	
	function fadeIn(teamPhotoId) 
	{
		//for (var i = 0; i< cntTeam; i++)
		//{
			//if ((i == teamPhotoId)&&(i != currentActive))
			//{
				var ctrlId = "teamPhoto" + teamPhotoId
				//opacity(ctrlId, state_min, state_max, 100)
changeOpac(state_max, ctrlId);
			//}
		//}
		//getTeamDetails(teamPhotoId)
	} 

	function getTeamDetails(id){alert('j')
		var ctrlName =  document.getElementById("lblBiogName")
		var ctrlRole =  document.getElementById("lblBiogPosition")
		var ctrlEmail =  document.getElementById("hlBiogEmail")
		var ctrlBiog =  document.getElementById("lblBiog")

		ctrlName.innerHTML = teamBiogs[id][0]
		ctrlRole.innerHTML = teamBiogs[id][1]
		ctrlEmail.innerHTML = teamBiogs[id][2]
		ctrlBiog.innerHTML = teamBiogs[id][3]
		if(teamBiogs[id][3].length > 2){
			ctrlBiog.innerHTML += teamBiogs[id][5]
		}

	}
	
	function fadeOut(teamPhotoId) {

		for (var i = 0; i< cntTeam; i++)
		{
			// if photo is not active, fade out
			if (i != currentActive)
			{
//alert('fade out ' + i)
				var ctrlId = "teamPhoto" + i
				
				// if photo is current one, fade back out
				if(i == teamPhotoId)
				{
				opacity(ctrlId, state_max, state_min, 100)
				}
				
				// if photo is not current one do nothing
				else
				{
				opacity(ctrlId, state_min, state_min, 100)
				}
			}
			
			// if photo is the active one, do nothing
			else
			{
//alert('leave ' + i)				
//opacity(ctrlId, state_max, state_max, 100)
			}
		}
	} 

	function opaque(teamPhotoId, MasterId, CultureId)
	{
		// dont reset active photo if page is first loaded as there is not active photo
		if (currentActive != -1)
		{
			var ctrlId = "teamPhoto" + currentActive
			
			// reset previously selected Team photo
			//opacity(ctrlId, state_max, state_min, 1)
		}
		
		// set current active
		var ctrlId = "teamPhoto" + teamPhotoId
		//opacity(ctrlId, state_max, state_max, 100)
		
		// store id of the active photo
		//currentActive = teamPhotoId


		// show biog for clicked (active) team member
		setVisibility('biog', 'block')
		//displayBio(teamPhotoId)

	//AJAX_getBio(MasterId, CultureId)
	}

	function setVisibility(ctrl, state)
	{
		document.getElementById(ctrl).style.display = state;
	}
