/**
 * BloxPress2
 * ----------------------
 * Copyright (C) 2006, Kjell Bublitz
 * www.bloxpress.org
 *
 * @type: Extension
 * @fileoverview Bloxpress MozDom Component
 * @author Kjell Bublitz kb@bloxpress.org
 * @version 1.3
 * @source http://developer.mozilla.org/en/docs/DOM
 */
var BloxpressDom = {
    domAllWhite: function(nod) {
        return !(/[^\t\n\r ]/.test(nod.data));
    },
    domIsIgnorable: function(nod) {
        return (nod.nodeType == 8) || ( (nod.nodeType == 3) && this.domAllWhite(nod) );
    },
    domBefore: function(sib) {
        while ((sib = sib.previousSibling)) {
            if (!this.domIsIgnorable(sib)) return sib;
        }
        return null;
    },
    domAfter: function(sib) {
        while ((sib = sib.nextSibling)) {
            if (!this.domIsIgnorable(sib)) return sib;
        }
        return null;
    },
    domLast: function(par) {
        var res = par.lastChild;
        while (res) {
            if (!this.domIsIgnorable(res)) return res;
            res = res.previousSibling;
        }
        return null;
    },
    domFirst: function(par) {
        var res = par.firstChild;
        while (res) {
            if (!this.domIsIgnorable(res)) return res;
            res = res.nextSibling;
        }
        return null;
    }
};

