function SetLotteryType (k,n)
{
	JLotto.nNumbersDrawn = k;
	nBallsDrawn = k;
	nBiggestNumber = n;
	SetGuarantee (k,k);
	LotteryTypeText.innerText = ' ' + k + ' balls drawn / ' + n + ' is the biggest number ';
}

function SetGuarantee (t,m)
{
	JLotto.nGuarantee = t;
	GuaranteeText.innerText = ' ' + t + ' numbers match if ' + m + ' numbers are correct'
}


function SetPlayingNumbers (sNumbers)
{
	var str = ' ';
	var n = 0;

	JLotto.sNumbersArray = sNumbers;
	for (var i=0; i < sNumbers.length; i++)
	{
		if (sNumbers.charAt(i) == "1") {
			str += i + 1 + ', ';
			n++;
		}
	}
	PlayingNumbersText.innerText =  str + ' [' + n +']';
	

	// enable buttons
	LotteryType.disabled=true;
	Numbers.disabled=true;	
	Guarantee.disabled=false;
	EvenOdd.disabled=false;
	Consecutives.disabled=false;
	LowHigh.disabled=false;
	Tables.disabled=false;
	FinalDigits.disabled=false;
	Decades.disabled=false;
	Sequences.disabled=false;
	Movement.disabled=false;
	Ranges.disabled=false;
	KeyPositions.disabled=false;
	KeyGroups.disabled=false;
	Spacing.disabled=false;
	Delta.disabled=false;
	Spread.disabled=false;
	Sums.disabled=false;
	Roots.disabled=false;
	KeyNumbers.disabled=false;
	Subsets.disabled=false;
	PrimesSubset.disabled=false;
	Optimization.disabled=false;
	NewWheel.disabled=false;
}

function SetEvenOdd (nEven, nOdd){
	var str = ' ';
	
	JLotto.nEven = nEven;
	JLotto.nOdd = nOdd;
	if (nEven >= 0) str= str + 'max. even: ' + nEven
	if (nOdd >= 0) str = str + ' max. odd: ' + nOdd
	if (nEven < 0 && nOdd < 0) str = ' not set';
	EvenOddText.innerText = str;
}

function SetConsecutives (nPairs,nTriplets,nQuartets)
{
	var str = ' ';
	
	JLotto.nPairs = nPairs;
	JLotto.nTriplets = nTriplets;
	JLotto.nQuartets = nQuartets;
	if (nPairs >= 0) str= str + 'max. pairs: ' + nPairs
	if (nTriplets >= 0) str= str + ' max. triplets: ' + nTriplets
	if (nQuartets >= 0) str= str + ' max. quartets: ' + nQuartets
	if (nPairs < 0 && nTriplets < 0 && nQuartets < 0) str = ' not set';
	ConsecutivesText.innerText = str;	
}

function SetLowHigh (nLow){
	var str = ' ';
	
	JLotto.nLow = nLow;
	if (nLow >= 0)
		str= str + nLow + ' low numbers / ' + (nBallsDrawn - nLow) + ' high numbers';
	else
		str = ' not set';
	LowHighText.innerText = str;
}

