﻿function togglestatelinks()
{
     if (document.getElementById('statelinks').style.display == "block")
     {
       document.getElementById('statelinks').style.display = "none";
       document.getElementById('m1_1').src = "/_layouts/BCCS/IMAGES/open.gif";
     }
     else
     {
       document.getElementById('statelinks').style.display = "block";
       document.getElementById('m1_1').src = "/_layouts/BCCS/IMAGES/closed.gif";
     }
     setMainDivHeight();
}

function setMainDivHeight()
{
// Calculate available height
var availableHeight = getBrowserHeight();
var topDiv = document.getElementById("TopDiv");
if (topDiv)
{
	availableHeight -= (topDiv.offsetHeight);
}
var bottomDiv = document.getElementById("BottomDiv");
if (bottomDiv)
{
	availableHeight -= (bottomDiv.offsetHeight);
}
// Set MainDiv height
var mainDiv = document.getElementById("MainDiv");
mainDiv.marginHeight = 20;
mainDiv.outerHeight = mainDiv.offsetHeight + mainDiv.marginHeight;
var sideBar = document.getElementById("sidebar");

if (sideBar.offsetHeight > availableHeight)
{
    availableHeight = sideBar.offsetHeight + 20;
}
if (mainDiv.outerHeight < availableHeight)
{
	mainDiv.borderHeight = 0;
	mainDiv.paddingHeight = 0;
	if (typeof(mainDiv.style.minWidth) != "undefined") // Standards
	{
		mainDiv.style.minHeight = availableHeight - mainDiv.marginHeight - mainDiv.borderHeight - mainDiv.paddingHeight + "px";
	}
	else if (typeof(mainDiv.style.minHeight) != "undefined") // IE 6
	{
		mainDiv.style.height = availableHeight - mainDiv.marginHeight - mainDiv.borderHeight - mainDiv.paddingHeight - 4 + "px";
	}
	else // IE 5.x
	{
		mainDiv.style.height = availableHeight - mainDiv.marginHeight - 4 + "px";
	}
}
}
function getBrowserHeight()
{
if (window.innerHeight) // W3C
{
	return window.innerHeight;
}

else if (document.documentElement.offsetHeight) // IE 6 & 7
{
	return document.documentElement.offsetHeight;
}

else if (document.body.offsetHeight) // IE 5
{
	return document.body.offsetHeight;
}

return 0;
}

function GetAmber()
{
    var svcURL = parent.location.protocol + '//services.ito.state.il.us/agencycomponents/getBPFeatures.cfm?agency=bus' ;
    document.write(unescape("%3Cscript src='" + svcURL + "' type='text/javascript'%3E%3C/script%3E"));
}
