var nRows;
var cursor = 1;

function toggleCellVisibility( cellId ) {
  var obj = document.getElementById( cellId );
  if ( obj.style.visibility == "visible" ) {
    //obj.style.backgroundColor = "red";
    obj.style.visibility = "hidden";
  }
  else {
    //obj.style.backgroundColor = "blue";
    obj.style.visibility = "visible";
  }
}

function unwind() {
  if ( cursor > (nRows*nRows) ) {
    cursor = 1;
    return;
  }
  else {
    var currentCell = "cell_" + cursor;
    toggleCellVisibility(currentCell);
    cursor++;
    setTimeout('unwind()',65);
  }
}