window.addEventListener ? window.addEventListener('load', so_init, false) : window.attachEvent('onload', so_init);

var d = document, v = null, e = null, vFontSize = 1, vColor = 0, vTop = 0, vLeft = 0, eColor = 0, outTime = 1;

function pageWidth() {
   return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight() {
   return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;

}

function posLeft() {
   return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function posTop() {
   return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

function posRight() {
   return posLeft() + pageWidth();
}

function posBottom() {
   return posTop() + pageHeight();
}

function so_init()
{
   if (!d.getElementById || !d.createElement)
      return;

   pWidth = pageWidth();
   pHeight = pageHeight();

   v = d.getElementById('vip');
   e = d.getElementById('ent');
   vTop = pHeight / 2;
   vLeft = pWidth / 2;
   v.style.top = vTop;
   e.style.left = (vLeft - 350) + "px";
   e.style.top = (vTop - 100) + "px";

   setTimeout(fadeIn, 2500);
}

function fadeIn()
{
   vFontSize += 5;
   v.style.fontSize = vFontSize + "px";

   v.style.visibility = 'visible';
//   v.style.display = 'block';
   vLeft -= 4;
   vTop -= 3;
   v.style.top = vTop + "px";
   v.style.left = vLeft + "px";
   vColor += 2;
   v.style.color = "rgb(" + vColor + "," + vColor + "," + vColor + ")";
   
   if (vColor >= 255)
   {
      setTimeout(fadeOut, 1);
   }
   else
   {
      setTimeout(fadeIn, .0000001);
   }
}

function fadeOut()
{
   vFontSize += 5;
   v.style.fontSize = vFontSize + "px";

   v.style.visibility = 'visible';
//   v.style.display = 'block';
   vLeft -= 4;
   vTop -= 3;
   v.style.top = vTop + "px";
   v.style.left = vLeft + "px";
   vColor -= 2;
   v.style.color = "rgb(" + vColor + "," + vColor + "," + vColor + ")";

   eColor += 4;
   e.style.visibility = 'visible';

   if (eColor < 255)
   {
      e.style.color = "rgb(" + eColor + "," + eColor + "," + eColor + ")";
   }
   else
   {
      e.style.color = "rgb(" + (512 - eColor) + "," + (512 - eColor) + "," + (512 - eColor) + ")";
   }

   if (vColor <= 0)
   {
      setTimeout(goHome, 3500);
   }
   else
   {
//      outTime += .000001;
      setTimeout(fadeOut, outTime);
   }
}

function goHome()
{
   window.location = 'aboutus.html';
}

