// {{{ docs <-- this is a VIM (text editor) text fold

    var domTT_classPrefix = 'domTT';
    var domTT_maxWidth = 300;
    var tooltipArray = new Array();
    
    function findNodeInObjectlist(aNode)
    {
       for(i=0; i<tooltipArray.length; i++)
       {
          if(tooltipArray[i].objectNode == aNode)
          {
            return i;
          }
        }
        return -1;
    }
    
    function addNodeToObjectlist(aNode, text)
    {
        tempObject = new Object;
        tempObject.objectNode = aNode;
        tempObject.tooltip = text;
        tooltipArray.push(tempObject);
        return (tooltipArray.length -1);
    }
    
    function nl2br(aString)
    {
        return aString.replace(/[\n]/g,"<br/>");
    }

    function textWrapper(aString, columnWidth)
    {
        
        returnString = "";
        
        aString = aString.replace(/<br>/, " <br/> ");
        
        tempArray = aString.split(/ /);
        
        addString = "";
        for(i=0; i<tempArray.length; i++)
        {
            if(tempArray[i] != "<br/>")
            {
                if(tempArray[i].length + addString.length <= columnWidth)
                {
                    addString += tempArray[i] + " ";
                } else {
                    returnString = returnString + addString + "<br/>";
                    addString = tempArray[i]+" ";
                } 
            } else {
                returnString = returnString + addString;
                addString = "";
            }
            
        }
        returnString += addString;
        return returnString;
        
    }
    
    function tooltipWrapper(theNode, anEvent)
    {

        // Internet explorer check disabled, all browsers are now forced to use the javascript, or revert to the official 'title' tags
       /*if(navigator.appName != "Microsoft Internet Explorer")
       {*/

            index = findNodeInObjectlist(theNode)
            if(index == -1)
            {
                text = nl2br(theNode.title)
                text = textWrapper(text, 60);
                index = addNodeToObjectlist(theNode, text);
                theNode.title = "";
            }
            
            domTT_activate(theNode, anEvent, 'content', tooltipArray[index].tooltip + "", 'direction', 'southeast', 'trail', true);
        //}
    }
// }}}
