#line 4250 "/home/travis/build/felix-lang/felix/src/packages/flx_web.fdoc"
  
  
  val slideshow_js = """
  <button id="start" onclick="start_slides()">Start</button>
  <button id="stop" onclick="stop_slides()" disabled="true">Stop</button>
  <button id="reset" onclick="reset_slides()">Reset</button>
  <button id="next" onclick="skip_to_next()">Next</button>
  <span id="goose" style="position:absolute; right:50px;">Slideshow Ready</span>
  <script>
  var slides = new Array();
  var slideno = 0;
  var lineno = 0;
  var nslides = 0;
  slides[0]=0;
  
  var interval_handle;
  function enable (slide, line) {
    var elt = document.getElementById("slide-section-"+slide+","+line)
    elt.style.display="";
    var n = elt.innerHTML.length;
    interval_handle = setTimeout(showframe, 7000+25 * n);
  }
  
  function disable (slide, line) {
    document.getElementById("slide-section-"+slide+","+line).style.display="none";
  }
  
  function disable_slide (slide) {
    for (i = 1; i <= slides[slide]; i = i + 1) disable(slide,i);
  }
  
  function nextslide() {
    slideno = slideno + 1;
    if (slideno > nslides ) { reset_slides();}
    lineno = 1;
  }
  
  function nextline() {
    lineno = lineno + 1;
    if (lineno > slides[slideno]) { nextslide(); }
  }
  
  function showline() {
    if (slideno == 0) {
      document.getElementById("goose").innerHTML="READY";
    }
    else {
      document.getElementById("goose").innerHTML="SLIDE " + (slideno) + ", LINE " + (lineno) +"";
      enable (slideno, lineno);
    }
  }
  
  function showframe(){
    oldslide = slideno;
    oldline = lineno;
    nextline();
    if (oldslide != slideno) {
      disable_slide(oldslide);
      setTimeout(showline,2000);
    }
    else showline();
  }
  
  function skip_to_next() {
    clearTimeout(interval_handle);
    disable_slide (slideno);
    nextslide();
    showline();
  }
  
  function start_slides() {
    document.body.style.background="black";
    document.body.style.color="white";
    document.getElementById("start").disabled=true;
    document.getElementById("stop").disabled=false;
    document.getElementById("reset").disabled=false;
    showframe();
  }
  
  function stop_slides() {
    document.body.style.background="white";
    document.body.style.color="black";
    document.getElementById("start").disabled=false;
    document.getElementById("stop").disabled=true;
    document.getElementById("reset").disabled=false;
    clearTimeout(interval_handle);
  }
  
  function reset_slides() {
    document.getElementById("reset").disabled=true;
    disable_slide(slideno);
    stop_slides();
    slideno = 0;
    lineno = 0;
    showline();
  }
  
  </script>
  """;
  
  include "./slideshow-interface";
  
  fun setup(config_data:string) = {
    eprintln$ "Setup fdoc_slideshow " + config_data;
    return 0;
  }
  
  
  object fdoc_slideshow (var write_string: string -> 0) implements slideshow_t =
  {
    method fun whatami () => "Slideshow object";
    var slideshow-used = false;
    var slide_count = 0;
    var slide_section_count = 0;
  
    proc end_slide_section() { write_string("\n</div>"); }
    proc end_slide() {
      write_string("</div>\n<script>\nslides["+str slide_count+"]=" + str slide_section_count + ";\n</script>\n");
    }
    proc start_slide() {
      write_string('\n<div class="slide" id="slide-'+str slide_count+'">\n');
    }
    proc start_slide_section() {
      write_string('\n<div class="slide-section" id="slide-section-'+
        str slide_count+","+str slide_section_count+'" style="display:none">\n');
    }
  
    method fun check-slide-commands (b:string) : bool =
    {
      if b == "slideshow" do
        slideshow-used = true;
        write_string (slideshow_js);
        slide_count = 0;
        slide_section_count = 0;
        return true;
      elif b == "slide" do
        if slide_count != 0 do
          end_slide_section();
          end_slide();
        done
        slide_count = slide_count + 1;
        slide_section_count = 1;
        start_slide();
        start_slide_section();
        //s = doc;
        return true;
      elif b == "section" do
        if slide_section_count != 0 do
          end_slide_section();
        done
        slide_section_count = slide_section_count + 1;
        start_slide_section();
        //s = doc;
        return true;
      else
        return false;
      done
    }
  
    method proc finalise() =
    {
      if slide_count > 0 do
        end_slide_section();
        end_slide();
        write_string("\n<script>nslides = " + str slide_count + ";</script>\n");
      done
    }
    method fun active () => slideshow-used;
  };
  
  export fun setup of (string) as "fdoc_slideshow_setup";
  export fun fdoc_slideshow of (string->0) as "fdoc_slideshow";