// ***** Copyright ©2003 Frogtrade Limited. All rights reserved *****
//
// Purpose: 
//
// Notes: 
//

var h2j_array=new Array();

function h2j_add_object(obj)
{
	var debug_messages=(typeof(ft_debug_messages)!="undefined");
	if (!obj)
	{
		return false;
	}
	else if (!obj.object_ref)
	{
		if (debug_messages)
		{
			show_ft_debug_message("html_to_jscript_linker",
								  "Tried to add an object with no or a false object_ref to h2j array.");
		}
		return false;
	}
	else if (h2j_array[obj.object_ref])
	{
		if (debug_messages)
		{
			show_ft_debug_message("html_to_jscript_linker",
								  "Tried to add an object with object_ref: " + obj.object_ref + " to h2j array.\nAn object with this object_ref is already present in the array.");
		}
		return false;
	}
	else
	{
		h2j_array[obj.object_ref]=obj;
		return true;
	}
}

function h2j_get_object(object_ref)
{
	return h2j_array[object_ref];
}

function h2j_get_html(object_ref, html_element)
{
	html_element=(html_element?html_element:document);
	var tgt=html_element.all[object_ref];

	if (!tgt)
	{
		return tgt;
	}
	else if (!tgt.length)
	{
		return tgt;
	}
	else if (typeof(ft_debug_messages)!="undefined")
	{
		show_ft_debug_message("html_to_jscript_linker",
							  "Tried to access html element by id: " + object_ref + ".\nMore than one element in the DOM with this id.")
	}
}
