//set the specified select box's value to the passed-in value
function selectBoxValue(box,val)
{
	for (var i=0; i<box.options.length; ++i)
	{
		if (box.options[i].value == val)
			box.selectedIndex = i;
	}
}

//resets all the elements in the form to neutral values
function resetForm(theForm)
{
	for (var i=0; i<theForm.elements.length; ++i)
	{
		if (theForm.elements[i].type == "text")
			theForm.elements[i].value = "";
		else if (theForm.elements[i].type.substr(0,6) == "select")
			theForm.elements[i].selectedIndex = 0;
	}
}

//constructs a url parameter string out of an assoc. array
function arrayToString(theArray)
{
	var msg = "";
	for (var field in theArray)
	{
		msg += field + "=" + escape(theArray[field]) + "&"
	}
	return msg;
}