/* 


DESCRIPTION:

				This script is used to toggle visibility of elements
				To use to display a processing screen, turn processing element on at the top of the page
				and turn it off at the bottom of the page.
				For the main page content, do the reverse.

USAGE:

Include link to this file in the head

<script language="JavaScript" type="text/javascript" src="/js/changeObjectVisibility.js"></script>


Just before flush() php function

	<script type="text/javascript">
	<!-- //
		changeObjectVisibility("processing","visible");
		changeObjectVisibility("container","hidden");
	// -->
	</script>

Bottom of page just before </body>

	<script type="text/javascript">
	<!-- //
		changeObjectVisibility("processing","hidden");
		changeObjectVisibility("container","visible");
	// -->
	</script>

*/



//  function getStyleObject(string) -> returns style object
//  given a string containing the id of an object
//  the function returns the stylesheet of that object
//  or false if it can't find a stylesheet.  Handles
//  cross-browser compatibility issues.


function getStyleObject(objectId) {
	// checkW3C DOM, then MSIE 4, then NN 4.
	//
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {  
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) { 
		return document.layers[objectId];
	} else {
		return false;
	}
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
		styleObject.visibility = newVisibility;
		//styleObject.display = newDisplay;
		return true;
    } else {
		// we couldn't find the object, so we can't change its visibility
		return false;
    }
}
