/* Converter: from numeric representation to real symbols
   Copyright (c) 2010  Paul Gorodyansky http://WinRus.com
  
  Implementation: http://Bukva.WinRus.com
   (http://WinRus.com/bukva.htm or at the bottom of http://porusski.net)

*/

var NumericFormatVariant = '0';

function SetVariant2(myForm2, variant)
{
  if (variant.value == "0") {NumericFormatVariant = '0'; txtControl2.focus(); return false;}
  
  variant.selected = true;  NumericFormatVariant = variant.value;  txtControl2.focus();
          
}          

function ConvertToSymbols()
{ 
  if (NumericFormatVariant == '0') {txtControl2.focus(); return false;}

    var curTextPrepared=""; var txtParm = null;
    var num2 = parseInt(NumericFormatVariant);
    var curText2=txtControl2.value; 
    
    var LineParm =  new RegExp( "\\n", "g" );
    
    var curTextSingleLine = curText2.replace(LineParm, "");
    
    switch (num2)
    {                                                                           
      case 1: curTextPrepared =  curTextSingleLine.replace(/\\u/g, "%u");     
             break;
      case 2: txtParm =  new RegExp("U\\+",'g'); 
              curTextPrepared =  curTextSingleLine.replace(txtParm, "%u"); 
             break;
      case 3: curTextPrepared =  curTextSingleLine;     
             break;             
      default: break;
    }        
  
  
  var newText2 = unescape(curTextPrepared);
  
  txtControl2.value = newText2;
  
  txtControl2.focus();
          
}          


/* Paul Gorodyansky, author of the site
   "Cyrillic (Russian): instructions for Windows and Internet": 
   http://WinRus.com/

*/



