var currentCell = "cell1";
var RowMax = 3;
var ColMax = 3;
function InitArrays()
{
      var nIndex;
      //alert("init");
      //find first empty cell
      for(nIndex=0; nIndex<81; nIndex++)
      {
         if(Initial[nIndex]==-1)
         {
            TableClick('cell'+nIndex);
            break;
         }
      }
      ResetState();
      var val = document.getElementById("selLang").value;
      document.getElementById("selLang").value = "English"
      document.onkeydown = KeyPressed;
      var elem = document.getElementById("generated");
      elem.innerHTML = 'Automatically generated by Sudoku Generator <a href="http://sudoku.smike.ru">http://sudoku.smike.ru</a>';

}
function FillCell(code)
{
   var strID = currentCell;
   var nIndex = parseInt(strID.substring(4));
   x = document.getElementById(strID);
   switch(code)
   {
      case 49:
      case 50:
      case 51:
      case 52:
      case 53:
      case 54:
      case 55:
      case 56:
      case 57:
          KeyVal = String.fromCharCode(code);
          x.innerHTML = KeyVal;
          x.style.fontSize = "48px";
          x.style.fontFamily = "Courier";
          Current[nIndex] = code;
          break;
      case 32:
         KeyVal = "&nbsp;";
         x.innerHTML = KeyVal;
         x.style.fontSize = "48px";
         x.style.fontFamily = "Courier";
         Current[nIndex] = -1;
         break;
    }
} 
function KeyPressed(e)
{
   var keyCode;
   var keyVal;
   var x;
   var nIndex1;
   var strID = currentCell;
   var nIndex = parseInt(strID.substring(4));
   if (!e) e = window.event;
   keyCode = e.keyCode;
   x = document.getElementById(strID);
      switch(keyCode)
      {
         case 49:
         case 50:
         case 51:
         case 52:
         case 53:
         case 54:
         case 55:
         case 56:
         case 57:
            KeyVal = String.fromCharCode(keyCode);
            x.innerHTML = KeyVal;
            x.style.fontSize = "48px";
            x.style.fontFamily = "Courier";
            Current[nIndex] = keyCode;
         break;
         case 97:
         case 98:
         case 99:
         case 100:
         case 101:
         case 102:
         case 103:
         case 104:
         case 105:
            KeyVal = String.fromCharCode(keyCode-48);
            x.innerHTML = KeyVal;
            x.style.fontSize = "48px";
            x.style.fontFamily = "Courier";
            Current[nIndex] = keyCode-48;
         break;
         case 8:
         case 46:
         case 32:
            KeyVal = "&nbsp;";
            x.innerHTML = KeyVal;
            x.style.fontSize = "48px";
            x.style.fontFamily = "Courier";
            Current[nIndex] = -1;
         break;
         case 39:
             for(nIndex1 = nIndex+1; nIndex1<81; nIndex1++)
             {
             if(Initial[nIndex1]==-1)
             {
                TableClick('cell'+nIndex1);
                break;
             }
         }
         break;
         case 37:
            for(nIndex1 = nIndex-1; nIndex1>=0; nIndex1--)
            {
                if(Initial[nIndex1]==-1)
                {
                   TableClick('cell'+nIndex1);
                   break;
                }
            }
         break;
         case 35:
            for(nIndex1 = 80; nIndex1>=0; nIndex1--)
            {
            if(Initial[nIndex1]==-1)
            {
               TableClick('cell'+nIndex1);
               break;
            }
         }
         break;
         case 36:
         for(nIndex1 = 0; nIndex1<81; nIndex1++)
         {
            if(Initial[nIndex1]==-1)
            {
               TableClick('cell'+nIndex1);
               break;
            }
         }
         break;
         case 40:
         for(nIndex1 = nIndex+9; nIndex1<81; nIndex1=nIndex1+9)
         {
            if(Initial[nIndex1]==-1)
            {
               TableClick('cell'+nIndex1);
               break;
            }
         }
         break;
         case 38:
         for(nIndex1 = nIndex-9; nIndex1>=0; nIndex1=nIndex1-9)
         {
            if(Initial[nIndex1]==-1)
            {
               TableClick('cell'+nIndex1);
               break;
            }
         }
         break;
         default:
         break;
      }
}   
function CurrentState()
{
     ResetAllCells();
     var nIndex;
     var Cell;
     var KeyVal;
     var x;
     ResetNumSelColumn();
     ResetAllCells();
     for(nIndex=0; nIndex<81; nIndex++)
     {
        Cell = 'cell'+nIndex;
        x = document.getElementById(Cell);
        if(Current[nIndex]==-1)
           KeyVal = "&nbsp;";
        else
           KeyVal = String.fromCharCode(Current[nIndex]);
        x.innerHTML = KeyVal;
        x.style.fontSize = "48px";
        x.style.fontFamily = "Courier";
     }
     //find first empty cell
     for(nIndex=0; nIndex<81; nIndex++)
     {
        if(Initial[nIndex]==-1)
        {
           TableClick('cell'+nIndex);
           break;
        }
     }
}
function ResetState()
{
     ResetAllCells();
     var nIndex;
     var Cell;
     var KkeyVal;
     var x;
     ResetNumSelColumn();
     ResetAllCells();
     for(nIndex=0; nIndex<81; nIndex++)
     {
        Cell = 'cell'+nIndex;
        x = document.getElementById(Cell);
        if(Initial[nIndex]==-1)
           KeyVal = "&nbsp;";
        else
           KeyVal = String.fromCharCode(Initial[nIndex]);
        x.innerHTML = KeyVal;
        x.style.fontSize = "48px";
        x.style.fontFamily = "Courier";
     }
     //find first empty cell
     for(nIndex=0; nIndex<81; nIndex++)
     {
        if(Initial[nIndex]==-1)
        {
           TableClick('cell'+nIndex);
           break;
        }
     }
}
function SolutionState()
{
     var nIndex;
     var Cell;
     var keyVal;
     var x;
     ResetAllCells();
     for(nIndex=0; nIndex<81; nIndex++)
     {
        Cell = 'cell'+nIndex;
        x = document.getElementById(Cell);
        KeyVal = String.fromCharCode(Solution[nIndex]);
        x.innerHTML = KeyVal;
//        x.style.fontSize = "48px";
//        x.style.fontFamily = "Courier";
     }
     for(nIndex=1; nIndex<10; nIndex++)
     {
        Cell = 'tnum'+nIndex;
         x = document.getElementById(Cell);
         x.innerHTML = '&nbsp';
     }
     x = document.getElementById('tnumspace');
     x.innerHTML = '&nbsp';
     x = document.getElementById('instr');
     x.innerHTML = '&nbsp';
}    

