/*******************************
*
* elcElement.js
* 
* generic element class
*
* Author: DoublePrime
*******************************/
DEBUG = (window.location.search.indexOf('debug=1') > -1) ? true : false;

function elcElement(id) {
//	alert( 'id: ' + id );
	if (bw.ns4) this.layerAlias = getLayerAlias(id);
	this.obj=bw.dom?document.getElementById(id):bw.ie4?document.all[id]:bw.ns4?eval(this.layerAlias):0;
	this.css=bw.dom?document.getElementById(id).style:bw.ie4?document.all[id].style:bw.ns4?this.obj:0;

	function getLayerAlias(name, docAlias) {
		var i, layer, docLayers, layerAlias;
		if (!docAlias) docAlias = "document";
		docLayers = eval(docAlias + ".layers");
		for (i=0; i<docLayers.length; i++) {
			layerAlias = docAlias + ".layers." + docLayers[i].name;
			layer = eval(layerAlias);
			if(layer.name == name) return layerAlias;
			if(layer.document.layers.length > 0) {
				layerAlias = getLayerAlias(name, layerAlias + ".document");
				if(layerAlias!=null) return layerAlias;
			}
		}
		return null;
	}
}

elcElement.prototype.setBackgroundColor = function(color) {
	if (this.css) {
		if (bw.ns4){
			this.css.bgColor = color;
		} else {
			this.css.backgroundColor = color;
		}
	}
}

elcElement.prototype.setColor = function(color) {
	if (this.css) {
		this.css.color = color;
	}
}
