<!--	
var intervalID;
var indexAnc = 0;
var indexInc = 2;
var alg;
function initWnd()
{
   alg = 5*Math.random();
   alg = Math.round(alg);
   intervalID = setInterval("fillInterval()", 50);
}
function fillInterval()
{
   switch(alg)
   {

       case 0:
         algGT2();
         break;
       case 1:
         alg2();
         break;
       case 2:
         alg1();
         break;
       default:
         alg0();
         break;
   }
}
function alg0()
{
    var row = indexAnc;
    var col;
    for(col=0;((col<ColMax) && (row<RowMax));col++)
    {
        showCell1(row,col);
    }
    row = RowMax - indexAnc - 1;
    for(col=0;((col<ColMax) && (row>=0));col++)
    {
       showCell1(row,col);
    }
    col = indexAnc;
    for(row=0;((row<RowMax) && (col<ColMax));row++)
    {
       showCell1(row,col);
    }
    col = ColMax-indexAnc-1;
    for(row=0;((row<RowMax) && (col>=0));row++)
    {
       showCell1(row,col);
    }
    indexAnc++;
    if((indexAnc>=RowMax) && (indexAnc>=ColMax))
    {
       clearInterval(intervalID);
       alg = 3*Math.random();
       alg = Math.round(alg);
       if(alg%2) indexAnc = anchMax - 1; else indexAnc = 0;
       intervalID = setInterval("fillInterval1()", 2);
    }
}
function alg1()
{
    var row = indexAnc;
    var col;
    for(col=0;col<ColMax;col++)
    {
        showCell1(row,col);
    }
    row = RowMax - indexAnc - 1;
    for(col=0;col<ColMax;col++)
    {
       showCell1(row,col);
    }
    indexAnc++;
    if(indexAnc>=RowMax)
    {
       clearInterval(intervalID);
       alg = 3*Math.random();
       alg = Math.round(alg);
       if(alg%2) indexAnc = anchMax - 1; else indexAnc = 0;
       intervalID = setInterval("fillInterval1()", 2);
    }
}
function alg2()
{
    var row;
    var col;
    col = indexAnc;
    for(row=0;row<RowMax;row++)
    {
       showCell1(row,col);
    }
    col = ColMax-indexAnc-1;
    for(row=0;row<RowMax;row++)
    {
       showCell1(row,col);
    }
    indexAnc++;
    if(indexAnc>=ColMax)
    {
       clearInterval(intervalID);
       alg = 3*Math.random();
       alg = Math.round(alg);
       if(alg%2) indexAnc = anchMax - 1; else indexAnc = 0;
       intervalID = setInterval("fillInterval1()", 2);
    }
}
function algGT2()
{
    var row = indexAnc / ColMax;
    row = Math.floor(row);
    var col = indexAnc % ColMax;
    showCell1(row,col);
    indexAnc++;
    if((row>RowMax/2) && (col>ColMax/2))
    {
//       alert(indexAnc+' '+row+' '+col);
       clearInterval(intervalID);
       alg = 3*Math.random();
       alg = Math.round(alg);
       if(alg%2) indexAnc = anchMax - 1; else indexAnc = 0;
       intervalID = setInterval("fillInterval1()", 2);
    }  else { 
       var indexBack = RowMax*ColMax - indexAnc;
       row = indexBack / ColMax;
       row = Math.floor(row);
       col = indexBack % ColMax;
       cellID = "td_"+row+"_"+col;
       x = document.getElementById(cellID);
       x.style.color='#000000';
       if(alg>3)
       {
          indexAnc--;
          indexAnc += ColMax;
          row = indexAnc / ColMax;
          row = Math.floor(row);
          if(row>=RowMax)
          {
             indexAnc %= ColMax;
             indexAnc++;
          }
       }
    }        
}
function showCell(index)
{
    var row = index / ColMax;
    row = Math.floor(row);
    var col = index % ColMax;
    showCell1(row,col);
}
function showCell1(row,col)
{
    var cellID = "td_"+row+"_"+col;
    var x = document.getElementById(cellID);
    x.style.color='#000000';
}
function fillInterval1()
{
   var index;
   var anc;
   var menuPrint;
   var elemID = 'a'+indexAnc;
   anc = document.getElementById(elemID);
   anc.style.visibility = 'visible';
   switch(alg)
   {
      case 0:
      case 2:
         indexAnc++;
         if(indexAnc==anchMax)
         {
            clearInterval(intervalID);
            menuPrint = document.getElementById("menu2");
            menuPrint.style.visibility = 'visible';
         }   
         break;   
      case 1:
      case 3:
         indexAnc--;
         if(indexAnc<0)
         {
            clearInterval(intervalID);
            menuPrint = document.getElementById("menu2");
            menuPrint.style.visibility = 'visible';
         }   
         break;   
   }   
}
//-->
