open Safestd
open Safeapplets
open Safetk

open Tk
open Viewers
open Hyper

let f frame ctx =
  try
    let url = List.assoc "url" ctx.viewer_params
    and title = List.assoc "title" ctx.viewer_params in
    let link = {h_uri = url;
                h_context = None;
		h_method = GET} in
    let hyperf = List.assoc "goto" ctx.viewer_hyper in
    let t = Button.create frame [Text title;
			     Command (fun _ -> hyperf.hyper_func link)]
     in
     pack [t][]
  with
    Not_found -> failwith "Navigation not available"

let _ = Applets.register "f" f
