// JavaScript Document
function login(){
FB.login(function(response) {
  if (response.session) {
    if (response.perms) {
      // user is logged in and granted some permissions.
      // perms is a comma separated list of granted permissions // response.perms
	  get_user_id();
    } else {
      // user is logged in, but did not grant any permissions

    }
  } else {
    // user is not logged in
  }
}, {perms:'email,read_stream,publish_stream,offline_access'});
	  }

function onFBConnected(){
var api = FB.Facebook.apiClient;
var uid = [api.get_session().uid];
var fields = ["name"];
api.users_getInfo(uid, fields, function(result){

	alert(result[0].name);    	

});
}
/*function share(flash_message_title,flash_message_description,flash_image_title,flash_message_link) {
alert(flash_message_title);
    var message_title = flash_message_title;
    var userPrompt = "CHRONORA swiss watches and jewelery";
    var hrefLink = "http://www.chronora.com/";
    var hrefTitle = "CHRONORA swiss watches and jewelery";
    var message_caption = "";
    var message_description = flash_message_description;
	var image_src= "http://www.chronora.com/images/"+flash_image_title;
	var image_link= "http://www.chronora.com/"+flash_message_link;
    FB.ui(
         {

             method: 'stream.publish',
             message: message_title,
             display: 'dialog',
             attachment: {
                 name: hrefLink,
                 caption: message_caption,
                 description: (
                    message_description
                   ),
                 href: hrefLink,
				 media: [{ type: 'image', src: image_src, href: image_link}]				 
             },
             action_links: [
                    { text: message_title, href: message_link }
                 ],

             user_message_prompt: userPrompt
         },
               function(response) {
                   if (response && response.post_id) {
                       //  alert('Post published successfully.');
                   } else {
                       // alert('Post was not published.');
                   }
               }
             );
}*/

function shareKeepUp(flash_message_title,flash_message_description,flash_image_title,flash_message_link){
	
    var message_title = flash_message_title;
    var userPrompt = "CHRONORA swiss watches and jewelery";
    var hrefLink = flash_message_link;
    var hrefTitle = "CHRONORA swiss watches and jewelery";
    var message_caption = flash_message_title;
    var message_description = flash_message_description;
	var image_src= flash_image_title;
	var image_link= flash_message_link;
    FB.ui(
         {
             method: 'stream.publish',
             message: message_title,
             display: 'dialog',
             attachment: {
                 name: hrefLink,
                 caption: message_caption,
                 description: (
                    message_description
                   ),
                 href: hrefLink,
				 media: [{ type: 'image', src: flash_image_title, href: flash_message_link}]
             },

             action_links: [
                    { text: "Chronora", href: "http://www.chronora.com/" }
                 ],

             user_message_prompt: userPrompt
         },
               function(response) {
                   if (response && response.post_id) {
                       //  alert('Post published successfully.');
                   } else {
                       // alert('Post was not published.');
                   }
               }
             );
	}
	
function share(flash_message_title,flash_message_description,flash_image_title,flash_message_link){
    var message_title = flash_message_title;
    var userPrompt = "CHRONORA swiss watches and jewelery";
    var hrefLink = flash_message_link;
    var hrefTitle = "CHRONORA swiss watches and jewelery";
    var message_caption = flash_message_title;
    var message_description = flash_message_description;
	var image_src= "http://www.chronora.com/images/"+flash_image_title;
	var image_link= "http://www.chronora.com/"+flash_message_link;
    FB.ui(
         {
             method: 'stream.publish',
             message: message_title,
             display: 'dialog',
             attachment: {
                 name: hrefLink,
                 caption: message_caption,
                 description: (
                    message_description
                   ),
                 href: hrefLink,
				 media: [{ type: 'image', src: 'http://www.chronora.com/'+flash_image_title, href: flash_message_link}]
             },

             action_links: [
                    { text: "Chronora", href: "http://www.chronora.com/" }
                 ],

             user_message_prompt: userPrompt
         },
               function(response) {
                   if (response && response.post_id) {
                       //  alert('Post published successfully.');
                   } else {
                       // alert('Post was not published.');
                   }
               }
             );
	}
function logout(){
	FB.logout(function() { 
		window.location='http://www.chronora.com/';
	});
}
function sharewebsite(){
    
    var message_title = "Experience Luxury!";
    var userPrompt = "Experience Luxury!";
    var hrefLink = "http://www.chronora.com/";
	var hrefTitle = 'Chronora swiss legend watches and jewelery';
    var message_caption = "Experience Luxury!";
    var message_description = "CHRONORA DISTRIBUTS SWISS LEGEND WATCHES AND JEWELERY IN BEIRUT SOUKS IN LEBANON.";
    FB.ui(
         {
             method: 'stream.publish',
             message: message_title,
             display: 'dialog',
             attachment: {
                 name: hrefLink,
                 caption: message_caption,
                 description: (
                    message_description
                   ),
                 href: hrefLink,
				 media: [{ type: 'image', src: 'http://www.chronora.com/images/chronora_logo_intro.png', href: 'http://www.chronora.com'}]
             },

             action_links: [
                    { text: "Chronora", href: "http://www.chronora.com/" }
                 ],

             user_message_prompt: userPrompt
         },
               function(response) {
                   if (response && response.post_id) {
                       //  alert('Post published successfully.');
                   } else {
                       // alert('Post was not published.');
                   }
               }
             );
	}
