;(function (FMS, Backbone, _, $) {
    _.extend( FMS, {
        FMSView: Backbone.View.extend({

            render: function(){
                if ( !this.template ) {
                    console.log('no template to render');
                    return;
                }
                template = _.template( tpl.get( this.template ) );
                if ( this.model ) {
                    this.$el.html(template(this.model.toJSON()));
                } else {
                    this.$el.html(template());
                }
                this.afterRender();
                return this;
            },

            afterRender: function() {},

            afterDisplay: function() {},

            navigate: function( route, direction ) {
                if ( !direction ) {
                    direction == 'left';
                }

                FMS.router.navigate( route, { trigger: true } );
            },

            onClickButtonPrev: function() {
                this.navigate( this.prev, 'right' );
            },

            onClickButtonNext: function() {
                this.navigate( this.next, 'left' );
            },

            displayError: function(msg) {
                alert(msg);
            },

            destroy: function() { console.log('destory for ' + this.id); this._destroy(); this.remove(); },

            _destroy: function() {}
        })
    });
    _.extend( FMS.FMSView, Backbone.Events );
})(FMS, Backbone, _, $);

@@ -88,16 +88,279 @@
 extend(%7B
+%0A            tag: 'div',%0A%0A            events: %7B%0A                'pagehide': 'destroy',%0A                'pageshow': 'afterDisplay',%0A                'click .ui-btn-left': 'onClickButtonPrev',%0A                'click .ui-btn-right': 'onClickButtonNext'%0A            %7D,
 %0A%0A      

move standard events into view object