// Copyright Leo Ponton 2005
// leo_ponton@yahoo.co.uk
//
function MenuSlider(id)
{
	/*
	Recursive.
	Functionality for vertically sliding sidebar menu that tracks the scrolled position of the page.
	
	Tested with IE6, Mozilla 1.2.1, Netscape 7, Opera 6.05
	*/
	
	var ie = navigator.appName.indexOf("xplorer")>=0;
	var doc = document;
	if (navigator.appName.indexOf("xplorer")>=0)
	{ // Internet Explorer doesn't properly implement the DOM
	
		var elem = doc.all[id];
		if (document.layers) elem.style = elem;
		var origY = parseInt(elem.style.top);
		elem.y = doc.body.scrollTop;
		
		window.slide = function()
		{
			//elem.y += Math.round((doc.body.scrollTop + origY - elem.y)/20);
			elem.y += (doc.body.scrollTop + origY - elem.y)/20;
			elem.style.top = elem.y;
			setTimeout("slide();", 1);
		}
	}
	else
	{ //Mozilla, Netscape and Opera do
	
		var elem = doc.getElementById(id);
		if (document.layers) elem.style = elem;
		var origY = parseInt(elem.style.top);
		elem.y = pageYOffset; 
	
		window.slide = function()
		{
			//elem.y += Math.round((ie?doc.body.scrollTop:pageYOffset + origY - elem.y)/20);
			elem.y += (ie?doc.body.scrollTop:pageYOffset + origY - elem.y)/20;
			elem.style.top = elem.y + (ie?"":"px");
			//window.status = origY + " : " + elem.y;
			setTimeout("slide();", 1);
		}
	}
	slide();
}

function reloadPage(init) {  //reloads the window if Nav4 resized...reqd for Opera
  if (init==true) with (navigator) 
  {
  	if ((appName=="Netscape")&&(parseInt(appVersion)==4)) 
	{
    	document.pWidth=innerWidth; 
		document.pHeight=innerHeight; 
		onresize=reloadPage; }}
  else if (innerWidth!=document.pWidth || innerHeight!=document.pHeight) 
  	location.reload();
}