function tempo()
{
   var tempo = new Date();
   return tempo.getTime();
}
function ScriviStatistiche(t,p)
{
  if (document['images'] != null && id_statistiche!='')
  {
   var x =new Image();
   var tm=stattempo1-stattempo0;
   x.src='http://www.statistiche.cc/Open.php?file='+statnome
  +'&username='+statutente
  +'&referer='+escape(statriferimento)
  +'&Tload='+tm
  +'&Tuser='+t
  +'&ID='+id_statistiche
  +'&Browser='+escape(window.navigator.appName)
  +'&Width='+window_width
  +'&Height='+window_height
  +'&Color='+depth
  +'&Origine='+escape(document.URL)
  +'&start='+p;
  }
}
function loadfun()
{
   stattempo1 = tempo();
   ScriviStatistiche(0,'load');
}
function unloadfun()
{
   if (stattempo1 != '')
   {
      var tm = 0;
      tm = tempo() - stattempo1;
      ScriviStatistiche(tm,'unload');
   }
}
function StatLnk(w)
{
   if (StatLnk.arguments.length>1)
      file=StatLnk.arguments[1];
   else
      file=w.href;

   file=escape(file);

   var x=new Image();
   x.src='http://www.statistiche.cc/Open.php'
        +'?username='+statutente
        +'&file='+file
        +'&start=inizio'
        +'&redir='+statnome
        +'&referer='+statriferimento;
   return true;
}
function SetTmp(p_nome,p_utente,p_id)
{
   statnome=p_nome;
   statutente=p_utente;
   id_statistiche=p_id;

   stattempo0=tempo();
   stattempo1='';
   depth = 0;
   window_width=0;
   window_height=0;
   statriferimento='';
   var MemErr = window.onerror;
   window.onerror = function() { return true; };

   if (typeof top.document != 'unknown')
    statriferimento=new String(top.document.referrer);
   else
    statriferimento=new String(document.referrer);

   if (statriferimento=='')
     if (typeof opener != 'undefined')
       if (opener['location'] != null)
         {statriferimento=new String(opener['location']);}

   if (window['screen'] != null)
   {
     if (window.screen.colorDepth != null)
       {depth=window.screen.colorDepth;}
     if (depth == 0 && window.screen.pixelDepth != null)
       {depth=window.screen.pixelDepth}
     window_width=window.screen.width;
     window_height=window.screen.height;
   }

   window.onerror = MemErr;
}
function SetTempo()
{
   stattempo0=tempo();
   stattempo1='';
   depth = 0;
   window_width=0;
   window_height=0;
   statriferimento='';
   var MemErr = window.onerror;
   window.onerror = function() { return true; };

   if (typeof top.document != 'unknown')
    statriferimento=new String(top.document.referrer);
   else
    statriferimento=new String(document.referrer);

   if (statriferimento=='')
     if (typeof opener != 'undefined')
       if (opener['location'] != null)
         {statriferimento=new String(opener['location']);}

   if (window['screen'] != null)
   {
     if (window.screen.colorDepth != null)
       {depth=window.screen.colorDepth;}
     if (depth == 0 && window.screen.pixelDepth != null)
       {depth=window.screen.pixelDepth}
     window_width=window.screen.width;
     window_height=window.screen.height;
   }

   window.onerror = MemErr;
}
