function FotoListXML(xml) {
  this.fotolist = [ ];
  this.fotocount = 0;
  this.title = "unnamed";

  images = xml.getElementsByTagName("images")[0];

  tag = images.getElementsByTagName("title")[0];
  if (tag != undefined) {
    value = tag.childNodes[0];
    if (value != undefined)
      this.title = value.nodeValue;
    else
      this.title = "unnamed";
  }

  imgarray = images.getElementsByTagName("image");
  for (i = 0; i < imgarray.length; i++) {
    image = imgarray[i];
    file_full = 0;
    tag = image.getElementsByTagName("full")[0];
    if (tag != undefined) {
      value = tag.childNodes[0];
      if (value != undefined) {
        file_full = value.nodeValue;
      }
    }

    file_preview = 0;
    tag = image.getElementsByTagName("preview")[0];
    if (tag != undefined) {
      value = tag.childNodes[0];
      if (value != undefined) {
        file_preview = value.nodeValue;
      }
    }

    file_priority = Infinity;
    tag = image.getElementsByTagName("priority")[0];
    if (tag != undefined) {
    value = tag.childNodes[0];
      if (value != undefined) {
        file_priority = value.nodeValue;
      }
    }

    if (file_full != 0 && file_preview != 0)
      this.fotolist[this.fotocount++] = [ file_full, file_preview, file_priority, this.fotocount ];
  }

  /* sort the foto list */
  for (i = 0; i < this.fotocount; i++)
    for (j = i + 1; j < this.fotocount; j++) {
      if (this.fotolist[j][2] < this.fotolist[i][2] ||
        this.fotolist[j][3] < this.fotolist[i][3]) {
        tmp = this.fotolist[j];
        this.fotolist[j] = this.fotolist[i];
        this.fotolist[i] = tmp;
      }
    }
}


