

/*********** Slide up / down ***********/

// slide increments - higher values are faster
var goAmount = 175;

// slide delay - higher values are slower
var goTime = 0;

// height that the content finishes at
var newHeight = 345;

// height that the content starts at
var originalHeight = 345;

// additional height padding
var heightPadding = 55;



var isSliding = false;

function slideContent(inObject,inHeight)
{
	inObjectID = document.getElementById(inObject);

	if(inHeight == 'auto')
	{
		isSliding = true;
		doSlide(inObject,"down");
		document.getElementById("slide_down").style.display = 'none';
		document.getElementById("slide_up").style.display = 'inline';
	}
	else
	{
		isSliding = true;
		doSlide(inObject,"up");
		document.getElementById("slide_down").style.display = 'inline';
		document.getElementById("slide_up").style.display = 'none';
	}
}


function getDimensions(inObject)
{
	var inObjectID = document.getElementById(inObject);

	inObjectIDfullHeight = inObjectID.offsetHeight + heightPadding;

	inObjectID.style.height = originalHeight + "px";
	inObjectID.style.overflow = "auto";

	var contentSectionID = document.getElementById("content_section");
	contentSectionID.style.visibility = "visible";

	var bodyID = document.getElementById("products_body");
	bodyID.style.height = "auto";
	bodyID.style.overflow = "auto";
}


function doSlide(inSlideObject,whichWay)
{
	inSlideObjectID = document.getElementById(inSlideObject);

	if(isSliding == true)
	{
		if(whichWay == "down")
		{
			if(newHeight < inObjectIDfullHeight)
			{
				inSlideObjectID.style.height = newHeight + "px";
				newHeight = newHeight + goAmount;
				setTimeout('doSlide("scroll_content","down")',goTime); // need to get rid of the hardcoded id
			}
			else
			{
				isSliding = false;
				inSlideObjectID.style.height = inObjectIDfullHeight + "px";
			}
		}
		else
		{
			if(newHeight > originalHeight)
			{
				inSlideObjectID.style.height = newHeight + "px";
				newHeight = newHeight - goAmount;
				setTimeout('doSlide("scroll_content","up")',goTime); // need to get rid of the hardcoded id
			}
			else
			{
				isSliding = false;
				inSlideObjectID.style.height = originalHeight + "px";
			}
		}
	}

}


/*
	get dimensions of page (for debugging)
*/

	function getDims(inObject)
	{
		inObjectID = document.getElementById(inObject);
		alert("inObject.offsetHeight=" + inObjectID.offsetHeight + "\n\n" + "inObject.style.height=" + inObjectID.style.height + "\n\n" + "inObjectID.style.top=" + inObjectID.style.top);
	}


/*** de-hi-lites background object ***/
function noliteBG()
{
	var liElements = document.getElementsByTagName("li");
	for(var i=0; i < liElements.length; i++)
	{
		var node = liElements.item(i);
		for(var j=0; j < node.attributes.length; j++)
		{
			if((node.attributes.item(j).nodeName == 'class') || (node.attributes.item(j).nodeName == 'CLASS'))
			{
				if(node.attributes.item(j).nodeValue == 'reference_id')
				{
					node.style.backgroundColor = oldBGcolor;
				}
			}
		}
	}
}


/*** hi-lites background object ***/
var newBGcolor = "#F9FAB8";
var oldBGcolor = "#FFFFFF";

function hiliteBG(inObject)
{
	noliteBG();
	var inObjectID = document.getElementById(inObject).style.backgroundColor = newBGcolor;
}


function hiliteBGmulti(inObjectConcat)
{
	noliteBG();

	var inObjectSplit = inObjectConcat.split('-');
	var startHi = parseInt(inObjectSplit[0]);
	var stopHi = parseInt(inObjectSplit[1]);

	for(var i = startHi; i <= stopHi; i++)
	{
		document.getElementById("ref_" + i).style.backgroundColor = newBGcolor;
	}

}

/*********** Misc Functions ***********/
function openPopUp(inURL,inWidth,inHeight)
{
	windowOptions = 'toolbar=no,location=no,resizable=yes,scrollbars=yes,menubar=no,width=' + inWidth + ',height=' + inHeight;
	newWindow = window.open(inURL,'newWin',windowOptions);
}

function printMe()
{
	document.getElementById("scroll_content").style.height = "auto";
	document.getElementById("slide_down").style.display = 'none';
	setTimeout('window.print()',3000);
	document.getElementById("slide_up").style.display = 'inline';
}


window.onbeforeprint = function(e)
{
	document.getElementById("scroll_content").style.height = "auto";
	document.getElementById("slide_down").style.display = 'none';
}

window.onafterprint = function(e)
{
	document.getElementById("slide_up").style.display = 'inline';
}

function setPage(inPage)
{
	if(inPage != "Welcome")
	{
		document.getElementById(inPage).style.fontWeight = "bold";
		document.getElementById(inPage).style.color = "black";
	}
}