var contatore=0;
var pos;
var elabora1;
var distanza_num;
var est=new Array();
var numeri="";
function check(){
	
	if (contatore>10){
		
		alert("Attenzione è possibile selezionare 10 numeri per volta");
		
		return false;
		}else{
		
		return true;
		}
	
	}

function selectCell(t){
	contatore++;
	
	if (t.getAttribute("stato")!="1") {
		//reset();
		
		t.style.backgroundColor=colorDown;
		t.setAttribute('stato','1');
		
		
		
		
	}else{
	contatore--;
	t.style.backgroundColor=colorUp;
		t.setAttribute('stato','0');
	}
	searchValue();
	}


function searchValue(){
	contatore=0;
	var contval=0;
	numeri="";
		for (i=1;i<=55;i++){
		t=document.getElementById('cell' +i);
		//document.getElementById("ta").value+=t.getAttribute("stato");	
		if (t.getAttribute("stato")=="1") {
			contval++;
			
			contatore++;
			numeri+= i + "-" ;
			}
		}
	//if ((contatore<2) && (elabora1!="") && (elabora1!="distanza"))getError(); 	
		document.all['numeri'].value=numeri;
	}

function getPos(n){
	r=n % 5;
	if (r==0){
		pos=5;
		ruota=n/5;
		}else{
		pos=r;
		ruota=(n-r)/5+1;
		}
	}




	
function makeArrayEstrazioni(){
	for (ruota_n=1;ruota_n<=10;ruota_n++){
		for (i=1;i<=5;i++){
			n=(ruota_n-1)*5+i;
			
			t=document.all['cell' +n].innerText;
			if (((ruota_n==ruota_n1)&& (pos1==i)) || ((ruota_n==ruota_n2)&& (pos2==i))){
				document.all['cell'+n].style.backgroundColor=colorDown;
				contatore++;
			}
			
			est[ruota_n + "_" + i]=t*1;
			
		}
		
	}
	searchValue();

	}	
	



function reset(){
	
	for (n=1;n<=50;n++){
		document.all['cell'+n].style.backgroundColor=colorUp;
	}			
	}
	