function posiz(pos) {
	var ievs = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
	if (ievs){
		var iev=new Number(RegExp.$1);
		if (iev>=7) {
			document.documentElement.scrollTop=pos;
		}
		else {
			document.body.scrollTop=pos;
		}
	}
	else
	{
		window.scroll(0,pos);
	}	
}
function vai_f(dove) {
	var pos; //Declaring a local variable
	if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop; } //Sniffing for IE5
	else if (document.body) { pos = document.body.scrollTop; } //Sniffing for IE6
	else { pos = window.pageYOffset; } //Sniffing for Netscape
		window.location="str_arch.asp?ex_fondo="+dove+"&pos="+pos;
}
function vai_s(dove) {
	var pos; //Declaring a local variable
	if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop; } //Sniffing for IE5
	else if (document.body) { pos = document.body.scrollTop; } //Sniffing for IE6
	else { pos = window.pageYOffset; } //Sniffing for Netscape
		window.location="str_arch.asp?ex_serie="+dove+"&pos="+pos;
}
function vai_ss(dove) {
	var pos; //Declaring a local variable
	if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop; } //Sniffing for IE5
	else if (document.body) { pos = document.body.scrollTop; } //Sniffing for IE6
	else { pos = window.pageYOffset; } //Sniffing for Netscape
		window.location="str_arch.asp?ex_s_serie="+dove+"&pos="+pos;
}
function vai_fa(dove) {
	var pos; //Declaring a local variable
	if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop; } //Sniffing for IE5
	else if (document.body) { pos = document.body.scrollTop; } //Sniffing for IE6
	else { pos = window.pageYOffset; } //Sniffing for Netscape
		window.location="str_arch.asp?ex_fascicolo="+dove+"&pos="+pos;
}
function vai_sottofa(dove) {
	var pos; //Declaring a local variable
	if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop; } //Sniffing for IE5
	else if (document.body) { pos = document.body.scrollTop; } //Sniffing for IE6
	else { pos = window.pageYOffset; } //Sniffing for Netscape
		window.location="str_arch.asp?ex_sottofascicolo="+dove+"&pos="+pos;
}
function nuovo_figlio(padre,tipo_padre) {
	if (tipo.value!="") {
	window.location="/admin/mod_"+tipo.value+".asp?id_padre="+padre+"&tipo_padre="+tipo_padre+"&act=nuovo"
	}
}
function nuovo_multiplo(padre,tipo_padre) {
	if (tipo_m.value!="") {
	window.location="/importazione_dati/creaschede.asp?id_padre="+padre+"&tipo_padre="+tipo_padre+"&tipo_doc="+tipo_m.value
	}
}
function mod_me(id,tipo_doc,padre,tipo_padre) {
	if (tipo_doc!="") {
	window.location="/admin/mod_"+tipo_doc+".asp?id_"+tipo_doc+"="+id+"&id_padre="+padre+"&tipo_padre="+tipo_padre+"&act=mod"
	}
}
function mod_archivi(id,tipo_doc) {
	if (tipo_doc!="") {
	window.location="/admin/mod_"+tipo_doc+".asp?id_archivi="+id+"&act=mod"
	}
}
function mod_fondi(id,tipo_doc,padre) {
	if (tipo_doc!="") {
	window.location="/admin/mod_"+tipo_doc+".asp?id_fondi="+id+"&id_padre="+padre+"&act=mod"
	}
}
function mod_serie(id,tipo_doc) {
	if (tipo_doc!="") {
	window.location="/admin/mod_"+tipo_doc+".asp?id_serie="+id+"&act=mod"
	}
}
function mod_sottoserie(id,tipo_doc) {
	if (tipo_doc!="") {
	window.location="/admin/mod_"+tipo_doc+".asp?id_sottoserie="+id+"&act=mod"
	}
}
function vis_galleria_fascicolo() {
	if (document.getElementById('visdoc').style.display=='none') {
	document.getElementById('vis_doc').value="Nascondi";
	document.getElementById('visdoc').style.display='block'
	}
	else
	{
		document.getElementById('vis_doc').value="Mostra";
		document.getElementById('visdoc').style.display='none'
	}
}
function obbligatorio(nome_form) {
	for (var i=0; i < document.forms[nome_form].elements.length; i++) {
		if (document.forms[nome_form].elements[i].className=='obblig') {
			if (document.forms[nome_form].elements[i].value=='') {
				alert("Verifica di aver compilato tutti i campi obbligatori!");
				return false
			}
		}
   }
  document.forms[nome_form].submit()
}
function scambia(q) {
	if (q == true) {
	document.getElementById("da").innerHTML = "post: ";
	document.getElementById("a").innerHTML = "ante: ";
	}
	else
	{
	document.getElementById("da").innerHTML = "da: ";
	document.getElementById("a").innerHTML = "a: ";
	}
	}
	function scambia_doc(q) {
	if (q == true) {
	document.getElementById("da").innerHTML = "post: ";
	document.getElementById("a_d").style.display = "inline";	
	//document.getElementById("a").style.display = "inline";	
	//document.getElementById("a_gg").style.display = "block";	
	//document.getElementById("a_gm").style.display = "block";	
	//document.getElementById("a_mm").style.display = "block";	
	//document.getElementById("a_ma").style.display = "block";	
	//document.getElementById("a_aa").style.display = "block";	
	}
	else
	{
	document.getElementById("da").innerHTML = "data doc: ";
	document.getElementById("a_d").style.display = "none";	
	//document.getElementById("a").style.display = "none";	
	//document.getElementById("a_gg").style.display = "none";	
	//document.getElementById("a_gm").style.display = "none";	
	//document.getElementById("a_mm").style.display = "none";	
	//document.getElementById("a_ma").style.display = "none";	
	//document.getElementById("a_aa").style.display = "none";	
	}
}
function elimina_elemento(id,tipo,controllo) {
	if (confirm("Sei sicuro?")) {
	window.location="/admin/elimina_elemento.asp?id="+id+"&amp;tipo="+tipo+"&amp;c="+controllo
	}
}

