+ name + '\\s+)').test(el.className);
}

function removeClass(el, name) {
    var reg = new RegExp('(?:^' + name + '$)' +
                         '|(?:\\s+' + name + '$)' + 
                         '|(?:^' + name + '\\s+)' + 
                         '|(?:\\s+' + name + '\\s+)');
    el.className = el.className.replace(reg, function (text) {
        return ' ';
    }).replace(/\\s{2,}/, ' ').trim();
}

function addClass(el, name) {
    if (!hasClass(el, name)) {
        el.className = (el.className + ' ' 