

	function getCurrentTime()
	{
		var now = new Date();
		var curHour = now.getHours();
		var curMin = now.getMinutes();
		var day = now.getDay();
		var date = now.getDate();
		var year = now.getFullYear();
		var month = now.getMonth();
		var numero = date -1;
			var days = new Array("domenica","lunedi","martedi","mercoledi","giovedi","venerdi","sabato");
var months = new Array("GENNAIO","FEBBRAIO","MARZO","APRILE","MAGGIO","GIUGNO","LUGLIO","AGOSTO","SETTEMBRE","OTTOBRE","NOVEMBRE","DICEMBRE");
var daycur = new Array ("primo","due","tre","quattro","cinque","sei","sette","otto","nove","dieci","undici","dodici","tredici","quattordici","quindici","sedici","diciassette","diciotto","diciannove","venti","ventuno","ventidue","ventitre","ventiquattro","venticinque","ventisei","ventisette","ventotto","ventinove","trenta","trentuno");
		

			if(curMin < 10)
			{
				curMin = "0" + curMin;
			}
			if(curHour < 10)
			{
				curHour = "0" + curHour;
			}

			if (date<10){
					date = "0"+date;
					}
					
					
document.getElementById('timemese').innerHTML=(months[(month)]);
document.getElementById('timedata').innerHTML=(date);
document.getElementById('timenome').innerHTML=(daycur[numero]);
document.getElementById('timegiorno').innerHTML=(days[day]);
document.getElementById('timeora').innerHTML=("ore : " + curHour + ":" + curMin);



}


function countdown(occasion,message_on_occasion,da,mo,yr){

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var crosscount='';
crosscount=document.getElementById("count");
var crossevent='';
crossevent = document.getElementById("evento");
var suffisso = 'no : ';
var today=new Date();
var todayy=today.getYear();
if (todayy < 1000)
todayy+=1900;
var todaym=today.getMonth();
var todayd=today.getDate();
var todayh=today.getHours();
var todaymin=today.getMinutes();
var todaysec=today.getSeconds();
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;
futurestring=montharray[mo-1]+" "+da+", "+yr;
dd=Date.parse(futurestring)-Date.parse(todaystring);

/* ---------------GIORNI----------------------*/

dday=Math.floor(dd/(60*60*1000*24)*1);
daynum = dday-1;			// serve per mantenere numerico il valore
switch(daynum) { 
  
  case 1: 
    //istruzioni 
		suffisso = ' : ';
		dday = dday + ' giorno,  ';
  break; //si ferma qui 

  case 0: 
    //istruzioni 
		dday = '';
		suffisso = 'no ormai ';
  break; //si ferma qui 

  default: 
    //istruzioni 
		dday = dday + ' giorni,  ';
	}
	
/* -------------------- ORE --------------------------*/
dhour=Math.floor(((dd%(60*60*1000*24))/(60*60*1000)*1)+9); 
// il +9  serve per calcolare le 9 del mattino l'ora in cui di solito parte
//un'evento
hournum = dhour;
if (dhour<8&&dday=='') {
		dhour = 'poche ore ';
		}
		else if (hournum==1)
		{
			dhour = hournum + ' ora e ';
		}
		
		else
		{
		dhour = hournum + ' ore e '
		}
/* ------------------  MINUTI -----------------------*/	
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
if (dhour=='poche ore '){
		dmin = '';
		}
		else if (dmin==1)
		{
		dmin = dmin + ' minuto ';
		}
		else if (dmin==0)
		{
		dmin= hournum + ' ore precise &nbsp;';
		dhour='';
		dday = dday.substring(0,9);
		dday = dday + ' e ';
		
		}
		else
		{
		dmin = dmin + ' minuti ';
		}
		
//NEL GIORNO DELL' OCCASIONE
if(daynum<=0&&todayd==da){

crosscount.innerHTML=message_on_occasion
return;
}
//SE E' PASSATA L'OCCASIONE
else if (daynum<=-1){
crosscount.innerHTML="Il " + occasion + "si è già svolto ...";
return;
}
//ALTRIMENTI ASPETTANDOLA
else{
crosscount.innerHTML="Manca"+suffisso + dday+ dhour + dmin +"al :";

crossevent.innerHTML=occasion;
}

}


function calen(init,posx, posy,giorno,mese,anno){
/*		CALEN E' UNA FUNZIONE CREATA DA GIOVANNI AVALLONE ®2011*/
var months = new Array("GEN","FEB","MAR","APR","MAG","GIU","LUG","AGO","SET","OTT","NOV","DIC");
document.write('<style type="text/css">div#calendario'+init+' { position:absolute; visibility:hidden; visibility:visible; font-size:50%; height:61px; width:46px; color:#FDAD4F; font-weight:normal; letter-spacing:-.05em; background:url(scripts/sfondi/calendario.png) no-repeat; } div#mese'+init+' { position:absolute; font-size:80%; color:#FFFFFF; font-weight:bold; letter-spacing:-.05em; }   div#giorno'+init+' { position:absolute; font-size:280%; color:#666; font-weight:bold; letter-spacing:-.05em;  }    div#anno'+init+' { position:absolute; font-size:80%; color:#777; font-weight:bold; letter-spacing:-.05em; }  </style>');			
document.write('<div id="calendario'+init+'"></div><div id="mese'+init+'"></div><div id="giorno'+init+'"></div><div id="anno'+init+'"></div>');		
cal = document.getElementById("calendario" + init );
m = document.getElementById("mese" + init );
g = document.getElementById("giorno" + init );
a = document.getElementById("anno" + init );
cal.style.left = posx+'px';
cal.style.top = posy+'px';
mese = months [mese-1];
cal.style.visibility = "visible";
m.style.left = posx + 12 + 'px' ;
m.style.top = posy + 5 +'px' ;
m.innerHTML = mese;
if (giorno<10) {
		giorno = '0' + giorno
		}
g.style.left = posx + 4 + 'px' ;
g.style.top = posy + 15 +'px' ;
g.innerHTML = giorno;
a.style.left = posx + 13 + 'px' ;
a.style.top = posy + 48 +'px' ;
a.innerHTML = anno;


}



