window.pubsub=( function(){ function sub(type,handler){ checkScope.apply(this); if(!this._events_[type]) this._events_[type]=[]; this._events_[type].push(handler); } function unsub(type,handler){ checkScope.apply(this); if(!this._events_[type]) return; if(!handler){ delete this._events_[type]; return; } for(var i=0, count=this._events_[type].length; i