
function htmlObject(tag,empty){
  this.tag = tag
  this.is_empty = empty;
  this.cdata = '';
  this.attrs = [];
  this.children = [];
  this.ac = function (tag,empty){ // add_child
    c = this.children.length;
    this.children[c] = new htmlObject(tag,empty);
    return this.children[c];
  }
  this.aa = function (name,value){ // add_attribute
    this.attrs[this.attrs.length] = new htmlAttribute(name,value);
  }
  this.build = function(){
    out = '<'+tag;
    for (var i=0;i<this.attrs.length;i++){
      attr = this.attrs[i];
      out += ' '+attr.name+'="'+attr.value+'"';
    }
    if(this.empty != undefined){out += ' />';}
    else{out += ' >';}
    for (var i=0;i<this.children.length;i++){
      out += this.children[i].build();
    }
    out += this.cdata;
    if(this.empty == undefined){ out += '</'+tag+'>';}
    return out;
  }
  this.write = function (){
    out = this.build();
    document.write(out);
    }
}
  

function htmlAttribute(name,value){
  this.name = name;
  this.value = value;
}
