function hasClass(obj, name) {
obj = ge(obj);
return obj && (new RegExp('(\\s|^)' + name + '(\\s|$)')).test(obj.className);
}
function addClass(obj, name) {
var obj = ge(obj);
if (!hasClass(obj, name)) {
obj.className = (obj.className ? obj.className + ' ' : '') + name;
}
}
function hasClass(selector, name) {
var obj = ge(selector);
return obj && (new RegExp('(\\s|^)' + name + '(\\s|$)')).test(obj.className);
}
function addClass(selector, name) {
var obj = ge(selector);
if ( !hasClass(selector, name) ) {
obj.className = (obj.className ? obj.className + ' ' : '') + name;
}
}
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}