$(document).ready(function(){ 
if($('#mailerform').length > 0) {
    data = $(":input[@name^='data']").map(function(){ return $(this).attr("name").replace(/data\[/, '').replace(/\]/, ''); });
    var d = new Array();
    jQuery.map(data, function(n) {if(jQuery.inArray(n, d) == -1) {d.push(n);}});
    h = document.createElement("input");
    h.name = 'ordered_input_names';
    h.type = 'hidden';
    h.value = d;
    $('#mailerform').append(h);

    $('#mailerform').submit(function() {
        $('#submit').val('submitting...');
        $('#submit').attr("disabled","disabled");
    })
}
});

