How to integrate facebook javascript sdk in our mobile app?
===

I am developing an app where i need to integrate facebook in it. When i click on **share via facebook** in app, the following picture needs to be post in facebook. The code i am using is

  index.html

        <section id="previewPage" data-role="page">
	<div id="fb-root"></div>
        <script>
         // window.fbAsyncInit = function() {
        FB.init({
       appId      : 'xxxxxxxxxx', // App ID
       channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

      // FB.Event.subscribe('auth.statusChange', handleStatusChange);
      //};
  
      // Load the SDK Asynchronously
       //(function(d){
        //  var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
      //  if (d.getElementById(id)) {return;}
      //  js = d.createElement('script'); 
	// js.id = id; 
	// js.async = true;
      // js.src = "//connect.facebook.net/en_US/all.js";
       // ref.parentNode.insertBefore(js, ref);
     // }(document));
    </script>
			<div data-role="content" id="previewId" class="previewScreen">
				<img id="previewImageId" height="270"/>				
			<div style="display:none">	
			<select name="sharingScreen" id="sharingId" class="sharingScreen" data-native-menu="false" style="display:none;">
				<option value="email">Share via Email</option>
				<option value="bbm">Share via BBM</option>
				<option value="sms">Share via SMS</option>
				<option value="facebook">Share via Facebook</option>
				<option value="twitter">Share via Twitter</option>
				<option value="google">Share via Google</option>
			</select>
			</div>
			
			</div>				
		</section>

sharing.js (which handles options menus in that page)

      $(".sharingScreen").change(function(){
         var page =$(this).val();
        if (page == "facebook")
        {
	//alert("this page is value   "  +   page);
    try
    {
        var pageURL = "xxxxxxxx";
        var shareLink = "xxxxxxxxxxxx";
         ALBM_PostToFB({
                          "status_code":200,
                          "data":{
                          "url":"xxxxxxxxxxxx"
                          }
            });
        
	}
    catch(e)
    {
		alert("11111"+e);
    }

      var ALBM_PostToFB = function ALBM_PostToFB(response) {
    try {
        var pageTitle = "wallpapers app";
        if(pageTitle == null) pageTitle = "wallpapers app";
        var pageURL = "xxxxxxxxxxxxxx";
		var shareLink = "xxxxxxxxxxxxxx";
        
        //logger.log("bitly response was "+response);
        if(response.status_code == 200 && response.data && response.data.url) {
            shareLink = response.data.url;
            //currentAlbumView.albumShareURL = shareLink;
        } else {
            alert('2222Post ID: ');
        }
        
        var shareText = 'Check out the created facebook sdk';
        

            var obj = {
                method: 'feed',
                link: shareLink,
                name: 'Check out "'+pageTitle+'" album',
                caption: 'Created by: ',
                description: "this is wallpapers app.......",
                //redirect_uri: pageURL+"?"+ALBUM_URL_SHARE_REDIRECT_KEY+"="+ALBUM_URL_SHARE_REDIRECT_VALUE
            };
            var FB_Post_Callback = function FB_Post_Callback(response) {
                if(response && response.post_id) logger.log("post to FB success, post id is "+response.post_id);
                else logger.logError("failed to post to FB stream "+response);
                return true;
            }
           // FB.ui(obj, FB_Post_Callback);
        

    } catch(e) {
        alert("333333"+e);
    }
     };

      }else
      {
	alert("this is not facebook");
      }
      });

Here i know that after initializing facebook directly i am writing code for post to facebook. can anyone please suggest me regarding login, authentication in facebook. 

What i mean is when clicks on **share via facebook** in options menu, facebook login needs to be opened & after login i need to share that particular image in that page....

As i am new to developing any help will be greatfull for me. 

Thanks in advance......