//*******************************
// Classe periodo
//*******************************
function periodo(value){
   this.value    = value;
   this.anno     = mAnno;
   this.mese     = mMese;
   this.giorno   = mGiorno;
   this.indice   = mIndice;
   this.raccordo = mRaccordo;
   this.tabacchi = mTabacchi;
   this.riga     = mRiga; 
   this.base     = mBase;

}

function mAnno() {

  var ret
  ret = this.value.split("/");
  if (ret[2].length < 4)
  {
     ret[2] =  ("19"+""+ret[2]).substring(0,4)
  }
 
  return parseInt(ret[2]);

}


function mMese() {
  var ret
  ret = this.value.split("/");
  return parseInt(ret[1]*1); 

}
function mGiorno() {
  var ret
  ret = this.value.split("/");
  return parseInt(ret[0]*1); 

}

function mIndice() {

  var ret;   
  ret= matricedati[this.riga()][this.mese()];
  return ret;

}

function mRiga(){
  var ret
  
  a =this.anno()
  b =(a-primo_anno)+1
  ret = b 
  return ret 
}



function mRaccordo(){
  var ret
  ret = matricedati[this.riga()][colbase];
  return ret;
}

function mTabacchi(){
	
/******************************************************
  ritorno il raccordo tabacchi 

*******************************************************/

if (tab_indici=="foi" || tab_indici=="")
{
	if (this.anno()*1 < 1992){ return  1.0000}
	else 	{ if(1992 == this.anno()){if (this.mese()*1 < 2){return  1.0000}else{return 1.0009; } }else{  return 1.0009;  }}	}
	
else {return  1.0000}
	
}

function mBase(){
  var ret 
  var rigamatrice = this.riga()
  coefdiracc  = this.raccordo()

  while (coefdiracc == matricedati[rigamatrice][colbase]){
         rigamatrice -= 1;
  }

  ret = matricedati[rigamatrice][0];

  return ret;
}


