/*
 * $Id: memesuite-menu.in 2537 2008-04-03 17:45:00Z cegrant $
 */
/* 
   Note: all links require "html_path+" to work in both
   the html/ and cgi-bin/ directories.
   The may be set by the user prior to calling this script.
*/
var meme_contact = '@CONTACT@';
var glam2_web = 'http://bioinformatics.org.au/glam2';
var glam2_contact = '@CONTACT@';
function make_items(html_path) {
  return [
    ['MEME Suite Menu', html_path+'intro.html',
      ['Submit A Job', html_path+'intro.html',
        ['Discover New Motifs Using MEME', html_path+'cgi-bin/meme.cgi'],
        ['Discover Motifs in Large Data Sets Using MEME-ChIP', html_path+'cgi-bin/meme-chip.cgi'],
        ['Discover New Gapped Motifs Using GLAM2', html_path+'cgi-bin/glam2.cgi'],
        ['Search Using Motifs', html_path+'search.html'],
        ['Compare Motifs Using Tomtom', html_path+'cgi-bin/tomtom.cgi'],
        ['Associate Motifs with GO-terms Using GOMO', html_path+'cgi-bin/gomo.cgi']
      ],
      ['Documentation', html_path+'documentation.html',
        ['Detailed Documentation', html_path+'documentation.html'],
        ['Release Notes', html_path+'doc/release-notes.html'],
        ['Installation Guide', html_path+'doc/meme-install.html'],
        ['Command Line Documentation', html_path+'doc/overview.html'],
        ['FAQ', html_path+'general-faq.html'],
        ['Publications', html_path+'/doc/cite.html']
      ],
      ['Downloads', html_path+'downloads.html',
        ['Download MEME Suite Software', html_path+'meme-download.html'],
        ['Copyright', html_path+'COPYRIGHT.html'],
        ['Commercial Licenses', 'http://invent.ucsd.edu/technology/cases/2010/SD2010-808.shtml']
      ],
      ['User Support', html_path+'resources.html',
        ['User Forum', 'https://www.nbcr.net/forum/viewforum.php?f=5'],
        ['MEME Suite E-mail Support', 'mailto:' + meme_contact],
        ['GLAM/GLAM2SCAN E-mail Support', 'mailto:' + glam2_contact]
      ],
      ['Alternate Servers',html_path+'alternates.html',
        ['NBCR', 'http://meme.nbcr.net'],
        ['QFAB (Australia)', 'http://meme.qfab.org/index.html'],
        ['GenOuest', 'http://tools.genouest.org/tools/meme/intro.html']
      ],
      ['Authors', html_path+'doc/authors.html'],
      ['Citing', html_path+'doc/cite.html']
    ]
  ];
}
/*
        Feel free to use your custom icons for the tree. Make sure they are all of the same size.
        User icons collections are welcome, we'll publish them giving all regards.
*/
function make_template(html_path) {
  return {
    'target'  : 'frameset', // name of the frame links will be opened in
                            // other possible values are: _blank, _parent, _search, _self and _top
    'icon_e'  : html_path+'images/empty.gif', // empty image
    'icon_l'  : html_path+'images/line.gif',  // vertical line
    'icon_32' : html_path+'images/base.gif',   // root leaf icon normal
    'icon_36' : html_path+'images/base.gif',   // root leaf icon selected
    'icon_48' : html_path+'images/blankpixel.gif',   // root icon normal
    'icon_52' : html_path+'images/blankpixel.gif',   // root icon selected
    'icon_56' : html_path+'images/blankpixel.gif',   // root icon opened
    'icon_60' : html_path+'images/blankpixel.gif',   // root icon selected
    'icon_16' : html_path+'images/blankpixel.gif', // node icon normal
    'icon_20' : html_path+'images/blankpixel.gif', // node icon selected
    'icon_24' : html_path+'images/blankpixel.gif', // node icon opened
    'icon_28' : html_path+'images/blankpixel.gif', // node icon selected opened
    'icon_0'  : html_path+'images/blankpixel.gif', // leaf icon normal
    'icon_4'  : html_path+'images/blankpixel.gif', // leaf icon selected
    'icon_2'  : html_path+'images/joinbottom.gif', // junction for leaf
    'icon_3'  : html_path+'images/join.gif',       // junction for last leaf
    'icon_18' : html_path+'images/plusbottom.gif', // junction for closed node
    'icon_19' : html_path+'images/plus.gif',       // junctioin for last closed node
    'icon_26' : html_path+'images/minusbottom.gif',// junction for opened node
    'icon_27' : html_path+'images/minus.gif'       // junctioin for last opended node
  };
}
// Title: Tigra Tree
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_menu_tree/
// Version: 1.1
// Date: 11-12-2002 (mm-dd-yyyy)
// Notes: This script is free. Visit official site for further details.
function tree (a_items, a_template) {
  this.a_tpl      = a_template;
  this.a_config   = a_items;
  this.o_root     = this;
  this.a_index    = [];
  this.o_selected = null;
  this.n_depth    = -1;
  
  var o_icone = new Image(),
    o_iconl = new Image();
  o_icone.src = a_template['icon_e'];
  o_iconl.src = a_template['icon_l'];
  a_template['im_e'] = o_icone;
  a_template['im_l'] = o_iconl;
  for (var i = 0; i < 64; i++)
    if (a_template['icon_' + i]) {
      var o_icon = new Image();
      a_template['im_' + i] = o_icon;
      o_icon.src = a_template['icon_' + i];
    }
  
  this.toggle = function (n_id) {  var o_item = this.a_index[n_id]; o_item.open(o_item.b_opened) };
  this.select = function (n_id) { return this.a_index[n_id].select(); };
  this.mout   = function (n_id) { this.a_index[n_id].upstatus(true) };
  this.mover  = function (n_id) { this.a_index[n_id].upstatus() };
  this.a_children = [];
  for (var i = 0; i < a_items.length; i++)
    new tree_item(this, i);
  this.n_id = trees.length;
  trees[this.n_id] = this;
  
  for (var i = 0; i < this.a_children.length; i++) {
    document.write(this.a_children[i].init());
    this.a_children[i].open();
  }
}
function tree_item (o_parent, n_order) {
  this.n_depth  = o_parent.n_depth + 1;
  this.a_config = o_parent.a_config[n_order + (this.n_depth ? 2 : 0)];
  if (!this.a_config) return;
  this.o_root    = o_parent.o_root;
  this.o_parent  = o_parent;
  this.n_order   = n_order;
  this.b_opened  = !this.n_depth;
  this.n_id = this.o_root.a_index.length;
  this.o_root.a_index[this.n_id] = this;
  o_parent.a_children[n_order] = this;
  this.a_children = [];
  for (var i = 0; i < this.a_config.length - 2; i++)
    new tree_item(this, i);
  this.get_icon = item_get_icon;
  this.open     = item_open;
  this.select   = item_select;
  this.init     = item_init;
  this.upstatus = item_upstatus;
  this.is_last  = function () { return this.n_order == this.o_parent.a_children.length - 1 };
}
function item_open (b_close) {
  var o_idiv = get_element('i_div' + this.o_root.n_id + '_' + this.n_id);
  if (!o_idiv) return;
  
  if (!o_idiv.innerHTML) {
    var a_children = [];
    for (var i = 0; i < this.a_children.length; i++)
      a_children[i]= this.a_children[i].init();
    o_idiv.innerHTML = a_children.join('');
  }
  o_idiv.style.display = (b_close ? 'none' : 'block');
  
  this.b_opened = !b_close;
  var o_jicon = document.images['j_img' + this.o_root.n_id + '_' + this.n_id],
    o_iicon = document.images['i_img' + this.o_root.n_id + '_' + this.n_id];
  if (o_jicon) o_jicon.src = this.get_icon(true);
  if (o_iicon) o_iicon.src = this.get_icon();
  this.upstatus();
}
function item_select (b_deselect) {
  if (!b_deselect) {
    var o_olditem = this.o_root.o_selected;
    this.o_root.o_selected = this;
    if (o_olditem) o_olditem.select(true);
  }
  var o_iicon = document.images['i_img' + this.o_root.n_id + '_' + this.n_id];
  if (o_iicon) o_iicon.src = this.get_icon();
  get_element('i_txt' + this.o_root.n_id + '_' + this.n_id).style.fontWeight = b_deselect ? 'normal' : 'bold';
  
  this.upstatus();
  return Boolean(this.a_config[1]);
}
function item_upstatus (b_clear) {
  window.setTimeout('window.status="' + (b_clear ? '' : this.a_config[0] + (this.a_config[1] ? ' ('+ this.a_config[1] + ')' : '')) + '"', 10);
}
function item_init () {
  var a_offset = [],
    o_current_item = this.o_parent;
  for (var i = this.n_depth; i > 1; i--) {
    a_offset[i] = '';
    o_current_item = o_current_item.o_parent;
  }
  return '
| ' + (this.n_depth ? a_offset.join('') + (this.a_children.length
    ? ' |