CmdUtils.CreateCommand({
  names: ["import to freebase"],
  arguments: [  ],
        description: "import the html of the selection to freebase",
        preview:  "select the part of the page to write into freebase",
        author: { name: "Spencer Kelly", email: "spencerwater@gmail.com"},
        homepage: "http://spencerwaterbed.com/soft/ubiquity/htmlview.html",
	icon: "http://sites.google.com/site/spencerhost/_/rsrc/1265592726089/home/16-icon.png",
        license: "GPL",


  preview: function(pblock, args ) {

pblock.innerHTML = "select a part of the page to view its html";
var thehtml= CmdUtils.getHtmlSelection(); 
if(thehtml!=''){
thehtml=thehtml.replace(/&/g,'&amp;'); 
thehtml=thehtml.replace(/>/g,'&gt;'); 
thehtml=thehtml.replace(/</g,'&lt;'); 
pblock.innerHTML = 'import the following html:<br/>'+thehtml;
}


  },


	execute: function( args ){
var thehtml= CmdUtils.getHtmlSelection(); 
if(thehtml!=''){
var url='http://garden.freebaseapps.com/htmlimport';
Utils.openUrlInBrowser( url, {html:thehtml});
}

		return true;
	},
})

