	
    
    /**
     * Automatically creates linked Table of Contents.
     */
    function CreateIndex(){
      var list = document.getElementsByTagName("A"),oTop,parentDiv,oID,oAnchor;
      var theIndex='<table class="toc"><th class="toc">Table of Contents</th><tr><td><UL>';

      for (var i=0; i < list.length; i++) {
        if(list[i].className == "group"){
          theIndex +='<LI class="index"><A class="index" href="#'+list[i].id+'">'+list[i].id+". "+list[i].innerHTML+'</A>';
        }else if(list[i].className == "item"){
          var val = list[i].id;
          theIndex +='<LI class="indexitem"><A class="indexitem" href="#'+val+'">'+val+". "+list[i].innerHTML+'</A>';
          if(list[i].id){ // Do only if the object has an ID value
            oAnchor = document.getElementById(list[i].id);
            oTop = document.createElement("div");
            oTop.innerHTML = "<a href='#top' class='top'>top</a>";
            oTop.align = "center";
            parentDiv = oAnchor.parentNode;
            parentDiv.insertBefore(oTop,oAnchor);
            oID = document.createElement("span");
            oID.innerHTML = val+". ";
            parentDiv.insertBefore(oID,oAnchor);
            i++; // increment to skip over the newly created "A" tag
          }
        }else if(list[i].className == "subitem"){
          var val = list[i].id;
          theIndex +='<LI class="subindexitem"><A class="subindexitem" href="#'+val+'">'+val+". "+list[i].innerHTML+'</A>';
          if(list[i].id){ // Do only if the object has an ID value
            oAnchor = document.getElementById(list[i].id);
            oTop = document.createElement("div");
            oTop.innerHTML = "<a href='#top' class='top'>top</a>";
            oTop.align = "center";
            parentDiv = oAnchor.parentNode;
            parentDiv.insertBefore(oTop,oAnchor);
            oID = document.createElement("span");
            oID.innerHTML = val+". ";
            oID.style.color = "Maroon";
            parentDiv.insertBefore(oID,oAnchor);
            i++; // increment to skip over the newly created "A" tag
          }
        }else if(list[i].className == "subitem2"){
          var val = list[i].id;
          theIndex +='<LI class="subindexitem2"><A class="subindexitem2" href="#'+val+'">'+val+". "+list[i].innerHTML+'</A>';
          if(list[i].id){ // Do only if the object has an ID value
            oAnchor = document.getElementById(list[i].id);
            oTop = document.createElement("div");
            oTop.innerHTML = "<a href='#top' class='top'>top</a>";
            oTop.align = "center";
            parentDiv = oAnchor.parentNode;
            parentDiv.insertBefore(oTop,oAnchor);
            oID = document.createElement("span");
            oID.innerHTML = val+". ";
            parentDiv.insertBefore(oID,oAnchor);
            i++; // increment to skip over the newly created "A" tag
          }
        }else if(list[i].className == "subitem3"){
          var val = list[i].id;
          theIndex +='<LI class="subindexitem3"><A class="subindexitem3" href="#'+val+'">'+val+". "+list[i].innerHTML+'</A>';
          if(list[i].id){ // Do only if the object has an ID value
            oAnchor = document.getElementById(list[i].id);
            oTop = document.createElement("div");
            oTop.innerHTML = "<a href='#top' class='top'>top</a>";
            oTop.align = "center";
            parentDiv = oAnchor.parentNode;
            parentDiv.insertBefore(oTop,oAnchor);
            oID = document.createElement("span");
            oID.innerHTML = val+". ";
            parentDiv.insertBefore(oID,oAnchor);
            i++; // increment to skip over the newly created "A" tag
          }
        }
      }
      theIndex +='</UL></td></tr></table>';
      var oDiv = document.getElementById("TOC");
      oDiv.innerHTML = theIndex;
    }
    
    /*********************** These are required by ELinks.htm ************************/

    /**
     * This function is used to retrieve a file from the server.
     * First it creates an IFrame, then calls GetAjaxFile.php which also parses the ajax file and displays it in the IFrame.
     *
     * @param elemID String, the element ID that contains the onClick()
     * @param file Srting, the file name to retrieve.
     * 
     * Currently retrieving ELinks.js and Installer.js
     * ToDo Options: could pass in the width and height
     * The GetAjaxFile.php script could also be put in a central location store just a single copy.
     * The file param would have to include the full path as well since the files could be in different locations.
     */
    function upDateIFrame(elemID,file){
      var Obj, ObjParent, oIframe;
      Obj = document.getElementById(elemID);
      ObjParent = Obj.parentNode;
      Obj.style.display = 'none';
    
      oIframe = document.createElement("iframe");
      oIframe.id = elemID + "_IFrame";
      oIframe.width = '100%';
      oIframe.height = '500';
      oIframe.style.borderStyle = 'none';
      oIframe.src = 'http://www.canadiandomainregistry.ca/contrib/GetAjaxFile.php?file=elinksV2/'+file;
      ObjParent.appendChild(oIframe);
    }

    var btnUp, btnDn, btnMore;
    btnUp="v1.png";
    btnDn="v1.close.png";
    btnMore="MoreInfo.png";
    
    /**
     * A function that uses the class name to find and adds onclick links/images.
     * Saves having to type it in every where a link is required.
     * Based on the CreateIndex() concept.
     */
    function appendVer1() { 
      var oElems=document.getElementsByTagName("span"),btnNum=0,oVer2;
      for(i in oElems){ 
        oVer2=oElems[i];
        if(oVer2.className === "moreInfo") {
          oVer2.innerHTML = oVer2.innerHTML + "<img class='ver1Img' onclick='ShowVer1(this)' id='showBtn"+btnNum+"' src='"+btnMore+"' title='Show more Info'>";
        }else if(oVer2.className === "ver2") {
          oVer2.innerHTML += "<img class='ver1Img' onclick='ShowVer1(this)' id='showBtn"+btnNum+"' src='"+btnUp+"' title='Show version 1 syntax'>";
        }else if(oVer2.className === "lessInfo") {
          oVer2.innerHTML = oVer2.innerHTML + "<img class='ver1Img' onclick='ShowVer1(this)' id='hideBtn"+btnNum+"' src='"+btnDn+"'><br />";
          btnNum+=1; // increment only after finding its show btn
        }else if(oVer2.className === "ver1") {
          oVer2.innerHTML = oVer2.innerHTML + "<img class='ver1Img' onclick='ShowVer1(this)' id='hideBtn"+btnNum+"' src='"+btnDn+"'><br />";
          btnNum+=1; // increment only after finding its show btn
        }
      }
    }
  
    /**
     *  A custom hide/show used to refer to the version 1 code changes
     */
    function ShowVer1(elem){
      var elemSibling,theID,thisClass;
      thisClass = elem.parentNode.className;
      if(thisClass === "ver1") {
        theID = "showBtn"+elem.id.slice(7);
        document.getElementById(theID).src=btnUp;
        elem.parentNode.style.display = "none";
      }else if(thisClass === "ver2") { 
        elem.src = "blank.png";
        theID = "hideBtn"+elem.id.slice(7);
        elemSibling = document.getElementById(theID).parentNode;
        elemSibling.style.display = "inline";
        elemSibling.style.color = "red";
      }else if(thisClass === "lessInfo") {
        theID = "showBtn"+elem.id.slice(7);
        document.getElementById(theID).src=btnMore;
        elem.parentNode.style.display = "none";
      }else if(thisClass === "moreInfo") { 
        elem.src = "blank.png";
        theID = "hideBtn"+elem.id.slice(7);
        elemSibling = document.getElementById(theID).parentNode;
        elemSibling.style.display = "inline";
        //elemSibling.style.color = "red";
      }
    }
    
    /**
     *  An image Pre-loader.
     */ 
    function FT_PreloadImages() {
      var argc,i;
      if (document.images) {
        if (typeof(document.FT) === 'undefined') { document.FT = new Object();}
        document.FT.loaded_images = [];
        argc = arguments.length;
        for (i=0; i<argc; i+=1) {
          document.FT.loaded_images[i] = new Image();
          document.FT.loaded_images[i].src = arguments[i];
        }
      }
    }
    
    function init() {
      CreateIndex();
      appendVer1();
      ELinks();
      FT_PreloadImages('blank.png');
      //FT_PreloadImages('lang/Hide-Dn.png', 'lang/Show-Dn.png') // mouse down images are not currently being used.
    }

    onload = init;