//<![CDATA[

function setPage1()
{
	setFooter("column1", "column2");
	setMainColumnHeight("main_content_wrapper", 1);
}

function setPage2()
{
	setFooter("column1", "column2");
	setMainColumnHeight("main_content_wrapper", 2);
}

function setPage3()
{
	setFooter("column1", "column2");
	setMainColumnHeight("main_content_wrapper", 3);
}

function setFooterBlog()
{
	setFooter("content", "sidebar");
}

function setFooter(column1, column2)
{
	var iHeightHeader = $("header").offsetHeight;
	var iHeight1 = $(column1).offsetHeight;
	var iHeight2 = $(column2).offsetHeight;
	iFooterHeight = 20 + ((iHeight1 > iHeight2) ? iHeight1 : iHeight2);
	var ofooter = $("footer");
	if (window.innerHeight > (iFooterHeight + 232))
		ofooter.style.bottom = "0px";
	else
		ofooter.style.top = (232 + iFooterHeight + 12) + "px";
	ofooter.style.position = "absolute";
	ofooter.style.visibility = "visible";
}

function mouseOut(objectName, imageOut)
{
	if (document.images)
	{
		document[objectName].src = imageOut;
	}
}

function mouseOver(objectName, imageOver)
{
	if (document.images)
	{
		document[objectName].src = imageOver;
	}
}

function setCurrentMenu()
{
	sLocationPage = extractPageName(document.location.href);
	if (sLocationPage == "") sLocationPage = "index.html";

	var aMenu = $("menu").getElementsByTagName("a");
	for (var i=0; i<aMenu.length; i++)
	{
		sMenuPage = extractPageName(aMenu[i].href);
		if (sMenuPage == sLocationPage)       	
		{
			aMenu[i].style.color = "#ffe1a7";
			aMenu[i].style.background = "url(../img/lm-li-selected.gif) no-repeat left";
		}
	}

}

function extractPageName(sLocation)
{
    iIndex = sLocation.lastIndexOf("/");
	return sLocation.substring(iIndex + 1);
}

function stickydiv(sDiv)
{
	pos = document.documentElement.scrollTop;
	if (document.documentElement.scrollTop > 230) 
		$(sDiv).style.top = pos -230 + 5 + "px";
	else
		$(sDiv).style.top = '0';
}

function setMainColumnHeight(sMainColumn, iNumColumns)
{
	iNewHeight = 0;
	for (var i=1; i<(iNumColumns+1); i++)
	{
		sNewName = "column" + i;
		if ( $(sNewName).offsetHeight > iNewHeight)
			iNewHeight = $(sNewName).offsetHeight;
	}
	iNewHeight += 30;
	$("main_content_wrapper").style.height = iNewHeight + "px";
}

//]]>
