// JavaScript Document
function ApriGruppo(cosa)
{
	var d=document.getElementById(cosa).style;
	d.display=d.display!="block"?"block":"none";
}
function MostraLog()
{
	var x=window.open("admin/trylog.htm","full","resizable=yes,menubar=no,locationbar=no,toolbar=no,statusbar=no,width=250,height=150");
	x.moveTo((screen.availWidth-250)/2,(screen.availHeight-150)/2 );
	x.focus();
}

function Evidenza()
{
	var x=window.open("evidenza.php","notice","resizable=yes,menubar=no,locationbar=no,toolbar=no,statusbar=no,width=640,height=480");
	x.focus();
}
function Dimensiona()
{
	var x= screen.availWidth;
	var y=screen.availHeight;
	var g=Math.ceil(14600/x)*1.5;
	if(document.getElementById("MnSx"))
	{
		document.getElementById("MnSx").style.width=g+"%";
	}
	if(document.getElementById("MnDx"))
	{
		document.getElementById("MnDx").style.width=g+"%";
	}
}

function Sponsor()
{
	var d=document.getElementById("sponsor");
	d.style.display=d.style.display!="block"?"block":"none";
}
var tO;
function Muovi(quanto)
{
	var c=document.getElementById("pagina").contentDocument?document.getElementById("pagina").contentDocument.getElementById("main_content"):document.frames["pagina"].document.getElementById("main_content");
	c.scrollTop+=quanto?10:-10;
	tO=setTimeout("Muovi("+quanto+")",30);
}

function Ferma()
{
	clearTimeout(tO);
}


function GO_Page(destinazione, menu)
{
	if(destinazione.length>0)
	{
		if(document.FUORI)
		{
			//document.getElementById(document.FUORI).style.color="#FFFFFF";
			document.getElementById(document.FUORI).className="Normal_A_W";//style.fontWeight="normal";
		}
		if(menu && document.getElementById(menu))
		{
			var m=document.getElementById(menu);
			m.className="Choosen_A_W";//style.fontWeight="bold";//m.style.color="#D01F39";
			document.FUORI=menu;
		}
		document.getElementById("general_middle").src=destinazione;
	}
}

function Left_Page(destinazione,menu)
{
	if(destinazione.length>0)
	{
		if(parent.document.FUORI)
		{
			//parent.document.getElementById(parent.document.FUORI).style.color="#FFFFFF";
   			  parent.document.getElementById(parent.document.FUORI).className="Normal_A_W";//style.fontWeight="normal";
		}
		if(menu && parent.document.getElementById(menu))
		{
			var m=parent.document.getElementById(menu);
			m.className="Choosen_A_W";//style.fontWeight="bold";//m.style.color="#D01F39";
			parent.document.FUORI=menu;
		}
		document.location=destinazione;
	}
}
function Left_Left_Page(destinazione,menu)
{
	if(destinazione.length>0)
	{
		if(parent.parent.document.FUORI)
		{
			parent.parent.document.getElementById(parent.parent.document.FUORI).className="Normal_A_W";//style.fontWeight="normal";//parent.parent.document.getElementById(parent.parent.document.FUORI).style.color="#2c2c2c";
		}
		if(menu && parent.parent.document.getElementById(menu))
		{
			var m=parent.parent.document.getElementById(menu);
			m.className="Choosen_A_W";//			m.style.fontWeight="bold";//m.style.color="#D01F39";
			parent.parent.document.FUORI=menu;
		}
		parent.document.location=destinazione;
	}
}
var FUORI="";
var ALTRO="";
function Open_Son(quale)
{
	var c=document.getElementById("son_of_"+quale);
	if(FUORI && FUORI!=c)
	{
		FUORI.style.display="none";
	}	
	c.style.display=c.style.display!="block"?"block":"none";
	FUORI=c;
}

function Stampa_Articolo(id)
{
	var x=window.open("prnart.php?id="+id);
	x.focus();
}

function fnGO(targ)
{
	var c=document.getElementById("pagina").contentDocument?document.getElementById("pagina").contentDocument:document.frames["pagina"].document;
	c.getElementById(targ).scrollTop=0;
}


function Open_Right(destinazione, menu)
{
	if(destinazione.length>0)
	{
		if(document.getElementById(ALTRO))
		{
			document.getElementById(ALTRO).className="Normal_A_W";//style.fontWeight="normal"; //document.getElementById(ALTRO).style.color="#2c2c2c";
		}
		if(menu.length)
		{
			var m=document.getElementById(menu);
			m.className="Choosen_A_W";//m.style.fontWeight="bold";//m.style.color="#D01F39";
			ALTRO=menu;
		}
		document.getElementById("middle_right").src=destinazione;
	}
}

function Cambia_Lingua(lingua)
{
	var lingue= new Array("LNGit","LNGen","LNGde","LNGfr","LNGru");
	var midd=document.getElementById("general_middle");
	var docs=midd.src;
	var newdocs=docs.substr(0,(docs.length-2))+lingua;
	midd.src=newdocs;
	/*for(var x=0;x<lingue.length;x++)
	{	
		var l=document.getElementById(lingue[x]);
		l.className=l.id!=("LNG"+lingua)?"Normal_A_B":"Choosen_A_B";
	}
	*/
	Cambia_Menu(lingua)
}

function Apri(foto)
{
	var x=window.open(foto,"nuova","width=640,height=480,resizable=yes");
	x.focus();
}
function Apri_Testo(id)
{
	var d=document.getElementById("blocco_testo"+id);
	var l=document.getElementById("lex"+id);
	d.style.display=d.style.display!="block"?"block":"none";
	l.innerHTML=d.style.display=="block"?"chiudi...":"leggi...";
}

function Stampa(cosa)
{
	var x=window.open("prnart.php?id="+cosa,"nuova","width=480,height=600,resizable=yes");
	x.focus();
}

function Posiziona()
{
	var o=document.getElementById("OGGI");
	var b=document.getElementById("BOX");
	var OL=DL_GetElementLeft(o);
	var OT=DL_GetElementTop(o);
	b.style.top=(OT-120)+"px";
	b.style.left=OL>275?(OL-140)+"px":(OL+15)+"px";
	b.style.backgroundImage=OL>275?"url(images/box_dx.gif)":"url(images/box_sx.gif)";
	b.style.display="block";
	TempoTrascorso=6;
	setTimeout("ChiudiBox()",1000);
}

function DL_GetElementLeft(eElement)
{
    if (!eElement && this)                       // if argument is invalid
    {                                            // (not specified, is null or is 0)
        eElement = this;                         // and function is a method
    }                                            // identify the element as the method owner
    
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}


function DL_GetElementTop(eElement)
{
    if (!eElement && this)
    {
        eElement = this;
    }

    var nTopPos = eElement.offsetTop;
    var eParElement = eElement.offsetParent;
    while (eParElement != null)
    {
        nTopPos += eParElement.offsetTop;
        eParElement = eParElement.offsetParent;
    }
    return nTopPos;
}
var TempoTrascorso=5;
function ChiudiBox()
{
	TempoTrascorso--;
	document.getElementById("timing").innerHTML=TempoTrascorso;
	TempoTrascorso<=0?document.getElementById("BOX").style.display="none":null;
	TempoTrascorso<=0?clearTimeout():setTimeout("ChiudiBox()",1000);
	
}