//
// Toggle various divs with fading. www.designbyfire.com
//

var main_divs = new Array( 
	  "regional", "pressContacts"  );
var current_div = "regional";


function storePos(){
document.cookie = "win_"+window.name+"="+document.body.scrollTop;
}
function lastPos(){
cVal = document.cookie.split("win_"+window.name+"=");
if(cVal.length==2){
window.scrollTo(0,parseInt(cVal[1]));
}
}

function showDiv(div_elem)  {
	
	if (div_elem == current_div) {
		return;
	}


//-- Changes the background position of the tabs depending on which is selected


	var tmp1 = document.getElementById('Rtmenu1');
	var tmp2 = document.getElementById('Rtmenu2');
	
	
	
	if (div_elem == "regional") {
		tmp1.style.color="#333";
		tmp2.style.color="#9b1d07";
	}
	if (div_elem == "pressContacts") {
		tmp1.style.color="#9b1d07";
		tmp2.style.color="#333";
		}
	
	
	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)";
			setTimeout('window.scrollTo(lastPos()',1);
		} else {
			current.style.opacity = 1;
		}
		current.style.display 			= "none";	
		whichDiv.style.display			= "block";
		
		//setTimeout('window.scrollTo(storePos())',1); 
		//window.scrollTo(storePos());		
		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;
}