  function TextImage(tag, id, tagPos, path, alt) {
    this.tag    = tag;
    this.id     = id;
    this.tagPos = tagPos;
    this.path   = path;
    this.alt    = alt;
  }

  function transformElementsToImages() {
    for(var j=0; j<textImage.length; j++) {
      var obj = (textImage[j].id == '' ? document.body.getElementsByTagName(textImage[j].tag)[0] : document.getElementById(textImage[j].id));
      if (obj == null) {continue;}
      if (textImage[j].alt == '') {textImage[j].alt = obj.innerHTML;}
      if (textImage[j].tagPos == "under") {
        obj.innerHTML = '<img src="'+ textImage[j].path +'" alt="' + textImage[j].alt + '">'; 
      } else if (textImage[j].tagPos == "self"){
        obj.outerHTML = '<img src="'+ textImage[j].path +'" alt="' + textImage[j].alt + '">'; 
      }
    }
  }

