window.onload=function() {
	attrimenu();
	runtime();
	resize();
}

function aprimenu(id) {
	var d=document.getElementById('sub'+this.id);
	if (d) {
		if (d.style.display == 'block') {
			d.style.display='none';
		} else {
			d.style.display='block';
		}
	}
}

function attrimenu(id) {

	var menulivello1=document.getElementById('menu').getElementsByTagName('dt').length;
	
		for (var i=1; i<=menulivello1; i++) {
			if (document.getElementById('submenu'+i)) {document.getElementById('submenu'+i).style.display='none';}
		}
		
	if (d != undefined) {
		var d=document.getElementById(id);
		if (d) {d.style.display='block';}
	}

	
	for (var i=1; i<=menulivello1; i++) {
			
		if (document.getElementById('menu'+i)) {
			menulivellouno=document.getElementById('menu'+i);
			menulivellouno.setAttribute('tabindex',i+'00');
			addEvent(menulivellouno, 'click', aprimenu);
			addEvent(menulivellouno, 'focus', parla);
			addEvent(menulivellouno, 'blur', silenzio);
			addEvent(menulivellouno, 'mouseover', parla);
			addEvent(menulivellouno, 'mouseout', silenzio);
		}

		if (document.getElementById('submenu'+i)) {

			if (document.getElementById('submenu'+i).getElementsByTagName('ul')[0]) {
			
				oldul=document.getElementById('submenu'+i).getElementsByTagName('ul')[0];
				
				var newli=document.createElement('li');		
				var newa=document.createElement('a');
				newa.setAttribute('href','javascript:void(0)');
				newa.setAttribute('tabindex',i+'99');
				newa.setAttribute('title','Chiudi questo sottomenu');
				newa.setAttribute('id','chiudisubmenu'+i);
				newa.setAttribute('onclick',"chiudimenu('menu" + i + "')");
				var newtext=document.createTextNode('Chiudi sottomenu');
				newa.appendChild(newtext);
				newli.appendChild(newa);
				oldul.appendChild(newli);

			}
		for (var j=1; j<=20; j++) {
			if (document.getElementById('submenu'+i + '_' +j)) {
				menulivellodue=document.getElementById('submenu'+i + '_' +j);
				menulivellodue.setAttribute('tabindex',i+ '_' + '0'+j);
				addEvent(menulivellodue, 'focus', parla);
				addEvent(menulivellodue, 'blur', silenzio);
				addEvent(menulivellodue, 'mouseover', parla);
				addEvent(menulivellodue, 'mouseout', silenzio);
			}
		}
	}
	}

	if (menuattivo !='') {
		document.getElementById(menuattivo).style.display="block";
	}
 
}

function chiudimenu(menuid) {
	
	var d=document.getElementById('sub' + menuid);
	var e=document.getElementById(menuid);
	if (d) {d.style.display='none';}
	if (e) {e.focus();}
}

function checkform() {
	if (document.iscrizione.nome.value == "")       {alert("Il campo NOME è obbligatorio!");           document.iscrizione.nome.focus();return false;};
	if (document.iscrizione.cognome.value == "")          	{alert("Il campo COGNOME è obbligatorio!");       		document.iscrizione.cognome.focus();return false;};
	if (document.iscrizione.professione.value == "")     		{alert("Il campo PROFESSIONE è obbligatorio!");      			document.iscrizione.professione.focus();return false;};
	if (isNaN(document.iscrizione.telefono.value)) 			{alert("Il campo TELEFONO è errato!");            			document.iscrizione.telefono.focus();return false;};
	if (document.iscrizione.email.value=="")               	{alert ("Il campo E-mail è obbligatorio");												document.iscrizione.email.focus(); return false;};
	if ((document.iscrizione.email.value.indexOf('@') == -1) || (document.iscrizione.email.value.indexOf('.') == -1)) {alert("Il campo E-Mail non contiene un indirizzo valido!"); document.iscrizione.email.focus();  return false;};
	if (document.iscrizione.indirizzo.value == "")       {alert("Il campo INDIRIZZO è obbligatorio!");           document.iscrizione.indirizzo.focus();return false;};
	if (document.iscrizione.citta.value == "")       {alert("Il campo CITTA' è obbligatorio!");           document.iscrizione.citta.focus();return false;};
	if (!document.iscrizione.privacy.checked)	 	{alert("E' necessario acconsentire al trattamento dei dati personali!");           document.iscrizione.privacy.focus();return false;};
	return true;
}

