if (document.observe) {
    document.observe('dom:loaded', function(e) {
        if($('mailerform')) {
            data = $('mailerform').getElements().collect(function(i){ if(i.name.match(/^data/)) return i.name.replace(/data\[/, '').replace(/\]/, ''); }).compact().uniq();
            h = document.createElement("input");
            h.name = 'ordered_input_names';
            h.type = 'hidden';
            h.value = data;
            $('mailerform').appendChild(h);

            $('mailerform').observe('submit', function() {
                $('submit').value = 'submitting...';
                $('submit').disable();
            })
        }
    });
}