function SetFinalDigits (nMaxFinalDigits,nMaxFinalDigitCount,nMaxIndFnDig){
	var str = ' ';
	var i;

	// set maximum for all digits together
	JLotto.nMaxFinalDigits = nMaxFinalDigits;
	if (nMaxFinalDigits >= 0)
		str= str + 'max. match: ' + nMaxFinalDigits + '; ';

	// set maximum for every digits
	JLotto.nMaxFinalDigitCount = nMaxFinalDigitCount;
	if (nMaxFinalDigitCount >= 0)
		str= str + 'digits count: ' + nMaxFinalDigitCount + '; ';
	
	// set maximum for individual final digits
	JLotto.nMaxFinalDigit0=nMaxIndFnDig[0];JLotto.nMaxFinalDigit1=nMaxIndFnDig[1];
	JLotto.nMaxFinalDigit2=nMaxIndFnDig[2];JLotto.nMaxFinalDigit3=nMaxIndFnDig[3];
	JLotto.nMaxFinalDigit4=nMaxIndFnDig[4];JLotto.nMaxFinalDigit5=nMaxIndFnDig[5];
	JLotto.nMaxFinalDigit6=nMaxIndFnDig[6];JLotto.nMaxFinalDigit7=nMaxIndFnDig[7];
	JLotto.nMaxFinalDigit8=nMaxIndFnDig[8];JLotto.nMaxFinalDigit9=nMaxIndFnDig[9];
	for (i=0; i < 10; i++) {
		if (nMaxIndFnDig[i] != -1) str += ' max for digit '+i+': '+nMaxIndFnDig[i]+';';
	}
	if (str == ' ') str+= 'maximum matching final digits'

	FinalDigitsText.innerText = str;
}

function SetDecades (nMinDec,nMaxDec)
{
	var i, str = ' ';
	JLotto.nMinDec1 = nMinDec[0];JLotto.nMaxDec1 = nMaxDec[0];
	JLotto.nMinDec2 = nMinDec[1];JLotto.nMaxDec2 = nMaxDec[1];
	JLotto.nMinDec3 = nMinDec[2];JLotto.nMaxDec3 = nMaxDec[2];
	JLotto.nMinDec4 = nMinDec[3];JLotto.nMaxDec4 = nMaxDec[3];
	JLotto.nMinDec5 = nMinDec[4];JLotto.nMaxDec5 = nMaxDec[4];
	JLotto.nMinDec6 = nMinDec[5];JLotto.nMaxDec6 = nMaxDec[5];
	JLotto.nMinDec7 = nMinDec[6];JLotto.nMaxDec7 = nMaxDec[6];
	JLotto.nMinDec8 = nMinDec[7];JLotto.nMaxDec8 = nMaxDec[7];
	JLotto.nMinDec9 = nMinDec[8];JLotto.nMaxDec9 = nMaxDec[8];
	JLotto.nMinDec10 = nMinDec[9];JLotto.nMaxDec10 = nMaxDec[9];
	
	for (i=0; i < 10; i++) {
		if (nMinDec[i]!= -1 || nMaxDec[i] != -1) {
			str += '[' + i + '1 to ' + eval(i+1) + '0:';
			if (nMinDec[i]!= -1) str += ' min:' + nMinDec[i];
			if (nMaxDec[i]!= -1) str += ' max:' + nMaxDec[i];
			str += '] ';
		}
	}
	DecadesText.innerText = str;
}

function SetSequences (nSequenceLength,nMaxNumbersInSequence)
{
	var str = ' ';
	
	JLotto.nSequenceLength = nSequenceLength;
	JLotto.nMaxNumbersInSequence = nMaxNumbersInSequence;
	str = str + 'length: ' + nSequenceLength + ' / max. numbers: ' + nMaxNumbersInSequence;
	if (nSequenceLength < 0 || nMaxNumbersInSequence < 0) str = ' not set';
	SequencesText.innerText = str;

}

