// Class Definitions ----------------------------------------------------------------------------------------------------------

	function WordOfTheDayBox (id)
		{	this.id = id;
		}; // class WordOfTheDayBox (id)

	WordOfTheDayBox.prototype.getTodaysWord	= word_of_the_day_box_get_todays;
	WordOfTheDayBox.prototype.render		= word_of_the_day_box_render;
	WordOfTheDayBox.prototype.setData		= word_of_the_day_box_set_data;
	WordOfTheDayBox.prototype.onAJaxSuccess	= word_of_the_day_box_ajax_success;
	WordOfTheDayBox.prototype.onAJaxFailure	= word_of_the_day_box_ajax_failure;
	WordOfTheDayBox.prototype.onAJaxUpdate	= word_of_the_day_box_ajax_update;

// Method Definitions ---------------------------------------------------------------------------------------------------------

	function word_of_the_day_box_ajax_failure (ajax)
		{	this.setData("wordulous", "adjective", "Anonymous", ": given to inventing creative new words because one's large vocabulary needs sustenance");
		}; // function word_of_the_day_box_ajax_failure (ajax)

	// ------------------------------------------------------------------------------------------------------------------------

	function word_of_the_day_box_ajax_success (ajax)
		{	// Get the XML document root node.
			var xml	= ajax.responseXML;
			var xml	= xml.getElementsByTagName("wod");
			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 pronunciation.
			data			= xml? xml.getElementsByTagName("pronunc") : false;
			data			= data ? data.item(0) : false;
			var pronunc		= data && data.firstChild ? data.firstChild.nodeValue : "";

			// Get the definition.
			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+$/, "");

			// Set the data.
			this.setData(headword, func, pronunc, def, pub_date);
		}; // function word_of_the_day_box_ajax_success (ajax)

	// ------------------------------------------------------------------------------------------------------------------------

	function word_of_the_day_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 word_of_the_day_box_ajax_update (ajax)

	// ------------------------------------------------------------------------------------------------------------------------

	/** This methods gets today's word.                                                                                     **/
	function word_of_the_day_box_get_todays ()
		{	makeAJaxRequest("/word/content/daily/active.xml", "GET", this); 
		}; // function word_of_the_day_box_get_todays ()

	// ------------------------------------------------------------------------------------------------------------------------

	/** This methods sets the data to appear in a word of the day box.                                                      **/
	function word_of_the_day_box_render (entry, pspeech, pronunc, def, date)
		{	// The next control to set.
			var control = false;

			// Set the entry text.
			if ( (control = document.getElementById(this.id + "_entry")) )
				{	control.innerHTML = "<a href=\"/cgi-bin/mwwod.pl\">" + 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 = "\\" + pronunc + "\\ " + 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.substring(0, 1) != "<" && def.substring(0, 1) != ":" ) ? 
											( "<strong>:</strong> " + def ) : def;
					control.innerHTML	= def;
				}; // if ( (control = document.getElementById(this.id + "_def")) )

			// Set the entry date.
			if ( (control = document.getElementById(this.id + "_date")) )
				{	var date_values		= date.split("/");
					var month			= date_values[0];
					var day				= date_values[1];
					var year			= date_values[2];
					month				= month.replace(/^0/, "");
					var months			= Array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
					month				= months[parseInt(month)];
					control.innerHTML	= month + " " + day + ", " + year;
				}; // if ( (control = document.getElementById(this.id + "_entry")) )
		}; // function word_of_the_day_box_render (entry, pspeech, pronunc, def, date)

	// ------------------------------------------------------------------------------------------------------------------------

	/** This methods sets the data to appear in a word of the day box.                                                      **/
	function word_of_the_day_box_set_data (entry, pspeech, pronunc, def, date)
		{	this.render(entry, pspeech, pronunc, def, date);
		}; // function word_of_the_day_box_set_data (data)
