/*	-------------------------------------------------------------------------------- */

//	description: javascript for switch id in use with adobe flash

//	author: cornel boppart
//	date: may 2009

/*	-------------------------------------------------------------------------------- */
// please beware to make changes in this file!

/*	-------------------------------------------------------------------------------- */

// get flash movie object
var flashMovie;
var interval =	setInterval("detectAnchor()", 0);
var	loc = location.hash;

window.onload = init, interval;

function init() {
	if (document.getElementById) {
		flashMovie = document.getElementById("team");
	}
	
	var anchor = location.hash.split("#").join("");
	if (anchor != "") switchId(anchor);
}

function detectAnchor() {
	if (loc != location.hash) {
		loc = location.hash;
		window.location.href = window.location.href;
		return loc;
	}
}
	
function switchId(value) {
	var fadeSpeed = 100;
	var alpha1 = 25;
	var alpha2 = 100;

	if (flashMovie) {
		flashMovie.switchId(value, fadeSpeed, alpha1, alpha2);
	}
	
	var anchor = location.hash.split("#").join("");
	var team = window.location.search.substring(1);
	
	if (team == "id=team&team=business" || team == "id=team") {
		var value2 = value + "_business";
		var anchor2 = anchor + "_business";
	}
	else if (team == "id=team&team=freizeit") {
		var value2 = value + "_freizeit";
		var anchor2 = anchor + "_freizeit";
	}
	
	if (value != "") window.location.href = "#" + value;
	
	var id_prev = document.getElementById(anchor2);
	var id = document.getElementById(value2);
	var cl = document.getElementById(value);
	var cl_prev = document.getElementById(anchor);
	
	if (anchor2 != value2 && anchor2 != "_business" && anchor2 != "_freizeit" && id_prev.style.display != "none" && id_prev.style.display != "") id_prev.style.display = "none";
	if (id.style.display != "block" || id.style.display == "") id.style.display = "block";
	if (anchor != value && anchor != "" && cl_prev.className != "team_inactive") cl_prev.className = "team_inactive";
	if (cl.className != "team_active" || cl.className == "") cl.className = "team_active";
}
