//In quale ambiente sto operando ?
var ns4;var ie4
if (self.screen) { scrWidth = screen.width; scrHeight = screen.height }
function CreaOgg(id,nest,frm)
{
ns4 = (document.layers)? true:false
ie4 =  (document.all)? true:false
if (ns4) 
	{
	stringa = "";
    if (frm) stringa = "parent." + frm + ".";
    if (nest) stringa = stringa + "document."+ nest + "."
    this.css = eval (stringa + "document." + id );
    this.x = this.css.left;	
    this.y = this.css.top; 
    this.doc=this.css.document
     }
else
	{ 
	stringa = "";
    if (frm) stringa = "parent." + frm + ".";
    this.event = this.css = eval(stringa + "document.all[id].style"); 
	this.x = this.css.pixelLeft; 
	this.y = this.css.pixelTop; 
	this.doc = eval(stringa + "document.all[id]")}

//variabili esclusive dell'oggetto

this.id=id;this.ogg="Ly" + id;this.attivo=false;this.visibile=false;this.azione=null;this.Ttop=null;this.Tright=null;this.Tbottom=null;this.Tleft=null
this.i=0;this.coordx=new Array();this.coordy=new Array()
//metodi esclusivi dell' oggetto
this.Scrivi = COScrivi
    // movimento lineare
this.MuoviDi = COMuoviDi;this.MuoviA = COMuoviA;this.MuoviVerso = COMuoviVerso;this.MuoviVerso2 = COMuoviVerso2
    // mostra e nascondi
this.Mostra = COMostra;this.Nasc = CONasc;this.Cambia = COCambia;
// Tendina
this.TendaA = COTendaA;this.TendaDi = COTendaDi;this.TendaMin = COTendaMin;this.TendaVerso = COTendaVerso;this.TendaVerso2 = COTendaVerso2
}
//Metodi
function COScrivi(testo) 
{
if (ns4)    {	this.doc.open(); this.doc.write(testo);	this.doc.close() } else {	this.doc.innerHTML = testo	}
}

function COMuoviDi(x,y)
{ this.x += x; this.y += y; this.MuoviA(this.x,this.y) }
function COMuoviA(x,y) 
{	this.x = x; this.y = y; this.css.left = this.x; this.css.top = this.y }
function COMostra()
{ (ns4) ?	this.css.visibility = "show" :	this.css.visibility = "visible";	this.visibile=true }
function CONasc()
{ 
if (ns4) 	{ this.css.visibility = "hide" } else {	this.css.visibility = "hidden" }
	this.visibile=false
}
function COCambia()
{	(this.visibile) ? this.Nasc() : this.Mostra() }
function COMuoviVerso(finx,finy,inc,inter,azione)
{
if (this.attivo) return;this.attivo=true;this.azione=azione;diffx= (finx - this.x)/inc;diffy= (finy - this.y)/inc
if (!diffx)	{diffx=0}
if (!diffy)	{diffy=0}
this.MuoviVerso2(diffx,diffy,inc,finx,finy,inter)
}
function COMuoviVerso2(ax,ay,inc,fx,fy,inter)
{(!inter) ? aa=30 : aa= inter
sx=ax;sy=ay
if (this.x < (fx+1) && this.x > (fx - 1) && this.y < (fy+1) && this.y > (fy - 1)) 
	{
	this.MuoviA(fx,fy);	this.attivo=false; eval(this.azione);return;
	}
this.MuoviDi(sx,sy);setTimeout(this.ogg+".MuoviVerso2("+sx+","+sy+","+ aa + "," + fx + "," + fy +"," + inter + ")",aa)			
}
function COTendaA(top,right,bottom,left)
{
    this.Ttop = top ; this.Tright = right; this.Tbottom = bottom; this.Tleft = left;
if (ns4)
    { this.css.clip.top = top; this.css.clip.right = right; this.css.clip.bottom = bottom; this.css.clip.left = left }
	else
    { this.css.clip = "rect("+top+"px "+right+"px "+bottom+"px "+left+"px)" }
}
function COTendaDi(top,right,bottom,left)
{	this.TendaA(this.Ttop + top,this.Tright + right ,this.Tbottom + bottom,this.Tleft + left) }
function COTendaVerso(Mtop,Mright,Mbottom,Mleft,inc,inter,azione )
{if (this.attivo) return;
this.attivo=true; this.azione=azione; Dtop=(Mtop-this.Ttop)/inc;Dright=(Mright-this.Tright)/inc;
Dbottom=(Mbottom-this.Tbottom)/inc;Dleft=(Mleft-this.Tleft)/inc;this.i=0
this.TendaVerso2(Dtop,Dright,Dbottom,Dleft,inc,Mtop,Mright,Mbottom,Mleft,30)
}
function COTendaVerso2(Dtop,Dright,Dbottom,Dleft,inc,Mtop,Mright,Mbottom,Mleft,inter)
{
(!inter) ? aa=30 : aa=inter
vinc=inc;Ptop=Dtop;Pbottom=Dbottom;Pleft=Dleft;Pright=Dright
if (this.i == vinc)
	{ this.TendaA(Mtop,Mright,Mbottom,Mleft); this.attivo=false; eval(this.azione); return;	}
this.i= this.i + 1;this.TendaDi(Ptop,Pright,Pbottom,Pleft);
setTimeout(this.ogg+".TendaVerso2("+Ptop+","+Pright+ "," + Pbottom + "," + Pleft + ","+ vinc + "," + Mtop + "," + Mright + "," + Mbottom + "," + Mleft +"," + inter + ")",aa)			
}
function COTendaMin()
{Wmin=(this.Tright)/2;this.TendaVerso(Wmin,0,0,Wmin,20)}

var colori=new Array('#FFFFFF','#E8E8E8','#C2C2C2','#8E8E8E','#424242','#000000','#000000','#000000','#000000','#000000','#000000')
var num=0; var i=0;var t1=300;var t2=3500;var appoggio;
function NewWin(url)
{
Fines=window.open(url,'aaaa','scrollbars=yes,status=no,toolbar=yes,width=640,height=480');
}
function Fade(){
CreaTesto()
if (num<10)	
{	LyNews.Scrivi(text)		
	num++;setTimeout('Fade()',t1)
}
	else
{
setTimeout('Fade2()',t2)
}
}

function Fade2(){
CreaTesto()
if (num>1)	
{	
	LyNews.Scrivi(text)		
	num--;setTimeout('Fade2()',t1)
}
	else
{
num=0;i=i+1;
if (i==testo.length) i=0;
Fade()
}
}

function CreaTesto(){
text="<table><tr><td>" ;
text=text + "<span style=\"font-family: Arial ; font-size: 12px; font-weight : bold; color: " + colori[num] + "\">"
appoggio=testo[i].split("§");
variabile= appoggio[appoggio.length-1].indexOf("news.html")
if (variabile == -1)
	{
	text = text + "<span class=\'evid\'>" + appoggio[0] + "</span><br>" + appoggio[1];
	}
	else
	{
	text = text + "<a href=javascript:NewWin(\'" + appoggio[appoggio.length-1] + "\')>" + appoggio[0] + "</a><br>" + appoggio[1];
	}
text=text + "</span></td></tr></table>"
}