function SetRanges (nMinRanges,nMaxRanges)
{
	var i, str = ' ';
	JLotto.nMinRange1 = nMinRanges[0];JLotto.nMaxRange1 = nMaxRanges[0];
	JLotto.nMinRange2 = nMinRanges[1];JLotto.nMaxRange2 = nMaxRanges[1];
	JLotto.nMinRange3 = nMinRanges[2];JLotto.nMaxRange3 = nMaxRanges[2];
	JLotto.nMinRange4 = nMinRanges[3];JLotto.nMaxRange4 = nMaxRanges[3];
	JLotto.nMinRange5 = nMinRanges[4];JLotto.nMaxRange5 = nMaxRanges[4];
	JLotto.nMinRange6 = nMinRanges[5];JLotto.nMaxRange6 = nMaxRanges[5];
	JLotto.nMinRange7 = nMinRanges[6];JLotto.nMaxRange7 = nMaxRanges[6];
	JLotto.nMinRange8 = nMinRanges[7];JLotto.nMaxRange8 = nMaxRanges[7];
	JLotto.nMinRange9 = nMinRanges[8];JLotto.nMaxRange9 = nMaxRanges[8];
	
	for (i=0; i < 10; i++) {
		if (nMinRanges[i]!= -1 || nMaxRanges[i] != -1) {
			str += '[pos. ' + eval(i+1) + ':';
			if (nMinRanges[i]!= -1) str += ' min:' + nMinRanges[i];
			if (nMaxRanges[i]!= -1) str += ' max:' + nMaxRanges[i];
			str += '] ';
		}
	}
	RangesText.innerText = str;
}

function SetKeyPositions (KeyPositions)
{
	var i, str = 'position/number: ';
	
	JLotto.nKeyPosition1=KeyPositions[0];JLotto.nKeyPosition2=KeyPositions[1];
	JLotto.nKeyPosition3=KeyPositions[2];JLotto.nKeyPosition4=KeyPositions[3];
	JLotto.nKeyPosition5=KeyPositions[4];JLotto.nKeyPosition6=KeyPositions[5];
	JLotto.nKeyPosition7=KeyPositions[6];JLotto.nKeyPosition8=KeyPositions[7];
	JLotto.nKeyPosition9=KeyPositions[8];
	
	for (i=0; i < 10; i++) {
		if (KeyPositions[i]!= -1)
			str += eval(i+1) + '/' + KeyPositions[i] + ' ';
	}
	if (str=='position/number: ') str='not set';
	KeyPositionsText.innerText = str;
}

function SetSpacing (nSpacing,nSpacingRepeat) {
	var str = ' ';
	
	JLotto.nSpacing = nSpacing;
	JLotto.nSpacingRepeat = nSpacingRepeat;
	
	if (nSpacing >= 0) str= str + ' spacing: ' + nSpacing;
	if (nSpacingRepeat >= 0) str= str + ' repeats: ' + nSpacingRepeat
	if (nSpacing < 0 && nSpacingRepeat < 0) str = ' not set';
	SpacingText.innerText = str;
}

function SetDelta (nMinDelta,nMaxDelta,nDeltaRepeat) {
	var str = ' ';
	
	JLotto.nMinDelta = nMinDelta;
	JLotto.nMaxDelta = nMaxDelta;
	JLotto.nDeltaRepeat = nDeltaRepeat;
	
	if (nMinDelta >= 0) str= str + ' min: ' + nMinDelta;
	if (nMaxDelta >= 0) str= str + ' max: ' + nMaxDelta;
	if (nDeltaRepeat >= 0) str= str + ' repeats: ' + nDeltaRepeat
	if (nMinDelta < 0 && nMaxDelta < 0) str = ' not set';
	DeltaText.innerText = str;
}

function SetSpread (nMinSpread,nMaxSpread) {
	var str = ' ';
	
	JLotto.nMinSpread = nMinSpread;
	JLotto.nMaxSpread = nMaxSpread;
	
	if (nMinSpread >= 0) str= str + ' min: ' + nMinSpread;
	if (nMaxSpread >= 0) str= str + ' max: ' + nMaxSpread;
	if (nMinSpread < 0 && nMaxSpread < 0) str = ' not set';
	SpreadText.innerText = str;
}

function SetTable (nColumns,nMaxPerColumn,nMaxPerRow)
{
	var str = ' ';
	
	if (nColumns == -1) nMaxPerColumn = -1;
	if (nMaxPerColumn == -1 && nMaxPerRow == -1) nColumns = -1;
	JLotto.nColumns = nColumns;
	JLotto.nMaxPerColumn = nMaxPerColumn;
	JLotto.nMaxPerRow = nMaxPerRow;
	if (nColumns >= 0) str= str + 'table width: ' + nColumns;
	if (nMaxPerColumn >= 0) str= str + ' max. per column: ' + nMaxPerColumn;
	if (nMaxPerRow >= 0) str= str + ' max. per row: ' + nMaxPerRow;
	if (nColumns == -1) str = ' not set';
	TablesText.innerText = str;	
}

