function find_element (element_name)
{
	var element;

	if (document.getElementById) // this is the way the standards work
	{
		element = document.getElementById (element_name);
	} else if (document.all) { // this is the way old msie versions work
		element = document.all[element_name];
	} else if (document.layers) { // this is the way nn4 works
		element = document.layers[element_name];
	}

	return element;
}

// Find the top-left position of an item.  From: http://www.quirksmode.org/js/findpos.html
function find_position (obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent)
	{
		do
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
	}
}

// Using this function to fetch an XML node's value gives us an empty string if it's empty/NULL instead of failing.
function handle_null_node (value)
{
	if (value)
	{
		return value.nodeValue;
	} else return "";
}

// Make an HTTP request object.
function make_http_request ()
{
	var xmlhttp = false;

	// Try the standard way.
	if (!xmlhttp && typeof (XMLHttpRequest) != 'undefined')
	{
		try {
			xmlhttp = new XMLHttpRequest ();
		} catch (e) {
			xmlhttp = false;
			alert ("XMLHttpRequest failed");
		}
	}

	// If that didn't work, try the old IE way.
	if (!xmlhttp && typeof (ActiveXObject) != "undefined")
	{
		try
		{
			xmlhttp = new ActiveXObject ("MSXML2.XMLHTTP");
		} catch (e) {
			xmlhttp=false;
			alert ("MSXML2.XMLHTTP failed");
		}

		if (!xmlhttp) try
		{
			xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP");
		} catch (e) {
			xmlhttp = false;
			alert ("Microsoft.XMLHTTP failed");
		}
	}

	return xmlhttp;
}