function NF_area(codigo, largura, altura, x, y, z) {
    // declare and initialize
    this.codigo = codigo;
    this.largura = largura;
    this.altura = altura;
    this.x = x;
    this.y = y;
    this.z = z;

    // accessors
    this.getCodigo = new Function("return(this.codigo);");
    this.setCodigo = new Function("novoCodigo", "this.codigo = novoCodigo;");
    this.getLargura = new Function("return(this.largura);");
    this.setLargura = new Function("novaLargura", "this.largura = novaLargura;");
    this.getAltura = new Function("return(this.altura);");
    this.setAltura = new Function("novaAltura", "this.altura = novaAltura;");
    this.getX = new Function("return(this.x);");
    this.setX = new Function("novoX", "this.x = novoX;");
    this.getY = new Function("return(this.y);");
    this.setY = new Function("novoY", "this.y = novoY;");
    this.getZ = new Function("return(this.z);");
    this.setZ = new Function("novoZ", "this.z = novoZ;");

    var tmp = document.createElement('div');
    tmp.id = this.codigo;
    tmp.style.position = "absolute";
    tmp.style.top = this.y + "px";
    tmp.style.left = this.x + "px";
    tmp.style.width = this.largura + "px";
    tmp.style.height = this.altura + "px";
    tmp.style.zIndex = this.z;

    return tmp;
}

function NF_addElement2Object(objecto, elem) {
  if (objecto.innerHTML == null) {
      objecto.innerHTML = elem;
  } else {
      objecto.innerHTML += elem;
  }
}

function NF_addObject2Object(object1, object2){
    object1.appendChild(object2);
}

function NF_addObject2Document(objecto) {
    if (internetExplorer) {
        document.body.appendChild(objecto);
    } else {
        document.documentElement.appendChild(objecto);
    }
}

function NF_removeObject2Document(objecto) {
    if (internetExplorer) {
        document.body.removeChild(objecto);
    } else {
        document.documentElement.removeChild(objecto);
    }
}

function NF_flashObject(largura, altura, nomeFicheiro) {
  var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+largura+'" height="'+altura+'">';
  str += '<param name="movie" value="'+nomeFicheiro+'.swf">';
  str += '<param name="quality" value="high">';
  str += '<embed src="'+nomeFicheiro+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'"></embed>';
  str += '</object>';
  return str;
}

function NF_imgObject(largura, altura, nomeFicheiro) {
  return '<img src="'+nomeFicheiro+'" width="'+largura+'" height="'+altura+'">';
}

function NF_imgObjectWithLink(largura, altura, nomeFicheiro, linkHref) {
  return '<a href="'+linkHref+'" target="_blank"><img src="'+nomeFicheiro+'" border="0" width="'+largura+'" height="'+altura+'"></a>';
}

function setElementSource(elementName, pageName) {
    var element = document.getElementsByName(elementName)[0];
    element.src = pageName;
}
