	var montharray=new  Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	function FlashTime($className){
		$('.'+$className).each(function()
		{
			$val=$(this).attr('id');
			var today=new Date();
			$dt=$val.substring($val.indexOf('-')+1,$val.length);
			//alert($dt);
			if ($dt.substr(8,1)=='0')
			{
				d=parseInt($dt.substr(9,1));
			}else{
				d=parseInt($dt.substr(8,2));
			}

			//alert(d);
			//m=parseInt($dt.substring($dt.indexOf('-')+1,$dt.lastIndexOf('-')));

			if ($dt.substr(5,1)=='0')
			{
				m=parseInt($dt.substr(6,1));
			}else{
				m=parseInt($dt.substr(5,2));
			}
			if (m==2 && d>29) {
				d=29;
			}else if(m==4 || m==9  || m==11 || m==6){
				if (d>30)
				{
					d==30;
				}
			}else if(d>31)
			{
				d=31;
			}
			yr=parseInt($dt.substr(0,4));
			//alert(parseInt($dt.substr(8,2)));
			//alert(m);
			//alert(yr);
			//alert(yr);
			//alert(d+" "+m+" "+yr);
			theyear=yr;themonth=m;theday=d

			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[m-1]+" "+d+", "+yr+" 23:59:59";
			//alert(futurestring);
			//alert(todaystring);
			dd=Date.parse(futurestring)-Date.parse(todaystring);
			//alert(dd);
			dday=Math.floor(dd/(60*60*1000*24)*1);
			dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
			dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
			dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
			if (dsec<10)
			{
				dsec="0"+dsec;
			}
			if (dmin<10)
			{
				dmin="0"+dmin;
			}
			$(this).html(dday+ " gg "+dhour+" h "+dmin+":"+dsec);
		});
		setTimeout("FlashTime('"+$className+"')",1000);
	}

	function FlashTimeFormatted($className,$formattedClass){
		$('.'+$className).each(function()
		{
			$val=$(this).attr('id');
			var today=new Date();
			$dt=$val.substring($val.indexOf('-')+1,$val.length);
			//alert($dt);
			if ($dt.substr(8,1)=='0')
			{
				d=parseInt($dt.substr(9,1));
			}else{
				d=parseInt($dt.substr(8,2));
			}

			//alert(d);
			//m=parseInt($dt.substring($dt.indexOf('-')+1,$dt.lastIndexOf('-')));

			if ($dt.substr(5,1)=='0')
			{
				m=parseInt($dt.substr(6,1));
			}else{
				m=parseInt($dt.substr(5,2));
			}
			if (m==2 && d>29) {
				d=29;
			}else if(m==4 || m==9  || m==11 || m==6){
				if (d>30)
				{
					d=30;
				}
			}else if(d>31)
			{
				d=31;
			}
			yr=parseInt($dt.substr(0,4));
			//alert(parseInt($dt.substr(8,2)));
			//alert(m);
			//alert(yr);
			//alert(yr);
			//alert(d+" "+m+" "+yr);
			theyear=yr;themonth=m;theday=d

			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[m-1]+" "+d+", "+yr+" 23:59:59";
			//alert(futurestring);
			//alert(todaystring);
			dd=Date.parse(futurestring)-Date.parse(todaystring);
			//alert(dd);
			dday=Math.floor(dd/(60*60*1000*24)*1);
			dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
			dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
			dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
			if (dsec<10)
			{
				dsec="0"+dsec;
			}
			if (dmin<10)
			{
				dmin="0"+dmin;
			}
			if (dday==1) {
				$dday_descr="giorno";
			}else{
				$dday_descr="giorni";
			}
			$(this).html('<strong class="'+$formattedClass+'">'+dday+ '</strong> '+$dday_descr+' <strong class="'+$formattedClass+'">'+dhour+'</strong> h <strong class="'+$formattedClass+'">'+dmin+'</strong> m <strong class="'+$formattedClass+'">'+dsec+'</strong> s');
		});
		setTimeout("FlashTimeFormatted('"+$className+"','"+$formattedClass+"')",1000);
	}

