diff -urp /Users/vectoroc/Desktop/fb_social/fb_social.admin.inc ../fb_social/fb_social.admin.inc
--- /Users/vectoroc/Desktop/fb_social/fb_social.admin.inc	2010-09-08 04:10:44.000000000 +0400
+++ ../fb_social/fb_social.admin.inc	2010-10-06 15:13:58.000000000 +0400
@@ -6,11 +6,34 @@
 /**
  * Settings form for global fb_social custimazation 
  */
-function fb_social_settings_form(){
+function fb_social_settings_form($form_state){
   $languages = language_list();
-
+  $fb_social_fb_php_sdk = variable_get('fb_social_fb_php_sdk', 0);
+  if (isset($form_state['values'])) {
+    $fb_social_fb_php_sdk = $form_state['values']['fb_social_fb_php_sdk'];
+  }
+  
   $form = array();
-  $form['fb_social_appid'] = array(
+  $form['fb_social_fb_php_sdk'] = array(
+    '#type' => 'radios',
+    '#title' => t('Are you using other facebook modules'),
+    '#default_value' => variable_get('fb_social_fb_php_sdk', 0),
+    '#options' => array(t('Not Using other modules'), t('Drupal for facebook 6.x-3.x'), t('fbconnect 6.x-2.x')),
+    '#ahah' => array(
+      'path' => 'admin/settings/fb/social/settings-ahah',
+      'wrapper' => 'fb_social_settings_ahah_wrapper',
+      'method' => 'replace',
+    ),
+  );
+
+  //Display textfields when first option is selected
+  $form['wrapper'] = array(
+    '#value'  => '<div id="fb_social_settings_ahah_wrapper">',
+    '#suffix' => '</div>',
+  );
+    
+  if ($fb_social_fb_php_sdk == 0) {
+    $form['wrapper']['fb_social_appid'] = array(
       '#title' => t('Facebook application id'), 
       '#type' => 'textfield', 
       '#description' => t('<p> Register your application on Facebook to get a Facebook App Id: !url.</p>
@@ -20,7 +43,8 @@ function fb_social_settings_form(){
           '!url' => l('register here', 'http://developers.facebook.com/setup/') 
       )), 
       '#default_value' => variable_get('fb_social_appid', '') 
-  );
+    );    
+  }
   
   $form['fb_social_locale'] = array(
       '#title' => t('Default facebook application locale'), 
@@ -92,4 +116,29 @@ function _get_facebook_locale(){
     $fb_locale = unserialize($cache->data);
   }
   return $fb_locale;
+}
+
+function fb_social_settings_form_ahah() {
+  $form_state = array('storage' => NULL, 'submitted' => FALSE);
+  $form_build_id = $_POST['form_build_id'];
+  $form = form_get_cache($form_build_id, $form_state);
+  
+  $args = $form['#parameters'];
+  $form_id = array_shift($args);
+  $form_state['post'] = $form['#post'] = $_POST;
+  $form['#programmed'] = $form['#redirect'] = FALSE;
+  
+  $form['#submit'] = array();
+  
+  drupal_process_form($form_id, $form, $form_state);
+  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
+    
+  $output = theme('status_messages') . drupal_render($form['wrapper']);
+
+  // render form output as JSON
+  print drupal_to_js(array('data' => $output, 'status' => TRUE));
+  
+  // exit to avoid rendering the theme layer
+  exit();
+  
 }
\ No newline at end of file
diff -urp /Users/vectoroc/Desktop/fb_social/fb_social.module ../fb_social/fb_social.module
--- /Users/vectoroc/Desktop/fb_social/fb_social.module	2010-10-05 03:54:40.000000000 +0400
+++ ../fb_social/fb_social.module	2010-10-06 15:19:17.000000000 +0400
@@ -33,11 +33,40 @@ function fb_social_menu(){
     'weight' => -10,
   );  
   
+  $items['admin/settings/fb/social/settings-ahah'] = array(
+    'title' => t('AHAH Form Callback'),
+    'page callback' => 'fb_social_settings_form_ahah',
+    'access arguments' => array('administer site configuration'),
+    'type' => MENU_CALLBACK,
+    'file' => 'fb_social.admin.inc',
+  );
+  
   return $items;
 }
 
 
 /**
+ * Implementation of hook_init(). 
+ */
+function fb_social_init(){
+  $_facebook_sdk = NULL;
+  if (variable_get('fb_social_fb_php_sdk', 0) == 1) {
+    // check if fb module is enabled.
+    if (isset($_fb) && !empty($_fb)) {
+      $_facebook_sdk = $_fb;
+    } 
+  }
+  elseif (variable_get('fb_social_fb_php_sdk', 0) == 2) {
+    $_facebook_sdk = facebook_client();    
+  }
+  
+  if ($_facebook_sdk) {
+    $GLOBALS['conf']['fb_social_appid'] = $_facebook_sdk->getAppId();
+  }
+  
+}
+
+/**
  * Implementation of hook_footer
  */
 function fb_social_footer($main = 0) {
