var Ball = {
initialize: function(){
this.ball = $('ball');
this.ball.observe('click', this.appear.bindAsEventListener(this));
},
appear: function(event){
if (this.ballAppeared)
this.destroy();
else
this.create();
},
create: function(){
this.ballAppeared = true;
alert("Creating my ball from: " + this.ball);
},
destroy: function(){
this.ballAppeared = false;
alert("Destroying my ball from: " + this.ball);
}
};
document.observe('dom:loaded', Ball.initialize.bindAsEventListener(Ball));
Have a great day.
-justin