var theValues;var theStatusText;var onlyOneStep;var isFinished;var displayCause;function AddNumber(n,fi,fj){	// alle anderen sperren	for (a=0;a<9;a++)	{		if (a != n)			theValues[a][fi*9+fj] = 0;	}	// for		// in der gleichen Zeile	for (a=0;a<9;a++)	{		if ((theValues[n][fi*9+a] == 1)&&(a!=fj))			return false;		theValues[n][fi*9+a] = (a==fj?1:0);	}	// for	// in der gleichen Spalte	for (a=0;a<9;a++)	{		if ((theValues[n][a*9+fj] == 1)&&(a!=fi))			return false;		theValues[n][a*9+fj] = (a==fi?1:0);	}	// for	// in dem gleichen Quadrat	for (a=0;a<3;a++)	{		for (b=0;b<3;b++)		{			if ((theValues[n][(Math.floor(fi/3)*3+a)*9+Math.floor(fj/3)*3+b] == 1)&&(((Math.floor(fi/3)*3+a)*9+Math.floor(fj/3)*3+b) != fi*9+fj))				return false;							if (((Math.floor(fi/3)*3+a)*9+Math.floor(fj/3)*3+b) != fi*9+fj)				theValues[n][(Math.floor(fi/3)*3+a)*9+Math.floor(fj/3)*3+b] = 0;		}	// for	}	// for	return true;}	// AddNumberfunction InitParams(){	for (i=0;i<9;i++)	{		for (j=0;j<9;j++)		{			for (n=0;n<9;n++)				theValues[n][i*9+j] = -1;		}	// for	}	// for		for(i=0;i<9;i++)	{		for (j=0;j<9;j++)		{			theStyle = document.getElementById('td'+(i*9+j)).style;			theNumber = document.form.elements[i*9+j].value;			if (theNumber != '')			{				AddNumber(theNumber-1,i,j);				theStyle.backgroundColor = '#dddddd';				theStyle = document.getElementById('input'+(i*9+j)).style;				theStyle.color = 'black';			}	// if			else			{							theStyle.backgroundColor = '#bbbbff';				theStyle = document.getElementById('input'+(i*9+j)).style;				theStyle.color = 'blue';			}	// else		}	// for	}	// for}	// InitParamsfunction CheckParams(n){	var theTempValues = new Array(0);		for (i=0;i<9;i++)	{		for (j=0;j<9;j++)		{			theNumber = document.form.elements[i*9+j].value;			if ((theNumber != '')&&(theNumber != '1')&&(theNumber != '2')&&(theNumber != '3')&&(theNumber != '4')&&(theNumber != '5')&&(theNumber != '6')&&(theNumber != '7')&&(theNumber != '8')&&(theNumber != '9'))			{				alert('In Zeile '+(i+1)+' und Spalte '+(j+1)+' kommt ein falsches Zeichen vor (erlaubt sind bloss die Zahlen 1-9)!');				theStyle = document.getElementById('td'+(i*9+j)).style;				theStyle.backgroundColor = '#ffbbbb';				theStyle = document.getElementById('input'+(i*9+j)).style;				theStyle.color = 'red';				return false;						}	// if			theTempValues[i*9+j] = (((theNumber != '')&&(theNumber-1 == n))?1:0);		}	// for	}	// for	// nur eine Zahl in der Zeile	for (i=0;i<9;i++)	{		theSum = 0;		for (j=0;j<9;j++)			theSum = theSum + theTempValues[i*9+j];				if (theSum > 1)		{			alert('In Zeile '+(i+1)+' kommt die Zahl '+(n+1)+' mehrfach vor!');						for (j=0;j<9;j++)			{				if (theTempValues[i*9+j] == 1)				{					theStyle = document.getElementById('td'+(i*9+j)).style;					theStyle.backgroundColor = '#ffbbbb';					theStyle = document.getElementById('input'+(i*9+j)).style;					theStyle.color = 'red';				}	// if			}	// for			return false;		}	// if	}	// for	// nur eine Zahl in der Spalte	for (j=0;j<9;j++)	{		theSum = 0;		for (i=0;i<9;i++)			theSum = theSum + theTempValues[i*9+j];				if (theSum > 1)		{			alert('In Spalte '+(j+1)+' kommt die Zahl '+(n+1)+' mehrfach vor!');			for (i=0;i<9;i++)			{				if (theTempValues[i*9+j] == 1)				{					theStyle = document.getElementById('td'+(i*9+j)).style;					theStyle.backgroundColor = '#ffbbbb';					theStyle = document.getElementById('input'+(i*9+j)).style;					theStyle.color = 'red';				}	// if			}	// for			return false;		}	// if	}	// for	// nur eine Variante im Quadrat	for (i=0;i<3;i++)	{		for (j=0;j<3;j++)		{			theSum = 0;			for (k=0;k<3;k++)			{				for (l=0;l<3;l++)					theSum = theSum + theTempValues[i*27+k*9+j*3+l];			}	// for						if (theSum > 1)			{				alert('In einem Quadrat ('+(i+1)+'. Zeile/'+(j+1)+'. Spalte) kommt die Zahl '+(n+1)+' mehrfach vor!');				for (k=0;k<3;k++)				{					for (l=0;l<3;l++)					{						if (theTempValues[i*27+k*9+j*3+l] == 1)						{							theStyle = document.getElementById('td'+(i*27+k*9+j*3+l)).style;							theStyle.backgroundColor = '#ffbbbb';							theStyle = document.getElementById('input'+(i*27+k*9+j*3+l)).style;							theStyle.color = 'red';						}	// if					}	// for				}	// for				return false;			}	// if		}	// for	}	// for	return true;}	// CheckParamsfunction DisplayNumber(n,i,j,isNoError,theCause){	if (displayCause)		alert(theCause);	if ((onlyOneStep)||(!isNoError))	{		var theStyle = document.getElementById('td'+(i*9+j)).style;		theStyle.backgroundColor = '#ffbbbb';		theStyle = document.getElementById('input'+(i*9+j)).style;		theStyle.color = 'red';		if (!isNoError)		{			alert('Fehler bei der Zahl in der '+(i+1)+'. Zeile und '+(j+1)+'. Spalte! Die Ausgangslage war falsch!');			return false;		}	// if	}	// if		document.form.elements[i*9+j].value = n+1;	return true;}	// DisplayNumberfunction CheckPossibleNumber(i,j){	theNumbers = new Array(1,1,1,1,1,1,1,1,1);			for (n=0;n<9;n++)	{		theValue = document.form.elements[i*9+n].value;		if (theValue != '')			theNumbers[theValue-1] = 0;	}	// for		for (n=0;n<9;n++)	{		if (theNumbers[n] == 0)			continue;					if (theValues[n][i*9+j] == 0)			theNumbers[n] = 0;	}	// for		theNumOfNumbers = 0;	theNumber = 0;		for (n=0;n<9;n++)	{		if (theNumbers[n] == 1)		{			theNumOfNumbers++;			theNumber = n;		}	// if	}	// for		if (theNumOfNumbers == 1)	{		DisplayNumber(theNumber,i,j,AddNumber(theNumber,i,j),'Nur eine Zahl');		return true;	}	// if	else		return false;}	// CheckPossibleNumberfunction CalcTripel(){	// Tripel in einer Zeile	for (i=0;i<9;i++)	{								the3Sum = new Array('','','','','','','','','');		theTotalSum = new Array(0,0,0,0,0,0,0,0,0);		theNumSum = new Array(0,0,0,0,0,0,0,0,0);		hasChanged = false;		for (m=0;m<9;m++)		{			for (j=0;j<9;j++)			{				if (theValues[m][i*9+j] == -1)				{					the3Sum[m] += '1';					theTotalSum[j] += 1;					theNumSum[m] += 1;				}	// if				else					the3Sum[m] += '0';			}	// for		}	// for				theUsedNums = new Array(0,0,0,0,0,0,0,0,0);				for (j=0;j<9;j++)		{			if ((theTotalSum[j] <2)||(theTotalSum[j]>3))				continue;			for(l=j+1;l<9;l++)			{				if ((theTotalSum[l] <2)||(theTotalSum[l]>3))					continue;				for(m=l+1;m<9;m++)				{					if ((theTotalSum[m] <2)||(theTotalSum[m]>3))						continue;					for(q=0;q<9;q++)						theUsedNums[q] = 0;					for(q=0;q<9;q++)					{						if (theUsedNums[q] == 0)							theUsedNums[q] = (the3Sum[q][j]-0);						if (theUsedNums[q] == 0)							theUsedNums[q] = (the3Sum[q][l]-0);						if (theUsedNums[q] == 0)							theUsedNums[q] = (the3Sum[q][m]-0);					}	// for					theNums = 0;					for(q=0;q<9;q++)						theNums += (theUsedNums[q]-0);					if (theNums == 3)					{						hasChanged = false;						for(r=0;r<9;r++)						{							if ((r!=j)&&(r!=l)&&(r!=m))							{								for (q=0;q<9;q++)								{									if (theUsedNums[q] == 1)									{										if (theValues[q][i*9+r] == -1)											hasChanged = true;										theValues[q][i*9+r] = 0;									}	// if								}	// for							}	// if						}	// for						if (hasChanged)							return true;					}	// if					}	// for			}	// for		}	// for	}	// for	// Tripel in einer Spalte	for (j=0;j<9;j++)	{								the3Sum = new Array('','','','','','','','','');		theTotalSum = new Array(0,0,0,0,0,0,0,0,0);		theNumSum = new Array(0,0,0,0,0,0,0,0,0);		hasChanged = false;		for (m=0;m<9;m++)		{			for (i=0;i<9;i++)			{				if (theValues[m][i*9+j] == -1)				{					the3Sum[m] += '1';					theTotalSum[i] += 1;					theNumSum[m] += 1;				}	// if				else					the3Sum[m] += '0';			}	// for		}	// for		theUsedNums = new Array(0,0,0,0,0,0,0,0,0);				for (i=0;i<9;i++)		{			if ((theTotalSum[i] <2)||(theTotalSum[i]>3))				continue;			for(l=i+1;l<9;l++)			{				if ((theTotalSum[l] <2)||(theTotalSum[l]>3))					continue;				for(m=l+1;m<9;m++)				{					if ((theTotalSum[m] <2)||(theTotalSum[m]>3))						continue;					for(q=0;q<9;q++)						theUsedNums[q] = 0;					for(q=0;q<9;q++)					{						if (theUsedNums[q] == 0)							theUsedNums[q] = (the3Sum[q][i]-0);						if (theUsedNums[q] == 0)							theUsedNums[q] = (the3Sum[q][l]-0);						if (theUsedNums[q] == 0)							theUsedNums[q] = (the3Sum[q][m]-0);					}	// for					theNums = 0;					for(q=0;q<9;q++)						theNums += (theUsedNums[q]-0);					if (theNums == 3)					{						hasChanged = false;						for(r=0;r<9;r++)						{							if ((r!=i)&&(r!=l)&&(r!=m))							{								for (q=0;q<9;q++)								{									if (theUsedNums[q] == 1)									{										if (theValues[q][r*9+j] == -1)											hasChanged = true;										theValues[q][r*9+j] = 0;									}	// if								}	// for							}	// if						}	// for						if (hasChanged)							return true;					}	// if					}	// for			}	// for		}	// for	}	// for	return false;}	// CalcTripelfunction CalcParams(n){	if (n == 8)	{		for (i=0;i<9;i++)		{			for (j=0;j<9;j++)			{				if (CheckPossibleNumber(i,j))					return 2;			}	// for		}	// for	}	// if		if (isFinished[n])		return 0;	isFinished[n] = true;		// bereits abgeschlossen	for (i=0;i<9;i++)	{		for(j=0;j<9;j++)		{			if (theValues[n][i*9+j] == -1)			{				isFinished[n] = false;				j=9;				i=9;			}	// if		}	// for	}	// for				// nur eine Variante in der Zeile	for (i=0;i<9;i++)	{		theSum = 0;		for (j=0;j<9;j++)			theSum = theSum + theValues[n][i*9+j];				if (theSum == -1)		{			for (j=0;j<9;j++)			{				if (theValues[n][i*9+j] == -1)				{					if (!DisplayNumber(n,i,j,AddNumber(n,i,j),'Zeile'))						return -1;					return 2;									}	// if			}	// for			}	// if	}	// for	// nur eine Variante in der Spalte	for (j=0;j<9;j++)	{		theSum = 0;		for (i=0;i<9;i++)			theSum = theSum + theValues[n][i*9+j];				if (theSum == -1)		{			for (i=0;i<9;i++)			{				if (theValues[n][i*9+j] == -1)				{					if (!DisplayNumber(n,i,j,AddNumber(n,i,j),'Spalte'))						return -1;					return 2;									}	// if			}	// for			}	// if	}	// for	// nur eine Variante im Quadrat	for (i=0;i<3;i++)	{		for (j=0;j<3;j++)		{			theSum = 0;			for (k=0;k<3;k++)			{				for (l=0;l<3;l++)					theSum = theSum + theValues[n][i*27+k*9+j*3+l];			}	// for						if (theSum == -1)			{				for (k=0;k<3;k++)				{					for (l=0;l<3;l++)					{						if (theValues[n][i*27+k*9+j*3+l] == -1)						{							if (!DisplayNumber(n,i*3+k,j*3+l,AddNumber(n,i*3+k,j*3+l),'Quadrat'))								return -1;							return 2;						}	// if					}	// for				}	// for					}	// if		}	// for	}	// for		// nur eine Spalte im Quadrat moeglich	for (i=0;i<3;i++)	{		for (j=0;j<3;j++)		{			the2Sum = new Array(0,0,0);			hasChanged = false;			for (k=0;k<3;k++)			{				for (l=0;l<3;l++)					the2Sum[l] = the2Sum[l] + theValues[n][i*27+k*9+j*3+l];			}	// for			for (l=0;l<3;l++)			{				hasResult = true;								for (m=0;m<3;m++)				{					if (m == l)						hasResult = hasResult&&(the2Sum[l]<0);					else						hasResult = hasResult&&(the2Sum[m]==0);				}	// for								if (hasResult)				{					for (k=0;k<9;k++)					{						if ((Math.floor(k/3) != i)&&(theValues[n][k*9+j*3+l] != 1))						{							if 	(theValues[n][k*9+j*3+l] != 0)								hasChanged = true;								theValues[n][k*9+j*3+l] = 0;						}	// if					}	// for										if (hasChanged)						return 1;							}	// if			}	// for				}	// for	}	// for		// nur eine Zeile im Quadrat moeglich	for (i=0;i<3;i++)	{		for (j=0;j<3;j++)		{			the2Sum = new Array(0,0,0);			hasChanged = false;			for (k=0;k<3;k++)			{				for (l=0;l<3;l++)					the2Sum[k] = the2Sum[k] + theValues[n][i*27+k*9+j*3+l];			}	// for						for (k=0;k<3;k++)			{				hasResult = true;								for (m=0;m<3;m++)				{					if (m == k)						hasResult = hasResult&&(the2Sum[k]<0);					else						hasResult = hasResult&&(the2Sum[m]==0);				}	// for								if (hasResult)				{					for (l=0;l<9;l++)					{						if ((Math.floor(l/3) != j)&&(theValues[n][i*27+l+k*9] != 1))						{							if 	(theValues[n][i*27+l+k*9] != 0)								hasChanged = true;								theValues[n][i*27+l+k*9] = 0;						}	// if					}	// for										if (hasChanged)						return 1;								}	// if			}	// for		}	// for	}	// for	// paarweise frei in einem Quadrat	// drei Felder in einem Quadrat durch drei Zahlen belegt	for (i=0;i<3;i++)	{		for (j=0;j<3;j++)		{			the3Sum = new Array('','','','','','','','','');			theNumOfFields = new Array(0,0,0,0,0,0,0,0,0);			hasChanged = false;			for (m=n;m<9;m++)			{				for (k=0;k<3;k++)				{					for (l=0;l<3;l++)					{											if (theValues[m][i*27+k*9+j*3+l] == 1)							the3Sum[m] = -m-1;						else if (the3Sum[m] >= 0)						{							if (theValues[m][i*27+k*9+j*3+l] == -1)							{								the3Sum[m] = the3Sum[m]+'1';								theNumOfFields[m]++;							}	// if							else								the3Sum[m] = the3Sum[m]+'0';														}	// else												}	// for				}	// for			}	// for			for (m=n+1;m<9;m++)			{				if ((theNumOfFields[m]==2)&&(theNumOfFields[n]==2)&&(the3Sum[m] == the3Sum[n]))				{					for (k=0;k<9;k++)					{						if (the3Sum[m][k] == '1')						{							for (l=0;l<9;l++)							{								if ((l != m)&&(l != n))								{									if (theValues[l][Math.floor(k/3)*9+i*27+(k%3)+j*3] != 0)										hasChanged = true;									theValues[l][Math.floor(k/3)*9+i*27+(k%3)+j*3] = 0;								}	// if							}	// for						}	// if					}	// for				}	// if			}	// for			if (hasChanged)				return 1;						if (the3Sum[n] < 0)				continue;							for (m=n+1;m<9;m++)			{				if (the3Sum[m] < 0)					continue;				for (k=m+1;k<9;k++)				{					if (the3Sum[k] < 0)						continue;											theSum = 0;					for (l=0;l<9;l++)					{						if ((the3Sum[n][l]=='0')&&(the3Sum[m][l]=='0')&&(the3Sum[k][l] == '0'))							theSum += 1;					}	// for					if (theSum == 6)					{						for (l=0;l<9;l++)						{							if ((the3Sum[n][l]!='0')||(the3Sum[m][l]!='0')||(the3Sum[k][l] != '0'))							{								for(p=0;p<9;p++)								{									if ((p!=n)&&(p!=m)&&(p!=k))									{										if (theValues[p][i*27+Math.floor(l/3)*9+j*3+l%3] == -1)										{											hasChanged = true;											theValues[p][i*27+Math.floor(l/3)*9+j*3+l%3] = 0;										}	// if									}	// if								}	// for							}	// if													}	// for											}	// if				}	// for			}	// for									if (hasChanged)				return 1;		}	// for	}	// for	// paarweise frei in einer Zeile	for (i=0;i<9;i++)	{								the3Sum = new Array('','','','','','','','','');		theTotalSum = new Array(0,0,0,0,0,0,0,0,0);		theNumSum = new Array(0,0,0,0,0,0,0,0,0);		hasChanged = false;		for (m=0;m<9;m++)		{			for (j=0;j<9;j++)			{				if (theValues[m][i*9+j] == -1)				{					the3Sum[m] += '1';					theTotalSum[j] += 1;					theNumSum[m] += 1;				}	// if				else					the3Sum[m] += '0';			}	// for		}	// for		for (j=0;j<9;j++)		{			if (theNumSum[n] == 2)			{				for (m=n+1;m<9;m++)				{					if ((theNumSum[m] == 2)&&(the3Sum[n] == the3Sum[m]))					{						for (k=0;k<9;k++)						{							if (the3Sum[n][k] == '1')							{								for (l=0;l<9;l++)								{									if ((l != m)&&(l != n))									{										if (theValues[l][i*9+k] != 0)											hasChanged = true;										theValues[l][i*9+k] = 0;									}	// if								}	// for							}	// if						}	// for						if (hasChanged)							return 1;												}	// if				}	// for			}	// if						if ((theTotalSum[j] == 2)&&(the3Sum[n][j] == 1))			{				theOtherNum = -1;				for (m=n+1;m<9;m++)				{					if (the3Sum[m][j] == 1)					{						theOtherNum = m;						break;					}	// if				}	// for								for (k=j+1;k<9;k++)				{					if ((theTotalSum[k] == 2)&&(the3Sum[n][k] > 0))					{						for (m=n+1;m<9;m++)						{							if ((the3Sum[m][k] == 1)&&(m == theOtherNum))							{								for (l=0;l<9;l++)								{									if ((l != j)&&(l != k))									{										if (theValues[n][i*9+l] != 0)											hasChanged = true;										theValues[n][i*9+l] = 0;										if (theValues[m][i*9+l] != 0)											hasChanged = true;										theValues[m][i*9+l] = 0;									}	// if																	}	// for																						if (hasChanged)									return 1;							}	// if						}	// for										}	// if				}	// for			}	// if		}	// for								}	// for			// paarweise frei in einer Spalte	for (j=0;j<9;j++)	{								the3Sum = new Array('','','','','','','','','');		theTotalSum = new Array(0,0,0,0,0,0,0,0,0);		theNumSum = new Array(0,0,0,0,0,0,0,0,0);		hasChanged = false;		for (m=0;m<9;m++)		{			for (i=0;i<9;i++)			{				if (theValues[m][i*9+j] == -1)				{					the3Sum[m] += '1';					theTotalSum[i] += 1;					theNumSum[m] += 1;				}	// if				else					the3Sum[m] += '0';			}	// for		}	// for		for (i=0;i<9;i++)		{			if (theNumSum[n] == 2)			{				for (m=n+1;m<9;m++)				{					if ((theNumSum[m] == 2)&&(the3Sum[n] == the3Sum[m]))					{						for (k=0;k<9;k++)						{							if (the3Sum[n][k] == '1')							{								for (l=0;l<9;l++)								{									if ((l != m)&&(l != n))									{										if (theValues[l][k*9+j] != 0)											hasChanged = true;										theValues[l][k*9+j] = 0;									}	// if								}	// for							}	// if						}	// for						if (hasChanged)							return 1;												}	// if				}	// for			}	// if						if ((theTotalSum[i] == 2)&&(the3Sum[n][i] == 1))			{				theOtherNum = -1;				for (m=n+1;m<9;m++)				{					if (the3Sum[m][i] == 1)					{						theOtherNum = m;						break;					}	// if				}	// for												for (k=i+1;k<9;k++)				{					if ((theTotalSum[k] == 2)&&(the3Sum[n][k] > 0))					{						for (m=n+1;m<9;m++)						{							if ((the3Sum[m][k] == 1)&&(m == theOtherNum))							{								for (l=0;l<9;l++)								{									if ((l != i)&&(l != k))									{										if (theValues[n][l*9+j] != 0)											hasChanged = true;										theValues[n][l*9+j] = 0;										if (theValues[m][l*9+j] != 0)											hasChanged = true;										theValues[m][l*9+j] = 0;									}	// if																	}	// for																						if (hasChanged)									return 1;							}	// if						}	// for										}	// if				}	// for			}	// if		}	// for				}	// for			// innerhalb Spalte nur in einem Quadrat		for (j=0;j<9;j++)	{		thePositions = new Array(3);		thePositions[0] = false;		thePositions[1] = false;		thePositions[2] = false;		isFilled = false;				for (k=0;k<9;k++)		{			if (theValues[n][k*9+j] == -1)				thePositions[Math.floor(k/3)] = true;			else if (theValues[n][k*9+j] == 1)				isFilled = true;		}	// for						theStart = Math.floor(j/3)*3;						if (!isFilled&&thePositions[0]&&!thePositions[1]&&!thePositions[2])		{			for (i=0;i<3;i++)			{				for (m=0;m<3;m++)				{					if (i+theStart != j)					{						if (theValues[n][m*9+i+theStart] != 0)							hasChanged = true;						theValues[n][m*9+i+theStart] = 0;					}	// if				}	// for			}	// for						if (hasChanged)				return 1;		}	// if		if (!isFilled&&!thePositions[0]&&thePositions[1]&&!thePositions[2])		{			for (i=0;i<3;i++)			{				for (m=3;m<6;m++)				{					if (i+theStart != j)					{						if (theValues[n][m*9+i+theStart] != 0)							hasChanged = true;						theValues[n][m*9+i+theStart] = 0;					}	// if				}	// for			}	// for			if (hasChanged)				return 1;		}	// if		if (!isFilled&&!thePositions[0]&&!thePositions[1]&&thePositions[2])		{			for (i=0;i<3;i++)			{				for (m=6;m<9;m++)				{					if (i+theStart != j)					{						if (theValues[n][m*9+i+theStart] != 0)							hasChanged = true;						theValues[n][m*9+i+theStart] = 0;					}	// if				}	// for			}	// for						if (hasChanged)				return 1;		}	// if	}	// for	// innerhalb Zeile nur in einem Quadrat		for (k=0;k<9;k++)	{		thePositions = new Array(3);		thePositions[0] = false;		thePositions[1] = false;		thePositions[2] = false;		isFilled = false;				for (j=0;j<9;j++)		{			if (theValues[n][k*9+j] == -1)				thePositions[Math.floor(j/3)] = true;			else if (theValues[n][k*9+j] == 1)				isFilled = true;		}	// for						theStart = Math.floor(k/3)*3;								if (!isFilled&&thePositions[0]&&!thePositions[1]&&!thePositions[2])		{			for (i=0;i<3;i++)			{				for (m=0;m<3;m++)				{					if (m+theStart != k)					{						if (theValues[n][(m+theStart)*9+i] != 0)							hasChanged = true;						theValues[n][(m+theStart)*9+i] = 0;					}	// if				}	// for			}	// for						if (hasChanged)				return 1;		}	// if		if (!isFilled&&!thePositions[0]&&thePositions[1]&&!thePositions[2])		{			for (i=3;i<6;i++)			{				for (m=0;m<3;m++)				{					if (m+theStart != k)					{						if (theValues[n][(m+theStart)*9+i] != 0)							hasChanged = true;						theValues[n][(m+theStart)*9+i] = 0;					}	// if				}	// for			}	// for						if (hasChanged)				return 1;		}	// if		if (!isFilled&&!thePositions[0]&&!thePositions[1]&&thePositions[2])		{			for (i=6;i<9;i++)			{				for (m=0;m<3;m++)				{					if (m+theStart != k)					{						if (theValues[n][(m+theStart)*9+i] != 0)							hasChanged = true;						theValues[n][(m+theStart)*9+i] = 0;					}	// if				}	// for			}	// for						if (hasChanged)				return 1;		}	// if	}	// for		return 0;}	// CalcParamsfunction DisplayFieldValues(i,j){		theText = '';	for (n=0;n<9;n++)	{		if (theValues[n][i*9+j] == -1)			theText = theText+(n+1)+' ';	}	// for	alert(theText);}	// DisplayFieldValuesfunction DisplayParams(n){	var i, j;		theText = 'Verteilung von '+n+':\n\n';	n = n-1;	for (i=0;i<9;i++)	{		for (j=0;j<9;j++)		{			theText = theText+' '+(theValues[n][i*9+j]<0?'':' ')+theValues[n][i*9+j];		}	// for		theText = theText+'\n';	}	// for	alert(theText);}	// DisplayParamsfunction DeleteAll(){	self.open('index.php','_self');}	// DeleteAllfunction HandleCheck(displayAlert){	for (n=0;n<9;n++)	{		if (!CheckParams(n))			return false;	}	// for		if (displayAlert)		alert('Alle Werte sind moeglich!');	return true;}	// HandleCheckfunction DoInit(){	theValues = new Array(0);	for (n=0;n<9;n++)		theValues[n] = new Array(0);	InitParams();		document.getElementById('status').innerHTML = 'L&ouml;se (1. Durchgang)...';		setTimeout('DoSolve(0);',1);}	// DoInitfunction DoSolve(theNumOfLoops){	theResult = 0;		for (n=0;n<9;n++)	{		theTempResult = CalcParams(n);		if (theTempResult == -1)		{			document.getElementById('status').innerHTML = theStatusText;			return;		}	// if				theResult = theResult + theTempResult;		if ((onlyOneStep)&&(theTempResult > 1))		{			document.getElementById('status').innerHTML = theStatusText;			return;		}	// if	}	// for	if ((theResult != 0)||(CalcTripel()))	{		document.getElementById('status').innerHTML = 'L&ouml;se ('+(theNumOfLoops+1)+'. Durchgang)...';		setTimeout('DoSolve('+(theNumOfLoops+1)+');',1);	}	// if	else		document.getElementById('status').innerHTML = theStatusText;}	// DoSolvefunction DoCheck(){	if (!HandleCheck(false))	{		document.getElementById('status').innerHTML = theStatusText;		return;	}	// if		document.getElementById('status').innerHTML = '&Uuml;berpr&uuml;fung abgeschlossen, Initialisierung...';		setTimeout('DoInit();',1);}	// DoCheckfunction HandleSolve(doOnlyOneStep){	theStatusText = document.getElementById('status').innerHTML;	onlyOneStep = doOnlyOneStep;	isFinished = new Array(false,false,false,false,false,false,false,false,false);		document.getElementById('status').innerHTML = '&Uuml;berpr&uuml;fung...';		setTimeout('DoCheck();',1);}	// HandleSolvefunction SaveParams(){	theURL = 'index.php?color=on&auto=off';	for(i=0;i<81;i++)		theURL = theURL+'&'+i+'='+document.form.elements[i].value;	self.open(theURL,'_self');}	// SaveParams