// Class Definitions ----------------------------------------------------------------------------------------------------------

	function OpenDictionaryBox (id)
		{	this.id = id;
		}; // class OpenDictionaryBox (id)

	OpenDictionaryBox.prototype.getTodaysWord	= open_dictionary_box_get_todays;
	OpenDictionaryBox.prototype.render			= open_dictionary_box_render;
	OpenDictionaryBox.prototype.setData			= open_dictionary_box_set_data;
	OpenDictionaryBox.prototype.onAJaxSuccess	= open_dictionary_box_ajax_success;
	OpenDictionaryBox.prototype.onAJaxFailure	= open_dictionary_box_ajax_failure;
	OpenDictionaryBox.prototype.onAJaxUpdate	= open_dictionary_box_ajax_update;

// Method Definitions ---------------------------------------------------------------------------------------------------------

	function open_dictionary_box_ajax_failure (ajax)
		{	this.setData("wordulous", "adjective", "Anonymous", ": given to inventing creative new words because one's large vocabulary needs sustenance");
		}; // function open_dictionary_box_ajax_failure (ajax)

	// ------------------------------------------------------------------------------------------------------------------------

	function open_dictionary_box_ajax_success (ajax)
		{	// Get the XML document root node.
			var xml	= ajax.responseXML;
			var xml	= xml.getElementsByTagName("opendict");
			var xml	= xml ? xml.item(0) : false;

			// Get the headword.
			var data		= xml? xml.getElementsByTagName("headword") : false;
			data			= data ? data.item(0) : false;
			var headword	= data && data.firstChild ? data.firstChild.nodeValue : "";

			// Get the publication date.
			data			= xml? xml.getElementsByTagName("pub-date") : false;
			data			= data ? data.item(0) : false;
			var pub_date	= data && data.firstChild ? data.firstChild.nodeValue : "";

			// Get the function label.
			data			= xml? xml.getElementsByTagName("function") : false;
			data			= data ? data.item(0) : false;
			var func		= data && data.firstChild ? data.firstChild.nodeValue : "";

			// Get the author.
			data			= xml? xml.getElementsByTagName("author") : false;
			data			= data ? data.item(0) : false;
			var author		= data && data.firstChild ? data.firstChild.nodeValue : "";

			// Get the definition.
			// Get the headword.
			data			= xml? xml.getElementsByTagName("definition") : false;
			data			= data ? data.item(0) : false;
			var def			= data && data.firstChild ? data.firstChild.nodeValue : "";
			def		= def.replace(/\s+/, " ");
			def		= def.replace(/^\s+/, "");
			def		= def.replace(/\s+$/, "");
			def		= ( def.substring(0, 1) != ":" ? ":" : "" ) + def;

			// Set the data.
			this.setData(headword, func, author, def);
		}; // function open_dictionary_box_ajax_success (ajax)

	// ------------------------------------------------------------------------------------------------------------------------

	function open_dictionary_box_ajax_update (ajax)
		{	// Set the definition text.
			if ( (control = document.getElementById(this.id + "_def")) )
				{	control.innerHTML = "LOADING...";
				}; // if ( (control = document.getElementById(this.id + "_def")) )
		}; // function open_dictionary_box_ajax_update (ajax)

	// ------------------------------------------------------------------------------------------------------------------------

	/** This methods gets today's word.                                                                                     **/
	function open_dictionary_box_get_todays ()
		{	makeAJaxRequest("/daily/open_dict.xml", "GET", this); 
		}; // function open_dictionary_box_get_todays ()

	// ------------------------------------------------------------------------------------------------------------------------

	/** This methods sets the data to appear in an open dictionary box.                                                     **/
	function open_dictionary_box_render (entry, pspeech, submitted, def)
		{	// The next control to set.
			var control = false;

			// Set the entry text.
			if ( (control = document.getElementById(this.id + "_entry")) )
				{	control.innerHTML = "<a href=\"" + "http://www3.merriam-webster.com/opendictionary06/newword_search.php?word=" + entry + "\">" + entry + "</a>";
				}; // if ( (control = document.getElementById(this.id + "_entry")) )

			// Set the part of speech/pronunciation text.
			if ( (control = document.getElementById(this.id + "_pspeech")) )
				{	control.innerHTML = pspeech;
				}; // if ( (control = document.getElementById(this.id + "_pspeech")) )

			// Set the definition text.
			if ( (control = document.getElementById(this.id + "_def")) )
				{	var max_len			= isScreen800x600() ? 90 : 120;
					def					= chompText(def, max_len);
					def					= def.replace(/^:([^\s])/, ": $1");
					def					= ( def.substring(0, 1) != "<" && def.substring(0, 1) != ":" ) ? 
											( "<strong>:</strong> " + def ) : def;
					control.innerHTML	= def;
				}; // if ( (control = document.getElementById(this.id + "_def")) )

			// Set the submitted by field.
			if ( (control = document.getElementById(this.id + "_submitted")) )
				{	control.innerHTML = "Submitted by: " + submitted;
				}; // if ( (control = document.getElementById(this.id + "_submitted")) )

			// Set the more link.
			if ( (control = document.getElementById(this.id + "_def_link")) )
				{	control.href = "http://www3.merriam-webster.com/opendictionary06/newword_search.php?word=" + entry;
				}; // if ( (control = document.getElementById(this.id + "_def_link")) )
		}; // function open_dictionary_box_render (entry, pspeech, submitted, def)

	// ------------------------------------------------------------------------------------------------------------------------

	/** This methods sets the data to appear in an open dictionary box.                                                     **/
	function open_dictionary_box_set_data (headword, func, submitted_by, def)
		{	// Get the data values.
			/**
			var submitted	= data[0];
			var entry		= "techtorial";
			var pspeech		= "noun";
			var def			= ":A session of intensive technical tuition given by a tutor or an individual or to a small number of students.";

			// Render the data.
			this.render(entry, pspeech, submitted, def);
			**/

			// Render the data.
			this.render(headword, func, submitted_by, def);
		}; // function open_dictionary_box_set_data (headword, func, submitted_by, def)