var trans = [];
for (var i = 0x410; i <= 0x44F; i++)
  trans[i] = i - 0x350; // á-ñÁ-Ñ
  trans[0x401] = 0xA8;    // ³
  trans[0x451] = 0xB8;    // £
  
var escapeOrig = window.escape;
  
window.escape = function(str)
{
var ret = [];
for (var i = 0; i < str.length; i++)
{
var n = str.charCodeAt(i);
if (typeof trans[n] != 'undefined')
n = trans[n];
if (n <= 0xFF)
  ret.push(n);
}
return escapeOrig(String.fromCharCode.apply(null, ret));
}
                                      

var s = '';
var se = '';

function opl(a)
{
    if (s == '') return;
    var word = a.innerHTML;//firstChild.data;
    document.location.href = s+escape(word)+se;
}

function setlink(a)
{
    if (a && (se != '')) return;
    
    var tags = document.getElementsByTagName('span');
    for(i=0; i < tags.length; i++) {
        if (tags[i].className == 'link')
        {
            if (a)
            {
                tags[i].style.color = 'blue';
                tags[i].style.textDecoration = 'underline';
                tags[i].style.cursor = 'pointer';
            }
            else
            {
                tags[i].style.color = 'black';
                tags[i].style.textDecoration = 'none';
                tags[i].style.cursor = 'auto';
            }
        }
    }

    document.getElementById('off').style.display = a?'inline':'none'; 
}

function off() 
{      
    s = '';
    se = '';
    setlink(false);
}

function wiki() 
{
    setlink(true);
    s = 'http://ru.wikipedia.org/wiki/óÌÕÖÅÂÎÁÑ:Search?search=';
    se = '&go=ðÅÒÅÊÔÉ';
}

function ys() 
{
    setlink(true);
    s = 'http://slovari.yandex.ru/search.xml?text=';
    se = '';
}
