function dw(s) {return s;} //{document.write(s);}
colors = new Array("blue", "#00FF80", "red", "#00C000", "#CC00CC");
function td(n, s) 
{var t=
 dw("<td");
 if (n >= 0) t += dw(" bgcolor=" + colors[n]);
 t += dw(">");
 //dw( " &nbsp; &nbsp;  &nbsp;" ); // or: s
 t += dw(s);
 t += dw("</td>");
 return t;
}
x = -1;
function filltable(incr)
{
x = (x+incr+sols.length) % sols.length;
xs = x*3;
xyz = sols[x];
startstr = starts[xs] + "," + starts[xs+1] + "," + starts[xs+2];
somehtml = "<table class=med>";
somehtml += "<tr><th colspan=18>" + 
	'<a href="javascript:filltable(-1);">PREV</a> ' +
	'<a href="javascript:filltable(1);">NEXT</a><br> ' +
		(x+1) + ":  " + startstr + "</th></tr>";
i = -1;
sq = 0;
for (row=0; row < 13; row++)
  {
   somehtml += dw("<tr>");
   for (j = 0; j < 19; j++)
   {
   switch (row % 3)
     {
      case 0:
	 switch (j%3)
	   {
	    case 0: somehtml += td(-1, "&nbsp;"); break;
	    case 1:
	    case 2:
		    i++;
		    somehtml += td(xyz.charAt(i), i+""); break;
	   }
         break;
      case 1:
         switch (j%3)
	   {
	    case 0:
	    	    i++;
		    somehtml += td(xyz.charAt(i), i+""); 
		    break;
	    case 1:
		att = "";
		if (sq == starts[xs]) att = "bgcolor='" + colors[0] + "' ";
		if (sq == starts[xs+1]) att = "bgcolor='" + colors[1] + "' ";
		if (sq == starts[xs+2]) att = "bgcolor='" + colors[2] + "' ";
	    	somehtml += dw("<td " + att + "colspan=2 rowspan=2><b>" +
		  sq + "&nbsp;" + "</b></td>");
		sq++;
		break;
	   }
	   break;
      case 2:
         switch (j%3)
	   {
	    case 0: 
	    	    i++;
		    somehtml += td(xyz.charAt(i), i+""); 
		    break;
	    case 1:
	    case 2:
	   }
         break;
     }
   }
   somehtml += dw("</tr>");
  }
var targ1 = document.getElementById("targ1");
targ1.innerHTML = somehtml + "</table>";
}
filltable(1);
