function getFormData( form ) {
var str = '';
var gE = 'getElementsByTagName';
var inputs = [
(form[gE] ? form[gE]('input') : form.all ? form.all.tags('input') : []),
(form[gE] ? form[gE]('select') : form.all ? form.all.tags('select') : []),
(form[gE] ? form[gE]('textarea') : form.all ? form.all.tags('textarea') : [])
];
var Globals = new Array();
var fields = new Array();
for (var i = 0; i < inputs.length; i++)
{
for (j = 0; j < inputs[i].length; j++)
{
if (inputs[i][j])
{
var plus = '++'.substring(0,1);
if(escape(inputs[i][j].getAttribute('name')).replace(plus, '%2B') !== 'null')
{
fields[inputs[i][j].getAttribute('name')] = inputs[i][j];
str += escape(inputs[i][j].getAttribute('name')).replace(plus, '%2B');
str += '=' + escape(inputs[i][j].value).replace(plus, '%2B') + '&';
var names = inputs[i][j].getAttribute('name').split('[');
if ( names.length ) {
var temp = Globals;
for(k = 0; k < names.length; k++){
if (k > 0){
var name = names[k].substring(0, names[k].length - 1);
} else {
var name = names[k];
}
if (!temp[name])
{
if (k < (names.length - 1))
{
temp[name] = new Array();
} else {
temp[name] = ((inputs[i][j].value) ? inputs[i][j].value : "");
}
}
temp = temp[name];
}
}
}
}
}
}
return {"action": form.action, "request": str, "data": Globals, "fields": fields}
}