// Requires ajax.js.

// theform is the form name.
// serverPage is the page to process the form.
function submitform (theform, serverPage, viewlocation){
   // Call getformvalues and send theform name.
   var str = getformvalues(theform);
   // Send navigation request.
   processajax(serverPage, "post", str, viewlocation);
}

// Processes form elements producing a string of the id's and values.
function getformvalues (fobj) {
	var str = "";
	var wrote = 0;
	for(var i = 0; i < fobj.elements.length; i++){       
		if (fobj.elements[i].type == "checkbox"){
			if (fobj.elements[i].checked == true){
				if (wrote == 1){
					str += "&";
				} else {
					wrote = 1;
				}
				str += fobj.elements[i].id + "=" + escape(fobj.elements[i].value);
			}
		} else {
			if (wrote == 1){
				str += "&";
			} else {
				wrote = 1;
			}
			str += fobj.elements[i].id + "=" + escape(fobj.elements[i].value);
			
		}
	}
	return str;
}