1)) { height = this.getAttribute('editorheight') * 1; } var width = '100%'; if (this.hasAttribute('editorwidth') && ((this.getAttribute('editorwidth') * 1) > 1)) { width = this.getAttribute('editorwidth') * 1; } for(var i = 0;i < document.styleSheets.length; i++) { var h = document.styleSheets.item(i).href; if (!h.match(/HtmlEdit.css$/)) { continue; } this.image_urlbase = document.styleSheets.item(i).href.replace(/HtmlEdit.css$/, ''); } var toolbars = new Array('editToolbar', 'toolbarDeck'); for (var i =0; i < toolbars.length;i++) { var node = document.getAnonymousElementByAttribute(this, "anonid", toolbars[i]) //alert(node); this.replaceMenuImages(node); } var doc = new DOMParser().parseFromString("", 'text/xml'); doc = doc.firstChild; this.editor = document.importNode(doc,true); editor.parentNode.replaceChild(this.editor,editor); var _t = this; this.onLoadEventListener = function() { _t.onload(); } window.addEventListener("load", this.onLoadEventListener , false); return; ]]> var stylePulldown = document.getAnonymousElementByAttribute(this, "anonid", "stylemenupopup"); for (var i in styles) { var style = styles[i]; var mi = document.createElement('menuitem'); mi.setAttribute('value', 'span:'+style); mi.setAttribute('label', '.'+style); mi.setAttribute('tooltiptext', '.'+style); stylePulldown.appendChild(mi); } //alert(str); //alert(styles); ]]> 's in
 blocks with \n's */
                        for(i=0;i/g, '');
                        this.html = this.html.replace(/\<\/\>/g, '');
                        
                        // symbols to &# entries..
                        this.html = this.html.replace(/\xA9/i,    '©');
                        this.html = this.html.replace(/\xAE/i,    '®');
                        this.html = this.html.replace(/\u2122/i, '™');
                        this.html = this.html.replace(/\xA3/i,    '£');
                        this.html = this.html.replace(/\u2122/i, '™');
                        this.html = this.html.replace(/\u2014/i, '—');
                        this.html = this.html.replace(/\u2026/i, '…');
                        this.html = this.html.replace(/\xF7/i,    '÷');
                        this.html = this.html.replace(/\xE1/i,    'á');
                        this.html = this.html.replace(/\xA5/i,    '¥');
                        this.html = this.html.replace(/\u20AC/i, '€');
                        this.html = this.html.replace(/\u201C/i, '“');
                        this.html = this.html.replace(/\u201D/i, '”');
                        this.html = this.html.replace(/\u2022/i, '•');
                        this.html = this.html.replace(/\xB0/i,    '°');
                        this.html = this.html.replace(/\x85/i,    'é');
                        this.html = this.html.replace(/\xFA/i,    'ú');
                        
                        
                        
                        
                        
                        //alert(this.html);
                  
                        return this.html;
                        
                        ]]>
                 
            
            
    
            
                
                    
                 
            
             
                
                   ');
                        
                        
                        
                        
                        if (ancestors[k].tagName.toLowerCase() == context) {
                            if (align) {
                                if (ancestors[k].hasAttribute('align') && 
                                    (ancestors[k].getAttribute('align').toLowerCase() == align)) {
                                    inContext = true;
                                }
                            } else {
                                inContext = true;
                            }
                            
                        }
                    }
                    return inContext;
                    
                    ]]>
                 
            
             
               
             
                -1;i--) {
                        this._nodeHbox.removeChild( this._nodeHbox.childNodes[i]);
                    }
                    
                    
                    //this._tmpstatus.setAttribute('value','');
                    var ancestors = this.getAllAncestors();
                    var lastlab = null;
                    var firststyle = '';
                    var pos = 0;
                    for (var k in ancestors) {
                        pos++;
                        if (!ancestors[k]) {
                            // this happens if our top level is not a node.
                            continue;
                        }
                        if (ancestors[k].hasAttribute('class') && !firststyle) {
                            firststyle = ancestors[k].getAttribute('class');
                        }
                            
                        
                        var lab = document.createElement('label');
                        lab.setAttribute('value','<'+ ancestors[k].tagName.toLowerCase() + '> ' );
                        if (pos == 1){
                            lab.setAttribute('style','font-weight: bold' );
                        }
                        lab.associatedNode = ancestors[k];
                        
                        // add callback for pressing label item.
                        this._nodeHbox.insertBefore(lab,lastlab);
                        var _t = this;
                        var _node = ancestors[k];
                        var _lab = lab;
                        var _func = function() {
                            _t.selectNode(this);
                        }
                        lab.addEventListener('click', _func, true);
                        
                        lastlab = lab;
                    }
                    
                    var ml = false;
                    for (var i = 0; i < this.editToolbar.childNodes.length; i++) {
                        if (this.editToolbar.childNodes[i].tagName == 'xul:menulist') {
                            ml = this.editToolbar.childNodes[i];
                            continue;
                        }
                        if (this.editToolbar.childNodes[i].tagName != 'xul:toolbarbutton') {
                            continue;
                        }
                        
                        if (!this.editToolbar.childNodes[i].hasAttribute('tag')  ) {
                            continue;
                        }
                        
                        var enabled = this._isContextEnabled(this.editToolbar.childNodes[i].getAttribute('tag'));
                              
                        if (enabled) {
                            this.editToolbar.childNodes[i].setAttribute('checked', 'true');
                        } else {
                            this.editToolbar.childNodes[i].setAttribute('checked', 'false');
                        }
                         
                    }
                    //style - default to first item.
                    //ml.setAttribute('value',ml.childNodes[0].childNodes[0].getAttribute('label'));
                    ml.selectedIndex = 0;
                    for (var j = 0; j < ml.childNodes[0].childNodes.length; j++) {
                        var mlitem = ml.childNodes[0].childNodes[j];
                        if (!mlitem.getAttribute('value')) { 
                            continue;
                        }
                        
                        if (this._isContextEnabled(mlitem.getAttribute('value'))) {
                            
                            ml.selectedIndex = j;//setAttribute('value',mlitem.getAttribute('label'));
                            break;
                        }
                    }
                    
                    // update stylebar..
                    //alert(firststyle);
                    var stylePulldown = document.getAnonymousElementByAttribute(this, "anonid", "stylemenupopup");
                    if (!firststyle.length) {
                        stylePulldown.selectedIndex = 0;
                    } else {
                        //alert(stylePulldown.childNodes[1].getAttribute('value') );
                        for (var j=0; j < stylePulldown.childNodes.length; j++) {
                            if (stylePulldown.childNodes[j].getAttribute('value') == ('span:'+firststyle)) {
                                stylePulldown.parentNode.selectedIndex = j;
                                break;
                            }
                        }
                    }
                    this.showContextBar(ancestors);
                    
                 ]]>
                 
            
            
            
                
                
               
            
    
            
               
                 
            
            
            
                 0)) {
                            other_nodes.push(ar[i]);
                            continue;
                        }
                        if (!range.intersectsNode(ar[i]) || (range.compareNode(ar[i]) == 0))  {
                            continue;
                        }
                        
                        
                        has_other_nodes = true;
                    }
                    if (!nodes.length && other_nodes.length) {
                        nodes= other_nodes;
                    }
                    if (has_other_nodes || !nodes.length || (nodes.length > 1)) {
                        return false;
                    }
                    return nodes[0];
                    
                   ]]>
                
             
                
            
               
                 
            
            
            
          
               
               
             
            
        
    
          
                
                  
               
             
            

            
                
                
                
                
             
            
    
    
            
                
                  
               
             
            
         

            
                
                
                
                
             
            

            
              
            
                  /ig, ">");
                    str = str.replace(/\x22/ig, """);
                    // \x22 means '"' -- we use hex reprezentation so that we don't disturb
                    // JS compressors (well, at least mine fails.. ;)
                    return str;
                    ]]>
             
             
            
              
                  
                
             
            
            
                
                
                
                  
                
            
            
            
                
                  
                
              
            
            
            
                
                   1) {
                                optsAr[osplit[0]] = osplit[1];
                                if (isDefault) {
                                    defaultV = osplit[0];
                                }
                            } else {
                                optsAr[opt] = opt;
                                if (isDefault) {
                                    defaultV = opt;
                                }
                            }
                        
                        }
                        // now we have all the 
                        selNode = this.editingNode;
                        // remove all the children
                        for (var i=selNode.childNodes.length-1; i > -1; i--) {
                            selNode.removeChild(selNode.childNodes[i]);
                        }
                        for (var p in optsAr) {
                            var option = this._doc.createElement("option");
                            option.setAttribute('value', p);
                            if (defaultV == p) {
                                option.setAttribute('selected', 'selected');
                            }
                            option.appendChild(this._doc.createTextNode(optsAr[p]));
                            selNode.appendChild(option);
                        }
                        
                
                
                
                
                ]]>
              
            
            
                
                
                  
                
             
            
           
                 
            
                
                  
                
             
            
            
            
            
                
                ');
                    document.getAnonymousElementByAttribute(this, "anonid", "toolbarDeck").setAttribute("selectedIndex",'0');
                    ]]>
                
            
            
            
            
              
              
              
                  " : ">";
                        }
                        
                        for (i = root.firstChild; i; i = i.nextSibling) {
                            html += this.getHTML(i, true, editor);
                        }
                        if (outputRoot && !closed) {
                            html += "";
                        }
                        break;
                    case 3: // Node.TEXT_NODE
                        // If a text node is alone in an element and all spaces, replace it with an non breaking one
                        // This partially undoes the damage done by moz, which translates ' 's into spaces in the data element
                        if ( !root.previousSibling && !root.nextSibling && root.data.match(/^\s*$/i) ) {
                            if (root.data.length) {
                                html = ' ';
                            }
                        } else {
                            html = this.htmlEncode(root.data);
                        }
                        break;
                    case 8: // Node.COMMENT_NODE
                        html = "";
                        break;        // skip comments, for now.
                }
                return html;
             
                  ]]>
             
             
             
         
            
                
                
            
              
            
                
                
            

            
               
               
             
            

              
               
               
             
            
            
            
            
                
                
                 
            
             
                
                
               
             
                 
                
                
            
            
                
                
                
                
            
            
                
                
                
                 0) { 
                                            cols = cols + add;
                                        } else {
                                            cols++;
                                        }
                                    } else {
                                        cols++;
                                    }
                                }
                            }
                            if (value == cols) {
                                continue; // nothing changed..?
                            }
                            if (value < cols) { 
                                if (!confirm_delete)  {
                                    confirm_delete = confirm('are you sure you want to remove the last ' + (cols - value) + ' cols?');
                                    if (!confirm_delete) {
                                        return false; // eak bail out after trashing stuff?
                                    }
                                }
                                
                                for (var j=0;j <  (cols - value);j++) {
                                    // no account taken for colspan stuff...
                                    var remove = tablenode.childNodes[i].childNodes[tablenode.childNodes.length-1];
                                    remove.parentNode.removeChild(remove);
                                }
                                return true;
                            }
                            // add cols..
                            // how many cols on the last row?? = we are going to cheat for the time being.
                            var td = this._doc.createElement('td');
                            td.appendChild(this._doc.createElement('br'));
                            
                            
                            for (var j = 0; j < (value - cols); j++) {
                                var newtd = td.cloneNode(true);
                                tablenode.childNodes[i].appendChild(newtd);
                            }
                        }
                        return true;
                    }
                    if (key == 'colspan') { // td colspan...
                        var tdnode = tablenode;
                        tablenode = tdnode.parentNode.parentNode;
                        var trnode = tdnode.parentNode;
                        var cols = tablenode.getAttribute('cols');
                        var leftof = 0;
                        var ourPosition = 0;
                        for (var i=0;i 0) { 
                                    leftof = leftof + add;
                                } else {
                                    leftof++;
                                }
                            } else {
                                leftof++;
                            }
                        }
                        // is new amount too many?
                        if ((leftof + value) > cols) {
                            alert('not enough columns table for that value');
                            return false;
                        }
                        // are we adjusting stuff!!!
                        var addNodes = 0;
                        var removeNodes = value - 1;
                        if (tdnode.hasAttribute('colspan') && (tdnode.getAttribute('colspan') == value)) {
                            // same value - skip;
                            return true;
                        }
                        if (tdnode.hasAttribute('colspan') && (tdnode.getAttribute('colspan') > value)) {
                            // we are reducing.
                            addNodes = tdnode.getAttribute('colspan') -  value ;
                            removeNodes = 0;
                        }
                        if (tdnode.hasAttribute('colspan') && (tdnode.getAttribute('colspan') < value) ) {
                            // we are reducing.
                            removeNodes =  value  - tdnode.getAttribute('colspan') ;
                            addNodes = 0;
                        }
                        //alert('add: ' + addNodes +',remove: ' + removeNodes);
                        if (removeNodes) {
                            for (var i=0;i