diff -upr vkxp.dev/vkxp.admin.inc vkxp/vkxp.admin.inc
--- vkxp.dev/vkxp.admin.inc	2012-02-02 16:15:18.000000000 +0400
+++ vkxp/vkxp.admin.inc	2012-05-04 21:03:43.067467664 +0400
@@ -147,7 +147,11 @@ function vkxp_admin_main_settings_submit
     $params['redirect_uri'] = url('admin/config/services/vkxp/main', array('absolute' => TRUE));
     $params['response_type'] = 'code';
     $data = http_build_query($params, '', '&');
-    $url = 'http://api.vkontakte.ru/oauth/authorize?' . $data;
+    $url = 'http://oauth.vk.com/authorize?' . $data;
+    if (module_exists('overlay') && overlay_get_mode() !== 'none') {
+      overlay_close_dialog($url);
+      overlay_deliver_empty_page();
+    }
     drupal_goto($url);
   }
 
diff -upr vkxp.dev/vkxp.js vkxp/vkxp.js
--- vkxp.dev/vkxp.js	2012-02-02 16:15:18.000000000 +0400
+++ vkxp/vkxp.js	2012-05-05 02:16:08.012418790 +0400
@@ -3,6 +3,12 @@
 Drupal.behaviors.vkxp = {
   attach: function (context, settings) {
 
+    // Make sure this behavior is not processed more than once.
+    if (this.processed) {
+      return;
+    }
+    this.processed = true;
+
     $.getScript('http://vk.com/js/api/openapi.js', function() {
 
       // Initialize Open API.
diff -upr vkxp.dev/vkxp.module vkxp/vkxp.module
--- vkxp.dev/vkxp.module	2012-02-02 16:15:18.000000000 +0400
+++ vkxp/vkxp.module	2012-05-05 02:13:00.563489312 +0400
@@ -121,12 +121,12 @@ function vkxp_node_update($node) {
 function vkxp_init() {
 
   // Check user session for vkxp scripts.
-  if (isset($_SESSION['vkxp']) && sizeof($_SESSION['vkxp']) > 0) {
+  if (!(isset($_REQUEST['render']) && $_REQUEST['render'] == 'overlay') && isset($_SESSION['vkxp']) && sizeof($_SESSION['vkxp']) > 0) {
 
     // Get script for the first node in the user session.
     $script = array_shift($_SESSION['vkxp']);
     $app_id = variable_get('vkxp_app_id', '');
-
+    
     // Add settings for crossposting to the page.
     drupal_add_js(
       array('vkxp' =>
@@ -140,6 +140,7 @@ function vkxp_init() {
       ), 'setting');
 
     // Add js for Open API jquery to vk.com.
+    //drupal_add_js(drupal_get_path('module', 'vkxp') . '/vkxp.js');
     drupal_add_js(drupal_get_path('module', 'vkxp') . '/vkxp.js');
   }
 }
@@ -251,7 +252,7 @@ function _vkxp_process_node($node) {
  * Function makes query to vk.com.
  * Allows using hook_vkxp_query_alter() for altering query params.
  */
-function vkxp_query($method, $params, $request_url = 'https://api.vkontakte.ru/method/') {
+function vkxp_query($method, $params, $request_url = 'https://api.vk.com/method/') {
 
   // Collect query data.
   $query = array();
