CmdUtils.CreateCommand({
  name: "share-on-facebook",
  author: { name: "John Allen", email: "jallen7usa+web@gmail.com"},
  description: "Submit the current page to facebook.",

  preview: function( pblock, place ) {
	var msg = "this page";
	if (Application.activeWindow.activeTab.document.title.length > 0)
		msg = Application.activeWindow.activeTab.document.title;
	pblock.innerHTML = "Share '"+ msg + "' on Facebook."
  },

  execute: function() {
	var d=Application.activeWindow.activeTab.document;
	var f='http://www.facebook.com/share';
	var l=d.location;
	var e=encodeURIComponent;
	var p='.php?src=bm&v=4&i=1207275439&u='+e(l.href)+'&t='+e(d.title);
	1;
	try
	{
		if (!/^(.*\.)?facebook\.[^.]*$/.test(l.host))
			throw(0);
		share_internal_bookmarklet(p)
	}
	catch(z)
	{
		a=function() {
			if (!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=0,width=626,height=436'))
				l.href=f+p
		};

		a();
	}
	void(0)
}})