/**
 * @author Pawel Lytko
 * @property string _id, wartosc atrybutu id znacznika HTML
 */

	function Service_event()
	{
		this._return_function = null;
		this._index_form = -1;
		
		this.set_current_form = function(p_index)
		{
			try
			{
				if (typeof p_index == "number" && parseInt(p_index) >= 0)
				{
					this._index_form = p_index;
				}
			}
			catch (object_exception)
			{
				this._index_form = -1;
			}
		}
		
		this.get_form = function(p_id)
		{
			var return_value = null;
			try
			{
				if (typeof p_id == "string" || typeof p_id == "number")
				{
					return_value = document.forms[p_id];
				}
			}
			catch (object_exception)
			{
				return_value = null;
			}
			return return_value;
		}
		
		this.get_item_form = function(p_id)
		{
			var return_value = null;
			try
			{
				if (typeof p_id == "string" && typeof this._index_form == "number" && parseInt(this._index_form) >= 0)
				{
					return_value = document.forms[this._index_form].elements[p_id];
				}
			}
			catch (object_exception)
			{
				return_value = null;
			}
			return return_value;
		}
		
		this.set_return_function = function(p_return_value)
		{
			this._return_function = p_return_value;
		}
		
		this.get_return_function = function()
		{
			return this._return_function;
		}
		
		this.set_click = function(p_object, p_function)
		{
			var return_value = false;
			try
			{
				if (typeof p_object == "object" && typeof p_function == "function")
				{
					p_object.onclick = p_function;
					return_value = true;
				}
			} 
			catch (object_exception)
			{
				return_value = false;
			}
			return return_value;
		}
		
		this.set_submit = function(p_id, p_function)
		{
			var return_value = false;
			try
			{
				if ((typeof p_id == "string" || typeof p_id == "number") && typeof p_function == "function")
				{
					document.forms[p_id].onsubmit = p_function;
					return_value = true;
				}
			} 
			catch (object_exception)
			{
				return_value = false;
			}
			return return_value;
		}
		
		this.set_change = function(p_object, p_function)
		{
			var return_value = false;
			try
			{
				if (typeof p_object == "object" && typeof p_function == "function")
				{
					p_object.onchange = p_function;
					return_value = true;
				}
			} 
			catch (object_exception)
			{
				return_value = false;
			}
			return return_value;
		}
		
		this.set_click = function(p_object, p_function)
		{
			var return_value = false;
			try
			{
				if (typeof p_object == "object" && typeof p_function == "function")
				{
					p_object.onclick = p_function;
					return_value = true;
				}
			} 
			catch (object_exception)
			{
				return_value = false;
			}
			return return_value;
		}
		
		this.set_load = function(p_function)
		{
			var return_value = false;
			try
			{
				if (typeof p_function == "function")
				{
					window.onload = p_function;
					return_value = true;
				}
			}
			catch (object_exception)
			{
				return_value = false;
			}
			return return_value;
		}
		
	}