var http=getHTTPObject(); // We create the HTTP Object

function checkquest() {
	var modulo=document.questionario;
	var msg="Non ha risposto ad alcune domande!";
	if ((document.getElementById('email').value!="") && ((document.getElementById('email').value.indexOf('@') == -1) || (document.getElementById('email').value.indexOf('.') == -1))) {alert("Il campo -- E-mail -- non contiene un indirizzo valido!"); document.getElementById('email').focus(); return false;}
	if ((modulo.categoria_socio.value=="") && (modulo.categoria_dipendente.value == "") && (modulo.categoria_cliente.value == "") && (modulo.categoria_fornitore.value == "") && (modulo.categoria_istituzionefin.value == "") && (modulo.categoria_ente.value == "") && (modulo.categoria_collettivita.value == "")) {alert(msg); modulo.categoria_socio.focus();return false;}
	if (modulo.conoscenza.value=="")	{alert(msg); modulo.conoscenza.focus();return false;}
	if (modulo.completezza.value=="")	{alert(msg); modulo.completezza.focus();return false;}
	if (modulo.comunicazione.value=="")	{alert(msg); modulo.comunicazione.focus();return false;}
	if (modulo.efficacia.value=="")		{alert(msg); modulo.efficacia.focus();return false;}
	if (modulo.grafica.value=="")		{alert(msg); modulo.grafica.focus();return false;}
	if (modulo.linguaggio.value=="")	{alert(msg); modulo.linguaggio.focus();return false;}
	if (modulo.lunghezza.value=="")		{alert(msg); modulo.lunghezza.focus();return false;}
	if (modulo.impegno.value=="")		{alert(msg); modulo.impegno.focus();return false;}
	if (modulo.capacita.value=="")		{alert(msg); modulo.capacita.focus();return false;}
	if (modulo.utilita.value=="")		{alert(msg); modulo.utilita.focus();return false;}
	if (modulo.grado.value=="") 		{alert(msg); modulo.grado.focus();return false;}
	if (modulo.coerenza.value=="")		{alert(msg); modulo.coerenza.focus();return false;}
	if (modulo.importanza.value=="")	{alert(msg); modulo.importanza.focus();return false;}
	if (modulo.centralita.value=="")	{alert(msg); modulo.centralita.focus();return false;}
	if (modulo.rispetto.value=="")		{alert(msg); modulo.rispetto.focus();return false;}
	if (modulo.efficienza.value=="")	{alert(msg); modulo.efficienza.focus();return false;}
	if (modulo.correttezza.value=="")	{alert(msg); modulo.correttezza.focus();return false;}
	if (modulo.ricerca.value=="")		{alert(msg); modulo.ricerca.focus();return false;}
	if (modulo.attenzione.value=="")	{alert(msg); modulo.attenzione.focus();return false;}
	if (modulo.affidabilita.value=="")	{alert(msg); modulo.affidabilita.focus();return false;}
	if (modulo.interrelazione.value==""){alert(msg); modulo.interrelazione.focus();return false;}
	if (modulo.valorizzazione.value==""){alert(msg); modulo.valorizzazione.focus();return false;}
	if (modulo.osservazioni.value=="")	{alert(msg); modulo.osservazioni.focus();return false;}
	var contatore=0;
	if (modulo.capitolo1.checked) {contatore++;}
	if (modulo.capitolo2.checked) {contatore++;}
	if (modulo.capitolo3.checked) {contatore++;}
	if (modulo.capitolo4.checked) {contatore++;}
	if (contatore>2) {alert("Hai selezionato più di due risposte per la la domanda sui capitoli!"); document.getElementById('capitolo1').focus(); return false;}
	return true;
}

