//---- Set this variable only! ----
var buildDir = "/includes/";
var YOffset = 10;
var staticYOffset = 17;
//---------------------------------

var ie4 = false, ie5_mac = false, ie55 = false;
var nn4 = false, dom = false;
var agent = navigator.userAgent.toLowerCase();

if (document.all)
{
	var version = parseFloat(agent.substr(agent.indexOf("msie")+5, 3));
	if (agent.indexOf("mac") != -1 && version >= 5)
		ie5_mac = true;
	else
	{
		if (version >= 5.5)
			ie55 = true;
		else if (version >= 4)
			ie4 = true;
	}
}
//else if (document.layers)
else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4 && 
	parseInt(navigator.appVersion) < 5)
	nn4 = true;
else if (document.getElementById)
	dom = true;

var blank = new Image();
blank.src = buildDir + "blank.gif";

if (ie4)
	document.write('<script type="text/javascript" src="' + buildDir + 'ie4-build.js"></script>');
else if (ie5_mac)
	document.write('<script type="text/javascript" src="' + buildDir + 'ie5m-build.js"></script>');
else if (ie55)
	document.write('<script type="text/javascript" src="' + buildDir + 'ie55-build.js"></script>');
else if (nn4)
	document.write('<script type="text/javascript" src="' + buildDir + 'ns4-build.js"></script>');
else if (dom)
	document.write('<script type="text/javascript" src="' + buildDir + 'dom-build.js"></script>');
else
{
	alert("Your browser doesn't support this script.");
	location.href = buildDir + "upgrade.html";
	document.write('<script type="text/javascript" src="' + buildDir + 'no-build.js"></script>');
}

// ------------------------- Scroll - by BowiePT ------------------------ //

///// BROWSER DETECTION /////
NS6 = (document.getElementById&&!document.all);
IE = (document.all);
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4");

function getScrollTop() {
	var s = 0;
	if (document.documentElement && document.documentElement.scrollTop) {
		s = document.documentElement.scrollTop;
	}
	else if (document.body && document.body.scrollTop) {
		s = document.body.scrollTop;
	}
	return s;
}

///// STATIC FUNCTION /////
lastY 	= 0;
savedY 	= 0;
function makeStatic() {
	if (IE) {winY = getScrollTop();}
	if (NS||NS6) {winY = window.pageYOffset;}
	
	if (NS6||IE||NS) {
		if (winY != lastY && winY>YOffset-staticYOffset) {
			smooth = .3 * (winY - lastY - YOffset + staticYOffset);
		} else 
			if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) {
				smooth = .3 * (winY - lastY);
			} else 
				smooth=0;
			
		if (smooth > 0) 
			smooth = Math.ceil(smooth);
		else 
			smooth = Math.floor(smooth);
		
		lastY = lastY + smooth;
		
		if (lastY != savedY) {
			scrollAll()
			savedY = lastY
		}
		
		setTimeout('makeStatic()', 1);
	}
}

makeStatic()

function scrollAll()
{
	var i;
	if (!menus)
		return
		
	for (i=0; i<menus.length; i++)
	{
			menus[i].main.style.top = menus[i].sOffY + lastY;
	}
	
	for (i=0; i<menus.length; i++)
		for (j=0; j<menus[i].activeItems.length; j++)
			eval(menus[i].activeItems[j]);
}

// -----------------------------------------------------

