var currentDetail = 'ar';
var previousDetail = null;
var currentStyle = null;
var previousStyle = null;
var opacity = 100;
var initial = false;

function showBio(which) {
	if(document.getElementById(which+"Bio")||which=="all") {
		previousDetail = currentDetail;
		previousStyle = document.getElementById(previousDetail+'Bio');
	}
	
	if(previousDetail!=which) {
		currentDetail = which;
		if(which!="all") {
			currentStyle = document.getElementById(currentDetail+'Bio');
		}
		previousStyle = document.getElementById(previousDetail+'Bio');
		fadeOut();
	} 
}

var foId = null;
function fadeOut() {
	if(foId!=null) {
		clearTimeout(foId);
	}
	
	if(opacity>0) {
		opacity -= 5;
		previousStyle.style.opacity = opacity/100;
		previousStyle.style.filter = "alpha(opacity="+opacity+")";
		foId = setTimeout('fadeOut()',10);
	} else {
		opacity = 0; //just in case
		previousStyle.style.display="none";
		if(currentDetail!="all") {
			currentStyle.style.opacity = 0;
			currentStyle.style.filter = "alpha(opacity=0)";
			currentStyle.style.display="block";
		}
		foId = null;
		//bgId = setTimeout('setBackground()',500);
		fiId = setTimeout('fadeIn()',500);
	}
}

var fiId = null;
function fadeIn() {
	if(fiId!=null) {
		clearTimeout(fiId);
	}

	if(opacity<100) {
		opacity += 5;
		if(currentDetail!="all") {
			currentStyle.style.opacity = opacity/100;
			currentStyle.style.filter = "alpha(opacity="+opacity+")";
		} else {
			//leave this in case we need to show all
		}
		fiId = setTimeout('fadeIn()',10);
	} else {
		opacity = 100; //just in case
		fiId = null;
	}
}


