function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Non è stato possibile impostare un gestore di eventi");
  }
}

addEvent(window,'load',init,false);


//imposto di default (usati su onload) i parametri per avanti
first_go_next="&inizio=4&fine=6";
function init(){
	if (document.getElementById('go-mappa')){
		initMaps();
		btn_gomappa=document.getElementById('go-mappa');
		btn_gomappa.onclick=function (){mgnInfoMap(this.href);return false;}
		}
		
	if (document.getElementById('next-to')){
		btn_next_to=document.getElementById('next-to');
		btn_next_to.onclick=function (){loadXMLDocTo('/tc/xmlEventi.do?area=Torino'+first_go_next,'to');return false;}
		}
	if (document.getElementById('next-roma')){
		btn_next_rm=document.getElementById('next-roma');
		btn_next_rm.onclick=function (){loadXMLDocRm('/tc/xmlEventi.do?area=Roma'+first_go_next,'roma');return false;}
		}
	if (document.getElementById('next-retour')){
		btn_next_ret=document.getElementById('next-retour');
		btn_next_ret.onclick=function (){loadXMLDocRet('/tc/xmlEventi.do?area=Retour'+first_go_next,'retour');return false;}
		}
	if (document.getElementById('btn-cal-to')){
		btn_cal_ret=document.getElementById('btn-cal-to');
		btn_cal_ret.onclick=function (){displayCal('torino');return false;}
		}
	if (document.getElementById('btn-cal-roma')){
		btn_cal_ret=document.getElementById('btn-cal-roma');
		btn_cal_ret.onclick=function (){displayCal('roma');return false;}
		}
	if (document.getElementById('btn-cal-retour')){
		btn_cal_ret=document.getElementById('btn-cal-retour');
		btn_cal_ret.onclick=function (){displayCal('retour');return false;}
		}
	if (document.getElementById('cal-torino')){
				calto=Calendar.setup(
				{
					flat         : "cal-torino",
					flatCallback : dateChangedTo,
					dateStatusFunc : specialDateStatusFuncTo,
					range : [2006, 2007]
				}
   			 );
		setStylesCal('cal-torino');
		}
	if (document.getElementById('cal-roma')){
				calroma=Calendar.setup(
				{
					flat         : "cal-roma",
					flatCallback : dateChangedRoma,
					dateStatusFunc : specialDateStatusFuncRoma,
					range : [2006, 2007]
				}
   			 );
		setStylesCal('cal-roma');
		}
	if (document.getElementById('cal-retour')){
				calretour=Calendar.setup(
				{
					flat         : "cal-retour",
					flatCallback : dateChangedRet,
					dateStatusFunc : specialDateStatusFuncRet,
					range : [2006, 2007]
				}
   			 );
		setStylesCal('cal-retour');
		}
}
    function dateIsSpecial(year, month, day,col) {
		if (col=='to'){
        spyTo = special_days_to[year];
        if (!spyTo) return false;
        spmTo = special_days_to[year][month];
        if (!spmTo) return false;
        for (var i in spmTo) if (spmTo[i] == day) return true;
        return false;
		}
		if (col=='roma'){
        spyRoma = special_days_roma[year];
        if (!spyRoma) return false;
        spmRoma = special_days_roma[year][month];
        if (!spmRoma) return false;
        for (var i in spmRoma) if (spmRoma[i] == day) return true;
        return false;
		}
		if (col=='retour'){
        spyRet = special_days_retour[year];
        if (!spyRet) return false;
        spmRet = special_days_retour[year][month];
        if (!spmRet) return false;
        for (var i in spmRet) if (spmRet[i] == day) return true;
        return false;
		}
		if (col=='scheda'){
        spyScheda = special_days_scheda[year];
        if (!spyScheda) return false;
        spmScheda = special_days_scheda[year][month];
        if (!spmScheda) return false;
        for (var i in spmScheda) if (spmScheda[i] == day) return true;
        return false;
		}
    }

    function dateChangedTo(calendar) {
			//!calendar.dateClicked fa si che il btn next month o next year non vada su location.href e quindi nn apre altre pagine..
		 if(!calendar.dateClicked){
			 return;
			 }
		if (calendar) {
            var y = calendar.date.getFullYear();
            var m = calendar.date.getMonth();
            var d = calendar.date.getDate();
		if (spyTo[m]){
			for (t=0;t<spyTo[m].length;t++){
					if (spyTo[m][t]==d){
					//alert('giorno '+d+' '+m+' '+y);
					window.location.href="/tc/searchCalendario.do?pagchiamante=evento_&area=Torino&day="+d+"&month="+m+"&year="+y;
					}
				}
			}
        }
    }
	 function dateChangedRoma(calendar) {
		 	//!calendar.dateClicked fa si che il btn next month o next year non vada su location.href e quindi nn apre altre pagine..
		 if(!calendar.dateClicked){
			 return;
			 }
		if (calendar) {
            var y = calendar.date.getFullYear();
            var m = calendar.date.getMonth();
            var d = calendar.date.getDate();
		if (spyRoma[m]){
			for (r=0;r<spyRoma[m].length;r++){
					if (spyRoma[m][r]==d){
					//alert('Hai scelto di visualizzare l\'evento associato al giorno '+d+' '+m+' '+y);
					window.location.href="/tc/searchCalendario.do?pagchiamante=evento_&area=Roma&day="+d+"&month="+m+"&year="+y;
					}
				}
		}
        }
    }
	   function dateChangedRet(calendar) {
		   	//!calendar.dateClicked fa si che il btn next month o next year non vada su location.href e quindi nn apre altre pagine..
		 if(!calendar.dateClicked){
			 return;
			 }
		if (calendar) {
            var y = calendar.date.getFullYear();
            var m = calendar.date.getMonth();
            var d = calendar.date.getDate();
		if (spyRet[m]){
			for (rt=0;rt<spyRet[m].length;rt++){
					if (spyRet[m][rt]==d){
					//alert('Hai scelto di visualizzare l\'evento associato al giorno '+d+' '+m+' '+y);
					window.location.href="/tc/searchCalendario.do?pagchiamante=evento_&area=Retour&day="+d+"&month="+m+"&year="+y;
					}
				}
			}
        }
    }
	 function dateChangedScheda(calendar) {
		 	//!calendar.dateClicked fa si che il btn next month o next year non vada su location.href e quindi nn apre altre pagine..
		 if(!calendar.dateClicked){
			 return;
			 }
		if (calendar) {
            var y = calendar.date.getFullYear();
            var m = calendar.date.getMonth();
            var d = calendar.date.getDate();
		if (spyScheda[m]){
			for (t=0;t<spyScheda[m].length;t++){
					if (spyScheda[m][t]==d){
					//alert('Hai scelto di visualizzare l\'evento associato al giorno '+d+' '+m+' '+y);
					//window.location.href="paginaTorino.html";
                    window.location.href="/tc/searchCalendario.do?pagchiamante=evento_&area="+par_area_cal+"&day="+d+"&month="+m+"&year="+y;
					}
				}
			}
        }
    }

    function specialDateStatusFuncTo(date, y, m, d) {
        if (dateIsSpecial(y, m, d,'to')) {
        return "special";
        }
        else
        return false;
        };
	function specialDateStatusFuncRoma(date, y, m, d) {
        if (dateIsSpecial(y, m, d,'roma')) {
        return "special";
        }
        else
        return false;
        };
    function specialDateStatusFuncRet(date, y, m, d) {
        if (dateIsSpecial(y, m, d,'retour')) {
        return "special";
        }
        else
        return false;
        };
	 function specialDateStatusFuncScheda(date, y, m, d) {
        if (dateIsSpecial(y, m, d,'scheda')) {
        return "special";
        }
        else
        return false;
        };


