
function DynE1(window, id, body, left, top, width){
	// remember some arguments for later

	this.window = window;
	this.id = id;
	this.body=body;
	this.localx = 0;
	this.localy = 0;
	//output a CSS=P style sheet for this element
	var d = window.document;
	//alert( navigator.appName.indexOf("Microsoft") );
	///if ( navigator.appName.indexOf("Microsoft") != -1 ) {

		d.writeln( '<STYLE TYPE="text/css">');
		d.write('#' + id + ' {position:absolute;');
		if( left ) d.write('left:' + left +';');

		if( top  ) d.write('top:' + top + ';');
		if( width ) d.write('width:' + width + ';');
		d.writeln('}');
		d.writeln('</STYLE>');
	///}
}
if ( 0 && navigator.appName.indexOf("Netscape") != -1 ) {

	DynE1.prototype.output = function() {
		var d = this.window.document; //shortcut variable: saves typeing

		// Output the element within a <DIV> tag.  Specify the element id.
		d.writeln( '<layer ID="' + this.id + '">');
		d.writeln( this.body );
		d.writeln( "</layer>");
		this.layer = d[this.id];
	}

	DynE1.prototype.moveTo = function(x,y) {this.layer.moveTo( x, y );}
	DynE1.prototype.moveBy = function(x,y) {this.layer.moveBy( x, y );}
	DynE1.prototype.show = function() { this.layer.display = 'block';}
	DynE1.prototype.hide = function() { this.layer.display = "none";};
	DynE1.prototype.setStackingOrder = function(z) {this.layer.zIndex = z;};
	DynE1.prototype.setBgcolor = function(color){
		this.layer.bgcolor = color;
	}
	DynE1.prototype.setBgImage = function(image){
		this.layer.background.src = image;
	}

	DynE1.prototype.getX = function() { return this.layer.left; }
	DynE1.prototype.getY = function() { return this.layer.right; }
	DynE1.prototype.getWidth  = function() { return this.layer.width; }
	DynE1.prototype.getHeight = function() { return this.layer.height; }
	DynE1.prototype.getStackingOrder = function() { return this.layer.zIndex; }
	DynE1.prototype.isvisible = function() {
			return this.layer.visiblity == "show";
	}

	DynE1.prototype.setBody = function() {
		for( var i = 0 ; i < arguments.length; i++ ) 
				this.layer.document.writeln( arguments[i] );
		this.layer.document.close();
	}

	DynE1.prototype.addEventHandler = function( eventname, handler ) {
		this.layer.captureEvents( DynE1._eventmasks[eventname]);
		var dyne1 = this; // Curent DynE1 for use in the nested function.

		this.layer[eventname] = function(event) {
			return handler(dyne1, event.type, event.x, event.y, event.which, event.which, 
				((event.modifiers & Event.SHIFT_MASK) != 0 ),
				((event.modifiers & Event.CTRL_MASK) != 0 ),
				((event.modifiers & Event.ALT_MASK ) != 0 ));
		}
	}

	DynE1.prototype.removeEventHandler = function( eventname ) {
		this.layer.releaseEvents(DynE1._eventmasks[eventname]);
		delete this.layer[eventname];
	}
			DynE1._eventmasks = {
onabort:Event.ABORT, onblur:Event.BLUR, onchange:Event.CHANGE,
onclick:Event.CLICK, ondblclick:Event.DBLCLICK,
ondragdrop:Event.DRAGDROP, onerror:Event.ERROR,
onfocus:Event.FOCUS, onkeydown:Event.KEYDOWN,
onkeypress:Event.KEYPRESS, onkeyup:Event.KEYUP, onload:Event.LOAD,
onmousedown:Event.MOUSEDOWN, onmousemove:Event.MOUSEMOVE,
onmouseup:Event.MOUSEUP, onmove:Event.MOVE, onreset:Event.RESET,
onresize:Event.RESISE, onselect:Event.SELECT, onsubmit:Event.SUBMIT,
onunload:Event.UNLOAD
		};
	}
	if( 1 || navigator.appName.indexOf("Microsoft") != -1 ) {

		DynE1.prototype.output = function() {
			var d = this.window.document;

			d.writeln( '<div ID ="' + this.id + '">');
			d.writeln( this.body );
			d.writeln( "</div>");

			this.element = d.getElementById(this.id);
			this.style = this.element.style;
		}

		DynE1.prototype.moveTo = function(x, y ) {
			this.style.left = x;
			this.style.top = y;
		}

		DynE1.prototype.moveBy = function(x, y ) {
			this.style.left += x;
			this.style.top += y;
		}

		DynE1.prototype.show = function () { this.style.display = "block"; }
		DynE1.prototype.hide = function() { this.style.display = "none";}
		DynE1.prototype.setStackingOrder = function( z ) { this.style.zIndex = z; }
		DynE1.prototype.setBgColor = function( color ) {
			this.style.backgroundColor = color;
		}
		DynE1.prototype.setBgImage = function(image){
			this.style.backgroundImage = image;
		}

		DynE1.prototype.getX = function(){ return this.style.left;}
		DynE1.prototype.getY = function() { return this.style.top; }
		DynE1.prototype.getWidth = function() { return this.style.width; }
		DynE1.prototype.getHeight = function() { return this.style.height; }
		DynE1.prototype.getStackingOrder = function() { return this.style.zIndex; }
		DynE1.prototype.isvisible = function() {
			return this.style.visibility == "visible";
		}

		DynE1.prototype.setBody = function() {
			var body = "";
			for( var i = 0 ; i < arguments.length ; i++ ) {
				body += arguments[ i ] + "\n";
			}
			this.element.innerHTML = body;
		}
		DynE1.prototype.addEventHandler = function( eventname, handler ) {
			var dyne1 = this;

			this.element[eventname] = function() {
				var e = dyne1.window.event;
				e.cancelBubble = true;
				return handler(dyne1, e.type, e.x, e.y, e.button, e.keyCode,
					e.shiftKey, e.ctrlKey, e.altKey );
			}
		}

		DynE1.prototype.removeeventHandler = function(eventname ) {
			delete this.element[eventname];
		}

	}
