diff --git a/src/messenger/webim/js/164/chat.js b/src/messenger/webim/js/164/chat.js
index c29c3d2f..c96c5396 100644
--- a/src/messenger/webim/js/164/chat.js
+++ b/src/messenger/webim/js/164/chat.js
@@ -13,7 +13,7 @@ this.handleKeyDown.bind(this),this._options.message.onfocus=function(){this.focu
"act="+a+"&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0)+"&lastid="+(this._options.lastid||0);this._options.user&&(this._options.parameters+="&user=true");a=="refresh"&&this._options.message&&this._options.message.value!=""&&(this._options.parameters+="&typed=1")},enableInput:function(a){if(this._options.message)this._options.message.disabled=!a},stopUpdate:function(){this.enableInput(!0);if(this.updater._options)this.updater._options.onComplete=void 0;clearTimeout(this.timer)},
update:function(){this.updateOptions("refresh");this.updater=new Ajax.Request(this._options.servl,this._options)},requestComplete:function(a){try{this.enableInput(!0);this.cansend=!0;var b=Ajax.getXml(a);b&&b.tagName=="thread"?this.updateContent(b):this.handleError(a,b,"refresh messages failed")}catch(c){}this.skipNextsound=!1;this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)},postMessage:function(a){if(a!=""&&this.cansend){this.cansend=!1;this.stopUpdate();this.skipNextsound=!0;this.updateOptions("post");
var b={}.extend(this._options);b.parameters+="&message="+encodeURIComponent(a);b.onComplete=function(a){this.requestComplete(a);if(this._options.message)this._options.message.value="",this._options.message.focus()}.bind(this);myRealAgent!="opera"&&this.enableInput(!1);this.updater=new Ajax.Request(this._options.servl,b)}},changeName:function(a){this.skipNextsound=!0;new Ajax.Request(this._options.servl,{parameters:"act=rename&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0)+
-"&name="+encodeURIComponent(a)})},onThreadClosed:function(a){var b=Ajax.getXml(a);b&&b.tagName=="closed"?setTimeout("window.close()",2E3):this.handleError(a,b,"cannot close")},closeThread:function(){var a="act=close&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0);this._options.user&&(a+="&user=true");new Ajax.Request(this._options.servl,{parameters:a,onComplete:this.onThreadClosed.bind(this)})},processMessage:function(a,b){var c=NodeUtils.getNodeText(b);FrameUtils.insertIntoFrame(a,
+"&name="+encodeURIComponent(a)})},onThreadClosed:function(a){var b=Ajax.getXml(a);b&&b.tagName=="closed"?setTimeout("window.close()",2E3):this.handleError(a,b,"cannot close")},closeThread:function(){if(!confirm(localized[0]))return!1;var a="act=close&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0);this._options.user&&(a+="&user=true");new Ajax.Request(this._options.servl,{parameters:a,onComplete:this.onThreadClosed.bind(this)})},processMessage:function(a,b){var c=NodeUtils.getNodeText(b);FrameUtils.insertIntoFrame(a,
c)},showTyping:function(a){if($("typingdiv"))$("typingdiv").style.display=a?"inline":"none"},setupAvatar:function(a){a=NodeUtils.getNodeText(a);if(this._options.avatar&&this._options.user)this._options.avatar.innerHTML=a!=""?'':""},updateContent:function(a){var b=!1,c=this._options.container,d=NodeUtils.getAttrValue(a,"lastid");if(d)this._options.lastid=d;(d=NodeUtils.getAttrValue(a,
"typing"))&&this.showTyping(d=="1");if((d=NodeUtils.getAttrValue(a,"canpost"))&&(d=="1"&&!this.ownThread||this.ownThread&&d!="1"))window.location.href=window.location.href;for(d=0;d=0?(a="updated",this.lastupdate>0&&(c=((new Date).getTime()-this.lastupdate)/1E3,a=a+", "+c+" secs",c>10&&alert(a)),this.lastupdate=(new Date).getTime(),
this.setStatus(a)):this.clearStatus();b&&(FrameUtils.scrollDown(this._options.container),this.skipNextsound||(b=$("soundimg"),(b==null||b.className.match(/\bisound\b/))&&playSound(Chat.webimRoot+"/sounds/new_message.wav")),this.focused||window.focus())},isSendkey:function(a,b){return b==13&&(a||this._options.ignorectrl)||b==10},handleKeyDown:function(a){a?(ctrl=a.ctrlKey,a=a.which):(a=event.keyCode,ctrl=event.ctrlKey);if(this._options.message&&this.isSendkey(ctrl,a))return a=this._options.message.value,
diff --git a/src/messenger/webim/js/source/chat.js b/src/messenger/webim/js/source/chat.js
index 1e565fe1..5a3f8ae2 100644
--- a/src/messenger/webim/js/source/chat.js
+++ b/src/messenger/webim/js/source/chat.js
@@ -177,6 +177,9 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
},
closeThread: function() {
+ if(! confirm(localized[0])){
+ return false;
+ }
var _params = 'act=close&thread=' + (this._options.threadid || 0) + '&token=' + (this._options.token || 0);
if( this._options.user )
_params += "&user=true";
diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php
index 4c3680f4..5b511ea2 100644
--- a/src/messenger/webim/libs/chat.php
+++ b/src/messenger/webim/libs/chat.php
@@ -370,6 +370,7 @@ function setup_chatview_for_user($thread, $level)
$page['ct.user.name'] = htmlspecialchars(topage($thread['userName']));
$page['canChangeName'] = $settings['usercanchangename'] == "1";
$page['chat.title'] = topage($settings['chattitle']);
+ $page['chat.close.confirmation'] = getlocal('chat.close.confirmation');
setup_logo();
if ($settings['sendmessagekey'] == 'enter') {
diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties
index cccf52cd..580a0414 100644
--- a/src/messenger/webim/locales/en/properties
+++ b/src/messenger/webim/locales/en/properties
@@ -41,6 +41,7 @@ chat.client.changename=Change name
chat.client.name=You are
chat.client.spam.prefix=[spam]
chat.client.visited.page=Visitor navigated to {0}
+chat.close.confirmation=Are you sure want to leave chat?
chat.default.username=Guest
chat.error_page.close=Close...
chat.error_page.head=Error occurred:
diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties
index 8b52f824..64825104 100644
--- a/src/messenger/webim/locales/ru/properties
+++ b/src/messenger/webim/locales/ru/properties
@@ -41,6 +41,7 @@ chat.client.changename=
chat.client.name=Вы
chat.client.spam.prefix=[спам]
chat.client.visited.page=Посетитель перешел на {0}
+chat.close.confirmation=Вы действительно хотите покинуть диалог?
chat.default.username=Посетитель
chat.error_page.close=Закрыть...
chat.error_page.head=Произошла ошибка:
diff --git a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
index dbc777d3..1b4e2186 100644
--- a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
+++ b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
@@ -7,6 +7,9 @@
diff --git a/src/messenger/webim/styles/dialogs/original/templates/chat.tpl b/src/messenger/webim/styles/dialogs/original/templates/chat.tpl
index df7b1327..981f5aec 100644
--- a/src/messenger/webim/styles/dialogs/original/templates/chat.tpl
+++ b/src/messenger/webim/styles/dialogs/original/templates/chat.tpl
@@ -7,6 +7,9 @@
diff --git a/src/messenger/webim/styles/dialogs/silver/templates/chat.tpl b/src/messenger/webim/styles/dialogs/silver/templates/chat.tpl
index 1b0cc856..12549803 100644
--- a/src/messenger/webim/styles/dialogs/silver/templates/chat.tpl
+++ b/src/messenger/webim/styles/dialogs/silver/templates/chat.tpl
@@ -9,6 +9,9 @@