/**
 * ubiqutiy spellcheck
 * uses Google to spell check simple words
 * @author Nicholas Pike npike@npike.net
 */
CmdUtils.CreateCommand({
  name: "spellcheck",
  takes: {"word to spell check": noun_arb_text},
  preview: "Spell checks a given word",
   preview: function( pblock, textCheck ) {
     var msg = "<b>Google Suggestions</b><br/>";
     jQuery.post("https://www.google.com/tbproxy/spell?lang=en&hl=en","<spellrequest textalreadyclipped=\"0\" ignoredups=\"1\" ignoredigits=\"1\" ignoreallcaps=\"0\"><text>"+textCheck.text +"</text></spellrequest>", function(xml) {

   var suggestions = xml.firstChild.childNodes;
  for (var x = 0; x < suggestions.length; x++) {
   msg += suggestions[x].textContent +"<br />";
 }
   pblock.innerHTML = msg;
 }); 
    
  },
  execute: function( textCheck ) {}
})
