//ROLLOVER --------------------------------------------------------------------------------------------------------------------------
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-----------------------------------------------------------------------------------------------------------------------------------------


function addbookmark()
{
	if (document.all)
	{
		bookmarkurl = document.location.href;
		bookmarktitle = document.title;
		window.external.AddFavorite(bookmarkurl,bookmarktitle);
	}
	else
	{
		var msg = "ATTENZIONE\n\n";
		msg += "Per aggiungere questa pagina ai preferiti\n";
		msg += "di Netscape Navigator, bisogna:\n\n";
		msg += "1) Chiudere questa finestra\n";
		msg += "2) Premere i tasti Ctrl + D\n";
		window.alert(msg);
	}
}


function OpenCredits()
{
	Hschermo	= (window.screen.height - 450) / 2
	Wschermo	= (window.screen.width - 400) / 2
	window.open("credits.htm", "", "left=" + Wschermo + ",top=" + Hschermo + ",scrollbars=no,width=400,height=450,resizable=no,titlebar=no,status=no,toolbar=no")
}


function ApriPopUp(url)
{
	Hschermo	= (window.screen.height - 520) / 2
	Wschermo	= (window.screen.width - 490) / 2
	window.open(url, "", "left=" + Wschermo + ",top=" + Hschermo + ",scrollbars=yes,width=490,height=520,resizable=no,titlebar=no,status=no,toolbar=no")
}


function FieldsCheck(NomeForm)
{
	boolOk = true
	if (NomeForm == "LoginInAteneo")
	{
		if ((document.LoginInAteneo.Utente.value == "") || (document.LoginInAteneo.Password.value == ""))
		{
			alert("Attenzione: compilare tutti i campi")
			boolOk = false
		}
	}
}


function CheckFrmGratuiti()
{
	var NomeForm = document.frmRaccoltaDati
	
	if ((NomeForm.txtNome.value == "") || (NomeForm.txtCognome.value == "") || (NomeForm.txtTel.value == "") || (NomeForm.txtEmail.value == "") || (NomeForm.txtPrefisso.value == "") || (NomeForm.txtEta.value == "") || (NomeForm.txtComuneR.value == ""))
	{
		alert("Attenzione: Tutti i campi sono obbligatori")
		return false
	}
	else if ((NomeForm.txtEmail.value.indexOf("@") == -1) || (NomeForm.txtEmail.value.indexOf(".") == -1))
	{
		alert("Attenzione: l'indirizzo email non è stato digitato correttamente")
		return false
	}
	else if ((isNaN(NomeForm.txtTel.value) == true) || (isNaN(NomeForm.txtPrefisso.value) == true))
	{
		alert("Attenzione: il numero di telefono non è stato digitato correttamente")
		return false
	}
	else if (NomeForm.radioAutorizzo(1).checked == false)
	{
		alert("Attenzione: è necessario autorizzare Ateneo-Online al trattamento dei dati personali")
		return false
	}
	else
	{
		NomeForm.submit()
	}
}


function ChangeTDColor(Evento, TDID, OutColor)
{
	if (document.all)
	{
		if (Evento == "over")
		{
			document.getElementById(TDID).style.backgroundImage = "none"
			document.getElementById(TDID).style.backgroundColor = "white"
		}
		else
		{
			document.getElementById(TDID).style.backgroundImage = "none"
			document.getElementById(TDID).style.backgroundColor = OutColor
		}
	}
}


function ApriCustomPopUp(url, width, height, changepag)
{
	Hschermo	= (window.screen.height - height) / 2
	Wschermo	= (window.screen.width - width) / 2
	window.open(url, "", "left=" + Wschermo + ",top=" + Hschermo + ",scrollbars=yes,width=" + width + ",height=" + height + ",resizable=no,titlebar=no,status=no,toolbar=no")
	
	//L'argomento changepag contiene l'URL della pagina che deve caricarsi nella finestra di origine
	if (typeof(changepag) != "undefined")
	{
		document.location.href = changepag
	}
}


function VediApprofond(url)
{
	Hschermo	= (window.screen.height - 520) / 2
	Wschermo	= (window.screen.width - 490) / 2
	window.open(url, "", "left=" + Wschermo + ",top=" + Hschermo + ",scrollbars=yes,width=490,height=520,resizable=no,titlebar=no,status=no,toolbar=no")
}


function ChangeMap(QualeMappa)
{
	var CurrentMap		= document.ImgMappa
	CurrentMap.src		= "chisiamo/images/mappe/mappa" +  QualeMappa + ".gif"
}