function checkFieldsegnala() {
	if (document.segnalanotizia.mittente.value == "") {alert("Il campo MITTENTE è obbligatorio!"); document.segnalanotizia.mittente.focus();return false;}
	if (document.segnalanotizia.destinatario.value == "") {alert("Il campo DESTINATARIO è obbligatorio!"); document.segnalanotizia.destinatario.focus();return false;}
	if ((document.segnalanotizia.email.value.indexOf('@') == -1) || (document.segnalanotizia.email.value.indexOf('.') == -1)) {alert("Il campo E-Mail Destinatario non contiene un indirizzo valido!"); document.segnalanotizia.email.focus(); return false;}
	return true;
}

function aggiornaCap() {
	if (curricula.provincia.value=="EST") {
		 curricula.cap.value="99999";
	} else {
		if (curricula.cap.value =="99999") {
			curricula.cap.value="";
		}
	}
	return true;
}

function checkNumberInteger(campo) {
	if(parseInt(campo,10)!=campo) return false;
	return true;
}

function getYear(campo) {
	var strYear;
	var indice;
	var indice1;
	indice=campo.indexOf("/");
	if (indice==-1) return 0;
	indice1=campo.indexOf("/",indice+1);
	if (indice1==-1) return 0;
	strYear=campo.substr(indice1+1,campo.length-1);
	return parseInt(strYear,10);
}

function checkData(campo) {
	var strDay;
	var strMonth;
	var strYear;
	var indice;
	var indice1;
	indice=campo.indexOf("/");
	if (indice==-1) return false;
	strDay=campo.substr(0,indice);
	if (parseInt(strDay,10)!=strDay) return false;
	indice1=campo.indexOf("/",indice+1);
	if (indice1==-1) return false;
	strMonth=campo.substr(indice+1,indice1-(indice+1));
	if (parseInt(strMonth,10)!=strMonth) return false;
	strYear=campo.substr(indice1+1,campo.length-1);
	if (parseInt(strYear,10)!=strYear) return false;
	var objData=new Date(parseInt(strYear,10),parseInt(strMonth,10)-1,parseInt(strDay,10));
	if (isNaN(objData)) return false;
	if ((parseInt(strYear,10)!=objData.getFullYear())||((parseInt(strMonth,10)-1)!=objData.getMonth())||(parseInt(strDay,10)!=objData.getDate())) return false;
	return true;
}

function checkForm (myform) {
	var i;
	var error_text="";
	var error_mandatory="";
	var error_mandatory_count=0;
	var error_date="";
	var error_date_count=0;
	var error_number="";
	var error_number_count=0;
	
	for (i=0; i<myform.length; i++) {
		var description=myform.elements[i].description;
		var mandatory=myform.elements[i].mandatory;
		var datatype=myform.elements[i].datatype;
		var type=myform.elements[i].type;
		var value=myform.elements[i].value;
		if (type == 'select-one') {
			var index=myform.elements[i].selectedIndex;
			value=myform.elements[i].options[index].text;
		}
		if (type == 'checkbox') {
			var check=myform.elements[i].checked;
			if (check == true) value="on"; else value="";
		}
		if (mandatory == 'true' && value == "") {
			error_mandatory_count++;
			error_mandatory += " "+description+"\n";
		}
		if (datatype == 'date' && value != "") {
			if (!checkData(value)) {
				error_date_count++;
				error_date += " "+description+"\n";
			}
		}
		if (datatype == 'integer' && value != "") {
			if (!checkNumberInteger(value)) {
				error_number_count++;
				error_number += " "+description+"\n";
			}
		}
	
	}

	if (error_mandatory_count > 0) {
		if (error_mandatory_count == 1) error_text="Il campo\n"+error_mandatory+"è obbligatorio"; else error_text="I campi\n"+error_mandatory+"sono obbligatori";
		error_text+="\n\n";
	}

	if (error_date_count > 0) {
		if (error_date_count == 1) error_text += "Il campo\n"+error_date+"contiene una data errata"; else error_text += "I campi\n"+error_date+"contengono una data errata";
		error_text+="\n\n";
	}

	if (error_number_count > 0) {
		if (error_number_count == 1) error_text += "Il campo\n"+error_number+"contiene un valore non numerico"; else error_text += "I campi\n"+error_number+"contengono un valore non numerico";
		error_text+="\n\n";
	}

	if ((error_mandatory_count+error_date_count+error_number_count) > 0) {
		return error_text;
	}
	return null;
}

