Ну, без jQ вот как вариант:
function addClass (element, className) {
if (hasClass(element, className)) {
return;
}
element.className = element.className.length > 0 ?
element.className + " " + className :
className;
}
function removeClass (element, className) {
var pattern = new RegExp("\\s?" + className);
element.className = element.className.replace(pattern, "");
}
function hasClass(element, className) {
return element.className.indexOf(className) !== -1;
}
function toggleInherited(linkObj, expand) {
var base = linkObj.id,
list = document.getElementById(base + "-list"),
summary = document.getElementById(base + "-summary"),
trigger = document.getElementById(base + "-trigger"),
doHasClassClosed = hasClass(linkObj, "closed"),
doHasClassOpened = hasClass(linkObj, "opened");
if ( (expand == null && doHasClassClosed) || expand ) {
list.style.display = "none";
summary.style.display = "block";
trigger.src = toRoot + "assets/images/triangle-opened.png";
removeClass(linkObj, "closed");
addClass(linkObj, "opened");
} else if ( (expand == null && doHasClassOpened) || (expand == false) ) {
list.style.display = "block";
summary.style.display = "none";
trigger.src = toRoot + "assets/images/triangle-closed.png";
removeClass(linkObj, "opened");
addClass(linkObj, "closed");
}
return false;
}