// Constructor
YAHOO.lib.SingleForm = function(el, config) {
	this.fieldsContainer = null;
	YAHOO.lib.SingleForm.superclass.constructor.call(this, el, config);
}
YAHOO.lib.SingleForm._FIELDS_CONTAINER = 'FieldsContainer';
// Create
YAHOO.lib.SingleForm.create = function(el, config) {
	if (YAHOO.lang.isUndefined(config)) config = {};
	if (YAHOO.lang.isUndefined(config.close)) config.close = false;
	if (YAHOO.lang.isUndefined(config.modal)) config.modal = false;
	if (YAHOO.lang.isUndefined(config.draggable)) config.draggable = false;
	return new YAHOO.lib.SingleForm(el, config);
}
// Extend
YAHOO.extend(YAHOO.lib.SingleForm, YAHOO.lib.Form, {
	// Init
	init: function(el, config) {
		YAHOO.lib.SingleForm.superclass.init.call(this, el, config);
		this.fieldsContainer = YAHOO.util.Dom.get(el + YAHOO.lib.SingleForm._FIELDS_CONTAINER);
	}, 
	// Load Success
	loadSuccess: function(o) {
		this.page.hideWait();
		var responce = this.page.getJSObject(o.responseText);
		if (responce) {
			this.showMessages(responce);
			if (responce.result == 1) {
				if (this.fieldsContainer && responce.data.html) {
					this.fieldsContainer.innerHTML = responce.data.html.fields;
					this.resetTooltips();
					this.render();
					this.show();
				}
			}
		}
	}, 
	// Load Failure
	loadFailure: function(o) {
		this.page.hideWait();
		this.page.loadingFailure();
	}, 
	// Load
	load: function(_action, _phase, _query) {
		this.page.showWait();
		var callback = {scope: this, success: this.loadSuccess, failure: this.loadFailure};
		var query = this.getQuery(_action, _phase, _query);
		YAHOO.util.Connect.asyncRequest('POST', this.proxy, callback, query);
	}, 
	// To string
	toString: function() {return 'StaticForm Object';}
});