/*
+------------------------------------------------------------------------ 	+
| Page: functions.js
+------------------------------------------------------------------------ 	+
| Description: JavaScript Function Library
+------------------------------------------------------------------------ 	+
*/

/***** BEGIN SHOW/HIDE FUNCTIONS *****/

//check/uncheck checkboxes in a class
//parm cbvalue = true/false
function checkClass(whichClass,cbvalue)
{
	aEnumSelects = getElementsByClass(whichClass);
	for (x in aEnumSelects)
	{
		aEnumSelects[x].checked = cbvalue;
	}
}

//Hide a class
function hideClass(whichClass)
{
		aEnumSelects = getElementsByClass(whichClass);
		for (x in aEnumSelects)
		{
			aEnumSelects[x].style.display="none";
		}
}

// Hide a show/hide area
function hideFormLayer(whichLayer)
{
	//alert(whichLayer);
	if (document.getElementById)
	{
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = "none";
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = "none";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = "none";
	}
} 

//Show a class
//OPTIONAL PARAMETER displayType: "block" or "inline" - default is "block"
function showClass(whichClass)
{
	var displayType = (displayType == null) ? "block" : displayType;

		aEnumSelects = getElementsByClass(whichClass);
		for (x in aEnumSelects)
		{
			aEnumSelects[x].style.display=displayType;
		}
}

// Show a show/hide area
//OPTIONAL PARAMETER displayType: "block" or "inline" - default is "block"
function showFormLayer(whichLayer,displayType)
{

	var displayType = (displayType == null) ? "block" : displayType;

	//alert(whichLayer);
	if (document.getElementById)
	{
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = displayType;
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = displayType;
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = displayType;
	}
} 


// Toggle display property of an HTML element
function toggleFormLayer(whichLayer)
{
	
	//alert(whichLayer);
	if (document.getElementById)
	{
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	}

	if(style2.display=="none"){
		style2.display = "block";
	}
	else{
		style2.display = "none";
	}
} 

//Expand the search box automatically when it's a search page
function toggleFormLayer_Search(){
	toggleFormLayer("dShowHideSearchCtrlClose");
	toggleFormLayerReverse("dShowHideSearchCtrlOpen");

	toggleFormLayer("dShowHideSearchFinance");
}



/***** END SHOW/HIDE FUNCTIONS *****/
 