CmdUtils.CreateCommand({
  name: "printwyl",
  homepage: "http://stuarthendren.net/",
  author: { name: "Stuart Hendren", email: "stuarthendren@gmail.com"},
  contributors: ["Stuart Hendren"],
  license: "CC by-sa, http://creativecommons.org/licenses/by-sa/2.0/",
  description: "Sends the current page to PrintWhatYouLike.com",
  icon: "http://www.printwhatyoulike.com/static/img/favicon.png",
  help: "Print the current tab using <a href='http://printwhatyoulike.com'>PrintWhatYouLike.com</a>",

  preview: function( pblock ) {
    var msg = "Opens a new tab to print ";
    msg += context.focusedWindow.document.location.href;
    msg += " using PrintWhatYouLike.com.";
    pblock.innerHTML = msg;
  },

  execute: function( ) {

    var url = context.focusedWindow.document.location.href;
    var encodedUrl=escape(url);
    encodedUrl=encodedUrl.replace(/\+/g, "%2B");
    encodedUrl=encodedUrl.replace(/\//g, "%2F");
    var send = "http://www.printwhatyoulike.com/print?url=";
    send += encodedUrl;
    Utils.openUrlInBrowser(send);

  }
})