function setStylesCal(calcitta){
	if (calcitta=='cal-scheda'){
		var ccalend=document.getElementById(calcitta);
		cal_btn_info=ccalend.getElementsByTagName('td');
		cal_btn_info[0].style.backgroundColor="#C1B58F";
		}
	else{
		var ccalend=document.getElementById(calcitta);
		cal_btn_info=ccalend.getElementsByTagName('td');
		cal_btn_info[0].style.backgroundColor="#E4D9B9";
	}
}



function displayCal(calCity){
	calendario=document.getElementById('cal-'+calCity);
	txt_btn_cal=document.getElementById('btn-cal-'+calCity)
		if (calCity=='torino'){
		txt_btn_cal=document.getElementById('btn-cal-to')
		}
		else {
			txt_btn_cal=document.getElementById('btn-cal-'+calCity);
			}
		if (calendario.style.display==''||calendario.style.display=='none'){
		calendario.style.display="block";
		txt_btn_cal.firstChild.innerHTML='elenco';
		}
		else {
			calendario.style.display="none";
			txt_btn_cal.firstChild.innerHTML='calendario';
			}
	}





//INIZIA CARICAMENTO DATI XML
var xmlhttpTo;
var docTo;
function loadXMLDocTo(url,col){
city=col;
//alert('di torino'+url)
if (window.XMLHttpRequest)
  {
  xmlhttpTo=new XMLHttpRequest()
  xmlhttpTo.onreadystatechange=state_ChangeTo
  xmlhttpTo.open("GET",url,true)
  xmlhttpTo.send(null)
  }
else if (window.ActiveXObject)
  {
  xmlhttpTo=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttpTo)
    {
    xmlhttpTo.onreadystatechange=state_ChangeTo
    xmlhttpTo.open("GET",url,true)
    xmlhttpTo.send()
    }
  }
}
function state_ChangeTo()
{
if (xmlhttpTo.readyState==4)
  {
  if (xmlhttpTo.status==200)
  {
  docTo=xmlhttpTo.responseXML;//imposto il documento cosi' e' visibile a tutte le funzioni
  drawContentTo(docTo,city);
  mngFade('start',city);
  if (done==true){
	 mngFade('stop',city);
	  }
  }
  else
  {alert("Problemi nel caricamento dei dati:" + xmlhttpTo.statusText)}

  }
}