function otherError (myform,error) {
	var other_error="";
	var provincia 	= myform.provincia.value;
	var data_nascita=myform.data_nascita.value;
	var media_inf=myform.media_inf.selectedIndex;
	var diploma_maturita=myform.diploma_maturita.selectedIndex;
	var laurea_breve=myform.laurea_breve.selectedIndex;
	var laurea=myform.laurea.selectedIndex;
	var lingua01=myform.lingua01.selectedIndex;
	var livello_lingua01=myform.livello_lingua01.selectedIndex;
	var lingua02=myform.lingua02.selectedIndex;
	var livello_lingua02=myform.livello_lingua02.selectedIndex;
	var voto_mat01=myform.voto_mat01.value;
	var voto_mat02=myform.voto_mat02.value;
	var voto_laurea01=myform.voto_laurea01.value;
	var voto_laurea02=myform.voto_laurea02.value;
	var mat_tesi=myform.mat_tesi.value;
	var titolo_tesi=myform.titolo_tesi.value;
	var anno_maturita=myform.anno_maturita.selectedIndex;
	var anno_laurea=myform.anno_laurea.selectedIndex;
	var master_len	= myform.master.value.length;
	var conoscenze_informatiche_len	= myform.conoscenze_informatiche.value.length;
	var attuale_professione_len	= myform.attuale_professione.value.length;
	var esperienze_prof_precedenti_len	= myform.esperienze_prof_precedenti.value.length;
	var ulteriori_informazioni_len	= myform.ulteriori_informazioni.value.length;
	
	if (master_len>255) other_error += "il campo SPECIALIZZAZIONI/MASTER contiene piu' di 255 caratteri\n";
	if (conoscenze_informatiche_len>2048) other_error += "il campo CONOSCENZE INFORMATICHE contiene piu' di 2048 caratteri\n";
	if (attuale_professione_len>2048) other_error += "il campo ATTUALE ESPERIENZA PROFESSIONALE contiene piu' di 2048 caratteri\n";
	if (esperienze_prof_precedenti_len>2048) other_error += "il campo PRECEDENTI ESPERIENZE PROFESSIONALI contiene piu' di 2048 caratteri\n";
	if (ulteriori_informazioni_len>2048) other_error += "il campo EVENTUALI ULTERIORI INFORMAZIONI contiene piu' di 2048 caratteri\n";

	if (data_nascita != "") {
		var anno_nascita=getYear(data_nascita);
		if (anno_nascita<1950 || anno_nascita > 1985)
		other_error += "l'anno di nascita deve essere compreso tra il 1950 e 1985\n";
	}

		if (provincia == 0) other_error += "Selezionare almeno una provincia\n";
		if ((media_inf+diploma_maturita+laurea_breve+laurea) == 0) other_error += "Selezionare almeno un titolo di studio\n";
		if (lingua01 > 0 && livello_lingua01 == 0) other_error += "Selezionare il livello della 1^ lingua conosciuta\n";
		if (lingua02 > 0 && livello_lingua02 == 0) other_error += "Selezionare il livello della 2^ lingua conosciuta\n";
	
	if (voto_mat01 != "" || voto_mat02 != "" || anno_maturita != 0) {
		if ((media_inf+diploma_maturita) == 0) {
			other_error += "Selezionare il titolo di studio riferito ai dati inseriti\n";
		}
	}

	if (diploma_maturita > 0) {
	if (voto_mat01 == "" || voto_mat02 == "") other_error += "inserire la votazione della maturità\n"; else {
		if (parseInt(voto_mat01,10) > parseInt(voto_mat02,10)) other_error += "inserire un voto di maturità valido\n";
	}

	if (anno_maturita == 0)
		other_error += "inserire anno della maturità\n";
	}

	if (voto_laurea01 != "" || voto_laurea02 != "" || anno_laurea != 0 || mat_tesi != "" || titolo_tesi != "") {
		if ((laurea+laurea_breve) == 0) {
			other_error += "Selezionare il tipo di laurea riferito ai dati inseriti\n";
		}
	}
	
	if ((laurea_breve+laurea) > 0) {
	if (voto_laurea01 == "" || voto_laurea02 == "") other_error += "inserire la votazione della laurea\n"; else {
		if (parseInt(voto_laurea01,10) > parseInt(voto_laurea02,10))
		other_error += "inserire un voto di laurea valido\n";
		}

	if (anno_laurea == 0) other_error += "inserire anno della laurea\n";}

	if (other_error != "") {
		if (error == null) error="";
		error += other_error;
	}
	return error;
}

