+function add_edit_combo($combo_name,$url,$key_param='',$restrict_pages='')
+{
+ global $path_to_root, $page_security;
+
+ // Derive theme path
+ $theme_path = $path_to_root . '/themes/' . user_theme();
+
+ // Check if $url already has other parameters
+ if ($key_param) {
+ $key_param = ((strpos($url,'?')) ? '&' : '?') . $key_param;
+ }
+
+ $return_url = ($key_param) ? "<a target = '_blank' href='$url${key_param}=' onclick=\"javascript:var combo_id=document.forms[0].$combo_name;openWindow(this.href+combo_id.options[combo_id.selectedIndex].value,this.target); return false;\" tabindex='-1'><img width='16' height='16' border='0' alt='Add/Edit' title='Add/Edit' src='$theme_path/images/".ICON_EDIT."'></a>" : "<a target = '_blank' href='$url${key_param}' onclick=\"javascript:openWindow(this.href,this.target); return false;\" tabindex='-1'><img width='16' height='16' border='0' alt='Add/Edit' title='Add/Edit' src='$theme_path/images/".ICON_EDIT."'></a>";
+
+ // Don't pass edit button code If restrict_pages contains instructions but fails security check
+ if ($restrict_pages && strpos($restrict_pages, $page_security) === false) {
+ return '';
+ }
+
+ return $return_url;
+}
+