// toggling event visibility // $Id: toggle.js,v 1.1 2007-02-20 01:56:44 ot Exp $ // v1.0 David Dorward for the W3C CSS Validation Service, 18/12/2006 // Based on v2.01 Kent Brewster, 6/8/2006 http://www.mindsack.com // namespace protection: one global variable to rule them all var W3C = {}; W3C.QA = {}; W3C.QA.Validator = {}; W3C.QA.Validator.CSS = {}; W3C.QA.Validator.CSS.toggle = { init : function(toggle, closed, hidden) { // three class names, fed in from init call this.toggleClass = toggle; this.toggleClosed = closed; this.toggleHidden = hidden; this.toggleText = "toggletext"; // crawl through the document, look for toggled elements this.crawl(document.body); }, crawl : function(el) { // get this element's next sibling var nextSib = this.getNextSibling(el); // if it has a class name, the class name matches our toggle class if (el.className && el.className.match(this.toggleClass)) { // labels are nice, but redundant with the link we are adding for (i=0;i