<!--
// JavaScript Document
function openPhoto2(sorgente, preview)
{
	var scrTop=0;
	var boxImg;
	var imgIng;
	var winl;
	var wint;
	var srcPath="";
	var posName;
	
	if (document.getElementById)
	{

		imgIng = document.getElementById("imgingrand");
		imgIng.style.visibility="hidden";
		if (preview)
			{
			posName = sorgente.src.split("/");
			for(pos=0; pos<(posName.length-1); pos++)
				srcPath+=posName[pos] + "/";
			srcPath += "../" + posName[posName.length-1];
			}
		else
			srcPath=sorgente.src;
			
		imgIng.src = srcPath;
		imgIng.alt = sorgente.alt;
		
		imgIng.onload= function () 
			{
			this.style.visibility="inherit";
			aggiornaBox(this);
			};
	}
}

function aggiornaBox(sorgente)
{
		boxImg = document.getElementById("boxingrand");		
		if (document.body.parentNode.scrollTop)
			scrTop = parseInt(document.body.parentNode.scrollTop);
		else if (window.scrollY)
			scrTop = parseInt(window.scrollY);
		else
			scrTop = parseInt(document.body.scrollTop);
		
		var imgW;
		var imgH;
		if ((parseInt(sorgente.width)==0) || (parseInt(sorgente.height)==0))
		{
			imgW = 800;
			imgH = 600;
		}
		else
		{
		imgW = parseInt(sorgente.width);
		imgH = parseInt(sorgente.height);
		}

		var winl = (parseInt(screen.width) -  imgW )/2;
		var wint = (parseInt(screen.height) -  imgH )/2;
		if (winl < 0) winl=0;
		if (wint < 0) wint=0;
		boxImg.style.width = imgW + "px";
		boxImg.style.height = imgH + "px";
		boxImg.style.top = (wint + scrTop) + "px";
		boxImg.style.left = winl + "px";
		boxImg.style.visibility="visible";
		boxImg.onclick = function()	{ boxImg.style.width = "10px"; boxImg.style.height = "10px"; this.style.visibility="hidden"; var imgIng = document.getElementById("imgingrand"); imgIng.src="";};
		if ((parseInt(sorgente.width)!=imgW) || (parseInt(sorgente.height)!=imgH))
			aggiornaBox(sorgente);
//		alert(parseInt(sorgente.width));
}

function tastodx(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){ 
		return false;
	}else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
		alert("Schermata protetta, la copia non è autorizzata");
		return false;
	}
	return true;
}

function high(foto)
{
	if (foto.filters)
		foto.filters.alpha.opacity=100;
	else
		foto.style.MozOpacity=1;
}

function low(foto)
{
	if (foto.filters)
		foto.filters.alpha.opacity=50;
	else
		foto.style.MozOpacity=0.5;
}

function addOnClickImg()
{
	if (document.getElementsByTagName && document.getElementById)
	{
		var contBox = document.getElementById("containercontent");
		var arrImg = contBox.getElementsByTagName("img");
		var x=0;
		for (indImg=0; indImg < arrImg.length; indImg++)
		{
			arrImg[indImg].style.cursor="pointer";
			if (arrImg[indImg].className!="imgPreview")
				{
/*				arrImg[indImg].onclick = function()	{ openWinImg(this);	};*/
//				arrImg[indImg].onclick = function()	{ openPhoto2(this,false); };
				}
			else
				{
				// imgPreview
				if(document.onmousedown==null)
					document.onmousedown= function() { tastodx(); }
				arrImg[indImg].onclick = function()	{ openPhoto2(this,true); };
				arrImg[indImg].onmouseover = function()	{ high(this); };
				arrImg[indImg].onmouseout = function() { low(this);	};
				if (document.all)
					arrImg[indImg].style.filter="alpha(opacity=50)";
				else
					{
					arrImg[indImg].style.setProperty("-moz-opacity", "0.5", "");
					arrImg[indImg].style.setProperty("-khtml-opacity", "0.5", "");
					}				
				}
		}
	}
	if (document.getElementById)
	{

		imgIng = document.getElementById("imgingrand");
		imgIng.style.visibility="hidden";
		imgIng.onload= function () 
			{
			this.style.visibility="inherit";
			aggiornaBox(this);
			};
	}
}

function adattaHrefInLiContenutoIn(sorgente)
{
	var docPathArr = document.URL.split("/");
	var docPath = "";
	for (indArr=0; indArr < docPathArr.length-1 ;indArr++)
		{
		docPath += docPathArr[indArr] + "/";
		}
	var linkSpeciali = sorgente.getElementsByTagName("li");
	for (indLi=0; indLi < linkSpeciali.length; indLi++)
		{
		var liLink = linkSpeciali[indLi].getElementsByTagName("a");
		for (indHref=0; indHref < liLink.length; indHref++)
			{
			var relPath= liLink[indHref].href.substr(docPath.length);
			liLink[indHref].href = docPath + relPositionToRoot + relPath;
			}
		}
}

function adattaPath()
{
	if (document.getElementById && document.getElementsByTagName)
		{
		// gestione link menu sx
		var speciali = document.getElementById("speciali");
		adattaHrefInLiContenutoIn(speciali);
		// gestione link menu argomenti
		var navigationB = document.getElementById("navigationb");
		adattaHrefInLiContenutoIn(navigationB);
		}
}

startF = function startSettings()
{
/*	adattaPath();*/
	addOnClickImg();
}

var levelOfRoot="1";

if (window.addEventListener)
	window.addEventListener("load", startF, false);
else if (window.attachEvent)
	window.attachEvent("onload", startF);
else if (document.getElementById)
	window.onload = startF;
-->
