diff --git a/src/webim/images/en/search.gif b/src/webim/images/en/search.gif
new file mode 100644
index 00000000..69554f97
Binary files /dev/null and b/src/webim/images/en/search.gif differ
diff --git a/src/webim/images/nextpage.gif b/src/webim/images/nextpage.gif
new file mode 100644
index 00000000..8da5c630
Binary files /dev/null and b/src/webim/images/nextpage.gif differ
diff --git a/src/webim/images/prevpage.gif b/src/webim/images/prevpage.gif
new file mode 100644
index 00000000..e5479366
Binary files /dev/null and b/src/webim/images/prevpage.gif differ
diff --git a/src/webim/images/ru/search.gif b/src/webim/images/ru/search.gif
new file mode 100644
index 00000000..a7ebb1b8
Binary files /dev/null and b/src/webim/images/ru/search.gif differ
diff --git a/src/webim/operator/getcode.php b/src/webim/operator/getcode.php
index 9fc1e43f..f7462f9f 100644
--- a/src/webim/operator/getcode.php
+++ b/src/webim/operator/getcode.php
@@ -17,18 +17,43 @@ require('../libs/operator.php');
$operator = check_login();
-$lang = verifyparam("lang", "/^\w\w$/", "");
-if( !$lang || !in_array($lang,$available_locales) )
- $lang = $current_locale;
+// collect available images and locales
+$imageLocales = array();
+$imagesDir = '../images/webim';
+if($handle = opendir($imagesDir)) {
+ while (false !== ($file = readdir($handle))) {
+ if (preg_match("/^(\w+)_([\w-]+)_on.gif$/", $file, $matches)
+ && is_file("$imagesDir/".$matches[1]."_".$matches[2]."_off.gif")) {
+ $image = $matches[1];
+ if( !isset($imageLocales[$image]) ) {
+ $imageLocales[$image] = array();
+ }
+ $imageLocales[$image][] = $matches[2];
+ }
+ }
+ closedir($handle);
+}
-$file = "../images/webim/webim_${lang}_on.gif";
+$image = verifyparam("image","/^\w+$/", "webim");
+$image_locales = $imageLocales[$image];
+
+$lang = verifyparam("lang", "/^\w\w$/", "");
+if( !$lang || !in_array($lang,$image_locales) )
+ $lang = in_array($current_locale,$image_locales) ? $current_locale : $image_locales[0];
+
+$file = "../images/webim/${image}_${lang}_on.gif";
$size = get_gifimage_size($file);
-$message = get_image("/webim/button.php?lang=$lang",$size[0],$size[1]);
+$message = get_image("/webim/button.php?image=$image&lang=$lang",$size[0],$size[1]);
$page = array();
$page['operator'] = get_operator_name($operator);
$page['buttonCode'] = generate_button("",$lang,$message);
+$page['availableImages'] = array_keys($imageLocales);
+$page['availableLocales'] = $image_locales;
+
+$page['formimage'] = $image;
+$page['formlang'] = $lang;
start_html_output();
require('../view/gen_button.php');
diff --git a/src/webim/view/gen_button.php b/src/webim/view/gen_button.php
index 0d48c388..6578b594 100644
--- a/src/webim/view/gen_button.php
+++ b/src/webim/view/gen_button.php
@@ -51,19 +51,34 @@
-
-
-
-
+