function alterselectboxfromarray(form, field, parent, arrayname, defaultlabel) {

    // delete current entries
    eval ("var nr = document." + form + "." + field + ".length");
    if (nr > 0) {
        for (i = nr-1; i>=0; i--) eval("document." + form + "." + field + ".options[i] = null");
    }


    // initialize some variables
    var j = 0;
    var place = 0;

    // default entry
    newEntry = new Option(defaultlabel,'',true,true);
    eval ("document." + form + "." + field + ".options[0] = newEntry");


    // which items children to display?

    // (1) get the parent

    if (arguments.length == "5") {
	eval ("var idx = document." + form + "." + parent + ".options.selectedIndex");
	eval ("var the_value = document." + form + "." + parent + ".options[idx].value");
    } else {
	var the_value = arguments[5];
    }

    // any children at all?
    the_length = eval(arrayname + the_value + ".length");

    var noption = "";

    if (the_length > 0) {

        // (4) loop 'em!
        for (i=0; i<the_length; i++) {

				      noption =  eval(arrayname + the_value + "[i].split('|')");
				      
				      // (4a) new option, not default, not selected
				      newEntry = new Option(wong_escape(noption[1]),noption[0]);
				      eval ("document." + form + "." + field + ".options[i+1] = newEntry");
				      if (arguments.length == 7 && arguments[6] == noption[0]) eval ("document." + form + "." + field + ".options[i+1].selected = true");				      
				  }



    }

    return

}


function wong_escape(the_vals) {

    the_vals = the_vals.replace(/&uuml\;/g,"ü");
    the_vals = the_vals.replace(/&auml\;/g,"ä");
    the_vals = the_vals.replace(/&ouml\;/g,"ö");
    return the_vals;

}

