/*

Copyright (C) Claudio Frau - 2004
Zephir Software Design AG

*/


var navbox_htmlObjectId = "nav_box_foot";

var browserType = "";
var flag_navbox_initialized = false;

function initNavbox() {
	if (flag_navbox_initialized == false) {
		getBrowserType();
		reposition();
		flag_navbox_initialized = true;
	}
}


function getBrowserType() {
	// Opera 7 and higher
	if (window.opera && document.createComment && window.print) {
		browserType = "OPERA7";
	}
	
	// Opera 6 and below
	else if (window.opera && !document.createComment) {
		browserType = "OPERA6";
	}
	
	// Mozilla/Netscape or compatible
	else if (window.innerHeight && window.innerWidth && !window.opera) {
		browserType = "MOZ";
	}
	
	// IE 5 Mac
	else if (document.all && !document.mimeType) {
		browserType = "IE5MAC";
	}
	
	// IE 5
	else if (document.all && !document.fireEvent && !window.opera) {
		browserType = "IE5";
	}
	
	// IE 6
	else if (document.all && document.fireEvent && document.createComment) {
		browserType = "IE6";
	}

}


function getWindowHeight() {
	if (browserType == "MOZ") {
		return window.innerHeight;
	}
	else if (browserType == "IE5MAC") {
		return document.body.clientHeight;
	}
	else if (browserType == "IE5") {
		return document.body.clientHeight;
	}
	else if (browserType == "IE6") {
		return document.documentElement.clientHeight;
	}
	else if (browserType == "OPERA6") {
		return self.innerHeight;
	}
	else if (browserType == "OPERA7") {
		return self.innerHeight;
	}
	else {
		return 0;
	}
}


function getScrollOffset() {
	var scrollOffset = 0;
	
	if (window.pageYOffset) {
		scrollOffset = window.pageYOffset;
	}
	else if (document.body.scrollTop) {
		scrollOffset = document.body.scrollTop;
	}
	else if (document.documentElement.scrollTop) {
		scrollOffset = document.documentElement.scrollTop;
	}
	
	return scrollOffset;
}


function reposition() {
		
	var scrollAmount;
	var repositionAmount;
	var repositionLimit;
	
	var windowHeight = getWindowHeight();
	
	var NavObject = document.getElementById(navbox_htmlObjectId);
	var objHeight = NavObject.offsetHeight;
	

	// ==================================================
	// Internet Explorer 5 + 6
	// ==================================================
	if(browserType == "IE5" || browserType == "IE6" ) {
		
		NavObject.style.position = "absolute";
		
		if (browserType == "IE5") {
			scrollAmount = document.body.scrollTop; // get IE 5 scrollTop
			repositionAmount = (windowHeight + scrollAmount - objHeight); // -4 pixels hack fixes IE 5 position bug
			
		}	
			else if(browserType == "IE6") {

				scrollAmount = document.documentElement.scrollTop; // get IE 6 scrollTop
				repositionAmount = (windowHeight + scrollAmount - objHeight);
			}

		// alert ("repositionLimit = " + repositionLimit + ", Windowheight = " + windowHeight + ", scrollAmount = " + scrollAmount + ", repositionAmount = " + repositionAmount + ", objHeight = " + objHeight);
		
		// Fix IE 5 scroll overflow bug
		if (repositionAmount != repositionLimit) {
			NavObject.style.top	= repositionAmount + "px";
		}
	}
	
	// ==================================================
	// Mozilla or compatible
	// ==================================================			
	else if(browserType == "MOZ") {
		
	
		// NavObject.style.position = 'fixed';
		// NavObject.style.top	= (windowHeight - objHeight) + 'px';
		
		
	}
	
	// ==================================================
	// Internet Explorer 5 Mac
	// ==================================================
	else if (browserType == "IE5MAC") {
		
		NavObject.style.position = "absolute";
		
		scrollAmount = document.body.scrollTop; // get IE 5 Mac scrollTop
		
		repositionAmount = (windowHeight + scrollAmount - objHeight);
		
		repositionLimit = (repositionAmount - windowHeight + objHeight);

		NavObject.style.top	= repositionAmount + "px";

		setTimeout("reposition()", 500);
		
	}
	
	// ==================================================
	// Opera 6
	// ==================================================
	else if(browserType == "OPERA6") {
	
		repositionAmount = (windowHeight - objHeight);
		NavObject.style.top	= repositionAmount + 'px';
		setTimeout("reposition()", 350);
		
	}
	
	// ==================================================
	// Opera 7
	// ==================================================
	else if(browserType == "OPERA7") {
	
		NavObject.style.bottom = "1px";
		NavObject.style.bottom = "0px";
		
	}


} // reposition()