//INIZIA CARICAMENTO DATI XML
var xmlhttpRm;
var docRm;
function loadXMLDocRm(url,col){
city=col;
//alert('di roma'+url)
if (window.XMLHttpRequest)
  {
  xmlhttpRm=new XMLHttpRequest()
  xmlhttpRm.onreadystatechange=state_ChangeRm
  xmlhttpRm.open("GET",url,true)
  xmlhttpRm.send(null)
  }
else if (window.ActiveXObject)
  {
  xmlhttpRm=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttpRm)
    {
    xmlhttpRm.onreadystatechange=state_ChangeRm
    xmlhttpRm.open("GET",url,true)
    xmlhttpRm.send()
    }
  }
}
function state_ChangeRm()
{
if (xmlhttpRm.readyState==4)
  {
  if (xmlhttpRm.status==200)
  {
  docRm=xmlhttpRm.responseXML;//imposto il documento cosi' e' visibile a tutte le funzioni
  drawContentRm(docRm,city);
  mngFade('start',city);
  if (done==true){
	 mngFade('stop',city);
	  }
  }
  else
  {alert("Problemi nel caricamento dei dati:" + xmlhttpRm.statusText)}

  }
}

//INIZIA CARICAMENTO DATI XML
var xmlhttpRet;
var docRet;
function loadXMLDocRet(url,col){
city=col;
//alert('di ret'+url)
if (window.XMLHttpRequest)
  {
  xmlhttpRet=new XMLHttpRequest()
  xmlhttpRet.onreadystatechange=state_ChangeRet
  xmlhttpRet.open("GET",url,true)
  xmlhttpRet.send(null)
  }
else if (window.ActiveXObject)
  {
  xmlhttpRet=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttpRet)
    {
    xmlhttpRet.onreadystatechange=state_ChangeRet
    xmlhttpRet.open("GET",url,true)
    xmlhttpRet.send()
    }
  }
}
function state_ChangeRet()
{
if (xmlhttpRet.readyState==4)
  {
  if (xmlhttpRet.status==200)
  {
  docRet=xmlhttpRet.responseXML;//imposto il documento cosi' e' visibile a tutte le funzioni
  drawContentRet(docRet,city);
  mngFade('start',city);
  if (done==true){
	 mngFade('stop',city);
	  }
  }
  else
  {alert("Problemi nel caricamento dei dati:" + xmlhttpRet.statusText)}

  }
}


