// JavaScript Document
/*Messaggio scorrevole
msg = " Benvenuti nel sito della UILM Piemonte" ;
msg += "         ";
pos = 120;
function ScrollMessage() {
   var newtext = msg.substring(pos, msg.length) + msg.substring(0, pos);
   var div = document.getElementById("scroll");
   div.firstChild.nodeValue = newtext;
   pos++;
   if (pos > msg.length) pos = 0;
   window.setTimeout("ScrollMessage()",100);
   }
   function Finestra()
{//var stile= "top=140, left=10, width=430, height=330, scrollbars=no, toolbar=no, menubar=no"
  //window.open("GrDirigente.htm","Dirigente",stile); 
}
//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;
//}*/
  var n=2; 
function Cambia() {n='2';
window.status="UILM Piemonte";
setTimeout("Immagine1()",500);  }
//function Cambia1() {
//location.href="default1.htm"; }
var duration; var transition;
function Immagine1()
	{prima.filters.blendTrans(duration).apply();
	prima.filters.blendTrans(4).play();
	switch(n){	
	case '1': document.prima.src='Immagini/Banner/BannerRosso10.jpg';n='2';break;
	case '2':document.prima.src='Immagini/Banner/BannerAzzurro10.jpg';n='3';break;
	case '3':document.prima.src='Immagini/Banner/BannerGiallo10.jpg';n='4';break;
	case '4':document.prima.src='Immagini/Banner/BannerOminoRosso10.jpg';n='1';break;
		}
	setTimeout("Immagine1()",3500);
   }

  
   
function initleft(valleft,valwidth) {
if(typeof(valleft)== "string") {
    switch(valleft) {
        case "left":    retleft = 0;                                   break;
        case "center":  retleft = (screen.width - valwidth)/2;         break;
        case "right":   retleft = screen.width - valwidth;             break;
        default: alert("STRINGA ERRATA\n(avviso per il debugging)");break;
        }
 }
 else retleft = valleft
return(retleft)
}


function inittop(valtop,valheight) {
if(typeof(valtop)== "string") {
    switch(valtop) {
        case "top":     rettop = 5;                                   break;
        case "center":  rettop = (screen.height - valheight)/2;       break;
        case "bottom":  rettop = screen.height - valheight;           break;
        default: alert("STRINGA ERRATA\n(avviso per il debugging)");break;
        }
 }
 else rettop = valtop
return(rettop)
}


function initpassitot() {
this.passitot = Math.round(Math.max(Math.abs((this.fw-this.iw))/Math.abs(this.passow),Math.abs((this.fh-this.ih))/Math.abs(this.passoh))) 

 if(!this.passitot || this.passitot==0) 
 this.passitot = Math.round(Math.max(Math.abs((this.fl-this.il))/Math.abs(this.passow),Math.abs((this.ft-this.it))/Math.abs(this.passoh))) 
}


function popplay() {

if(!this.pp.closed){
  
  this.pp.focus()  
  
  if(this.ciclo < this.passitot) {
     opw = (this.passow > 0) ? "<" : ">" ;
     oph = (this.passoh > 0) ? "<" : ">" ;

     if(eval("this.iw "+opw+" this.fw")) this.iw += this.passow
     if(eval("this.ih "+oph+" this.fh")) this.ih += this.passoh

     this.il += this.passol 
     this.it += this.passot 
     this.pp.resizeTo(this.iw,this.ih)
     this.pp.moveTo(this.il,this.it)
     this.ciclo++
     eval("setTimeout(this.obj+'.play()',"+this.ms+")")
     }
  else {
     this.ciclo = 0
     eval(this.af)
     }
 }
}


function popslide(fw,fh,fileft,fitop,passow,passoh,ms,af,noslide){
 
 this.fw = (fw == "max") ? screen.width : (fw || this.iw);  
 this.fh = (fh == "max") ? screen.height : (fh || this.ih); 
 this.fl = (fileft) ? initleft(fileft,this.fw) : initleft(this.inleft,this.fw); 
 this.ft = (fitop) ? inittop(fitop,this.fh) : inittop(this.intop,this.fh); 
 this.inleft = fileft || this.inleft;
 this.intop = fitop || this.intop;
 this.passow = (this.fw - this.iw >=0) ? (passow || 5) : eval("-"+(passow || 5));
 this.passoh = (this.fh - this.ih >=0) ? (passoh || 5) : eval("-"+(passoh ||5)); 
 this.passi() 
 this.passol = (this.fl - this.il)/this.passitot 
 this.passot = (this.ft - this.it)/this.passitot
 this.ms = ms || 10; 
 this.af = af || ''
 if(!noslide) this.play()
}


function pop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft,fitop,passow,passoh,ms,af,noslide) {          
 this.obj = nome 
 this.iw = (iw == "max") ? screen.width : iw;           
 this.ih = (ih == "max") ? screen.height : ih;   

 this.il = initleft(inleft,this.iw) 
 this.it = inittop(intop,this.ih)  
 
 tools = tools || '';
 if(document.layers)
   tools = (tools.toLowerCase().indexOf("resizable")==-1) ? 'resizable=yes,'+tools : tools;
 
 this.pp = window.open(url,nome,tools+" width=10,height=10,left="+this.il+",top="+this.it) 
 this.pp.resizeTo(this.iw,this.ih)
 this.ciclo = 0    
 
 this.inleft = inleft
 this.intop = intop
 this.slide(fw,fh,fileft,fitop,passow,passoh,ms,af,noslide) 

}



function popclose() {
 this.pp.close()
}


function poplocation(url) {
 this.pp.location = url
 this.pp.focus()
}


function addpop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft,fitop,passow,passoh,ms,af,noslide) {
eval(nome+" = new pop(nome,url,tools,iw,ih,fw,fh,inleft,intop,fileft,fitop,passow,passoh,ms,af,noslide);")
}


pop.prototype.passi = initpassitot
pop.prototype.slide = popslide
pop.prototype.play = popplay
pop.prototype.close = popclose
pop.prototype.location = poplocation
