tate = ajax.transport.readyState;
if(readyState == 4) {
var status = ajax.transport.status, transport = ajax, json = ajax.evalJSON();
if(status == 200) {
ajax.options[''onSuccess''](transport, json);
} else {
ajax.options[''onFailure''](transport, json);
}
}
} catch (e) {}
},
setParameters: function(url, params) {
if (params && typeof params == ''string'') {
url += (url.include(''?'') ? ''&'' : ''?'') + params;
} else if (params && typeof params == ''object'') {
for(var param in params) {
url += (url.include(''?'') ? ''&'' : ''?'') + param + ''='' + params[param];
}
}
return url;
},
setRequestHeaders: function() {
var headers = {
''X-Requested-With'': ''XMLHttpRequest'',
''Accept'': ''application/xml, text/xml, text/html, text/javascript, application/javascript, application/json, text/javascript, text/plain, */*'',
''If-Modified-Since'': ''Thu, 01 Jan 1970 00:00:00 GMT''
};
this.method = ajax.options.method;
if (this.method == ''POST'') {
headers[''Content-type''] = ajax.options.contentType +
(ajax.options.encoding ? ''; charset='' + ajax.options.encoding : '''');
if (ajax.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005]) < 2005) {
headers[''Connection''] = ''close'';
}
}
for (var name in headers) {
ajax.transport.setRequestHeader(name, headers[name]);
}
},
evalJSON: function() {
try {
return eval(''('' + ajax.transport.responseText + '')'');
} catch (e) {}
}
};
var Form = {
serialize: function(element) {
var elements = $(element).all;
var queryComponents = [];
for(var i = 0; i < elements.length; i++) {
var parameter = null, method = elements[i].tagName.toLowerCase();
if([''input'', ''select'', ''textarea''].include(method)) {
parameter = Form.Serializers[method](elements[i]);
}
if(parameter != null && parameter.constructor == Array) {
var key = encodeURIComponent(parameter[0]);
var value = encodeURIComponent(parameter);
queryComponents.push(key + ''='' + value);
}
}
return queryComponents.join(''&'');
},
request: function(options) {
var params = this.toQueryParams(options.parameters);
options.parameters = this.serialize(this.form);
if(params) {
options.parameters = options.parameters.concat(''&'' + params);
}
if($(this.form).method) {
options.method = $(this.form).method;
}
return new ajax.request($(this.form).action, options);
},
toQueryParams: function(params) {
var queryComponents = [];
if (params && typeof params == ''string'') {
queryComponents.push(encodeURIComponent(params));
} else if (params && typeof params == ''object'') {
for(var param in params) {
var key = encodeURIComponent(param);
var value = encodeURIComponent(params[param]);
queryComponents.push(key + ''='' + value);
}
}
return queryComponents.join(''&'');
}
};
Form.Serializers = {
input: function(element) {
switch(element.type.toLowerCase()) {
case ''checkbox'':
case ''radio'':
return this.inputSelector(element);
default:
return this.textarea(element);
}
},
inputSelector: function(element) {
if(element.checked) {
return [element.name