var MOVTools = {
    start: function() {

//register 
if ($('register')) {        

    $('register').addEvent('submit', function(e) {
        //Prevents the default submit event from loading a new page.
        e.stop();
        //Empty the log and show the spinning indicator.
        var log = $('log_res').empty().addClass('ajax-loading');
        //Set the options of the form's Request handler. 
        //("this" refers to the $('myForm') element).
        this.set('send', {onComplete: function(response) { 
            log.removeClass('ajax-loading');
            log.set('html', response);
            if(response == 'OK') {
                setTimeout('go_to_page()', 10);
            }
        }});
        //Send the form.
        this.send();
    });
}



if ($('add_comments')) {        

    $('add_comments').addEvent('submit', function(e) {
        e.stop();
        var log = $('log_res').empty().addClass('ajax-loading');
        var comments = new Request.HTML({
        update: "comments"
        });

        this.set('send', {onComplete: function(response) { 
            log.removeClass('ajax-loading');
            log.set('html', response);
            var url = $('url').get('value'); 
            comments.get(url);
            if(response == 'OK') {              
                setTimeout('go_to_page()', 10);
            }
        }});
        this.send();
    });
}

function go_to_page()
{
window.location = '/'; // adauga firma
}
    }
};
window.addEvent('load', MOVTools.start); 
