if(!console) {
	var console={
		log: function(oObj) {}
	};
}
var Formidable = {
	initialize: function(oConfig) {
		Object.extend(this, oConfig);
		this.Browser.getBrowserInfo();
	},
	SUBMIT_FULL: 1,
	SUBMIT_REFRESH: -1,
	SUBMIT_TEST: -2,
	SUBMIT_DRAFT: -3,
	SUBMIT_CLEAR: -4,
	SUBMIT_SEARCH: -5,
	
	Classes: {},		// placeholder for classes definitions; used like this: var oObj = new Formidable.Classes.SomeObject(params)
	Context: {
		Forms: {},		// placeholder for subscribed forms in the page
		Objects: {}		// placeholder for page-level objects ( like modalbox )
	},

	Lister: {
		Pager: {
			goTo: function(sFormId, iPage) {

				var aForm = Formidable.f(sFormId);
				var oForm = aForm.domNode();

				oForm[aForm.Misc.HiddenIds.Lister.page].value=iPage;
				aForm.submitRefresh();
			}
		},
		Sort: {
			by: function(sName, sDirection, sFormId) {
				
				var aForm = Formidable.f(sFormId);
				var oForm = aForm.domNode();

				oForm[aForm.Misc.HiddenIds.Lister.sortField].value=sName;
				oForm[aForm.Misc.HiddenIds.Lister.sortDirection].value=sDirection;
				oForm.action=aForm.Misc.Urls.Lister.sortAction;

				aForm.submitRefresh();
			}
		}
	},
	f: function(sFormId) {		// shortcut for getting form instance
		return this.Context.Forms[sFormId];
	},
	o: function(sObjectId) {
		return this.Context.Objects[sObjectId];
	},
	executeInlineJs: function(oJson) {
		console.log("executeInlineJs", oJson);
		$H(oJson).each(function(sJs) {
			eval(unescape(sJs));
		}.bind(this));
	},
	debugMessage: function(sMessage) {
		sMessage = sMessage.replace(/<br \/>/g, "\n");
		sMessage = sMessage.replace(/<b>/g, "");
		sMessage = sMessage.replace(/<\/b>/g, "");
		sMessage = sMessage.replace(/^\s+|\s+$/g,"");
		alert(sMessage);
	},
	Browser: {
		name: "",
		version: "",
		os: "",
		total: "",
		thestring: "",
		place: "",
		detect: navigator.userAgent.toLowerCase(),
		checkIt: function(string) {
			this.place = this.detect.indexOf(string) + 1;
			this.thestring = string;
			return this.place;
		},
		getBrowserInfo: function() {
			//Browser detect script originally created by Peter Paul Koch at http://www.quirksmode.org/
			if (this.checkIt('konqueror')) {
				this.name = "konqueror";
				this.os = "linux";
			}
			else if (this.checkIt('safari')) this.name = "safari"
			else if (this.checkIt('omniweb')) this.name = "omniweb"
			else if (this.checkIt('opera')) this.name 	= "opera"
			else if (this.checkIt('webtv')) this.name 	= "webtv";
			else if (this.checkIt('icab')) this.name 	= "icab"
			else if (this.checkIt('msie')) this.name 	= "internet explorer"
			else if (!this.checkIt('compatible')) {
				this.name = "netscape"
				this.version = this.detect.charAt(8);
			}
			else this.name = "unknown";

			if (!this.version) this.version = this.detect.charAt(this.place + this.thestring.length);

			if (!this.os) {
				if (this.checkIt('linux')) this.os 		= "linux";
				else if (this.checkIt('x11')) this.os 	= "unix";
				else if (this.checkIt('mac')) this.os 	= "mac"
				else if (this.checkIt('win')) this.os 	= "windows"
				else this.os 							= "unknown";
			}
		}
	},
	Position: {
		/* catched at http://textsnippets.com/tag/dimensions */
		putCenter: function(item) {
			item = $(item);
			var xy = item.getDimensions();
			var win = this.windowDimensions();
			var scrol = this.scrollOffset();
			item.style.left = (win.width / 2) + scrol.width - (xy.width / 2) + "px";
			item.style.top = (win.height / 2) + scrol.height - (xy.height / 2) + "px";
		},
		fullScreen: function(item) {
			item = $(item);
			var win = this.windowDimensions();
			var scrol = this.scrollOffset();
			item.style.height = scrol.height + win.height + "px";
		},
		windowDimensions: function() {
			var x, y;
			if(self.innerHeight) {
				// all except Explorer
				x = self.innerWidth;
				y = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) {
				// Explorer 6 Strict Mode
				x = document.documentElement.clientWidth;
				y = document.documentElement.clientHeight;
			} else if (document.body) {
				// other Explorers
				x = document.body.clientWidth;
				y = document.body.clientHeight;
			}
			
			if (!x) x = 0;
			if (!y) y = 0;
			return {width: x, "height": y};
		},
		scrollOffset: function() {
			var x, y;
			if(self.pageYOffset) {
				// all except Explorer
				x = self.pageXOffset;
				y = self.pageYOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {
				// Explorer 6 Strict
				x = document.documentElement.scrollLeft;
				y = document.documentElement.scrollTop;
			} else if (document.body) {
				// all other Explorers
				x = document.body.scrollLeft;
				y = document.body.scrollTop;
			}
			
			if (!x) x = 0;
			if (!y) y = 0;
			return {width: x, height: y};
		}
	}
};

Formidable.Classes.FormBaseClass = Base.extend({
	//domNode: null,		// FORM html object reference in DOM
	domNode: function() {
		//return $(this.config.id);
		return document.forms[this.sFormId];
	},
	aAddPostVars: [],
	ajaxCache: {},
	ViewState: [],
	Objects: {},		// placeholder for instanciated JS objects in the FORM

	oLoading: null,
	oDebugDiv: false,

	constructor: function(oConfig) {
		Object.extend(this, oConfig);
		this.initLoader();
	},
	o: function(sObjectId) {	// shortcut for getting object instance

		if(sObjectId == "tx_ameosformidable") {
			return Formidable;
		} else if(Formidable.f(sObjectId)) {
			return Formidable.f(sObjectId);
		} else if(this.Objects[sObjectId]) {
			return this.Objects[sObjectId];
		} else if(this.Objects[this.sFormId + "_" + sObjectId]) {
			return this.Objects[this.sFormId + "_" + sObjectId];
		}

		return $(sObjectId);
	},
	attachEvent: function(sRdtId, sEventHandler, fFunc) {
		var oObj = this.o(sRdtId);
		if(oObj && typeof(oObj) != 'undefined') {
			if(typeof(oObj.domNode) != 'undefined') { oObj = oObj.domNode();}
			if(typeof(oObj) != 'undefined' && oObj != null) {
				Event.observe(oObj, sEventHandler, fFunc.bindAsEventListener(oObj));
			}
		}
	},
	updateViewState: function(oExecuter) {
		this.ViewState.push(oExecuter);
	},
	
	executeServerEvent: function(sEventId, sSubmitMode, sParams, sHash, sJsConfirm) {

		var bThrow = false;

		if(sJsConfirm != false) {
			bThrow = confirm(unescape(sJsConfirm));
		} else {
			bThrow = true;
		}

		if(bThrow) {
			$(this.sFormId + "_AMEOSFORMIDABLE_SERVEREVENT").value=sEventId;

			if(sParams != false) {
				$(this.sFormId + "_AMEOSFORMIDABLE_SERVEREVENT_PARAMS").value=sParams;
				$(this.sFormId + "_AMEOSFORMIDABLE_SERVEREVENT_HASH").value=sHash;
			}
			
			
			if(sSubmitMode) {
				this.doSubmit(sSubmitMode, true);
			} else {
				this.domNode().submit();
			}
		}
	},
	_clientData: function(oData) {
		
		if(oData) {
			if(typeof oData == "string") {
				if(oData.slice(0, 12) == "clientData::") {
					sObjectId = oData.slice(12);
					oObj = this.o(sObjectId);
					if(oObj && typeof oObj.getValue == "function") {
						oData = oObj.getValue();
					}
				}
			} else if(typeof oData == "object") {
				for(var i in oData) {
					oData[i] = this._clientData(oData[i]);
				}
			}
		}

		return oData;
	},
	executeClientEvent: function(sObjectId, bPersist, oTask) {
		console.log("Executing client event", "sObjectId:", sObjectId, "bPersist:", bPersist, "oTask", oTask);

		if(oTask.tasks.object) {
			// it's a single task to execute
			this.executeClientTask(oTask.tasks, bPersist);
		} else {
			// it's a collection of tasks to execute
			var _this = this;

			$H(oTask.tasks).each(function(value, key) {
				_this.executeClientTask(oTask.tasks[key], bPersist);
			});
		}

		if(bPersist) {
			this.updateViewState(oTask);
		}
	},
	executeClientTask: function(oTask, bPersist) {

		if(oTask.formid) {
			// execute it on given formid
			var oForm = Formidable.f(oTask.formid);
			if(!oForm) {
				console.log("executeClientEvent: single task: on formid " + oTask.formid + ": No method named " + oTask.method + " on " + oTask.object);
			}
		} else {
			var oForm = this;
		}

		var oObject = oForm.o(oTask.object);
		if(oObject) {
			if(oObject[oTask.method]) {

				oObject[oTask.method](
					oForm._clientData(oTask.data)
				);
			} else {
				console.log("executeClientEvent: single task: No method named " + oTask.method + " on " + oTask.object);
			}
		} else {
			console.log("executeClientEvent: single task: No object named " + oTask.object);
		}
	},
	executeAjaxEvent: function(sEventName, sObjectId, sEventId, sSafeLock, bCache, bPersist, aParams, aRowParams, aLocalArguments) {

		console.log("executeAjaxEvent on " + sObjectId);
		var aValues = {};
		if(aParams) {
			for(var sKey in aParams) {

				sName = aParams[sKey];
				if(sName.slice(0, 10) == "rowInput::") {
					aInfo = sName.split("::");
					sReturnName = aInfo[1];
					sId = aInfo[2];
				} else {
					sReturnName = sName;
					sId = sName;
				}

				if((oElement = this.o(sId))) {
					aValues[sReturnName] = oElement.getParamsForMajix(
						oElement.getValue(),
						sEventName,
						aParams,
						aRowParams,
						aLocalArguments
					);
				} else if((oElement = $(this.rdtIdByName(sName)))) {
					aValues[sReturnName] = $F(oElement);
				} else {
					aValues[sReturnName] = "";
				}
			}
		}

		if(aRowParams) {
			for(var sName in aRowParams) {
				aValues[sName] = aRowParams[sName];
			}
		}

		var oObject = this.o(sObjectId);
		if(oObject.getMajixThrowerIdentity != undefined) {
			var sThrower = oObject.getMajixThrowerIdentity(sObjectId);
			aValues = oObject.getParamsForMajix(aValues, sEventName, aParams, aRowParams, aLocalArguments);
		} else {
			var sThrower = sObjectId;
		}

		var sValue = JSONstring.make(aValues, true);
		var sUrl = this.Misc.Urls.Ajax.event + "&formid=" + this.sFormId + "&eventid=" + sEventId + "&safelock=" + sSafeLock + "&value=" + escape(sValue) + "&thrower=" + escape(sThrower);

		if(!bCache) { sUrl += "&random=" + escape(Math.random());}

		if(bCache && this.ajaxCache[sUrl] != undefined) {
			this.executeAjaxResponse(
				this.ajaxCache[sUrl],
				bPersist,
				bFromCache = true
			);
		} else {
			
			this.displayLoader();

			new Ajax.Request(
				this.Misc.Urls.Ajax.event,
				{
					method:'post',
					parameters: {
						'formid': this.sFormId,
						'eventid': sEventId,
						'safelock': sSafeLock,
						'value': sValue,
						'thrower': sThrower
					},
					onSuccess: function(transport) {

						if(transport.responseText != "" && transport.responseText.substr(0, 1) != "{") {
							this.removeLoader();
							if(transport.responseText != "null") {
								Formidable.debugMessage(transport.responseText);
							}
						} else {
							eval("var oJson=" + transport.responseText + ";");
							if(bCache) {
								this.ajaxCache[sUrl] = oJson;
							}
							
							this.removeLoader();

							this.executeAjaxResponse(oJson, bPersist, bFromCache = false);
						}
						
					}.bindAsEventListener(this),

					onFailure: function(){
						/*alert('Something went wrong...');*/
						console.log("Ajax request failed");
					}.bindAsEventListener(this)
				}
			);
		}
	},
	executeViewState: function(oViewState) {
		$A(oViewState).each(function(oTasks) {
			this.executeAjaxResponse(oTasks, true, false);
		}.bind(this));
	},
	executeAjaxResponse: function(oResponse, bPersist, bFromCache) {
		
		this.executeAjaxInit(oResponse.init);
		console.log(oResponse, "zoooooooooo");
		
		if(oResponse.tasks.object) {
			// it's a single task to execute
			this.executeAjaxTask(oResponse.tasks);
		} else {
			// it's a collection of tasks to execute
			var _this = this;

			$H(oResponse.tasks).each(function(value, key) {
				_this.executeAjaxTask(oResponse.tasks[key]);
			});
		}

		this.executeAjaxAttachEvents(oResponse.attachevents);
		if(bPersist) {
			this.updateViewState(oResponse);
		}
	},
	executeAjaxInit: function(oInit) {
		var _this = this;
		for(var sKey in oInit) {
			//_this.executeAjaxTask(oResponse.tasks[key], bPersist);
			console.log("AJAX initialization:" + oInit[sKey]);
			eval(oInit[sKey]);
		};
	},
	executeAjaxAttachEvents: function(oAttach) {
		var _this = this;
		for(var sKey in oAttach) {
			//_this.executeAjaxTask(oResponse.tasks[key], bPersist);
			console.log("AJAX attach event:" + oAttach[sKey]);
			eval(oAttach[sKey]);
		};
	},
	executeAjaxTask: function(oTask) {
		
		if(oTask.formid) {
			// execute it on given formid
			var oForm = Formidable.f(oTask.formid);
			if(!oForm) {
				console.log("executeClientEvent: single task: on formid " + oTask.formid + ": No method named " + oTask.method + " on " + oTask.object);
			}
		} else {
			var oForm = this;
		}

		var oObject = oForm.o(oTask.object);
		if(oObject) {
			if(oObject[oTask.method]) {
				console.log("calling", oTask.method, "on", oTask.object);
				oObject[oTask.method](oTask.data);
			} else {
				console.log("executeAjaxResponse: single task: No method named " + oTask.method + " on " + oTask.object);
			}
		} else {
			console.log("executeAjaxResponse: single task: No object named " + oTask.object);
		}
	},
	initPersistedData: function(oData) {
		for(var key in oData) {
			if(this.o(key)) {
				try {
					this.o(key).rebirth(oData[key]);
				} catch(e) {
					// rebirth not implemented on this object
				}
			}
		}
	},
	rdtIdByName: function(sName) {
		return this.sFormId + "_" + sName;
	},
	submitClear: function() {
		this.doSubmit(Formidable.SUBMIT_CLEAR, false);
	},
	submitSearch: function() {
		this.doSubmit(Formidable.SUBMIT_SEARCH, false);
	},
	submitDraft: function() {
		this.doSubmit(Formidable.SUBMIT_DRAFT, false);
	},
	submitTest: function() {
		this.doSubmit(Formidable.SUBMIT_TEST, false);
	},
	submitRefresh: function() {
		this.doSubmit(Formidable.SUBMIT_REFRESH, false);
	},
	submitFull: function() {
		this.doSubmit(Formidable.SUBMIT_FULL, false);
	},

	submitOnEnter: function(sFromUniqueId, myfield, e) {

		var keycode;
		
		if(window.event) {
			keycode = window.event.keyCode;
		} else if (e) {
			keycode = e.which;
		} else {
			return true;
		}
		
		if(keycode == 13) {
			this.doSubmit(Formidable.SUBMIT_FULL);
			return false;
		} else {
			return true;
		}
	},
	cleanSysFields: function(bAll) {
		$(this.sFormId + "_AMEOSFORMIDABLE_SERVEREVENT").value="";
		$(this.sFormId + "_AMEOSFORMIDABLE_SERVEREVENT_PARAMS").value="";
		$(this.sFormId + "_AMEOSFORMIDABLE_SERVEREVENT_HASH").value="";
		$(this.sFormId + "_AMEOSFORMIDABLE_ADDPOSTVARS").value="";
		if(bAll) {
			if($(this.sFormId + "_AMEOSFORMIDABLE_ENTRYID")) {$(this.sFormId + "_AMEOSFORMIDABLE_ENTRYID").value="";}
			$(this.sFormId + "_AMEOSFORMIDABLE_VIEWSTATE").value="";
			$(this.sFormId + "_AMEOSFORMIDABLE_SUBMITTED").value="";
		}
	},
	doSubmit: function(iMode, bServerEvent) {

		if(!iMode) { iMode = "";}
		if(!bServerEvent) {
			this.cleanSysFields();
		}

		$(this.sFormId + "_AMEOSFORMIDABLE_ADDPOSTVARS").value=JSONstring.make(this.aAddPostVars, true);

		// submitting Main form
		$(this.sFormId + "_AMEOSFORMIDABLE_SUBMITTED").value=iMode;

		if(this.ViewState.length > 0) {
			// saving viewstate
			$(this.sFormId + "_AMEOSFORMIDABLE_VIEWSTATE").value=JSONstring.make(this.ViewState, true);
		} else {
			$(this.sFormId + "_AMEOSFORMIDABLE_VIEWSTATE").value="";
		}

		this.domNode().submit();
	},
	doNothing: function(oSource) {
		return true;
	},
	scrollTo: function(sName) {
		var oObj = this.o(sName);
		if(oObj) {
			if(typeof oObj.domNode == "undefined") {
				Element.scrollTo(oObj);
			} else {
				Element.scrollTo(oObj.domNode());
			}
		}
	},
	sendToPage: function(sUrl) {
		document.location.href = sUrl;
	},
	openPopup: function(mUrl) {
		if(typeof mUrl["url"] != 'undefined') {
			// it's an array of parameters
			
			var aProps = [];

			if(typeof mUrl["name"] != 'undefined') { var sName = mUrl["name"];}
			if(typeof mUrl["menubar"] != 'undefined') {
				if(mUrl["menubar"] == true) {
					aProps.push("menubar=yes");
				} else {
					aProps.push("menubar=no");
				}
			}

			if(typeof mUrl["status"] != 'undefined') {
				if(mUrl["status"] == true) {
					aProps.push("status=yes");
				} else {
					aProps.push("status=no");
				}
			}

			if(typeof mUrl["scrollbars"] != 'undefined') {
				if(mUrl["scrollbars"] == true) {
					aProps.push("scrollbars=yes");
				} else {
					aProps.push("scrollbars=no");
				}
			}

			if(typeof mUrl["width"] != 'undefined') {
				aProps.push("width=" + mUrl["width"]);
			}

			if(typeof mUrl["height"] != 'undefined') {
				aProps.push("height=" + mUrl["height"]);
			}

			window.open(mUrl["url"], sName, aProps.join(", "));
		} else {
			window.open(mUrl);
		}
	},
	toggleDebug: function() {
		var oDiv=$(this.sFormId + '_debugzone');
		
		if(oDiv && oDiv.style.display == 'none'){
			oDiv.style.display='block';
			
			aDivs = document.getElementsByClassName("ameosformidable_debugcontainer_void");
			for(sKey in aDivs) { aDivs[sKey].className = "ameosformidable_debugcontainer";}
			
			aDivs = document.getElementsByClassName("ameosformidable_debughandler_void");
			for(sKey in aDivs) { aDivs[sKey].className = "ameosformidable_debughandler";}

		} else {
			oDiv.style.display='none';
			
			aDivs = document.getElementsByClassName("ameosformidable_debugcontainer");
			for(sKey in aDivs) { aDivs[sKey].className = "ameosformidable_debugcontainer_void";}
			
			aDivs = document.getElementsByClassName("ameosformidable_debughandler");
			for(sKey in aDivs) { aDivs[sKey].className = "ameosformidable_debughandler_void";}
		}
	},
	toggleBacktrace: function(iNumCall) {

		var oDiv = $(this.sFormId + '_formidable_call' + iNumCall + '_backtrace');

		if(oDiv && oDiv.style.display == 'none') {
			oDiv.style.display='block';
		} else {
			oDiv.style.display='none';
		}
	},
	debug: function(sMessage) {

		if(this.oDebugDiv == false) {
			this.oDebugDiv = $div({
				id: this.sFormId + "-majixdebug",
				style: "padding: 5px; border: 2px solid red; background-color: white; height: 500px; overflow: scroll;"
			});
			this.domNode().appendChild(this.oDebugDiv);
		}
		var oDate = new Date();
		var sTime = oDate.getHours() + ":" + oDate.getMinutes() + ":" + oDate.getSeconds();

		this.oDebugDiv.innerHTML =
			"<div style='font-weight: bold; font-size: 20px;'>DEBUG - " + sTime + "</div>" +
			sMessage +
			"<hr style='margin: 20px; padding:0; border: 0; border-top:2px solid black; color: black; '/>" +
			this.oDebugDiv.innerHTML;

		this.scrollTo(this.oDebugDiv.id);
		this.oDebugDiv.scrollTop = 0;
	},
	requestNewI18n: function(aParams) {
		this.cleanSysFields(true);
		this.addPostVar({
			"action": "requestNewI18n",
			"params": aParams
		});
		this.submitClear();
	},
	requestEdition: function(aParams) {
		this.cleanSysFields(true);
		this.addPostVar({
			"action": "requestEdition",
			"params": aParams
		});
		this.submitClear();
	},
	execOnNextPage: function(aTask) {
		this.addPostVar({
			"action": "execOnNextPage",
			"params": aTask
		});
	},
	addFormData: function(aData) {
		this.addPostVar({
			"action": "formData",
			"params": aData
		});
	},
	addPostVar: function(aVar) {
		this.aAddPostVars.push(aVar);
	},
	initLoader: function() {
		this.oLoading = $img({
			style: "position: fixed; left: 50%; top: 50%; margin: 0; padding: 0; z-index: 999999999;",
			src: Formidable.path + "res/images/loading.gif"
		});
	},
	displayLoader: function() {

		if(Formidable.Browser.name == "internet explorer") {
			this.oLoading.style.position = "absolute";
			Formidable.Position.putCenter(this.oLoading);
		}

		if(this.Misc.MajixSpinner.left) {
			posLeft = this.Misc.MajixSpinner.left;
			if((parseInt(posLeft) + "") == posLeft) {
				posLeft += "px";
			}

			this.oLoading.style.left = posLeft;
		}

		try {
			document.body.appendChild(this.oLoading);
		} catch(e) {}
	},
	removeLoader: function() {
		try {
			DOM.remove(this.oLoading);
		} catch(e) {}
	}
});



Formidable.Classes.RdtBaseClass = Base.extend({
	oForm: null,
	config: {},
	constructor: function(oConfig) {
		this.config = oConfig;
		this.oForm = Formidable.f(this.config.formid);
	},
	domNode: function() {
		return $(this.config.id);
	},
	replaceData: function(sData) {
		this.clearData();
		this.domNode().value = sData;
	},
	clearData: function(oData) {
		this.domNode().value = "";
	},
	getValue: function() {
		return $F(this.domNode());
	},
	displayBlock: function() {
		this.domNode().style.display="block";
		this.displayBlockLabel();
	},
	displayNone: function() {
		this.domNode().style.display="none";
		this.displayNoneLabel();
	},
	displayDefault: function() {
		this.domNode().style.display="";
		this.displayDefaultLabel();
	},
	displayNoneLabel: function() {
		if(this.getLabel()) {
			this.getLabel().style.display="none";
		}
	},
	displayBlockLabel: function() {
		if(this.getLabel()) {
			this.getLabel().style.display="block";
		}
	},
	displayDefaultLabel: function() {
		if(this.getLabel()) {
			this.getLabel().style.display="";
		}
	},
	getLabel: function() {
		return $(this.config.id + "_label");
	},
	replaceLabel: function(sLabel) {
		oLabel = this.getLabel();
		if(oLabel) {
			oLabel.innerHTML = sLabel;
		}
	},
	visible: function() {
		//this.displayBlock();
		this.domNode().style.visibility="visible";
	},
	hidden: function() {
		//this.displayBlock();
		this.domNode().style.visibility="hidden";
	},
	enable: function() {
		Form.enable(this.config.id);
	},
	disable: function() {
		Form.disable(this.config.id);
	},
	toggleDisplay: function() {
		if(this.domNode().style.display=="none") {
			this.displayBlock();
		} else {
			this.displayNone();
		}
	},
	toggleVisibility: function() {
		if(this.domNode().style.visibility=="hidden") {
			this.visible();
		} else {
			this.hidden();
		}
	},
	focus: function() {
		this.domNode().focus();
	},
	blur: function() {
		this.domNode().blur();
	},
	rebirth: function(oValue) {
		/* none in superclass */
	},
	Fx: function(aParams) {
		if(typeof Scriptaculous!='undefined') {
			oLabel = this.getLabel();

			switch(aParams["effect"]) {
				case "appear":	{
					if(oLabel) {
						new Effect.Parallel([
							new Effect.Appear(this.domNode()),
							new Effect.Appear(oLabel)
						], aParams["params"]);
					} else {
						new Effect.Appear(this.domNode(), aParams["params"]);
					}
					break;
				}
				case "fade": {
					if(oLabel) {
						new Effect.Parallel([
							new Effect.Fade(this.domNode()),
							new Effect.Fade(oLabel)
						], aParams["params"]);
					} else {
						new Effect.Fade(this.domNode(), aParams["params"]);
					}
					break;
				}
				case "puff": { new Effect.Puff(this.domNode(), aParams["params"]); break; }
				case "blinddown": { new Effect.BlindDown(this.domNode(), aParams["params"]); break; }
				case "blindup": { new Effect.BlindUp(this.domNode(), aParams["params"]); break; }
				case "switchoff": { new Effect.SwitchOff(this.domNode(), aParams["params"]); break; }
				case "slidedown": { new Effect.SlideDown(this.domNode(), aParams["params"]); break; }
				case "slideup": { new Effect.SlideUp(this.domNode(), aParams["params"]); break; }
				case "dropout": { new Effect.DropOut(this.domNode(), aParams["params"]); break; }
				case "shake": { new Effect.Shake(this.domNode(), aParams["params"]); break; }
				case "pulsate": { new Effect.Pulsate(this.domNode(), aParams["params"]); break; }
				case "squish": { new Effect.Squish(this.domNode(), aParams["params"]); break; }
				case "fold": { new Effect.Fold(this.domNode(), aParams["params"]); break; }
				case "grow": { new Effect.Grow(this.domNode(), aParams["params"]); break; }
				case "shrink": { new Effect.Shrink(this.domNode(), aParams["params"]); break; }
				case "highlight": { new Effect.Highlight(this.domNode(), aParams["params"]); break; }
				case "toggleAppear": { new Effect.toggle(this.domNode(), "appear", aParams["params"]); break; }
				case "toggleSlide": { new Effect.toggle(this.domNode(), "slide", aParams["params"]); break; }
				case "toggleBlind": { new Effect.toggle(this.domNode(), "blind", aParams["params"]); break; }
			}
		} else {
			console.log("Scriptaculous is not loaded. Add /meta/libs = scriptaculous to your formidable");
		}
	},
	getMajixThrowerIdentity: function(sObjectId) {
		return sObjectId;
	},
	getParamsForMajix: function(aValues, sEventName, aParams, aRowParams, aLocalArguments) {
		return aValues;
	},
	getName: function() {
		return this.config.id.substr(this.config.formid.length + 1);
	}
});