function mostraDiv(divCorrente) {
	if (document.getElementById) {
		questoDiv = document.getElementById(divCorrente).style
		if (questoDiv.display == "block") {
			questoDiv.display = "none"
		}
		else {
			questoDiv.display = "block"
		}
		return false
	}
	else {
		return true
	}
}
function espanDiv(divCorrente) {
	if (document.getElementById) {
		questoDiv = document.getElementById(divCorrente).style
		if (questoDiv.display == "none") {
			questoDiv.display = "block"
			document.getElementById('ainterrogazione').style.color='Gray';
			document.getElementById('ainterrogazione').innerHTML='[nascondi]';
			<!--document.getElementById('f').src='images/frecciar.gif';-->
			document.getElementById('contributo').style.color='Gray';
			document.getElementById('contributo').innerHTML='Nascondi';
		}
		else {
			questoDiv.display = "none"
			document.getElementById('ainterrogazione').style.color='Red';
			document.getElementById('ainterrogazione').innerHTML='[mostra]';
			<!--document.getElementById('f').src='images/frecciab.gif';-->
			document.getElementById('contributo').style.color='#990000';
			document.getElementById('contributo').innerHTML='Visualizza';

		}
		return false
	}
	else {
		return true
	}
}
function visualDiv(divCorrente) {
	if (document.getElementById) {
		questoDiv = document.getElementById(divCorrente).style
		if (questoDiv.display == "none") {
			questoDiv.display = "block"
			document.getElementById('contributo').style.color='#990000';
			document.getElementById('contributo').innerHTML='Nascondi';
		}
		else {
			questoDiv.display = "none"
			document.getElementById('contributo').style.color='#990000';
			document.getElementById('contributo').innerHTML='Visualizza';

		}
		return false
	}
	else {
		return true
	}
}
function visualCrono(divCorrente) {
	if (document.getElementById) {
		questoDiv = document.getElementById(divCorrente).style
		if (questoDiv.display == "none") {
			questoDiv.display = "block"
			document.getElementById('cronologia').style.color='#990000';
			document.getElementById('cronologia').innerHTML='nascondi';
		}
		else {
			questoDiv.display = "none"
			document.getElementById('cronologia').style.color='#990000';
			document.getElementById('cronologia').innerHTML='visualizza';

		}
		return false
	}
	else {
		return true
	}
}

function senzaCss(){
	for(i=0;i<document.styleSheets.length;i++) {
		void(document.styleSheets.item(i).disabled=true);
	}
	el = document.getElementsByTagName('*');
	for ( i=0; i<el.length; i++) {
		void(el[i].style.cssText = '');
	}
}
function conCss(){
	for(i=0;i<document.styleSheets.length;i++) {
		void(document.styleSheets.item(i).disabled=false);
	}
	el = document.getElementsByTagName('*');
	for ( i=0; i<el.length; i++) {
		void(el[i].style.cssText = '');
	}
}
function cambia_tipo() {
	//alert(form1.tipo.value)
	frames["fr_scelta"].location="scelta_sogg_prod.asp?tipo="+descfondo.tipo_sogg_prod.value;
	document.descfondo.id_sogg_prod.value=0;
	document.descfondo.sogg_prod.value='';
	alert('Attenzione! Il valore è stato azzerato');
}
function valida_data(tipo,id) {
elemento = document.getElementById(id);
if (elemento.value.length>0) {
switch (tipo) {
case 'gg':
if (elemento.value < 1 || elemento.value > 31) {
	alert("Giorno errato");
	elemento.value="";
	}
break;
case 'mm':
if (elemento.value < 1 || elemento.value > 12) {
	alert("Mese errato");
	elemento.value="";
	}
break;
case 'aa':
if (elemento.value.length!=4) {
	alert("Immetti l'anno con 4 cifre");
	elemento.value="";
	}
break;
}
}
}
// visualizza il frame e fa partire il clip audio
function play_sound(clip) {
	document.getElementById('monitor').style.display='block';
	document.getElementById('player').src = 'sound.asp?clip='+clip;
	}	
