
/*
 * Sliding Navigation 1.2
 *
 * by Aloys Maue (aloys.maue@javaxml.org), March 2001
 *
 * Feel free to use this code (see copyright notices below).
 * We would appreciate your modifications will be emailed to us.
 * Latest versions will be published at
 * http://www.javaxml.org
 *
 * Copyright (c) 2000-2001 javaxml.org
 *
 * We grant you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS", without a warranty of any kind.
 *
 * This script should be "cross browser compatible"
 * It is testet on Netscape 4.03, 4.05, 4.07, 4.51, 4.7, 6 and InternetExplorer 4.0, 5.0 and 5.5
 * Browser which do not support layers like Netscape versions below 4
 * and InternetExplorer versions below 4 causes no errors and they ignore the functions.
 * 
 * SlidingNavigation offers the possibility to slide a navigation layer
 * appropiate to the position of the browsers scrollbar
 *
 * This script needs an
 * 	window.onload = init;
 *	in a javascript section in html
 * or the
 *	onload="init()"
 *	attribute in the body tag.
 *  
 * New in version 1.2: - Netscape 6 and IE 5.5 BugFixes
 * New in version 1.1: - Timer implementation is more stable in IE
 *						 (was sometimes buggy in shaking up and down at one position)
 *					   - Now support for IE 5.x also with relative positioning
 *						 (Bug in IE5.x: Problems with property posTop (always 0) in absolute positioning)
 */
	var slideY0 = 0;
	var lastY = 0;
	var pos = 0;
	var tout = null;
	var slideLay = null;
	function getLayTop() {
		return layerTop(slideLay);
	}
	function setLayTop(y) {
		layerTop(slideLay, y);
	}
	function checkScrolling() {
		y = documentTop(document);
		if (lastY != y)
			slideTo(y + slideY0);
		lastY = y;
		setTimeout( "checkScrolling()", 10 );
	}
	function slideTo(endpos) {
		if (slideLay != null) {
			if (tout)
				clearTimeout(tout);
			else
				pos = layerTop(slideLay);     
			slide(endpos);
		}
	}
	function slide(endpos) {
		if (pos != endpos) {
			pos = pos + Math.floor((endpos - pos)/8);
			layerTop(slideLay, pos);
			cmd = "slide(" + endpos + ")";
			if (document.all)
				clearTimeout(tout);
			tout = setTimeout(cmd, 50);
		}
	}
	
	/**
	*  (C) 04/05/2001, David Florian - adaptation for any layer (original  was only for layer "navigation")
	*/
	
	function init(nameLay) {
		slideLay = getLayer(nameLay);
		if (slideLay != null) {
			slideY0 = layerTop(slideLay);
			layerShow(slideLay);
			checkScrolling();
		}
	}

