var isIE4up = navigator.userAgent.indexOf("MSIE") >= 0 && document.all;
if (isIE4up)
{
  var imageSnow = "images/snowflake.gif";
  var numFlakes = 6;
  var delay = 10;
  var dX = new Array();
  var posX = new Array();
  var posY = new Array();
  var amplitude = new Array();
  var stepX = new Array();
  var stepY = new Array();
  var index;
  var documentWidth;
  var documentHeight;

  function GetDocSize()
  {
    documentWidth = document.body.scrollWidth < document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth;
    documentHeight = document.body.scrollHeight < document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight;
  }

  GetDocSize();
  document.write("<style type=\"text/css\">.flake {position:absolute;top:-200;}</style>");
  for (index = 0; index < numFlakes; index++)
  {  
    dX[index] = 0;
    posX[index] = Math.random()*(documentWidth-30)+10;
    posY[index] = Math.random()*documentHeight;
    amplitude[index] = Math.random()*20;
    stepX[index] = 0.02 + Math.random()/10;
    stepY[index] = 0.7 + Math.random();
    document.write("<div id=\"dot"+ index +"\" class=\"flake\"><img src=\"");
    document.write(imageSnow + "\" border=\"0\"></div>");
  }

  function MoveSnow(id, left, top)
  {
    var object;
    object = document.all[id].style;
    if (object)
    {
      object.left=left;
      object.top=top;
    }
  }

  function LetItSnow()
  {
    GetDocSize();
    documentScroll = (window.pageYOffset != null) ? window.pageYOffset : document.body.scrollTop;
    for (index = 0; index < numFlakes; ++index)
    {
      posY[index] += stepY[index];
      if (posY[index] > documentHeight+documentScroll-50)
      {
        posX[index] = Math.random()*(documentWidth-amplitude[index]-30);
        posY[index] = documentScroll;
        stepX[index] = 0.02 + Math.random()/10;
        stepY[index] = 0.7 + Math.random();
      }
      dX[index] += stepX[index];
      MoveSnow("dot"+index, posX[index]+amplitude[index]*Math.sin(dX[index]), posY[index]);
    }
    setTimeout("LetItSnow()", delay);
  }

window.onload=LetItSnow;
}