function TableClick(strID)
{
  var bgc;
  var x;
  currentCell = strID;
  ResetAllCells();
  x = document.getElementById(strID);
  bgc =  x.bgColor;
  bgc = bgc.toUpperCase();
  x.bgColor = "#FFFF00";
  x.focus();
}
function ResetAllCells()
{
   ResetCellBackGround('bigtable0');
   ResetCellBackGround('bigtable1');
   ResetCellBackGround('bigtable2');
   ResetCellBackGround('bigtable3');
   ResetCellBackGround('bigtable4');
   ResetCellBackGround('bigtable5');
   ResetCellBackGround('bigtable6');
   ResetCellBackGround('bigtable7');
   ResetCellBackGround('bigtable8');
   if(navigator.appName!="Microsoft Internet Explorer")
   {
//      alert("Supported by Microsoft Internet Explorer, only");
   } 
}
function ResetCellBackGround(bigtable)
{
   var IndexRow;
   var IndexCol;
   var x;
   for(IndexRow = 0; IndexRow<RowMax; IndexRow++)
   {
      x = document.getElementById(bigtable).rows[IndexRow].cells;
      for(IndexCol = 0; IndexCol<ColMax; IndexCol++)
      {
         x[IndexCol].bgColor = "#FFFFFF";
      }
   }
}
function ResetNumSelColumn()
{
   var x = document.getElementById('tnum1');
   x.innerHTML = '<a href="javascript:FillCell(49)" id="num1">1</a>';
   x = document.getElementById('tnum2');
   x.innerHTML = '<a href="javascript:FillCell(50)" id="num2">2</a>';
   x = document.getElementById('tnum3');
   x.innerHTML = '<a href="javascript:FillCell(51)" id="num3">3</a>';
   x = document.getElementById('tnum4');
   x.innerHTML = '<a href="javascript:FillCell(52)" id="num4">4</a>';
   x = document.getElementById('tnum5');
   x.innerHTML = '<a href="javascript:FillCell(53)" id="num5">5</a>';
   var x = document.getElementById('tnum6');
   x.innerHTML = '<a href="javascript:FillCell(54)" id="num6">6</a>';
   x = document.getElementById('tnum7');
   x.innerHTML = '<a href="javascript:FillCell(55)" id="num7">7</a>';
   x = document.getElementById('tnum8');
   x.innerHTML = '<a href="javascript:FillCell(56)" id="num8">8</a>';
   x = document.getElementById('tnum9');
   x.innerHTML = '<a href="javascript:FillCell(57)" id="num9">9</a>';
   x = document.getElementById('tnumspace');
   var val = document.getElementById("selLang").value;
   x.innerHTML = '<a href="javascript:FillCell(32)" id="numspace">_</a>';
   x = document.getElementById('instr');
   if(val == "English")
   {
     x.innerHTML = 'Click on symbol to fill current Sudoku cell.';
   } else {
     x.innerHTML =  String.fromCharCode(1050,1083,1080,1082,1085,1080,1090,1077,32,1085,1072,32,1089,1080,1084,1074,
1086,1083,44,32,1095,1090,1086,1073,1099,32,1079,1072,1087,1086,1083,1085,
1080,1090,1100,32,1090,1077,1082,1091,1097,1091,1102,32,1103,1095,1077,1081,
1082,1091,32,1057,1091,1076,1086,1082,1091,46);
  }
}
function LanguageChange()
{
  var val = document.getElementById("selLang").value;
  var elem;
/*  
  elem = document.getElementById("languagesel");
  if(val == "English")
  {
     elem.innerHTML = '<font face="Arial" size="1">Select Language</font>';
  } else {
     elem.innerHTML =  String.fromCharCode(60,102,111,110,116,32,102,97,99,101,61,34,65,114,105,97,
                                           108,34,32,115,105,122,101,61,34,49,34,62,
                                           1042,1099,1073,1077,1088,1080,1090,1077,32,1103,1079,1099,1082,
                                           60,47,102,111,110,116,62);
  }
  elem.style.fontSize = "10px";
  elem.style.fontFamily = "Arial";
*/  
  elem = document.getElementById("printlink");
//  elem.style.fontSize = "10px";
//  elem.style.fontFamily = "Arial";
  if(val == "English")
  {
     elem.innerHTML = "Printable Version";
  } else {
     elem.innerHTML =  String.fromCharCode(1042,1077,1088,1089,1080,1103,32,1076,1083,1103,32,1087,1077,1095,1072,1090,1080);
  }
  
  elem = document.getElementById("sudokutitle");
  if(val == "English")
  {
     elem.innerHTML = 'Online Sudoku';
  } else {
     elem.innerHTML =  String.fromCharCode(1054,1085,1083,1072,1081,1085,32,1057,1091,1076,1086,1082,1091);
  }
  elem.style.fontSize = "25px";
  elem.style.fontFamily = "Arial";
  
  elem = document.getElementById("instuction");
  if(val == "English")
  {
    elem.innerHTML = "<b>Cursor is marked with Yellow Cell.</b>"
    elem.innerHTML += "<br><b>To move cursor to other position use Arrows, Home and End keys or click on some cell.<br>MS IExplorer only!</b>";
  } else {
     elem.innerHTML =  String.fromCharCode(60,98,62,1050,1091,1088,1089,1086,1088,32,1086,1090,1084,1077,1095,1077,
                                       1085,32,1078,1077,1083,1090,1086,1081,32,1082,1083,1077,1090,1082,1086,1081,
                                       46,60,47,98,62,60,98,114,62);
      elem.innerHTML +=  String.fromCharCode(60,98,62,1055,1077,1088,1077,1076,1074,1080,1075,1072,1090,1100,32,1082,
                                             1091,1088,1089,1086,1088,32,1084,1086,1078,1085,1086,32,1082,1083,1072,1074,
                                             1080,1096,1072,1084,1080,45,1089,1090,1088,1077,1083,1082,1072,1084,1080,44,
                                             32,1072,32,1090,1072,1082,1078,1077,32,1082,1083,1072,1074,1080,1096,1072,
                                             1084,1080,32,72,111,109,101,32,1080,32,69,110,100,46,60,47,98,
                                             62,60,98,114,62);
      elem.innerHTML +=  String.fromCharCode(60,98,62,1056,1072,1073,1086,1090,1072,1077,1090,32,1090,1086,1083,1100,
                                             1082,1086,32,1074,32,77,83,32,73,69,120,112,108,111,114,101,114,33,60,47,98,62);
  }
//  elem.style.fontSize = "8pt";
//  elem.style.fontFamily = "Arial";
//  elem = document.getElementById("moresudoku");
//  if(val == "English")
//  {
//     elem.innerHTML = "<b>more Sudoku...</b>"
//  } else {
//     elem.innerHTML =  String.fromCharCode(60,98,62,1077,1097,1077,32,1057,1091,1076,1086,1082,1091,46,46,46,60,47,98,62);
//  }
  elem.style.fontSize = "8pt";
  elem.style.fontFamily = "Arial";
  elem = document.getElementById("solutionbutton");
  if(val == "English")
  {
     elem.value = "Solution"
  } else {
     elem.value =  String.fromCharCode(1056,1077,1096,1077,1085,1080,1077);
  }
  elem = document.getElementById("resetbutton");
  if(val == "English")
  {
     elem.value = "Reset"
  } else {
     elem.value =  String.fromCharCode(1057,1073,1088,1086,1089);
  }
  elem = document.getElementById("currentstatebutton");
  if(val == "English")
  {
     elem.value = "Current State"
  } else {
     elem.value =  String.fromCharCode(1058,1077,1082,1091,1097,1077,1077,32,1089,1086,1089,1090,1086,1103,1085,1080,1077);
  }
  elem = document.getElementById("generated");
  if(val == "English")
  {
     elem.innerHTML = 'Automatically generated by Sudoku Generator <a href="http://sudoku.smike.ru">http://sudoku.smike.ru</a>';
  } else {
     elem.innerHTML =  String.fromCharCode(1040,1074,1090,1086,1084,1072,1090,1080,1095,1077,1089,1082,1080,32,
                                           1089,1086,1079,1076,1072,1085,1086,32,
                                           1043,1077,1085,1077,1088,1072,1090,1086,1088,1086,1084,32,
                                           1057,1091,1076,1086,1082,1091,32,
                                           60,97,32,104,114,101,102,61,34,104,116,116,112,58,47,47,
                                           115,117,100,111,107,117,46,115,109,105,107,101,46,114,117,34,
                                           62,104,116,116,112,58,47,47,115,117,100,111,107,117,46,115,
                                           109,105,107,101,46,114,117,60,47,97,62);
  }
  elem = document.getElementById("instr");
  if(elem.innerHTML!='&nbsp;')
  {
    if(val == "English")
    {
        elem.innerHTML = 'Click on symbol to fill current Sudoku cell.';
     } else {
        elem.innerHTML =  String.fromCharCode(1050,1083,1080,1082,1085,1080,1090,1077,32,1085,1072,32,1089,1080,1084,1074,
           1086,1083,44,32,1095,1090,1086,1073,1099,32,1079,1072,1087,1086,1083,1085,
           1080,1090,1100,32,1090,1077,1082,1091,1097,1091,1102,32,1103,1095,1077,1081,
           1082,1091,32,1057,1091,1076,1086,1082,1091,46);
     }
  }
}
function PrintableVersion()
{
   var x;
   var printWndTitle = document.title + " (Printer friendly version)";
   var printWnd = window.open('','','width=500, height=600, toolbar=no, scrollbars=no, location=no, status=no, menubar=no, resizable=yes');
   printWnd.document.open("text/html", "replace");
   printWnd.document.write('<html>\r\n<head>\r\n<title>'+printWndTitle+'</title>\r\n');
   printWnd.document.write('<style>\r\n');
   printWnd.document.write('#cell0,#cell1,#cell2,#cell3,#cell4,#cell5,#cell6,#cell7,#cell8,#cell9,\r\n');
   printWnd.document.write('#cell10,#cell11,#cell12,#cell13,#cell14,#cell15,#cell16,#cell17,#cell18,#cell19,\r\n');
   printWnd.document.write('#cell20,#cell21,#cell22,#cell23,#cell24,#cell25,#cell26,#cell27,#cell28,#cell29,\r\n');
   printWnd.document.write('#cell30,#cell31,#cell32,#cell33,#cell34,#cell35,#cell36,#cell37,#cell38,#cell39,\r\n');
   printWnd.document.write('#cell40,#cell41,#cell42,#cell43,#cell44,#cell45,#cell46,#cell47,#cell48,#cell49,\r\n');
   printWnd.document.write('#cell50,#cell51,#cell52,#cell53,#cell54,#cell55,#cell56,#cell57,#cell58,#cell59,\r\n');
   printWnd.document.write('#cell60,#cell61,#cell62,#cell63,#cell64,#cell65,#cell66,#cell67,#cell68,#cell69,\r\n');
   printWnd.document.write('#cell70,#cell71,#cell72,#cell73,#cell74,#cell75,#cell76,#cell77,#cell78,#cell79,#cell80\r\n');
   printWnd.document.write('{\r\nFONT-SIZE: 36pt;\r\nFONT-FAMILY: courier;\r\nCOLOR: #000000;}\r\n');
   printWnd.document.write('FONT-STYLE: normal;\r\ntext-decoration: none;\r\n}\r\n');
   printWnd.document.write('#print1\r\n{\r\nFONT-SIZE: 12pt;\r\nFONT-FAMILY: courier;\r\n');
   printWnd.document.write('FONT-STYLE: normal;\r\n}\r\n');
   printWnd.document.write('</style>\r\n');
   printWnd.document.write('</head>\r\n<body>');
   printWnd.document.write('<table border="0" width="861" id="sudtable">\r\n');
   printWnd.document.write('<TR>\r\n');
   printWnd.document.write('<TD width="440">\r\n');
   printWnd.document.write('<table border="0" cellspacing="2">\r\n');
   printWnd.document.write('<TR>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable0">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell0').innerHTML;
   if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell0">' + x + '</TD>\r\n');
   x = document.getElementById('cell1').innerHTML;  
   if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell1">' + x + '</TD>\r\n');
   x = document.getElementById('cell2').innerHTML;    if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell2">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell9').innerHTML;     if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell9">' + x + '</TD>\r\n');
   x = document.getElementById('cell10').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell10">' + x + '</TD>\r\n');
   x = document.getElementById('cell11').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell11">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell18').innerHTML;     if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell18">' + x + '</TD>\r\n');
   x = document.getElementById('cell19').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell19">' + x + '</TD>\r\n');
   x = document.getElementById('cell20').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell20">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable1">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell3').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell3">' + x + '</TD>\r\n');
   x = document.getElementById('cell4').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="4enter"  id="cell4">' + x + '</TD>\r\n');
   x = document.getElementById('cell5').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell5">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell12').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell12">' + x + '</TD>\r\n');
   x = document.getElementById('cell13').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell13">' + x + '</TD>\r\n');
   x = document.getElementById('cell14').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell14">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell21').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell21">' + x + '</TD>\r\n');
   x = document.getElementById('cell22').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell22">' + x + '</TD>\r\n');
   x = document.getElementById('cell23').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell23">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable2">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell6').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell6">' + x + '</TD>\r\n');
   x = document.getElementById('cell7').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell7">' + x + '</TD>\r\n');
   x = document.getElementById('cell8').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;'; 
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell8">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell15').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell15">' + x + '</TD>\r\n');
   x = document.getElementById('cell16').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';  
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell16">' + x + '</TD>\r\n');
   x = document.getElementById('cell17').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';   
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell17">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell24').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell24">' + x + '</TD>\r\n');
   x = document.getElementById('cell25').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;'; 
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell25">' + x + '</TD>\r\n');
   x = document.getElementById('cell26').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;'; 
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell26">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable3">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell27').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell27">' + x + '</TD>\r\n');
   x = document.getElementById('cell28').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell28">' + x + '</TD>\r\n');
   x = document.getElementById('cell29').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell29">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell36').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell36">' + x + '</TD>\r\n');
   x = document.getElementById('cell37').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell37">' + x + '</TD>\r\n');
   x = document.getElementById('cell38').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell38">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell45').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell45">' + x + '</TD>\r\n');
   x = document.getElementById('cell46').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell46">' + x + '</TD>\r\n');
   x = document.getElementById('cell47').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell47">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable4">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell30').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell30">' + x + '</TD>\r\n');
   x = document.getElementById('cell31').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell31">' + x + '</TD>\r\n');
   x = document.getElementById('cell32').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell32">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell39').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell39">' + x + '</TD>\r\n');
   x = document.getElementById('cell40').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell40">' + x + '</TD>\r\n');
   x = document.getElementById('cell41').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell41">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell48').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell48">' + x + '</TD>\r\n');
   x = document.getElementById('cell49').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell49">' + x + '</TD>\r\n');
   x = document.getElementById('cell50').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell50">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable5">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell33').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell33">' + x + '</TD>\r\n');
   x = document.getElementById('cell34').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell34">' + x + '</TD>\r\n');
   x = document.getElementById('cell35').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell35">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell42').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell42">' + x + '</TD>\r\n');
   x = document.getElementById('cell43').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell43">' + x + '</TD>\r\n');
   x = document.getElementById('cell44').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell44">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell51').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell51">' + x + '</TD>\r\n');
   x = document.getElementById('cell52').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell52">' + x + '</TD>\r\n');
   x = document.getElementById('cell53').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell53">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable6">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell54').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell54">' + x + '</TD>\r\n');
   x = document.getElementById('cell55').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell55">' + x + '</TD>\r\n');
   x = document.getElementById('cell56').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell56">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell63').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell63">' + x + '</TD>\r\n');
   x = document.getElementById('cell64').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell64">' + x + '</TD>\r\n');
   x = document.getElementById('cell65').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell65">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell72').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell72">' + x + '</TD>\r\n');
   x = document.getElementById('cell73').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell73">' + x + '</TD>\r\n');
   x = document.getElementById('cell74').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell74">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable7">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell57').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell57">' + x + '</TD>\r\n');
   x = document.getElementById('cell58').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell58">' + x + '</TD>\r\n');
   x = document.getElementById('cell59').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell59">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell66').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell66">' + x + '</TD>\r\n');
   x = document.getElementById('cell67').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell67">' + x + '</TD>\r\n');
   x = document.getElementById('cell68').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell68">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell75').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell75">' + x + '</TD>\r\n');
   x = document.getElementById('cell76').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell76">' + x + '</TD>\r\n');
   x = document.getElementById('cell77').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell77">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('<TD width="144" height="144">\r\n');
   printWnd.document.write('<table border="1" cellspacing="0" id="bigtable8">\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell60').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell60">' + x + '</TD>\r\n');
   x = document.getElementById('cell61').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell61">' + x + '</TD>\r\n');
   x = document.getElementById('cell62').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell62">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell69').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell69">' + x + '</TD>\r\n');
   x = document.getElementById('cell70').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell70">' + x + '</TD>\r\n');
   x = document.getElementById('cell71').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell71">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('<TR>\r\n');
   x = document.getElementById('cell78').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell78">' + x + '</TD>\r\n');
   x = document.getElementById('cell79').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell79">' + x + '</TD>\r\n');
   x = document.getElementById('cell80').innerHTML;  if(!((x>=1) && (x<=9))) x = '&nbsp;';
   printWnd.document.write('<TD  width="48" height="48" align="center"  id="cell80">' + x + '</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   printWnd.document.write('</TD>\r\n');
   printWnd.document.write('</TR>\r\n');
   printWnd.document.write('</table>\r\n');
   var val = document.getElementById("selLang").value;
   if(val == "English")
   {
      printWnd.document.write('<a class="hidden" title="Click here to print!" id="print1" href="javascript:window.print()">Print<\a>');
   } else {
      printWnd.document.write('<a class="hidden" id="print1" '); 
      printWnd.document.write('title=&#1044;&#1083;&#1103;&#32;&#1087;&#1077;&#1095;&#1072;&#1090;&#1080;&#32;');      
      printWnd.document.write('&#1082;&#1083;&#1080;&#1082;&#1085;&#1080;&#1090;&#1077;&#32;');
      printWnd.document.write('&#1089;&#1102;&#1076;&#1072;&#33;');
      printWnd.document.write(' href="javascript:window.print()">&#1055;&#1077;&#1095;&#1072;&#1090;&#1072;&#1090;&#1100;<\a>'); 
   }
   printWnd.document.write('</body>\r\n</html>');
   printWnd.document.close();
   printWnd.location.reload(); 
}
