

var imagenames=new Array("images/hourglass.gif","images/sfumato.jpg","images/sfondoap3.jpg","images/sfumatov.jpg","images/sfumatoc.jpg","images/vda_new.gif");
imagenames.push("images/augusta_praetoria_sfu.gif","images/intest.gif","images/fitalogo3.gif","images/logofitarco2.gif");
imagenames.push("images/vda2.gif","images/italy.gif","images/arrowsx.gif","images/arrowdx.gif","images/arrowcenter.gif");
imagenames.push("scroller/visuali.jpg","images/ombra485x225.jpg","images/campo5a.jpg","images/newb12.gif");
imagenames.push("images/newy12.gif","images/newo12.gif","images/newp12.gif","images/newr12.gif","images/newv12.gif");
imagenames.push("images/puntobersaglio.gif","images/menutrasp.gif","images/squadrah4.jpg");

var Yoffset=245;

var PageHTML="index1.php";
var loadedbgcolor='#507550';  //#b8b095
var unloadedbgcolor='#333333';              
var loadedcolor='#bbaa99'; //#ccbb88
var unloadedcolor='#001100'; 
var barheight=1;                   
var barwidth=350;                  
var bordercolorest='#555555';
var bordercolor='#222222';       

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var imagesdone=false;
var OK=false;
var blocksize=barwidth/(imagenames.length);
barheight=Math.max(barheight,13);

var loaded=0, perouter, perdone, images=new Array();

var txt=(NS4)?'<layer name="perouter" bgcolor="'+bordercolor+'" visibility="hide">' : '<div id="perouter" style="position:absolute; visibility:hidden; background-color:'+unloadedbgcolor+'">';

txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td width="'+barwidth+'" height="'+barheight+'" valign="center">';

if(NS4)txt+='<ilayer width="100%" height="100%"><layer width="100%" height="100%" bgcolor="'+unloadedbgcolor+'" top="0" left="0">';

txt+='<table height="'+(barheight)+'" width="'+(barwidth)+'" cellpadding="0" cellspacing="0" border="1" style="border-collapse: collapse; border-left: 1px solid '+bordercolor+'; border-top: 1px solid '+bordercolor+'; border-right: 1px solid '+bordercolorest+'; border-bottom: 1px solid '+bordercolorest+'"><tbody><tr><td valign="center" align="center" width="100%" height="100%" bgcolor="'+unloadedbgcolor+'"><font color="'+loadedcolor+'" size="1" face="sans-serif">Caricamento immagini...</font></tbody></td></tr></table>';

if(NS4) txt+='</layer>';

txt+=(NS4)? '<layer name="perdone" width="100%" height="'+barheight+'" bgcolor="'+loadedbgcolor+'" top="0" left="0">' : '<div id="perdone" style="position:absolute; top:1px; left:1px; width:'+(barwidth)+'px; height:'+barheight+'px; z-index:100">';

txt+='<table height="'+(barheight)+'" width="'+(barwidth-2)+'" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse; background-image: url(\'images/statusbar.gif\')"><tbody><tr><td valign="center" align="center" width="100%" height="100%"><font id="completato" color="'+unloadedcolor+'" size="1" face="sans-serif">Caricamento immagini...</font></td></tr></tbody></table>';

txt+=(NS4)? '</layer></ilayer>' : '</div>';

txt+='</td></tr></table>';

txt+=(NS4)?'</layer>' : '</div></CENTER>';


document.write(txt);


function avviapreload(){
var attesa=setTimeout('go()','3000');  //imposta 3 secondi di attesa minima prima di aprire la Home Page
loadimages()
}

function loadimages(){

if(NS4){
perouter=document.perouter;
perdone=document.perouter.document.layers[0].document.perdone;
}
if(NS6){
perouter=document.getElementById('perouter');
perdone=document.getElementById('perdone');
}
if(IE4){
perouter=document.all.perouter;
perdone=document.all.perdone;
}

cliplayer(perdone,0,0,barheight,0);

setouterpos();
for(n=0;n<imagenames.length;n++){
images[n]=new Image();
images[n].src=imagenames[n];
setTimeout('checkload('+n+')' ,n*100);
}}

function setouterpos(){
var ww=(NS6)? window.innerWidth : document.body.clientWidth;
var x=(ww-barwidth)/2;

yposition=(NS6)?((window.innerHeight)-(document.getElementById('tablogo').getAttribute('height')))/2 + Yoffset : ((document.body.clientHeight)-(document.getElementById('tablogo').getAttribute('height')))/2 + Yoffset;  

if(NS4){
perouter.moveTo(x,yposition);
if (!imagesdone){
  perouter.visibility="show";
  }
}
if(IE4||NS6){
perouter.style.left=x+'px';
perouter.style.top=yposition+'px';

if (!imagesdone){
  perouter.style.visibility="visible";
  }
 }
}

function dispbars(){
loaded++;
cliplayer(perdone, 0, blocksize*loaded, barheight, 0);
if(loaded>=imagenames.length)setTimeout('hideperouter()', 1000);
}

function checkload(index){
(images[index].complete)? dispbars() : setTimeout('checkload('+index+')', 100);
}

function hideperouter(){

document.getElementById('completato').innerHTML="...completato.";
go();
}

function cliplayer(layer, ct, cr, cb, cl){
if(NS4){
	layer.clip.left=cl;
	layer.clip.top=ct;
	layer.clip.right=cr;
	layer.clip.bottom=cb;
	}
if(IE4||NS6)layer.style.clip='rect('+ct+' '+cr+' '+cb+' '+cl+')';
}

function go(){
 if (OK) {
   location.href=PageHTML;
 }
 else {
  OK=true;
 }
}