function convertSingleQuote(orgString) {
	var re=new RegExp("'+","gi");
	var tempstr=new String(orgString);
	return tempstr.replace(re,'\'\'');
}

function appendBlank(myform) {
	myform.master.value=myform.master.value+" ";
	myform.conoscenze_informatiche.value=myform.conoscenze_informatiche.value+" ";
	myform.attuale_professione.value=myform.attuale_professione.value+" ";
	myform.esperienze_prof_precedenti.value=myform.esperienze_prof_precedenti.value+" ";
	myform.ulteriori_informazioni.value=myform.ulteriori_informazioni.value+" ";
}

function convertAllSingleQuote(myform) {
	myform.cognome.value=convertSingleQuote(myform.cognome.value);
	myform.nome.value=convertSingleQuote(myform.nome.value);
	myform.nato_a.value=convertSingleQuote(myform.nato_a.value);
	myform.indirizzo.value=convertSingleQuote(myform.indirizzo.value);
	myform.comune.value=convertSingleQuote(myform.comune.value);
	myform.cap.value=convertSingleQuote(myform.cap.value);
	myform.telefono.value=convertSingleQuote(myform.telefono.value);
	myform.telefono_2.value=convertSingleQuote(myform.telefono_2.value);
	myform.e_mail.value=convertSingleQuote(myform.e_mail.value);
	myform.cod_fiscale.value=convertSingleQuote(myform.cod_fiscale.value);
	myform.master.value=convertSingleQuote(myform.master.value);
	myform.conoscenze_informatiche.value=convertSingleQuote(myform.conoscenze_informatiche.value);
	myform.attuale_professione.value=convertSingleQuote(myform.attuale_professione.value);
	myform.esperienze_prof_precedenti.value	= convertSingleQuote(myform.esperienze_prof_precedenti.value);
	myform.ulteriori_informazioni.value	= convertSingleQuote(myform.ulteriori_informazioni.value);
	myform.mat_tesi.value=convertSingleQuote(myform.mat_tesi.value);
	myform.titolo_tesi.value=convertSingleQuote(myform.titolo_tesi.value);
}

function invia () {
	convertAllSingleQuote(document.curricula);
	appendBlank(document.curricula);
	var error=checkForm (document.curricula);
	error=otherError (document.curricula,error);

	if (error == null) {
		document.curricula.submit ();
		alert('Il Vs. Curriculum Vitae è stato inviato e sarà preso in esame quanto prima.');
		document.curricula.reset();}
	else alert (error);
}
function annulla () {
	if(confirm("Cancellare tutti i Campi?"))
	document.curricula.reset ();
}

function oggi() {
	var d=new Date ();
	var gs=d.getDay();
	var gg=d.getDate();
	var mm=d.getMonth()+1;
	var aa=d.getFullYear();
	var hh=d.getHours();
	var min=d.getMinutes();

	var giorni=new Array("Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato");
	var mesi=new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto","Settembre",
	"Ottobre","Novembre","Dicembre");

	if (gg<10) gg="0"+gg;
	if (mm<10) mm="0"+mm;
	if (hh<10) hh="0"+hh;
	if (min<10) min="0"+min;

	document.write (giorni[gs]+ ", " +gg+" "+mesi[mm-1]+" "+aa);

}

function iaprlista() {
	if (document.getElementById('menu_sedi').style.display == 'none') {document.getElementById('menu_sedi').style.display='block';} else {document.getElementById('menu_sedi').style.display='none';}
}



