function openWindow(url, title, tool, location, men, res, status, scroll, width, height, focus) {
  // Parameter: url
  //            title
  //            toolbar      = yes/no
  //            location     = yes/no
  //            menubar      = yes/no
  //            resizable    = yes/no
  //            status       = yes/no
  //            scrollbars   = yes/no
  //            width        = xxx
  //            height       = yyy
  //            focus        = yes/no
  var param = 'toolbar='+tool+',location='+location;
  param += ',menubar='+men+',resizable='+res+',status='+status;
  param += ',scrollbars='+scroll+',width='+width+',height='+height;
  var myWindow=window.open(url,title,param);
  if(focus=="yes") myWindow.focus();
}

function searchDictionary()
{
  var pattern = getSelection();

  if (pattern == "")
  {
    var message = '';
    if (language == "pl")
    {
      message = 'Proszę zaznaczyć słowo!';
    }
    else if (language == "de")
    {
      message = 'Bitte ein Wort markieren!';
    }
    alert(message);
  }
  else
  {
    var url = "/index.shtml?CONTENT=dictionary;DICTACTION=search;LANG="
            + language + ";WORD=" + pattern;
    window.location.href = url;
  }

}

function searchSite()
{
  var pattern = getSelection();

  if (pattern == "")
  {
    var message = '';
    if (language == "pl")
    {
      message = 'Proszę zaznaczyć słowo!';
    }
    else if (language == "de")
    {
      message = 'Bitte ein Wort markieren!';
    }
    alert(message);
  }
  else
  {
    var url = "/index.shtml?CONTENT=search;SEARCHACTION=search;ASSOCIATION=OR;LANG="
            + language + ";SEARCH=" + pattern;
    window.location.href = url;
  }

}

function getSelection()
{
  var pattern = '';
  var textRange;

  if (navigator.appName == "Netscape")
  {
    var regularExp = new RegExp('([ \\n\\t\\v\\r\\f]|%0D|%0A|%20)+', 'g');
    pattern = escape(document.getSelection());
    pattern = pattern.replace (regularExp,"%20");
  }
  else if ( navigator.appName == "Microsoft Internet Explorer")
  {
    TextRange = document.selection.createRange();
    pattern = TextRange.text;
  }

  return pattern;
}