<!--

//===============================================================================
// Declare the layer object (with desired properties and methods)
//		Properties:
//			Actual layer that the object refers to
//		Methods:
//			None yet
//===============================================================================

// Prototypes
LayerObject.prototype.show = layer_show;
LayerObject.prototype.hide = layer_hide;
LayerObject.prototype.alertStatus = layer_alertStatus;
LayerObject.prototype.getLayerByLayerName = layer_getLayerByLayerName;
LayerObject.prototype.setInnerHTML = layer_setInnerHTML;
LayerObject.prototype.getInnerHTML = layer_getInnerHTML;
LayerObject.prototype.setTop = layer_setTop;
LayerObject.prototype.setLeft = layer_setLeft;
LayerObject.prototype.getFirstFormOnLayer = layer_getFirstFormOnLayer;
LayerObject.prototype.isVisible = layer_isVisible;

//===============================================================================
// Layer Methods:
//===============================================================================

// Display the name of the layer object (for debugging layer errors)
function layer_alertStatus() {
	if (this.layerExists)
		alert(this.name + ' exists!');
	else
		alert(this.name + ' does not exist');	
	return true;
}

function layer_getFirstFormOnLayer( lyrToUse ) {
	if (this.layerExists)
		return this.layer.document.forms[0];
}

// Hide the layer calling this method
function layer_hide() {
	if (this.layerExists)
	{
		this.style.visibility='hidden';
		this.visible=false;
	}
	return true;
}

// this function is used to determine the status of those layers referenced by this module but which do not use it's functionality
function layer_isVisible() {
	if (this.layerExists)
	{
		if (browserIsIE4) return (this.style.visibility == 'visible');
		else if (browserIsNN4) return (this.style.visibility == 'show');
		else return false;
	}
	else
	{
		return false;
	}
}

// Set the top attribute for the layer
function layer_setTop( intNewTopValue ) {
	if (this.layerExists) {
		if (browserIsIE4)
			this.style.top=intNewTopValue.toString() + 'px';
		else
			this.style.top=intNewTopValue;
	}
	return true;
}

// Set the bottom attribute for the layer
function layer_setLeft( intNewLeftValue ) {
	if (this.layerExists) {
		if (browserIsIE4)
			this.style.left=intNewLeftValue.toString() + 'px';
		else
			this.style.left=intNewLeftValue;
	}
	return true;
}

// Show the layer calling this method
function layer_show() {
	if (this.layerExists)
	{
		this.style.visibility='visible';
		this.visible=true;
	}
	return true;
}

//===============================================================================
// function to get inner HTML (browser-independently)
//===============================================================================
function layer_getInnerHTML () {
	var strTextToReturn = '';
    if (browserIsIE4)
        strTextToReturn = this.layer.innerHTML;
    else if (browserIsNN4) {
       // NOT FUNCTIONING	   
	   // strTextToReturn = this.layer.document.body;
    }
	//alert( strTextToReturn );
	return( strTextToReturn );
}

//===============================================================================
// function to set inner HTML (browser-independently)
//===============================================================================
function layer_setInnerHTML ( strNewHTML ) {
    if (browserIsIE4 || browserIsNN6)
        this.layer.innerHTML = strNewHTML;
    else if (browserIsNN4) {
		this.layer.document.open( 'text/html' );
        this.layer.document.write( strNewHTML );
        this.layer.document.close();
    }
	return true;
}

//===============================================================================
// Recursively search for a layer in NN, or use document.all if in IE
// sample usage:
// Simply make a variable and assign it to this function call, you will be returned the layerObject which has the name 'layerName '
// ie. var myLayer = getLayerByName('FormattingTools', document);
//===============================================================================
function layer_getLayerByLayerName(layerName, currLayer)
{
	if (browserIsNN6) {
		this.layer=document.getElementById(layerName);
		return true;
	} else {
		if ((document.all) && (eval('document.all.' + layerName)))
		{
			this.layer=eval('document.all.' + layerName);
			return true;
		} 
		else
		{
			var layerFound = '';
			if (currLayer[layerName] != null)
			{
				this.layer=currLayer[layerName];
				return true;
			}
			else
			{
				if (currLayer.layers && currLayer.layers.length > 0)
				{
					for (i = 0; i<currLayer.layers.length; i++)
					{
						layerFound = layer_getLayerByLayerName(layerName, currLayer.layers[i]);
						if (layerFound) 
						{	
							this.layer=layerFound;
							return true;
						}
					}
				}
			}
		}
	}
	// layer not found, set to null
	this.layer=null;
	return false;
}



//===============================================================================
//Constructor
//===============================================================================
function LayerObject(layerName) {
	this.version='1.0';
	this.author='Reid Guest';
	this.dateCreated='September 22, 2000';
	
	this.name=layerName;

	// Set the <<< layer >>> attribute to default setting; it will be assigned by page initilialization function later
	this.getLayerByLayerName(layerName, document);

	// If the layer does not exist, then set flag to false, otherwise it's true;
	if (this.layer != null)
	{
		this.layerExists = true;

		// Assign the style object as a property of the layer object itself (for browser-compatibility issues)
		this.style = (browserIsIE4 || browserIsNN6)? (eval('this.layer.style')):(eval('this.layer'));

		//this.innerHTML =  this.layer.innerHTML;
	}
	else
	{
		this.layerExists = false;
	}

	// addtional properties:
	// isVisible:		boolean
	this.visible=false;

	return this;
}

//-->


