/*!
 * Blast Mojo Framework
 *
 * Copyright (c) 2009, Blast Radius, Inc.
 * All rights reserved.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

var mojo = {
	Version: "1.12b"
};
dojo.provide("mojo.command.Behavior");
dojo.declare("mojo.command.Behavior", null, {
	_requestObj: null,
	getRequest: function() {
		if (!this._requestObj) {
			throw new Error("ERROR mojo.command.Behavior.getRequest - requestObj is not set")
		}
		return this._requestObj
	},
	_execute: function(B) {
		this._requestObj = B;
		if (typeof(B.update) == "function") {
			B.update()
		}
		if (this._requestObj == null || (!this._requestObj)) {
			throw new Error("ERROR mojo.command.Behavior._execute - requestObj is not set")
		} else {
			if (! (this._requestObj instanceof mojo.controller.Request)) {
				throw new Error("ERROR mojo.command.Behavior._execute - requestObj is not type of mojo.controller.Request")
			} else {
				if (!this._requestObj.callerObj) {
					throw new Error("ERROR mojo.command.Behavior._execute - callerObj is not set")
				}
			}
		}
		if(!this._requestObj.getParams() && typeof(this._requestObj.getParams()) == "boolean") return;
		return this.execute(B)
	},
	execute: function(A) {
		throw new Error("ERROR mojo.command.Behavior.execute - execute() method is not implemented")
	}
});
dojo.provide("mojo.command.Command");
dojo.declare("mojo.command.Command", null, {
	_requestObj: null,
	getRequest: function() {
		if (!this._requestObj) {
			throw new Error("ERROR mojo.command.Command.getRequest - requestObj is not set")
		}
		return this._requestObj
	},
	_execute: function(A) {
		this._requestObj = A;
		if (typeof(A.update) == "function") {
			A.update()
		}
		if (this._requestObj == null || (!this._requestObj)) {
			throw new Error("ERROR mojo.command.Command._execute - requestObj is not set")
		} else {
			if (! (this._requestObj instanceof mojo.controller.Request)) {
				throw new Error("ERROR mojo.command.Command._execute - requestObj is not type of mojo.controller.Request")
			}
		}
		
		if(!this._requestObj.getParams() && typeof(this._requestObj.getParams()) == "boolean") return;
		return this.execute(A)
	},
	execute: function(A) {
		throw new Error("ERROR mojo.command.Command.execute - execute() method is not implemented")
	},
	onResponse: function(A) {
		throw new Error("ERROR mojo.command.Command.onResponse - onResponse() method is not implemented")
	},
	onError: function(A) {
		throw new Error("ERROR mojo.command.Command.onError - onError() method is not implemented")
	}
});
dojo.provide("mojo.controller.Controller");
dojo.declare("mojo.controller.Controller", null, {
	constructor: function(A, B) {
		this._init(A, B)
	},
	_contextElementObj: null,
	_commands: new Array(),
	_connectHandles: new Array(),
	_queryCache: new Object(),
	_observers: new Object(),
	_tags: new Array(),
	_init: function(A, E) {
		if (this.params) {
			var D = {};
			D.onChange = function() {};
			var F = this._getBaseProperty("params");
			for (var B in F) {
				if (typeof F[B] == "object") {
					var C = F[B];
					D[B] = new mojo.controller.Param(B, dojo.clone(C.defaultValue), C.required, C.type, D);
					if (E) {
						D[B].setValue(E[B])
					}
				}
			}
			for (var B in this.params) {
				if (typeof this.params[B] == "object") {
					var C = this.params[B];
					D[B] = new mojo.controller.Param(B, dojo.clone(C.defaultValue), C.required, C.type, D);
					if (E) {
						D[B].setValue(E[B])
					}
				}
			}
			this.params = D;
			D = null;
			E = null
		}
		this._contextElementObj = null;
		if (A) {
			this._contextElementObj = A
		}
		this._commands = new Array();
		this._tags = new Array();
		this._connectHandles = new Array();
		this._callBaseMethod("addCommands");
		this.addCommands();
		this._addObservers();
		this._callBaseMethod("addIntercepts");
		this.addIntercepts();
		this.onInit();
		if (this.params) {
			for (var B in this.params) {
				if (typeof this.params[B] == "object") {
					var C = this.params[B];
					if (C.getValue() != null) {
						C.onChange()
					}
				}
			}
		}
		mojo.Messaging.subscribe("/mojo/controller/" + this.declaredClass + "/addObservers", this, "_addObservers");
		mojo.Messaging.subscribe("/mojo/controller/addObservers", this, "_addObservers")
	},
	getConfig: function(A) {
		A = A.toLowerCase();
		switch (A) {
		case "params":
			return this[A];
			break
		}
		return null
	},
	getValue: function(A) {
		return this.params[A].getValue()
	},
	setValue: function(B, A) {
		this.params[B].setValue(A)
	},
	getContextController: function(A) {
		if (this.getContextElement() && this.getContextElement().mojoControllers[A]) {
			return this.getContextElement().mojoControllers[A]
		}
		return null
	},
	_getBaseProperty: function(propertyName) {
		var superclass = eval(this.declaredClass + ".superclass");
		if (superclass.declaredClass != "mojo.controller.Controller" && superclass[propertyName]) {
			return superclass[propertyName]
		}
		return null
	},
	_callBaseMethod: function(A) {
		var B = this._getBaseProperty(A);
		if (B) {
			B.call(this)
		}
	},
	getContextElement: function() {
		if (!this._contextElementObj) {
			return null
		}
		return this._contextElementObj
	},
	onInit: function() {},
	_addObservers: function() {
		this._queryCache = new Object();
		this._observers = new Object();
		this._callBaseMethod("addObservers");
		this.addObservers();
		for (var B in this._queryCache) {
			if (this._queryCache[B]["length"]) {
				for (var D in this._observers[B]) {
					if (this._observers[B][D]["length"]) {
						var C = this._queryCache[B].length;
						for (var A = 0; A < C; A++) {
							this._addObserver(this._queryCache[B][A], D, this._observers[B][D])
						}
					}
				}
			}
		}
		this._queryCache = new Object();
		this._observers = new Object()
	},
	addObservers: function() {
		throw new Error("ERROR mojo.controller.Controller.addObservers - addObservers() method is not implemented")
	},
	removeObservers: function() {
		var A = this._connectHandles.length;
		for (var B = 0; B < A; B++) {
			dojo.disconnect(this._connectHandles[B])
		}
	},
	addObserver: function(I, E, H, F) {
		var A = function(K) {
			if (!dojo.isArray(K)) {
				return false
			}
			for (var L = 0,
			J = K.length; L < J; L++) {
				if (typeof(K[L]) != "string") {
					return false
				}
			}
			return true
		};
		if (!I) {
			return
		}
		if (!E) {
			throw new Error("ERROR mojo.controller.Controller.addObserver - srcFunc is not set")
		}
		if (typeof(E) != "string") {
			throw new Error("ERROR mojo.controller.Controller.addObserver - srcFunc is not type String")
		}
		if (!H) {
			throw new Error("ERROR mojo.controller.Controller.addObserver - cmdName is not set")
		}
		if (typeof(H) != "string" && H != null) {
			throw new Error("ERROR mojo.controller.Controller.addObserver - cmdName is not type String")
		}
		if (typeof(I) == "string" || A(I)) {
			if (!dojo.isArray(I)) {
				I = [I]
			}
			for (var D = 0,
			G = I.length; D < G; D++) {
				var C = I[D];
				if (this.getContextElement() && E.match(/^onclick|onmouse|onkey|onmove/) != null) {
					this._addObserver(this.getContextElement(), E, [{
						cmdName: H,
						paramsObj: F,
						eventDelegate: C
					}])
				} else {
					if (!this._queryCache[C]) {
						this._queryCache[C] = mojo.query(C, this.getContextElement())
					}
					if (!this._observers[C]) {
						this._observers[C] = new Object()
					}
					if (!this._observers[C][E]) {
						this._observers[C][E] = new Array()
					}
					var B = this._observers[C][E].length;
					this._observers[C][E][B] = {
						cmdName: H,
						paramsObj: F
					}
				}
			}
		} else {
			if (!dojo.isArray(I)) {
				I = [I]
			}
			for (var D = 0,
			G = I.length; D < G; D++) {
				this._addObserver(I[D], E, [{
					cmdName: H,
					paramsObj: F
				}])
			}
		}
		if (! (this._commands[H]) || this._commands[H] == null) {
			throw new Error("ERROR mojo.controller.Controller.addObserver - cmdName does not reference a Command in the Controller")
		}
	},
	_addObserver: function(J, D, A) {
		var B = new Array();
		var E = A.length;
		for (var C = 0; C < E; C++) {
			if (typeof(A[C].eventDelegate) == "undefined") {
				A[C].eventDelegate = ""
			}
			if (!this._observerIsTagged(J, D + A[C].eventDelegate, A[C])) {
				B.push(A[C]);
				this._tagObserver(J, D + A[C].eventDelegate, A[C])
			}
		}
		if (!J.mojoObservers) {
			J.mojoObservers = new Object()
		}
		if (!J.mojoObservers[D]) {
			J.mojoObservers[D.toLowerCase()] = new Array()
		}
		if (B.length > 0) {
			var H = this;
			var G = function(O) {
				var N = function(S) {
					var S = S || window.event;
					var R = S.target || S.srcElement;
					if (R.nodeType == 3) {
						R = R.parentNode
					}
					return R
				};
				if (H.getContextElement() && H.getContextElement().parentNode == null) {
					H.removeObservers()
				} else {
					var P = B.length;
					for (var L = 0; L < P; L++) {
						if (typeof(mojo) != "undefined") {
							var K = J;
							if (B[L].eventDelegate.length > 0) {
								var M = N(O);
								K = mojo.queryMatch(M, B[L].eventDelegate, H.getContextElement(), true)
							}
							if (K != null) {
								var Q = H._setRequest(B[L].paramsObj, K, O, B[L].cmdName);
								H.fireCommandChain(B[L].cmdName, Q)
							}
						}
					}
				}
			};
			var I = D.toLowerCase();
			if ((I == "onmouseleave" || I == "onmouseenter") && MooTools && Element.Events.mouseleave && Element.Events.mouseenter) {
				$(J).addEvent(D.replace("on", ""), G)
			} else {
				var F = dojo.connect(J, D, G);
				this._connectHandles.push(F)
			}
			J.mojoObservers[D.toLowerCase()].push(G)
		}
	},
	_tagObserver: function(A, E, D) {
		if (!A.mojoObserve) {
			A.mojoObserve = new Object()
		}
		if (typeof A.mojoObserve[this.declaredClass] == "undefined") {
			var F = this._tags.length;
			A.mojoObserve[this.declaredClass] = F;
			this._tags[F] = new Object()
		}
		var C = A.mojoObserve[this.declaredClass];
		var B = this._generateTagKey(E, D);
		if (this._tags[C] && !this._tags[C][B]) {
			this._tags[C][B] = true
		}
	},
	_generateTagKey: function(D, C) {
		var B = D + "_" + C.cmdName;
		if (C.paramsObj) {
			var E;
			if (typeof(C.paramsObj) == "function") {
				E = C.paramsObj.toString()
			} else {
				if (typeof(C.paramsObj) == "object") {
					for (var A in C.paramsObj) {
						if (C.paramsObj[A]) {
							E += A + ":" + C.paramsObj[A].toString() + ","
						}
					}
				}
			}
			B += "_" + E
		}
		return B
	},
	_observerIsTagged: function(A, D, C) {
		if (!A.mojoObserve) {
			A.mojoObserve = new Object()
		}
		var E = false;
		var B = this._generateTagKey(D, C);
		if (typeof A.mojoObserve[this.declaredClass] != "undefined" && this._tags[A.mojoObserve[this.declaredClass]] && this._tags[A.mojoObserve[this.declaredClass]][B]) {
			E = true
		}
		return E
	},
	addCommands: function() {
		throw new Error("ERROR mojo.controller.Controller.addCommands - addCommands() method is not implemented")
	},
	addCommand: function(cmdName, cmdObjPath) {
		if (!cmdName) {
			throw new Error("ERROR mojo.controller.Controller.addCommand - cmdName is not set")
		}
		if (typeof(cmdName) != "string") {
			throw new Error("ERROR mojo.controller.Controller.addCommand - cmdName is not type String")
		}
		if (!cmdObjPath) {
			throw new Error("ERROR mojo.controller.Controller.addCommand - cmdObjPath is not set")
		}
		if (typeof(cmdObjPath) != "string") {
			throw new Error("ERROR mojo.controller.Controller.addCommand - cmdObjPath is not type String")
		}
		if (!this._commands[cmdName]) {
			this._commands[cmdName] = new Array()
		}
		var addFunc = function(cmdName, cmdObjPath, thisObj) {
			dojo.require(cmdObjPath);
			var cmdObj = eval("new " + cmdObjPath + "()");
			if ((cmdObj instanceof mojo.command.Command) || (cmdObj instanceof mojo.command.Behavior)) {
				thisObj._commands[cmdName].push(cmdObj)
			} else {
				throw new Error("ERROR mojo.controller.Controller.addCommand - Command object is not type mojo.command.Command or mojo.command.Behavior")
			}
		};
		addFunc(cmdName, cmdObjPath, this)
	},
	getCommand: function(A) {
		if (!A) {
			throw new Error("ERROR mojo.controller.Controller.getCommand - cmdName is not set")
		}
		if (typeof(A) != "string") {
			throw new Error("ERROR mojo.controller.Controller.getCommand - cmdName is not type String")
		}
		if (this._commands[A]) {
			return this._commands[A][0]
		}
		throw new Error("ERROR mojo.controller.Controller.getCommand - cmdName does not reference a Command in the Controller")
	},
	getCommandChain: function(A) {
		if (!A) {
			throw new Error("ERROR mojo.controller.Controller.getCommandChain - cmdName is not set")
		}
		if (typeof(A) != "string") {
			throw new Error("ERROR mojo.controller.Controller.getCommandChain - cmdName is not type String")
		}
		if (!this._commands[A]) {
			throw new Error("ERROR mojo.controller.Controller.getCommandChain - cmdName does not reference a Command in the Controller")
		}
		if (this._commands[A]) {
			return this._commands[A]
		}
		return null
	},
	fireCommandChain: function(A, D) {
		var C = this._commands[A].length;
		for (var B = 0; B < C; B++) {
			this._commands[A][B]._execute(D)
		}
	},
	addIntercepts: function() {
		throw new Error("ERROR mojo.controller.Controller.addIntercepts - addIntercepts() method is not implemented")
	},
	addIntercept: function(G, F, B, E) {
		if (!G) {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - interceptType is not set")
		}
		if (typeof(G) != "string") {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - interceptType is not type String")
		}
		if (G == "before" || G == "after" || G == "around") {} else {
			throw new Error('ERROR mojo.controller.Controller.addIntercept - interceptType is not "before", "after", or "around"')
		}
		if (!F) {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - interceptCmdName is not set")
		}
		if (typeof(F) != "string") {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - interceptCmdName is not type String")
		}
		if (!B) {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - cmdName is not set")
		}
		if (typeof(B) != "string") {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - cmdName is not type String")
		}
		if (F.toString() == B.toString()) {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - a command cannot add advice to itself")
		}
		if (!this._commands[F]) {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - interceptCmdName does not reference a Command in the Controller")
		}
		if (!this._commands[B]) {
			throw new Error("ERROR mojo.controller.Controller.addIntercept - cmdName does not reference a Command in the Controller")
		}
		var C = this;
		var D = this.getCommand(F)["_execute"];
		var A = function(H) {
			if (typeof(mojo) != "undefined") {
				requestObj = C._setRequest(E, H.args[0].callerObj, H.args[0].eventObj, B, H);
				C.fireCommandChain(B, requestObj)
			}
		};
		switch (G) {
		case "before":
			this._commands[F][0]["_execute"] = function() {
				var H = {
					args: arguments,
					calleeObj: this
				};
				A.apply(this, [H]);
				return D.apply(this, arguments)
			};
			break;
		case "after":
			this._commands[F][0]["_execute"] = function() {
				var H = {
					args: arguments,
					calleeObj: this
				};
				D.apply(this, arguments);
				return A.apply(this, [H])
			};
			break;
		case "around":
			this._commands[F][0]["_execute"] = function() {
				var H = {
					args: arguments,
					calleeObj: this
				};
				H.proceed = function() {
					return D.apply(this.calleeObj, this.args)
				};
				return A.apply(this, [H])
			};
			break
		}
	},
	_setRequest: function(E, A, C, B, D) {
		var F = new mojo.controller.Request(E, A, C, B, this, D);
		return F
	}
});
mojo.controller.Controller.updateObservers = function(A) {
	if (A) {
		mojo.Messaging.publish("/mojo/controller/" + A + "/addObservers")
	} else {
		mojo.Messaging.publish("/mojo/controller/addObservers")
	}
};
dojo.provide("mojo.controller.Map");
__mojoControllerMap = null;
dojo.declare("mojo.controller.Map", null, {
	onComplete: function() {},
	constructor: function() {
		mojo.Messaging.subscribe("/mojo/controller/mapControllers", this, "mapControllers")
	},
	_controllers: new Array(),
	_siteMap: null,
	getSiteMap: function() {
		if (!this._siteMap) {
			throw new Error("ERROR mojo.controller.Map - siteMap not set")
		}
		return this._siteMap
	},
	setSiteMap: function(F) {
		if (F == null || typeof F == "undefined") {
			throw new Error("ERROR mojo.controller.Map.setSiteMap - siteMapObj parameter is required")
		}
		var B = function() {
			throw new Error('ERROR mojo.controller.Map.setSiteMap - siteMapObj parameter must consist of patterns in the format {pattern: "pattern", controllers: [{controller: "controller.path"}]}')
		};
		if (!dojo.isArray(F)) {
			B()
		}
		for (var D = 0,
		A = F.length; D < A; D++) {
			var E = F[D];
			if (typeof E.pattern == "undefined" || E.pattern == null) {
				B()
			}
			if (!dojo.isArray(E.controllers)) {
				B()
			}
			for (var C = 0,
			A = E.controllers.length; C < A; C++) {
				if (typeof E.controllers[C].controller == "undefined" || !dojo.isString(E.controllers[C].controller) || E.controllers[C].controller == "") {
					B()
				}
			}
		}
		for (pattern in F) {}
		this._siteMap = F
	},
	mapControllers: function(C) {
		var B = this.getSiteMap();
		var I = B.length;
		for (var E = 0; E < I; E++) {
			var G = B[E].pattern;
			if (typeof(G) == "string") {
				var A = [];
				if (C && typeof(C) == "object") {
					A = mojo.query(G, C)
				} else {
					A = mojo.query(G)
				}
				var F = A.length;
				for (var D = 0; D < F; D++) {
					this._mapControllers(B[E].controllers, A[D])
				}
			} else {
				if (typeof(G) == "function" || typeof(G) == "object") {
					if (C && typeof(C) == "string") {
						var H = new RegExp(G);
						if (H.test(C)) {
							this._mapControllers(B[E].controllers)
						}
					}
				} else {
					alert(G);
					throw new Error("ERROR mojo.controller.Map - siteMap contains invalid pattern")
				}
			}
		}
		this.onComplete()
	},
	_mapControllers: function(F, A) {
		var B = F.length;
		for (var D = 0; D < B; D++) {
			var E = F[D].controller;
			var G = F[D].params;
			if (djConfig && djConfig.isDebug) {
				try {
					this.mapController(E, A, G)
				} catch(C) {
					console.debug("EXCEPTION: " + C.message + " in mojo.controller.Map.mapController() for controller: " + E)
				}
			} else {
				this.mapController(E, A, G)
			}
		}
	},
	mapController: function(controllerName, contextElementObj, controllerParams) {
		if (controllerName == null || typeof controllerName == "undefined") {
			throw new Error("ERROR mojo.controller.Map.mapController - controllerName parameter is required")
		}
		if (!dojo.isString(controllerName) || controllerName == "") {
			throw new Error("ERROR mojo.controller.Map.mapController - controllerName parameter must be a non-empty string")
		}
		dojo.require(controllerName);
		if (contextElementObj) {
			if (!contextElementObj.mojoControllers) {
				contextElementObj.mojoControllers = {}
			}
			if (!contextElementObj.mojoControllers[controllerName]) {
				contextElementObj.mojoControllers[controllerName] = eval("new " + controllerName + "(contextElementObj, controllerParams)");
				if (! (contextElementObj.mojoControllers[controllerName] instanceof mojo.controller.Controller)) {
					throw new Error('ERROR mojo.controller.Map.mapController - "' + controllerName + '" must be an instance of mojo.controller.Controller')
				}
			}
		} else {
			if (!this._controllers[controllerName]) {
				this._controllers[controllerName] = eval("new " + controllerName + "(null, controllerParams)");
				if (! (this._controllers[controllerName] instanceof mojo.controller.Controller)) {
					throw new Error('ERROR mojo.controller.Map.mapController - "' + controllerName + '" must be an instance of mojo.controller.Controller')
				}
			}
		}
	}
});
mojo.controller.Map.mapControllers = function(A) {
	mojo.Messaging.publish("/mojo/controller/mapControllers", [A])
};
mojo.controller.Map.getInstance = function() {
	if (__mojoControllerMap == null) {
		__mojoControllerMap = new mojo.controller.Map()
	}
	return __mojoControllerMap
};
dojo.provide("mojo.controller.Param");
dojo.declare("mojo.controller.Param", null, {
	constructor: function(C, A, E, D, B) {
		this._value = null;
		this._defaultValue = null;
		this._params = null;
		this._type = null;
		this._name = C;
		this._defaultValue = A;
		if (D) {
			this._type = D
		}
		if (B) {
			this._params = B
		}
		this.setValue(this._defaultValue);
		if (typeof E == "boolean") {
			this._required = E
		}
	},
	_name: null,
	_value: null,
	_defaultValue: null,
	_required: false,
	_type: null,
	_params: null,
	getName: function() {
		return this._name
	},
	getValue: function() {
		return this._value
	},
	setValue: function(B) {
		var D = mojo.helper.Validation.getInstance();
		var C = this.getRequired();
		var A = this.getType();
		if (C && !D.isRequired(B)) {
			throw new Error("ERROR mojo.controller.Param.setValue - value parameter is required")
		}
		if (typeof B == "undefined") {
			return
		}
		if (A && !D.isType(B, {
			type: A
		})) {
			throw new Error("RROR mojo.controller.Param.setValue - value parameter is invalid type")
		}
		if (this.getValue() != B) {
			this._value = B;
			this.onChange();
			if (this._params != null && this._params["onChange"]) {
				this._params.onChange()
			}
		}
	},
	getDefaultValue: function() {
		return this._defaultValue
	},
	getRequired: function() {
		return this._required
	},
	getType: function() {
		return this._type
	},
	onChange: function() {}
});
dojo.provide("mojo.controller.Request");
dojo.declare("mojo.controller.Request", null, {
	constructor: function(F, A, D, B, C, E) {
		this._paramsFunc = null;
		this.paramsObj = null;
		this.callerObj = null;
		this.eventObj = null;
		this.commandName = null;
		this.controllerObj = null;
		this.invocation = null;
		if (typeof(F) == "function") {
			this.paramsObj = {};
			this._paramsFunc = F
		} else {
			if (typeof(F) == "object") {
				this.paramsObj = F
			}
		}
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.controller.Request.constructor - callerObj is not set")
		} else {
			this.callerObj = A
		}
		this.eventObj = D;
		if (B == null || typeof B == "undefined") {
			throw new Error("ERROR mojo.controller.Request.constructor - commandName is not set")
		} else {
			if (typeof B != "string") {
				throw new Error("ERROR mojo.controller.Request.constructor - commandName is not type String")
			} else {
				this.commandName = B
			}
		}
		if (C == null || typeof C == "undefined") {
			throw new Error("ERROR mojo.controller.Request.constructor - controllerObj is not set")
		} else {
			if (! (C instanceof mojo.controller.Controller)) {
				throw new Error("ERROR mojo.controller.Request.constructor - controllerObj is not type mojo.controller.Controller")
			} else {
				this.controllerObj = C
			}
		}
		this.invocation = E
	},
	_paramsFunc: null,
	paramsObj: null,
	callerObj: null,
	eventObj: null,
	commandName: null,
	controllerObj: null,
	invocation: null,
	update: function() {
		if (this._paramsFunc && typeof(this._paramsFunc) == "function") {
			var A = this._paramsFunc(this.getContextElement(), this.getCaller(), this.getController());
			for (var B in A) {
				this.paramsObj[B] = A[B]
			}
		}
	},
	getParams: function() {
		if (!this.paramsObj) {
			this.update()
		}
		return this.paramsObj
	},
	getCaller: function() {
		return this.callerObj
	},
	getContextElement: function() {
		return this.getController().getContextElement()
	},
	getEvent: function() {
		return this.eventObj
	},
	getCommandName: function() {
		return this.commandName
	},
	getController: function() {
		return this.controllerObj
	},
	getControllerName: function() {
		return this.getController().declaredClass
	},
	getInvocation: function() {
		return this.invocation
	}
});
dojo.provide("mojo.helper.String");
mojo.toSentenceCase = function(A) {
	return A.charAt(0).toUpperCase() + A.replace(/ \w/g,
	function(B) {
		return B.toUpperCase()
	}).substring(1)
};
dojo.provide("mojo.helper.Validation");
dojo.require("dojox.validate");
dojo.require("dojox.validate.web");
var __mojoHelperValidation = null;
dojo.declare("mojo.helper.Validation", null, {
	isRequired: function(A) {
		if (typeof A == "undefined" || A == null) {
			return false
		}
		if (dojo.isString(A)) {
			return dojo.string.trim(A).length > 0
		}
		return true
	},
	isType: function(A, B) {
		switch (B.type) {
		case String:
			return (typeof A == "string" || A instanceof String);
			break;
		case Number:
			return (typeof A == "number" || A instanceof Number);
			break;
		case Boolean:
			return (typeof A == "boolean" || A instanceof Boolean);
			break;
		default:
			return (A instanceof B.type)
		}
	},
	isEmailAddress: function(A) {
		if (A == null) {
			throw new Error("ERROR mojo.helper.Validation.isEmailAddress - value parameter is required")
		}
		if (!dojo.isString(A)) {
			throw new Error("ERROR mojo.helper.Validation.isEmailAddress - value parameter must be a non-empty string")
		}
		if (!dojox.validate.isEmailAddress(A.replace(/^\s+|\s+$/g,""), {}) || A.match(/[^\w-_@\.]/gi)) {
			return false
		}
		return true
	},
	isEmailAddressList: function(A) {
		if (A == null) {
			throw new Error("ERROR mojo.helper.Validation.isEmailAddressList - value parameter is required")
		}
		if (!dojo.isString(A)) {
			throw new Error("ERROR mojo.helper.Validation.isEmailAddressList - value parameter must be a non-empty string")
		}
		if (!dojox.validate.isEmailAddressList(A, {})) {
			return false
		}
		return true
	},
	isUrl: function(A) {
		if (A == null) {
			throw new Error("ERROR mojo.helper.Validation.isUrl - value parameter is required")
		}
		if (!dojo.isString(A)) {
			throw new Error("ERROR mojo.helper.Validation.isUrl - value parameter must be a non-empty string")
		}
		return dojox.validate.isUrl(A, {
			allowLocal: true
		})
	},
	isLength: function(A, B) {
		if ((A == null) || (A == "")) {
			return true
		}
		if (!dojo.isString(A)) {
			throw new Error("ERROR mojo.helper.Validation.isLength - value parameter must be a string")
		}
		if (B) {
			if (B.min && B.min > A.length) {
				return false
			}
			if (B.max && B.max < A.length) {
				return false
			}
		}
		return true
	},
	isRange: function(A, B) {
		if ((A == null) || (A == "")) {
			return true
		}
		A = parseInt(A);
		if (isNaN(A)) {
			return false
		}
		if (B) {
			if (typeof(B.min) == "undefined") {
				B.min = 0
			}
			if (B.min > A) {
				return false
			}
			if (typeof(B.max) != "undefined" && B.max < A) {
				return false
			}
		}
		return true
	},
	isMatch: function(A, B) {
		var encodeRE = function(s) { return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1') };
		
		if ((A == null) || (A == "")) {
			return true
		}
		if (B) {
			if (B.refValue) {
				B.refValue = encodeRE(B.refValue);
				B.regex = "^" + B.refValue + "$"
			}
			var regex = new RegExp(B.regex)
			if (B.caseInsensitive) {
				regex = new RegExp(B.regex, "i")
			}
			if (! (regex).test(A)) {
				return false
			}
		}
		return true
	},
	isZipCode: function(D) {
		var B = "0123456789-";
		var C = 0;
		if ((D == null) || (D == "")) {
			return true
		}
		if (D.length != 5 && D.length != 10) {
			return false
		}
		for (var A = 0; A < D.length; A++) {
			temp = "" + D.substring(A, A + 1);
			if (temp == "-") {
				C++
			}
			if (B.indexOf(temp) == "-1") {
				return false
			}
			if ((C > 1) || ((D.length == 10) && "" + D.charAt(5) != "-")) {
				return false
			}
		}
		return true
	},
	isPostalCode: function(A) {
		if (A == null) {
			throw new Error("ERROR mojo.helper.Validation.isPostalCode - value parameter is required")
		}
		if (!dojo.isString(A)) {
			throw new Error("ERROR mojo.helper.Validation.isPostalCode - value parameter must be a non-empty string")
		}
		if (typeof A == "undefined" || A == null) {
			return false
		}
		if (A.length == 6 && A.search(/^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d$/) != -1) {
			return true
		} else {
			if (A.length == 7 && A.search(/^[a-zA-Z]\d[a-zA-Z](-|\s)\d[a-zA-Z]\d$/) != -1) {
				return true
			} else {
				return false
			}
		}
		return true
	},
	execute: function(I, T) {
		if (typeof I == "undefined" || I == null) {
			throw new Error("ERROR mojo.helper.Validation.execute - rulesObj parameter is required")
		}
		if (typeof T == "undefined" || T == null) {
			throw new Error("ERROR mojo.helper.Validation.execute - domElmListObj parameter is required")
		}
		var S = function() {
			throw new Error('ERROR mojo.helper.Validation.execute - rulesObj parameter must consist of rules in the format {"inputName": [{rule: testFunction[, errorMsg: "msg"]}[, ...]]}')
		};
		if (!dojo.isArray(T)) {
			T = [T]
		}
		for (rule in I) {
			if (!dojo.isArray(I[rule])) {
				S()
			}
			for (var P = 0,
			Q = I[rule].length; P < Q; P++) {
				if (typeof I[rule][P].rule != "function") {
					S()
				}
				if (typeof I[rule][P].error != "undefined" && !dojo.isString(I[rule][P].error)) {
					S()
				}
			}
		}
		var F = function(b, a) {
			if (!b) {
				return null
			}
			do {
				b = b.nextSibling
			} while ( b && b . nodeType != 1 );
			if (b && a && a.toLowerCase() != b.tagName.toLowerCase()) {
				return F(b, a)
			}
			return b
		};
		var B = new Array();
		var D = T.length;
		for (var P = 0; P < D; P++) {
			var C = mojo.query("*[name]", T[P]);
			if (T[P].name) {
				C.push(T[P])
			}
			var X = C.length;
			for (var O = 0; O < X; O++) {
				B.push(C[O])
			}
			B = mojo.distinct(B);
			var R = mojo.query(".mojoValidationError", T[P]);
			var U = F(T[P], "SPAN");
			if (U != null && dojo.hasClass(U, "mojoValidationError")) {
				R.push(U)
			}
			var W = R.length;
			for (var O = 0; O < W; O++) {
				dojo._destroyElement(R[O])
			}
		}
		var N = true;
		var E = new Array();
		var J = function(b) {
			var a = true;
			while (b != null) {
				if (dojo.style(b, "visibility") == "hidden" || dojo.style(b, "display") == "none") {
					a = false;
					break
				}
				b = (b.tagName == "BODY") ? null: b.parentNode
			}
			return a
		};
		var L = B.length;
		var V = {};
		for (var P = (L - 1); P >= 0; P--) {
			var H = B[P];
			if (H.type == "radio" || H.type == "checkbox") {
				H.mojoValidationGroup = true;
				if (!V[H.name]) {
					V[H.name] = new Array()
				} else {
					B[P] = null
				}
				if (H.checked) {
					V[H.name].push((H.value) ? H.value: "checked")
				}
			}
		}
		for (var P = 0; P < L; P++) {
			var H = B[P];
			if (H) {
				if (I[H.name]) {
					var Z = I[H.name];
					var G = Z.length;
					for (var O = 0; O < G; O++) {
						var A = Z[O];
						if (A["force"] || (J(H) && !H.disabled) || (H.type && H.type == "hidden")) {
							if (A.params && A.params.ref) {
								var Y = mojo.queryFirst('*[name="' + A.params.ref + '"]').value;
								if (Y && Y.length > 0) {
									A.params.refValue = Y
								}
							}
							var K = H.value;
							if (H.mojoValidationGroup) {
								K = V[H.name].toString()
							}
							if (! (A.rule(K, A.params))) {
								var M = {
									element: H,
									message: A["errorMsg"]
								};
								E.push(M);
								N = false;
								break
							}
						}
					}
				}
			}
		}
		return E
	}
});
mojo.helper.Validation.getInstance = function() {
	if (__mojoHelperValidation == null) {
		__mojoHelperValidation = new mojo.helper.Validation()
	}
	return __mojoHelperValidation
};
dojo.provide("mojo.helper.view.Error");
mojo.helper.view.Error.showElementErrors = function(F, C) {
	var A = F.length;
	for (var D = 0; D < A; D++) {
		var B = F[D];
		var E = document.createElement("span");
		E.className = "mojoValidationError";
		E.innerHTML = B.message;
		if (C != null) {
			C.appendChild(E)
		} else {
			if (B.element.type == "checkbox") {
				if (B.element.parentNode.tagName == "LABEL") {
					dojo.place(E, B.element.parentNode, "after")
				} else {
					dojo.place(E, B.element, "after")
				}
			} else {
				dojo.place(E, B.element, "after")
			}
		}
	}
};
dojo.provide("mojo.History");
var __mojoHistory = null;
dojo.declare("mojo.History", null, {
	constructor: function() {
		var A = this;
		if (typeof rsh != "undefined" && rsh["dhtmlHistory"] && rsh["dhtmlHistory"]["_isIE"]) {
			rsh.dhtmlHistory.init();
			dojo.connect(rsh.dhtmlHistory, "_fireHistoryEvent",
			function(B) {
				A.setHash(B);
				A._execute()
			})
		} else {
			this._interval = window.setInterval(function() {
				A._execute()
			},
			100)
		}
		A._execute()
	},
	_interval: null,
	_defaultHash: "",
	_savedHash: "",
	_paramsObj: null,
	_topic: null,
	onChange: function() {},
	getHash: function() {
		var A = window.location.hash;
		if (A.length > 0) {
			A = A.substring(1)
		}
		if (A.toLowerCase() == "null" || A.toLowerCase() == "undefined") {
			A = ""
		}
		if (A.length == 0 && this._defaultHash.length > 0) {
			A = this._defaultHash
		}
		return A
	},
	setHash: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.History.setHash - newHash parameter is required")
		}
		if (!dojo.isString(A) || A == "") {
			throw new Error("ERROR mojo.History.setHash - newHash parameter must be a non-empty string")
		}
		window.location.hash = A
	},
	setDefault: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.History.setDefault - defaultHashObj parameter is required")
		}
		if (typeof(A) == "string") {
			this._defaultHash = A
		} else {
			if (typeof(A) == "object") {
				this._defaultHash = this._parseObj(A)
			}
		}
		this._execute()
	},
	_execute: function() {
		var A = this.getHash();
		if (A.length == 0 && this._defaultHash.length > 0) {
			A = this._defaultHash
		}
		if (this._savedHash != A) {
			document.title = document.title.replace(window.location.hash, "");
			this._savedHash = A;
			this._paramsObj = this._parseHash(this._savedHash);
			this._topic = this._paramsObj["topic"] || null;
			this.onChange();
			if (this._topic) {
				mojo.Messaging.publish(this._topic, this._paramsObj)
			}
		}
	},
	_parseHash: function(D) {
		var C = new Object();
		var B = D.split("&");
		for (var A = 0; A < B.length; A++) {
			var E = B[A].split("=");
			if (E.length == 2) {
				C[E[0]] = unescape(E[1])
			}
		}
		return C
	},
	_parseObj: function(C) {
		var D = new Array();
		for (var A in C) {
			D.push(A + "=" + escape(C[A].toString()))
		}
		var B = D.join("&");
		return B
	},
	getParams: function() {
		return this._paramsObj
	},
	getTopic: function() {
		return this._topic
	}
});
mojo.History.getInstance = function() {
	if (__mojoHistory == null) {
		__mojoHistory = new mojo.History()
	}
	return __mojoHistory
};
dojo.provide("mojo.*");
dojo.provide("mojo.Messaging");
__mojoMessagingTopics = new Array();
mojo.Messaging.publish = function(B, C) {
	if (B == null || typeof B == "undefined") {
		throw new Error("ERROR mojo.Messaging.publish - topic parameter is required")
	}
	if (!dojo.isString(B) || B == "") {
		throw new Error("ERROR mojo.Messaging.publish - topic parameter must be a non-empty string")
	}
	var A = mojo.Messaging.getTopic(B);
	A.setMessage(C);
	A.onPublish(C);
	if (!dojo.isArray(C)) {
		C = [C]
	}
	dojo.publish(B, C);
	A.setMessage(null)
};
mojo.Messaging.subscribe = function(A, B, C) {
	if (A == null || typeof A == "undefined") {
		throw new Error("ERROR mojo.Messaging.subscribe - topic parameter is required")
	}
	if (!dojo.isString(A) || A == "") {
		throw new Error("ERROR mojo.Messaging.subscribe - topic parameter must be a non-empty string")
	}
	if (!dojo.isObject(B) && !dojo.isString(B)) {
		throw new Error("ERROR mojo.Messaging.subscribe - targetObj parameter must be an object or a string")
	}
	mojo.Messaging.getTopic(A);
	return dojo.subscribe(A, B, C)
};
mojo.Messaging.unsubscribe = function(A) {
	dojo.unsubscribe(A)
};
mojo.Messaging.getTopic = function(A) {
	if (A == null || typeof A == "undefined") {
		throw new Error("ERROR mojo.Messaging.getTopic - topic parameter is required")
	}
	if (!dojo.isString(A) || A == "") {
		throw new Error("ERROR mojo.Messaging.getTopic - topic parameter must be a non-empty string")
	}
	if (!__mojoMessagingTopics[A]) {
		__mojoMessagingTopics[A] = new mojo.MessagingTopic(A)
	}
	return __mojoMessagingTopics[A]
};
dojo.provide("mojo.MessagingTopic");
dojo.declare("mojo.MessagingTopic", null, {
	onPublish: function() {},
	constructor: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.MessagingTopic - topic parameter is required")
		}
		if (typeof A == "string") {
			if (A == "") {
				throw new Error("ERROR mojo.MessagingTopic - topic parameter must be a non-empty string")
			}
		} else {
			throw new Error("ERROR mojo.MessagingTopic - topic parameter is not type String")
		}
		this._topic = A;
		__mojoMessagingTopics[A] = this
	},
	_topic: null,
	_messageObj: null,
	getTopic: function() {
		return this._topic
	},
	getMessage: function() {
		return this._messageObj
	},
	setMessage: function(A) {
		this._messageObj = A
	}
});
dojo.provide("mojo.Model");
__mojoModel = new Array();
__mojoModelReferences = new Array();
mojo.Model.set = function(A, B) {
	if (A == null || typeof A == "undefined") {
		throw new Error("ERROR mojo.Model.set - key parameter is required")
	}
	if (!dojo.isString(A) || A == "") {
		throw new Error("ERROR mojo.Model.set - key parameter must be a non-empty string")
	}
	__mojoModel[A] = B;
	mojo.Model.notify(A)
};
mojo.Model.add = function(B, D) {
	if (B == null || typeof B == "undefined") {
		throw new Error("ERROR mojo.Model.add - key parameter is required")
	}
	if (!dojo.isString(B) || B == "") {
		throw new Error("ERROR mojo.Model.add - key parameter must be a non-empty string")
	}
	if (D == null || typeof D == "undefined") {
		throw new Error("ERROR mojo.Model.add - valueObj parameter is required")
	}
	if (D == "") {
		throw new Error("ERROR mojo.Model.add - valueObj parameter must be a non-empty string")
	}
	if (mojo.Model.contains(B)) {
		if (!dojo.isArray(__mojoModel[B])) {
			var C = __mojoModel[B];
			__mojoModel[B] = new Array();
			__mojoModel[B].push(C)
		}
		if (dojo.isArray(D)) {
			for (var A = 0; A < D.length; A++) {
				__mojoModel[B].push(D[A])
			}
		} else {
			__mojoModel[B].push(D)
		}
		mojo.Model.notify(B)
	} else {
		mojo.Model.set(B, D)
	}
};
mojo.Model.get = function(B) {
	if (B == null || typeof B == "undefined") {
		throw new Error("ERROR mojo.Model.get - key parameter is required")
	}
	if (!dojo.isString(B) || B == "") {
		throw new Error("ERROR mojo.Model.get - key parameter must be a non-empty string")
	}
	var A = __mojoModel[B];
	if (typeof A == "undefined") {
		A = null
	}
	if (djConfig && djConfig.isDebug) {
		console.debug('WARNING mojo.Model - No entry found for "' + B + '" key')
	}
	return A
};
mojo.Model.getReference = function(A) {
	if (A == null || typeof A == "undefined") {
		throw new Error("ERROR mojo.Model.getReference - key parameter is required")
	}
	if (!dojo.isString(A) || A == "") {
		throw new Error("ERROR mojo.Model.getReference - key parameter must be a non-empty string")
	}
	if (!__mojoModelReferences[A]) {
		__mojoModelReferences[A] = new mojo.ModelReference(A)
	}
	return __mojoModelReferences[A]
};
mojo.Model.remove = function(A) {
	if (A == null || typeof A == "undefined") {
		throw new Error("ERROR mojo.Model.remove - key parameter is required")
	}
	if (!dojo.isString(A) || A == "") {
		throw new Error("ERROR mojo.Model.remove - key parameter must be a non-empty string")
	}
	__mojoModel[A] = null;
	mojo.Model.notify(A)
};
mojo.Model.contains = function(B) {
	if (B == null || typeof B == "undefined") {
		throw new Error("ERROR mojo.Model.contains - key parameter is required")
	}
	if (!dojo.isString(B) || B == "") {
		throw new Error("ERROR mojo.Model.contains - key parameter must be a non-empty string")
	}
	var A = __mojoModel[B];
	if (A) {
		return true
	}
	return false
};
mojo.Model.notify = function(C) {
	if (C == null || typeof C == "undefined") {
		throw new Error("ERROR mojo.Model.notify - key parameter is required")
	}
	if (!dojo.isString(C) || C == "") {
		throw new Error("ERROR mojo.Model.notify - key parameter must be a non-empty string")
	}
	__mojoModel["__mojoTemplateControllers"] = [];
	var D = mojo.Model.getReference(C);
	D.onNotify();
	mojo.Messaging.publish("/mojo/model/" + C);
	var E = __mojoModel["__mojoTemplateControllers"].length;
	for (var B = 0; B < E; B++) {
		var A = __mojoModel["__mojoTemplateControllers"][B];
		if (A && A.updateController) {
			A._addObservers();
			A.updateController = null
		}
	}
	__mojoModel["__mojoTemplateControllers"] = null
};
mojo.Model.addObserver = function(B, A, C) {
	if (B == null || typeof B == "undefined") {
		throw new Error("ERROR mojo.Model.addObserver - key parameter is required")
	}
	if (!dojo.isString(B) || B == "") {
		throw new Error("ERROR mojo.Model.addObserver - key parameter must be a non-empty string")
	}
	if (A == null || typeof A == "undefined") {
		throw new Error("ERROR mojo.Model.addObserver - targetObj parameter is required")
	}
	if (!dojo.isObject(A)) {
		throw new Error("ERROR mojo.Model.addObserver - targetObj parameter must be an object")
	}
	if (C == null || typeof C == "undefined") {
		throw new Error("ERROR mojo.Model.addObserver - targetFunc parameter is required")
	}
	if (!dojo.isString(C) || C == "") {
		throw new Error("ERROR mojo.Model.addObserver - targetFunc parameter must be a function and is not of type string")
	}
	return mojo.Messaging.subscribe("/mojo/model/" + B, A, C)
};
mojo.Model.removeObserver = function(A) {
	if (A == null || typeof A != "object") {
		throw new Error("ERROR mojo.Model.removeObserver - handle parameter is required")
	}
	mojo.Messaging.unsubscribe(A)
};
dojo.provide("mojo.ModelReference");
dojo.declare("mojo.ModelReference", null, {
	onNotify: function() {},
	constructor: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.ModelReference - key parameter is required")
		}
		if (!dojo.isString(A) || A == "") {
			throw new Error("ERROR mojo.ModelReference - key parameter must be a non-empty string")
		}
		this._key = A;
		__mojoModelReferences[A] = this
	},
	_key: null,
	getKey: function() {
		return this._key
	},
	getValue: function() {
		return mojo.Model.get(this._key)
	},
	setValue: function(A) {
		mojo.Model.set(this._key, A)
	}
});
dojo.provide("mojo.query");
mojo.query = function(D, C) {
	if (C && (typeof C == "string" || typeof C == "object")) {
		var B = dojo.query(D, C)
	} else {
		if ((new RegExp(/^\#[a-zA-Z0-9\-\_]*$/)).test(D)) {
			var A = document.getElementById(D.substring(1));
			if (A) {
				var B = [A]
			} else {
				var B = []
			}
		} else {
			var B = dojo.query(D)
		}
	}
	return B
};
mojo.queryFirst = function(C, B) {
	var A = mojo.query(C, B);
	if (A.length > 0) {
		return A[0]
	}
	return null
};
mojo.distinct = function(E) {
	if (E.length == 0) {
		return E
	}
	var C = [],
	F;
	for (var B = 0,
	A = E.length; B < A; B++) {
		if (! (F = E[B])._counted) {
			F._counted = true;
			C.push(F)
		}
	}
	for (var B = 0,
	D; D = C[B]; B++) {
		D._counted = undefined
	}
	return C
};
mojo.queryMatch = function(B, H, F, C) {
	if (!B || B == F) {
		return null
	}
	var G = false;
	var E = [];
	if ((new RegExp(/^[\#|\.]?[a-zA-Z0-9\-\_]+$/)).test(H)) {
		G = true
	} else {
		E = mojo.query(H, F)
	}
	while (B && B != F) {
		if (G) {
			if ((H.indexOf("#") == 0 && B.id == H.substring(1)) || (H.indexOf(".") == 0 && dojo.hasClass(B, H.substring(1))) || (B.tagName && B.tagName.toLowerCase() == H.toLowerCase())) {
				return B
			}
		} else {
			for (var D = 0,
			A = E.length; D < A; D++) {
				if (E[D] == B) {
					return B
				}
			}
		}
		if (C) {
			B = B.parentNode
		} else {
			break
		}
	}
	return null
};
dojo.provide("mojo.service.Delegate");
dojo.declare("mojo.service.Delegate", null, {
	constructor: function(A) {
		this._callerObj = A
	},
	_callerObj: null,
	getCaller: function() {
		return this._callerObj
	},
	setCaller: function(A) {
		this._callerObj = A
	}
});
dojo.provide("mojo.service.Locator");
__mojoServiceRegistry = new Array();
dojo.declare("mojo.service.Locator", null, {
	constructor: function() {
		if (__mojoServiceRegistry.length == 0) {
			this.addServices()
		}
	},
	addServices: function() {
		if (djConfig && djConfig.isDebug) {
			console.debug("ERROR mojo.service.Locator - addServices() not implemented")
		}
	},
	addService: function(A) {
		if (A == null || typeof A == "undefined") {
			throw (new Error("ERROR mojo.service.Locator.addService - serviceObj parameter is required"))
		}
		if (! (A instanceof mojo.service.Service)) {
			throw (new Error("ERROR mojo.service.Locator.addService - serviceObj parameter must be an instance of the mojo.service.Service class"))
		}
		var B = A.getName();
		if (!__mojoServiceRegistry[B]) {
			__mojoServiceRegistry[B] = A
		} else {
			throw (new Error('ERROR mojo.service.Locator.addService - service with the name "' + B + '" already exists in the registry; service not added'))
		}
	},
	getService: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.service.Locator.getService - name parameter is required")
		}
		if (!dojo.isString(A) || A == "") {
			throw new Error("ERROR mojo.service.Locator.getService - name parameter must be a non-empty string")
		}
		return __mojoServiceRegistry[A] || null
	}
});
dojo.provide("mojo.service.Service");
dojo.declare("mojo.service.Service", null, {
	VALID_METHODS: ["GET", "POST", "PUT", "DELETE"],
	DEFAULT_PARAMS: {
		json: true,
		method: "GET",
		cacheExpiry: 0,
		cache: true,
		retry: 1,
		hijax: false
	},
	constructor: function(A, B, C) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.service.Service.constructor - name parameter is required")
		}
		if (!dojo.isString(A) || A == "") {
			throw new Error("ERROR mojo.service.Service.constructor - name parameter must be a non-empty string")
		}
		if (B == null || typeof B == "undefined") {
			throw new Error("ERROR mojo.service.Service.constructor - uri parameter is required")
		}
		if (!dojo.isString(B) || B == "") {
			throw new Error("ERROR mojo.service.Service.constructor - uri parameter must be a non-empty string")
		}
		var D = {};
		for (property in this.DEFAULT_PARAMS) {
			D[property] = this.DEFAULT_PARAMS[property]
		}
		if (A.toLowerCase().indexOf("add") == 0) {
			D.method = "POST"
		} else {
			if (A.toLowerCase().indexOf("update") == 0) {
				D.method = "PUT"
			} else {
				if (A.toLowerCase().indexOf("delete") == 0) {
					D.method = "DELETE"
				}
			}
		}
		if (C) {
			if (C.method) {
				if (C.method != "GET") {
					D.cache = false
				}
			} else {
				if (D.method != "GET") {
					D.cache = false
				}
			}
			if (C.method) {
				if (C.method != "GET") {
					D.retry = 0
				}
			} else {
				if (D.method != "GET") {
					D.retry = 0
				}
			}
		}
		if (C) {
			for (property in C) {
				D[property] = C[property]
			}
		}
		this.setName(A);
		this.setUri(B);
		this.setParams(D)
	},
	_name: "",
	_uri: "",
	_params: new Object(),
	getName: function() {
		return this._name
	},
	setName: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.service.Service.setName - name parameter is required")
		}
		if (!dojo.isString(A) || A == "") {
			throw new Error("ERROR mojo.service.Service.setName - name parameter must be a non-empty string")
		}
		this._name = A
	},
	getUri: function() {
		return this._uri
	},
	setUri: function(A) {
		if (A == null || typeof A == "undefined") {
			throw new Error("ERROR mojo.service.Service.setUri - uri parameter is required")
		}
		if (!dojo.isString(A) || A == "") {
			throw new Error("ERROR mojo.service.Service.setUri - uri parameter must be a non-empty string")
		}
		this._uri = A
	},
	getParams: function() {
		return this._paramsObj
	},
	setParams: function(D) {
		if (!D) {
			throw new Error("ERROR mojo.service.Service.setParams - paramsObj parameter is required")
		}
		if (D) {
			for (property in D) {
				switch (property) {
				case "json":
				case "hijax":
				case "cache":
					if (typeof D[property] != "boolean") {
						throw new Error("ERROR mojo.service.Service.setParams - " + property + " property of paramsObj must be a boolean")
					}
					break;
				case "cacheExpiry":
				case "retry":
					if (typeof D[property] != "number") {
						throw new Error("ERROR mojo.service.Service.setParams - " + property + " property of paramsObj must be a number")
					}
					break;
				case "method":
					var B = false;
					for (var C = 0,
					A = this.VALID_METHODS.length; C < A; C++) {
						if (this.VALID_METHODS[C] == D[property].toUpperCase()) {
							B = true
						}
					}
					if (!B) {
						throw new Error('ERROR mojo.service.Service.setParams - method property of paramsObj must be one of "GET", "POST", "PUT", or "DELETE"')
					}
					break
				}
			}
		}
		if (!this._paramsObj) {
			this._paramsObj = {}
		}
		for (property in D) {
			this._paramsObj[property] = D[property]
		}
	},
	invoke: function(paramsObj, callerObj) {
		if (!callerObj) {
			throw new Error("ERROR mojo.service.Service.invoke - callerObj parameter is required")
		}
		if (!dojo.isObject(callerObj)) {
			throw new Error("ERROR mojo.service.Service.invoke - callerObj parameter must be an object")
		}
		if (typeof callerObj.onResponse != "function") {
			throw new Error("ERROR mojo.service.Service.invoke - callerObj parameter must contain an object with an onResponse method")
		}
		if (typeof callerObj.onError != "function") {
			throw new Error("ERROR mojo.service.Service.invoke - callerObj parameter must contain an object with an onError method")
		}
		var serviceParams = this.getParams();
		if (typeof TrimPath != "undefined" && TrimPath.parseTemplate) {
			var uriFinal = TrimPath.parseTemplate(this.getUri()).process(paramsObj);
			if (paramsObj && paramsObj["_MODIFIERS"] && paramsObj["defined"]) {
				delete paramsObj["_MODIFIERS"];
				delete paramsObj["defined"]
			}
		} else {
			var uriFinal = this.getUri()
		}
		if (serviceParams.hijax && callerObj.getRequest() && callerObj.getRequest().callerObj && callerObj.getRequest().callerObj.tagName == "A") {
			uriFinal = callerObj.getRequest().callerObj.href
		}
		var tried = 0;
		var serializeName = this.getName();
		var pairs = new Array();
		for (var key in paramsObj) {
			if (typeof(paramsObj[key]) != "function") {
				pairs.push(key + "_" + paramsObj[key])
			} else {
				pairs.push(key + "__function")
			}
		}
		if (pairs.length > 0) {
			serializeName += "_" + pairs.join("_")
		}
		var errorCallback = function(errorObj, httpObj) {
			var errors = new Array();
			if (httpObj) {
				errorObj.code = httpObj.status;
				errors.push(errorObj)
			}
			if (typeof(errorObj) == "string") {
				var msg = errorObj;
				errorObj = new Object();
				errorObj.message = msg
			}
			if (errorObj.name) {
				errorObj.code = errorObj.name;
				errors.push(errorObj)
			}
			if (errorObj.errors) {
				errors = errorObj.errors
			}
			if (errorObj.error) {
				errors.push(errorObj.error)
			}
			if (errors[0]["redirectUrl"]) {
				window.location.replace(errors[0]["redirectUrl"])
			}
			if (httpObj && serviceParams.retry >= tried) {
				serviceInvoke()
			} else {
				callerObj.onError(errors)
			}
		};
		var thisObj = this;
		var serviceInvoke = function() {
			return dojo["xhr" + mojo.toSentenceCase(serviceParams.method.toLowerCase())]({
				url: uriFinal,
				preventCache: (!serviceParams.cache && serviceParams.method == "GET"),
				handleAs: serviceParams.json ? "json": "text",
				content: paramsObj,
				load: function(response, ioArgs) {
					tried++;
					if (ioArgs.handleAs == "json") {
						if (!dojo.isObject(response)) {
							try {
								response = eval(response)
							} catch(ex) {
								errorCallback(ex);
								return
							}
						}
						if (response.error || response.errors) {
							errorCallback(response)
						} else {
							if (serviceParams.cache) {
								thisObj._setCache(serializeName, response, serviceParams.cacheExpiry)
							}
							callerObj.onResponse(response, ioArgs.args.content)
						}
					} else {
						if (serviceParams.cache) {
							thisObj._setCache(serializeName, response, serviceParams.cacheExpiry)
						}
						callerObj.onResponse(response, ioArgs.args.content)
					}
				},
				error: function(response, ioArgs) {
					tried++;
					errorCallback(response, ioArgs.xhr)
				}
			})
		};
		var cacheObj;
		if (serviceParams.cache) {
			cacheObj = this._getCache(serializeName)
		}
		if (cacheObj) {
			callerObj.onResponse(cacheObj.data, paramsObj)
		} else {
			var currentXhr = serviceInvoke()
		}
		return currentXhr
	},
	_setCache: function(A, D, C) {
		var B = 0;
		if (C > 0) {
			B = (new Date()).getTime() + (C * 1000)
		}
		mojo.Model.set(A, {
			data: D,
			expiryTime: B
		})
	},
	_getCache: function(C) {
		var A = null;
		if (mojo.Model.contains(C)) {
			A = mojo.Model.get(C);
			var B = (new Date()).getTime();
			if (A.expiryTime > 0 && B > A.expiryTime) {
				mojo.Model.remove(C);
				A = null
			}
		}
		return A
	}
});
dojo.provide("extLib.trimpath.template");
if (typeof(TrimPath) == "undefined") {
	TrimPath = {}
} (function() {
	if (TrimPath == null) {
		TrimPath = new Object()
	}
	if (TrimPath.evalEx == null) {
		TrimPath.evalEx = function(src) {
			return eval(src)
		}
	}
	var UNDEFINED;
	if (Array.prototype.pop == null) {
		Array.prototype.pop = function() {
			if (this.length === 0) {
				return UNDEFINED
			}
			return this[--this.length]
		}
	}
	if (Array.prototype.push == null) {
		Array.prototype.push = function() {
			for (var i = 0; i < arguments.length; ++i) {
				this[this.length] = arguments[i]
			}
			return this.length
		}
	}
	TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) {
		if (optEtc == null) {
			optEtc = TrimPath.parseTemplate_etc
		}
		var funcSrc = parse(tmplContent, optTmplName, optEtc);
		var func = TrimPath.evalEx(funcSrc, optTmplName, 1);
		if (func != null) {
			return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc)
		}
		return null
	};
	try {
		String.prototype.process = function(context, optFlags) {
			var template = TrimPath.parseTemplate(this, null);
			if (template != null) {
				return template.process(context, optFlags)
			}
			return this
		}
	} catch(e) {}
	TrimPath.parseTemplate_etc = {};
	TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
	TrimPath.parseTemplate_etc.statementDef = {
		"if": {
			delta: 1,
			prefix: "if (",
			suffix: ") {",
			paramMin: 1
		},
		"else": {
			delta: 0,
			prefix: "} else {"
		},
		"elseif": {
			delta: 0,
			prefix: "} else if (",
			suffix: ") {",
			paramDefault: "true"
		},
		"/if": {
			delta: -1,
			prefix: "}"
		},
		"for": {
			delta: 1,
			paramMin: 3,
			prefixFunc: function(stmtParts, state, tmplName, etc) {
				if (stmtParts[2] != "in") {
					throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(" "))
				}
				var iterVar = stmtParts[1];
				var listVar = "__LIST__" + iterVar;
				return ["var ", listVar, " = ", stmtParts[3], ";", "var __LENGTH_STACK__;", "if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();", "__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", "if ((", listVar, ") != null) { ", "var ", iterVar, "_ct = 0;", "for (var ", iterVar, "_index in ", listVar, ") { ", iterVar, "_ct++;", "if (typeof(", listVar, "[", iterVar, "_index]) == 'function') {continue;}", "__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;", "var ", iterVar, " = ", listVar, "[", iterVar, "_index];"].join("")
			}
		},
		"forelse": {
			delta: 0,
			prefix: "} } if (__LENGTH_STACK__[__LENGTH_STACK__.length - 1] == 0) { if (",
			suffix: ") {",
			paramDefault: "true"
		},
		"/for": {
			delta: -1,
			prefix: "} }; delete __LENGTH_STACK__[__LENGTH_STACK__.length - 1];"
		},
		"var": {
			delta: 0,
			prefix: "var ",
			suffix: ";"
		},
		"macro": {
			delta: 1,
			prefixFunc: function(stmtParts, state, tmplName, etc) {
				var macroName = stmtParts[1].split("(")[0];
				return ["var ", macroName, " = function", stmtParts.slice(1).join(" ").substring(macroName.length), "{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; "].join("")
			}
		},
		"/macro": {
			delta: -1,
			prefix: " return _OUT_arr.join(''); };"
		}
	};
	TrimPath.parseTemplate_etc.modifierDef = {
		"eat": function(v) {
			return ""
		},
		"escape": function(s) {
			return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
		},
		"capitalize": function(s) {
			return String(s).toUpperCase()
		},
		"default": function(s, d) {
			return s != null ? s: d
		}
	};
	TrimPath.parseTemplate_etc.modifierDef.h = TrimPath.parseTemplate_etc.modifierDef.escape;
	TrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) {
		this.process = function(context, flags) {
			if (context == null) {
				context = {}
			}
			if (context._MODIFIERS == null) {
				context._MODIFIERS = {}
			}
			if (context.defined == null) {
				context.defined = function(str) {
					return (context[str] != undefined)
				}
			}
			for (var k in etc.modifierDef) {
				if (context._MODIFIERS[k] == null) {
					context._MODIFIERS[k] = etc.modifierDef[k]
				}
			}
			if (flags == null) {
				flags = {}
			}
			var resultArr = [];
			var resultOut = {
				write: function(m) {
					resultArr.push(m)
				}
			};
			try {
				func(resultOut, context, flags)
			} catch(e) {
				if (flags.throwExceptions == true) {
					throw e
				}
				var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + (e.message ? "; " + e.message: "") + "]");
				result["exception"] = e;
				return result
			}
			return resultArr.join("")
		};
		this.name = tmplName;
		this.source = tmplContent;
		this.sourceFunc = funcSrc;
		this.toString = function() {
			return "TrimPath.Template [" + tmplName + "]"
		}
	};
	TrimPath.parseTemplate_etc.ParseError = function(name, line, message) {
		this.name = name;
		this.line = line;
		this.message = message
	};
	TrimPath.parseTemplate_etc.ParseError.prototype.toString = function() {
		return ("TrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.message)
	};
	var parse = function(body, tmplName, etc) {
		body = cleanWhiteSpace(body);
		var funcText = ["var TrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {"];
		var state = {
			stack: [],
			line: 1
		};
		var endStmtPrev = -1;
		while (endStmtPrev + 1 < body.length) {
			var begStmt = endStmtPrev;
			begStmt = body.indexOf("{", begStmt + 1);
			while (begStmt >= 0) {
				var endStmt = body.indexOf("}", begStmt + 1);
				var stmt = body.substring(begStmt, endStmt);
				var blockrx = stmt.match(/^\{(cdata|minify|eval)/);
				if (blockrx) {
					var blockType = blockrx[1];
					var blockMarkerBeg = begStmt + blockType.length + 1;
					var blockMarkerEnd = body.indexOf("}", blockMarkerBeg);
					if (blockMarkerEnd >= 0) {
						var blockMarker;
						if (blockMarkerEnd - blockMarkerBeg <= 0) {
							blockMarker = "{/" + blockType + "}"
						} else {
							blockMarker = body.substring(blockMarkerBeg + 1, blockMarkerEnd)
						}
						var blockEnd = body.indexOf(blockMarker, blockMarkerEnd + 1);
						if (blockEnd >= 0) {
							emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
							var blockText = body.substring(blockMarkerEnd + 1, blockEnd);
							if (blockType == "cdata") {
								emitText(blockText, funcText)
							} else {
								if (blockType == "minify") {
									emitText(scrubWhiteSpace(blockText), funcText)
								} else {
									if (blockType == "eval") {
										if (blockText != null && blockText.length > 0) {
											funcText.push("_OUT.write( (function() { " + blockText + " })() );")
										}
									}
								}
							}
							begStmt = endStmtPrev = blockEnd + blockMarker.length - 1
						}
					}
				} else {
					if (body.charAt(begStmt - 1) != "$" && body.charAt(begStmt - 1) != "\\") {
						var offset = (body.charAt(begStmt + 1) == "/" ? 2 : 1);
						if (body.substring(begStmt + offset, begStmt + 10 + offset).search(TrimPath.parseTemplate_etc.statementTag) == 0) {
							break
						}
					}
				}
				begStmt = body.indexOf("{", begStmt + 1)
			}
			if (begStmt < 0) {
				break
			}
			var endStmt = body.indexOf("}", begStmt + 1);
			if (endStmt < 0) {
				break
			}
			emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
			emitStatement(body.substring(begStmt, endStmt + 1), state, funcText, tmplName, etc);
			endStmtPrev = endStmt
		}
		emitSectionText(body.substring(endStmtPrev + 1), funcText);
		if (state.stack.length != 0) {
			throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(","))
		}
		funcText.push("}}; TrimPath_Template_TEMP");
		return funcText.join("")
	};
	var emitStatement = function(stmtStr, state, funcText, tmplName, etc) {
		var parts = stmtStr.slice(1, -1).split(" ");
		var stmt = etc.statementDef[parts[0]];
		if (stmt == null) {
			emitSectionText(stmtStr, funcText);
			return
		}
		if (stmt.delta < 0) {
			if (state.stack.length <= 0) {
				throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr)
			}
			state.stack.pop()
		}
		if (stmt.delta > 0) {
			state.stack.push(stmtStr)
		}
		if (stmt.paramMin != null && stmt.paramMin >= parts.length) {
			throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr)
		}
		if (stmt.prefixFunc != null) {
			funcText.push(stmt.prefixFunc(parts, state, tmplName, etc))
		} else {
			funcText.push(stmt.prefix)
		}
		if (stmt.suffix != null) {
			if (parts.length <= 1) {
				if (stmt.paramDefault != null) {
					funcText.push(stmt.paramDefault)
				}
			} else {
				for (var i = 1; i < parts.length; i++) {
					if (i > 1) {
						funcText.push(" ")
					}
					funcText.push(parts[i])
				}
			}
			funcText.push(stmt.suffix)
		}
	};
	var emitSectionText = function(text, funcText) {
		if (text.length <= 0) {
			return
		}
		var nlPrefix = 0;
		var nlSuffix = text.length - 1;
		while (nlPrefix < text.length && (text.charAt(nlPrefix) == "\n")) {
			nlPrefix++
		}
		while (nlSuffix >= 0 && (text.charAt(nlSuffix) == " " || text.charAt(nlSuffix) == "\t")) {
			nlSuffix--
		}
		if (nlSuffix < nlPrefix) {
			nlSuffix = nlPrefix
		}
		if (nlPrefix > 0) {
			funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
			var s = text.substring(0, nlPrefix).replace("\n", "\\n");
			if (s.charAt(s.length - 1) == "\n") {
				s = s.substring(0, s.length - 1)
			}
			funcText.push(s);
			funcText.push('");')
		}
		var lines = text.substring(nlPrefix, nlSuffix + 1).split("\n");
		for (var i = 0; i < lines.length; i++) {
			emitSectionTextLine(lines[i], funcText);
			if (i < lines.length - 1) {
				funcText.push('_OUT.write("\\n");\n')
			}
		}
		if (nlSuffix + 1 < text.length) {
			funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
			var s = text.substring(nlSuffix + 1).replace("\n", "\\n");
			if (s.charAt(s.length - 1) == "\n") {
				s = s.substring(0, s.length - 1)
			}
			funcText.push(s);
			funcText.push('");')
		}
	};
	var emitSectionTextLine = function(line, funcText) {
		var endMarkPrev = "}";
		var endExprPrev = -1;
		while (endExprPrev + endMarkPrev.length < line.length) {
			var begMark = "${",
			endMark = "}";
			var begExpr = line.indexOf(begMark, endExprPrev + endMarkPrev.length);
			if (begExpr < 0) {
				break
			}
			if (line.charAt(begExpr + 2) == "%") {
				begMark = "${%";
				endMark = "%}"
			}
			var endExpr = line.indexOf(endMark, begExpr + begMark.length);
			if (endExpr < 0) {
				break
			}
			emitText(line.substring(endExprPrev + endMarkPrev.length, begExpr), funcText);
			var exprArr = line.substring(begExpr + begMark.length, endExpr).replace(/\|\|/g, "#@@#").split("|");
			for (var k in exprArr) {
				if (exprArr[k].replace) {
					exprArr[k] = exprArr[k].replace(/#@@#/g, "||")
				}
			}
			funcText.push("_OUT.write(");
			emitExpression(exprArr, exprArr.length - 1, funcText);
			funcText.push(");");
			endExprPrev = endExpr;
			endMarkPrev = endMark
		}
		emitText(line.substring(endExprPrev + endMarkPrev.length), funcText)
	};
	var emitText = function(text, funcText) {
		if (text == null || text.length <= 0) {
			return
		}
		text = text.replace(/\\/g, "\\\\");
		text = text.replace(/\n/g, "\\n");
		text = text.replace(/"/g, '\\"');
		funcText.push('_OUT.write("');
		funcText.push(text);
		funcText.push('");')
	};
	var emitExpression = function(exprArr, index, funcText) {
		var expr = exprArr[index];
		if (index <= 0) {
			funcText.push(expr);
			return
		}
		var parts = expr.split(":");
		funcText.push('_MODIFIERS["');
		funcText.push(parts[0]);
		funcText.push('"](');
		emitExpression(exprArr, index - 1, funcText);
		if (parts.length > 1) {
			funcText.push(",");
			funcText.push(parts[1])
		}
		funcText.push(")")
	};
	var cleanWhiteSpace = function(result) {
		result = result.replace(/\t/g, "    ");
		result = result.replace(/\r\n/g, "\n");
		result = result.replace(/\r/g, "\n");
		result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, "$1");
		return result
	};
	var scrubWhiteSpace = function(result) {
		result = result.replace(/^\s+/g, "");
		result = result.replace(/\s+$/g, "");
		result = result.replace(/\s+/g, " ");
		result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, "$1");
		return result
	};
	TrimPath.parseDOMTemplate = function(elementId, optDocument, optEtc) {
		if (optDocument == null) {
			optDocument = document
		}
		var element = optDocument.getElementById(elementId);
		var content = element.value;
		if (content == null) {
			content = element.innerHTML
		}
		content = content.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
		return TrimPath.parseTemplate(content, elementId, optEtc)
	};
	TrimPath.processDOMTemplate = function(elementId, context, optFlags, optDocument, optEtc) {
		return TrimPath.parseDOMTemplate(elementId, optDocument, optEtc).process(context, optFlags)
	}
})();