function sub(type,handler){ if(!handler){ var err=new ReferenceError('handler not defined'); throw(err); } checkScope.apply(this); if(!this._events_[type]) this._events_[type]=[]; this._events_[type].push(handler); } function unsub(type,handler){ if(!handler){ var err=new ReferenceError('handler not defined. if you wish to remove all handlers from the event please pass "*" as the handler'); throw err; } checkScope.apply(this); if(handler=='*'){ delete this._events_[type]; return; } if(!this._events_[type]) return; for(var i=0, count=this._events_[type].length; i