/* -------------------------------------------------------------------------- */
/*  Helix JavaScript Library - Version 1.2                                    */
/*                                                                            */
/*  @file: helix.js                                                           */
/*                                                                            */
/*  @desc: Helix library                                                      */
/*                                                                            */
/*  @requires: Dojo Javascript library :  http://dojotoolkit.org              */
/*                                                                            */
/* -------------------------------------------------------------------------- */
/*                                                                            */
/* Note: since version 1.2 helix.js has been splitted into sub-files          */
/*       located in :                                                         */
/*       helix/src/<file>.js                                                  */
/*       helix/src/widget/<file>.js                                           */
/*                                                                            */
/* -------------------------------------------------------------------------- */

/* ------------------------------------------------ */
/* the root variable(s) of helix public symbols     */
/* ------------------------------------------------ */

  var helix    = {};  /* root of everything         */

  helix.io     = {};  /* for io                     */
  helix.widget = {};  /* for widgets                */
  helix.bionux = {};  /* for bionux                 */

/* ------------------------------------------------ */
/* helix module registration                        */
/* ------------------------------------------------ */

  dojo.registerModulePath("helix", "../helix/src");
  dojo.require("dojo.widget.*");

/* ------------------------------------------------ */
/* List of modules                                  */
/* ------------------------------------------------ */
/* helix.html                                       */
/* desc: dojo html extensions + bug corrections     */
/* location: helix/src/html.js                      */
/*                                                  */
/* helix.io.json                                    */
/* desc: dojo io json extensions                    */
/* location: helix/src/io/json.js                   */
/*                                                  */
/* helix.io.jow                                     */
/* desc: JOW (Json Object Wrapper) library          */
/* location: helix/src/io/jow.js                    */
/*                                                  */
/* helix.lang                                       */
/* desc: language extension                         */
/* location: helix/src/lang.js                      */
/*                                                  */
/* helix.widget.*                                   */
/* desc: language extension                         */
/* location: helix/src/widget/*.js                  */
/* except for utilities herein                      */
/* ------------------------------------------------ */

  helix.widget = {

  /* ------------------------------------------------ */
  /* shorthand for dojo.widget.getWidgetById          */
  
    byId: function(id) {
      return dojo.widget.getWidgetById(id);
    },

  /* ------------------------------------------------ */
  /* create a new (unused) id for widget              */
  
    newId: function (prefix) {
      prefix = prefix || "wgt";
      var id, i = 0;
      do {
        id = prefix + "_" + (i++);
      } while (dojo.widget.getWidgetById(id));
      return id;
    }, 

    /* ------------------------------------------------ */
    /* get domNode or widget domNode                    */

    domNode: function(id) {
      var elt = document.getElementById(id);
      if (elt) return elt;
      elt = dojo.widget.byId(id);
      return (elt ? elt.domNode : undefined);
    }
    
  };