done=false;
function drawContentTo(doc,city){
	//alert('draw di torino');
	var xmlDoc=doc;
	docRoot=xmlDoc.getElementsByTagName("eventi")[0];
	els=docRoot.getElementsByTagName("elemento");

	//gli elementi dell'xml da cui prendo i dati
	var xmlElement=[];
	for(i=0;i<els.length;i++){
		xmlElement.push(els[i]);
		}

	//atributi per navigazione
    go_lang=docRoot.getAttribute('lang');
	go_next_to=docRoot.getAttribute('next');
	go_prev_to=docRoot.getAttribute('prev');
	par_area=docRoot.getAttribute('citta');



//nascondo o visualizzo i btn prossimi 3 e precedenti 3 in base al valore passato dall'xml..ogni tasto e parametrizzato da city
	if (go_next_to.length>0){
			btn_next_multicolumn=document.getElementById('next-'+city);
			btn_next_multicolumn.onclick=function (){loadXMLDocTo('/tc/xmlEventi.do?'+go_next_to,city);return false;}
			btn_next_multicolumn.parentNode.style.display="block";
		}
	else {
		btn_next_multicolumn=document.getElementById('next-'+city);
		btn_next_multicolumn.parentNode.style.display="none";
		}

	if (go_prev_to.length>0){
			btn_prev_multicolumn=document.getElementById('prev-'+city);
			btn_prev_multicolumn.parentNode.style.display="block";
			btn_prev_multicolumn.onclick=function (){loadXMLDocTo('/tc/xmlEventi.do?'+go_prev_to,city);return false;}
		}
	else {
		btn_prev_multicolumn=document.getElementById('prev-'+city);
		btn_prev_multicolumn.parentNode.style.display="none";
		}

	// i box in cui scrivo i dati
	var boxes=[document.getElementById('box-'+city+'-1'),document.getElementById('box-'+city+'-2'),document.getElementById('box-'+city+'-3')];


for (k=0;k<xmlElement.length;k++){
	paras=boxes[k].getElementsByTagName('p');
	for (i=0;i<paras.length;i++){
			if (paras[i].className=='data'){
				if (xmlElement[k].getElementsByTagName('data')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('data')[0].firstChild.nodeValue;
					}
				else {
					paras[i].innerHTML='';
					 }
				}
			if (paras[i].className=='dove'){
				if (xmlElement[k].getElementsByTagName('indirizzo')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('indirizzo')[0].firstChild.nodeValue;
					}
				else{
					paras[i].innerHTML='';
					}
				}
			if (paras[i].className=='tipoevento'){
				paras[i].firstChild.innerHTML=xmlElement[k].getAttribute('tipo');
				paras[i].firstChild.href="/tc/pages/listingTipo_"+go_lang+".jsp?pagchiamante=evento_&tipo="+xmlElement[k].getAttribute('idtipologia');
				}
			if (paras[i].className=='img-abs'){
				if (xmlElement[k].getElementsByTagName('thumb')[0].firstChild){
					//alert(xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue.length)
					if (paras[i].style.display!='none'){
						paras[i].firstChild.src=xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue;
						}
					else{
						paras[i].firstChild.src=xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue;
						paras[i].style.display='block';
						}
					}
				else {
					paras[i].style.display="none";
					}
				}
			if (paras[i].className=='txt-abs'){
				if (xmlElement[k].getElementsByTagName('testobreve')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('testobreve')[0].firstChild.nodeValue;
					}
				else{
					paras[i].innerHTML='';
					}
				}
		}
		hs2=boxes[k].getElementsByTagName('h2');
		if (xmlElement[k].getElementsByTagName('titolo')[0].firstChild){
			if (xmlElement[k].getElementsByTagName('dettaglio')[0].firstChild){
				if (xmlElement[k].getElementsByTagName('dettaglio')[0].firstChild.nodeValue=='si'){
					hs2[0].innerHTML='';
					hs2[0].innerHTML='<a href="#">'+xmlElement[k].getElementsByTagName('titolo')[0].firstChild.nodeValue+'</a>';
					hs2[0].firstChild.href='schedaEvento_'+go_lang+'.jsp?pagchiamante=evento_'+go_lang+'&id='+xmlElement[k].getAttribute('id');
					}
				else{
					hs2[0].innerHTML='';
					hs2[0].innerHTML=xmlElement[k].getElementsByTagName('titolo')[0].firstChild.nodeValue;
					}
				}
			}
		else{
			hs2[0].firstChild.innerHTML='';
			}

		hs3=boxes[k].getElementsByTagName('h3');
		hs3[0].innerHTML=xmlElement[k].getAttribute('categoria');
	}
	done=true;
return done;
}

