<!-- Published: 7/19/2004 13:15 -->
// x21_layout
window.onload=function () {
	enableScrollButtons();
	resizeFrames();
}
var isResizing=0;
window.onresize=function () {
	if (!isResizing)
		isResizing=setTimeout("isResizing=0;resizeFrames();",200);
}
function resizeFrames() {
	var total=getWindowHeight();
	var topframe=document.getElementById("topdiv").offsetHeight;
	var taken=parseInt(topframe);
	var remainder=total - taken;
	remainder = (remainder < 30) ? 30 : remainder;
	document.getElementById("content").style.height=remainder+"px";
	document.getElementById("content").style.width=(getWindowWidth()-158)+"px";
	var meta=document.getElementById("meta").offsetHeight;
	taken += parseInt(meta);
	if (scrolling) taken += 34;
	remainder=total - taken;
	remainder = (remainder < 30) ? 30 : remainder;
	document.getElementById("menu").style.height=remainder+"px";
	checkScroll();
}
function getWindowHeight() {
var windowHeight=0;
	if (typeof(window.innerHeight)=='number')
		windowHeight=window.innerHeight;
	else
		if (document.documentElement&&document.documentElement.clientHeight)
			windowHeight=document.documentElement.clientHeight;
		else if (document.body&&document.body.clientHeight)
			windowHeight=document.body.clientHeight;
	return parseInt(windowHeight);
}
function getWindowWidth() {
var windowWidth=0;
	if (typeof(window.innerWidth)=='number')
		windowWidth=window.innerWidth;
	else
		if (document.documentElement&&document.documentElement.clientWidth)
			windowWidth=document.documentElement.clientWidth;
		else if (document.body&&document.body.clientWidth)
			windowWidth=document.body.clientWidth;
	return parseInt(windowWidth);
}
var scrolling=false;
var scrollButtonUp=null;
var scrollButtonDown=null;
function enableScrollButtons() {
	scrollButtonUp=document.getElementById("scrollup");
	scrollButtonDown=document.getElementById("scrolldown");
	if (scrollButtonUp)
	{
		scrollButtonUp.onmouseover=scrollUp;
		scrollButtonUp.onmouseout=stopScroll;
	}
	if (scrollButtonDown)
	{
		scrollButtonDown.onmouseover=scrollDown;
		scrollButtonDown.onmouseout=stopScroll;
	}
}
var scroller=0;
function checkScroll() {
	if (document.getElementById("menu").offsetHeight < frames[1].document.getElementById("menuitems").offsetHeight) {
		if (!scrolling)	enterScrollMode();
	} else {
		if (scrolling) leaveScrollMode();
	}
}
function enterScrollMode() {
	scrolling=true;
	document.getElementById("menu").style.height=(parseInt(document.getElementById("menu").style.height)-34)+"px";
	scrollButtonUp.style.display="block";
	scrollButtonDown.style.display="block";
}
function leaveScrollMode() {
	scrolling=false;
	scrollButtonUp.style.display="none";
	scrollButtonDown.style.display="none";
	document.getElementById("menu").style.height=(parseInt(document.getElementById("menu").style.height)+34)+"px";
	frames[1].scrollTo(0,0);
}
function scrollUp() {
	if (!scroller)
	{
		scroller=setInterval("frames[1].scrollBy(0,-2)",10);
		document.getElementById("scrollup").className="scrolluphi";
	}
}
function scrollDown() {
	if (!scroller)
	{
		scroller=setInterval("frames[1].scrollBy(0,2)",10);
		document.getElementById("scrolldown").className="scrolldownhi";
	}
}
function stopScroll() {
	if (scroller)
	{
		clearInterval(scroller);
		scroller=0;
		document.getElementById("scrollup").className="scrollup";
		document.getElementById("scrolldown").className="scrolldown";
	}
}


