//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, objID, "POST", str);
	}
}
