// ************************************************************************************
// BaseWebpartBehavior
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior.initializeBase(this, [element]);
	this._onApplicationLoadDelegate = Function.createDelegate(this, this._onApplicationLoad);
	this._Target = null;
};

// prototype
Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior.prototype =
{
	// methods
	initialize: function()
	{
		Sys.Application.add_load(this._onApplicationLoadDelegate);
		this.add_propertyChanged(this._onPropertyChanged);
		Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		$clearHandlers(this.get_element());
		Sys.Application.remove_load(this._onApplicationLoadDelegate);
		this.remove_propertyChanged(this._onPropertyChanged);
		Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior.callBaseMethod(this, "dispose");
	},
	findChild: function(id)
	{
		var rv = null;
		if (id)
		{
			rv = $find(this.get_ClientID() + this.get_ClientIDSeparator() + id);
			if (!rv)
			{
				rv = $find(this.get_ClientID() + id);
			}
			if (!rv)
			{
				rv = $find(id);
			}
		}
		return rv;
	},
	getChild: function(id)
	{
		var rv = null;
		if (id)
		{
			rv = $get(this.get_ClientID() + this.get_ClientIDSeparator() + id);
			if (!rv)
			{
				rv = $get(this.get_ClientID() + id);
			}
			if (!rv)
			{
				rv = $get(id);
			}
		}
		return rv;
	},
	raiseEvent: function(id, args)
	{
		var events = this.get_events();
		if (events)
		{
			var f = events.getHandler(id);
			if (f)
			{
				f(this, args);
			}
		}
	},

	// properties
	get_Target: function()
	{
		return this._Target;
	},
	set_Target: function(value)
	{
		if (this._Target !== value)
		{
			this._Target = value;
			this.raisePropertyChanged("Target");
		}
	},
	get_ClientID: function()
	{
		return this.get_Target().get_ClientID();
	},
	set_ClientID: function(value)
	{
		if (this.get_Target().get_ClientID() !== value)
		{
			this.get_Target().set_ClientID(value);
		}
	},
	get_ClientIDSeparator: function()
	{
		return this.get_Target().get_ClientIDSeparator();
	},
	set_ClientIDSeparator: function(value)
	{
		if (this.get_Target().get_ClientIDSeparator() !== value)
		{
			this.get_Target().set_ClientIDSeparator(value);
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
	},
	_onPropertyChanged: function(p)
	{
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("BaseWebpartBehavior._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("BaseWebpartBehavior._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("BaseWebpartBehavior._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior.registerClass("Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior", Sys.UI.Behavior);
// ************************************************************************************
// Competir.Web.UI
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI");

// static methods
Competir.Web.UI.LimitText = function(value, maxWords, maxCharsPerWord, suffix)
{
	var words = value.split(' ');
	if (words.length > maxWords)
	{
		words = words.slice(0, maxWords);
		if (suffix)
		{
			words[words.length - 1] = words[words.length - 1] + suffix;
		}
	}
	for (var i = 0; i < words.length; i++)
	{
		if (words[i].length > maxCharsPerWord)
		{
			words[i] = words[i].substring(0, maxCharsPerWord);
		}
	}
	return words.join(' ');
};
Competir.Web.UI.setInnerHTML = function(obj, html)
{
	if (obj)
	{
		obj.innerHTML = html;
		if (navigator.userAgent.indexOf("MSIE") == -1)
		{
			Competir.Web.UI.fixMozillaDisplay(obj);
		}
	}
};
Competir.Web.UI.toggleImage = function(obj)
{
	if (obj)
	{
		// obj
		if (String.isInstanceOfType(obj))
		{
			obj = $get(obj);
		}

		// value
		var objSrc = obj.getAttribute("src").toLowerCase();
		var altSrc = obj.getAttribute("altsrc").toLowerCase();

		// apply
		if (obj)
		{
			obj.setAttribute("altsrc", objSrc);
			obj.setAttribute("src", altSrc);
		}
	}
};
Competir.Web.UI.toggleDisplay = function(obj, value, display)
{
	if (obj)
	{
		// obj
		if (String.isInstanceOfType(obj))
		{
			var objRef = $find(obj);
			if (!objRef)
			{
				obj = $get(obj);
			}
			else
			{
				obj = objRef;
			}
		}

		// value
		if (value == null | value == undefined)
		{
			if (Sys.UI.Control.isInstanceOfType(obj))
			{
				value = !obj.get_visible();
			}
			else
			{
				value = (obj.style.display == "none");
			}
		}

		// apply
		if (obj)
		{
			if (Sys.UI.Control.isInstanceOfType(obj))
			{
				obj.set_visibilityMode(Sys.UI.VisibilityMode.collapse);
				obj.set_visible(value);
				if (value)
				{
					obj.raiseEvent("onShow", Sys.EventArgs.Empty);
				}
				else
				{
					obj.raiseEvent("onHide", Sys.EventArgs.Empty);
				}
			}
			else
			{
				obj.style.display = (value) ? (display != null ? display : "block") : "none";
			}
		}

		// fix
		if (obj)
		{
			Competir.Web.UI.fixMozillaDisplay(obj);
		}
	}
};
Competir.Web.UI.show = function(obj, display)
{
	Competir.Web.UI.toggleDisplay(obj, true, display);
};
Competir.Web.UI.hide = function(obj)
{
	Competir.Web.UI.toggleDisplay(obj, false, null);
};
Competir.Web.UI.fixMozillaDisplay = function(obj)
{
	if (obj)
	{
		if (navigator.userAgent.indexOf("MSIE") == -1)
		{
			var refNode = obj.parentNode;
			while (refNode && refNode != document.body)
			{
				if (refNode.tagName.toLowerCase() == "table" && refNode.getAttribute("refresh") == "true")
				{
					var r = refNode.insertRow(-1);
					var t = r.insertCell(-1);
					refNode.deleteRow(refNode.rows.length - 1);
					break;
				}
				else
				{
					refNode = refNode.parentNode;
				}
			}
		}
	}
};
Competir.Web.UI.validateFormElement = function(control, id, controlType, validationType, blink)
{
	var rv = false;
	switch (validationType)
	{
		case "hasValue":
			switch (controlType)
			{
				case "text":
				case "combo":
					var obj = control.getChild(id);
					if (obj)
					{
						if (obj.value && obj.value != "")
						{
							rv = true;
						}
						else if (blink)
						{
							control.callFromBehavior("blink", [obj]);
						}
					}
					break;
				case "radio":
					var group = document.getElementsByName(control.get_ClientID() + id);
					if (group.length)
					{
						for (var i = 0; i < group.length; i++)
						{
							if (group[i].checked)
							{
								rv = true;
								break;
							}
						}
					}
					if (!rv && blink)
					{
						for (var i = 0; i < group.length; i++)
						{
							control.callFromBehavior("blink", [group[i].parentNode]);
						}
					}
					break;
			}
			break;
		case "insensitiveEquality":
			switch (controlType)
			{
				case "text":
				case "combo":
					rv = true;
					var value = "";
					var arrObj = new Array();
					var arrId = id.split(",");
					for (var i = 0; i < arrId.length; i++)
					{
						var obj = control.getChild(arrId[i]);
						if (obj)
						{
							arrObj.push(obj);
						}
					}
					for (var i = 0; i < arrObj.length; i++)
					{
						if (value == "")
						{
							value = arrObj[i].value.toLowerCase();
						}
						else
						{
							if (arrObj[i].value.toLowerCase() != value)
							{
								rv = false;
								break;
							}
						}
					}
					if (!rv && blink)
					{
						for (var i = 0; i < arrObj.length; i++)
						{
							control.callFromBehavior("blink", [arrObj[i]]);
						}
					}
					break;
			}
			break;
		case "email":
			switch (controlType)
			{
				case "text":
				case "combo":
					var obj = control.getChild(id);
					if (obj)
					{
						if (obj.value && obj.value != "")
						{
							var re = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
							rv = re.test(obj.value);
						}
						if (!rv && blink)
						{
							control.callFromBehavior("blink", [obj]);
						}
					}
					break;
			}
			break;
		case "numeric":
			switch (controlType)
			{
				case "text":
				case "combo":
					var obj = control.getChild(id);
					if (obj)
					{
						if (obj.value && obj.value != "")
						{
							rv = !obj.value.match(/\D/);
						}
						if (!rv && blink)
						{
							control.callFromBehavior("blink", [obj]);
						}
					}
					break;
			}
			break;
		case "date":
			switch (controlType)
			{
				case "text":
				case "combo":
					var arrObj = new Array();
					var arrId = id.split(",");
					for (var i = 0; i < arrId.length; i++)
					{
						var obj = control.getChild(arrId[i]);
						if (obj)
						{
							arrObj.push(obj);
						}
					}
					if (arrId.length == 3)
					{
						var dd = parseInt(arrObj[0].value, 10);
						var MM = parseInt(arrObj[1].value, 10) - 1;
						var yyyy = parseInt(arrObj[2].value, 10);
						var date = new Date(yyyy, MM, dd);
						if (date.getFullYear() == yyyy)
						{
							if (date.getMonth() == MM)
							{
								if (date.getDate() == dd)
								{
									rv = true;
								}
							}
						}
					}
					if (!rv && blink)
					{
						for (var i = 0; i < arrObj.length; i++)
						{
							control.callFromBehavior("blink", [arrObj[i]]);
						}
					}
					break;
			}
			break;
	}
	return rv;
};
Competir.Web.UI.getFormElementValue = function(control, id, type)
{
	var rv = "";
	switch (type)
	{
		case "text":
		case "combo":
			var obj = control.getChild(id);
			if (obj)
			{
				rv = obj.value;
			}
			break;
		case "radio":
			var group = document.getElementsByName(control.get_ClientID() + id);
			if (group.length)
			{
				for (var i = 0; i < group.length; i++)
				{
					if (group[i].checked)
					{
						rv = group[i].value;
						break;
					}
				}
			}
			break;
	}
	return rv;
};
Competir.Web.UI.getKeyCode = function(e)
{
	var rv = 0;
	if (!e)
	{
		if (window.event)
		{
			e = window.event;
		}
	}
	if (e)
	{
		if (e.which)
		{
			rv = e.which;
		}
		else if (e.keyCode)
		{
			rv = e.keyCode;
		}
	}
	return rv;
};
Competir.Web.UI.cancelEvent = function(e)
{
	if (!e)
	{
		if (window.event)
		{
			e = window.event;
		}
	}
	if (e.preventDefault && e.stopPropagation)
	{
		e.preventDefault();
		e.stopPropagation();
	}
	else
	{
		e.returnValue = false;
		e.cancelBubble = true;
	}
	return false;
};
Competir.Web.UI.DomObjectMethodExecutor = function(id, methodName)
{
	this.exec = function()
	{
		var s = "document.getElementById(\"" + id + "\")." + methodName + "();";
		eval(s);
	};
};



// ************************************************************************************
// SWFObject
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI");

// constructor
Competir.Web.UI.SWFObject = function(movie, id, width, height, scale, salign, menu, bgcolor, quality)
{
	this.variables = new Object();
	this.attributes = new Object();
	this.elementAttributes = new Array();
	if (id)
	{
		this.setAttribute("id", id);
		this.setAttribute("name", id);
	}
	if (width)
	{
		this.setAttribute("width", width);
	}
	if (height)
	{
		this.setAttribute("height", height);
	}
	if (navigator.userAgent.indexOf("IE") != -1)
	{
		this.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
		this.setAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
		if (movie)
		{
			this.addParam("movie", movie);
		}
		if (scale)
		{
			this.addParam("scale", scale);
		}
		if (salign)
		{
			if (salign.toLowerCase() != "cc")
			{
				this.addParam("salign", salign);
			}
		}
		if (menu)
		{
			this.addParam("menu", menu);
		}
		if (bgcolor)
		{
			if (bgcolor.toLowerCase() == "transparent")
			{
				this.addParam("wmode", "transparent");
			}
			else
			{
				this.addParam("bgcolor", bgcolor);
				this.addParam("wmode", "opaque");
			}
		}
		else
		{
			this.addParam("wmode", "transparent");
		}
		this.addParam("quality", quality ? quality : "high");
		this.addParam("allowscriptaccess", "always");
	}
	else
	{
		if (movie)
		{
			this.setAttribute("src", movie);
		}
		if (scale)
		{
			this.setAttribute("scale", scale);
		}
		if (salign)
		{
			if (salign.toLowerCase() != "cc")
			{
				this.setAttribute("salign", salign);
			}
		}
		if (menu)
		{
			this.setAttribute("menu", menu);
		}
		if (bgcolor)
		{
			if (bgcolor.toLowerCase() == "transparent")
			{
				this.setAttribute("wmode", "transparent");
			}
			else
			{
				this.setAttribute("bgcolor", bgcolor);
				this.setAttribute("wmode", "opaque");
			}
		}
		else
		{
			this.setAttribute("wmode", "transparent");
		}
		this.setAttribute("quality", quality ? quality : "high");
		this.setAttribute("allowScriptAccess", "always");
		this.setAttribute("type", "application/x-shockwave-flash");
	}
};
Competir.Web.UI.SWFObject.prototype =
{
	addParam: function(key, value)
	{
		if (!this.params)
		{
			this.params = new Object();
		}
		this.params[key] = value;
	},
	getParam: function(key)
	{
		return this.params[key];
	},
	setAttribute: function(key, value)
	{
		this.attributes[key] = value;
	},
	getAttribute: function(key)
	{
		return this.attributes[key];
	},
	setElementAttribute: function(key, value)
	{
		this.elementAttributes[key] = value;
	},
	getElementAttribute: function(key)
	{
		return this.elementAttributes[key];
	},
	addVariable: function(key, value)
	{
		this.variables[key] = value;
	},
	getVariable: function()
	{
		return this.variables[key];
	},
	getVariablePairs: function()
	{
		var rv = new Array();
		for (var key in this.variables)
		{
			rv.push(key + "=" + this.variables[key]);
		}
		return rv;
	},
	applyVariables: function()
	{
		var value = this.getVariablePairs().join("&");
		if (navigator.userAgent.indexOf("IE") != -1)
		{
			this.addParam("flashvars", value);
		}
		else
		{
			this.setAttribute("flashvars", value);
		}
	},
	getSWFHTML: function()
	{
		var rv = "";
		var key;
		var tagName = "";
		if (navigator.userAgent.indexOf("IE") != -1)
		{
			tagName += "OBJECT";
		}
		else
		{
			tagName += "EMBED";
		}
		rv += "<" + tagName;
		this.applyVariables();
		for (key in this.attributes)
		{
			rv += " " + key + "=\"" + this.attributes[key] + "\"";
		}
		for (key in this.elementAttributes)
		{
			rv += " " + key + "=\"" + this.elementAttributes[key] + "\"";
		}
		if (this.params)
		{
			rv += ">";
			for (key in this.params)
			{
				rv += "<param name=\"" + key + "\" value=\"" + this.params[key] + "\"/>";
			}
			rv += "</" + tagName + ">";
		}
		else
		{
			rv += "/>";
		}
		return rv;
	},
	write: function(id)
	{
		var n = (typeof id == "string") ? document.getElementById(id) : id;
		if (n.tagName.toLowerCase() == "textarea")
		{
			n.value = this.getSWFHTML();
		}
		else
		{
			if (navigator.userAgent.indexOf("IE") != -1)
			{
				if (this.getParam("movie"))
				{
					var objProxy = new Object();
					objProxy.id = this.getAttribute("id");
					objProxy.CallFunction = function(request)
					{
						document.getElementById(this.id).CallFunction(request);
					};
					objProxy.SetReturnValue = function(value)
					{
						document.getElementById(this.id).SetReturnValue(value);
					};
					window[this.getAttribute("id")] = objProxy;

					this.applyVariables();
					Competir.Web.UI.setInnerHTML(n, this.getSWFHTML());
				}
			}
			else
			{
				if (this.getAttribute("src"))
				{
					Competir.Web.UI.setInnerHTML(n, this.getSWFHTML());
				}
			}
		}
	}
};

// registration
Competir.Web.UI.SWFObject.registerClass("Competir.Web.UI.SWFObject", Sys.Component);



// ************************************************************************************
// Misc
// ************************************************************************************
// exceptions
function ShowHideExceptionInfo(id)
{
	var objLink = document.getElementById("div_ex_link_" + id);
	var objDiv = document.getElementById("div_ex_info_" + id);
	if (objDiv)
	{
		if (objDiv.style.display == "none")
		{
			objDiv.style.display = "block";
			if (objLink)
			{
				Competir.Web.UI.setInnerHTML(objLink, "Ocultar detalles");
			}
		}
		else
		{
			objDiv.style.display = "none";
			if (objLink)
			{
				Competir.Web.UI.setInnerHTML(objLink, "Mostrar detalles");
			}
		}
	}
}
// ************************************************************************************
// SearchBoxEventArgs
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.SearchBoxEventArgs = function()
{
	Competir.Web.UI.Webparts.SearchBoxEventArgs.initializeBase(this);
	this._Expression = "";
};

// prototype
Competir.Web.UI.Webparts.SearchBoxEventArgs.prototype =
{
	// properties
	get_Expression: function()
	{
		return this._Expression;
	},
	set_Expression: function(value)
	{
		if (this._Expression !== value)
		{
			this._Expression = value;
		}
	}
};

// registration
Competir.Web.UI.Webparts.SearchBoxEventArgs.registerClass("Competir.Web.UI.Webparts.SearchBoxEventArgs", Sys.CancelEventArgs);
// ************************************************************************************
// User
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa.Security");

// User
Competir.MiEmpresa.Security.User = function(generic)
{
	Competir.MiEmpresa.Security.User.initializeBase(this);
	this._FKInstancia = 0;
	this._Username = "";
	this._Email = "";
	this._FirstName = "";
	this._LastName = "";
	this._GUID = "";
	this._AccessExpirationDate = "";
	this._UserType = null;
	this._EffectiveLicenseType = null;
	this._RelatedUsers = null;
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.Security.User.prototype =
{
	// methods
	parseGeneric: function(obj)
	{
		if (String.isInstanceOfType(obj))
		{
			obj = Sys.Serialization.JavaScriptSerializer.deserialize(obj);
		}
		this.set_FKInstancia(obj.FKInstancia);
		this.set_Username(obj.Usuario);
		this.set_Email(obj.Email);
		this.set_FirstName(obj.Nombre);
		this.set_LastName(obj.Apellido);
		this.set_GUID(obj.GUID);
		this.set_AccessExpirationDate(obj.AccessExpirationDate);
		this.set_UserType(obj.UserType);
		this.set_EffectiveLicenseType(obj.EffectiveLicenseType);
		this.set_RelatedUsers(obj.RelatedUsers);
		obj = null;
	},

	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_Username: function()
	{
		return this._Username;
	},
	set_Username: function(value)
	{
		if (this._Username !== value)
		{
			this._Username = value;
			this.raisePropertyChanged("Username");
		}
	},
	get_GUID: function()
	{
		return this._GUID;
	},
	set_GUID: function(value)
	{
		if (this._GUID !== value)
		{
			this._GUID = value;
			this.raisePropertyChanged("GUID");
		}
	},
	get_AccessExpirationDate: function()
	{
		return this._AccessExpirationDate;
	},
	set_AccessExpirationDate: function(value)
	{
		if (this._AccessExpirationDate !== value)
		{
			this._AccessExpirationDate = value;
			this.raisePropertyChanged("AccessExpirationDate");
		}
	},
	get_UserType: function()
	{
		return this._UserType;
	},
	set_UserType: function(value)
	{
		if (this._UserType !== value)
		{
			this._UserType = value;
			this.raisePropertyChanged("UserType");
		}
	},
	get_EffectiveLicenseType: function()
	{
		return this._EffectiveLicenseType;
	},
	set_EffectiveLicenseType: function(value)
	{
		if (this._EffectiveLicenseType !== value)
		{
			this._EffectiveLicenseType = value;
			this.raisePropertyChanged("EffectiveLicenseType");
		}
	},
	get_RelatedUsers: function()
	{
		return this._RelatedUsers;
	},
	set_RelatedUsers: function(value)
	{
		if (this._RelatedUsers !== value)
		{
			this._RelatedUsers = value;
			this.raisePropertyChanged("RelatedUsers");
		}
	},
	get_FirstName: function()
	{
		return this._FirstName;
	},
	set_FirstName: function(value)
	{
		if (this._FirstName !== value)
		{
			this._FirstName = value;
			this.raisePropertyChanged("FirstName");
		}
	},
	get_LastName: function()
	{
		return this._LastName;
	},
	set_LastName: function(value)
	{
		if (this._LastName !== value)
		{
			this._LastName = value;
			this.raisePropertyChanged("LastName");
		}
	},
	get_Email: function()
	{
		return this._Email;
	},
	set_Email: function(value)
	{
		if (this._Email !== value)
		{
			this._Email = value;
			this.raisePropertyChanged("Email");
		}
	}
};

// registration
Competir.MiEmpresa.Security.User.registerClass("Competir.MiEmpresa.Security.User", Sys.Component);
// ************************************************************************************
// KeyManager
// ************************************************************************************
/*
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.KeyManager = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.KeyManager.initializeBase(this, [element]);
	this.targetOnOperationStartedDelegate = Function.createDelegate(this, this.targetOnOperationStarted);
	this.targetOnOperationSucceededDelegate = Function.createDelegate(this, this.targetOnOperationSucceeded);
	this.targetOnOperationFailedDelegate = Function.createDelegate(this, this.targetOnOperationFailed);
	this.onKeyDownDelegate = Function.createDelegate(this, this.onKeyDown);
	this.onKeyUpDelegate = Function.createDelegate(this, this.onKeyUp);
	this._TargetDomElementClientID = "";
	this._TargetControlKeyDownHandler = "";
	this._TargetControlKeyUpHandler = "";
};

// prototype
Competir.Web.UI.Webparts.Behaviors.KeyManager.prototype =
{
	// methods
	initialize: function()
	{
		this.bindEvents("initialize");
		var target = this.get_Target();
		if (target)
		{
			target.add_onOperationStarted(this.targetOnOperationStartedDelegate);
			target.add_onOperationSucceeded(this.targetOnOperationSucceededDelegate);
			target.add_onOperationFailed(this.targetOnOperationFailedDelegate);
		}
		Competir.Web.UI.Webparts.Behaviors.KeyManager.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		this.unbindEvents("dispose");
		var target = this.get_Target();
		if (target)
		{
			target.remove_onOperationStarted(this.targetOnOperationStartedDelegate);
			target.remove_onOperationSucceeded(this.targetOnOperationSucceededDelegate);
			target.remove_onOperationFailed(this.targetOnOperationFailedDelegate);
		}
		Competir.Web.UI.Webparts.Behaviors.Registration.callBaseMethod(this, "dispose");
	},
	getKeyCode: function(e)
	{
		var rv = 0;
		if (!e)
		{
			if (window.event)
			{
				e = window.event;
			}
		}
		if (e)
		{
			if (e.which)
			{
				rv = e.which;
			}
			else if (e.keyCode)
			{
				rv = e.keyCode;
			}
		}
		return rv;
	},
	bindEvents: function(referer)
	{
		//alert("(" + this.get_Target().get_ClientID() + ")" + referer + " >> bindEvents");
		if (this.get_TargetDomElementClientID() != "")
		{
			var obj = this.getChild(this.get_TargetDomElementClientID());
			if (obj)
			{
				if (this.get_TargetControlKeyDownHandler() != "")
				{
					$addHandler(obj, "keydown", this.onKeyDownDelegate);
					//obj.onkeydown = Function.createDelegate(this, this.onKeyDown);
				}
				if (this.get_TargetControlKeyUpHandler() != "")
				{
					$addHandler(obj, "keyup", this.onKeyUpDelegate);
					//obj.onkeyup = Function.createDelegate(this, this.onKeyUp);
				}
			}
		}
	},
	unbindEvents: function(referer)
	{
		//alert("(" + this.get_Target().get_ClientID() + ")" + referer + " >> unbindEvents");
		if (this.get_TargetDomElementClientID() != "")
		{
			var obj = this.getChild(this.get_TargetDomElementClientID());
			if (obj)
			{
				$clearHandlers(obj);
			}
		}
	},

	// properties
	get_TargetDomElementClientID: function()
	{
		return this._TargetDomElementClientID;
	},
	set_TargetDomElementClientID: function(value)
	{
		if (this._TargetDomElementClientID !== value)
		{
			this._TargetDomElementClientID = value;
			this.raisePropertyChanged("TargetDomElementClientID");
		}
	},
	get_TargetControlKeyDownHandler: function()
	{
		return this._TargetControlKeyDownHandler;
	},
	set_TargetControlKeyDownHandler: function(value)
	{
		if (this._TargetControlKeyDownHandler !== value)
		{
			this._TargetControlKeyDownHandler = value;
			this.raisePropertyChanged("TargetControlKeyDownHandler");
		}
	},
	get_TargetControlKeyUpHandler: function()
	{
		return this._TargetControlKeyUpHandler;
	},
	set_TargetControlKeyUpHandler: function(value)
	{
		if (this._TargetControlKeyUpHandler !== value)
		{
			this._TargetControlKeyUpHandler = value;
			this.raisePropertyChanged("TargetControlKeyUpHandler");
		}
	},

	// event delegates
	onKeyDown: function(e)
	{
		var keyCode = this.getKeyCode(e);
		if (keyCode != 0)
		{
			//var h = eval("this.get_Target()." + this.get_TargetControlKeyDownHandler());
			var h = this.get_Target()[this.get_TargetControlKeyDownHandler()];
			if (h)
			{
				h.apply(this.get_Target(), [keyCode]);
			}
			else
			{
				this.get_Target().callFromBehavior(this.get_TargetControlKeyDownHandler(), [keyCode]);
			}
		}
	},
	onKeyUp: function()
	{
		var keyCode = this.getKeyCode(e);
		if (keyCode != 0)
		{
			//var h = eval("this.get_Target()." + this.get_TargetControlKeyUpHandler());
			var h = this.get_Target()[this.get_TargetControlKeyUpHandler()];
			if (h)
			{
				h.apply(this.get_Target(), [keyCode]);
			}
			else
			{
				this.get_Target().callFromBehavior(this.get_TargetControlKeyDownHandler(), [keyCode]);
			}
		}
	},
	targetOnOperationStarted: function(sender, args)
	{
		this.unbindEvents("targetOnOperationStarted." + args.get_Command());
	},
	targetOnOperationSucceeded: function(sender, args)
	{
		this.bindEvents("targetOnOperationSucceeded." + args.get_Command());
	},
	targetOnOperationFailed: function(sender, args)
	{
		this.bindEvents("targetOnOperationFailed." + args.get_Command());
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.KeyManager.registerClass("Competir.Web.UI.Webparts.Behaviors.KeyManager", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);
*/



// ************************************************************************************
// FocusManager
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.FocusManager = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.FocusManager.initializeBase(this, [element]);
	this._TargetDomElement = null;
	this._TargetControlFocusHandler = "";
	this._TargetControlBlurHandler = "";
};

// prototype
Competir.Web.UI.Webparts.Behaviors.FocusManager.prototype =
{
	// methods
	initialize: function()
	{
		var obj = this.get_TargetDomElement();
		if (obj)
		{
			obj.onfocus = Function.createDelegate(this, this.onFocus);
			obj.onblur = Function.createDelegate(this, this.onBlur);
		}
		Competir.Web.UI.Webparts.Behaviors.FocusManager.callBaseMethod(this, "initialize");
	},

	// properties
	get_TargetDomElement: function()
	{
		return this._TargetDomElement;
	},
	set_TargetDomElement: function(value)
	{
		if (this._TargetDomElement !== value)
		{
			this._TargetDomElement = value;
			this.raisePropertyChanged("TargetDomElement");
		}
	},
	get_TargetControlFocusHandler: function()
	{
		return this._TargetControlFocusHandler;
	},
	set_TargetControlFocusHandler: function(value)
	{
		if (this._TargetControlFocusHandler !== value)
		{
			this._TargetControlFocusHandler = value;
			this.raisePropertyChanged("TargetControlFocusHandler");
		}
	},
	get_TargetControlBlurHandler: function()
	{
		return this._TargetControlBlurHandler;
	},
	set_TargetControlBlurHandler: function(value)
	{
		if (this._TargetControlBlurHandler !== value)
		{
			this._TargetControlBlurHandler = value;
			this.raisePropertyChanged("TargetControlBlurHandler");
		}
	},

	// event delegates
	onFocus: function(e)
	{
		if (this.get_TargetControlFocusHandler() != "")
		{
			var h = eval("this.get_Target()." + this.get_TargetControlFocusHandler());
			if (h)
			{
				h.apply(this.get_Target(), []);
			}
		}
	},
	onBlur: function()
	{
		if (this.get_TargetControlBlurHandler() != "")
		{
			var h = eval("this.get_Target()." + this.get_TargetControlBlurHandler());
			if (h)
			{
				h.apply(this.get_Target(), []);
			}
		}
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.FocusManager.registerClass("Competir.Web.UI.Webparts.Behaviors.FocusManager", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);



// ************************************************************************************
// DefaultValueManager
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.DefaultValueManager = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.DefaultValueManager.initializeBase(this, [element]);
	this._TargetDomElement = null;
	this._InitialValue = "";
};

// prototype
Competir.Web.UI.Webparts.Behaviors.DefaultValueManager.prototype =
{
	// methods
	initialize: function()
	{
		var obj = this.get_TargetDomElement();
		if (obj)
		{
			obj.onfocus = Function.createDelegate(this, this.onFocus);
			obj.onblur = Function.createDelegate(this, this.onBlur);
			this.set_InitialValue(obj.value);
		}
		Competir.Web.UI.Webparts.Behaviors.DefaultValueManager.callBaseMethod(this, "initialize");
	},

	// properties
	get_TargetDomElement: function()
	{
		return this._TargetDomElement;
	},
	set_TargetDomElement: function(value)
	{
		if (this._TargetDomElement !== value)
		{
			this._TargetDomElement = value;
			this.raisePropertyChanged("TargetDomElement");
		}
	},
	get_InitialValue: function()
	{
		return this._InitialValue;
	},
	set_InitialValue: function(value)
	{
		if (this._InitialValue !== value)
		{
			this._InitialValue = value;
			this.raisePropertyChanged("InitialValue");
		}
	},

	// event delegates
	onFocus: function(e)
	{
		var obj = this.get_TargetDomElement();
		if (obj)
		{
			if (obj.value == this.get_InitialValue())
			{
				obj.value = "";
			}
		}
	},
	onBlur: function()
	{
		var obj = this.get_TargetDomElement();
		if (obj)
		{
			if (obj.value == "")
			{
				obj.value = this.get_InitialValue();
			}
		}
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.DefaultValueManager.registerClass("Competir.Web.UI.Webparts.Behaviors.DefaultValueManager", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);



// ************************************************************************************
// BackgroundBlinker
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.BackgroundBlinker = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.BackgroundBlinker.initializeBase(this, [element]);
	this._IsPlaying = false;
	this._Speed = 700;
	this._Iterations = 0;
	this._TargetDomElement = null;
	this._Color = "";
};

// prototype
Competir.Web.UI.Webparts.Behaviors.BackgroundBlinker.prototype =
{
	// methods
	blink: function(targetDomElement)
	{
		if (targetDomElement)
		{
			if (!targetDomElement.isBlinking)
			{
				var blinkEffect = function(control, target, color, iterations, speed)
				{
					this.control = control;
					this.target = target;
					this.color = color;
					if (target.style.color)
					{
						this.originalFgColor = target.style.color;
					}
					else
					{
						var c = "";
						if (target.currentStyle)
						{
							if (target.currentStyle.color)
							{
								c = target.currentStyle.color;
							}
						}
						if (c == "")
						{
							c = "black";
						}
						this.originalFgColor = c;
					}
					if (target.style.backgroundColor)
					{
						this.originalBgColor = target.style.backgroundColor;
					}
					else
					{
						var c = "";
						if (target.currentStyle)
						{
							if (target.currentStyle.backgroundColor)
							{
								c = target.currentStyle.backgroundColor;
							}
						}
						if (c == "")
						{
							c = "transparent";
						}
						this.originalBgColor = c;
					}
					this.iterations = iterations * 2;
					this.speed = speed;
					this.execute = function(pointer)
					{
						pointer = pointer || this;
						pointer.iterations--;
						if (pointer.iterations == 0)
						{
							pointer.target.isBlinking = false;
							pointer.target.style.color = pointer.originalFgColor;
							pointer.target.style.backgroundColor = pointer.originalBgColor;
						}
						else
						{
							pointer.target.isBlinking = true;
							if (pointer.iterations % 2 == 0)
							{
								pointer.target.style.color = pointer.originalFgColor;
								pointer.target.style.backgroundColor = pointer.originalBgColor;
							}
							else
							{
								pointer.target.style.color = pointer.originalBgColor;
								pointer.target.style.backgroundColor = pointer.color;
							}
							setTimeout(function() { pointer.execute(pointer) }, pointer.speed);
						}
					};
				};
				var e = new blinkEffect(this, targetDomElement, this.get_Color(), this.get_Iterations(), this.get_Speed());
				e.execute();
			}
		}
	},

	// properties
	get_Speed: function()
	{
		return this._Speed;
	},
	set_Speed: function(value)
	{
		if (this._Speed !== value)
		{
			this._Speed = value;
			this.raisePropertyChanged("Speed");
		}
	},
	get_Iterations: function()
	{
		return this._Iterations;
	},
	set_Iterations: function(value)
	{
		if (this._Iterations !== value)
		{
			this._Iterations = value;
			this.raisePropertyChanged("Iterations");
		}
	},
	get_Color: function()
	{
		return this._Color;
	},
	set_Color: function(value)
	{
		if (this._Color !== value)
		{
			this._Color = value;
			this.raisePropertyChanged("Color");
		}
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.BackgroundBlinker.registerClass("Competir.Web.UI.Webparts.Behaviors.BackgroundBlinker", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);



// ************************************************************************************
// Gallery
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.Gallery = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.Gallery.initializeBase(this, [element]);
	this._TargetDomElementClientID = "";
	this._ScrollPosition = 0;
	this._Speed = 30;
	this._Interval = null;
	this.scrollDelegate = Function.createDelegate(this, this.scroll);
};

// prototype
Competir.Web.UI.Webparts.Behaviors.Gallery.prototype =
{
	// methods
	previous: function()
	{
		var obj = this.getChild(this.get_TargetDomElementClientID());
		if (obj)
		{
			this.set_ScrollPosition(obj.scrollTop - parseInt(obj.style.height));
			this.scroll(this);
		}
	},
	next: function()
	{
		var obj = this.getChild(this.get_TargetDomElementClientID());
		if (obj)
		{
			this.set_ScrollPosition(obj.scrollTop + parseInt(obj.style.height));
			this.scroll(this);
		}
	},
	scroll: function()
	{
		var obj = this.getChild(this.get_TargetDomElementClientID());
		if (obj)
		{
			if (!this.get_Interval())
			{
				this.set_Interval(window.setInterval(this.scrollDelegate, this.get_Speed()));
			}
			var d = Math.round((this.get_ScrollPosition() - obj.scrollTop) / 4);
			if (d > 0)
			{
				d = Math.max(d, 1);
			}
			else
			{
				d = Math.min(d, -1);
			}
			if (Math.abs(this.get_ScrollPosition() - obj.scrollTop) > 1)
			{
				obj.scrollTop += d;
			}
			else
			{
				obj.scrollTop = this.get_ScrollPosition();
				clearInterval(this.get_Interval());
				this.set_Interval(null);
			}
		}
	},

	// properties
	get_TargetDomElementClientID: function()
	{
		return this._TargetDomElementClientID;
	},
	set_TargetDomElementClientID: function(value)
	{
		if (this._TargetDomElementClientID !== value)
		{
			this._TargetDomElementClientID = value;
			this.raisePropertyChanged("TargetDomElementClientID");
		}
	},
	get_ScrollPosition: function()
	{
		return this._ScrollPosition;
	},
	set_ScrollPosition: function(value)
	{
		if (this._ScrollPosition !== value)
		{
			this._ScrollPosition = value;
			this.raisePropertyChanged("ScrollPosition");
		}
	},
	get_Speed: function()
	{
		return this._Speed;
	},
	set_Speed: function(value)
	{
		if (this._Speed !== value)
		{
			this._Speed = value;
			this.raisePropertyChanged("Speed");
		}
	},
	get_Interval: function()
	{
		return this._Interval;
	},
	set_Interval: function(value)
	{
		if (this._Interval !== value)
		{
			this._Interval = value;
			this.raisePropertyChanged("Interval");
		}
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.Gallery.registerClass("Competir.Web.UI.Webparts.Behaviors.Gallery", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);



// ************************************************************************************
// Modal
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.Modal = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.Modal.initializeBase(this, [element]);
};

// prototype
Competir.Web.UI.Webparts.Behaviors.Modal.prototype =
{
	// methods
	initialize: function()
	{
		this.get_Target().add_onHide(Function.createDelegate(this, this.onTargetHide));
		this.get_Target().add_onShow(Function.createDelegate(this, this.onTargetShow));
		Competir.Web.UI.Webparts.Behaviors.Modal.callBaseMethod(this, "initialize");
	},

	// event delegates
	onTargetHide: function(sender, args)
	{
		if (window.modal == sender)
		{
			window.modal = null;
		}
	},
	onTargetShow: function(sender, args)
	{
		var objBackground = sender.getChild("Background");
		if (objBackground)
		{
			if (!window.modal)
			{
				Competir.Web.UI.show(objBackground);
				window.modal = sender;
			}
			else
			{
				if (window.modal != sender)
				{
					Competir.Web.UI.hide(objBackground);
				}
			}
		}
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.Modal.registerClass("Competir.Web.UI.Webparts.Behaviors.Modal", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);



// ************************************************************************************
// SwfLoader
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.SwfLoader = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.SwfLoader.initializeBase(this, [element]);
	this._MovieContainer = null;
	this._Movie = "";
	this._Width = "100%";
	this._Height = "100%";
	this._Scale = "ShowAll";
	this._SelfAlign = "";
	this._Menu = "false";
	this._BackgroundColor = "";
};

// prototype
Competir.Web.UI.Webparts.Behaviors.SwfLoader.prototype =
{
	// methods
	loadMovie: function()
	{
		if (this.get_Movie() != "")
		{
			var o = new Competir.Web.UI.SWFObject(this.get_Movie(), this.get_ClientID() + "Player", this.get_Width(), this.get_Height(), this.get_Scale(), this.get_SelfAlign(), this.get_Menu(), this.get_BackgroundColor(), "high");
			o.addVariable("id", this.get_ClientID());
			o.write(this.get_MovieContainer());
		}
	},
	refresh: function()
	{
		var objMovie = this.getChild("Player");
		if (objMovie)
		{
			objMovie.width = this.get_Width();
			objMovie.height = this.get_Height();
		}
	},

	// properties
	get_MovieContainer: function()
	{
		return this._MovieContainer;
	},
	set_MovieContainer: function(value)
	{
		if (this._MovieContainer !== value)
		{
			this._MovieContainer = value;
			this.raisePropertyChanged("MovieContainer");
		}
	},
	get_Movie: function()
	{
		return this._Movie;
	},
	set_Movie: function(value)
	{
		if (this._Movie !== value)
		{
			this._Movie = value;
			this.raisePropertyChanged("Movie");
		}
	},
	get_Width: function()
	{
		return this._Width;
	},
	set_Width: function(value)
	{
		if (this._Width !== value)
		{
			this._Width = value;
			this.raisePropertyChanged("Width");
			if (this.get_isInitialized())
			{
				this.refresh();
			}
		}
	},
	get_Height: function()
	{
		return this._Height;
	},
	set_Height: function(value)
	{
		if (this._Height !== value)
		{
			this._Height = value;
			this.raisePropertyChanged("Height");
			if (this.get_isInitialized())
			{
				this.refresh();
			}
		}
	},
	get_Scale: function()
	{
		return this._Scale;
	},
	set_Scale: function(value)
	{
		if (this._Scale !== value)
		{
			this._Scale = value;
			this.raisePropertyChanged("Scale");
		}
	},
	get_SelfAlign: function()
	{
		return this._SelfAlign;
	},
	set_SelfAlign: function(value)
	{
		if (this._SelfAlign !== value)
		{
			this._SelfAlign = value;
			this.raisePropertyChanged("SelfAlign");
		}
	},
	get_Menu: function()
	{
		return this._Menu;
	},
	set_Menu: function(value)
	{
		if (this._Menu !== value)
		{
			this._Menu = value;
			this.raisePropertyChanged("Menu");
		}
	},
	get_BackgroundColor: function()
	{
		return this._BackgroundColor;
	},
	set_BackgroundColor: function(value)
	{
		if (this._BackgroundColor !== value)
		{
			this._BackgroundColor = value;
			this.raisePropertyChanged("BackgroundColor");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		this.loadMovie();
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.SwfLoader.registerClass("Competir.Web.UI.Webparts.Behaviors.SwfLoader", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);



// ************************************************************************************
// Callout
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts.Behaviors");

// constructor
Competir.Web.UI.Webparts.Behaviors.Callout = function(element)
{
	Competir.Web.UI.Webparts.Behaviors.Callout.initializeBase(this, [element]);
	this._onWindowChangeEventDelegate = Function.createDelegate(this, this.refresh);
	this._onClickEventDelegate = Function.createDelegate(this, this._onClick);
	this._TargetDomElement = null;
	this._MessageClientID = "";
	this._Position = "Down";
	this._OffsetX = 0;
	this._OffsetY = 0;
};

// prototype
Competir.Web.UI.Webparts.Behaviors.Callout.prototype =
{
	// methods
	initialize: function()
	{
		this.get_element().style.position = "absolute";
		if (window.addEventListener)
		{
			window.addEventListener("resize", this._onWindowChangeEventDelegate, false);
			window.addEventListener("scroll", this._onWindowChangeEventDelegate, false);
			window.addEventListener("click", this._onClickEventDelegate, false);
		}
		else if (document.addEventListener)
		{
			document.addEventListener('resize', this._onWindowChangeEventDelegate, false);
			document.addEventListener('scroll', this._onWindowChangeEventDelegate, false);
			document.addEventListener('click', this._onClickEventDelegate, false);
		}
		else
		{
			window.attachEvent("onresize", this._onWindowChangeEventDelegate);
			window.attachEvent("onscroll", this._onWindowChangeEventDelegate);
			document.attachEvent("onclick", this._onClickEventDelegate);
		}
		Competir.Web.UI.Webparts.Behaviors.Callout.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		Competir.Web.UI.Webparts.Behaviors.Callout.callBaseMethod(this, "dispose");
	},
	show: function(targetDomElement, messageClientID, position, offsetX, offsetY)
	{
		if (targetDomElement)
		{
			this.set_TargetDomElement(targetDomElement);
			if (messageClientID)
			{
				this.set_MessageClientID(messageClientID);
			}
			if (position)
			{
				this.set_Position(position);
			}
			if (offsetX)
			{
				this.set_OffsetX(offsetX);
			}
			if (offsetY)
			{
				this.set_OffsetY(offsetY);
			}

			var i;
			var directions = new Array("Up", "Down", "Left", "Right");
			for (i = 0; i < directions.length; i++)
			{
				var objArrow = this.getChild(directions[i]);
				if (objArrow)
				{
					Competir.Web.UI.hide(objArrow);
					switch (directions[i])
					{
						case "Up":
						case "Down":
							if (this.get_OffsetX() != 0)
							{
								if (objArrow)
								{
									objArrow.style.left = (this.get_OffsetX() * -1);
								}
							}
							if (this.get_Position().toLowerCase() == "up" && directions[i].toLowerCase() == "down")
							{
								Competir.Web.UI.show(objArrow);
							}
							else if (this.get_Position().toLowerCase() == "down" && directions[i].toLowerCase() == "up")
							{
								Competir.Web.UI.show(objArrow);
							}
							break;
						case "Left":
						case "Right":
							if (this.get_OffsetY() != 0)
							{
								if (objArrow)
								{
									objArrow.style.top = (this.get_OffsetY() * -1);
								}
							}
							if (this.get_Position().toLowerCase() == "left" && directions[i].toLowerCase() == "right")
							{
								Competir.Web.UI.show(objArrow);
							}
							else if (this.get_Position().toLowerCase() == "right" && directions[i].toLowerCase() == "left")
							{
								Competir.Web.UI.show(objArrow);
							}
							break;
					}
				}
			}

			if (this.get_MessageClientID())
			{
				var objContainer = this.get_Target().getContentsContainer();
				if (objContainer)
				{
					for (i = 0; i < objContainer.childNodes.length; i++)
					{
						Competir.Web.UI.hide(objContainer.childNodes[i]);
					}
				}
				var objMessage = this.getChild(this.get_MessageClientID());
				if (objMessage)
				{
					Competir.Web.UI.show(objMessage);
				}
			}

			this.get_Target().show();
			this.refresh();
		}
	},
	computeCoordinate: function(coordinate)
	{
		var rv = 0;
		switch (coordinate)
		{
			case "top":
				if (navigator.userAgent.indexOf("MSIE") == -1)
				{
					rv += document.body.scrollTop;
				}
				switch (this.get_Position().toLowerCase())
				{
					case "up":
						rv -= this.get_element().offsetHeight;
						rv -= this.get_OffsetY();
						break;
					case "down":
						rv += this.get_TargetDomElement().offsetHeight;
						rv += this.get_OffsetY();
						break;
					case "left":
					case "right":
						rv -= this.get_element().offsetHeight * 0.5;
						rv += this.get_TargetDomElement().offsetHeight * 0.5;
						break;
				}
				rv += this.get_OffsetY();
				break;
			case "left":
				if (navigator.userAgent.indexOf("MSIE") == -1)
				{
					rv += document.body.scrollLeft;
				}
				switch (this.get_Position().toLowerCase())
				{
					case "up":
					case "down":
						rv -= this.get_element().offsetWidth * 0.5;
						rv += this.get_TargetDomElement().offsetWidth * 0.5;
						break;
					case "left":
						rv -= this.get_element().offsetWidth;
						break;
					case "right":
						rv += this.get_TargetDomElement().offsetWidth;
						break;
				}
				rv += this.get_OffsetX();
				break;
		}
		var refNode = this.get_TargetDomElement();
		while (refNode)
		{
			switch (coordinate)
			{
				case "top":
					if (refNode.offsetTop != 0)
					{
						rv += refNode.offsetTop;
					}
					break;
				case "left":
					if (refNode.offsetLeft != 0)
					{
						rv += refNode.offsetLeft;
					}
					break;
			}
			refNode = refNode.offsetParent;
		}
		return rv;
	},
	refresh: function()
	{
		if (this.get_TargetDomElement())
		{
			this.get_element().style.top = this.computeCoordinate("top") + "px";
			this.get_element().style.left = this.computeCoordinate("left") + "px";
		}
	},

	// properties
	get_TargetDomElement: function()
	{
		return this._TargetDomElement;
	},
	set_TargetDomElement: function(value)
	{
		if (this._TargetDomElement !== value)
		{
			this._TargetDomElement = value;
			this.raisePropertyChanged("TargetDomElement");
		}
	},
	get_MessageClientID: function()
	{
		return this._MessageClientID;
	},
	set_MessageClientID: function(value)
	{
		if (this._MessageClientID !== value)
		{
			this._MessageClientID = value;
			this.raisePropertyChanged("MessageClientID");
		}
	},
	get_Position: function()
	{
		return this._Position;
	},
	set_Position: function(value)
	{
		if (this._Position !== value)
		{
			this._Position = value;
			this.raisePropertyChanged("Position");
		}
	},
	get_OffsetX: function()
	{
		return this._OffsetX;
	},
	set_OffsetX: function(value)
	{
		if (this._OffsetX !== value)
		{
			this._OffsetX = value;
			this.raisePropertyChanged("OffsetX");
		}
	},
	get_OffsetY: function()
	{
		return this._OffsetY;
	},
	set_OffsetY: function(value)
	{
		if (this._OffsetY !== value)
		{
			this._OffsetY = value;
			this.raisePropertyChanged("OffsetY");
		}
	},

	// event delegates
	_onClick: function(sender, args)
	{
		if (this.get_TargetDomElement())
		{
			if (document.compareDocumentPosition)
			{
				if (this.get_TargetDomElement() != sender.target)
				{
					if ((this.get_element().compareDocumentPosition(sender.target) & 16) == 0)
					{
						this.get_Target().hide();
					}
				}
			}
			else if (this.get_element().contains)
			{
				if (this.get_TargetDomElement() != sender.srcElement)
				{
					if (!this.get_element().contains(sender.srcElement))
					{
						this.get_Target().hide();
					}
				}
			}
		}
	}
};

// registration
Competir.Web.UI.Webparts.Behaviors.Callout.registerClass("Competir.Web.UI.Webparts.Behaviors.Callout", Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);
// ************************************************************************************
//	Execution queue
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.ExecutionQueue = function(maxConcurrentCalls, noOpTimeoutMS)
{
	Competir.MiEmpresa.ExecutionQueue.initializeBase(this);
	this._onOperationStartedDelegate = Function.createDelegate(this, this._onOperationStarted);
	this._onOperationFinishedDelegate = Function.createDelegate(this, this._onOperationFinished);
	this._Active = false;
	this._MaxConcurrentCalls = maxConcurrentCalls;
	this._NoOpTimeoutMS = (noOpTimeoutMS) ? noOpTimeoutMS : 0;
	this._Operations = new Array();
	this._ExecutingOperations = new Array();
	this._Timer = null;
};

// prototype
Competir.MiEmpresa.ExecutionQueue.prototype =
{
	// methods
	start: function()
	{
		if (!this.get_Active())
		{
			this.set_Active(true);
			this.process();
		}
	},
	stop: function()
	{
		this.set_Active(false);
		this.abortOperations(this.get_Operations());
		this.abortOperations(this.get_ExecutingOperations());
	},
	process: function()
	{
		var eq = this;
		var ms;
		if (this.get_Operations().length != 0)
		{
			ms = 200;
		}
		else if (this.get_NoOpTimeoutMS() != 0)
		{
			ms = this.get_NoOpTimeoutMS();
		}
		if (this._Timer)
		{
			clearTimeout(this._Timer);
		}
		this._Timer = setTimeout(function() { eq.run() }, ms);
	},
	enqueue: function(o)
	{
		Array.add(this.get_Operations(), o);
		o.add_onStarted(this._onOperationStartedDelegate);
		o.add_onSucceeded(this._onOperationFinishedDelegate);
		o.add_onFailed(this._onOperationFinishedDelegate);
		o.onStarted();
		this.reportStatus();
		this.process();
	},
	run: function()
	{
		if (this.get_Active())
		{
			var operations = this.get_Operations();
			if (operations.length != 0)
			{
				for (var i = 0; i < operations.length; i++)
				{
					if (this.get_Active())
					{
						var o = operations[i];
						if (this.get_ExecutingOperations().length < this.get_MaxConcurrentCalls())
						{
							if (o)
							{
								Array.add(this.get_ExecutingOperations(), o);
								Array.remove(operations, o);
								o.execute();
							}
							this.reportStatus();
						}
						else
						{
							this.reportStatus();
							break;
						}
					}
				}
			}
			else if (this.get_NoOpTimeoutMS() != 0)
			{
				var o = new Competir.MiEmpresa.Operation("noop");
				o.execute();
				this.process();
			}
		}
	},
	abortOperations: function(operations)
	{
		if (operations.length != 0)
		{
			for (var i = 0; i < operations.length; i++)
			{
				var o = operations[i];
				if (o)
				{
					var r = o.get_Request();
					if (r)
					{
						var e = r.get_executor();
						if (e)
						{
							e._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
							e.get_statusCode = function()
							{
								return 0;
							};
							if (e.get_started())
							{
								e.abort();
							}
						}
					}
				}
			}
			Array.clear(operations);
		}
	},
	isExecuting: function(command)
	{
		var rv = false;
		var executing = this.get_ExecutingOperations();
		if (command)
		{
			for (var i = 0; i < executing.length; i++)
			{
				if (executing[i].get_Command() == command)
				{
					rv = true;
					break;
				}
			}
		}
		else
		{
			rv = (executing.length != 0);
		}
		return rv;
	},
	reportStatus: function()
	{
		/*
		var out = "";
		out += "Total: " + this.get_Operations().length;
		out += " / ";
		out += "Executing: " + this.get_ExecutingOperations().length;
		document.title = out;
		*/
	},

	// properties
	get_Active: function()
	{
		return this._Active;
	},
	set_Active: function(value)
	{
		if (this._Active !== value)
		{
			this._Active = value;
			this.raisePropertyChanged("Active");
		}
	},
	get_MaxConcurrentCalls: function()
	{
		return this._MaxConcurrentCalls;
	},
	set_MaxConcurrentCalls: function(value)
	{
		if (this._MaxConcurrentCalls !== value)
		{
			this._MaxConcurrentCalls = value;
			this.raisePropertyChanged("MaxConcurrentCalls");
		}
	},
	get_NoOpTimeoutMS: function()
	{
		return this._NoOpTimeoutMS;
	},
	set_NoOpTimeoutMS: function(value)
	{
		if (this._NoOpTimeoutMS !== value)
		{
			this._NoOpTimeoutMS = value;
			this.raisePropertyChanged("NoOpTimeoutMS");
		}
	},
	get_Operations: function()
	{
		return this._Operations;
	},
	set_Operations: function(value)
	{
		if (this._Operations !== value)
		{
			this._Operations = value;
			this.raisePropertyChanged("Operations");
		}
	},
	get_ExecutingOperations: function()
	{
		return this._ExecutingOperations;
	},
	set_ExecutingOperations: function(value)
	{
		if (this._ExecutingOperations !== value)
		{
			this._ExecutingOperations = value;
			this.raisePropertyChanged("ExecutingOperations");
		}
	},

	// event delegates
	_onOperationStarted: function(sender, args)
	{
		this.reportStatus();
	},
	_onOperationFinished: function(sender, args)
	{
		sender.remove_onStarted(this._onOperationStartedDelegate);
		sender.remove_onSucceeded(this._onOperationFinishedDelegate);
		sender.remove_onFailed(this._onOperationFinishedDelegate);
		Array.remove(this.get_ExecutingOperations(), sender);
		sender.dispose();
		this.reportStatus();
		this.process();
	}
};

// registration
Competir.MiEmpresa.ExecutionQueue.registerClass("Competir.MiEmpresa.ExecutionQueue", Sys.Component);
// ************************************************************************************
//	Operation
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.Operation = function(command)
{
	Competir.MiEmpresa.Operation.initializeBase(this);
	this._Command = command;
	this._Request = null;
	this._Result = null;
	this._LastError = null;
	this._Parameters = new Array();
};

// prototype
Competir.MiEmpresa.Operation.prototype =
{
	// methods
	execute: function()
	{
		var proxy = new Competir.MiEmpresa.Web.ws.operaciones();
		proxy.set_defaultSucceededCallback(Function.createDelegate(this, this.onSucceeded));
		proxy.set_defaultFailedCallback(Function.createDelegate(this, this.onFailed));
		this.set_Request(proxy.ExecuteMultipleOperations("<Operations>" + this.toXml() + "</Operations>"));
	},
	toXml: function()
	{
		var rv = "<Operation>";
		rv += "<Command><![CDATA[" + this.get_Command() + "]]></Command>";
		var parameters = this.get_Parameters();
		if (parameters.length)
		{
			rv += "<Parameters>";
			for (var i = 0; i < parameters.length; i++)
			{
				rv += "<Parameter>";
				rv += "<Name><![CDATA[" + parameters[i].name + "]]></Name>";
				if (parameters[i].cdata == false)
				{
					rv += "<Value isxml=\"true\">" + parameters[i].value + "</Value>";
				}
				else
				{
					rv += "<Value isxml=\"false\"><![CDATA[" + parameters[i].value + "]]></Value>";
				}
				rv += "</Parameter>";
			}
			rv += "</Parameters>";
		}
		rv += "</Operation>";
		return rv;
	},
	addParameter: function(name, value, cdata)
	{
		Array.add(this.get_Parameters(), { name: name, value: value, cdata: cdata });
	},
	getParameter: function(name)
	{
		var rv = null;
		var parameters = this.get_Parameters();
		for (var i = 0; i < parameters.length; i++)
		{
			if (parameters[i].name == name)
			{
				rv = parameters[i];
				break;
			}
		}
		return rv;
	},
	addListener: function(obj)
	{
		if (obj._onOperationStarted)
		{
			this.add_onStarted(Function.createDelegate(obj, obj._onOperationStarted));
		}
		if (obj._onOperationSucceeded)
		{
			this.add_onSucceeded(Function.createDelegate(obj, obj._onOperationSucceeded));
		}
		if (obj._onOperationFailed)
		{
			this.add_onFailed(Function.createDelegate(obj, obj._onOperationFailed));
		}
	},
	raiseEvent: function(id, args)
	{
		var events = this.get_events();
		if (events)
		{
			var f = events.getHandler(id);
			if (f)
			{
				f(this, args);
			}
		}
	},

	// properties
	get_Command: function()
	{
		return this._Command;
	},
	set_Command: function(value)
	{
		if (this._Command !== value)
		{
			this._Command = value;
			this.raisePropertyChanged("Command");
		}
	},
	get_Request: function()
	{
		return this._Request;
	},
	set_Request: function(value)
	{
		if (this._Request !== value)
		{
			this._Request = value;
			this.raisePropertyChanged("Request");
		}
	},
	get_Result: function()
	{
		return this._Result;
	},
	set_Result: function(value)
	{
		if (this._Result !== value)
		{
			this._Result = value;
			this.raisePropertyChanged("Result");
		}
	},
	get_LastError: function()
	{
		return this._LastError;
	},
	set_LastError: function(value)
	{
		if (this._LastError !== value)
		{
			this._LastError = value;
			this.raisePropertyChanged("LastError");
		}
	},
	get_Parameters: function()
	{
		return this._Parameters;
	},
	set_Parameters: function(value)
	{
		if (this._Parameters !== value)
		{
			this._Parameters = value;
			this.raisePropertyChanged("Parameters");
		}
	},

	// events
	add_onStarted: function(handler)
	{
		this.get_events().addHandler("onStarted", handler);
	},
	remove_onStarted: function(handler)
	{
		this.get_events().removeHandler("onStarted", handler);
	},
	add_onSucceeded: function(handler)
	{
		this.get_events().addHandler("onSucceeded", handler);
	},
	remove_onSucceeded: function(handler)
	{
		this.get_events().removeHandler("onSucceeded", handler);
	},
	add_onFailed: function(handler)
	{
		this.get_events().addHandler("onFailed", handler);
	},
	remove_onFailed: function(handler)
	{
		this.get_events().removeHandler("onFailed", handler);
	},

	// event delegates
	onStarted: function()
	{
		this.raiseEvent("onStarted", Sys.EventArgs.Empty);
	},
	onSucceeded: function(result, eventArgs)
	{
		this.set_Result(result);
		this.raiseEvent("onSucceeded", eventArgs);
	},
	onFailed: function(error)
	{
		this.set_LastError(error);
		this.raiseEvent("onFailed", Sys.EventArgs.Empty);
	}
};

// registration
Competir.MiEmpresa.Operation.registerClass("Competir.MiEmpresa.Operation", Sys.Component);
// ************************************************************************************
// CustomPropertyOption
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.CustomPropertyOption = function(generic)
{
	Competir.MiEmpresa.CustomPropertyOption.initializeBase(this);
	this._Key = "";
	this._Value = "";
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.CustomPropertyOption.prototype =
{
	// methods
	writeXml: function(sb)
	{
		sb.append(String.format("<option key=\"{0}\">{1}</option>", this.get_Key(), this.get_Value()));
	},
	parseGeneric: function(obj)
	{
		this.set_Key(obj.Key);
		this.set_Value(obj.Value);
		obj = null;
	},

	// properties
	get_Key: function()
	{
		return this._Key;
	},
	set_Key: function(value)
	{
		if (this._Key !== value)
		{
			this._Key = value;
			this.raisePropertyChanged("Key");
		}
	},
	get_Value: function()
	{
		return this._Value;
	},
	set_Value: function(value)
	{
		if (this._Value !== value)
		{
			this._Value = value;
			this.raisePropertyChanged("Value");
		}
	},

	// JSON
	descriptor: function()
	{
		properties: [{ Key: "Key", Type: String }, { Key: "Value", Value: String}];
	}
};

// registration
Competir.MiEmpresa.CustomPropertyOption.registerClass("Competir.MiEmpresa.CustomPropertyOption", Sys.Component);



// ************************************************************************************
// CustomPropertyOptions
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.CustomPropertyOptions = function(generic)
{
	Competir.MiEmpresa.CustomPropertyOptions.initializeBase(this);
	this._arr = new Array();
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.CustomPropertyOptions.prototype =
{
	// methods
	clear: function()
	{
		while (this._arr.length != 0)
		{
			this._arr.pop();
		}
	},
	add: function(obj)
	{
		this._arr.push(obj);
	},
	addComplete: function(key, value)
	{
		var cpo = new Competir.MiEmpresa.CustomPropertyOption();
		cpo.set_Key(key);
		cpo.set_Value(value);
		this._arr.push(cpo);
	},
	indexOf: function(index)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i] == obj)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	indexOfKey: function(key)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_Key() == key)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	getItem: function(index)
	{
		return this._arr[index];
	},
	get_Count: function()
	{
		return this._arr.length;
	},
	parseGeneric: function(obj)
	{
		this.clear();
		if (obj != null && obj.length != null)
		{
			for (var i = 0; i < obj.length; i++)
			{
				var cpo = new Competir.MiEmpresa.CustomPropertyOption();
				cpo.parseGeneric(obj[i]);
				this.add(cpo);
			}
		}
		obj = null;
	}
};

// registration
Competir.MiEmpresa.CustomPropertyOptions.registerClass("Competir.MiEmpresa.CustomPropertyOptions", Sys.Component);



// ************************************************************************************
// CustomProperty
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.CustomProperty = function(generic)
{
	Competir.MiEmpresa.CustomProperty.initializeBase(this);
	this._Name = "";
	this._Value = null;
	this._Section = "system";
	this._IsXml = false;
	this._Label = "";
	this._Options = new Competir.MiEmpresa.CustomPropertyOptions();
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.CustomProperty.prototype =
{
	// methods
	ToString: function()
	{
		return String.format("Name: {0}, Label: {1}, IsXml: {2}, Section: {3}", this._Name, this._Label, this._IsXml, this._Section);
	},
	toXml: function()
	{
		return this.writeXml(new Sys.StringBuilder(""));
	},
	writeXml: function(sb)
	{
		sb.append(String.format("<property name=\"{0}\" label=\"{1}\" isxml=\"{2}\">", this._Name, this._Label, this._IsXml));
		if (this._Value)
		{
			sb.append("<value><![CDATA[" + this._Value + "]]></value>");
		}
		if (this._Option != null && this._Options.get_Count() > 0)
		{
			sb.append("<options>");
			for (var i = 0; i < this._Options.get_Count(); i++)
			{
				var o = this._Options.get_Item(i);
				o.writeXml(sb);
				i++;
			}
			sb.append("</options>");
		}
		sb.append("</property>");
		return sb.toString();
	},
	parseGeneric: function(obj)
	{
		this.set_Name(obj.Name);
		this.set_Value(obj.Value);
		this.set_Section(obj.Section);
		this.set_IsXml(obj.IsXml);
		this.set_Label(obj.Label);
		this.get_Options().parseGeneric(obj.Options);
		obj = null;
	},

	// properties
	get_Name: function()
	{
		return this._Name;
	},
	set_Name: function(value)
	{
		if (this._Name !== value)
		{
			this._Name = value;
			this.raisePropertyChanged("Name");
		}
	},
	get_Value: function()
	{
		return this._Value;
	},
	set_Value: function(value)
	{
		if (this._Value !== value)
		{
			this._Value = value;
			this.raisePropertyChanged("Value");
		}
	},
	get_Section: function()
	{
		return this._Section;
	},
	set_Section: function(value)
	{
		if (this._Section !== value)
		{
			this._Section = value;
			this.raisePropertyChanged("Section");
		}
	},
	get_IsXml: function()
	{
		return this._IsXml;
	},
	set_IsXml: function(value)
	{
		if (this._IsXml !== value)
		{
			this._IsXml = value;
			this.raisePropertyChanged("IsXml");
		}
	},
	get_Label: function()
	{
		return this._Label;
	},
	set_Label: function(value)
	{
		if (this._Label !== value)
		{
			this._Label = value;
			this.raisePropertyChanged("Label");
		}
	},
	get_Options: function()
	{
		return this._Options;
	},
	set_Options: function(value)
	{
		if (this._Options !== value)
		{
			this._Options = value;
			this.raisePropertyChanged("Options");
		}
	}
};

// registration
Competir.MiEmpresa.CustomProperty.registerClass("Competir.MiEmpresa.CustomProperty", Sys.Component);



// ************************************************************************************
// CustomProperties
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.CustomProperties = function(generic)
{
	Competir.MiEmpresa.CustomProperties.initializeBase(this);
	this._arr = new Array();
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.CustomProperties.prototype =
{
	// methods
	addNew: function(section, name, value)
	{
		var rv = new Competir.MiEmpresa.CustomProperty();
		rv.set_Section(section);
		rv.set_Name(name);
		rv.set_Value(value);
		this.add(rv);
		return rv;
	},
	clear: function()
	{
		while (this._arr.length != 0)
		{
			this._arr.pop();
		}
	},
	add: function(obj)
	{
		this._arr.push(obj);
	},
	addComplete: function(key, value)
	{
		var cpo = new Competir.MiEmpresa.CustomPropertyOption();
		cpo.set_Key(key);
		cpo.set_Value(value);
		this._arr.push(cpo);
	},
	indexOf: function(obj)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i] == obj)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	indexOfName: function(section, name)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_Name() == name && this._arr[i].get_Section() == section)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	getItem: function(index)
	{
		return this._arr[index];
	},
	getItemByName: function(section, name)
	{
		return this._arr[this.indexOfName(section, name)];
	},
	toXml: function()
	{
		return this.writeXml(new Sys.StringBuilder(""));
	},
	writeXml: function(sb)
	{
		sb.append("<properties>");
		var arrSections = new Array();
		for (var i = 0; i < this.get_Count(); i++)
		{
			var item = this.getItem(i);
			if (!Array.contains(arrSections, item.get_Section()))
			{
				Array.add(arrSections, item.get_Section());
			}
		}
		for (var i = 0; i < arrSections.length; i++)
		{
			var sectionName = arrSections[i];
			sb.append("<" + sectionName + ">");
			for (var j = 0; j < this.get_Count(); j++)
			{
				var item = this.getItem(j);
				if (item.get_Section() == sectionName)
				{
					item.writeXml(sb);
				}
			}
			sb.append("</" + sectionName + ">");
		}
		sb.append("</properties>");
		return sb.toString();
	},
	parseGeneric: function(obj)
	{
		this.clear();
		if (obj != null && obj.length != null)
		{
			for (var i = 0; i < obj.length; i++)
			{
				this.add(new Competir.MiEmpresa.CustomProperty(obj[i]));
			}
		}
		obj = null;
	},
	get_Count: function()
	{
		return this._arr.length;
	}
};

// registration
Competir.MiEmpresa.CustomProperties.registerClass("Competir.MiEmpresa.CustomProperties", Sys.Component);

// ************************************************************************************
// BaseWebpartControl
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.BaseWebpartControl = function(element)
{
	Competir.Web.UI.Webparts.BaseWebpartControl.initializeBase(this, [element]);
	this._onApplicationLoadDelegate = Function.createDelegate(this, this._onApplicationLoad);
	this._UniqueID = "";
	this._ClientID = "";
	this._ClientIDSeparator = "";
	this._ClientVisible = true;
	this._ScriptFolder = "";
	this._ScriptFolderUri = "";
	this._XsltFolder = "";
	this._XsltFile = "";
	this._XsltFileUri = "";
	this._XsltParameters = new Competir.MiEmpresa.CustomProperties();
	this._Width = "";
	this._Height = "";
	this._StandAloneWebpart = false;
	this._AKInstanciaWebpart = "";
	this._GUIDInstanciaWebpart = "";
	this._ContentsContainerClientID = "";
	this._ProgressIndicatorClientID = "";
	this._Properties = new Competir.MiEmpresa.CustomProperties();
	this._EnableAjax = true;
	this._RegisterClientControl = true;
	this._ParentBaseWebpartControl = null;
	this._UseCache = false;
	this._CacheExpirationTimeSpan = "00:00:00";
};

// prototype
Competir.Web.UI.Webparts.BaseWebpartControl.prototype =
{
	// methods
	initialize: function()
	{
		Sys.Application.add_load(this._onApplicationLoadDelegate);
		this.add_propertyChanged(this._onPropertyChanged);
		this.toggleDisplay(this, this.get_ClientVisible());
		Competir.Web.UI.Webparts.BaseWebpartControl.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		$clearHandlers(this.get_element());
		Sys.Application.remove_load(this._onApplicationLoadDelegate);
		this.remove_propertyChanged(this._onPropertyChanged);
		Competir.Web.UI.Webparts.BaseWebpartControl.callBaseMethod(this, "dispose");
	},
	getChildControls: function()
	{
		var rv = new Array();
		var c = Sys.Application.getComponents();
		for (var i = 0; i < c.length; i++)
		{
			if (Competir.Web.UI.Webparts.BaseWebpartControl.isInstanceOfType(c[i]))
			{
				if (c[i].get_ParentBaseWebpartControl() == this)
				{
					rv.push(c[i]);
				}
			}
		}
		return rv;
	},
	findChild: function(id)
	{
		var rv = null;
		if (id)
		{
			rv = $find(this.get_ClientID() + this.get_ClientIDSeparator() + id);
			if (!rv)
			{
				rv = $find(this.get_ClientID() + id);
			}
			if (!rv)
			{
				rv = $find(id);
			}
		}
		return rv;
	},
	getChild: function(id)
	{
		var rv = null;
		if (id)
		{
			rv = $get(this.get_ClientID() + this.get_ClientIDSeparator() + id);
			if (!rv)
			{
				rv = $get(this.get_ClientID() + id);
			}
			if (!rv)
			{
				rv = $get(id);
			}
		}
		return rv;
	},
	getContentsContainer: function()
	{
		var rv = $get(this.get_id());
		if (this.get_ContentsContainerClientID() != "")
		{
			rv = $get(this.get_ContentsContainerClientID());
			if (!rv)
			{
				rv = $get(this.get_ClientID() + this.get_ContentsContainerClientID());
			}
		}
		return rv;
	},
	getProgressIndicator: function()
	{
		var rv = null;
		if (this.get_ProgressIndicatorClientID() != "")
		{
			rv = $get(this.get_ClientID() + this.get_ProgressIndicatorClientID());
			if (!rv)
			{
				rv = $get(this.get_ProgressIndicatorClientID());
			}
		}
		return rv;
	},
	raiseEvent: function(id, args)
	{
		var events = this.get_events();
		if (events)
		{
			var f = events.getHandler(id);
			if (f)
			{
				f(this, args);
			}
		}
	},
	callFromBehavior: function(fnName, args)
	{
		var bhs = Sys.UI.Behavior.getBehaviors(this.get_element());
		for (var i = 0; i < bhs.length; i++)
		{
			var b = bhs[i];
			var m = eval("b." + fnName);
			if (m)
			{
				m.apply(b, args);
				break;
			}
		}
	},
	showWorkingProgress: function()
	{
		if (this.get_visible())
		{
			var obj = this.getProgressIndicator();
			if (obj)
			{
				Competir.Web.UI.show(obj);
			}
		}
	},
	hideWorkingProgress: function()
	{
		var obj = this.getProgressIndicator();
		if (obj)
		{
			Competir.Web.UI.hide(obj);
		}
	},
	toggleDisplay: function(obj, value)
	{
		if (!obj)
		{
			obj = this;
		}
		Competir.Web.UI.toggleDisplay(obj, value);
	},
	toggleImage: function(obj)
	{
		Competir.Web.UI.toggleImage(obj);
	},
	show: function(obj)
	{
		if (!obj)
		{
			obj = this;
		}
		Competir.Web.UI.show(obj);
	},
	hide: function(obj)
	{
		if (!obj)
		{
			obj = this;
		}
		Competir.Web.UI.hide(obj);
	},
	applyStyle: function(obj, name)
	{
		obj.className += " " + name;
	},
	removeStyle: function(obj, name)
	{
		obj.className = obj.className.replace(name, "");
	},
	update: function()
	{
		if (Competir.Web.UI.Webparts.ComponentList.isInstanceOfType(this) | Competir.Web.UI.Webparts.ContentViewer.isInstanceOfType(this))
		{
			this.renderContent();
		}
		var controls = this.getChildControls();
		for (var i = 0; i < controls.length; i++)
		{
			controls[i].update();
		}
	},
	mergeXsltParameters: function(cps)
	{
		if (!this.get_XsltParameters())
		{
			this.set_XsltParameters(cps);
		}
		for (var i = 0; i < cps.get_Count(); i++)
		{
			var cp = cps.getItem(i);
			if (this.get_XsltParameters().indexOfName(cp.get_Section(), cp.get_Name()) == -1)
			{
				this.get_XsltParameters().add(cp);
			}
			else
			{
				this.get_XsltParameters().getItemByName(cp.get_Section(), cp.get_Name()).set_Value(cp.get_Value());
			}
		}
	},

	// properties
	get_UniqueID: function()
	{
		return this._UniqueID;
	},
	set_UniqueID: function(value)
	{
		if (this._UniqueID !== value)
		{
			this._UniqueID = value;
			this.raisePropertyChanged("UniqueID");
		}
	},
	get_ClientID: function()
	{
		return this._ClientID;
	},
	set_ClientID: function(value)
	{
		if (this._ClientID !== value)
		{
			this._ClientID = value;
			this.raisePropertyChanged("ClientID");
		}
	},
	get_ClientIDSeparator: function()
	{
		return this._ClientIDSeparator;
	},
	set_ClientIDSeparator: function(value)
	{
		if (this._ClientIDSeparator !== value)
		{
			this._ClientIDSeparator = value;
			this.raisePropertyChanged("ClientIDSeparator");
		}
	},
	get_ClientVisible: function()
	{
		return this._ClientVisible;
	},
	set_ClientVisible: function(value)
	{
		if (this._ClientVisible !== value)
		{
			this._ClientVisible = value;
			this.raisePropertyChanged("ClientVisible");
		}
	},
	get_ScriptFolder: function()
	{
		return this._ScriptFolder;
	},
	set_ScriptFolder: function(value)
	{
		if (this._ScriptFolder !== value)
		{
			this._ScriptFolder = value;
			this.raisePropertyChanged("ScriptFolder");
		}
	},
	get_ScriptFolderUri: function()
	{
		return this._ScriptFolderUri;
	},
	set_ScriptFolderUri: function(value)
	{
		if (this._ScriptFolderUri !== value)
		{
			this._ScriptFolderUri = value;
			this.raisePropertyChanged("ScriptFolderUri");
		}
	},
	get_XsltFolder: function()
	{
		return this._XsltFolder;
	},
	set_XsltFolder: function(value)
	{
		if (this._XsltFolder !== value)
		{
			this._XsltFolder = value;
			this.raisePropertyChanged("XsltFolder");
		}
	},
	get_XsltFile: function()
	{
		return this._XsltFile;
	},
	set_XsltFile: function(value)
	{
		if (this._XsltFile !== value)
		{
			this._XsltFile = value;
			this.raisePropertyChanged("XsltFile");
		}
	},
	get_XsltFileUri: function()
	{
		return this._XsltFileUri;
	},
	set_XsltFileUri: function(value)
	{
		if (this._XsltFileUri !== value)
		{
			this._XsltFileUri = value;
			this.raisePropertyChanged("XsltFileUri");
		}
	},
	get_XsltParameters: function()
	{
		return this._XsltParameters;
	},
	set_XsltParameters: function(value)
	{
		if (Competir.MiEmpresa.CustomProperties.isInstanceOfType(value))
		{
			if (this._User !== value)
			{
				this._XsltParameters = value;
				this.raisePropertyChanged("XsltParameters");
			}
		}
		else
		{
			this._XsltParameters = new Competir.MiEmpresa.CustomProperties(value);
			this.raisePropertyChanged("XsltParameters");
		}
	},
	get_Width: function()
	{
		return this._Width;
	},
	set_Width: function(value)
	{
		if (this._Width !== value)
		{
			this._Width = value;
			this.raisePropertyChanged("Width");
		}
	},
	get_Height: function()
	{
		return this._Height;
	},
	set_Height: function(value)
	{
		if (this._Height !== value)
		{
			this._Height = value;
			this.raisePropertyChanged("Height");
		}
	},
	get_StandAloneWebpart: function()
	{
		return this._StandAloneWebpart;
	},
	set_StandAloneWebpart: function(value)
	{
		if (this._StandAloneWebpart !== value)
		{
			this._StandAloneWebpart = value;
			this.raisePropertyChanged("StandAloneWebpart");
		}
	},
	get_AKInstanciaWebpart: function()
	{
		return this._AKInstanciaWebpart;
	},
	set_AKInstanciaWebpart: function(value)
	{
		if (this._AKInstanciaWebpart !== value)
		{
			this._AKInstanciaWebpart = value;
			this.raisePropertyChanged("AKInstanciaWebpart");
		}
	},
	get_GUIDInstanciaWebpart: function()
	{
		return this._GUIDInstanciaWebpart;
	},
	set_GUIDInstanciaWebpart: function(value)
	{
		if (this._GUIDInstanciaWebpart !== value)
		{
			this._GUIDInstanciaWebpart = value;
			this.raisePropertyChanged("GUIDInstanciaWebpart");
		}
	},
	get_ContentsContainerClientID: function()
	{
		return this._ContentsContainerClientID;
	},
	set_ContentsContainerClientID: function(value)
	{
		if (this._ContentsContainerClientID !== value)
		{
			this._ContentsContainerClientID = value;
			this.raisePropertyChanged("ContentsContainerClientID");
		}
	},
	get_ProgressIndicatorClientID: function()
	{
		return this._ProgressIndicatorClientID;
	},
	set_ProgressIndicatorClientID: function(value)
	{
		if (this._ProgressIndicatorClientID !== value)
		{
			this._ProgressIndicatorClientID = value;
			this.raisePropertyChanged("ProgressIndicatorClientID");
		}
	},
	get_Properties: function()
	{
		return this._Properties;
	},
	set_Properties: function(value)
	{
		if (this._Properties !== value)
		{
			this._Properties = new Competir.MiEmpresa.CustomProperties(value);
			this.raisePropertyChanged("Properties");
		}
	},
	get_EnableAjax: function()
	{
		return this._EnableAjax;
	},
	set_EnableAjax: function(value)
	{
		if (this._EnableAjax !== value)
		{
			this._EnableAjax = value;
			this.raisePropertyChanged("EnableAjax");
		}
	},
	get_RegisterClientControl: function()
	{
		return this._RegisterClientControl;
	},
	set_RegisterClientControl: function(value)
	{
		if (this._RegisterClientControl !== value)
		{
			this._RegisterClientControl = value;
			this.raisePropertyChanged("RegisterClientControl");
		}
	},
	get_ParentBaseWebpartControl: function()
	{
		return this._ParentBaseWebpartControl;
	},
	set_ParentBaseWebpartControl: function(value)
	{
		if (this._ParentBaseWebpartControl !== value)
		{
			this._ParentBaseWebpartControl = value;
			this.raisePropertyChanged("ParentBaseWebpartControl");
		}
	},
	get_UseCache: function()
	{
		return this._UseCache;
	},
	set_UseCache: function(value)
	{
		if (this._UseCache !== value)
		{
			this._UseCache = value;
			this.raisePropertyChanged("UseCache");
		}
	},
	get_CacheExpirationTimeSpan: function()
	{
		return this._CacheExpirationTimeSpan;
	},
	set_CacheExpirationTimeSpan: function(value)
	{
		if (this._CacheExpirationTimeSpan !== value)
		{
			this._CacheExpirationTimeSpan = value;
			this.raisePropertyChanged("CacheExpirationTimeSpan");
		}
	},

	// events
	add_onShow: function(handler)
	{
		this.get_events().addHandler("onShow", handler);
	},
	remove_onShow: function(handler)
	{
		this.get_events().removeHandler("onShow", handler);
	},
	add_onHide: function(handler)
	{
		this.get_events().addHandler("onHide", handler);
	},
	remove_onHide: function(handler)
	{
		this.get_events().removeHandler("onHide", handler);
	},
	add_onOperationStarted: function(handler)
	{
		this.get_events().addHandler("onOperationStarted", handler);
	},
	remove_onOperationStarted: function(handler)
	{
		this.get_events().removeHandler("onOperationStarted", handler);
	},
	add_onOperationSucceeded: function(handler)
	{
		this.get_events().addHandler("onOperationSucceeded", handler);
	},
	remove_onOperationSucceeded: function(handler)
	{
		this.get_events().removeHandler("onOperationSucceeded", handler);
	},
	add_onOperationFailed: function(handler)
	{
		this.get_events().addHandler("onOperationFailed", handler);
	},
	remove_onOperationFailed: function(handler)
	{
		this.get_events().removeHandler("onOperationFailed", handler);
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
	},
	_onPropertyChanged: function(p)
	{
	},
	_onOperationStarted: function(sender, args)
	{
		this.raiseEvent("onOperationStarted", sender);
	},
	_onOperationSucceeded: function(sender, args)
	{
		this.raiseEvent("onOperationSucceeded", sender);
	},
	_onOperationFailed: function(sender, args)
	{
		this.raiseEvent("onOperationFailed", sender);
	}
};

// static methods
Competir.Web.UI.Webparts.BaseWebpartControl.getCurrent = function(typeName)
{
	var rv = null;
	var c = Sys.Application.getComponents();
	for (var i = 0; i < c.length; i++)
	{
		if (Object.getType(c[i]).getName() == "Competir.Web.UI.Webparts." + typeName)
		{
			rv = c[i];
		}
	}
	return rv;
};

// registration
Competir.Web.UI.Webparts.BaseWebpartControl.registerClass("Competir.Web.UI.Webparts.BaseWebpartControl", Sys.UI.Control);
// ************************************************************************************
// Context
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.Context = function(element)
{
	Competir.MiEmpresa.Context.initializeBase(this, [element]);
	this._onApplicationLoadDelegate = Function.createDelegate(this, this._onApplicationLoad);
	this._onDocumentReadyStateChangeDelegate = Function.createDelegate(this, this._onDocumentReadyStateChange);
	this._onPageBeforeUnloadDelegate = Function.createDelegate(this, this._onPageBeforeUnload);
	this._FKInstancia = "";
	this._AKInstancia = "";
	this._GUID = "";
	this._Name = "";
	this._Locale = "";
	this._ExecutionQueue = new Competir.MiEmpresa.ExecutionQueue(3);
	this._ExecutionQueueNoOpTimeoutMS = 0;
	this._User = new Competir.MiEmpresa.Security.User();
};

// prototype
Competir.MiEmpresa.Context.prototype =
{
	// methods
	initialize: function()
	{
		Sys.Application.add_load(this._onApplicationLoadDelegate);
		if (window.addEventListener)
		{
			window.addEventListener("beforeunload", this._onPageBeforeUnloadDelegate, false);
		}
		else if (document.addEventListener)
		{
			document.addEventListener('beforeunload', this._onPageBeforeUnloadDelegate, false);
		}
		Competir.MiEmpresa.Context.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		Sys.Application.remove_load(this._onApplicationLoadDelegate);
		Competir.MiEmpresa.Context.callBaseMethod(this, "dispose");
	},
	raiseEvent: function(id, args)
	{
		var events = this.get_events();
		if (events)
		{
			var f = events.getHandler(id);
			if (f)
			{
				f(this, args);
			}
		}
	},

	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_Name: function()
	{
		return this._Name;
	},
	set_Name: function(value)
	{
		if (this._Name !== value)
		{
			this._Name = value;
			this.raisePropertyChanged("Name");
		}
	},
	get_Locale: function()
	{
		return this._Locale;
	},
	set_Locale: function(value)
	{
		if (this._Locale !== value)
		{
			this._Locale = value;
			this.raisePropertyChanged("Locale");
		}
	},
	get_GUID: function()
	{
		return this._GUID;
	},
	set_GUID: function(value)
	{
		if (this._GUID !== value)
		{
			this._GUID = value;
			this.raisePropertyChanged("GUID");
		}
	},
	get_User: function()
	{
		return this._User;
	},
	set_User: function(value)
	{
		if (!Competir.MiEmpresa.Security.User.isInstanceOfType(value))
		{
			value = new Competir.MiEmpresa.Security.User(value);
		}
		if (this._User !== value)
		{
			this._User = value;
			this.raisePropertyChanged("User");
			this.raiseEvent("onUserChange", Sys.EventArgs.Empty);
		}
	},
	get_ExecutionQueue: function()
	{
		return this._ExecutionQueue;
	},
	set_ExecutionQueue: function(value)
	{
		if (this._ExecutionQueue !== value)
		{
			this._ExecutionQueue = value;
			this.raisePropertyChanged("ExecutionQueue");
		}
	},
	get_ExecutionQueueNoOpTimeoutMS: function()
	{
		return this._ExecutionQueueNoOpTimeoutMS;
	},
	set_ExecutionQueueNoOpTimeoutMS: function(value)
	{
		if (this._ExecutionQueueNoOpTimeoutMS !== value)
		{
			this._ExecutionQueueNoOpTimeoutMS = value;
			this.raisePropertyChanged("ExecutionQueueNoOpTimeoutMS");
		}
	},

	// events
	add_onUserChange: function(handler)
	{
		this.get_events().addHandler("onUserChange", handler);
	},
	remove_onUserChange: function(handler)
	{
		this.get_events().removeHandler("onUserChange", handler);
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (document.readyState && document.readyState != "complete")
		{
			document.attachEvent("onreadystatechange", this._onDocumentReadyStateChangeDelegate);
		}
		else
		{
			var eq = this.get_ExecutionQueue();
			if (eq)
			{
				eq.set_NoOpTimeoutMS(this.get_ExecutionQueueNoOpTimeoutMS());
				eq.start();
			}
		}
	},
	_onDocumentReadyStateChange: function()
	{
		if (document.readyState == "complete")
		{
			document.detachEvent("onreadystatechange", this._onDocumentReadyStateChangeDelegate);
			var eq = this.get_ExecutionQueue();
			if (eq)
			{
				eq.set_NoOpTimeoutMS(this.get_ExecutionQueueNoOpTimeoutMS());
				eq.start();
			}
		}
	},
	_onPageBeforeUnload: function()
	{
		var eq = this.get_ExecutionQueue();
		if (eq)
		{
			eq.stop();
		}
	}
};

// static methods
Competir.MiEmpresa.Context.getCurrent = function()
{
	var rv = null;
	var c = Sys.Application.getComponents();
	for (var i = 0; i < c.length; i++)
	{
		if (Object.getType(c[i]).getName() == "Competir.MiEmpresa.Context")
		{
			rv = c[i];
		}
	}
	return rv;
};

// registration
Competir.MiEmpresa.Context.registerClass("Competir.MiEmpresa.Context", Sys.UI.Control);
// ************************************************************************************
// CurrentUserBox
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.CurrentUserBox = function(element)
{
	Competir.Web.UI.Webparts.CurrentUserBox.initializeBase(this, [element]);
	this._onUserChangeDelegate = Function.createDelegate(this, this._onUserChange);
	this._Mode = "Normal";
	this._ReturnUrl = "";
	this._ForceRemember = false;
	this._FillLicenses = false;
	this._FillOUs = false;
	this._FillRelatedUsers = false;
	this._FillTemplates = false;
	this._FillTemplateContents = false;
	this._TxtUsernameClientID = "";
	this._TxtPasswordClientID = "";
	this._ChkRememberClientID = "";
	this._TxtLicenseCodeClientID = "";
	this._User = new Competir.MiEmpresa.Security.User();
};

// prototype
Competir.Web.UI.Webparts.CurrentUserBox.prototype =
{
	// methods
	initialize: function()
	{
		var objContext = Competir.MiEmpresa.Context.getCurrent();
		if (objContext)
		{
			objContext.add_onUserChange(this._onUserChangeDelegate);
		}
		Competir.Web.UI.Webparts.CurrentUserBox.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		var objContext = Competir.MiEmpresa.Context.getCurrent();
		if (objContext)
		{
			objContext.remove_onUserChange(this._onUserChangeDelegate);
		}
		Competir.Web.UI.Webparts.CurrentUserBox.callBaseMethod(this, "dispose");
	},
	login: function()
	{
		var username = "";
		var objTxtUsername = this.getChild(this.get_TxtUsernameClientID());
		if (objTxtUsername)
		{
			username = objTxtUsername.value;
		}
		if (username == "")
		{
			this.raiseError("username.empty");
		}
		var password = "";
		var objTxtPassword = this.getChild(this.get_TxtPasswordClientID());
		if (objTxtPassword)
		{
			password = objTxtPassword.value;
		}
		if (password == "")
		{
			this.raiseError("password.empty");
		}
		if (username != "" && password != "")
		{
			var o;
			var objSelector = this.getByMode("Selector");
			if (objSelector)
			{
				o = new Competir.MiEmpresa.Operation("user.validate");
				o.addParameter("FillLicenses", true);
				o.addParameter("FillRelatedUsers", true);
			}
			else
			{
				o = new Competir.MiEmpresa.Operation("user.login");
				o.addParameter("ForceRemember", this.get_ForceRemember());
				o.addParameter("FillLicenses", this.get_FillLicenses());
				o.addParameter("FillOUs", this.get_FillOUs());
				o.addParameter("FillRelatedUsers", this.get_FillRelatedUsers());
				o.addParameter("FillTemplates", this.get_FillTemplates());
				o.addParameter("FillTemplateContents", this.get_FillTemplateContents());
			}
			o.addParameter("Username", username);
			o.addParameter("Password", password);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},
	logout: function()
	{
		var o = new Competir.MiEmpresa.Operation("user.logout");
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	select: function(FKInstancia)
	{
		if (FKInstancia)
		{
			var o = new Competir.MiEmpresa.Operation("user.login");
			o.addParameter("FKInstancia", FKInstancia);
			o.addParameter("ForceRemember", this.get_ForceRemember());
			o.addParameter("FillLicenses", this.get_FillLicenses());
			o.addParameter("FillOUs", this.get_FillOUs());
			o.addParameter("FillRelatedUsers", this.get_FillRelatedUsers());
			o.addParameter("FillTemplates", this.get_FillTemplates());
			o.addParameter("FillTemplateContents", this.get_FillTemplateContents());
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},
	validate: function(code)
	{
		if (!code)
		{
			code = this.getLicenseCode();
		}
		if (code)
		{
			var o = new Competir.MiEmpresa.Operation("license.validate");
			o.addParameter("Code", code);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},
	exchange: function(code, includeRelatedUsers)
	{
		if (!code)
		{
			code = this.getLicenseCode();
		}
		if (code)
		{
			var o = new Competir.MiEmpresa.Operation("license.exchange");
			o.addParameter("Code", code);
			o.addParameter("IncludeRelatedUsers", includeRelatedUsers);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},
	getByMode: function(mode)
	{
		var rv = null;
		if (this.get_Mode() == mode)
		{
			rv = this;
		}
		else
		{
			rv = Competir.Web.UI.Webparts.CurrentUserBox.getByMode(mode);
		}
		return rv;
	},
	getLicenseCode: function()
	{
		var rv = "";
		if (this.get_TxtLicenseCodeClientID() != "")
		{
			rv = Competir.Web.UI.getFormElementValue(this, this.get_TxtLicenseCodeClientID(), "text");
		}
		return rv;
	},
	renderContent: function(contentMode)
	{
		// clear
		if (contentMode)
		{
			var objContainer = this.getContentsContainer();
			if (objContainer)
			{
				Competir.Web.UI.setInnerHTML(objContainer, "");
			}
		}
		else
		{
			contentMode = "";
		}

		// render
		var o = new Competir.MiEmpresa.Operation("currentuserbox.content.render");
		o.addParameter("ID", this.get_id());
		if (this.get_User().get_FKInstancia() != 0)
		{
			o.addParameter("FKInstancia", this.get_User().get_FKInstancia());
		}
		o.addParameter("FillLicenses", this.get_FillLicenses());
		o.addParameter("FillOUs", this.get_FillOUs());
		o.addParameter("FillRelatedUsers", this.get_FillRelatedUsers());
		o.addParameter("FillTemplates", this.get_FillTemplates());
		o.addParameter("FillTemplateContents", this.get_FillTemplateContents());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		if (this.get_XsltParameters().indexOfName("xslt", "ContentMode") != -1)
		{
			this.get_XsltParameters().getItemByName("xslt", "ContentMode").set_Value(contentMode);
		}
		else
		{
			this.get_XsltParameters().addNew("xslt", "ContentMode", contentMode);
		}
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	raiseError: function(error)
	{
		throw Error.notImplemented("CurrentUserBox.raiseError no se ha implementado en la aplicación.");
	},

	// properties
	get_Mode: function()
	{
		return this._Mode;
	},
	set_Mode: function(value)
	{
		if (this._Mode !== value)
		{
			this._Mode = value;
			this.raisePropertyChanged("Mode");
		}
	},
	get_ReturnUrl: function()
	{
		return this._ReturnUrl;
	},
	set_ReturnUrl: function(value)
	{
		if (this._ReturnUrl !== value)
		{
			this._ReturnUrl = value;
			this.raisePropertyChanged("ReturnUrl");
		}
	},
	get_ForceRemember: function()
	{
		return this._ForceRemember;
	},
	set_ForceRemember: function(value)
	{
		if (this._ForceRemember !== value)
		{
			this._ForceRemember = value;
			this.raisePropertyChanged("ForceRemember");
		}
	},
	get_FillLicenses: function()
	{
		return this._FillLicenses;
	},
	set_FillLicenses: function(value)
	{
		if (this._FillLicenses !== value)
		{
			this._FillLicenses = value;
			this.raisePropertyChanged("FillLicenses");
		}
	},
	get_FillOUs: function()
	{
		return this._FillOUs;
	},
	set_FillOUs: function(value)
	{
		if (this._FillOUs !== value)
		{
			this._FillOUs = value;
			this.raisePropertyChanged("FillOUs");
		}
	},
	get_FillRelatedUsers: function()
	{
		return this._FillRelatedUsers;
	},
	set_FillRelatedUsers: function(value)
	{
		if (this._FillRelatedUsers !== value)
		{
			this._FillRelatedUsers = value;
			this.raisePropertyChanged("FillRelatedUsers");
		}
	},
	get_FillTemplates: function()
	{
		return this._FillTemplates;
	},
	set_FillTemplates: function(value)
	{
		if (this._FillTemplates !== value)
		{
			this._FillTemplates = value;
			this.raisePropertyChanged("FillTemplates");
		}
	},
	get_FillTemplateContents: function()
	{
		return this._FillTemplateContents;
	},
	set_FillTemplateContents: function(value)
	{
		if (this._FillTemplateContents !== value)
		{
			this._FillTemplateContents = value;
			this.raisePropertyChanged("FillTemplateContents");
		}
	},
	get_TxtUsernameClientID: function()
	{
		return this._TxtUsernameClientID;
	},
	set_TxtUsernameClientID: function(value)
	{
		if (this._TxtUsernameClientID !== value)
		{
			this._TxtUsernameClientID = value;
			this.raisePropertyChanged("TxtUsernameClientID");
		}
	},
	get_TxtPasswordClientID: function()
	{
		return this._TxtPasswordClientID;
	},
	set_TxtPasswordClientID: function(value)
	{
		if (this._TxtPasswordClientID !== value)
		{
			this._TxtPasswordClientID = value;
			this.raisePropertyChanged("TxtPasswordClientID");
		}
	},
	get_ChkRememberClientID: function()
	{
		return this._ChkRememberClientID;
	},
	set_ChkRememberClientID: function(value)
	{
		if (this._ChkRememberClientID !== value)
		{
			this._ChkRememberClientID = value;
			this.raisePropertyChanged("ChkRememberClientID");
		}
	},
	get_TxtLicenseCodeClientID: function()
	{
		return this._TxtLicenseCodeClientID;
	},
	set_TxtLicenseCodeClientID: function(value)
	{
		if (this._TxtLicenseCodeClientID !== value)
		{
			this._TxtLicenseCodeClientID = value;
			this.raisePropertyChanged("TxtLicenseCodeClientID");
		}
	},
	get_User: function()
	{
		return this._User;
	},
	set_User: function(value)
	{
		if (!Competir.MiEmpresa.Security.User.isInstanceOfType(value))
		{
			value = new Competir.MiEmpresa.Security.User(value);
		}
		if (this._User !== value)
		{
			this._User = value;
			this.raisePropertyChanged("User");
			if (this.get_isInitialized())
			{
				this.renderContent();
			}
		}
	},

	// event delegates
	_onUserChange: function()
	{
		var objContext = Competir.MiEmpresa.Context.getCurrent();
		if (objContext)
		{
			this.set_User(objContext.get_User());
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("CurrentUserBox._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("CurrentUserBox._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("CurrentUserBox._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// static methods
Competir.Web.UI.Webparts.CurrentUserBox.getByMode = function(mode)
{
	var rv = null;
	var cubs = Competir.Web.UI.Webparts.CurrentUserBox.getAll();
	for (var i = 0; i < cubs.length; i++)
	{
		if (cubs[i].get_Mode() == mode)
		{
			rv = cubs[i];
			break;
		}
	}
	return rv;
};
Competir.Web.UI.Webparts.CurrentUserBox.getCurrent = function()
{
	var rv = null;
	var cubs = Sys.Application.getComponents();
	for (var i = 0; i < cubs.length; i++)
	{
		if (Object.getType(cubs[i]).getName() == "Competir.Web.UI.Webparts.CurrentUserBox")
		{
			rv = cubs[i];
		}
	}
	return rv;
};
Competir.Web.UI.Webparts.CurrentUserBox.getAll = function()
{
	var rv = new Array();
	var cubs = Sys.Application.getComponents();
	for (var i = 0; i < cubs.length; i++)
	{
		if (Object.getType(cubs[i]).getName() == "Competir.Web.UI.Webparts.CurrentUserBox")
		{
			rv.push(cubs[i]);
		}
	}
	return rv;
};

// registration
Competir.Web.UI.Webparts.CurrentUserBox.registerClass("Competir.Web.UI.Webparts.CurrentUserBox", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// SearchBox
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.SearchBox = function(element)
{
	Competir.Web.UI.Webparts.SearchBox.initializeBase(this, [element]);
	this._HelpExpression = "";
	this._SearchPageUrl = "";
	this._Expression = "";
	this._AKClases = "";
	this._ParentFKs = "";
	this._IncludeSolutionTaxonomies = true;
	this._TxtExpressionClientID = "";
	this._SearchEngineClientID = "";
	this._SearchEngine = "internal";
};

// prototype
Competir.Web.UI.Webparts.SearchBox.prototype =
{
	// methods
	isValid: function()
	{
		throw Error.notImplemented("SearchBox.isValid no se ha implementado en la aplicación.");
	},
	search: function()
	{
		throw Error.notImplemented("SearchBox.search no se ha implementado en la aplicación.");
	},

	// properties
	get_HelpExpression: function()
	{
		return this._HelpExpression;
	},
	set_HelpExpression: function(value)
	{
		if (this._HelpExpression !== value)
		{
			this._HelpExpression = value;
			this.raisePropertyChanged("HelpExpression");
		}
	},
	get_SearchPageUrl: function()
	{
		return this._SearchPageUrl;
	},
	set_SearchPageUrl: function(value)
	{
		if (this._SearchPageUrl !== value)
		{
			this._SearchPageUrl = value;
			this.raisePropertyChanged("SearchPageUrl");
		}
	},
	get_Expression: function()
	{
		return this._Expression;
	},
	set_Expression: function(value)
	{
		if (this._Expression !== value)
		{
			this._Expression = value;
			this.raisePropertyChanged("Expression");
		}
	},
	get_AKClases: function()
	{
		return this._AKClases;
	},
	set_AKClases: function(value)
	{
		if (this._AKClases !== value)
		{
			this._AKClases = value;
			this.raisePropertyChanged("AKClases");
		}
	},
	get_ParentFKs: function()
	{
		return this._ParentFKs;
	},
	set_ParentFKs: function(value)
	{
		if (this._ParentFKs !== value)
		{
			this._ParentFKs = value;
			this.raisePropertyChanged("ParentFKs");
		}
	},
	get_IncludeSolutionTaxonomies: function()
	{
		return this._IncludeSolutionTaxonomies;
	},
	set_IncludeSolutionTaxonomies: function(value)
	{
		if (this._IncludeSolutionTaxonomies !== value)
		{
			this._IncludeSolutionTaxonomies = value;
			this.raisePropertyChanged("IncludeSolutionTaxonomies");
		}
	},
	get_TxtExpressionClientID: function()
	{
		return this._TxtExpressionClientID;
	},
	set_TxtExpressionClientID: function(value)
	{
		if (this._TxtExpressionClientID !== value)
		{
			this._TxtExpressionClientID = value;
			this.raisePropertyChanged("TxtExpressionClientID");
		}
	},
	get_SearchEngineClientID: function()
	{
		return this._SearchEngineClientID;
	},
	set_SearchEngineClientID: function(value)
	{
		if (this._SearchEngineClientID !== value)
		{
			this._SearchEngineClientID = value;
			this.raisePropertyChanged("SearchEngineClientID");
		}
	},
	get_SearchEngine: function()
	{
		return this._SearchEngine;
	},
	set_SearchEngine: function(value)
	{
		if (this._SearchEngine !== value)
		{
			this._SearchEngine = value;
			this.raisePropertyChanged("SearchEngine");
		}
	},

	// events
	add_onClientSearch: function(handler)
	{
		this.get_events().addHandler("onClientSearch", handler);
	},
	remove_onClientSearch: function(handler)
	{
		this.get_events().removeHandler("onClientSearch", handler);
	},

	// event delegates
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("SearchBox._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("SearchBox._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("SearchBox._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.SearchBox.registerClass("Competir.Web.UI.Webparts.SearchBox", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// EventsViewer
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.EventsViewer = function(element)
{
	Competir.Web.UI.Webparts.EventsViewer.initializeBase(this, [element]);
	this._FKInstanciaUsuarios = "";
	this._FKInstanciaObjetos = "";
	this._AKInstanciaEventos = "";
	this._SortField = "EventDateDesc";
	this._WithObjectData = true;
	this._Entries = 10;
	this._MinDate = "";
	this._MaxDate = "";
	this._DistinctField = "None";
	this._AKClases = "";
	this._ParentFKs = "";
};

// prototype
Competir.Web.UI.Webparts.EventsViewer.prototype =
{
	// methods
	renderContent: function()
	{
		var o = new Competir.MiEmpresa.Operation("eventsviewer.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
		o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
		o.addParameter("FKInstanciaUsuarios", this.get_FKInstanciaUsuarios());
		o.addParameter("FKInstanciaObjetos", this.get_FKInstanciaObjetos());
		o.addParameter("AKInstanciaEventos", this.get_AKInstanciaEventos());
		o.addParameter("SortField", this.get_SortField());
		o.addParameter("Entries", this.get_Entries());
		o.addParameter("MinDate", this.get_MinDate);
		o.addParameter("MaxDate", this.get_MaxDate());
		o.addParameter("DistinctField", this.get_DistinctField());
		o.addParameter("AKClases", this.get_AKClases());
		o.addParameter("ParentFKs", this.get_ParentFKs());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},

	// properties
	get_FKInstanciaUsuarios: function()
	{
		return this._FKInstanciaUsuarios;
	},
	set_FKInstanciaUsuarios: function(value)
	{
		if (this._FKInstanciaUsuarios !== value)
		{
			this._FKInstanciaUsuarios = value;
			this.raisePropertyChanged("FKInstanciaUsuarios");
		}
	},
	get_FKInstanciaObjetos: function()
	{
		return this._FKInstanciaObjetos;
	},
	set_FKInstanciaObjetos: function(value)
	{
		if (this._FKInstanciaObjetos !== value)
		{
			this._FKInstanciaObjetos = value;
			this.raisePropertyChanged("FKInstanciaObjetos");
		}
	},
	get_AKInstanciaEventos: function()
	{
		return this._AKInstanciaEventos;
	},
	set_AKInstanciaEventos: function(value)
	{
		if (this._AKInstanciaEventos !== value)
		{
			this._AKInstanciaEventos = value;
			this.raisePropertyChanged("AKInstanciaEventos");
		}
	},
	get_SortField: function()
	{
		return this._SortField;
	},
	set_SortField: function(value)
	{
		if (this._SortField !== value)
		{
			this._SortField = value;
			this.raisePropertyChanged("SortField");
		}
	},
	get_WithObjectData: function()
	{
		return this._WithObjectData;
	},
	set_WithObjectData: function(value)
	{
		if (this._WithObjectData !== value)
		{
			this._WithObjectData = value;
			this.raisePropertyChanged("WithObjectData");
		}
	},
	get_Entries: function()
	{
		return this._Entries;
	},
	set_Entries: function(value)
	{
		if (this._Entries !== value)
		{
			this._Entries = value;
			this.raisePropertyChanged("Entries");
		}
	},
	get_MinDate: function()
	{
		return this._MinDate;
	},
	set_MinDate: function(value)
	{
		if (this._MinDate !== value)
		{
			this._MinDate = value;
			this.raisePropertyChanged("MinDate");
		}
	},
	get_MaxDate: function()
	{
		return this._MaxDate;
	},
	set_MaxDate: function(value)
	{
		if (this._MaxDate !== value)
		{
			this._MaxDate = value;
			this.raisePropertyChanged("MaxDate");
		}
	},
	get_DistinctField: function()
	{
		return this._DistinctField;
	},
	set_DistinctField: function(value)
	{
		if (this._DistinctField !== value)
		{
			this._DistinctField = value;
			this.raisePropertyChanged("DistinctField");
		}
	},
	get_AKClases: function()
	{
		return this._AKClases;
	},
	set_AKClases: function(value)
	{
		if (this._AKClases !== value)
		{
			this._AKClases = value;
			this.raisePropertyChanged("AKClases");
		}
	},
	get_ParentFKs: function()
	{
		return this._ParentFKs;
	},
	set_ParentFKs: function(value)
	{
		if (this._ParentFKs !== value)
		{
			this._ParentFKs = value;
			this.raisePropertyChanged("ParentFKs");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("EventsViewer._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("EventsViewer._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("EventsViewer._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.EventsViewer.registerClass("Competir.Web.UI.Webparts.EventsViewer", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// BaseChooserControl
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.BaseChooserControl = function(element)
{
	Competir.Web.UI.Webparts.BaseChooserControl.initializeBase(this, [element]);
	this._SelectedValue = null;
	this._SelectedAlternateValue = null;
};

// prototype
Competir.Web.UI.Webparts.BaseChooserControl.prototype =
{
	// methods
	select: function(value, alternateValue)
	{
		this.set_SelectedAlternateValue(alternateValue);
		this.set_SelectedValue(value);
	},

	// properties
	get_SelectedValue: function()
	{
		return this._SelectedValue;
	},
	set_SelectedValue: function(value)
	{
		if (this._SelectedValue !== value)
		{
			this._SelectedValue = value;
			this.raisePropertyChanged("SelectedValue");
			if (this.get_isInitialized())
			{
				this.raiseEvent("onClientChange", Sys.EventArgs.Empty);
			}
		}
	},
	get_SelectedAlternateValue: function()
	{
		return this._SelectedAlternateValue;
	},
	set_SelectedAlternateValue: function(value)
	{
		if (this._SelectedAlternateValue !== value)
		{
			this._SelectedAlternateValue = value;
			this.raisePropertyChanged("SelectedAlternateValue");
		}
	},

	// events
	add_onClientChange: function(handler)
	{
		this.get_events().addHandler("onClientChange", handler);
	},
	remove_onClientChange: function(handler)
	{
		this.get_events().removeHandler("onClientChange", handler);
	},

	// event delegates
	/*
	_onApplicationLoad: function(o)
	{
	if (this.get_SelectedValue())
	{
	this.raiseEvent("onClientChange", Sys.EventArgs.Empty);
	}
	},
	*/
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("BaseChooserControl._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("BaseChooserControl._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("BaseChooserControl._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.BaseChooserControl.registerClass("Competir.Web.UI.Webparts.BaseChooserControl", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// BasePaginatorControl
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.BasePaginatorControl = function(element)
{
	Competir.Web.UI.Webparts.BasePaginatorControl.initializeBase(this, [element]);
	this._Paginate = false;
	this._ActualPage = 0;
	this._PageLength = 0;
	this._PageSetLength = 0;
	this._PaginateXpression = "ROOT/Class";
	this._SortHelperXpression = "";
	this._SortHelperDataType = "String";
	this._SortHelperOrder = "Ascending";
	this._MaxPageCache = 0;
};

// prototype
Competir.Web.UI.Webparts.BasePaginatorControl.prototype =
{
	// methods
	renderContent: function()
	{
		this.changePageIndex(0);
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
	},

	// properties
	get_Paginate: function()
	{
		return this._Paginate;
	},
	set_Paginate: function(value)
	{
		if (this._Paginate !== value)
		{
			this._Paginate = value;
			this.raisePropertyChanged("Paginate");
		}
	},
	get_ActualPage: function()
	{
		return this._ActualPage;
	},
	set_ActualPage: function(value)
	{
		if (this._ActualPage !== value)
		{
			this._ActualPage = value;
			this.raisePropertyChanged("ActualPage");
		}
	},
	get_PageLength: function()
	{
		return this._PageLength;
	},
	set_PageLength: function(value)
	{
		if (this._PageLength !== value)
		{
			this._PageLength = value;
			this.raisePropertyChanged("PageLength");
		}
	},
	get_PageSetLength: function()
	{
		return this._PageSetLength;
	},
	set_PageSetLength: function(value)
	{
		if (this._PageSetLength !== value)
		{
			this._PageSetLength = value;
			this.raisePropertyChanged("PageSetLength");
		}
	},
	get_PaginateXpression: function()
	{
		return this._PaginateXpression;
	},
	set_PaginateXpression: function(value)
	{
		if (this._PaginateXpression !== value)
		{
			this._PaginateXpression = value;
			this.raisePropertyChanged("PaginateXpression");
		}
	},
	get_SortHelperXpression: function()
	{
		return this._SortHelperXpression;
	},
	set_SortHelperXpression: function(value)
	{
		if (this._SortHelperXpression !== value)
		{
			this._SortHelperXpression = value;
			this.raisePropertyChanged("SortHelperXpression");
		}
	},
	get_SortHelperDataType: function()
	{
		return this._SortHelperDataType;
	},
	set_SortHelperDataType: function(value)
	{
		if (this._SortHelperDataType !== value)
		{
			this._SortHelperDataType = value;
			this.raisePropertyChanged("SortHelperDataType");
		}
	},
	get_SortHelperOrder: function()
	{
		return this._SortHelperOrder;
	},
	set_SortHelperOrder: function(value)
	{
		if (this._SortHelperOrder !== value)
		{
			this._SortHelperOrder = value;
			this.raisePropertyChanged("SortHelperOrder");
		}
	},
	get_MaxPageCache: function()
	{
		return this._MaxPageCache;
	},
	set_MaxPageCache: function(value)
	{
		if (this._MaxPageCache !== value)
		{
			this._MaxPageCache = value;
			this.raisePropertyChanged("MaxPageCache");
		}
	}
};

// registration
Competir.Web.UI.Webparts.BasePaginatorControl.registerClass("Competir.Web.UI.Webparts.BasePaginatorControl", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// GoogleWidgetViewer
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.GoogleWidgetViewer = function(element)
{
	Competir.Web.UI.Webparts.GoogleWidgetViewer.initializeBase(this, [element]);
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._WithCommunityStats = false;
};

// prototype
Competir.Web.UI.Webparts.GoogleWidgetViewer.prototype =
{
	// methods
	renderContent: function()
	{
		if (this.get_FKInstancia() != 0 | this.get_AKInstancia() != "" | this.get_AKInstanciaWebpart() != "" | this.get_GUIDInstanciaWebpart() != "")
		{
			var o = new Competir.MiEmpresa.Operation("googlewidget.content.render");
			o.addParameter("ID", this.get_id());
			o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
			o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
			o.addParameter("FKInstancia", this.get_FKInstancia());
			o.addParameter("AKInstancia", this.get_AKInstancia());
			o.addParameter("WithCommunityStats", this.get_WithCommunityStats());
			o.addParameter("ScriptFolder", this.get_ScriptFolder());
			o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
			o.addParameter("XsltFolder", this.get_XsltFolder());
			o.addParameter("XsltFile", this.get_XsltFile());
			o.addParameter("XsltFileUri", this.get_XsltFileUri());
			o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},

	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_WithCommunityStats: function()
	{
		return this._WithCommunityStats;
	},
	set_WithCommunityStats: function(value)
	{
		if (this._WithCommunityStats !== value)
		{
			this._WithCommunityStats = value;
			this.raisePropertyChanged("WithCommunityStats");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("GoogleWidgetViewer._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("GoogleWidgetViewer._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("GoogleWidgetViewer._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.GoogleWidgetViewer.registerClass("Competir.Web.UI.Webparts.GoogleWidgetViewer", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// ContentViewer
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.ContentViewer = function(element)
{
	Competir.Web.UI.Webparts.ContentViewer.initializeBase(this, [element]);
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._WithCommunityStats = false;
	this._SearchTokenProperties = null;
};

// prototype
Competir.Web.UI.Webparts.ContentViewer.prototype =
{
	// methods
	renderContent: function()
	{
		if (this.get_FKInstancia() != 0 | this.get_AKInstancia() != "" | this.get_SearchTokenProperties() != null | this.get_AKInstanciaWebpart() != "" | this.get_GUIDInstanciaWebpart() != "")
		{
			var o = new Competir.MiEmpresa.Operation("contentviewer.content.render");
			o.addParameter("ID", this.get_id());
			o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
			o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
			o.addParameter("FKInstancia", this.get_FKInstancia());
			o.addParameter("AKInstancia", this.get_AKInstancia());
			o.addParameter("WithCommunityStats", this.get_WithCommunityStats());
			if (this.get_SearchTokenProperties())
			{
				o.addParameter("SearchTokenXml", this.get_SearchTokenProperties().toXml(), false);
			}
			o.addParameter("ScriptFolder", this.get_ScriptFolder());
			o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
			o.addParameter("XsltFolder", this.get_XsltFolder());
			o.addParameter("XsltFile", this.get_XsltFile());
			o.addParameter("XsltFileUri", this.get_XsltFileUri());
			o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},

	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_WithCommunityStats: function()
	{
		return this._WithCommunityStats;
	},
	set_WithCommunityStats: function(value)
	{
		if (this._WithCommunityStats !== value)
		{
			this._WithCommunityStats = value;
			this.raisePropertyChanged("WithCommunityStats");
		}
	},
	get_SearchTokenProperties: function()
	{
		return this._SearchTokenProperties;
	},
	set_SearchTokenProperties: function(value)
	{
		if (this._SearchTokenProperties !== value)
		{
			this._SearchTokenProperties = value;
			this.raisePropertyChanged("SearchTokenProperties");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		var cps = new Competir.MiEmpresa.CustomProperties(this.get_SearchTokenProperties());
		if (cps.get_Count() != 0)
		{
			this.set_SearchTokenProperties(cps);
		}
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("ContentViewer._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("ContentViewer._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("ContentViewer._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.ContentViewer.registerClass("Competir.Web.UI.Webparts.ContentViewer", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// TabManager
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.TabManager = function(element)
{
	Competir.Web.UI.Webparts.TabManager.initializeBase(this, [element]);
	this.onUserChangeDelegate = Function.createDelegate(this, this.onUserChange);
	this._Tabs = new Competir.MiEmpresa.Tabs();
	this._UrlReferrer = "";
};

// prototype
Competir.Web.UI.Webparts.TabManager.prototype =
{
	// methods
	initialize: function()
	{
		var ctx = Competir.MiEmpresa.Context.getCurrent();
		if (ctx)
		{
			ctx.add_onUserChange(this.onUserChangeDelegate);
		}
		Competir.Web.UI.Webparts.TabManager.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		var ctx = Competir.MiEmpresa.Context.getCurrent();
		if (ctx)
		{
			ctx.remove_onUserChange(this.onUserChangeDelegate);
		}
		Competir.Web.UI.Webparts.TabManager.callBaseMethod(this, "dispose");
	},
	inner_closeTab: function(name)
	{
		// tab
		var tab = this.get_Tabs().getItemByName(name);
		if (tab)
		{
			tab.set_Visible(false);
			tab.set_Active(false);
		}

		// operation
		var o = new Competir.MiEmpresa.Operation("tabs.close");
		o.addParameter("ID", this.get_id());
		o.addParameter("TabName", name);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},

	// properties
	get_Tabs: function()
	{
		return this._Tabs;
	},
	set_Tabs: function(value)
	{
		if (Competir.MiEmpresa.Tabs.isInstanceOfType(value))
		{
			if (this._Tabs !== value)
			{
				this._Tabs = value;
				this.raisePropertyChanged("Tabs");
			}
		}
		else
		{
			this._Tabs = new Competir.MiEmpresa.Tabs(value);
			this.raisePropertyChanged("Tabs");
		}
	},
	get_UrlReferrer: function()
	{
		return this._UrlReferrer;
	},
	set_UrlReferrer: function(value)
	{
		if (this._UrlReferrer !== value)
		{
			this._UrlReferrer = value;
			this.raisePropertyChanged("UrlReferrer");
		}
	},

	// events delegates
	onUserChange: function(sender, args)
	{
	}
};

// registration
Competir.Web.UI.Webparts.TabManager.registerClass("Competir.Web.UI.Webparts.TabManager", Competir.Web.UI.Webparts.BaseWebpartControl);



// ************************************************************************************
// Tab
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.Tab = function(generic)
{
	Competir.MiEmpresa.Tab.initializeBase(this);
	this._Active = false;
	this._ActiveUrl = "";
	this._Name = "";
	this._Title = "";
	this._Type = 0;
	this._Visible = false;
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.Tab.prototype =
{
	// methods
	parseGeneric: function(obj)
	{
		if (String.isInstanceOfType(obj))
		{
			obj = Sys.Serialization.JavaScriptSerializer.deserialize(obj);
		}
		this.set_Active(obj.Active);
		this.set_ActiveUrl(obj.ActiveUrl);
		this.set_Name(obj.Name);
		this.set_Title(obj.Title);
		this.set_Type(obj.Type);
		this.set_Visible(obj.Visible);
	},

	// properties
	get_Active: function()
	{
		return this._Active;
	},
	set_Active: function(value)
	{
		if (this._Active !== value)
		{
			this._Active = value;
			this.raisePropertyChanged("Active");
		}
	},
	get_ActiveUrl: function()
	{
		return this._ActiveUrl;
	},
	set_ActiveUrl: function(value)
	{
		if (this._ActiveUrl !== value)
		{
			this._ActiveUrl = value;
			this.raisePropertyChanged("ActiveUrl");
		}
	},
	get_Name: function()
	{
		return this._Name;
	},
	set_Name: function(value)
	{
		if (this._Name !== value)
		{
			this._Name = value;
			this.raisePropertyChanged("Name");
		}
	},
	get_Title: function()
	{
		return this._Title;
	},
	set_Title: function(value)
	{
		if (this._Title !== value)
		{
			this._Title = value;
			this.raisePropertyChanged("Title");
		}
	},
	get_Type: function()
	{
		return this._Type;
	},
	set_Type: function(value)
	{
		if (this._Type !== value)
		{
			this._Type = value;
			this.raisePropertyChanged("Type");
		}
	},
	get_Visible: function()
	{
		return this._Visible;
	},
	set_Visible: function(value)
	{
		if (this._Visible !== value)
		{
			this._Visible = value;
			this.raisePropertyChanged("Visible");
		}
	}
};

// registration
Competir.MiEmpresa.Tab.registerClass("Competir.MiEmpresa.Tab", Sys.Component);



// ************************************************************************************
// Tabs
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.MiEmpresa");

// constructor
Competir.MiEmpresa.Tabs = function(generic)
{
	Competir.MiEmpresa.Tabs.initializeBase(this);
	this._arr = new Array();
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.MiEmpresa.Tabs.prototype =
{
	// methods
	initialize: function()
	{
		Competir.MiEmpresa.Tabs.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		Competir.MiEmpresa.Tabs.callBaseMethod(this, "dispose");
	},
	add: function(obj)
	{
		this._arr.push(obj);
	},
	clear: function()
	{
		while (this._arr.length != 0)
		{
			this._arr.pop();
		}
	},
	remove: function(obj)
	{
		for (var i = 0; i < this._arr.count; i++)
		{
			if (this[i] == obj)
			{
				this._arr.removeAt(i);
			}
		}
	},
	indexOf: function(index)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i] == obj)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	indexOfName: function(name)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_Name() == name)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	indexOfActiveUrl: function(url)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_ActiveUrl() == url)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	getItem: function(index)
	{
		return this._arr[index];
	},
	getItemByName: function(name)
	{
		return this._arr[this.indexOfName(name)];
	},
	getActiveTab: function()
	{
		var rv = null;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_Active())
			{
				rv = this.getItem(i);
				break;
			}
		}
		return rv;
	},
	parseGeneric: function(obj)
	{
		this.clear();
		if (obj != null && obj.length != null)
		{
			for (var i = 0; i < obj.length; i++)
			{
				var x = obj[i];
				var y = new Competir.MiEmpresa.Tab(x);
				this.add(y);
			}
		}
		obj = null;
	},
	get_Count: function()
	{
		return this._arr.length;
	}
};

// registration
Competir.MiEmpresa.Tabs.registerClass("Competir.MiEmpresa.Tabs", Sys.Component);
// ************************************************************************************
// TemplateManager
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.TemplateManager = function(element)
{
	Competir.Web.UI.Webparts.TemplateManager.initializeBase(this, [element]);
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._Sections = new Competir.Web.UI.Webparts.Sections();
	this._Properties = new Competir.MiEmpresa.CustomProperties(null);
};

// prototype
Competir.Web.UI.Webparts.TemplateManager.prototype =
{
	// methods
	renderContent: function()
	{
	},
	removeWebpart: function(id)
	{
		var webpart = this.findChild(id);
		if (webpart)
		{
			if (confirm("¿Estás seguro/a de querer eliminar este webpart?"))
			{
				var o = new Competir.MiEmpresa.Operation("webpart.remove");
				o.addParameter("ClientID", id);
				o.addParameter("FKInstanciaTemplate", this.get_FKInstancia());
				o.addParameter("AKInstanciaWebpart", webpart.get_AKInstanciaWebpart());
				o.addParameter("GUIDInstanciaWebpart", webpart.get_GUIDInstanciaWebpart());
				o.addListener(this);
				Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
			}
		}
	},
	removePublication: function(id, objectIDs)
	{
		var webpart = this.findChild(id);
		if (webpart)
		{
			var o = new Competir.MiEmpresa.Operation("webpart.publications.remove");
			o.addParameter("ClientID", id);
			o.addParameter("FKInstanciaTemplate", this.get_FKInstancia());
			o.addParameter("AKInstanciaWebpart", webpart.get_AKInstanciaWebpart());
			o.addParameter("GUIDInstanciaWebpart", webpart.get_GUIDInstanciaWebpart());
			o.addParameter("ObjectIDs", objectIDs);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},

	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_Sections: function()
	{
		return this._Sections;
	},
	set_Sections: function(value)
	{
		if (this._Sections !== value)
		{
			this._Sections = new Competir.Web.UI.Webparts.Sections(value);
			this.raisePropertyChanged("Sections");
		}
	},
	get_Properties: function()
	{
		return this._Properties;
	},
	set_Properties: function(value)
	{
		if (this._Properties !== value)
		{
			this._Properties = new Competir.MiEmpresa.CustomProperties(value);
			this.raisePropertyChanged("Properties");
		}
	},

	// event delegates
	_onOperationStarted: function(sender, args)
	{
		var p = sender.getParameter("ClientID");
		if (p)
		{
			var webpart = this.findChild(p.value);
			if (webpart)
			{
				webpart.showWorkingProgress();
			}
		}
	},
	_onOperationSucceeded: function(sender, args)
	{
		var p = sender.getParameter("ClientID");
		if (p)
		{
			var webpart = this.findChild(p.value);
			if (webpart)
			{
				webpart.hideWorkingProgress();
			}
			switch (sender.get_Command())
			{
				case "webpart.remove":
					var element = webpart.get_element();
					if (element)
					{
						if (element.parentNode)
						{
							element.parentNode.removeChild(element);
							webpart.dispose();
						}
					}
					break;
				case "webpart.publications.remove":
					webpart.renderContent();
					break;
			}
		}
	},
	_onOperationFailed: function(sender, args)
	{
		var p = sender.getParameter("ClientID");
		if (p)
		{
			var webpart = this.findChild(p.value);
			if (webpart)
			{
				webpart.hideWorkingProgress();
			}
		}
		switch (sender.get_Command())
		{
			case "webpart.remove":
				alert(" " + sender.get_LastError().get_message());
				break;
			case "webpart.publications.remove":
				alert(" " + sender.get_LastError().get_message());
				break;
		}
	}
};

// registration
Competir.Web.UI.Webparts.TemplateManager.registerClass("Competir.Web.UI.Webparts.TemplateManager", Competir.Web.UI.Webparts.BaseWebpartControl);



// ************************************************************************************
// Section
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.Section = function(generic)
{
	Competir.Web.UI.Webparts.Section.initializeBase(this);
	this._FKInstancia = 0;
};

// prototype
Competir.Web.UI.Webparts.Section.prototype =
{
	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	}
};

// registration
Competir.Web.UI.Webparts.Section.registerClass("Competir.Web.UI.Webparts.Section", Sys.Component);



// ************************************************************************************
// Sections
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.Sections = function(generic)
{
	this._arr = new Array();
	Competir.Web.UI.Webparts.Sections.initializeBase(this);
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.Web.UI.Webparts.Sections.prototype =
{
	// methods
	clear: function()
	{
		while (this._arr.length != 0)
		{
			this._arr.pop();
		}
	},
	add: function(obj)
	{
		this._arr.push(obj);
	},
	indexOf: function(index)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i] == obj)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	indexOfName: function(FKInstancia)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_FKInstancia() == FKInstancia)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	getItem: function(index)
	{
		return this._arr[index];
	},
	getItemByFKInstancia: function(FKInstancia)
	{
		return this._arr[this.indexOfName(FKInstancia)];
	},
	parseGeneric: function(obj)
	{
		this.clear();
		if (obj != null && obj.length != null)
		{
			for (var i = 0; i < obj.length; i++)
			{
				this.add(new Competir.Web.UI.Webparts.Section(obj[i]));
			}
		}
		obj = null;
	},
	get_Count: function()
	{
		return this._arr.length;
	}
};

// registration
Competir.Web.UI.Webparts.Sections.registerClass("Competir.Web.UI.Webparts.Sections", Sys.Component);
// ************************************************************************************
// GenericXml
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.GenericXml = function(element)
{
	Competir.Web.UI.Webparts.GenericXml.initializeBase(this, [element]);
};

//prototype
Competir.Web.UI.Webparts.GenericXml.prototype =
{
	renderContent: function()
	{
		// Operation
		var o = new Competir.MiEmpresa.Operation("genericxml.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("GenericXml._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("GenericXml._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("GenericXml._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.GenericXml.registerClass("Competir.Web.UI.Webparts.GenericXml", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// CaptchaControl
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.CaptchaControl = function(element) {
	Competir.Web.UI.Webparts.CaptchaControl.initializeBase(this, [element]);
};

// prototype
Competir.Web.UI.Webparts.CaptchaControl.prototype =
{
	// methods
	initialize: function() {
		Competir.Web.UI.Webparts.CaptchaControl.callBaseMethod(this, "initialize");
	},
	dispose: function() {
		Competir.Web.UI.Webparts.CaptchaControl.callBaseMethod(this, "dispose");
	},
	refresh: function() {
		if (Aula365) {
			if (Aula365.Json) {
				var svc = new Aula365.Json();
				var img = this.get_ImageElement();
				var hdn = this.get_HiddenElement();
				svc.General_GetNewCaptcha(function(result) {
					if (img) {
						img.src = result.ImageUrl;
					}
					if (hdn) {
						hdn.value = result.Code;
					}
				});
			}
		}
	},
	validateCode: function() {
		var rv = false;
		if (Aula365) {
			if (Aula365.Json) {
				//
				var svc = new Aula365.Json();
				var img = this.get_ImageElement();
				var hdn = this.get_HiddenElement();
				var txt = this.get_InputElement();
				//
				var f = function(result) {
					rv = result;
				};
				//
				svc.General_ValidateCaptchaCode(hdn.value, txt.value, f);
			}
		}
		return rv;
	},

	// properties
	get_ImageElement: function() {
		var img = this.getChild("img");
		return img;
	},
	get_HiddenElement: function() {
		var hdn = this.getChild("hdn");
		return hdn;
	},
	get_InputElement: function() {
		var hdn = this.getChild("txt");
		return hdn;
	}
};

// registration
Competir.Web.UI.Webparts.CaptchaControl.registerClass("Competir.Web.UI.Webparts.CaptchaControl", Competir.Web.UI.Webparts.BaseWebpartControl);
// ************************************************************************************
// TaxonomyBrowser
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.TaxonomyBrowser = function(element)
{
	Competir.Web.UI.Webparts.TaxonomyBrowser.initializeBase(this, [element]);
	this._AKInstanciaArbol = "";
	this._AKInstanciaRamaInicial = "";
};

// prototype
Competir.Web.UI.Webparts.TaxonomyBrowser.prototype =
{
	// properties
	get_AKInstanciaArbol: function()
	{
		return this._AKInstanciaArbol;
	},
	set_AKInstanciaArbol: function(value)
	{
		if (this._AKInstanciaArbol !== value)
		{
			this._AKInstanciaArbol = value;
			this.raisePropertyChanged("AKInstanciaArbol");
		}
	},
	get_AKInstanciaRamaInicial: function()
	{
		return this._AKInstanciaRamaInicial;
	},
	set_AKInstanciaRamaInicial: function(value)
	{
		if (this._AKInstanciaRamaInicial !== value)
		{
			this._AKInstanciaRamaInicial = value;
			this.raisePropertyChanged("AKInstanciaRamaInicial");
		}
	},

	// event delegates
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("TaxonomyBrowser._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("TaxonomyBrowser._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("TaxonomyBrowser._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.TaxonomyBrowser.registerClass("Competir.Web.UI.Webparts.TaxonomyBrowser", Competir.Web.UI.Webparts.BaseChooserControl);
// ************************************************************************************
// RSSViewer
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.RSSViewer = function(element)
{
	Competir.Web.UI.Webparts.RSSViewer.initializeBase(this, [element]);
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._WithCommunityStats = false;
};

// prototype
Competir.Web.UI.Webparts.RSSViewer.prototype =
{
	// methods
	renderContent: function()
	{
		if (this.get_FKInstancia() != 0 | this.get_AKInstancia() != "" | this.get_AKInstanciaWebpart() != "" | this.get_GUIDInstanciaWebpart() != "")
		{
			var o = new Competir.MiEmpresa.Operation("rssviewer.content.render");
			o.addParameter("ID", this.get_id());
			o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
			o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
			o.addParameter("Paginate", this.get_Paginate());
			o.addParameter("PaginateXpression", this.get_PaginateXpression());
			o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
			o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
			o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
			o.addParameter("ActualPage", this.get_ActualPage());
			o.addParameter("PageLength", this.get_PageLength());
			o.addParameter("PageSetLength", this.get_PageSetLength());
			o.addParameter("FKInstancia", this.get_FKInstancia());
			o.addParameter("AKInstancia", this.get_AKInstancia());
			o.addParameter("WithCommunityStats", this.get_WithCommunityStats());
			o.addParameter("ScriptFolder", this.get_ScriptFolder());
			o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
			o.addParameter("XsltFolder", this.get_XsltFolder());
			o.addParameter("XsltFile", this.get_XsltFile());
			o.addParameter("XsltFileUri", this.get_XsltFileUri());
			o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.renderContent();
	},

	// properties
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_WithCommunityStats: function()
	{
		return this._WithCommunityStats;
	},
	set_WithCommunityStats: function(value)
	{
		if (this._WithCommunityStats !== value)
		{
			this._WithCommunityStats = value;
			this.raisePropertyChanged("WithCommunityStats");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	}
};

// registration
Competir.Web.UI.Webparts.RSSViewer.registerClass("Competir.Web.UI.Webparts.RSSViewer", Competir.Web.UI.Webparts.BasePaginatorControl);
// ************************************************************************************
// BaseSearchControl
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.BaseSearchControl = function(element)
{
	Competir.Web.UI.Webparts.BaseSearchControl.initializeBase(this, [element]);
	this._SearchTokenProperties = null;
};

// prototype
Competir.Web.UI.Webparts.BaseSearchControl.prototype =
{
	// methods
	renderContent: function()
	{
		this.executeSearch();
	},
	executeSearch: function()
	{
		var o = new Competir.MiEmpresa.Operation("basesearchcontrol.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
		o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
		if (this.get_SearchTokenProperties())
		{
			o.addParameter("SearchTokenXml", this.get_SearchTokenProperties().toXml(), false);
		}
		o.addParameter("Paginate", this.get_Paginate());
		o.addParameter("PaginateXpression", this.get_PaginateXpression());
		o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
		o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
		o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
		o.addParameter("ActualPage", this.get_ActualPage());
		o.addParameter("PageLength", this.get_PageLength());
		o.addParameter("PageSetLength", this.get_PageSetLength());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.executeSearch();
	},

	// properties
	get_SearchTokenProperties: function()
	{
		return this._SearchTokenProperties;
	},
	set_SearchTokenProperties: function(value)
	{
		if (this._SearchTokenProperties !== value)
		{
			this._SearchTokenProperties = value;
			this.raisePropertyChanged("SearchTokenProperties");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		var cps = new Competir.MiEmpresa.CustomProperties(this.get_SearchTokenProperties());
		if (cps.get_Count() != 0)
		{
			this.set_SearchTokenProperties(cps);
			if (this.get_EnableAjax())
			{
				this.renderContent();
			}
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("BaseSearchControl._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("BaseSearchControl._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("BaseSearchControl._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.BaseSearchControl.registerClass("Competir.Web.UI.Webparts.BaseSearchControl", Competir.Web.UI.Webparts.BasePaginatorControl);
// ************************************************************************************
// Itinerario
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.Itinerario = function(element)
{
	Competir.Web.UI.Webparts.Itinerario.initializeBase(this, [element]);
	this._IncludePeriods = false;
	this._IncludeProductData = false;
	this._IncludeTracking = false;
	this._FillObjects = false;
};

// prototype
Competir.Web.UI.Webparts.Itinerario.prototype =
{
	// methods
	renderContent: function()
	{
		var o = new Competir.MiEmpresa.Operation("itinerario.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("IncludePeriods", this.get_IncludePeriods());
		o.addParameter("IncludeProductData", this.get_IncludeProductData());
		o.addParameter("IncludeTracking", this.get_IncludeTracking());
		o.addParameter("FillObjects", this.get_FillObjects());
		o.addParameter("Paginate", this.get_Paginate());
		o.addParameter("PaginateXpression", this.get_PaginateXpression());
		o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
		o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
		o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
		o.addParameter("ActualPage", this.get_ActualPage());
		o.addParameter("PageLength", this.get_PageLength());
		o.addParameter("PageSetLength", this.get_PageSetLength());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.renderContent();
	},

	// properties
	get_IncludePeriods: function()
	{
		return this._IncludePeriods;
	},
	set_IncludePeriods: function(value)
	{
		if (this._IncludePeriods !== value)
		{
			this._IncludePeriods = value;
			this.raisePropertyChanged("IncludePeriods");
		}
	},
	get_IncludeProductData: function()
	{
		return this._IncludeProductData;
	},
	set_IncludeProductData: function(value)
	{
		if (this._IncludeProductData !== value)
		{
			this._IncludeProductData = value;
			this.raisePropertyChanged("IncludeProductData");
		}
	},
	get_IncludeTracking: function()
	{
		return this._IncludeTracking;
	},
	set_IncludeTracking: function(value)
	{
		if (this._IncludeTracking !== value)
		{
			this._IncludeTracking = value;
			this.raisePropertyChanged("IncludeTracking");
		}
	},
	get_FillObjects: function()
	{
		return this._FillObjects;
	},
	set_FillObjects: function(value)
	{
		if (this._FillObjects !== value)
		{
			this._FillObjects = value;
			this.raisePropertyChanged("FillObjects");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("ComponentList._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("ComponentList._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("ComponentList._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.Itinerario.registerClass("Competir.Web.UI.Webparts.Itinerario", Competir.Web.UI.Webparts.BasePaginatorControl);
// ************************************************************************************
// MultipleSql
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.MultipleSql = function(element)
{
	Competir.Web.UI.Webparts.MultipleSql.initializeBase(this, [element]);
	this._Statements = new Competir.Web.UI.Webparts.DeclarativeSqls(null);
	this._AspCacheMode = "None";
};

// prototype
Competir.Web.UI.Webparts.MultipleSql.prototype =
{
	// methods
	renderContent: function()
	{
		if (this.get_Statements().get_Count() != 0)
		{
			for (var i = 0; i < this.get_Statements().get_Count(); i++)
			{
				var item = this.get_Statements().getItem(i);
				var o = new Competir.MiEmpresa.Operation("multiplesql.content.render");
				o.addParameter("ID", this.get_id());
				o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
				o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
				o.addParameter("StatementName", item.get_Name());
				o.addParameter("ScriptFolder", this.get_ScriptFolder());
				o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
				o.addParameter("XsltFile", this.get_XsltFile());
				o.addParameter("XsltFolder", this.get_XsltFolder());
				o.addParameter("XsltFileUri", this.get_XsltFileUri());
				o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
				o.addParameter("AspCacheMode", this.get_AspCacheMode());
				o.addListener(this);
				Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
			}
		}
	},
	get_StatementContainerClientID: function(statementName)
	{
		return this.get_ClientID() + this.get_ContentsContainerClientID() + "_" + statementName;
	},
	get_StatementContainer: function(statementName)
	{
		return $get(this.get_StatementContainerClientID(statementName));
	},

	// properties
	get_Statements: function()
	{
		return this._Statements;
	},
	set_Statements: function(value)
	{
		if (this._Statements !== value)
		{
			this._Statements = new Competir.Web.UI.Webparts.DeclarativeSqls(value);
			this.raisePropertyChanged("Statements");
		}
	},
	get_AspCacheMode: function()
	{
		return this._AspCacheMode;
	},
	set_AspCacheMode: function(value)
	{
		if (this._AspCacheMode !== value)
		{
			this._AspCacheMode = value;
			this.raisePropertyChanged("AspCacheMode");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
		Competir.Web.UI.Webparts.MultipleSql.callBaseMethod(this, "_onApplicationLoad");
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("MultipleSql._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("MultipleSql._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("MultipleSql._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.MultipleSql.registerClass("Competir.Web.UI.Webparts.MultipleSql", Competir.Web.UI.Webparts.BaseChooserControl);



// ************************************************************************************
// DeclarativeSql
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.DeclarativeSql = function(generic)
{
	Competir.Web.UI.Webparts.DeclarativeSql.initializeBase(this);
	this._Name = "";
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.Web.UI.Webparts.DeclarativeSql.prototype =
{
	// methods
	parseGeneric: function(obj)
	{
		if (String.isInstanceOfType(obj))
		{
			obj = Sys.Serialization.JavaScriptSerializer.deserialize(obj);
		}
		this.set_Name(obj.Name);
	},

	// properties
	get_Name: function()
	{
		return this._Name;
	},
	set_Name: function(value)
	{
		if (this._Name !== value)
		{
			this._Name = value;
			this.raisePropertyChanged("Name");
		}
	}
};

// registration
Competir.Web.UI.Webparts.DeclarativeSql.registerClass("Competir.Web.UI.Webparts.DeclarativeSql", Sys.Component);



// ************************************************************************************
// DeclarativeSqls
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.DeclarativeSqls = function(generic)
{
	this._arr = new Array();
	Competir.Web.UI.Webparts.DeclarativeSqls.initializeBase(this);
	if (generic)
	{
		this.parseGeneric(generic);
	}
};

// prototype
Competir.Web.UI.Webparts.DeclarativeSqls.prototype =
{
	// methods
	clear: function()
	{
		while (this._arr.length != 0)
		{
			this._arr.pop();
		}
	},
	remove: function(obj)
	{
		for (var i = 0; i < this._arr.count; i++)
		{
			if (this[i] == obj)
			{
				this._arr.removeAt(i);
			}
		}
	},
	add: function(obj)
	{
		this._arr.push(obj);
	},
	indexOfName: function(name)
	{
		var rv = -1;
		for (var i = 0; i < this._arr.length; i++)
		{
			if (this._arr[i].get_Name() == name)
			{
				rv = i;
				break;
			}
		}
		return rv;
	},
	getItem: function(index)
	{
		return this._arr[index];
	},
	getItemByName: function(name)
	{
		return this._arr[this.indexOfName(name)];
	},
	parseGeneric: function(obj)
	{
		this.clear();
		if (obj != null && obj.length != null)
		{
			for (var i = 0; i < obj.length; i++)
			{
				this.add(new Competir.Web.UI.Webparts.DeclarativeSql(obj[i]));
			}
		}
		obj = null;
	},
	toXml: function()
	{
		return this.writeXml(new Sys.StringBuilder(""));
	},
	writeXml: function(sb)
	{
		sb.append("<statements>");
		for (var i = 0; i < this.get_Count(); i++)
		{
			sb.append("<statement name=\"" + this.getItem(i).get_Name() + "\"/>");
		}
		sb.append("</statements>");
		return sb.toString();
	},
	get_Count: function()
	{
		return this._arr.length;
	}
};

// registration
Competir.Web.UI.Webparts.DeclarativeSqls.registerClass("Competir.Web.UI.Webparts.DeclarativeSqls", Sys.Component);
// ************************************************************************************
// IdeasAndComments
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.IdeasAndComments = function(element)
{
	Competir.Web.UI.Webparts.IdeasAndComments.initializeBase(this, [element]);
	this._onUserChangeDelegate = Function.createDelegate(this, this.onUserChange);
	this._Mode = "Regular";
	this._Entries = 0;
	this._Randomize = false;
	this._SortDirection = "Descending";
	this._UseCacheForQueryResults = false;
	this._QueryResultsCacheTTL = null;
	this._WarningBoxClientID = "";
	this._FormBoxClientID = "";
	this._TxtCommentClientID = "";
	this._AKInstanciaEstadoPublicacion = "Publicado";
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._WithCommunityStats = false;
	this._FKInstanciaComentarioPadre = null;
};

// prototype
Competir.Web.UI.Webparts.IdeasAndComments.prototype =
{
	// methods
	initialize: function()
	{
		var objContext = Competir.MiEmpresa.Context.getCurrent();
		if (objContext)
		{
			objContext.add_onUserChange(this._onUserChangeDelegate);
		}
		Competir.Web.UI.Webparts.IdeasAndComments.callBaseMethod(this, "initialize");
	},
	dispose: function()
	{
		var objContext = Competir.MiEmpresa.Context.getCurrent();
		if (objContext)
		{
			objContext.remove_onUserChange(this._onUserChangeDelegate);
		}
		Competir.Web.UI.Webparts.IdeasAndComments.callBaseMethod(this, "dispose");
	},
	renderContent: function()
	{
		var o = new Competir.MiEmpresa.Operation("ideasandcomments.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("Mode", this.get_Mode());
		o.addParameter("Entries", this.get_Entries());
		o.addParameter("Randomize", this.get_Randomize());
		o.addParameter("SortDirection", this.get_SortDirection());
		o.addParameter("UseCacheForQueryResults", this.get_UseCacheForQueryResults());
		o.addParameter("QueryResultsCacheTTL", this.get_QueryResultsCacheTTL());
		o.addParameter("Paginate", this.get_Paginate());
		o.addParameter("ActualPage", this.get_ActualPage());
		o.addParameter("PageLength", this.get_PageLength());
		o.addParameter("PageSetLength", this.get_PageSetLength());
		o.addParameter("PaginateXpression", this.get_PaginateXpression());
		o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
		o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
		o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
		o.addParameter("FKInstancia", this.get_FKInstancia());
		o.addParameter("FKInstanciaComentarioPadre", this.get_FKInstanciaComentarioPadre());
		o.addParameter("AKInstancia", this.get_AKInstancia());
		o.addParameter("WithCommunityStats", this.get_WithCommunityStats());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	postComment: function()
	{
		if (this.getValue() != "")
		{
			var usr = Competir.MiEmpresa.Context.getCurrent().get_User();
			if (usr && usr.get_UserType() && usr.get_UserType().AKInstancia != "TipoUsuario.Anonymous")
			{
				var o = new Competir.MiEmpresa.Operation("comments.post");
				o.addParameter("ID", this.get_id());
				o.addParameter("FKInstancia", this.get_FKInstancia());
				o.addParameter("Text", this.getValue());
				o.addParameter("AKInstanciaEstadoPublicacion", this.get_AKInstanciaEstadoPublicacion());
				o.addListener(this);
				Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);

				// Reinicio el contador de caracteres restantes
				var counter = this.getChild("commentremainingchars");
				counter.innerHTML = "3000";
			}
			else
			{
				alert("Para dejar un comentario debes ser un usuario registrado.");
			}
		}
	},
	postAnswer: function(FKInstanciaComentarioPadre)
	{
		var usr = Competir.MiEmpresa.Context.getCurrent().get_User();
		var text = this.getChild(FKInstanciaComentarioPadre + "answertext").value;
		if (usr && usr.get_UserType() && usr.get_UserType().AKInstancia != "TipoUsuario.Anonymous")
		{
			var o = new Competir.MiEmpresa.Operation("comments.post");
			o.addParameter("ID", this.get_id());
			o.addParameter("FKInstancia", this.get_FKInstancia());
			o.addParameter("Text", text);
			o.addParameter("AKInstanciaEstadoPublicacion", this.get_AKInstanciaEstadoPublicacion());
			o.addParameter("FKInstanciaComentarioPadre", FKInstanciaComentarioPadre);
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
		else
		{
			alert("Para responder un comentario debes ser un usuario registrado.");
		}
	},
	showAnswers: function(FKInstanciaComentarioPadre, forceUpdate)
	{
		// Por las dudas
		var control_dom = this.getChild(FKInstanciaComentarioPadre + "ContentsContainer");
		if (control_dom != null && control_dom.innerHTML == "")
		{
			forceUpdate = true;
		}

		// Si ya tenia el html y no me fuerzan a actualizar, solo muestro el contenedor. Si no, voy a buscarlo
		var control = this.findChild(FKInstanciaComentarioPadre + "ContentsContainer");

		// Si el control aparece como creado pero el objeto dom no, es porque me actualizaron (por ejemplo, hicieron
		// un comentario) con lo cual tengo que recrear la referencia
		if (control_dom == null && control != null)
		{
			control.dispose();
			control = null;
		}
		if (control == null)
		{
			var clientID = this.get_ClientID() + FKInstanciaComentarioPadre;
			control = $create(Competir.Web.UI.Webparts.IdeasAndComments,
			{
				"AKInstancia": this.get_AKInstancia(),
				"AKInstanciaEstadoPublicacion": this.get_AKInstanciaEstadoPublicacion(),
				"ActualPage": 0,
				"CacheExpirationTimeSpan": this.get_CacheExpirationTimeSpan(),
				"ClientID": this.get_ClientID(),
				"ClientIDSeparator": "_",
				"ClientVisible": true,
				"ContentsContainerClientID": clientID + "ContentsContainer",
				"EnableAjax": true,
				"Entries": 0,
				"FKInstancia": this.get_FKInstancia(),
				"FKInstanciaComentarioPadre": FKInstanciaComentarioPadre,
				"FormBoxClientID": "divForm",
				"Width": { "IsEmpty": true, "Type": 1, "Value": 0 },
				"Height": { "IsEmpty": true, "Type": 1, "Value": 0 },
				"MaxPageCache": 0,
				"Mode": "Regular",
				"PageLength": 8,
				"PageSetLength": 5,
				"Paginate": true,
				"PaginateXpression": "ROOT/Class",
				"ProgressIndicatorClientID": "ProgressIndicator",
				"QueryResultsCacheTTL": null,
				"Randomize": false,
				"ScriptFolder": "",
				"ScriptFolderUri": "/virtual/fileshandler/v0.0.0.0/scripts/",
				"SortDirection": 1,
				"UniqueID": clientID,
				"UseCache": false,
				"UseCacheForQueryResults": false,
				"WarningBoxClientID": "divWarning",
				"WithCommunityStats": false,
				"XsltFile": "",
				"XsltFileUri": "/virtual/xslt/xslt_wp_blogs_post_comments.xslt",
				"XsltFolder": "",
				"XsltParameters": [{ "Name": "FKInstancia", "Value": this.get_FKInstancia(), "Options": {}, "IsXml": false, "Section": "xslt", "Label": ""}]
			}, null, null, $get(clientID + 'ContentsContainer'));
			forceUpdate = true;
		}
		if (!forceUpdate)
		{
			// Escondo el "mostrar respuestas"
			var showAnswers = this.getChild(FKInstanciaComentarioPadre + "showanswers");
			var parentesis = this.getChild(FKInstanciaComentarioPadre + "parentesis");
			var answersCount = this.getChild(FKInstanciaComentarioPadre + "answerscount");
			if (showAnswers)
			{
				Competir.Web.UI.hide(showAnswers);
				Competir.Web.UI.hide(answersCount);
				Competir.Web.UI.hide(parentesis);
			}

			// Muestro el "ocultar respuestas"
			var hideAnswers = this.getChild(FKInstanciaComentarioPadre + "hideanswers");
			if (hideAnswers)
			{
				Competir.Web.UI.show(hideAnswers, "inline");
			}
		}
		else
		{
			control.renderContent();
		}

		// Muestro al contenedor
		var objContainer = this.getChild(FKInstanciaComentarioPadre + "ContentsContainer");
		Competir.Web.UI.show(objContainer);
	},
	hideAnswers: function(FKInstanciaComentarioPadre)
	{
		var objContainer = this.getChild(FKInstanciaComentarioPadre + "ContentsContainer");
		if (objContainer)
		{
			Competir.Web.UI.hide(objContainer);

			var showAnswers = this.getChild(FKInstanciaComentarioPadre + "showanswers");
			var parentesis = this.getChild(FKInstanciaComentarioPadre + "parentesis");
			var answerscount = this.getChild(FKInstanciaComentarioPadre + "answerscount");
			if (showAnswers)
			{
				Competir.Web.UI.show(showAnswers, "inline");
				Competir.Web.UI.show(answerscount, "inline");
				Competir.Web.UI.show(parentesis, "inline");
			}

			var hideAnswers = this.getChild(FKInstanciaComentarioPadre + "hideanswers");
			if (hideAnswers)
			{
				Competir.Web.UI.hide(hideAnswers);
			}
		}
	},
	showAnswerArea: function(FKInstanciaComentarioPadre)
	{
		var objContainer = this.getChild(FKInstanciaComentarioPadre + "answerarea");
		Competir.Web.UI.show(objContainer, "");
	},
	hideAnswerArea: function(FKInstanciaComentarioPadre)
	{
		var objContainer = this.getChild(FKInstanciaComentarioPadre + "answerarea");
		Competir.Web.UI.hide(objContainer);
	},
	clearAnswerArea: function(FKInstanciaComentarioPadre)
	{
		var objContainer = this.getChild(FKInstanciaComentarioPadre + "answertext");
		objContainer.value = "";

		var remainingChars = this.getChild(FKInstanciaComentarioPadre + "remainingchars");
		remainingChars.innerHTML = "3000";
	},
	updateAnswersCount: function(FKInstanciaComentarioPadre)
	{
		// Incremento el contador
		var answersCount = this.getChild(FKInstanciaComentarioPadre + "answerscount");
		answersCount.innerHTML = parseInt(answersCount.innerHTML) + 1;

		// Por si estaba escondido el "Mostrar respuestas", lo muestro porque ahora si que hay respuestas
		var showAnswersArea = this.getChild(FKInstanciaComentarioPadre + "showanswersarea");
		var parentesis = this.getChild(FKInstanciaComentarioPadre + "parentesis");
		Competir.Web.UI.show(showAnswersArea, "inline");
		Competir.Web.UI.show(answersCount, "inline");
		Competir.Web.UI.show(parentesis, "inline");
	},
	disableComment: function(commentId)
	{
		var o = new Competir.MiEmpresa.Operation("comments.disable");
		o.addParameter("ID", this.get_id());
		o.addParameter("CommentId", commentId);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	saveComment: function(commentId, text)
	{
		var o = new Competir.MiEmpresa.Operation("comments.save");
		o.addParameter("ID", this.get_id());
		o.addParameter("CommentId", commentId);
		o.addParameter("Text", text);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	limitChars: function(limitFieldId, remainingCounterId, limitNum)
	{
		var limitField = this.getChild(limitFieldId);
		if (limitField.value.length > limitNum)
		{
			limitField.value = limitField.value.substring(0, limitNum);
		}
		else
		{
			var remainingCounter = this.getChild(remainingCounterId);
			remainingCounter.innerHTML = limitNum - limitField.value.length;
		}
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.renderContent();
	},
	getValue: function()
	{
		var rv = "";
		if (this.get_TxtCommentClientID() != "")
		{
			var objTxtComment = this.getChild(this.get_TxtCommentClientID());
			if (objTxtComment)
			{
				rv = objTxtComment.value;
			}
		}
		return rv;
	},

	// properties
	get_Mode: function()
	{
		return this._Mode;
	},
	set_Mode: function(value)
	{
		if (this._Mode !== value)
		{
			this._Mode = value;
			this.raisePropertyChanged("Mode");
		}
	},
	get_Entries: function()
	{
		return this._Entries;
	},
	set_Entries: function(value)
	{
		if (this._Entries !== value)
		{
			this._Entries = value;
			this.raisePropertyChanged("Entries");
		}
	},
	get_Randomize: function()
	{
		return this._Randomize;
	},
	set_Randomize: function(value)
	{
		if (this._Randomize !== value)
		{
			this._Randomize = value;
			this.raisePropertyChanged("Randomize");
		}
	},
	get_SortDirection: function()
	{
		return this._SortDirection;
	},
	set_SortDirection: function(value)
	{
		if (this._SortDirection !== value)
		{
			this._SortDirection = value;
			this.raisePropertyChanged("SortDirection");
		}
	},
	get_UseCacheForQueryResults: function()
	{
		return this._UseCacheForQueryResults;
	},
	set_UseCacheForQueryResults: function(value)
	{
		if (this._UseCacheForQueryResults !== value)
		{
			this._UseCacheForQueryResults = value;
			this.raisePropertyChanged("UseCacheForQueryResults");
		}
	},
	get_QueryResultsCacheTTL: function()
	{
		return this._QueryResultsCacheTTL;
	},
	set_QueryResultsCacheTTL: function(value)
	{
		if (this._QueryResultsCacheTTL !== value)
		{
			this._QueryResultsCacheTTL = value;
			this.raisePropertyChanged("QueryResultsCacheTTL");
		}
	},
	get_WarningBoxClientID: function()
	{
		return this._WarningBoxClientID;
	},
	set_WarningBoxClientID: function(value)
	{
		if (this._WarningBoxClientID !== value)
		{
			this._WarningBoxClientID = value;
			this.raisePropertyChanged("WarningBoxClientID");
		}
	},
	get_FormBoxClientID: function()
	{
		return this._FormBoxClientID;
	},
	set_FormBoxClientID: function(value)
	{
		if (this._FormBoxClientID !== value)
		{
			this._FormBoxClientID = value;
			this.raisePropertyChanged("FormBoxClientID");
		}
	},
	get_TxtCommentClientID: function()
	{
		return this._TxtCommentClientID;
	},
	set_TxtCommentClientID: function(value)
	{
		if (this._TxtCommentClientID !== value)
		{
			this._TxtCommentClientID = value;
			this.raisePropertyChanged("TxtCommentClientID");
		}
	},
	get_AKInstanciaEstadoPublicacion: function()
	{
		return this._AKInstanciaEstadoPublicacion;
	},
	set_AKInstanciaEstadoPublicacion: function(value)
	{
		if (this._AKInstanciaEstadoPublicacion !== value)
		{
			this._AKInstanciaEstadoPublicacion = value;
			this.raisePropertyChanged("AKInstanciaEstadoPublicacion");
		}
	},
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_FKInstanciaComentarioPadre: function()
	{
		return this._FKInstanciaComentarioPadre;
	},
	set_FKInstanciaComentarioPadre: function(value)
	{
		if (this._FKInstanciaComentarioPadre !== value)
		{
			this._FKInstanciaComentarioPadre = value;
			this.raisePropertyChanged("FKInstanciaComentarioPadre");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_WithCommunityStats: function()
	{
		return this._WithCommunityStats;
	},
	set_WithCommunityStats: function(value)
	{
		if (this._WithCommunityStats !== value)
		{
			this._WithCommunityStats = value;
			this.raisePropertyChanged("WithCommunityStats");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_Mode() == "Regular")
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("IdeasAndComments._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("IdeasAndComments._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("IdeasAndComments._onOperationFailed no se ha implementado en la aplicación.");
	},
	onUserChange: function(sender, args)
	{
		// Reinicio la pagina entera para que los permisos para comentar y responder se actualizen
		window.location.reload();

		//			var usr = sender.get_User();
		//			var logged = usr && usr.get_UserType() && usr.get_UserType().AKInstancia != "TipoUsuario.Anonymous";

		// Cambio el permiso para comentar
		//			var objFormBox = this.getChild(this.get_FormBoxClientID());
		//			if (objFormBox)
		//			{
		//				var objWarningBox = this.getChild(this.get_WarningBoxClientID());
		//				if (logged)
		//				{
		//					Competir.Web.UI.show(objFormBox);
		//					if (objWarningBox)
		//					{
		//						Competir.Web.UI.hide(objWarningBox);
		//					}
		//				}
		//				else
		//				{
		//					Competir.Web.UI.hide(objFormBox);
		//					if (objWarningBox)
		//					{
		//						Competir.Web.UI.show(objWarningBox);
		//					}
		//				}
		//			}

		// Cambio el permiso para responder
		//			for (var i = 0; i < this._answerButtons.length; i++)
		//			{
		//				var button = this.getChild(this._answerButtons[i]);
		//				button.setAttribute("style", (logged ? "" : "none"));
		//			}
	}
};

// registration
Competir.Web.UI.Webparts.IdeasAndComments.registerClass("Competir.Web.UI.Webparts.IdeasAndComments", Competir.Web.UI.Webparts.BasePaginatorControl);
// ************************************************************************************
// QABankV2
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.QABankV2 = function(element)
{
	Competir.Web.UI.Webparts.QABankV2.initializeBase(this, [element]);
	this._Mode = "Regular";
	this._AKInstanciaArbol = "";
	this._AKInstanciaTipoConsulta = "TipoConsulta.ConsultoriaEducativa";
	this._AKInstanciaEstadoPublicacion = "Publicado";
	this._SearchExpression = "";
	this._ParentFKs = "";
	this._SortDirection = "";
	this._UseCacheForQueryResults = false;
	this._QueryResultsCacheTTL = null;
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._WithCommunityStats = false;
};

// prototype
Competir.Web.UI.Webparts.QABankV2.prototype =
{
	// methods
	renderContent: function()
	{
		var o = new Competir.MiEmpresa.Operation("qabankv2.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
		o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
		o.addParameter("Mode", this.get_Mode());
		o.addParameter("AKInstanciaArbol", this.get_AKInstanciaArbol());
		o.addParameter("AKInstanciaTipoConsulta", this.get_AKInstanciaTipoConsulta());
		o.addParameter("AKInstanciaEstadoPublicacion", this.get_AKInstanciaEstadoPublicacion());
		o.addParameter("SearchExpression", this.get_SearchExpression());
		o.addParameter("ParentFKs", this.get_ParentFKs());
		o.addParameter("SortDirection", this.get_SortDirection());
		o.addParameter("UseCacheForQueryResults", this.get_UseCacheForQueryResults());
		o.addParameter("QueryResultsCacheTTL", this.get_QueryResultsCacheTTL());
		o.addParameter("FKInstancia", this.get_FKInstancia());
		o.addParameter("AKInstancia", this.get_AKInstancia());
		o.addParameter("WithCommunityStats", this.get_WithCommunityStats());
		o.addParameter("Paginate", this.get_Paginate());
		o.addParameter("PaginateXpression", this.get_PaginateXpression());
		o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
		o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
		o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
		o.addParameter("ActualPage", this.get_ActualPage());
		o.addParameter("PageLength", this.get_PageLength());
		o.addParameter("PageSetLength", this.get_PageSetLength());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	search: function(expression, parentFKs, FKInstancia)
	{
		if (expression)
		{
			this.set_SearchExpression(expression);
		}
		else
		{
			this.set_SearchExpression("");
		}
		if (parentFKs)
		{
			this.set_ParentFKs(parentFKs);
		}
		else
		{
			this.set_ParentFKs("");
		}
		if (FKInstancia)
		{
			this.set_FKInstancia(FKInstancia);
		}
		else
		{
			this.set_FKInstancia(0);
		}
		this.set_ActualPage(0);
		this.renderContent();
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.renderContent();
	},

	// properties
	get_Mode: function()
	{
		return this._Mode;
	},
	set_Mode: function(value)
	{
		if (this._Mode !== value)
		{
			this._Mode = value;
			this.raisePropertyChanged("Mode");
		}
	},
	get_AKInstanciaTipoConsulta: function()
	{
		return this._AKInstanciaTipoConsulta;
	},
	set_AKInstanciaTipoConsulta: function(value)
	{
		if (this._AKInstanciaTipoConsulta !== value)
		{
			this._AKInstanciaTipoConsulta = value;
			this.raisePropertyChanged("AKInstanciaTipoConsulta");
		}
	},
	get_AKInstanciaEstadoPublicacion: function()
	{
		return this._AKInstanciaEstadoPublicacion;
	},
	set_AKInstanciaEstadoPublicacion: function(value)
	{
		if (this._AKInstanciaEstadoPublicacion !== value)
		{
			this._AKInstanciaEstadoPublicacion = value;
			this.raisePropertyChanged("AKInstanciaEstadoPublicacion");
		}
	},
	get_AKInstanciaArbol: function()
	{
		return this._AKInstanciaArbol;
	},
	set_AKInstanciaArbol: function(value)
	{
		if (this._AKInstanciaArbol !== value)
		{
			this._AKInstanciaArbol = value;
			this.raisePropertyChanged("AKInstanciaArbol");
		}
	},
	get_SearchExpression: function()
	{
		return this._SearchExpression;
	},
	set_SearchExpression: function(value)
	{
		if (this._SearchExpression !== value)
		{
			this._SearchExpression = value;
			this.raisePropertyChanged("SearchExpression");
		}
	},
	get_ParentFKs: function()
	{
		return this._ParentFKs;
	},
	set_ParentFKs: function(value)
	{
		if (this._ParentFKs !== value)
		{
			this._ParentFKs = value;
			this.raisePropertyChanged("ParentFKs");
		}
	},
	get_SortDirection: function()
	{
		return this._SortDirection;
	},
	set_SortDirection: function(value)
	{
		if (this._SortDirection !== value)
		{
			this._SortDirection = value;
			this.raisePropertyChanged("SortDirection");
		}
	},
	get_UseCacheForQueryResults: function()
	{
		return this._UseCacheForQueryResults;
	},
	set_UseCacheForQueryResults: function(value)
	{
		if (this._UseCacheForQueryResults !== value)
		{
			this._UseCacheForQueryResults = value;
			this.raisePropertyChanged("UseCacheForQueryResults");
		}
	},
	get_QueryResultsCacheTTL: function()
	{
		return this._QueryResultsCacheTTL;
	},
	set_QueryResultsCacheTTL: function(value)
	{
		if (this._QueryResultsCacheTTL !== value)
		{
			this._QueryResultsCacheTTL = value;
			this.raisePropertyChanged("QueryResultsCacheTTL");
		}
	},
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_WithCommunityStats: function()
	{
		return this._WithCommunityStats;
	},
	set_WithCommunityStats: function(value)
	{
		if (this._WithCommunityStats !== value)
		{
			this._WithCommunityStats = value;
			this.raisePropertyChanged("WithCommunityStats");
		}
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			if (this.get_Mode() != "Static")
			{
				this.renderContent();
			}
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("QABankV2._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("QABankV2._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("QABankV2._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.QABankV2.registerClass("Competir.Web.UI.Webparts.QABankV2", Competir.Web.UI.Webparts.BasePaginatorControl);
// ************************************************************************************
// ComponentList
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.ComponentList = function(element)
{
	Competir.Web.UI.Webparts.ComponentList.initializeBase(this, [element]);
	this._SearchTokenProperties = null;
	this._ComponentListIDs = "";
	this._ExcludedIDs = "";
	this._SelectedValue = null;
};

// prototype
Competir.Web.UI.Webparts.ComponentList.prototype =
{
	// methods
	renderContent: function()
	{
		if (this.get_SearchTokenProperties() != null | this.get_ComponentListIDs() != "" | this.get_AKInstanciaWebpart() != "" | this.get_GUIDInstanciaWebpart() != "")
		{
			// Xslt parameters
			var cpsXslt = new Competir.MiEmpresa.CustomProperties();
			cpsXslt.addNew("xslt", "SelectedValue", this.get_SelectedValue());
			this.mergeXsltParameters(cpsXslt);

			// Operation
			var o = new Competir.MiEmpresa.Operation("componentlist.content.render");
			o.addParameter("ID", this.get_id());
			o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
			o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
			if (this.get_SearchTokenProperties())
			{
				o.addParameter("SearchTokenXml", this.get_SearchTokenProperties().toXml(), false);
			}
			o.addParameter("ComponentListIDs", this.get_ComponentListIDs());
			o.addParameter("ExcludedIDs", this.get_ExcludedIDs());
			o.addParameter("Paginate", this.get_Paginate());
			o.addParameter("PaginateXpression", this.get_PaginateXpression());
			o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
			o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
			o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
			o.addParameter("ActualPage", this.get_ActualPage());
			o.addParameter("PageLength", this.get_PageLength());
			o.addParameter("PageSetLength", this.get_PageSetLength());
			o.addParameter("ScriptFolder", this.get_ScriptFolder());
			o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
			o.addParameter("XsltFolder", this.get_XsltFolder());
			o.addParameter("XsltFile", this.get_XsltFile());
			o.addParameter("XsltFileUri", this.get_XsltFileUri());
			o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
			o.addParameter("UseCache", this.get_UseCache());
			o.addParameter("CacheExpirationTimeSpan", this.get_CacheExpirationTimeSpan());
			o.addParameter("MaxPageCache", this.get_MaxPageCache());
			o.addListener(this);
			Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
		}
	},
	select: function(value)
	{
		this.set_SelectedValue(value);
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.renderContent();
	},

	// properties
	get_SearchTokenProperties: function()
	{
		return this._SearchTokenProperties;
	},
	set_SearchTokenProperties: function(value)
	{
		if (this._SearchTokenProperties !== value)
		{
			this._SearchTokenProperties = value;
			this.raisePropertyChanged("SearchTokenProperties");
		}
	},
	get_ComponentListIDs: function()
	{
		return this._ComponentListIDs;
	},
	set_ComponentListIDs: function(value)
	{
		if (this._ComponentListIDs !== value)
		{
			this._ComponentListIDs = value;
			this.raisePropertyChanged("ComponentListIDs");
		}
	},
	get_SelectedValue: function()
	{
		return this._SelectedValue;
	},
	set_SelectedValue: function(value)
	{
		if (this._SelectedValue !== value)
		{
			this._SelectedValue = value;
			this.raisePropertyChanged("SelectedValue");
			this.raiseEvent("onClientChange", Sys.EventArgs.Empty);
		}
	},
	get_ExcludedIDs: function()
	{
		return this._ExcludedIDs;
	},
	set_ExcludedIDs: function(value)
	{
		if (this._ExcludedIDs !== value)
		{
			this._ExcludedIDs = value;
			this.raisePropertyChanged("ExcludedIDs");
			this.raiseEvent("ExcludedIDs", Sys.EventArgs.Empty);
		}
	},

	// events
	add_onClientChange: function(handler)
	{
		this.get_events().addHandler("onClientChange", handler);
	},
	remove_onClientChange: function(handler)
	{
		this.get_events().removeHandler("onClientChange", handler);
	},

	// event delegates
	_onApplicationLoad: function(o)
	{
		var cps = new Competir.MiEmpresa.CustomProperties(this.get_SearchTokenProperties());
		if (cps.get_Count() != 0)
		{
			this.set_SearchTokenProperties(cps);
		}
		if (this.get_EnableAjax())
		{
			this.renderContent();
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("ComponentList._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("ComponentList._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("ComponentList._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.ComponentList.registerClass("Competir.Web.UI.Webparts.ComponentList", Competir.Web.UI.Webparts.BasePaginatorControl);
// ************************************************************************************
// QABankV2DF
// ************************************************************************************
// namespace
Type.registerNamespace("Competir.Web.UI.Webparts");

// constructor
Competir.Web.UI.Webparts.QABankV2DF = function(element)
{
	Competir.Web.UI.Webparts.QABankV2DF.initializeBase(this, [element]);
	this._Mode = "Regular";
	this._AKInstanciaArbol = "";
	this._AKInstanciaTipoConsulta = "TipoConsulta.ConsultoriaEducativa";
	this._AKInstanciaEstadoPublicacion = "Publicado";
	this._SearchExpression = "";
	this._ParentFKs = "";
	this._SortDirection = "";
	this._UseCacheForQueryResults = false;
	this._QueryResultsCacheTTL = null;
	this._FKInstancia = 0;
	this._AKInstancia = "";
	this._WithCommunityStats = false;
};

// prototype
Competir.Web.UI.Webparts.QABankV2DF.prototype =
{
	// methods
	renderContent: function()
	{
		var o = new Competir.MiEmpresa.Operation("qabankv2df.content.render");
		o.addParameter("ID", this.get_id());
		o.addParameter("AKInstanciaWebpart", this.get_AKInstanciaWebpart());
		o.addParameter("GUIDInstanciaWebpart", this.get_GUIDInstanciaWebpart());
		o.addParameter("Mode", this.get_Mode());
		o.addParameter("AKInstanciaArbol", this.get_AKInstanciaArbol());
		o.addParameter("AKInstanciaTipoConsulta", this.get_AKInstanciaTipoConsulta());
		o.addParameter("AKInstanciaEstadoPublicacion", this.get_AKInstanciaEstadoPublicacion());
		o.addParameter("SearchExpression", this.get_SearchExpression());
		o.addParameter("ParentFKs", this.get_ParentFKs());
		o.addParameter("SortDirection", this.get_SortDirection());
		o.addParameter("UseCacheForQueryResults", this.get_UseCacheForQueryResults());
		o.addParameter("QueryResultsCacheTTL", this.get_QueryResultsCacheTTL());
		o.addParameter("FKInstancia", this.get_FKInstancia());
		o.addParameter("AKInstancia", this.get_AKInstancia());
		o.addParameter("WithCommunityStats", this.get_WithCommunityStats());
		o.addParameter("Paginate", this.get_Paginate());
		o.addParameter("PaginateXpression", this.get_PaginateXpression());
		o.addParameter("SortHelperXpression", this.get_SortHelperXpression());
		o.addParameter("SortHelperDataType", this.get_SortHelperDataType());
		o.addParameter("SortHelperOrder", this.get_SortHelperOrder());
		o.addParameter("ActualPage", this.get_ActualPage());
		o.addParameter("PageLength", this.get_PageLength());
		o.addParameter("PageSetLength", this.get_PageSetLength());
		o.addParameter("ScriptFolder", this.get_ScriptFolder());
		o.addParameter("ScriptFolderUri", this.get_ScriptFolderUri());
		o.addParameter("XsltFolder", this.get_XsltFolder());
		o.addParameter("XsltFile", this.get_XsltFile());
		o.addParameter("XsltFileUri", this.get_XsltFileUri());
		o.addParameter("XsltParametersXml", this.get_XsltParameters().toXml(), false);
		o.addParameter("UseCache", this.get_UseCache());
		o.addParameter("CacheExpirationTimeSpan", this.get_CacheExpirationTimeSpan());
		o.addParameter("MaxPageCache", this.get_MaxPageCache());
		o.addListener(this);
		Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(o);
	},
	search: function(expression, parentFKs, FKInstancia)
	{
		if (expression)
		{
			this.set_SearchExpression(expression);
		}
		else
		{
			this.set_SearchExpression("");
		}
		if (parentFKs)
		{
			this.set_ParentFKs(parentFKs);
		}
		else
		{
			this.set_ParentFKs("");
		}
		if (FKInstancia)
		{
			this.set_FKInstancia(FKInstancia);
		}
		else
		{
			this.set_FKInstancia(0);
		}
		this.set_ActualPage(0);
		this.renderContent();
	},
	changePageIndex: function(index)
	{
		this.set_ActualPage(index);
		this.renderContent();
	},

	// properties
	get_Mode: function()
	{
		return this._Mode;
	},
	set_Mode: function(value)
	{
		if (this._Mode !== value)
		{
			this._Mode = value;
			this.raisePropertyChanged("Mode");
		}
	},
	get_AKInstanciaTipoConsulta: function()
	{
		return this._AKInstanciaTipoConsulta;
	},
	set_AKInstanciaTipoConsulta: function(value)
	{
		if (this._AKInstanciaTipoConsulta !== value)
		{
			this._AKInstanciaTipoConsulta = value;
			this.raisePropertyChanged("AKInstanciaTipoConsulta");
		}
	},
	get_AKInstanciaEstadoPublicacion: function()
	{
		return this._AKInstanciaEstadoPublicacion;
	},
	set_AKInstanciaEstadoPublicacion: function(value)
	{
		if (this._AKInstanciaEstadoPublicacion !== value)
		{
			this._AKInstanciaEstadoPublicacion = value;
			this.raisePropertyChanged("AKInstanciaEstadoPublicacion");
		}
	},
	get_AKInstanciaArbol: function()
	{
		return this._AKInstanciaArbol;
	},
	set_AKInstanciaArbol: function(value)
	{
		if (this._AKInstanciaArbol !== value)
		{
			this._AKInstanciaArbol = value;
			this.raisePropertyChanged("AKInstanciaArbol");
		}
	},
	get_SearchExpression: function()
	{
		return this._SearchExpression;
	},
	set_SearchExpression: function(value)
	{
		if (this._SearchExpression !== value)
		{
			this._SearchExpression = value;
			this.raisePropertyChanged("SearchExpression");
		}
	},
	get_ParentFKs: function()
	{
		return this._ParentFKs;
	},
	set_ParentFKs: function(value)
	{
		if (this._ParentFKs !== value)
		{
			this._ParentFKs = value;
			this.raisePropertyChanged("ParentFKs");
		}
	},
	get_SortDirection: function()
	{
		return this._SortDirection;
	},
	set_SortDirection: function(value)
	{
		if (this._SortDirection !== value)
		{
			this._SortDirection = value;
			this.raisePropertyChanged("SortDirection");
		}
	},
	get_UseCacheForQueryResults: function()
	{
		return this._UseCacheForQueryResults;
	},
	set_UseCacheForQueryResults: function(value)
	{
		if (this._UseCacheForQueryResults !== value)
		{
			this._UseCacheForQueryResults = value;
			this.raisePropertyChanged("UseCacheForQueryResults");
		}
	},
	get_QueryResultsCacheTTL: function()
	{
		return this._QueryResultsCacheTTL;
	},
	set_QueryResultsCacheTTL: function(value)
	{
		if (this._QueryResultsCacheTTL !== value)
		{
			this._QueryResultsCacheTTL = value;
			this.raisePropertyChanged("QueryResultsCacheTTL");
		}
	},
	get_FKInstancia: function()
	{
		return this._FKInstancia;
	},
	set_FKInstancia: function(value)
	{
		if (this._FKInstancia !== value)
		{
			this._FKInstancia = value;
			this.raisePropertyChanged("FKInstancia");
		}
	},
	get_AKInstancia: function()
	{
		return this._AKInstancia;
	},
	set_AKInstancia: function(value)
	{
		if (this._AKInstancia !== value)
		{
			this._AKInstancia = value;
			this.raisePropertyChanged("AKInstancia");
		}
	},
	get_WithCommunityStats: function()
	{
		return this._WithCommunityStats;
	},
	set_WithCommunityStats: function(value)
	{
		if (this._WithCommunityStats !== value)
		{
			this._WithCommunityStats = value;
			this.raisePropertyChanged("WithCommunityStats");
		}
	},


	// event delegates
	_onApplicationLoad: function(o)
	{
		if (this.get_EnableAjax())
		{
			if (this.get_Mode() != "Static")
			{
				this.renderContent();
			}
		}
	},
	_onOperationStarted: function(sender, args)
	{
		throw Error.notImplemented("QABankV2._onOperationStarted no se ha implementado en la aplicación.");
	},
	_onOperationSucceeded: function(sender, args)
	{
		throw Error.notImplemented("QABankV2._onOperationSucceeded no se ha implementado en la aplicación.");
	},
	_onOperationFailed: function(sender, args)
	{
		throw Error.notImplemented("QABankV2._onOperationFailed no se ha implementado en la aplicación.");
	}
};

// registration
Competir.Web.UI.Webparts.QABankV2DF.registerClass("Competir.Web.UI.Webparts.QABankV2DF", Competir.Web.UI.Webparts.BasePaginatorControl);
