That did the trick. Thanks.

What is a RegExp and why do you use it?
Why couldn't you just do this:
Code:
function replace_class(o, ncls)
{
    o.className = "ncls";
}