function SetSums (sSumElements,nMinSum,nMaxSum) {
	var str = ' ';
	
	JLotto.sSumElements = sSumElements;
	JLotto.nMinSum = nMinSum;
	JLotto.nMaxSum = nMaxSum;
	
	if ((nMinSum > 0) || (nMaxSum > 0)) {
		str='number positions: ';
		for (i=0; i < sSumElements.length; i++) {
			if (sSumElements.charAt(i) == '1')
				str = str + '(' + eval(i+1) + ') ';
		}
	}	
	if (nMinSum >= 0) str= str + ' min: ' + nMinSum;
	if (nMaxSum >= 0) str= str + ' max: ' + nMaxSum;
	if (nMinSum < 0 && nMaxSum < 0) str = ' not set';
	SumsText.innerText = str;
}

function SetRoots (nMinRoot,nMaxRoot) {
	var str = ' ';
	
	JLotto.nMinRoot = nMinRoot;
	JLotto.nMaxRoot = nMaxRoot;
	
	if (nMinRoot >= 0) str= str + ' min: ' + nMinRoot;
	if (nMaxRoot >= 0) str= str + ' max: ' + nMaxRoot;
	if (nMinRoot < 0 && nMaxRoot < 0) str = ' not set';
	RootsText.innerText = str;
}


//-----------------------------------------------------------------------------
// Function:    SetNumbersSet
// Description: Passes sets of numbers parameters to Java applet
//-----------------------------------------------------------------------------

function  SetNumbersSet (sSetName, sSet, nMin, nMax, sPositions)
{
	var strSelected= "";    // formatted output that contains selected numbers
	var strPos = " ";       // formatted output that contains numbers positions
	var strOut = "";
	
	var strMin, strMax;     // formatted output of min and max amount of numbers
	var nSelected = 0;      // selected numbers counter
	var i, j;
		
	// count numbers and construct the output string
	for (i = 0; i < sSet.length; i++)
	{
		if (sSet.charAt(i) == "1") {
			j = i + 1;
			strSelected = strSelected + j + ', ';
			nSelected++;
		}
	}
	
	// construct the string containing numbers position within the combination
    for (i=1; i <= JLotto.nNumbersDrawn; i++)
	{
		if (sPositions.charAt(i) == "1") {
			strPos = strPos + i + ', ';
		}
	}	
	
	if (nMin == -1)
		strMin = 'n/a' 
	else 
		strMin = nMin.toString();
		
	if (nMax == -1)
		strMax = 'n/a' 
	else 
		strMax = nMax.toString();
		
	if (nSelected > 0) 
	    strOut = strSelected + '(' + nSelected + ')' + ' at: ' + strPos + ' min: '+ strMin + ' max: ' + strMax;
	else
	{
		strOut = "";
	}	
	
	//--- pass parameters to Java applet
	
	switch(sSetName)
    {
        case 'KeyNumbers':
            KeyNumbersText.innerText = strOut;
           	JLotto.sFixed = sSet;
        	JLotto.sSetFixedPositions = sPositions;
            break;
        case 'PrimeNumbers':
            PrimeSubsetsText.innerText = strOut;
           	JLotto.sSetPrimes = sSet;
        	JLotto.sSetPrimesPositions = sPositions;
        	JLotto.nMinSetPrimes = nMin;
        	JLotto.nMaxSetPrimes = nMax;
            break;    
        case 'A':
            SubsetsTextA.innerText = "[A]:" + strOut;
           	JLotto.sSetA = sSet;
        	JLotto.sSetAPositions = sPositions;
        	JLotto.nMinSetA = nMin;
        	JLotto.nMaxSetA = nMax;
            break;    
        case 'B':
            SubsetsTextB.innerText = "[B]:" + strOut;
           	JLotto.sSetB = sSet;
        	JLotto.sSetBPositions = sPositions;
        	JLotto.nMinSetB = nMin;
        	JLotto.nMaxSetB = nMax;
            break;    
        case 'C':
            SubsetsTextC.innerText = "[C]:" + strOut;
           	JLotto.sSetC = sSet;
        	JLotto.sSetCPositions = sPositions;
        	JLotto.nMinSetC = nMin;
        	JLotto.nMaxSetC = nMax;
            break;    
        case 'D':
            SubsetsTextD.innerText = "[D]:" + strOut;
           	JLotto.sSetD = sSet;
        	JLotto.sSetDPositions = sPositions;
        	JLotto.nMinSetD = nMin;
        	JLotto.nMaxSetD = nMax;
            break;    
        case 'E':
            SubsetsTextE.innerText = "[E]:" + strOut;
           	JLotto.sSetE = sSet;
        	JLotto.sSetEPositions = sPositions;
        	JLotto.nMinSetE = nMin;
        	JLotto.nMaxSetE = nMax;
            break;    
        case 'F':
            SubsetsTextF.innerText = "[F]:" + strOut;
           	JLotto.sSetF = sSet;
        	JLotto.sSetFPositions = sPositions;
        	JLotto.nMinSetF = nMin;
        	JLotto.nMaxSetF = nMax;
            break;    

        default:
            ;
    }
}