function drawContentRm(doc,city){
	//alert('draw di roma');
	var xmlDoc=doc;
	docRoot=xmlDoc.getElementsByTagName("eventi")[0];
	els=docRoot.getElementsByTagName("elemento");

	//gli elementi dell'xml da cui prendo i dati
	var xmlElement=[];
	for(i=0;i<els.length;i++){
		xmlElement.push(els[i]);
		}

	//atributi per navigazione
    go_lang=docRoot.getAttribute('lang');
	go_next_rm=docRoot.getAttribute('next');
	//alert('su draw '+go_next+' city = '+city)
	go_prev_rm=docRoot.getAttribute('prev');
	par_area=docRoot.getAttribute('citta');

//nascondo o visualizzo i btn prossimi 3 e precedenti 3 in base al valore passato dall'xml..ogni tasto e parametrizzato da city
	if (go_next_rm.length>0){

			btn_next_multicolumn=document.getElementById('next-'+city);
			btn_next_multicolumn.onclick=function (){loadXMLDocRm('/tc/xmlEventi.do?'+go_next_rm,city);return false;}
			btn_next_multicolumn.parentNode.style.display="block";

		}
	else {
		btn_next_multicolumn=document.getElementById('next-'+city);
		btn_next_multicolumn.parentNode.style.display="none";
		}

	if (go_prev_rm.length>0){

			btn_prev_multicolumn=document.getElementById('prev-'+city);
			btn_prev_multicolumn.parentNode.style.display="block";
			btn_prev_multicolumn.onclick=function (){loadXMLDocRm('/tc/xmlEventi.do?'+go_prev_rm,city);return false;}
			
		}
	else {
		btn_prev_multicolumn=document.getElementById('prev-'+city);
		btn_prev_multicolumn.parentNode.style.display="none";
		}

	// i box in cui scrivo i dati
	var boxes=[document.getElementById('box-'+city+'-1'),document.getElementById('box-'+city+'-2'),document.getElementById('box-'+city+'-3')];


for (k=0;k<xmlElement.length;k++){
	paras=boxes[k].getElementsByTagName('p');
	for (i=0;i<paras.length;i++){
			if (paras[i].className=='data'){
				if (xmlElement[k].getElementsByTagName('data')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('data')[0].firstChild.nodeValue;
					}
				else {
					paras[i].innerHTML='';
					 }
				}
			if (paras[i].className=='dove'){
				if (xmlElement[k].getElementsByTagName('indirizzo')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('indirizzo')[0].firstChild.nodeValue;
					}
				else{
					paras[i].innerHTML='';
					}
				}
			if (paras[i].className=='tipoevento'){
				paras[i].firstChild.innerHTML=xmlElement[k].getAttribute('tipo');
				paras[i].firstChild.href="/tc/pages/listingTipo_"+go_lang+".jsp?pagchiamante=evento_&tipo="+xmlElement[k].getAttribute('idtipologia');
				}
			if (paras[i].className=='img-abs'){
				if (xmlElement[k].getElementsByTagName('thumb')[0].firstChild){
					//alert(xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue.length)
					if (paras[i].style.display!='none'){
						paras[i].firstChild.src=xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue;
						}
					else{
						paras[i].firstChild.src=xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue;
						paras[i].style.display='block';
						}
					}
				else {
					paras[i].style.display="none";
					}
				}
			if (paras[i].className=='txt-abs'){
				if (xmlElement[k].getElementsByTagName('testobreve')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('testobreve')[0].firstChild.nodeValue;
					}
				else{
					paras[i].innerHTML='';
					}
				}
		}
		hs2=boxes[k].getElementsByTagName('h2');
		if (xmlElement[k].getElementsByTagName('titolo')[0].firstChild){
			hs2[0].firstChild.innerHTML=xmlElement[k].getElementsByTagName('titolo')[0].firstChild.nodeValue;
			}
		else{
			hs2[0].firstChild.innerHTML='';
			}

		hs2=boxes[k].getElementsByTagName('h2');
		hs2[0].firstChild.href='schedaEvento_'+go_lang+'.jsp?pagchiamante=evento_'+go_lang+'&id='+xmlElement[k].getAttribute('id');

		hs3=boxes[k].getElementsByTagName('h3');
		hs3[0].innerHTML=xmlElement[k].getAttribute('categoria');
	}
	done=true;
return done;
}


