/* from web */
Array.prototype.Contains = function(mxd,strict) {
for(i in this) {
if(this[i] == mxd && !strict) return true;
else if(this[i] === mxd) return true;
}
return false;
}
	
/* setDisplay - sets the style display property of a given element based on element id
 *
 * @param	elementID		The id of the element to set the display
 * @param	mode			The mode to set the display to
 *
 */
function setDisplay(elementID,mode){document.getElementById(elementID).style.display = mode;}

/** toggleDisplay - takes an HTML element and toggles the display between 'none' and 'block'
 *
 *	@param		elementID - the id of the element to be toggled
 *
 */
function toggleDisplay(elementID)
{
	divObject = document.getElementById(elementID);
	if(divObject.style.display != "none")
	{
		divObject.style.display = "none";
	}
	else
	{
		divObject.style.display = "block";
	}
	
}

/** toggleDisplay - takes an HTML element and toggles the display between 'none' and 'block'
 *
 *	@param		elementID - the id of the element to be toggled
 *
 */
function toggleDisplaySpec(elementID,mode)
{
	divObject = document.getElementById(elementID);
	if(divObject.style.display != "none")
	{
		divObject.style.display = "none";
	}
	else
	{
		divObject.style.display = mode;
	}
	
}

/** whiteBlocks - will change the backgroundColor to white for all the items in the passed array which holds element id's
 *
 *	@param			blockArray - an array with element id's as its values
 *
 */
function whiteBlocks(blockArray)
{
	for(i = 0; i < blockArray.length; i++)
	{
		document.getElementById(blockArray[i]).style.backgroundColor = '#FFFFFF';
	}
}
function highlightBlock(blockID,focusID,blockArray)
{
	whiteBlocks(blockArray);
	document.getElementById(blockID).style.backgroundColor = '#E8E3D3';
	if(focusID != ""){document.getElementById(focusID).focus();}
}

function hideBlocks(blockArray)
{
	for(i = 0; i < blockArray.length; i++)
	{
		document.getElementById(blockArray[i]).style.display = 'none';
	}
}
function showBlock(blockID,blockArray)
{
	hideBlocks(blockArray);
	document.getElementById(blockID).style.display = 'block';
}