/*************************************************************************************
NOTICE: This software is authored and owned soley by Common Link, LLC 
Any use of this software, outside of Common Link staff, without 
express written autorization of Common Link, LLC, is strictly forbidden. 
*************************************************************************************/
// Turns the rendering of the layer on and off. Not accessible, and affects the layout.

function toggleDisplay(layer, state)
{
	var toggleDiv = document.getElementById(layer);

	if (state == 1) {
		toggleDiv.style.display = "block";
	} else {
		toggleDiv.style.display = "none";
	}
}


// Same as toggleDiv, but the layer is simply hidden.  Is accessible, and does not affect the layout.

function toggleHidden(layer, state)
{
	var toggleDiv = document.getElementById(layer);

	if (state == 1) {
		// Must be displayable to set as visible...
		toggleDiv.style.visibility = "visible";
	} else {
		toggleDiv.style.visibility = "hidden";
	}
}

function changeClass(layer, newStyle)
{
	var theElement = document.getElementById(layer);
	theElement.className = newStyle;
}

function opacity(layer, opacStart, opacEnd)
{
	//speed for each frame
	var timeToLoad = 0.5;   // In seconds.

	var speed = Math.round((timeToLoad * 1000)/100);
	var timer = 0;

	// Set the initial opacity...
	setOpacity(layer, opacStart);

	// Determine the direction for the blending, if start and end are the same nothing happens.
	if (opacStart > opacEnd) {
		for (i = opacStart; i >= opacEnd; i--) {
		setTimeout("setOpacity(" + "\"" + layer + "\"" + "," + i + ")", (timer * speed));
		timer++;
		}
	} else if (opacStart < opacEnd) {
		for (i = opacStart; i <= opacEnd; i++) {
		setTimeout("setOpacity(" + "\"" + layer + "\"" + "," + i + ")", (timer * speed));
		timer++;
		}
	}
}

// Change the opacity for different browsers
function setOpacity(layer, opacity)
{
	var divName = document.getElementById(layer);

	divName.style.opacity = (opacity / 100);
	divName.style.MozOpacity = (opacity / 100);
	divName.style.KhtmlOpacity = (opacity / 100);

	divName.style.filter = "alpha(opacity=" + opacity + ")";
}
