//
// Toggle various divs with fading. Look! An Ajaxalope!
//
var main_divs = new Array( 
	"story", "mod_schedule", "mod_schedule", "mod_about", "mod_contact", 
	"mod_handbook", "mod_schools", "mod_teachers", "mod_likenoother"  );
var current_div = "story";

function showDiv(div_elem)  {
	
	if (div_elem == current_div) {
		return;
	}

	var tmp = document.getElementById(div_elem);
	window.setTimeout(function() {fadeOut(tmp, 100);}, 10);

}

function fadeOut(whichDiv, alpha) {
	var current = document.getElementById(current_div);
	if (alpha >= 0) {
		new_alpha = alpha - 5;
		if (document.all) {
			current.style.filter = "alpha(opacity=" + new_alpha + ")";
		} else {
			current.style.opacity = (new_alpha/100);
		}
		window.setTimeout(function() {fadeOut(whichDiv, new_alpha);}, 10);
	} else {
		if (document.all) {
			current.style.filter = "alpha(opacity=100)";
		} else {
			current.style.opacity = 1;
		}
		current.style.display 			= "none";	
		whichDiv.style.display			= "block";
		
		window.scrollTo(0,0);		
		fadeIn(whichDiv, 0);
	}
}

function fadeIn(whichDiv, alpha) {
	if (alpha <= 100) {
		new_alpha = alpha + 5;
		if (document.all) {
			whichDiv.style.filter = "alpha(opacity=" + new_alpha + ")";
		} else {
			whichDiv.style.opacity = (new_alpha/100);
		}
		window.setTimeout(function() {fadeIn(whichDiv, new_alpha);}, 10);
	} else {
		current_div = whichDiv.id;
	}
}

function showThisContent(whichDiv)  {
	
	//
	// This function does nothing. It's only here to make the link look like it's
	// worth clicking on and therefore disguising the fact that it does indeed
	// do nothing.
	//

	return whichDiv;
}