function SetKeyGroups (sKeyGroupA,sKeyGroupB)
{
	var strA = '';
	var strB = '';
	var i,k,n;

	JLotto.sKeyGroupA = sKeyGroupA;
	JLotto.sKeyGroupB = sKeyGroupB;
	for (i=k=n=0; i < sKeyGroupA.length; i++)
	{
		if (sKeyGroupA.charAt(i) == "1") {
			k = i + 1;
			strA = strA + k + ', ';
			n++;
		}
	}
	if (n > 0) strA = 'Group A: ' + strA;
	for (i=k=n=0; i < sKeyGroupB.length; i++)
	{
		if (sKeyGroupB.charAt(i) == "1") {
			k = i + 1;
			strB = strB + k + ', ';
			n++;
		}
	}
	if (n > 0) strB = 'Group B: ' + strB;
	
	if (strA.length == 0 &&  strB.length == 0)
		KeyGroupsText.innerText = 'not set';
	else
		KeyGroupsText.innerText = strA + ' ' + strB;
}

function SetMovement (sMoveReference,nMoveRange,nMoveTolerance)
{
	var str= " "
	var i, k, n = 0;

	JLotto.sMoveReference = sMoveReference;
	JLotto.nMoveRange = nMoveRange;
	JLotto.nMoveTolerance = nMoveTolerance;
	for (i=0; i < sMoveReference.length; i++)
	{
		if (sMoveReference.charAt(i) == "1") {
			k = i + 1;
			str = str + k + ', ';
			n++;
		}
	}
	str += ' movement: ' + nMoveRange + ' tolerance: ' + nMoveTolerance;
	if (n == 0) str = ' not set';
	MovementText.innerText = str;
}


