/**
 *
 */
function checkCombination(){
 // score = [$('s1').value,$('s2').value,$('s3').value,$('s4').value,$('s5').value,$('s6').value];
 // if(score.length == 6) 
 xajax_CheckCombination($('s1').value,$('s2').value,$('s3').value,$('s4').value,$('s5').value,$('s6').value,$('s7').value);
 // else alert('Vous devez sélectionner 6 numéros');
 return false;	 
}

/**
 *
 */
function GetNp1(form) {	
	tb = parseFloat(stripBad(form.txtNumber.value));
	tp = parseFloat(stripBad(form.txtNumbe2.value));
	ht = parseFloat(stripBad(form.txtNumbe3.value));
	if( (tp<ht) || (tb<=tp)/* || (tb>47)*/ ) {
		form.txtResult.value= "Please enter valid numbers!";
	} else {
		sht = tp - ht;
		stb = tb - tp;
		ttpos = (fact1(tb)/fact1(stb))/fact1(tp);
		yrods = ((fact1(tp)/fact1(sht))/fact1(ht)) * ((fact1(stb)/fact1(stb - sht)) /fact1(sht));	
		zrods = ttpos/yrods;
		if (isNaN(zrods)) {
		  zrods = 'Infinity';
		} else {
		  zrods = gesult(zrods);
		}
		form.txtResult.value = zrods;
	} 
}

/**
 *
 */
function fact1(gg1) {
	ny = 1;
	nx = gg1;
	for(nn=1;nn<=nx;++nn){
		ny*=nn;
	}
	gg3 = ny;
	return gg3;
}

/**
 *
 */
function stripBad(string) {
	for (i=0, output='', valid="0123456789."; i< string.length; i++)
		if (valid.indexOf(string.charAt(i)) != -1)
			output += string.charAt(i)
	return output;
} 

/**
 *
 */
function gesult(ff){
	if (Number.prototype.toFixed) {
	 	ff = ff.toFixed(2);
	 	ff = parseFloat(ff);
	} else {
	 	leftSide = Math.floor(ff);
	 	rightSide = ff - leftSide;
	 	ff = leftSide + Math.round(rightSide *1e+14)/1e+14;
	}	
 	return ff; // comma();
}

/**
 *
 */
function comma(num) {
	n = Math.floor(num);
	myNum = num + "";
	myDec = ""	 
	if (myNum.indexOf('.',0) > -1){
		myDec = myNum.substring(myNum.indexOf('.',0),myNum.length);
	}	
	arr=new Array('0'), i=0; 
	while (n>0) {
		arr[i]=''+n%1000; 
		n=Math.floor(n/1000); 
		i++;
	}
	arr=arr.reverse();
	for (i in arr) if (i>0)
	while (arr[i].length<3) arr[i]='0'+arr[i];
	return arr.join() + myDec;
}