// visualizza il frame e fa partire il clip video
function play_video(clip) {
	document.getElementById('monitor').style.display='block';
	document.getElementById('player').src = 'video.asp?clip='+clip;
	}
// visualizza il frame e fa partire il clip foto-oggetto
function play_foto(clip) {
	document.getElementById('monitor').style.display='block';
	document.getElementById('player').src = 'foto.asp?clip='+clip;
	}
	
function cambiasfondo(id) {
	if (document.getElementById) {
		questoElemento = document.getElementById(id).style
		if (questoElemento.backgroundColor == '#eee') {
			questoElemento.backgroundColor = 'Orange'
		}
		else {
			questoElemento.backgroundColor = '#eee'
		}
		return false
	}
	else {
		return true
	}
}
function sfondover(id) {
	document.getElementById(id).style.backgroundColor = '#ddd'
}
function sfondout(id) {
	document.getElementById(id).style.backgroundColor = '#eee'
}
function vis_frame_keyword()
{	if (document.getElementById('fr_scelta_key').style.display=='block') 
		{ document.getElementById('fr_scelta_key').style.display='none'}
		else
		{document.getElementById('fr_scelta_key').style.display='block'}
}
function cambia_fr_keyword() {
	dest='/admin/scelta_keyword.asp?tipo='+document.formkeyadd.tipo_keyword.value+'&keyword='+document.formkeyadd.keyword.value
	//alert(dest);
	frames['fr_scelta'].location.href=dest;
}
function cambia_fr_tipokeyword() {
	document.formkeyadd.keyword.value='';
	dest='/admin/scelta_keyword.asp?tipo='+document.formkeyadd.tipo_keyword.value+'&keyword='+document.formkeyadd.keyword.value
	//alert(dest);
	frames['fr_scelta'].location.href=dest;
}
function cambia_fr_soggprod() {
	dest='/admin/scelta_sogg_prod.asp?tipo='+document.descfondo.tipo_sogg_prod.value+'&soggprod='+document.descfondo.sogg_prod.value
	//alert(dest);
	frames['fr_scelta_soggprod'].location.href=dest;
}
function cambia_fr_tiposoggprod() {
	document.descfondo.sogg_prod.value='';
	dest='/admin/scelta_sogg_prod.asp?tipo='+document.descfondo.tipo_sogg_prod.value+'&soggprod='+document.descfondo.sogg_prod.value
	//alert(dest);
	frames['fr_scelta_soggprod'].location.href=dest;
}
function obbligatorio_label(nome_form) {
	for (var i=0; i < document.forms[nome_form].elements.length; i++) {
		if (document.forms[nome_form].elements[i].title==document.forms[nome_form].elements[i].value) document.forms[nome_form].elements[i].value=''
		if (document.forms[nome_form].elements[i].className=='obblig') {
			if (document.forms[nome_form].elements[i].value=='') {
				alert("Verifica di aver compilato tutti i campi obbligatori!");
				return false
			}
		}
   }
  document.forms[nome_form].submit()
}
function valida_contributo() {
var stringa=''
invia=true;
//alert (document.form1.firma.value);
if (document.form1.firma.value=='') {
	 stringa=stringa+'Inserisci una firma\n';
	 invia=false;
	 }
	 else
	 {
	 if (document.form1.firma.value.indexOf("<")!=-1 || document.form1.firma.value.indexOf(">")!=-1) {
	 	 stringa=stringa+'campo firma: i caratteri < > non sono ammessi!\n';
		 invia=false;
		 }
	 }
if (document.form1.commento.value=='') {
	stringa=stringa+'Inserisci un commento\n';
	invia=false;
	}
	 else
	 {
	 if (document.form1.commento.value.indexOf("<")!=-1 || document.form1.commento.value.indexOf(">")!=-1) {
	 	 stringa=stringa+'campo commento: i caratteri < > non sono ammessi!\n';
		 invia=false;
		 }
	}
if (!(document.form1.email.value.indexOf("@")!=-1 && document.form1.email.value.indexOf(".")!=-1)) {
	stringa=stringa+'email non valida\n';
	invia=false;
	}
if (stringa.length>0) alert(stringa);
if (invia==true) document.form1.submit();
}
function dizionari_opzioni_luoghi(tipo_key) {
if (tipo_key=='luoghi') {
		document.getElementById('opzioni_luoghi').style.display='block'
}
else
{
	document.getElementById('opzioni_luoghi').style.display='none'
}
}
function aprifinestra_gen(dove) {
	win=window.open(dove,"finestra");
	win.creator=self;
	win.focus();
	}