function iLayer( id ){
	this.ref	= MM_findObj( id );
	this.id		= id

	this.divListeners = new Array()

	this.move	= iLayer_move;

	this.setX	= iLayer_setX;
	this.setY	= iLayer_setY;

	this.getX	= iLayer_getX;
	this.getY	= iLayer_getY;

	this.setWidth	= iLayer_setWidth;
	this.setHeight	= iLayer_setHeight;

	this.resize	= iLayer_resize;

	this.getWidth	  = iLayer_getWidth;
	this.getHeight	= iLayer_getHeight;

	this.onResize = iLayer_onResize;
	this.addDivListeners = iLayer_addDivListeners;

	this.hide	= iLayer_hide;
	this.show	= iLayer_show;

	this.setContent	= iLayer_setContent;
}

function iLayer_getX(){
	return this.ref ? ( document.layers ? parseInt( this.ref.left ) : parseInt( this.ref.offsetLeft ) ) : 0;
}

function iLayer_getY(){
	return this.ref ? ( document.layers ? parseInt( this.ref.top ): parseInt( this.ref.offsetTop ) ) : 0;
}

function iLayer_setX( x ){
	x = parseInt( x );
	if( isNaN(x) ) return;

	if( document.layers ){
		this.ref.left = x;
	}
	else{
		this.ref.style.left = x;
	}
}

function iLayer_setY( y ){
	y = parseInt( y );
	if( isNaN(y)) return;

	if( document.layers ){
		this.ref.top = y;
	}
	else{
		this.ref.style.top = y;
	}
}

function iLayer_move( x, y ){
	this.setX( x );
	this.setY( y );
}

function iLayer_setWidth( width ){
	width = parseInt( width );
	if( isNaN(width)) return;

	if( document.layers ){
		this.ref.clip.width = width;
	}
	else{
		this.ref.style.width = width;
	}
}

function iLayer_setHeight( height ){
	height = parseInt( height );
	if( isNaN(height)) return;

	if( document.layers ){
		this.ref.clip.height = height;
	}
	else{
		this.ref.style.height = height;
	}
}

function iLayer_getWidth(){
	return this.ref ? ( document.layers ? parseInt( this.ref.clip.width ): parseInt( this.ref.offsetWidth ) ) : 0;
}

function iLayer_getHeight(){
	return this.ref ? ( document.layers ? parseInt( this.ref.clip.height ): parseInt( this.ref.offsetHeight ) ) : 0;
}

function iLayer_setContent( content ){
	MM_setTextOfLayer( this.id, "", content )
}

function iLayer_show(){
	MM_showHideLayers( this.id, '', 'show')
}

function iLayer_hide(){
	MM_showHideLayers( this.id, '', 'hide')
}

function iLayer_resize( width, height ){
	this.setWidth( width )
	this.setHeight( height )
} 

function iLayer_onResize(){
	var i
	for(i=0; i<this.divListeners.length; i++){
		this.divListeners[i].divResized( this.getWidth(), this.getHeight() )
	}
}

function iLayer_addDivListeners( l ){
	this.divListeners[ this.divListeners.length ] = l
}

