var SimpleForm = Class.create(BaseControl, {
    url:null,

    isChanged: function()
    {
        return true;
    },

    observeEvent: function()
    {
        var me = this;
        this.find('.save').invoke('observe', 'click', function(){
            me.save();
        });
    },

    save: function()
    {
        if (this.isChanged())
            this.submit();
    },

    submit: function()
    {
        this.showLoader();
        var me = this;
        Client.ajax(this.url, {
            parameters: this.serialize(),
            onComplete: function(response){
                me.update(response);
            }
        });
    },

    updateMessageFlash: function(value)
    {
        this.find('.message_flash').each(function(e){
            e.hide().update(value).popUp();
        });
    },

    showLoader: function()
    {
        this.find('.message_flash').invoke('update', '<div class="loading_bar"></div>');
    }
});