function getXMLHTTPRequest(){
	var request = false;
	try{
		request = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(err1){
		try{
			request = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(err2){
			request = false;
		}
	}//end of catch

	if(!request && typeof XMLHttpRequest != 'undefined'){
		request = new XMLHttpRequest();
	}
	return request;
}//end of getXMLHTTPRequest()

function makerequest(objID, para) {
	objReq = getXMLHTTPRequest();
	var obj = document.getElementById(objID);
	objReq.open("GET", para);
	objReq.onreadystatechange = function() {
		if (objReq.readyState == 4 && objReq.status == 200) {
			obj.innerHTML = objReq.responseText;
		}
	}
	objReq.send(null);
}
//Function to process an XMLHttpRequest.
function processajax (serverPage, obj, getOrPost, str){
	//Get an XMLHttpRequest object for use.
	xmlhttp = getxmlhttp ();
	if (getOrPost == "get"){
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	} 
	else{
		xmlhttp.open("POST", serverPage, true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(str);
	}
}
//document.getElementById(objID).focus()
//Functions to submit a form.
function getformvalues (fobj, valfunc){
	var str = "";
	aok = true;
	var val;
	//Run through a list of all objects contained within the form.
	for(var i = 0; i < fobj.elements.length; i++){
		if(valfunc) {
			if (aok == true){
				val = valfunc (fobj.elements[i].value,fobj.elements[i].name);
				if (val == false){
					aok = false;
				}
			}
		}
		str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
	}
	//Then return the string values.
	return str;
}
function submitform (theform, serverPage, objID, valfunc){
	var file = serverPage;
	var str = getformvalues(theform,valfunc);
	//If the validation is ok.
	if (aok == true){
		obj = document.getElementById(objID);
		processajax (serverPage, obj, "post", str);
	}
}
//functions.js
function trim (inputString) {
	// Removes leading and trailing spaces from the passed string. Also removes
	// consecutive spaces and replaces them with one space. If something besides
	// a string is passed in (null, custom object, etc.), then return the input.
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { // Check for spaces at the beginning of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf(" ") != -1) {
		// Note there are two spaces in the string
		// Therefore look for multiple spaces in the string
		retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length);
		// Again, there are two spaces in each of the strings
	}
	return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function