/********************************************
*                                           *
* SCRIPT: Flying Top                        *
* AUTHOR: Johannes Meyknecht, eMedia)Fabrik *
* COPYRIGHT: eMedia)Fabrik                  *
* WEBSITE: http://www.emediafabrik.de       *
*                                           *
********************************************/

// Hier die Startposition anpassen
position_start = 0;
lastScrollY = 0;

// Browsererkennungen gegebenenfalls erweitern/updaten
NS = (document.layers) ? 1 : 0;
IE = (navigator.appName.indexOf("Microsoft Internet Explorer") != "-1") ? 1 : 0;
OP = ((document.getElementById) && (navigator.appName == "Opera")) ? 1 : 0;
MOZ = ((document.getElementById) && (navigator.appName == "Netscape")) ? 1 : 0;
Kon = (navigator.appName.indexOf("Konqueror") != "-1") ? 1 : 0;

if (IE) {
	position = document.all.beamMeUp.style.pixelTop;
}

if (OP) {
	position = document.getElementById("beamMeUp").style.pixelTop;
}

if (NS) {
	position_start = 0;
	position = document.beamMeUp.top;
}

if (MOZ) {
	position = document.getElementById("beamMeUp").offsetTop;
}

if (Kon) {
	position = document.getElementById("beamMeUp").offsetTop;
}

function abstand() {
	if (IE || MOZ || Kon) { diffY = document.body.scrollTop; }
	if (NS) { diffY = self.pageYOffset; }
	if (OP) { diffY =  document.getElementsByTagName("body") [0] .scrollTop; }

	if (diffY != lastScrollY) {
		// Hier Faktor für smooth-Scrolling anpassen
		percent = .03 * (diffY - lastScrollY);
		if (percent > 0) percent = Math.ceil(percent);
		else percent = Math.floor(percent);
		if (IE) {
			position += percent;
			document.all.beamMeUp.style.pixelTop = position + position_start;
		}
		if (OP) {
			position += percent;
			document.getElementById("beamMeUp").style.pixelTop = position + position_start;
		}
		if (NS) {
			position += percent;
			document.beamMeUp.top = position + position_start;
		}
		if (MOZ || Kon) {
			position += percent;
			document.getElementById("beamMeUp").style.top = position + position_start;
		}

		lastScrollY = lastScrollY + percent;
		//window.status=lastScrollY;
	}
}

if (NS || IE || OP || MOZ || Kon) action = window.setInterval("abstand()",1);