	
	
	//Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;
	
	//Check if we are using IE.
	try {
		//If the Javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using MS.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	
	/*
	var xmlhttp;
	
	//If, the activexobject is available, we must be using IE.
	if (window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		//Else, we can use the native Javascript handler.
		xmlhttp = new XMLHttpRequest();
	}
	*/
	function place(text, place){
		
		var place=document.getElementById(place);
		place.innerHTML = text;
	}
	
	function makerequest(serverPage, objID) {
		var obj = document.getElementById(objID);
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}

		//Function to create a new div element.
	function createDiv (theid){
		//Initiate the variable.
		var mydiv;
			
		//Create the div.
		mydiv = document.createElement("div");
		
		//Set the div's class.
		mydiv.className = "newdiv";
		
		//Add a label to the element.
		mydiv.innerHTML = "Click Me To Change Color";
		
		//Setup an event listener.
		mydiv.onclick = function () { changeColor (this, 'newdivgreen'); };
		
		//Assign the element a unique id.
		mydiv.id = theid;
		
		//This is how to do it using the addEventHandler method.
		//mydiv.addEventListener ('click',function () { changeColor (this, '#00FF00'); }, false);
		
		//Append the div to the body.
		document.body.appendChild (mydiv);
	}
	
	//Function to change an object's color.
	function changeColor (theObj,theClass){
		//Check to ensure the object exists.
		if (theObj){
			//Change the color.
			theObj.className = theClass;
			//theObj.setAttribute ('class',theClass);
		}
	}
	
	//Function to remove an element.
	function removeElement (theid){
		//Check to ensure the element exists.
		theObj = document.getElementById(theid);
		if (theObj){
			theObj.parentNode.removeChild (theObj);
		}
	}
	
	//The number of rows.
	var numRows = 3;
	//The number of columns.
	var numCols = 3;
	
	//Function to create a table.
	function createTable (theid){
				
		var myTable;
		
		//Create the table.
		myTable = document.createElement ("table");
		myTable.className = "tableclass";
		myTable.border = 1;
		myTable.cellpadding = 4;
		myTable.width = "100%";
		myTable.id = theid;
		
		//Add the table.
		document.body.appendChild (myTable);
		
		//Then cycle through the number of rows.
		for (var i = 0; i < numRows; i++){
			var newTr;
			//Find the current number of rows.
			var curRows = myTable.getElementsByTagName("tr").length;
			//Create a new row.
			newTr = myTable.insertRow (curRows);
			newTr.style.height = "30px";
			//Now, create an appropriate number of columns.
			for (var j = 0; j < numCols; j++){
				//Create a new column.
				var myTd;
				myTd = document.createElement ("td");
				myTd.style.width = "20%";
				//Add a "remove" button in the first element of each row.
				if (j == 0){
					myTd.innerHTML = "Click to Remove";
					myTd.onclick = function () { removeRow (myTable, this.parentNode.rowIndex); };
				}
				//Add the column to the listing.
				newTr.appendChild (myTd);
			}
		}
	}
	
	//Function to remove a row.
	function removeRow (theTable, theIndex){
		//Make sure the element exists.
		if (theTable){
			//Remove the row at the selected index.
			theTable.deleteRow (theIndex);
		}
	}
	
	//Function to add a row.
	function addRow (theTable){
		var theObj = document.getElementById(theTable);
		//Check to ensure the object exists.
		if (theObj){
			//Add a new row to the end.
			newTr = theObj.insertRow (theObj.getElementsByTagName("tr").length);
			newTr.style.height = "30px";
			//Then add the columns.
			for (var j = 0; j < numCols; j++){
				//Create a new column.
				var myTd;
				myTd = document.createElement ("td");
				myTd.style.width = "20%";
				//Add a "remove" button in the first element of each row.
				if (j == 0){
					myTd.innerHTML = "Click to Remove";
					myTd.onclick = function () { removeRow (theObj, this.parentNode.rowIndex); };
				}
				//Add the column to the listing.
				newTr.appendChild (myTd);
			}
		}
	}
		function clear(theelement){
			document.getElementById(theelement).innerHTML ="";
		}
		function grabword (theelement, serverPage){
		//If there is nothing in the box, run AJAX to populate it.
		if (document.getElementById(theelement).innerHTML.length == 0){
			//Change the background color.
			document.getElementById(theelement).style.background = "#CCCCCC";
			var obj = document.getElementById(theelement);
			xmlhttp.open("POST", serverPage);
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					obj.innerHTML = xmlhttp.responseText;
				}
			}
			xmlhttp.send(null);
		} else {
			//Change the background color.
			document.getElementById(theelement).style.background = "#FFFFFF";
			//If the box is already populated, clear it.
			document.getElementById(theelement).innerHTML = "";
		}
	}
