
function passTextButtonEvents(e) {
	target = (ie) ? e.srcElement : e.target;
	target.manager.handleEvents(e);
}

function textButtonEventHandler(e) {
	target = (ie) ? e.srcElement : e.target;
	switch (e.type) {
		case "mousemove" :
			target.style.backgroundColor = this.hilite; break;
		case "mouseout" :
			target.style.backgroundColor = this.normal; break;
		case "mousedown" :
			target.style.backgroundColor = this.pressed; break;
		case "mouseup" :
			if (typeof(this.url) == "string") {
				window.location = this.url;
			} else {
				this.url();
			}
	}
}
function textButton(aLayer, aStyle, normalColour, hiliteColour, pressColour, aURL) {
	this.normal = normalColour;
	this.hilite = hiliteColour;
	this.pressed = pressColour;
	this.url = aURL;
	this.de = new DomElement(aLayer, aStyle);
	this.de.elm.manager = this;	
	this.de.addEventListener('mousedown',passTextButtonEvents,false);
	this.de.addEventListener('mouseup',passTextButtonEvents,false);
	this.de.addEventListener('mousemove',passTextButtonEvents,false);
	this.de.addEventListener('mouseout',passTextButtonEvents,false);
	this.handleEvents = textButtonEventHandler;
} 
