// -*- JavaScript -*-
// `outputer' class definition  [1997/11/20]
//   Copyright 1997 by EPSON KOWA corporation

// *************************************
// ** Methods
// *************************************
function outputer__node_begin( node ){
  this.document.writeln( "<dl compact>" );
}

function outputer__node_end( node ){
  this.document.writeln( "</dl>" );
}

function outputer__node( node, bullet ){
  var image, link_image, link_text;
  
  if( node.is_open() ){
    link_image = "JavaScript:" + this.navi.config.methods.nclose
                               + "('" + node.label.first + "')";
    if( this.navi.current == node )
      image = this.navi.config.img.current_open;
    else
      image = this.navi.config.img.open;
  }else{
    link_image = "JavaScript:" + this.navi.config.methods.nopen
                               + "('" + node.label.first + "')";
    if( this.navi.current == node )
      image = this.navi.config.img.current_close;
    else
      image = this.navi.config.img.close;
  }
  
  link_text = "JavaScript:" + this.navi.config.methods.go
                            + "('" + node.label.first + "')";
  
  if( bullet )
    this.document.writeln( "<dt>", image.link( link_image ),
                                   node.print_number( false ) );
  this.document.writeln( /* "<dd>", */ node.label.second.link( link_text ) );
}

function outputer__vertex( vertex, bullet ){
  var image, link;
  
  if( this.navi.current == vertex )
    image = this.navi.config.img.current_vertex;
  else
    image = this.navi.config.img.vertex;
  
  link = "JavaScript:" + this.navi.config.methods.go
                       + "('" + vertex.label.first + "')";
  
  if( bullet )
    this.document.writeln( "<dt>", image.link( link ), vertex.print_number( false ) );
  this.document.writeln( /* "<dd>", */ vertex.label.second.link( link ) );
}

// *************************************
// ** Constractor
// *************************************
function outputer(){
  // Properties
  this.navi = null;
  this.document = null;
  
  // Methods
  this.node_begin = outputer__node_begin;
  this.node_end = outputer__node_end;
  this.node = outputer__node;
  this.vertex = outputer__vertex;
}
