<!--

//===============================================================================
// 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;

//===============================================================================
// 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;
}

// Show the layer calling this method
function layer_show() {
	this.style.visibility='visible';
	return true;
}

// Hide the layer calling this method
function layer_hide() {
	this.style.visibility='hidden';
	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 ((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)? (eval('this.layer.style')):(eval('this.layer'));
	}
	else
	{
		this.layerExists = false;
	}

	return this;
}

//-->


