Hey !!
i had the same problem , but in your code :
heading.addEvent('click', function(){
// yada yada
this.hideAll(i); -- 'this' is not the class , but rather the button !!
// yada yada
});
to solve it , you have a few options :
1. use that variable .
// saving the this in a variable before we create the callback function .
var that = this;
heading.addEvent('click', function(){
// yada yada
that.hideAll(i); // now that is know in the function , and its basicly your callback 'this'
// yada yada
});
2. if you do something with the 'this' - you can use the call function .
var that = this;
heading.addEvent('click', function(e){
// use the this which is the button if needed.
this.do_something_of_button();
that.hideAll.call(that,e); -- the hideAll function will run , and inside it the 'this' is the that you gave in the first argument !
// yada yada
});