var no = 1;
var dx, xp, yp;
var am, stx, sty;
var i, doc_width = 800, doc_height = 600;
if (self.innerWidth) {
  doc_width = self.innerWidth;
  doc_height = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
  doc_width = document.documentElement.clientWidth;
  doc_height = document.documentElement.clientHeight;
} else if (document.body) {
  doc_width = document.body.clientWidth;
  doc_height = document.body.clientHeight;
}
doc_width -= 132;	// width of image x2

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < no; ++i) {  
  dx[i] = 0;
  xp[i] = Math.random()*doc_width;
  yp[i] = Math.random()*doc_height;
  am[i] = Math.random()*20;
  stx[i] = 0.02 + Math.random()/10;
  sty[i] = 0.7 + Math.random();
  if (document.layers) {
    document.write('<layer name="dot'+ i +'" left="15" top="15" visibility="show"><img src="/media/dot.gif" border="0" /></layer>');
  } else if (document.all || document.getElementById) {
    document.write('<div id="dot'+ i +'" style="position: absolute; z-index: '+ i +'; visibility: visible; top: 15px; left: 15px;"><img src="/media/dot.gif" border="0" /></div>');
  } else {
    break;
  }
}

snow();

function snow() {  // main animation function
  for (i = 0; i < no; i++) {  // iterate for every dot
    if (self.innerWidth) {
      doc_width = self.innerWidth;
      doc_height = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientWidth) {
      doc_width = document.documentElement.clientWidth;
      doc_height = document.documentElement.clientHeight;
    } else if (document.body) {
      doc_width = document.body.clientWidth;
      doc_height = document.body.clientHeight;
    }

    yp[i] += sty[i];
    if (yp[i] > doc_height-50) {
      xp[i] = Math.random()*(doc_width-am[i]-30);
      yp[i] = 0;
      stx[i] = 0.02 + Math.random()/10;
      sty[i] = 0.7 + Math.random();
    }
    dx[i] += stx[i];
    if (document.layers) {
      document.layers["dot" + i].top = yp[i];
      document.layers["dot" + i].left = xp[i] + am[i]*Math.sin(dx[i]);
    } else if (document.all) {
      document.all["dot" + i].style.pixelTop = yp[i];
      document.all["dot" + i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
    } else if (document.getElementById) {
      document.getElementById("dot"+i).style.top = yp[i] + "px";
      document.getElementById("dot"+i).style.left = xp[i] + am[i]*Math.sin(dx[i])+"px";
    }
  }
  setTimeout("snow()", 20);
}

