//------------------------------------------------------------------------------
// $Workfile: inlinemessage.js $ 
// $Author: Mulcahyh $ 
// $Date: 7/21/03 2:26p $ 
// $Revision: 1 $
//------------------------------------------------------------------------------

// This file is required to display/hide inline messages on the page
// works with all the browsers
// need to pass the div,span or layer that needs to be displayed
// to hide the layer/span/div by default use the following <script></script>code on the page 
// where the message needs to be displayed
// <script type=css/text>
// #(layer or span or div tag ID) { position:absolute; visibility:hidden;}
// </script>
//

function display_inlinemsg(lyrname)
{
	loadLyr(lyrname);
}

function hide_inlinemsg(lyrname)
{
	unloadLyr(lyrname);
}

function unloadLyr(lyr) {
  	var curcss = get_lyr_css(lyr);
	if (curcss) {
		curcss.visibility = "hidden";
	}
}
function loadLyr(lyr) {
  	var curcss = get_lyr_css(lyr);
	if (curcss) {
		curcss.visibility = "visible";
	}
}

// get reference
function get_lyr_css(id) {
	var lyr, lyrcss;
	lyr = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (lyr) lyrcss = (lyr.style)? lyr.style: lyr;
	return lyrcss;
}

// get reference to nested layer for ns4
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}