function SetSubsets (sSetA,nMinSetA,nMaxSetA,sSetB,nMinSetB,nMaxSetB,sSetC,nMinSetC,nMaxSetC,sSetD,nMinSetD,nMaxSetD,sSetE,nMinSetE,nMaxSetE,sSetF,nMinSetF,nMaxSetF,nSetALeftPosition,nSetARightPosition,nSetBLeftPosition,nSetBRightPosition,nSetCLeftPosition,nSetCRightPosition,nSetDLeftPosition,nSetDRightPosition,nSetELeftPosition,nSetERightPosition,nSetFLeftPosition,nSetFRightPosition)
{
	var strA= '';
	var strB= '';
	var strC= '';
	var strD= '';
	var strE= '';
	var strF= '';
	var strMin, strMax;
	var i, j;
	
//--- Set A:
	for (i=j=0; i < sSetA.length; i++)
	{
		if (sSetA.charAt(i) == "1") {
			j = i + 1;
			strA = strA + j + ', ';
		}
	}
	if (nMinSetA == -1)
		strMin = 'n/a' 
	else 
		strMin = nMinSetA.toString();
	if (nMaxSetA == -1)
		strMax = 'n/a' 
	else 
		strMax = nMaxSetA.toString();
	if (j > 0) 
		strA = '[A]: ' + strA + 'min: '+ strMin + ' max: '+ strMax;
	else
		strA = '[A]: empty';

	if (j == 0) {
	    nSetALeftPosition = -1;
	    nSetARightPosition = -1;
	}		
	if (nSetALeftPosition > 0) {
	    strA = strA + '; position: ' + nSetALeftPosition +':' + nSetARightPosition;
	}
	
	JLotto.nSetALeftPosition = nSetALeftPosition;
    JLotto.nSetARightPosition = nSetARightPosition;	   	
	JLotto.sSetA = sSetA;
	JLotto.nMinSetA = nMinSetA;
	JLotto.nMaxSetA = nMaxSetA;


//--- Set B:
	for (i=j=0; i < sSetB.length; i++)
	{
		if (sSetB.charAt(i) == "1") {
			j = i + 1;
			strB = strB + j + ', ';
		}
	}
	if (nMinSetB == -1)
		strMin = 'n/a' 
	else 
		strMin = nMinSetB.toString();
	if (nMaxSetB == -1)
		strMax = 'n/a' 
	else 
		strMax = nMaxSetB.toString();
	if (j > 0) 
		strB = '\n[B]: ' + strB + 'min: '+ strMin + ' max: '+ strMax;
	else
		strB = '\n[B]: empty';

	if (j == 0) {
	    nSetBLeftPosition = -1;
	    nSetBRightPosition = -1;
	}		
		
	if (nSetBLeftPosition > 0) {
	    strB = strB + '; position: ' + nSetBLeftPosition +':' + nSetBRightPosition;
	}
	JLotto.nSetBLeftPosition = nSetBLeftPosition;
    JLotto.nSetBRightPosition = nSetBRightPosition;		
	JLotto.sSetB = sSetB;
	JLotto.nMinSetB = nMinSetB;
	JLotto.nMaxSetB = nMaxSetB;
	

//--- Set C:
	for (i=j=0; i < sSetC.length; i++)
	{
		if (sSetC.charAt(i) == "1") {
			j = i + 1;
			strC = strC + j + ', ';
		}
	}
	if (nMinSetC == -1)
		strMin = 'n/a' 
	else 
		strMin = nMinSetC.toString();
	if (nMaxSetC == -1)
		strMax = 'n/a' 
	else 
		strMax = nMaxSetC.toString();
	if (j > 0)
		strC = '\n[C]: ' + strC + 'min: '+ strMin + ' max: '+ strMax;
	else
		strC = '\n[C]: empty';

	if (j == 0) {
	    nSetCLeftPosition = -1;
	    nSetCRightPosition = -1;
	}		

		
	if (nSetCLeftPosition > 0) {
	    strC = strC + '; position: ' + nSetCLeftPosition +':' + nSetCRightPosition;
	}
	JLotto.nSetCLeftPosition = nSetCLeftPosition;
    JLotto.nSetCRightPosition = nSetCRightPosition;		
	JLotto.sSetC = sSetC;
	JLotto.nMinSetC = nMinSetC;
	JLotto.nMaxSetC = nMaxSetC;

//--- Set D:
	for (i=j=0; i < sSetD.length; i++)
	{
		if (sSetD.charAt(i) == "1") {
			j = i + 1;
			strD = strD + j + ', ';
		}
	}
	if (nMinSetD == -1)
		strMin = 'n/a' 
	else 
		strMin = nMinSetD.toString();
	if (nMaxSetD == -1)
		strMax = 'n/a' 
	else 
		strMax = nMaxSetD.toString();
	if (j > 0)
		strD = '\n[D]: ' + strD + 'min: '+ strMin + ' max: '+ strMax;
	else
		strD = '\n[D]: empty';

	if (j == 0) {
	    nSetDLeftPosition = -1;
	    nSetDRightPosition = -1;
	}		

	if (nSetDLeftPosition > 0) {
	    strD = strD + '; position: ' + nSetDLeftPosition +':' + nSetDRightPosition;
	}
	JLotto.nSetDLeftPosition = nSetDLeftPosition;
    JLotto.nSetDRightPosition = nSetDRightPosition;		
	JLotto.sSetD = sSetD;
	JLotto.nMinSetD = nMinSetD;
	JLotto.nMaxSetD = nMaxSetD;
	
//--- Set E:
	for (i=j=0; i < sSetE.length; i++)
	{
		if (sSetE.charAt(i) == "1") {
			j = i + 1;
			strE = strE + j + ', ';
		}
	}
	if (nMinSetE == -1)
		strMin = 'n/a' 
	else 
		strMin = nMinSetE.toString();
	if (nMaxSetE == -1)
		strMax = 'n/a' 
	else 
		strMax = nMaxSetE.toString();
	if (j > 0)
		strE = '\n[E]: ' + strE + 'min: '+ strMin + ' max: '+ strMax;
	else
		strE = '\n[E]: empty';

	if (j == 0) {
	    nSetELeftPosition = -1;
	    nSetERightPosition = -1;
	}		

	if (nSetELeftPosition > 0) {
	    strE = strE + '; position: ' + nSetELeftPosition +':' + nSetERightPosition;
	}
	JLotto.nSetELeftPosition = nSetELeftPosition;
    JLotto.nSetERightPosition = nSetERightPosition;		
	JLotto.sSetE = sSetE;
	JLotto.nMinSetE = nMinSetE;
	JLotto.nMaxSetE = nMaxSetE;
	
//--- Set F:
	for (i=j=0; i < sSetF.length; i++)
	{
		if (sSetF.charAt(i) == "1") {
			j = i + 1;
			strF = strF + j + ', ';
		}
	}
	if (nMinSetF == -1)
		strMin = 'n/a' 
	else 
		strMin = nMinSetF.toString();
	if (nMaxSetF == -1)
		strMax = 'n/a' 
	else 
		strMax = nMaxSetF.toString();
	if (j > 0)
		strF = '\n[F]: ' + strF + 'min: '+ strMin + ' max: '+ strMax;
	else
		strF = '\n[F]: empty';

	if (j == 0) {
	    nSetFLeftPosition = -1;
	    nSetFRightPosition = -1;
	}		

	if (nSetFLeftPosition > 0) {
	    strF = strF + '; position: ' + nSetFLeftPosition +':' + nSetFRightPosition;
	}
	JLotto.nSetFLeftPosition = nSetFLeftPosition;
    JLotto.nSetFRightPosition = nSetFRightPosition;		
	JLotto.sSetF = sSetF;
	JLotto.nMinSetF = nMinSetF;
	JLotto.nMaxSetF = nMaxSetF;
	
	SubsetsText.innerText = strA + strB + strC +strD + strE + strF;
}


function SetOptimization (nOptimization) {
	JLotto.nOptimization = nOptimization;
	OptimizationText.innerText = ' optimization: '+ nOptimization/5 + '%';
}


function TabChange(tabID) {
	for (var i=0; i<=2; i++) {
		ToolBoxTabs[i].className = "Tab";
		tabContent[i].style.display = "none";
	}
	ToolBoxTabs[tabID].className = "SelectedTab";
	tabContent[tabID].style.display = "";
}

