// JavaScript Document

function homePage(){
	if (document.all){
		document.documentElement.style.behavior='url(#default#homepage)';
		document.documentElement.setHomePage('http://www.aiaroma.it');
	}else{
		var msg = "Sezione di Roma - Info: Il tuo browser non supporta lo script per inserire http://www.aiaroma.it come pagina iniziale."
		alert(msg);
	}
}

function preferiti(){
	if (document.all){
		window.external.AddFavorite(document.location.href,document.title);
	}else{
		var msg = "Sezione di Roma - Info: Il tuo browser non supporta lo script per inserire "+document.location.href+" ai preferiti."
		alert(msg);
	}
}

function stampa(idn){
	popUp = window.open("stampa_articolo.asp?idn="+idn, "stampa", "width=600 height=500 scrollbars=no");
	popUp.focus();
}

function invia(idn){
	document.location = "invia_articolo.asp?idn="+idn
}

function gallery(idn){
	document.location = "gallery.asp?idn="+idn
	
}

function viewImage(urlImage,imageBig){
	document.write('<a href="javascript:openImage(\''+imageBig+'\')" onfocus="this.blur();"><img src="'+urlImage+'" class="bordo_azzurro" border="0" alt="Clicca per ingrandire la foto" /></a>');
}

function openImage(image){
	i1 = new Image;
	i1.src = image;
	html = '<html>\n<head>\n<title>Associazione Italiana Arbitri - Sezione di Roma "Generoso Dattilo" - Foto </title>\n</head>\n<body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>\n<center><img src="'+image+'" border=0 name=imageBig onLoad="window.resizeTo(document.imageBig.width+14,document.imageBig.height+32)" /></center>\n\n</html>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
}

function openPopup(page,tool){
	popup = window.open(page,'pagina',tool);
	popup.focus();
}

var FoundFocus = false;
function setFoundFocus() {FoundFocus = true;}
function resetFoundFocus() {FoundFocus = false;}
function getFoundFocus() {return FoundFocus;}

function SetupEvents(){
	if (window.sidebar){	
		document.onmousedown=handleMouseDown;
		document.onclick=handleClick;
	}
	
	if (document.all)
		document.onselectstart=handleSelectStart
}

SetupEvents();

function handleSelectStart(evnt) {return false;}
function handleMouseDown(evnt) {return (window.sidebar )?(getFoundFocus())?true:false:false;}
function handleClick(evnt){return true;}

function CheckForFormFocus(){
	var i = j = 0;
	while (i < document.forms.length && !getFoundFocus()){
		j = 0;
		while (j < document.forms[i].length && !getFoundFocus()){
			document.forms[i].elements[j].onmouseover = setFoundFocus;
			document.forms[i].elements[j].onmouseout = resetFoundFocus;
			j++;
		}

	i++;
	}
}

function apriAlbum() {
	var trAlbum=document.getElementById("album");
	
	if (trAlbum.id=="album" && trAlbum.className=='nascosto') {
		trAlbum.className='visibile';
	}else{
		if(trAlbum.id=="album" && trAlbum.className=='visibile') {
			trAlbum.className='nascosto';
		}
	}
}

// inizio funzioni per immagini in primo piano dell'home page

var qualeimg = 0; 

function roller(){ 
	document.getElementById("immagine").style.filter="blendTrans(duration=2)";
	document.getElementById("immagine").style.filter="blendTrans(duration=CrossFadeDuration)";
	document.getElementById("immagine").filters.blendTrans.Apply();
	document.getElementById("immagine").src = "images/foto/"+img[qualeimg]; 
	
 	if (document.all) document.getElementById("immagine").filters.blendTrans.Play();
	
    qualeimg++; 
    if (qualeimg==img.length) 
        { 
        qualeimg=0; 
        clearInterval(timerID); 
        setTimeout("timerID=setInterval('roller()',3000)",1000); 
        } 
    } 
	
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function switchImage(imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
	  if (document.all){
		document.images["img_notizia"].style.filter="blendTrans(duration=2)";
		document.images["img_notizia"].style.filter="blendTrans(duration=CrossFadeDuration)";
		document.images["img_notizia"].filters.blendTrans.Apply();}
		document.images["img_notizia"].src = "images/foto/"+imgSrc;
		if (document.all) document.images["img_notizia"].filters.blendTrans.Play();
      	//document.images[imgName].src = imgSrc;
    }
  }
}

// fine funzioni per immagini in primo piano dell'home page