function handleHttpResponse() {
	if (http.readyState == 4) {
		var xmlDocument=eval(http.responseText);
		document.getElementById('td_abi').innerHTML="<span>"+xmlDocument[1]+"</span>";
		document.getElementById('td_cab').innerHTML="<span>"+xmlDocument[2]+"</span>";
		document.getElementById('td_indirizzo').innerHTML="<span>"+xmlDocument[3]+"</span>";
		document.getElementById('td_orari').innerHTML="<span>"+xmlDocument[4]+"</span>";
		document.getElementById('td_telefono').innerHTML="<span>"+xmlDocument[5]+"</span>";
		document.getElementById('td_fax').innerHTML="<span>"+xmlDocument[6]+"</span>";
		document.getElementById('td_direttore').innerHTML="<span><a href='mailto:"+xmlDocument[8] +"' >"+xmlDocument[7]+"</a></span>";
		document.getElementById('td_immagine').innerHTML="<img src='../images/"+xmlDocument[9]+"' alt='Foto della filiale' /><br /><img src='../images/icona_mappa.gif' alt='apri la cartina' border='no' style='width:3.503em; margin:0; float:left;' /><a href='javascript:void(0);' onclick=\"document.getElementById('div_cartina').style.display='block'\" style='float:left; margin-top:1.1em; font:bold 0.7em Verdana,Arial,sans serif; color:#16459C;'>Visualizza la cartina</a>";
		document.getElementById('div_cartina').innerHTML="<br /><br /><img src='../images/"+xmlDocument[10]+"' alt='cartina della filiale' /><br /><br /><a href='javascript:void(0);' onclick=\"document.getElementById('div_cartina').style.display='none'\" style='font:bold 0.7em Verdana,Arial,sans serif; color:#16459C;'>chiudi</a><br /><br />";
		document.getElementById('td_servizidispo').innerHTML="<span>Servizi Disponibili:</span>";
		if (xmlDocument[11] == "1") {document.getElementById('td_servizidispo').innerHTML += "<img src='../images/icona_bancomat.gif' alt='immagine servizio banca' />";}
		if (xmlDocument[12] == "1") {document.getElementById('td_servizidispo').innerHTML += "<img src='../images/icona_cassettasicurezza.gif' alt='immagine servizio cassa continua' />";}
		if (xmlDocument[13] == "1") {document.getElementById('td_servizidispo').innerHTML += "<img src='../images/icona_cassacontinua.gif' alt='immagine servizio cassetta di sicurezza' />";}
		// solo per la filiale di san marzano (SEDE)
		if (xmlDocument[14] == "1") {document.getElementById('td_comeragg').innerHTML += "<span>Come raggiungerci:</span><p class='testo' style='white-space:nowrap;'>Distanza dal capoluogo (Taranto) 22km</p><p class='testo' style='white-space:nowrap; float:left;'><img src='../images/icona_macchina.gif' alt='macchina' align='left' />Percorrendo la SS.7 fino a Fragagnano.</p><p class='testo' style='white-space:nowrap; float:left;'><img src='../images/icona_treno.gif' alt='aereo' align='left' />Più corse giornaliere su linee provinciali Azienda Ferrovie Sud-Est</p><p class='testo' style='white-space:nowrap; float:left;'><img src='../images/icona_aereo.gif' alt='treno' align='left' />Aereoporto 'Arlotta' di Grottaglie (solo per voli privati);<br />Aereoporto Brindisi-Casale (50Km),<br />con servizi di collegamento bus di linea, autonolo, bus navetta</p>";}
		if (xmlDocument[14] == "0") {document.getElementById('td_comeragg').innerHTML="";}
		//solo per la filiale di grottaglie (TESORERIA)
		if (xmlDocument[15] == "1") {
		
		document.getElementById('tr_tesoreria').innerHTML += "<table><tr class='tr1'><th colspan='3'><span><strong>Sportello di Tesoreria</strong></span></th></tr><tr class='tr1'><th><span>Abi :</span></th><td id='td_abi'><span>08817</span></td><td rowspan='8' id='td_immagine' valign='top'><img src='../images/filiale_grottaglie2.jpg' alt='Foto della filiale' /><br /><img src='../images/icona_mappa.gif' alt='apri la cartina' border='no' style='width:3.503em; margin:0; float:left;' /><a href='javascript:void(0);' onclick=\"document.getElementById('div_cartina2').style.display='block'\" style='float:left; margin-top:1.1em; font:bold 0.7em Verdana,Arial,sans serif; color:#16459C;'>Visualizza la cartina</a></td></tr><tr class='tr2'><th><span>Cab :</span></th><td id='td_cab'><span>78890</span></td></tr><tr class='tr1'><th><span>Indirizzo :</span></th><td id='td_indirizzo'><span>Via Cal&#242;, 72<br />74023 Grottaglie (TA)</span></td></tr><tr class='tr2'><th><span>Orari :</span></th><td id='td_orari'><span>8:20-13:20 14:45-15:30</span></td></tr><tr class='tr1'><th><span>Telefono :</span></th><td id='td_telefono'><span>099 5612586</span></td></tr><tr class='tr2'><th><span>Fax :</span></th><td id='td_fax'><span>099 5619518</span></td></tr><tr class='tr1'><th><span>Direttore :</span></th><td id='td_direttore'><span><a href='mailto:giuseppe.imperatore@bccsanmarzano.it'>Giuseppe Imperatore</a></span></td></tr></table>";
		} else {
		
		document.getElementById('tr_tesoreria').innerHTML = "";
		
		}
		

		
		isWorking=false;
	}
}