function drawContentRet(doc,city){
	var xmlDoc=doc;
	docRoot=xmlDoc.getElementsByTagName("eventi")[0];
	els=docRoot.getElementsByTagName("elemento");

	//gli elementi dell'xml da cui prendo i dati
	var xmlElement=[];
	for(i=0;i<els.length;i++){
		xmlElement.push(els[i]);
		}

	//atributi per navigazione
    go_lang=docRoot.getAttribute('lang');
	go_next_ret=docRoot.getAttribute('next');
	go_prev_ret=docRoot.getAttribute('prev');
	par_area=docRoot.getAttribute('citta');



//nascondo o visualizzo i btn prossimi 3 e precedenti 3 in base al valore passato dall'xml..ogni tasto e parametrizzato da city
	if (go_next_ret.length>0){
			btn_next_multicolumn=document.getElementById('next-'+city);
			btn_next_multicolumn.onclick=function (){loadXMLDocRet('/tc/xmlEventi.do?'+go_next_ret,city);return false;}
			btn_next_multicolumn.parentNode.style.display="block";
			
		}
	else {
		btn_next_multicolumn=document.getElementById('next-'+city);
		btn_next_multicolumn.parentNode.style.display="none";
		}

	if (go_prev_ret.length>0){
			btn_prev_multicolumn=document.getElementById('prev-'+city);
			btn_prev_multicolumn.parentNode.style.display="block";
			btn_prev_multicolumn.onclick=function (){loadXMLDocRet('/tc/xmlEventi.do?'+go_prev_ret,city);return false;}
			
		}
	else {
		btn_prev_multicolumn=document.getElementById('prev-'+city);
		btn_prev_multicolumn.parentNode.style.display="none";
		}

	// i box in cui scrivo i dati
	var boxes=[document.getElementById('box-'+city+'-1'),document.getElementById('box-'+city+'-2'),document.getElementById('box-'+city+'-3')];


for (k=0;k<xmlElement.length;k++){
	paras=boxes[k].getElementsByTagName('p');
	for (i=0;i<paras.length;i++){
			if (paras[i].className=='data'){
				if (xmlElement[k].getElementsByTagName('data')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('data')[0].firstChild.nodeValue;
					}
				else {
					paras[i].innerHTML='';
					 }
				}
			if (paras[i].className=='dove'){
				if (xmlElement[k].getElementsByTagName('indirizzo')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('indirizzo')[0].firstChild.nodeValue;
					}
				else{
					paras[i].innerHTML='';
					}
				}
			if (paras[i].className=='tipoevento'){
				paras[i].firstChild.innerHTML=xmlElement[k].getAttribute('tipo');
				paras[i].firstChild.href="/tc/pages/listingTipo_"+go_lang+".jsp?pagchiamante=evento_&tipo="+xmlElement[k].getAttribute('idtipologia');
				}
			if (paras[i].className=='img-abs'){
				if (xmlElement[k].getElementsByTagName('thumb')[0].firstChild){
					//alert(xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue.length)
					if (paras[i].style.display!='none'){
						paras[i].firstChild.src=xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue;
						}
					else{
						paras[i].firstChild.src=xmlElement[k].getElementsByTagName('thumb')[0].firstChild.nodeValue;
						paras[i].style.display='block';
						}
					}
				else {
					paras[i].style.display="none";
					}
				}
			if (paras[i].className=='txt-abs'){
				if (xmlElement[k].getElementsByTagName('testobreve')[0].firstChild){
					paras[i].innerHTML=xmlElement[k].getElementsByTagName('testobreve')[0].firstChild.nodeValue;
					}
				else{
					paras[i].innerHTML='';
					}
				}
		}
		hs2=boxes[k].getElementsByTagName('h2');
		if (xmlElement[k].getElementsByTagName('titolo')[0].firstChild){
			hs2[0].firstChild.innerHTML=xmlElement[k].getElementsByTagName('titolo')[0].firstChild.nodeValue;
			}
		else{
			hs2[0].firstChild.innerHTML='';
			}

		hs2=boxes[k].getElementsByTagName('h2');
		hs2[0].firstChild.href='schedaEvento_'+go_lang+'.jsp?pagchiamante=evento_'+go_lang+'&id='+xmlElement[k].getAttribute('id');

		hs3=boxes[k].getElementsByTagName('h3');
		hs3[0].innerHTML=xmlElement[k].getAttribute('categoria');
	}
	done=true;
return done;
}



function mngFade(action,city){
	var loading=document.getElementById('loading-'+city);
	if (action=='start'){
		hcontenitore=loading.parentNode.offsetHeight;
		hcontenitore=hcontenitore-110;
		loading.style.height=hcontenitore+"px";
		loading.style.display="block";
		}
	if (action=='stop'){
		window.setTimeout("doFade()",1500);
	}
}
//imposta opacità div loading
	var currOpacity=99;
	var timerID=null;
	function doFade(){
		var opaco=document.getElementById('loading-'+city);
		if (currOpacity>=0){
			currOpacity=currOpacity-10;
			opaco.style.filter="alpha(opacity="+currOpacity+")";
			opaco.style.opacity=currOpacity/100;
			timerID=window.setTimeout("doFade()",20);
			complete=false;
			return;
			}
	complete=true;
	if (complete==true){
		opaco.style.display="none";
		clearTimeout(timerID);
		currOpacity=99;
		opaco.style.filter="alpha(opacity="+currOpacity+")";
		opaco.style.opacity=currOpacity/99;
		}
	}
