makeSearchCommand({
  name: "anagram",
  author: {name: "Paul Nicholls", email: "max.thrax@gmail.com"},
  description: "Finds anagrams for the given word or phrase",
  icon: "http://wordsmith.org/favicon.ico",
  url:"http://wordsmith.org/anagram/anagram.cgi?anagram={QUERY}&t=1000",
  preview: function( pblock, thing ) {
    if (thing.text < 1) {pblock.innerHTML = "Find anagrams"; return;}
    jQuery.get(this.url.replace("{QUERY}", thing.text),
      function (doc)
       {var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("http://www.w3.org/1999/xhtml", "div");
        tempElement.innerHTML = doc;
        var resultElement=tempElement.getElementsByTagName('blockquote')[0];
        var resultTitle=resultElement.getElementsByTagName('h3')[0].innerHTML;
        var resultBody=resultElement.getElementsByTagName('p')[3].innerHTML;
        pblock.innerHTML = '<h3>'+resultTitle+'</h3><p style="max-height:250px;overflow-y:auto;">'+resultBody+'</p>'; })
  }
});


