private void GuardarDocumentos( string directory , string header , string footer , NodoArbol nodo , ArrayList archivosGenerados , WebIndex indexer )
        {
            if( nodo.body != null )
            {
                string texto = "";
                if( nodo.body.innerText != null )
                    texto = nodo.body.innerText.Trim();

                if( !texto.Equals("") )
                {
                    bool guardar = true;
                    string titulo = "";
                    IHTMLElement seccion = null;

                    seccion = SearchFirstCutNode( nodo.body );
                    if( seccion != null && seccion.innerText != null )
                    {
                        titulo = seccion.innerText.Trim() ;
                        if( titulo.Length == 0 )
                            guardar = false;
                    }

                    if( guardar )
                    {
                        // hacer un preproceso de TODOS los nodos del cuerpo:
                        IHTMLElementCollection col = (IHTMLElementCollection)nodo.body.children;
                        foreach( IHTMLElement nodoBody in col )
                            PreProcesarNodo( nodoBody , null);

                        // Generar el documento a guardar:

                        IHTMLDOMNode domNode = (IHTMLDOMNode)nodo.body;
                        IHTMLElement clonedBody = (IHTMLElement)domNode.cloneNode(true);

                        // Si hay pie o cabecera, aƱadirlos al body:
                        if (header != null && !header.Equals(""))
                            clonedBody.insertAdjacentHTML("afterBegin", header);
                        if (footer != null && !footer.Equals(""))
                            clonedBody.insertAdjacentHTML("beforeEnd", footer);

                        iDoc.title = titulo;
                        AntesYDespuesBody();

                        string archivo = directory + Path.DirectorySeparatorChar + nodo.Archivo;

                        Encoding encoding = Encoding.GetEncoding( iDoc.charset );
                        StreamWriter writer = new StreamWriter( archivo , false , encoding );
                        writer.WriteLine( textoAntesBody );
                        texto = clonedBody.outerHTML;

                        // Parece que hay un bug por el cual pone about:blank en los links. Quitarlos:
                        texto = texto.Replace( "about:blank" , "" ).Replace("about:" , "" );
                        writer.WriteLine( texto );
                        writer.WriteLine( textoDespuesBody );
                        writer.Close();

                        // Clean the files using Tidy
                        TidyOutputFile(archivo);

                        if (FirstChapterContent == null)
                        {
                            // This is the first chapter of the document. Store it clean, because
                            // we will need after.
                            FirstChapterContent = nodo.body.innerHTML.Replace("about:blank", "").Replace("about:", "");
                        }

                        archivosGenerados.Add( archivo );

                        if (indexer != null)
                            // Store the document at the full text search index:
                            indexer.AddPage(nodo.Archivo, nodo.Title , clonedBody );
                    }
                }
            }

            foreach( NodoArbol hijo in nodo.Hijos )
                GuardarDocumentos( directory , header , footer , hijo , archivosGenerados , indexer );
        }
        private void GuardarDocumentos(string directory, HtmlPageDecorator decorator, NodoArbol nodo, ArrayList archivosGenerados, WebIndex indexer)
        {
            if( nodo.body != null )
            {
                string texto = "";
                if( nodo.body.innerText != null )
                    texto = nodo.body.innerText.Trim();

                if( !texto.Equals("") )
                {
                    bool guardar = true;
                    string titulo = "";
                    IHTMLElement seccion = null;

                    seccion = SearchFirstCutNode( nodo.body );
                    if( seccion != null && seccion.innerText != null )
                    {
                        titulo = seccion.innerText.Trim() ;
                        if( titulo.Length == 0 )
                            guardar = false;
                    }

                    if( guardar )
                    {
                        // hacer un preproceso de TODOS los nodos del cuerpo:
                        IHTMLElementCollection col = (IHTMLElementCollection)nodo.body.children;
                        foreach( IHTMLElement nodoBody in col )
                            PreprocessHtmlNode( nodoBody , null);

                        // Save the section, adding header, footers, etc:
                        string filePath = directory + Path.DirectorySeparatorChar + nodo.Archivo;
                        decorator.ProcessAndSavePage(nodo.body, filePath, nodo.Name);

                        if (FirstChapterContent == null)
                        {
                            // This is the first chapter of the document. Store it clean, because
                            // we will need after.
                            FirstChapterContent = nodo.body.innerHTML.Replace("about:blank", "").Replace("about:", "");
                        }

                        archivosGenerados.Add(filePath);

                        if (indexer != null)
                            // Store the document at the full text search index:
                            //indexer.AddPage(nodo.Archivo, nodo.Title, nodo.body);
                            indexer.AddPage(nodo.Archivo, nodo.Name, nodo.body);

                    }
                }
            }

            foreach( NodoArbol hijo in nodo.Hijos )
                GuardarDocumentos( directory , decorator , hijo , archivosGenerados , indexer );
        }