// PROMTs Online Translator, Copyright (c) 1998-2000 PROject MT, Ltd. All rights reserved. http://www.translate.ru/
function DoTableWin(str, Type)
{
    var strTable1 = "ABVGDEZIJKLMNOPRSTUFHC'Y'EQabvgdezijklmnoprstufhc'y'eq"; // ëàòèíèöà
    var strTable2 = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ¨¸"; // Koi8-r
    
    var strNew = "";
    //var ar=top.zwho.zar;
    var i, j, docontinue, bracket = 0, len = str.length;
    for (i = 0; i < len; i++)
    {
	  if (str.substr(i, 1)=='[') bracket=1;
	  if (str.substr(i, 1)==']') bracket=0;

	  if (bracket == 0 ) {
	    if ("lw" == Type)
	    {

	    	if ( ("'" == str.substr(i, 1)) )
	        {
	            strNew = strNew + "ü";
	        	continue;
	        }
	    	if ( ("`" == str.substr(i, 1)) )
	        {
	            strNew = strNew + "ú";
	        	continue;
	        }
	    
	    	if (i < (len - 1))
	    	{
		        var c = str.substr(i, 2);
		        if (("Zh" == c) || ("ZH" == c))
		        {
		            strNew = strNew + "Æ";
			        i++;
		        	continue;
		        }
		        else if (("Ch" == c) || ("CH" == c))
		        {
		            strNew = strNew + "×";
			        i++;
		        	continue;
		        }
		        else if (("Sh" == c) || ("SH" == c))
		        {
		            strNew = strNew + "Ø";
			        i++;
		        	continue;
		        }
		        else if (("Xh" == c) || ("XH" == c))
		        {
		            strNew = strNew + "Ù";
			        i++;
		        	continue;
		        }
		        else if (("xh" == c) || ("xh" == c))
		        {
		            strNew = strNew + "ù";
			        i++;
		        	continue;
		        }
		        else if (("Je" == c) || ("JE" == c))
		        {
		            strNew = strNew + "Ý";
			        i++;
		        	continue;
		        }
		        else if (("JI" == c) || ("JI" == c))
		        {
		            strNew = strNew + "É";
			        i++;
		        	continue;
		        }
		        else if (("ji" == c) || ("ji" == c))
		        {
		            strNew = strNew + "é";
			        i++;
		        	continue;
		        }
		        else if (("je" == c) || ("je" == c))
		        {
		            strNew = strNew + "ý";
			        i++;
		        	continue;
		        }
		        else if (("Ju" == c) || ("JU" == c))
		        {
		            strNew = strNew + "Þ";
			        i++;
		        	continue;
		        }
		        else if (("Ja" == c) || ("JA" == c))
		        {
		            strNew = strNew + "ß";
			        i++;
		        	continue;
		        }
		        if ("zh" == c)
		        {
		            strNew = strNew + "æ";
			        i++;
		        	continue;
		        }
		        else if ("ch" == c)
		        {
		            strNew = strNew + "÷";
			        i++;
		        	continue;
		        }
		        else if ("sh" == c)
		        {
		            strNew = strNew + "ø";
			        i++;
		        	continue;
		        }
		        else if ("ju" == c)
		        {
		            strNew = strNew + "þ";
			        i++;
		        	continue;
		        }
		        else if ("ja" == c) 
		        {
		            strNew = strNew + "ÿ";
			        i++;
		        	continue;
		        }
		        else if (("Jo" == c) || ("JO" == c))
		        {
		            strNew = strNew + "¨";
			        i++;
		        	continue;
		        }
		        else if ("jo" == c)
		        {
		            strNew = strNew + "¸";
			        i++;
		        	continue;
		        }
	    	}
	    }

          var c = str.substr(i, 1);
          var pos = strTable1.indexOf(c);
          if (pos < 0)
            strNew = strNew + c;
          else
          {
        	var d = strTable2.substr(pos, 1);
          	strNew = strNew + d;
          }
	} else {
         strNew = strNew + str.substr(i, 1);
        }
	
    }

    return strNew;
}


function translate(strText){
 var decoder_type='lw';
	
 if (0 == strText.length){
    return strText;
 }
	
 strText = DoTableWin(strText, decoder_type);
 return strText;
}

function el_translate(element) {
 element.value=translate(element.value);
}
