// some fixes/changes to the YUI code
// The monitorresize property seems to cause lots of javascript errors in konqueror
// So here we tell it that the default for monitor resize is FALSE, not true.
YAHOO.widget.Module.prototype.initDefaultConfig = function() {
    this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
    this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
    this.cfg.addProperty("monitorresize", { value:false, handler:this.configMonitorResize } );
};


YAHOO.util.Dom.addClass = function(el, className) {
    var f = function(el) {
        // don't care if it's already present or not. Duplicates won't hurt us. 
        // Our removeClass will make sure that all entries are removed
        el.className += ' ' + className;
    };  

    YAHOO.util.Dom.batch(el, f, YAHOO.util.Dom, true);
};

YAHOO.util.Dom.removeClass = function(el, className) {
    var re = new RegExp('(?:^|\\s+)' + className + '(?=\\s+|$)', 'g');

    var f = function(el) {
        el.className = el.className.replace(re, '');
    };  

    YAHOO.util.Dom.batch(el, f, YAHOO.util.Dom, true);
};  


YAHOO.widget.CreateDTFromMarkup = function(div, columns, cfg) {
    cfg = cfg || {}; // needs a config object or dt has a problem

    // find the table htmlelement object
    div = YAHOO.util.Dom.get(div);
    var table = div.firstChild;
    while(!table.tagName || table.tagName.toLowerCase() !== "table") {
        table = table.nextSibling;
        if (!table) { return null; }
    }
    
    var dscfg = { responseType: YAHOO.util.DataSource.TYPE_HTMLTABLE, responseSchema: { fields: columns } };
    var myDataSource = new YAHOO.util.DataSource(table, dscfg);

    // create and return the datatable
    return new YAHOO.widget.DataTable(div, columns, myDataSource, cfg); 
};
