function toStrDay(dayValue) {
strDay = new Array(7);
strDay[0]="Domenica";
strDay[1]="Luned&igrave";
strDay[2]="Marted&igrave";
strDay[3]="Mercoled&igrave";
strDay[4]="Gioved&igrave";
strDay[5]="Venerd&igrave";
strDay[6]="Sabato";
return strDay[dayValue];
}

function toStrMonth(MonthValue) {
strMonth = new Array(12);
strMonth[0]="Gennaio";
strMonth[1]="Febbraio";
strMonth[2]="Marzo";
strMonth[3]="Aprile";
strMonth[4]="Maggio";
strMonth[5]="Giugno";
strMonth[6]="Luglio";
strMonth[7]="Agosto";
strMonth[8]="Settembre";
strMonth[9]="Ottobre";
strMonth[10]="Novembre";
strMonth[11]="Dicembre";
return strMonth[MonthValue];
}

function isdigit(chcifra) {
 if (chcifra >="0"  && chcifra<="9") 
  return true;
 else return false; 
}
    
function isnumber(strnumero) {
  if (strnumero.length==0) return false;
  for (i=0;i<strnumero.length;i++)
      if (!isdigit(strnumero.charAt(i)))
	   return false;
  return true;
}

function lefttrim(str) {
while (str.length>0)
 if (str.charAt(0)==" ")
  str=str.substring(1,str.length);
 else
  break;
return str;
}

function righttrim(str) {
while (str.length>0)
 if (str.charAt(str.length-1)==" ")
  str=str.substring(0,str.length-1);
 else
  break;
return str;
}

function trim(str) {
return righttrim(lefttrim(str));
}

function isemptydate(giorno,mese,anno) {
return (giorno=="" && mese=="" && anno=="");
}

function isgteq(gg1,mm1,aa1,gg2,mm2,aa2) {
intgg1=parseInt(gg1);
intmm1=parseInt(mm1);
intaa1=parseInt(aa1);
intgg2=parseInt(gg2);
intmm2=parseInt(mm2);
intaa2=parseInt(aa2);
if (intaa1>intaa2) return true;
if (intaa1==intaa2) {
 if (intmm1>intmm2) return true;
 if (intmm1==intmm2)
  if (intgg1>=intgg2) return true;
}
return false;
}

function isdate(giorno,mese,anno) {
if (giorno=="" && mese=="" && anno=="") return true;
if (isnumber(giorno) && isnumber(mese) && isnumber(anno))
{ 
  gg=parseInt(giorno);
  mm=parseInt(mese);
  aa=parseInt(anno);
  
  if ((aa%4)==0)
    bisestile=true;
  else bisestile=false;
  
  if (mm==1 || mm==3 || mm==5 || mm==7 || mm==8 || mm==10 || mm==12 )
    if (gg>=1 && gg<=31) return true;
	  else return false;
  if (mm==4 || mm==6 || mm==9 || mm==11)
    if (gg>=1 && gg<=30) return true;
	  else return false;
 if (mm==2)
   if (bisestile)
	 if (gg>=1 && gg<=29) return true;
	   else return false;
   else
	 if (gg>=1  && gg<=28) return true;
	   else return false;
  return false;
}
else return false;
}
