var aryLights = new Array()
var heightMargin = 2;			// Reduce the height of the resized object by this amount

function setHeightToParent(x)
	{
	// Set the object with id of 'x' to its parent's visual height
	var objToStretch = document.getElementById(x);
	var objParent = objToStretch.parentNode;

	var parentHeight = objParent.offsetHeight;

	objToStretch.style.height = (parentHeight-heightMargin) + "px";
	}

function showObject(x)
	{
	var objToShow = document.getElementById(x);
	objToShow.style.display = "inline";
	}

function prepare(x)
	{
	// Add the reference to the light's ID to the array.
	// This array is then used by the window.onLoad function.
	// It will first go through each and set their height
	// and then make them all visible.

	var nextIndex = aryLights.length;
	aryLights[nextIndex] = x;
	}

function sizeAndShow()
	{
	// Find lights
	var lIndex = 1;
	var justInCase = 0;
	var lID = "winlight-" + lIndex;

	while (document.getElementById(lID) && justInCase<20)
		{
		justInCase++;

		prepare(lID);

		lIndex++;
		lID = "winlight-" + lIndex;
		}

	for (i=0; i<aryLights.length; i++)
		{
		setHeightToParent(aryLights[i]);
		showObject(aryLights[i]);
		}
	}

if (window.addEventListener)
	{
	// FF / NS version
	//invoke function
	window.addEventListener("load", sizeAndShow, false);

	//function invoked again, since no event handler conflicts
	//window.onload=sizeAndShow();
	}

if (window.attachEvent)
	{
	// IE version
	//invoke function
	// window.attachEvent("onload", sizeAndShow);

	// IE hates PNGs... }:(
	}
