function opacity(id, opacStart, opacEnd, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
	if(opacStart==0) {
		document.getElementById(id).style.display = "block";
	} else {
		setTimeout('document.getElementById("'+id+'").style.display = "none"',millisec);
	}
}
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 Fensterhoehe () {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	} else {
		return 0;
	}
}
function Fensterweite () {
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	} else {
		return 0;
	}
}

function changeLand(a) {
	ps = document.getElementsByTagName("p");
	for(i=0;i<=ps.length;i++) {
		if(ps[i]) {
			if(ps[i].className=="importer") {
				ps[i].style.display = "none";
			} else if(ps[i].className=="displayNone importer") {
				ps[i].style.display = "none";
			}
		}
	}
	/*alert(document.getElementById(a.value).innerHTML);*/
	document.getElementById(a.value).style.display = "block";
}

function showDetail(a,b) {
	if(b==1) {
		opacity(a,100,0,500);
		setTimeout("opacity('mainDetail',0,100,1000)",500);
	} else {
		opacity("mainDetail",100,0,500);
		setTimeout("opacity('"+a+"',0,100,1000)",500);
	}
}

function rang(a) {
	for(i=0;i<16;i++) {
		if(document.getElementById("rang"+i)) {
			document.getElementById("rang"+i).style.display = "none";
		}
	}
	document.getElementById("rang"+a).style.display = "block";
	if(document.getElementById("rang"+(a+1))) {
		document.getElementById("rangLink").href = "javascript:rang("+(a+1)+")";
	} else {
		document.getElementById("rangLink").href = "javascript:rang(0)";
	}
}

function language(a) {
	document.location = "?site="+document.getElementById('aktuelleSeite').value+"&lang="+a;
}

function load(obj,lang) {
	var browserName = navigator.appName;
	if(browserName == "Microsoft Internet Explorer") {
		document.location = "?site="+obj+"&lang="+lang;
	} else {
		opacity("content",100,0,500);
		window.setTimeout("makePOSTRequest('/functions/load.php', 'site="+obj+"&lang="+lang+"')",500);
		window.setTimeout('opacity("content",0,100,1000)',750);
		document.getElementById('aktuelleSeite').value = obj;
	}
}

function nav(a) {
	document.getElementById(a+"Sub").style.display = "block";
}
function hideNav() {
	document.getElementById("boardsSub").style.display = "none"
	document.getElementById("teamSub").style.display = "none"
}
// image Show | kein Bock mehr also viele Funktionen mit der selben aufgabe - copy paste
function imageShowJonas(a) {
	string = a.src;
	string = string.split("/");
	string = string[7].replace(/THUMB_/gi,"");
	opacity("imageShowJonasI",100,0,250);
	window.setTimeout('document.getElementById("imageShowJonasI").src = "/riders/images/gallery/jonas/'+string+'";',250);
	window.setTimeout('opacity("imageShowJonasI",0,100,500);',300);
}
function imageShowDan(a) {
	string = a.src;
	string = string.split("/");
	string = string[7].replace(/THUMB_/gi,"");
	opacity("imageShowDanI",100,0,250);
	window.setTimeout('document.getElementById("imageShowDanI").src = "/riders/images/gallery/dan/'+string+'";',250);
	window.setTimeout('opacity("imageShowDanI",0,100,500);',300);
}
function imageShowAnders(a) {
	string = a.src;
	string = string.split("/");
	string = string[7].replace(/THUMB_/gi,"");
	opacity("imageShowDanI",100,0,250);
	window.setTimeout('document.getElementById("imageShowAndersI").src = "/riders/images/gallery/anders/'+string+'";',250);
	window.setTimeout('opacity("imageShowAndersI",0,100,500);',300);
}
function imageShowMartin(a) {
	string = a.src;
	string = string.split("/");
	string = string[7].replace(/THUMB_/gi,"");
	opacity("imageShowMartinI",100,0,250);
	window.setTimeout('document.getElementById("imageShowMartinI").src = "/riders/images/gallery/martin/'+string+'";',250);
	window.setTimeout('opacity("imageShowMartinI",0,100,500);',300);
}
function imageShowAndrea(a) {
	string = a.src;
	string = string.split("/");
	string = string[7].replace(/THUMB_/gi,"");
	opacity("imageShowAndreaI",100,0,250);
	window.setTimeout('document.getElementById("imageShowAndreaI").src = "/riders/images/gallery/andrea/'+string+'";',250);
	window.setTimeout('opacity("imageShowAndreaI",0,100,500);',300);
}



var http_request = false;
function makePOSTRequest(url, parameters) {
	http_request = false;
	if (window.XMLHttpRequest) {
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Es kann kein XMLHttp Instanz erstellt werden.');
		return false;
	}
	http_request.onreadystatechange = alertContents;
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}
function alertContents() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			result = http_request.responseText;
			document.getElementById('content').innerHTML = result;            
		}
	}
}
