var d=document;

if(d.images)
{
 pix=new Image(); 
 pix.src='/phpimg.php?img=blf.gif'; 
}

// Reserve space for scrollbar (CSS 3)
d.write('<style type="text/css"> html { overflow: -moz-scrollbars-vertical; } </style>');

// Protect e-mail addresses from harvester bots
function email(name,domain,subj,cls) {
 var addr=name+'@'+domain;
 var addrt=(subj)?addr+'?subject='+subj:addr;
 cls=(cls=='')?'':'class="'+cls+'" ';
 document.write('<a '+cls+'href="mailto:'+addrt+'">'+addr+'</a>');
}

// Note: The the event order is FIFO for FF and LIFO for IE
function addEvent(obj, evType, fn)
{ 
 if(obj.addEventListener)
 {
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent)
 { 
   var r=obj.attachEvent("on"+evType, fn); 
   return r; 
 } else return false;
}

// Original image fade-in thanks to http://clagnut.com/sandbox/imagefades/
d.write("<style type='text/css'>#imgl, #imgr {visibility:hidden;} </style>");

// The initImage function makes the photo completely tranpsarent by using the setOpacity function to set its opacity to zero. The photo can then be made visible and faded in using the fadeIn function. The whole effect is delayed a few ms as specified by the "delay" variable.
function initImage()
{
 var delay=800;
 var imageId='imgl';
 var image=d.getElementById(imageId);
 setOpacity(image, 0);
 image.style.visibility='visible';
 window.setTimeout("fadeIn('"+imageId+"',0)",delay);
 var delay=800;
 var imageId='imgr';
 var image=d.getElementById(imageId);
 setOpacity(image, 0);
 image.style.visibility='visible';
 window.setTimeout("fadeIn('"+imageId+"',0)",delay);
}

// The setOpacity function is passed an object and an opacity value. It then sets the opacity of the supplied object using four proprietary ways. It also prevents a flicker in Firefox caused when opacity is set to 100%, by setting the value to 99.999% instead.
function setOpacity(obj, opacity)
{
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

//The fadeIn function uses a Timeout to call itself every few ms specified byt the variable "period" with an object Id and an opacity. The opacity is specified as a percentage and increased a few % at a time as specified by the "increment" variable. The loop stops once the opacity reaches 100%:
function fadeIn(objId,opacity)
{
 var period=50;
 var increment=5;
 if(d.getElementById)
 {
  var obj=d.getElementById(objId);
  if(opacity<=100)
  {
   setOpacity(obj, opacity);
   opacity+=increment;
   window.setTimeout("fadeIn('"+objId+"',"+opacity+")", period);
  }
 }
}

addEvent(window, "load", initImage);

d.write("<style type='text/css'>#main {visibility:hidden;} </style>"); // Flash still shows through
function showmain()
{
 window.setTimeout("d.getElementById('main').style.visibility='visible'",2100);
}
addEvent(window, "load", showmain);