var isWorking=false;

function updateSedi(url) {
 if (!isWorking && http) {
 http.open("GET", url, true);
 http.onreadystatechange=handleHttpResponse;
 isWorking=true;
 http.send(null);
 }
}

function getHTTPObject() {
	var xmlhttp=false;
	if(typeof ActiveXObject != 'undefined') {
		try {xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
			catch (E) {xmlhttp=false;}
		}
	} else if (XMLHttpRequest) {
		xmlhttp=new XMLHttpRequest();
	}
	return xmlhttp;
}

function setActiveStyleSheet(title) {
	for (var i=0; i<document.getElementsByTagName("link").length; i++) {
		var a=document.getElementsByTagName("link")[i];
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
		 a.disabled=true;
		 if(a.getAttribute("title") == title) a.disabled=false;
		}
	}
}

function getActiveStyleSheet() {

	for (var i=0; i<document.getElementsByTagName("link").length; i++) {
		var a=document.getElementsByTagName("link")[i];
		if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && (a.disabled == false)) {
			cssattivo=a.getAttribute("title");
			break;
		}
	}
	return cssattivo;
}

function swapstyle(css) {
	setActiveStyleSheet(css);
	runtime();
}

function placeFocus() {
	document.login.email.focus();
}
 	
function checkFields() {	
	if (document.login.email.value == "") {
	alert("E' necessario inserire il proprio E-Mail address nell'apposito campo!");
	document.login.email.focus();
	return false;
	}
	else return true;
}

function StopFlashMovie() {
	if (navigator.appName.indexOf("Opera")==-1) {
	flashMovie=getFlashMovieObject("filmato");
	flashMovie.StopPlay();
	}
}

function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName]) return document.embeds[movieName];
	} else {
		return document.getElementById(movieName);
	}
}

function resize() {
	for (var i=0; i<document.images.length; i++) {
		if ((document.images[i].src != "transparent.gif") && document.images[i].className == 'resize') {
			document.images[i].src += "&width="+document.images[i].width;
		}
	}
	return;
}

function runtime() {

	if (screen.width != "0" && screen.width != "" && screen.width != null) {
		var ampiezza=eval(screen.width*0.0977)+"%";
	}

	var url='runtime.php?ampiezza='+escape(ampiezza)+'&style='+escape(getActiveStyleSheet());
	
	updateruntime(url);

}

function handleHttpResponseRuntime() {
	if (http.readyState == 4) {
	    var xmlDocument=http.responseXML;
	    var ampiezza=xmlDocument.getElementsByTagName('ampiezza').item(0).firstChild.data;
	    var style=xmlDocument.getElementsByTagName('style').item(0).firstChild.data;

		if (ampiezza != document.getElementsByTagName('body')[0].style.fontSize) {
			document.getElementsByTagName('body')[0].style.fontSize=ampiezza;
		}

		if (style != getActiveStyleSheet()) {
			setActiveStyleSheet(style);
		}
		isWorking=false;
	}
}

function updateruntime(url) {

	if (!isWorking && http) {
		http.open("GET", url, true);
		http.onreadystatechange=handleHttpResponseRuntime;
		isWorking=true;
		http.send(null);
	}
}
function apri_chiudi_layer(nomelayer) {

	if (document.getElementById(nomelayer).style.display == "none") {
		document.getElementById(nomelayer).style.display = "block";
	} else {
		document.getElementById(nomelayer).style.display = "none";
	}
}

