
    <!--
      var currFieldName;
      var currFieldOverName='';
      var currFieldOver;
      var blinkCount=0;
      var blinkInterval;
      
      var movePlace = new Array(1000);
      var moveVal = new Array(1000);
      var cellNames = new Array(100);
      var cellFields = new Array(100);
      var mirrorVal = new Array(100);
      var cellNumFields = new Array(16);
      var cur1,cur2,cur3,cur4,cur5,cur6,cur7,cur8,cur9,curX;
      var t1r2d2;
      var numMoves = 0;  
      var timerID = 0;
      var tStart  = null;
      var currMouseValue = 'P';
      var loaded = 0;
      var firstTime = 1;
      var busy = 1;
 
      function Fill1Solution() 
      {
        try {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
            var idName = "A" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "R" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "D" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "S" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "T" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
          }
        if (document.layers)
          Key = e.which;
        else
          Key = window.event.keyCode;
        text = "Congratulations!! You have solved the puzzle!!";
        S0( text, "red", true);  
             text = "Wrong solution (error in column "+m+"). Please try again";
             S0( text, "red", true);  

        }
        }
        catch(err)
        {
	   alert("Error in function Fill1Solution : "+err.description);
        }
      }

      function Restart1Solution() 
      {
        try {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
            var idName = "A" + i.toString() + j.toString();
            
            text = document.getElementById(idName).name;
            var idName = "T" + i.toString() + j.toString();
            
           text = "Congratulations!! You have solved the puzzle!!";
           S0( text, "red", true);  
            if (document.layers)
              Key = e.which;
            else
              Key = window.event.keyCode;

             text = "Wrong solution (error in column "+m+"). Please try again";
             S0( text, "red", true);  
            text = document.getElementById(idName).name;
            var idName = "D" + i.toString() + j.toString();
            
             text = "Wrong solution (error in column "+m+"). Please try again";
             S0( text, "red", true);  
            text = document.getElementById(idName).name;
            var idName = "R" + i.toString() + j.toString();
            
            text = document.getElementById(idName).name;
            if (text.charAt(0)=='R')
            {
              document.getElementById(idName).value = text.charAt(3);
            }
            else
            {
              document.getElementById(idName).value = '';
            }
          }
        }
        if (document.layers)
          Key = e.which;
        else
          Key = window.event.keyCode;

        ClearStatus();
        }
        catch(err)
        {
	   alert("Error in function Restart1Solution : "+err.description);
        }
      }

      function Print1Table() 
      {
        try {
        if (window.print) 
        {
          text = "Congratulations!! You have solved the puzzle!!";
          S0( text, "red", true);  
          for (j = 1; j <= 9; j++)
          {
            if (document.layers)
              Key = e.which;
            else
              Key = window.event.keyCode;

             text = "Wrong solution (error in column "+m+"). Please try again";
             S0( text, "red", true);  
            var idName = "A" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "R" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
             text = "Wrong solution (error in column "+m+"). Please try again";
             S0( text, "red", true);  
            var idName = "T" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "L" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "F" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
          }
          for (k = 1; k <= 9; k++)
          {
            var idName = "A" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
          }
          for (l = 1; l <= 9; l++)
          {
            var idName = "A" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
          }
          window.print();  
        } 
        }
        catch(err)
        {
	   alert("Error in function Print1Solution : "+err.description);
        }
      }

      function Reload1Solution() 
      {
        try {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
            var idName = "A" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "D" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "B" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "R" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
            var idName = "Y" + i.toString() + j.toString();
            document.getElementById(idName).value =
                     document.getElementById(idName).name.charAt(3);
          }
        }
        SudokuForm.SudokuStatus.color=color;
        SudokuForm.SudokuStatus.value=text;
        if (blinkCount)
        {
          startBlink();
        }
        }
        catch(err)
        {
	   alert("Error in function Reload1Solution : "+err.description);
        }
      }

      function PrintTable(gameNum) 
      {
        try {
//        window.open("printSudoku.php?num="+gameNum,"creation","width=420,height=480,toolbar=0,scrollbars=auto,location=0,status=0,menubar=0,resizeable=yes");
          window.open("printSudoku.php?num="+gameNum,"creation","width=840,height=760,toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=0");
        }
        catch(err)
        {
	   alert("Error in function PrintTable : "+err.description);
        }
      }

      function S0( text, color, blink)  
      {
        try {
        SudokuForm.SudokuStatus.style.color=color;
        SudokuForm.SudokuStatus.value=text;
        if (blink)
        {
          startBlink();
        }
        }
        catch(err)
        {
	   alert("Error in function S0 : "+err.description);
        }
      }

      function HandleMouseOver ( fieldName )
      {
        try 
        {
          if ( loaded==1 )
          {
            currFieldOverName = fieldName;
            currFieldOver=cellFields[GetIndexByCellName(fieldName)];
	    currFieldOver.style.cursor=t1r2d2.style.cursor; 
          }
        }
        catch(err)
        {
	   alert("Error in function HandleMouseOver : "+err.description);
        }
      }

      function HandleMouseOut ( fieldName )
      {
        try {
        //document.getElementsByName(fieldName)[0].style.background='white'; 
        //document.getElementsByName(fieldName)[0].style.border='2px solid #fff'; 
        //document.getElementsByName(fieldName)[0].style.bordercolor='#ffffff'; 
        }
        catch(err)
        {
	   alert("Error in function HandleMouseOut : "+err.description);
        }
      }

      function HandleFieldFocus ( cellName )
      {
        try {
        currFieldName = cellName;
        }
        catch(err)
        {
	   alert("Error in function HandleFieldFocus : "+err.description);
        }
      }

      function HandleMouseClick ( cellName )
      {        
         try
         {
           var currVal;
           currFieldName = cellName;

	   //alert ("a="+document.getElementsByName(cellName)[0].readOnly);

          if ( !document.getElementsByName(cellName)[0].readOnly )
          {
           if ( ( currMouseValue >= '1' ) && ( currMouseValue <= '9' ) )
           {
             SetValue ( cellName, 1, currMouseValue );
           }
           else if ( currMouseValue == 'X' )
           {
             SetValue ( cellName, 0, ' ' );
           }
          }
        }
        catch(err)
        {
	   alert("Error in function HandleMouseClick : "+err.description);
        }
      }

      function ChangeVal(e) 
      {
         try {
        var Key;
        var fieldId;
        var val;
        var valStr;
        var currVal;

        ClearStatus();

        if (currFieldName == '') return;

	if (!e) var e = window.event;

        if (document.all)
        {
          Key = window.event.keyCode;
        }
        else
        {
          if (e)
          {
   	    if (e.which) Key = e.which;
	    else if (e.keyCode) Key = e.keyCode;
          }
        }
	
        fieldId = document.getElementsByName(currFieldName)[0].id; 

        if (Key == 27) return;

        if (fieldId.charAt(0)=='A')
        { 
          currVal = document.getElementsByName(currFieldName)[0].value; 

          //alert("Key  = "+Key);
          if ((Key >= 49) && (Key<=57))
          { 
            //val = Key - 48;
            valStr = String.fromCharCode(Key);
            SetValue ( currFieldName, 0, valStr );
          }
          else if ((Key >= 97) && (Key<=105))
          { 
            val = Key - 96;
	        valStr = val + '';
            SetValue ( currFieldName, 0, valStr );
          }
          else if ((Key == 8) || (Key == 46) || (Key == 110))
          { 
            val = ' ';
            SetValue ( currFieldName, 0, ' ' );
          }

          else
          {
            if ( (currVal >= 1) && (currVal<=9) )
            {
                document.getElementsByName(currFieldName)[0].value=currVal; 
            }
              else
            {
              document.getElementsByName(currFieldName)[0].value=" "; 
            }
          }
        }
        }
        catch(err)
        {
  	      alert("Error in function ChangeVal : "+err.description);
        }
      } 

      function SetValue ( cellName, highlight, value )
      {        
        var currVal;
        try
        {
           var index;
           index=GetIndexByCellName(cellName);
           mirrorVal[index] = value;

           currVal = document.getElementsByName(cellName)[0].value;
           document.getElementsByName(cellName)[0].value=value;
           if (highlight==1) HighlightCell ( cellName );
           else ClearHighlightCell ( cellName );
           AddUndoStep( cellName, currVal ) ;
           if (PuzzleIsFull())
           {
             CheckSolution();
           }
        }
        catch(err)
        {
	   alert("Error in function SetValue : "+err.description);
        }
      }

      function Init() 
      {
        try 
        {
           LoadCurs();
        }
        catch(err)
        {
	   alert("Error in function Init : "+err.description);
        }
      }

      function FillSolution() 
      {
        try {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
            var cellName = "A" + i.toString() + j.toString();
            document.getElementsByName(cellName)[0].value =
                     document.getElementsByName(cellName)[0].id.charAt(3);
          }
        }
        }
        catch(err)
        {
	   alert("Error in function FillSolution : "+err.description);
        }
      }

      function LoadCurs ( )
      {
        try {
          var k;
          var cellName;

          if (loaded==0)
          {
            cellNumFields[0] = document.getElementsByName('N1')[0];
            cellNumFields[1] = document.getElementsByName('N2')[0];
            cellNumFields[2] = document.getElementsByName('N3')[0];
            cellNumFields[3] = document.getElementsByName('N4')[0];
            cellNumFields[4] = document.getElementsByName('N5')[0];
            cellNumFields[5] = document.getElementsByName('N6')[0];
            cellNumFields[6] = document.getElementsByName('N7')[0];
            cellNumFields[7] = document.getElementsByName('N8')[0];
            cellNumFields[8] = document.getElementsByName('N9')[0];
            cellNumFields[9] = document.getElementsByName('NX')[0];

            t1r2d2 = document.getElementById("T1R2D2"); 

            cur1 = document.all.item("Cur1");
            cur2 = document.all.item("Cur2");
            cur3 = document.all.item("Cur3");
            cur4 = document.all.item("Cur4");
            cur5 = document.all.item("Cur5");
            cur6 = document.all.item("Cur6");
            cur7 = document.all.item("Cur7");
            cur8 = document.all.item("Cur8");
            cur9 = document.all.item("Cur9");
            curX = document.all.item("CurX");
	    cur1.style.cursor = 'url(one3.cur),auto';
   	    cur2.style.cursor = 'url(two3.cur),auto';
	    cur3.style.cursor = 'url(three3.cur),auto';
	    cur4.style.cursor = 'url(four3.cur),auto';
	    cur5.style.cursor = 'url(five3.cur),auto';
	    cur6.style.cursor = 'url(six3.cur),auto';
	    cur7.style.cursor = 'url(seven3.cur),auto';
	    cur8.style.cursor = 'url(eight3.cur),auto';
	    cur9.style.cursor = 'url(nine3.cur),auto';
	    curX.style.cursor = 'url(x3.cur),auto';

            /*
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur1").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur2").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur3").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur4").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur5").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur6").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur7").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur8").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("Cur9").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 
			       document.all.item("CurX").style.cursor; 
    	    document.getElementsByName("A11")[0].style.cursor = 'default';
            */

            k=0;

            for (i = 1; i <= 9; i++)
            {
              for (j = 1; j <= 9; j++)
              {
                cellName = "A" + i.toString() + j.toString();
	        cellNames[k] = cellName;
                cellFields[k] = document.getElementsByName(cellName)[0];
                mirrorVal[k] = cellFields[k].value;
                k++;
              }
            }

            /*
            for (i = 0; i <= 80; i++)
            {
    	     cellFields[i].style.cursor = cur1.style.cursor; 
    	     cellFields[i].style.cursor = cur2.style.cursor; 
    	     cellFields[i].style.cursor = cur3.style.cursor; 
    	     cellFields[i].style.cursor = cur4.style.cursor; 
    	     cellFields[i].style.cursor = cur5.style.cursor; 
    	     cellFields[i].style.cursor = cur6.style.cursor; 
    	     cellFields[i].style.cursor = cur7.style.cursor; 
    	     cellFields[i].style.cursor = cur8.style.cursor; 
    	     cellFields[i].style.cursor = cur9.style.cursor; 
    	     cellFields[i].style.cursor = curX.style.cursor; 
    	     cellFields[i].style.cursor = 'default'; 
            }
            */
          }

          var table = document.getElementById("SudokuTable");

          /* Initialization code. */
          if (table.addEventListener)
          {
      	    table.addEventListener('DOMMouseScroll', handle_wheel1, false);
          }
          table.onmousewheel = handle_wheel1;


          loaded=1;
        } 
        catch(err)
        {
	   alert("Error in function LoadCurs : "+err.description);
        }
      }

      function ChangeMouseSelection ( delta )
      {
        try {
	if ( delta == 1 )
        {
          if ( currMouseValue == '1' ) MouseSelection ('2');
          else if ( currMouseValue == '2' ) MouseSelection ('3');
          else if ( currMouseValue == '3' ) MouseSelection ('4');
          else if ( currMouseValue == '4' ) MouseSelection ('5');
          else if ( currMouseValue == '5' ) MouseSelection ('6');
          else if ( currMouseValue == '6' ) MouseSelection ('7');
          else if ( currMouseValue == '7' ) MouseSelection ('8');
          else if ( currMouseValue == '8' ) MouseSelection ('9');
          else if ( currMouseValue == '9' ) MouseSelection ('X');
          else if ( currMouseValue == 'X' ) MouseSelection ('1');
        }
	else 
        {
          if ( currMouseValue == 'X' ) MouseSelection ('9');
          else if ( currMouseValue == '1' ) MouseSelection ('X');
          else if ( currMouseValue == '2' ) MouseSelection ('1');
          else if ( currMouseValue == '3' ) MouseSelection ('2');
          else if ( currMouseValue == '4' ) MouseSelection ('3');
          else if ( currMouseValue == '5' ) MouseSelection ('4');
          else if ( currMouseValue == '6' ) MouseSelection ('5');
          else if ( currMouseValue == '7' ) MouseSelection ('6');
          else if ( currMouseValue == '8' ) MouseSelection ('7');
          else if ( currMouseValue == '9' ) MouseSelection ('8');
        }
        }
        catch(err)
        {
	   alert("Error in function ChangeMouseSelection : "+err.description);
        }
      }

      function Mouse1Selection ( value )
      {
        try {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
             var cellName = "A" + i.toString() + j.toString();
 
     	     if ( document.getElementsByName(cellName)[0].value == value )
             {
               HighlightCell ( cellName );
             }
	     else
             {
               ClearHighlightCell ( cellName );
             }

	     switch (value) 
	     {
	        case '1': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur1").style.cursor; 
		             break;
	        case '2': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur2").style.cursor; 
		             break;
	        case '3': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur3").style.cursor; 
		             break;
	        case '4': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur4").style.cursor; 
		             break;
	        case '5': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur5").style.cursor; 
		             break;
	        case '6': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur6").style.cursor; 
		             break;
	        case '7': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur7").style.cursor; 
		             break;
	        case '8': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur8").style.cursor; 
		             break;
	        case '9': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("Cur9").style.cursor; 
		             break;
	        case 'X': 
		   document.getElementsByName(cellName)[0].style.cursor =
			     document.all.item("CurX").style.cursor; 
		             break;
	        case 'P': 
		   document.getElementsByName(cellName)[0].style.cursor = 'default';
		             break;
		default : ;
	     }
          }

	    switch (value) 
	    {
	    	case '1': 
			t1r2d2.style.cursor = cur1.style.cursor; 
	                text = "Click on a square to insert \'1\'      ";
		             break;
		case '2': 
			t1r2d2.style.cursor = cur2.style.cursor; 
	                text = "Click on a square to insert \'2\'      ";
		             break;
		case '3': 
			t1r2d2.style.cursor = cur3.style.cursor; 
	                text = "Click on a square to insert \'3\'      ";
		             break;
	        case '4': 
			t1r2d2.style.cursor = cur4.style.cursor; 
	                text = "Click on a square to insert \'4\'      ";
		             break;
	        case '5': 
			t1r2d2.style.cursor = cur5.style.cursor; 
	                text = "Click on a square to insert \'5\'      ";
		             break;
	        case '6': 
			t1r2d2.style.cursor = cur6.style.cursor; 
	                text = "Click on a square to insert \'6\'      ";
		             break;
	        case '7': 
			t1r2d2.style.cursor = cur7.style.cursor; 
	                text = "Click on a square to insert \'7\'      ";
		             break;
	        case '8': 
			t1r2d2.style.cursor = cur8.style.cursor; 
	                text = "Click on a square to insert \'8\'      ";
		             break;
	        case '9': 
			t1r2d2.style.cursor = cur9.style.cursor; 
	                text = "Click on a square to insert \'9\'      ";
		             break;
	        case 'X': 
			t1r2d2.style.cursor = curX.style.cursor; 
	                text = "Click on a square to clear it.   ";
		             break;
	        case 'P': 
			t1r2d2.style.cursor = 'default'; 
	                text = "                                         ";
		             break;
		default : ;
            }


        }
        currMouseValue = value;
        }
        catch(err)
        {
	   alert("Error in function MouseSelection1 : "+err.description);
        }
      }

      function Mouse2Selection ( value )
      {
        try {
        var cellName;

        if ( loaded==1 )
        {
	    switch (value) 
	    {
	    	case '1': 
			t1r2d2.style.cursor = cur1.style.cursor; 
	                text = "Click on a square to insert \'1\'      ";
		             break;
		case '2': 
			t1r2d2.style.cursor = cur2.style.cursor; 
	                text = "Click on a square to insert \'2\'      ";
		             break;
		case '3': 
			t1r2d2.style.cursor = cur3.style.cursor; 
	                text = "Click on a square to insert \'3\'      ";
		             break;
	        case '4': 
			t1r2d2.style.cursor = cur4.style.cursor; 
	                text = "Click on a square to insert \'4\'      ";
		             break;
	        case '5': 
			t1r2d2.style.cursor = cur5.style.cursor; 
	                text = "Click on a square to insert \'5\'      ";
		             break;
	        case '6': 
			t1r2d2.style.cursor = cur6.style.cursor; 
	                text = "Click on a square to insert \'6\'      ";
		             break;
	        case '7': 
			t1r2d2.style.cursor = cur7.style.cursor; 
	                text = "Click on a square to insert \'7\'      ";
		             break;
	        case '8': 
			t1r2d2.style.cursor = cur8.style.cursor; 
	                text = "Click on a square to insert \'8\'      ";
		             break;
	        case '9': 
			t1r2d2.style.cursor = cur9.style.cursor; 
	                text = "Click on a square to insert \'9\'      ";
		             break;
	        case 'X': 
			t1r2d2.style.cursor = curX.style.cursor; 
	                text = "Click on a square to clear it.   ";
		             break;
	        case 'P': 
			t1r2d2.style.cursor = 'default'; 
	                text = "                                         ";
		             break;
		default : ;
            }

          for (i = 0; i <= 80; i++)
          {
             cellName = cellNames[i];
     	     if ( document.getElementsByName(cellName)[0].value == value )
             {
               HighlightCell ( cellName );
             }
	     else
             {
               if (firstTime==0)
               {
                 ClearHighlightCell ( cellName );
               }
             }
          }

	  var table = document.getElementsByName("SudokuTable");

          switch (value) 
	  {
	     case '1': 
      	           table.cursor = document.all.item("Cur1").style.cursor; 
		             break;
	        case '2': 
      	           table.cursor = document.all.item("Cur2").style.cursor; 
		             break;
	        case '3': 
      	           table.cursor = document.all.item("Cur3").style.cursor; 
		             break;
	        case '4': 
      	           table.cursor = document.all.item("Cur4").style.cursor; 
		             break;
	        case '5': 
      	           table.cursor = document.all.item("Cur5").style.cursor; 
		             break;
	        case '6': 
      	           table.cursor = document.all.item("Cur6").style.cursor; 
		             break;
	        case '7': 
      	           table.cursor = document.all.item("Cur7").style.cursor; 
		             break;
	        case '8': 
      	           table.cursor = document.all.item("Cur8").style.cursor; 
		             break;
	        case '9': 
      	           table.cursor = document.all.item("Cur9").style.cursor; 
		             break;
	        case 'X': 
      	           table.cursor = document.all.item("CurX").style.cursor; 
		             break;
	        case 'P': 
		   table.cursor = 'default';
		             break;
		default : ;
          }
          currMouseValue = value;
          firstTime = 0;
         }
        }
        catch(err)
        {
	   alert("Error in function MouseSelection : "+err.description);
        }
      }

      function Mouse3Selection ( value )
      {
        try {
        var cellName;

        if ( loaded==1 )
        {
          for (i = 0; i <= 80; i++)
          {
             cellName = cellNames[i];
     	     if ( document.getElementsByName(cellName)[0].value == value )
             {
               HighlightCell ( cellName );
             }
	     else
             {
               if (firstTime==0)
               {
                 ClearHighlightCell ( cellName );
               }
             }

	     switch (value) 
	     {
	        case '1': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur1").style.cursor; 
		             break;
	        case '2': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur2").style.cursor; 
		             break;
	        case '3': 
		   document.getElementsByName(cellName)[0].style.cursor =
			       document.all.item("Cur3").style.cursor; 
		             break;
	        case '4': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur4").style.cursor; 
		             break;
	        case '5': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur5").style.cursor; 
		             break;
	        case '6': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur6").style.cursor; 
		             break;
	        case '7': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur7").style.cursor; 
		             break;
	        case '8': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur8").style.cursor; 
		             break;
	        case '9': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur9").style.cursor; 
		             break;
	        case 'X': 
		   document.getElementsByName(cellName)[0].style.cursor =
			       document.all.item("CurX").style.cursor; 
		             break;
	        case 'P': 
		   document.getElementsByName(cellName)[0].style.cursor = 'default';
		             break;
		default : ;
	     }
          }
	    switch (value) 
	    {
	    	case '1': 
			t1r2d2.style.cursor = cur1.style.cursor; 
	                text = "Click on a square to insert \'1\'      ";
		             break;
		case '2': 
			t1r2d2.style.cursor = cur2.style.cursor; 
	                text = "Click on a square to insert \'2\'      ";
		             break;
		case '3': 
			t1r2d2.style.cursor = cur3.style.cursor; 
	                text = "Click on a square to insert \'3\'      ";
		             break;
	        case '4': 
			t1r2d2.style.cursor = cur4.style.cursor; 
	                text = "Click on a square to insert \'4\'      ";
		             break;
	        case '5': 
			t1r2d2.style.cursor = cur5.style.cursor; 
	                text = "Click on a square to insert \'5\'      ";
		             break;
	        case '6': 
			t1r2d2.style.cursor = cur6.style.cursor; 
	                text = "Click on a square to insert \'6\'      ";
		             break;
	        case '7': 
			t1r2d2.style.cursor = cur7.style.cursor; 
	                text = "Click on a square to insert \'7\'      ";
		             break;
	        case '8': 
			t1r2d2.style.cursor = cur8.style.cursor; 
	                text = "Click on a square to insert \'8\'      ";
		             break;
	        case '9': 
			t1r2d2.style.cursor = cur9.style.cursor; 
	                text = "Click on a square to insert \'9\'      ";
		             break;
	        case 'X': 
			t1r2d2.style.cursor = curX.style.cursor; 
	                text = "Click on a square to clear it.   ";
		             break;
	        case 'P': 
			t1r2d2.style.cursor = 'default'; 
	                text = "                                         ";
		             break;
		default : ;
            }

          currMouseValue = value;
          firstTime = 0;
        }
        }
        catch(err)
        {
	   alert("Error in function MouseSelection : "+err.description);
        }
      }

      function Mouse4Selection ( value )
      {
        try {
          var cellName;

          if ( loaded==1 )
          {
            for (i = 0; i <= 80; i++)
            {
              cellName = cellNames[i];
     	      if ( document.getElementsByName(cellName)[0].value == value )
              {
                HighlightCell ( cellName );
              }
  	      else
              {
                if (!firstTime)
                {
                  ClearHighlightCell ( cellName );
                }
              }

	      switch (value) 
	      {
	        case '1': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur1").style.cursor; 
		             break;
	        case '2': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur2").style.cursor; 
		             break;
	        case '3': 
		   document.getElementsByName(cellName)[0].style.cursor =
			       document.all.item("Cur3").style.cursor; 
		             break;
	        case '4': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur4").style.cursor; 
		             break;
	        case '5': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur5").style.cursor; 
		             break;
	        case '6': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur6").style.cursor; 
		             break;
	        case '7': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur7").style.cursor; 
		             break;
	        case '8': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur8").style.cursor; 
		             break;
	        case '9': 
		   document.getElementsByName(cellName)[0].style.cursor = 
			       document.all.item("Cur9").style.cursor; 
		             break;
	        case 'X': 
		   document.getElementsByName(cellName)[0].style.cursor =
			       document.all.item("CurX").style.cursor; 
		             break;
	        case 'P': 
		   document.getElementsByName(cellName)[0].style.cursor = 'default';
		             break;
		default : ;
	      }
            }
	    switch (value) 
	    {
	    	case '1': 
			t1r2d2.style.cursor = cur1.style.cursor; 
	                text = "Click on a square to insert \'1\'      ";
		             break;
		case '2': 
			t1r2d2.style.cursor = cur2.style.cursor; 
	                text = "Click on a square to insert \'2\'      ";
		             break;
		case '3': 
			t1r2d2.style.cursor = cur3.style.cursor; 
	                text = "Click on a square to insert \'3\'      ";
		             break;
	        case '4': 
			t1r2d2.style.cursor = cur4.style.cursor; 
	                text = "Click on a square to insert \'4\'      ";
		             break;
	        case '5': 
			t1r2d2.style.cursor = cur5.style.cursor; 
	                text = "Click on a square to insert \'5\'      ";
		             break;
	        case '6': 
			t1r2d2.style.cursor = cur6.style.cursor; 
	                text = "Click on a square to insert \'6\'      ";
		             break;
	        case '7': 
			t1r2d2.style.cursor = cur7.style.cursor; 
	                text = "Click on a square to insert \'7\'      ";
		             break;
	        case '8': 
			t1r2d2.style.cursor = cur8.style.cursor; 
	                text = "Click on a square to insert \'8\'      ";
		             break;
	        case '9': 
			t1r2d2.style.cursor = cur9.style.cursor; 
	                text = "Click on a square to insert \'9\'      ";
		             break;
	        case 'X': 
			t1r2d2.style.cursor = curX.style.cursor; 
	                text = "Click on a square to clear it.   ";
		             break;
	        case 'P': 
			t1r2d2.style.cursor = 'default'; 
	                text = "                                         ";
		             break;
		default : ;
            }


	    switch (value) 
	    {
	    	case '1': 
			t1r2d2.style.cursor = document.all.item("Cur1").style.cursor; 
		             break;
		case '2': 
			t1r2d2.style.cursor = document.all.item("Cur2").style.cursor; 
		             break;
		case '3': 
			t1r2d2.style.cursor = document.all.item("Cur3").style.cursor; 
		             break;
	        case '4': 
			t1r2d2.style.cursor = document.all.item("Cur4").style.cursor; 
		             break;
	        case '5': 
			t1r2d2.style.cursor = document.all.item("Cur5").style.cursor; 
		             break;
	        case '6': 
			t1r2d2.style.cursor = document.all.item("Cur6").style.cursor; 
		             break;
	        case '7': 
			t1r2d2.style.cursor = document.all.item("Cur7").style.cursor; 
		             break;
	        case '8': 
			t1r2d2.style.cursor = document.all.item("Cur8").style.cursor; 
		             break;
	        case '9': 
			t1r2d2.style.cursor = document.all.item("Cur9").style.cursor; 
		             break;
	        case 'X': 
			t1r2d2.style.cursor = document.all.item("CurX").style.cursor; 
		             break;
	        case 'P': 
			t1r2d2.style.cursor = 'default'; 
		             break;
		default : ;
            }

            currMouseValue = value;
            firstTime = 0;
          }
          return false;
        }
        catch(err)
        {
	   alert("Error in function MouseSelection : "+err.description);
        }
      }

      function MouseSelection ( value )
      {
        try {
          var cellField;
          var text;

          if ( loaded==1 )
          {
            UpdateHighlightByValue ( currMouseValue, value );
	    switch (value) 
	    {
	    	case '1': 
			t1r2d2.style.cursor = cur1.style.cursor; 
	                text = "Click on a square to insert \'1\'      ";
		             break;
		case '2': 
			t1r2d2.style.cursor = cur2.style.cursor; 
	                text = "Click on a square to insert \'2\'      ";
		             break;
		case '3': 
			t1r2d2.style.cursor = cur3.style.cursor; 
	                text = "Click on a square to insert \'3\'      ";
		             break;
	        case '4': 
			t1r2d2.style.cursor = cur4.style.cursor; 
	                text = "Click on a square to insert \'4\'      ";
		             break;
	        case '5': 
			t1r2d2.style.cursor = cur5.style.cursor; 
	                text = "Click on a square to insert \'5\'      ";
		             break;
	        case '6': 
			t1r2d2.style.cursor = cur6.style.cursor; 
	                text = "Click on a square to insert \'6\'      ";
		             break;
	        case '7': 
			t1r2d2.style.cursor = cur7.style.cursor; 
	                text = "Click on a square to insert \'7\'      ";
		             break;
	        case '8': 
			t1r2d2.style.cursor = cur8.style.cursor; 
	                text = "Click on a square to insert \'8\'      ";
		             break;
	        case '9': 
			t1r2d2.style.cursor = cur9.style.cursor; 
	                text = "Click on a square to insert \'9\'      ";
		             break;
	        case 'X': 
			t1r2d2.style.cursor = curX.style.cursor; 
	                text = "Click on a square to clear it.   ";
		             break;
	        case 'P': 
			t1r2d2.style.cursor = 'default'; 
	                text = "                                         ";
		             break;
		default : ;
            }
           
            if (currFieldOverName!='')
            {
  	      //document.getElementsByName(currFieldOverName)[0].style.cursor=t1r2d2.style.cursor; 
  	      currFieldOver.style.cursor=t1r2d2.style.cursor; 
            }
            S0( text, "blue", false);  

	    HighlightMouseNum(value);

            for (i = 0; i <= 80; i++)
            {
              cellField = cellFields[i];
              /*
     	      if ( cellField.value == value )
              {
                HighlightField ( cellField );
              }
  	      else if (cellField.value == currMouseValue)
              {
                if (firstTime==0)
                {
                  ClearHighlightField ( cellField );
                }
              }
              */

              /*
	      switch (value) 
	      {
	        case '1': 
		   cellField.style.cursor = cur1.style.cursor; 
		             break;
	        case '2': 
		   cellField.style.cursor = cur2.style.cursor; 
		             break;
	        case '3': 
		   cellField.style.cursor = cur3.style.cursor; 
		             break;
	        case '4': 
		   cellField.style.cursor = cur4.style.cursor; 
		             break;
	        case '5': 
		   cellField.style.cursor = cur5.style.cursor; 
		             break;
	        case '6': 
		   cellField.style.cursor = cur6.style.cursor; 
		             break;
	        case '7': 
		   cellField.style.cursor = cur7.style.cursor; 
		             break;
	        case '8': 
		   cellField.style.cursor = cur8.style.cursor; 
		             break;
	        case '9': 
		   cellField.style.cursor = cur9.style.cursor; 
		             break;
	        case 'X': 
		   cellField.style.cursor = curX.style.cursor; 
		             break;
	        case 'P': 
		   cellField.style.cursor = 'default';
		             break;
		default : ;
	      }
              */
            }

            currMouseValue = value;
            busy = 0;

            firstTime = 0;
          }
          return false;
        }
        catch(err)
        {
	   alert("Error in function MouseSelection : "+err.description);
        }
      }

      function HighlightMouseNum ( value )
      {
        try 
        {
	  switch (currMouseValue) 
	  {
	    case '1': 
                 ClearHighlightNum(cellNumFields[0]);
		 break;
            case '2': 
                 ClearHighlightNum(cellNumFields[1]);
	         break;
	    case '3': 
                 ClearHighlightNum(cellNumFields[2]);
	         break;
	    case '4': 
                 ClearHighlightNum(cellNumFields[3]);
	         break;
	    case '5': 
                 ClearHighlightNum(cellNumFields[4]);
	         break;
	    case '6': 
                 ClearHighlightNum(cellNumFields[5]);
	         break;
	    case '7': 
                 ClearHighlightNum(cellNumFields[6]);
	         break;
	    case '8': 
                 ClearHighlightNum(cellNumFields[7]);
	         break;
	    case '9': 
                 ClearHighlightNum(cellNumFields[8]);
	         break;
	    case 'X': 
                 ClearHighlightNum(cellNumFields[9]);
		 break;
            default : ;
	  }
	  switch (value) 
	  {
	    case '1': 
                 HighlightNum(cellNumFields[0]);
		 break;
            case '2': 
                 HighlightNum(cellNumFields[1]);
	         break;
	    case '3': 
                 HighlightNum(cellNumFields[2]);
	         break;
	    case '4': 
                 HighlightNum(cellNumFields[3]);
	         break;
	    case '5': 
                 HighlightNum(cellNumFields[4]);
	         break;
	    case '6': 
                 HighlightNum(cellNumFields[5]);
	         break;
	    case '7': 
                 HighlightNum(cellNumFields[6]);
	         break;
	    case '8': 
                 HighlightNum(cellNumFields[7]);
	         break;
	    case '9': 
                 HighlightNum(cellNumFields[8]);
	         break;
	    case 'X': 
                 HighlightNum(cellNumFields[9]);
		 break;
            default : ;
	  }
        }
        catch(err)
        {
	   alert("Error in function HighlightCurrNum : "+err.description);
        }
      }

      function ClearHighlightMouseNum()
      {
        try 
        {
          ClearHighlightNum('N1');
          ClearHighlightNum('N2');
          ClearHighlightNum('N3');
          ClearHighlightNum('N4');
          ClearHighlightNum('N5');
          ClearHighlightNum('N6');
          ClearHighlightNum('N7');
          ClearHighlightNum('N8');
          ClearHighlightNum('N9');
          ClearHighlightNum('NX');
          ClearHighlightNum('NP');
        }
        catch(err)
        {
	   alert("Error in function ClearHighlightMouseNum : "+err.description);
        }
      }

      function HighlightNum ( field )
      {
        try {
	  field.style.background = '#dddddd'; 
        }
        catch(err)
        {
	   alert("Error in function HighlightNum : "+err.description);
        }
      }

      function ClearHighlightNum ( field )
      {
        try {
	  field.style.background = 'White'; 
        }
        catch(err)
        {
	   alert("Error in function ClearHighlightNum : "+err.description);
        }
      }

      function HighlightCell ( cellName )
      {
        try {
        //document.getElementsByName(cellName)[0].style.background = 'Tomato'; 
	//document.getElementsByName(cellName)[0].style.border =
	//      				'2px solid #f0f'; 
	//document.getElementsByName(cellName)[0].style.border = '2px solid #ff4500';
	document.getElementsByName(cellName)[0].style.border = '2px solid blue';
        }
        catch(err)
        {
	   alert("Error in function HighlightCell : "+err.description);
        }
      }

      function ClearHighlightCell ( cellName )
      {
        try {
        //document.getElementsByName(cellName)[0].style.background = 'white'; 
	document.getElementsByName(cellName)[0].style.border =
   	    			'2px solid #fff'; 
        }
        catch(err)
        {
	   alert("Error in function ClearHighlightCell : "+err.description);
        }
      }

      function HighlightField ( field )
      {
        try {
  	  //field.style.border = '2px solid cyan';
  	  field.style.border = '2px solid blue';
        }
        catch(err)
        {
	  alert("Error in function HighlightField : "+err.description);
        }
      }

      function ClearHighlightField ( field )
      {
        try {
	  field.style.border = '2px solid #fff'; 
        }
        catch(err)
        {
	   alert("Error in function ClearHighlightField : "+err.description);
        }
      }

      function ClearAllHighlights()
      {
        try {
        for (i = 0; i <= 80; i++)
        {
           ClearHighlightCell ( cellNames[i] );
        }
        }
        catch(err)
        {
	   alert("Error in function ClearAllHighlightCell : "+err.description);
        }
      }

      function HandleTableMouseWheel(e)
      {
        try 
        { 
          if ((loaded==1) && (firstTime==0))
          {
            if (busy==0)
            {
              if (((currMouseValue>='1') && (currMouseValue<='9')) ||
                   (currMouseValue == 'X'))
              {
                busy = 1;
	        window.event.returnValue = false;
                HandleMouseWheel(e);
              }
            }
          }
        }
        catch(err)
        {
	   alert("Error in function HandleTableMouseWheel : "+err.description);
        }
      } 

      function HandleMouseWheel(e)
      {
        try 
        {
          if (busy==1)
          {
            if ( ( ( currMouseValue >= '1' ) && ( currMouseValue <= '9' ) ) ||
                 ( currMouseValue == 'X'  ) )
            {
   	      //window.event.returnValue = false;

     	      if (!e) e = window.event;

   	      if ( e.wheelDelta <= 0 || e.detail > 0) 
              { 
                ChangeMouseSelection(-1); 
              }
	      else 
              { 
                ChangeMouseSelection(1); 
              }
              busy =0;
            }
          }
        }
        catch(err)
        {
	   alert("Error in function HandleMouseWheel : "+err.description);
        }
      } 

      function GetIndexByCellName( cellName )
      {
        try {
          var index=-1;
          for (i = 0; i <= 80; i++)
          {
            if ( cellName == cellNames[i] )
            {
              index = i;
              break;
            }
          }
          return index;
        }
        catch(err)
        {
	   alert("Error in function GetIndexByCellName : "+err.description);
        }
      }
     
      function UpdateHighlightByValue ( oldValue , newValue )
      {
        try {
          for (i = 0; i <= 80; i++)
          {
            if ( mirrorVal[i] == oldValue )
            {
               ClearHighlightField ( cellFields[i] );
            }
            else if ( mirrorVal[i] == newValue )
            {
               HighlightField ( cellFields[i] );
            }
          }
        }
        catch(err)
        {
	   alert("Error in function UpdateHighlightByValue : "+err.description);
        }
      }
     

      function RestartSolution() 
      {
        try 
        {
          var cellName;
          for (i = 0; i <= 80; i++)
          {
            var cellName = cellNames[i];
            
            text = document.getElementsByName(cellName)[0].id;
            if (text.charAt(0)=='R')
            {
              document.getElementsByName(cellName)[0].value = text.charAt(3);
              mirrorVal[i] = cellFields[i].value;
            }
            else
            {
              document.getElementsByName(cellName)[0].value = '';
              mirrorVal[i] = 0;
            }
            ClearHighlightCell ( cellName );
          }
          ClearStatus();
          numMoves=0; 
          MouseSelection ( 'P' );
        }
        catch(err)
        {
	   alert("Error in function RestartSolution : "+err.description);
        }
      }

      function SendToPrinter() 
      {
        try {
        if (window.print) {
          window.print() ;  
        } 
        }
        catch(err)
        {
	   alert("Error in function SendToPrinter : "+err.description);
        }
      }

      function UndoStep() 
      {
        var index;
        var cellName;

        ClearStatus();

        if ( numMoves > 0 )
        {
          cellName = movePlace[numMoves];
          document.getElementsByName(cellName)[0].value=moveVal[numMoves];
          index=GetIndexByCellName(cellName);
          mirrorVal[index] = moveVal[numMoves];
      	  if ( document.getElementsByName(movePlace[numMoves])[0].value !=  
		 currMouseValue )
          {
            ClearHighlightCell ( movePlace[numMoves] );
          }
          numMoves--;
        }
      }

      function AddUndoStep( cellName, currVal ) 
      {
	numMoves++;
        movePlace[numMoves]=cellName;
        moveVal[numMoves]=currVal; 
      }

      function ZoomLarge() 
      {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
             var cellName = "A" + i.toString() + j.toString();
             var text = document.getElementsByName(cellName)[0].id;
             if (text.charAt(0)!='R')
             {
               document.getElementsByName(cellName)[0].className = "bigcl1";
             }
             else
             {
               document.getElementsByName(cellName)[0].className = "bigcl11";
             }
          }
        }
      }

      function ZoomMedium() 
      {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
             var cellName = "A" + i.toString() + j.toString();
             var text = document.getElementsByName(cellName)[0].id;
             if (text.charAt(0)!='R')
             {
               document.getElementsByName(cellName)[0].className = "midcl1";
             }
             else
             {
               document.getElementsByName(cellName)[0].className = "midcl11";
             }
          }
        }
      }

      function ZoomSmall() 
      {
        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
             var cellName = "A" + i.toString() + j.toString();
             var text = document.getElementsByName(cellName)[0].id;
             if (text.charAt(0)!='R')
             {
               document.getElementsByName(cellName)[0].className = "cl1";
             }
             else
             {
               document.getElementsByName(cellName)[0].className = "cl11";
             }
          }
        }
      }

      function PuzzleIsFull()  
      {
        var cellValue;
        var puzzleFull;

        puzzleFull=1;

        for (i = 0; i <= 80; i++)
        {
          cellValue=(document.getElementsByName(cellNames[i]))[0].value;
          if ( (cellValue<'1') || (cellValue>'9') )
          {
            puzzleFull=0;
            break;
          }
        }
        return puzzleFull;
      }

      function CheckSolution()  
      {
        var text;
        var res=1;       

        for (i = 1; i <= 9; i++)
        {
          for (j = 1; j <= 9; j++)
          {
            var cellName = "A" + i.toString() + j.toString();

            var x=document.getElementsByName(cellName)
            var cellValue = x[0].value;

            if ( (cellValue<'1') || (cellValue>'9') )
            {
               text = "Please complete the empty cells!!";
               S0( text, "red", true);  
               res=0;
               break;        
            }
          }
        }

        if (res==0) return false;

        for (m = 1; m <= 9; m++)
        {
          res = CheckRow(m);
          if (res==0)
          {
             text = "Wrong number in row "+m+". Please try again";
             S0( text, "red", true);  
             break;        
          }

          res = CheckColumn(m);
          if (res==0)
          {
             text = "Wrong number in column "+m+". Please try again";
             S0( text, "red", true);  
             break;        
          }

          res = CheckSquare(m-1);
          if (res==0)
          {
             text = "Wrong solution. Please try again";
             S0( text, "red", true);  
             break;
          }
        }

        if (res==0) return false;

        MouseSelection ( 'P' );
        text = "Congratulations!! You have solved the puzzle!!";
        S0( text, "green", true);  

        return true;
      }

      function CheckRow(rowNum)
      {
        var cellValue;
        var arr = new Array();
        var i;
 
        for (k=0; k<9; k++)
        {
          arr[k] = 0;
        }

        i=rowNum;
        for (j=1; j<=9; j++)
        {
          var cellName = "A" + i.toString() + j.toString();
          cellValue = document.getElementsByName(cellName)[0].value;
          
          if ( (cellValue>='1') && (cellValue<='9') )
          {
            arr[cellValue-'1']=1;
          }
        }

        for (k=0; k<9; k++)
        {
          if (arr[k]!=1) return 0;
        }

        return 1;
      }

      function CheckColumn(columnNum)
      {
        var cellValue;
        var arr = new Array();
        var i;
 
        for (k=0; k<9; k++)
        {
          arr[k] = 0;
        }

        j=columnNum;
        for (i=1; i<=9; i++)
        {
          var cellName = "A" + i.toString() + j.toString();
          cellValue = document.getElementsByName(cellName)[0].value;
          
          if ( (cellValue>='1') && (cellValue<='9') )
          {
            arr[cellValue-'1']=1;
          }
        }

        for (k=0; k<9; k++)
        {
          if (arr[k]!=1) return 0;
        }

        return 1;
      }

      function CheckSquare(squareNum)
      {
        var cellValue;
        var arr = new Array();
 
        for (k=0; k<9; k++)
        {
          arr[k] = 0;
        }

        for (r=1; r<=3; r++)
        {
          for (c=1; c<=3; c++)
          {
            i = r + (Math.floor(squareNum / 3)) * 3;
            j = c + (squareNum % 3) * 3;
            var cellName = "A" + i.toString() + j.toString();
            cellValue = document.getElementsByName(cellName)[0].value;
          
            if ( (cellValue>='1') && (cellValue<='9') )
            {
              arr[cellValue-'1']=1;
            }
          }
        }

        for (k=0; k<9; k++)
        {
          if (arr[k]!=1) return 0;
        }
        return 1;
      }

      function doBlink() 
      {
        if (blinkCount>0)
        {
          blinkCount++;
        }

        if (blinkCount>=5)
        {
          blinkCount=0;
          clearInterval(blinkInterval);
          SudokuForm.SudokuStatus.style.visibility = "";
        }
        else
        {
          SudokuForm.SudokuStatus.style.visibility =
             SudokuForm.SudokuStatus.style.visibility == "" ? "hidden" : "";
        }
      }

      function ClearStatus() 
      {
         blinkCount=0;
         clearInterval(blinkInterval);
         SudokuForm.SudokuStatus.value=" ";
      }

      function startBlink() 
      {
        // Make sure it is IE4
        if (document.all)
        {
          if (blinkCount==0)
          {
            blinkCount=1;
            blinkInterval = setInterval("doBlink()",700);
          }
        }
      }

      //window.onload = startBlink;

      function ResetTimer() 
      {
        tStart = null;
        SudokuForm.theTime.value = "   00:00";
      }

      function StartTimer() 
      {
        tStart   = new Date();
        SudokuForm.theTime.value = "   00:00";
        timerID  = setTimeout("UpdateTimer()", 1000);
      }

      function StopTimer()
      {
        if(timerID) 
        {
          clearTimeout(timerID);
          timerID  = 0;
        }
        tStart = null;
      }

      function UpdateTimer() 
      {
         if(timerID) 
         {
           clearTimeout(timerID);
           clockID  = 0;
         }

         if (!tStart)
         {
           tStart   = new Date();
         }

         var   tDate = new Date();
         var   tDiff = tDate.getTime() - tStart.getTime();

         tDate.setTime(tDiff);

         minutes = tDate.getMinutes();
         seconds = tDate.getSeconds();

	 if (seconds < 10) 
	 { 
           seconds = '0' + seconds; 
         }

	 if (minutes < 10) 
	 { 
           minutes = '0' + minutes; 
         }

         SudokuForm.theTime.value = "   " + minutes + ":" + seconds;
   
         timerID = setTimeout("UpdateTimer()", 1000);
      }

      function handle_wheel1(event)
      {
        try 
        { 
          if ((loaded==1) && (firstTime==0))
          {
            if (busy==0)
            {
              if (((currMouseValue>='1') && (currMouseValue<='9')) ||
                   (currMouseValue == 'X'))
              {
                busy = 1;
 
                if (!event)
                {
                  event = window.event;
  	          window.event.returnValue = false;
                }

                if (event.preventDefault)
                {
                  event.preventDefault();
                }

 	        //event.returnValue = false;
                HandleMouseWheel(event);
              }
            }
          }
        }
        catch(err)
        {
   	  alert("Error in function Handle_Wheel1 : "+err.description);
        }
      }


    //-->

