/*
*/

// ==UserScript==
// @name          Spanish->English translator
// @description   Press F2 to translate selected text from Spanish to English via BabelFish (assumes accented characters are encoded directly, and not via entities, e.g. it works for es.wikipedia.org).
// @include       *
// @exclude       
// ==/UserScript==

document.onkeydown = function (event) {
  if (event.keyCode == 113) {
    translateSpanishSelection();
    return false;
  }
  else {
    return true;
  }
}

function translateSpanishSelection() {
  selection = window.getSelection();
  if (selection != "") {
    translateWindow= window.open("http://babelfish.altavista.com/tr?lp=es_en&text=" + selection, 
                    'translateWindow','width=600,height=700');
  }
}
