//This script is Copyright © 2005 by Lubois, LLC.
var pos = 0;
var Opera = window.opera ? true : false;
var menu, timer;
function findScrollTop() {
	var test=document.documentElement.scrollTop;
	if(test!=null && test!=0)
		return test;
	test=document.body.scrollTop;
	if(test!=null && test!=0)
		return test;
	test=window.pageYOffset
	if(test!=null && test!=0)
		return test;
	return (0);
}
function initFixing (id) {
	if (document.layers)
		menu = document[id];   
	else if (document.getElementById && !Opera)
		menu = document.getElementById(id);
	else if (document.all && !Opera) 
		menu = document.all[id];
	else if (Opera) 
	{
		menu = document.getElementById(id);
		document.getElementById("topNav").style.marginTop='8px';
		menu.style.marginLeft='8px';
	}
  
	timer = setInterval('checkPos()', 35);
	if (document.layers)
  		menu.visibility = 'show';
	else
		menu.style.visibility = 'visible';
}
function checkPos () {	
	var top=findScrollTop();
	if(pos!=top)
	{
		dif=(pos-top)/4;
		if(dif>.5||dif<-.5)
			pos=pos-dif;
		else
			pos=top;				
		move();		
	}	
}
function move(){
	var actPos=pos-150;
	if(actPos<=0)
		actPos=0;
	if (document.layers) 
		menu.paddingTop = actPos;
	else if (document.getElementById && !Opera)    
		menu.style.paddingTop = actPos + 'px';
	else	
		menu.style.paddingTop = actPos;
}
