function Riga(altri) {
	this.inizializza(altri);
}

Riga.prototype.inizializza =function (altri) {
	this.celle=new Array();
	this.eventi=new Array();
	this.stile=new Vuoto();
	this.altri= new Array();
	//if (altri!=null)
		this.altri=altri;
};

Riga.prototype.aggiungiStile=function (oStile){
	this.stile=oStile;
};

Riga.prototype.aggiungiCella=function (valore,tipo,decimali){
	return this.celle[this.celle.length]=new Cella(valore,tipo,decimali);
};

Riga.prototype.aggiungiCellaN=function (tab,riga,tipo,fr,decimali){
	var tCella=riga + "-" + this.celle.length;
	var valore=fr.getElementById(tab + "c" + tCella).innerHTML;
	var stile=fr.getElementById(tab + "s" + tCella).innerHTML;
	var evento=fr.getElementById(tab + "e" + tCella).innerHTML;
	var oCella=this.celle[this.celle.length]=new Cella(valore,tipo,decimali);
//	if (evento!=""){
		var eventi=evento.split("§");
		for(var i=0; i<eventi.length; i++){
			var evento=eventi[i].split("@");
			oCella.evento(new Evento(evento[0],evento[1]));
		}
//	}
//	if (stile!=""){
		var stile=stile.split("@");
	try{		
		oCella.setStile(new Stile(stile[0],stile[1]));
	}
	catch(e){}
//	}
	return oCella;
};

Riga.prototype.estraiEvento=function (evento){
	for(var i in this.eventi)
		if (this.eventi[i].tipo==evento) {
			return this.eventi[i].azione;
		}
	return "";
};

Riga.prototype.aggiungiEvento=function (oEvento){
	for(var i in this.eventi)
		if (this.eventi[i].tipo==oEvento.tipo) {
			this.eventi[i].azione+=";" + oEvento.azione;
			return;
		}
	this.eventi[this.eventi.length]=oEvento;
};

Riga.prototype.sostEvento=function (oEvento){
	for(var i in this.eventi)
		if (this.eventi[i].tipo==oEvento.tipo) {
			this.eventi[i]=oEvento;
			return;
		}
	this.eventi[this.eventi.length]=oEvento;
};

Riga.prototype.toString=function (){
	var testo="<tr" + this.stile;
	for ( var i in this.eventi)
		testo+= this.eventi[i];
	testo+= ">";
	for ( var i in this.celle )
		testo+= this.celle[i];
	return testo + "</tr>";
};

Riga.prototype.info = function (indice){
	try{
		return this.altri[indice];
	}
	catch(e){
		return "";
	}
}

Riga.prototype.nCelle = function (){
	return this.celle.length;
}


