+# This function makes sure that $str is in the list of options, and returns "" otherwise
+function format_options($str, $name) {
+ if(!isset($GLOBALS[$name . '_options'])) {
+ die("Couldn't find options for \"$name\". Be sure to call pulldown().");
+ }
+
+ foreach($GLOBALS[$name . '_options']['options'] as $keyval) {
+ list($key, $value) = $keyval;
+ if($str == $key) {
+ return $str;
+ }
+ }
+
+ return '';
+}
+