function Layer(id) {
  this.id = id;

 if(navigator.appName.indexOf("scape") > 0) {
   this.ob = document.getElementById(id).style;
   this.obCore = document.getElementById(id); 
 } else if(navigator.appName.indexOf("pera") > 0) {
   this.ob = document.getElementById(id).style;
   this.obCore = document.getElementById(id);    
 } else {
   this.ob = eval("document.all."+id+".style");
   this.obCore = eval("document.all."+id); 
 }


  this.moveRel = moveRel;
  this.moveAbs = moveAbs;
  this.getX = getX;
  this.getY = getY;
  this.setX = setX;
  this.setY = setY;
  this.setColor = setColor;
  this.getColor = getColor;
  this.setVisible = setVisible;
  this.getHeight = getHeight;
  this.setHeight = setHeight;
  this.getWidth = getWidth;
  this.setWidth = setWidth;
  this.setZ = setZ;
  this.getZ = getZ;
  this.toFront = toFront;
  this.toBack = toBack;
  this.offsetLeft = offsetLeft;
  this.offsetTop = offsetTop;
  this.setText = setText;

  this.FONTMARGIN = 2;
  this.FONTSIZE = parseInt(this.ob.fontSize);
  this.MIN_LAYERHEIGHT = (this.FONTMARGIN+this.FONTSIZE);
}


function getX() {
   return parseInt(this.ob.left);
}

function getY() {
  return parseInt(this.ob.top);
}

function setX(x) {
  this.ob.left = x;
}

function setY(y) {
  this.ob.top = y;
}


function moveRel(x, y) {
  with(this) {
    setX(getX() + x);
    setY(getY() + y);
  }
}

function moveAbs(x, y) {
  with(this) {
    setX(x);
    setY(y);
  }
}

function isVisible() {
  return "xxx";
}

function setVisible(b) {
  if(b)
    this.ob.visibility = "visible";
  else
    this.ob.visibility = "hidden";
}

function getHeight() {
  return parseInt(this.ob.height);
}

function setHeight(height) {
  if(height < this.MIN_LAYERHEIGHT)
    this.ob.height = this.MIN_LAYERHEIGHT;
  else
    this.ob.height = height;  
}

function getWidth() {
  return parseInt(this.ob.width);
}

function setWidth(width) {
  this.ob.width = width;
}

function setColor(colorName) { 
  this.ob.backgroundColor = colorName;
}

function getColor() {
  return this.ob.backgroundColor;
}

function setZ(z) {
  this.ob.zIndex = z;
}

function getZ() {
  return parseInt(this.ob.zIndex);
}

function toBack() {
  var z = this.getZ();
  if(z-1 >= 0)
    this.setZ(this.getZ()-1);
}

function toFront() {
  this.setZ(this.getZ()+1);
}

function offsetTop() {
  return document.getElementById(this.id).offsetTop;
}

function offsetLeft() {
  return document.getElementById(this.id).offsetLeft;
}

function setText(text) {
  this.obCore.innerHTML = text;  
}