// JavaScript Document

function scrollToDiv(divid)
{
	var div = document.getElementById(divid);
	window.scrollTo(0,div.offsetTop);
}
	
function loadPage(buttonId, pageUrl)
{
	var menuTable = top.document.getElementById('menuBar');
	
	var buttons = menuTable.getElementsByTagName('td');
	
	for (var i = 0; i < buttons.length; i++)
	{
		var button = buttons[i];
		
		if (button.className == "menuButtonSelected")
			button.className = "menuButton";
			
		if (button.id == buttonId)
			button.className = "menuButtonSelected";
			
		if (button.style.visibility == "hidden")
			button.style.visibility = "";
	}
	
	if (pageUrl)
	{
		var iframe = top.document.getElementById('contentIframe');
		iframe.src = pageUrl;
	}
}

function resizeIframe()
{
	// not necessary after all
	//top.document.getElementById('contentIframe').style.height = '403px';
}

function ensureInsideFrame()
{
	var doc_location = top.document.location.href;
	
	if (doc_location.search(/index\.html/) < 0 && top.document.location.href.search(/html/) > 0)
		document.location = '../index.html';
}