function set_form_defaults_from_query_string (frm) {

    var i, j, re, tmp, tmp2, ftbl;

    if (! window.scrollTo)
	// Easy way to tell if we're JavaScript 1.1 or lower
	return false;

    // Break down ?query part of URL string (if one exists)
    ftbl = new Object();
    if (location.search) {
	re = new RegExp ('\\\053', 'g');
	i = (location.search.charAt(0) == '?') ? 1 : 0;
	tmp = location.search.substring(i).split('&');
	for (i = 0; i < tmp.length; i++) {
            tmp2 = tmp[i].split('=');
            if (tmp2.length == 2 && tmp2[0] && tmp2[1]) {
		tmp2[1] = tmp2[1].replace(re, ' ');
		ftbl[unescape(tmp2[0])] = unescape(tmp2[1]);
	    }
	}
    }

    // Set frm fields to their defaults
    for (i = 0; i < frm.elements.length; i++) {
	tmp = frm.elements[i];
	if (tmp.name && ftbl[tmp.name]) {
	    //
	    // select would be nicer here, but Netscape 3.x doesn't
	    // parse the file correctly if we use it
	    //
	    if (tmp.type == 'checkbox') {
		// don't change checkbox value; just mark it checked
		tmp.checked = true;
	    }
	    else if (tmp.type == 'password') {
		// no default; password values must always be typed in
		true;
	    }
	    else if (tmp.type == 'radio') {
		// like checkboxes above, don't change radio button values
		if (tmp.value == ftbl[tmp.name])
		    tmp.checked = true;
	    }
	    else if (tmp.type.indexOf ('select') != -1) {
		//
		// SELECT tags have no values; to get to the VALUEs, you
		// have to examine each OPTION tag (option tags, by way of
		// contrast, have no NAMEs)
		//
		for (j = 0; j < tmp.options.length; j++) {
		    tmp2 = tmp.options[j];
		    tmp2.selected = (tmp2.value == ftbl[tmp.name]) ? true : false;
		    if (tmp2.selected)
			break;
		}
	    }
	    else {
		// for all others (INPUT, TEXTAREA, etc.) just re-use the old
		// value; i.e., let the old value act as the default
		tmp.value = ftbl[tmp.name];
	    }
	}
    }

    if (i > 0)
	// If we've done any screwing with the form, make sure we're at top
	window.scrollTo (0,0);

    return i; 

}

window.all_loaded_up = 1;
