/*
Snow Effect Script
*/
mes = new Date().getMonth()
dia = new Date().getDate()
						 
if (((mes == 11) && (dia > 20)) || ((mes == 0) && (dia < 7))) {

  //Configure below to change URL path to the snow image
  var snowsrc="http://www.santiagocaldas.org/imagenes/navidad/snow.gif"
  // Configure below to change number of snow to render
  var no = 10;

  var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
  var ie4up = (document.all) ? 1 : 0;

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var ii, doc_width = 800, doc_height = 600;
  
  if (ns4up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  
  for (ii = 0; ii < no; ++ ii) {  
    dx[ii] = 0;                        // set coordinate variables
    xp[ii] = Math.random()*(doc_width-50);  // set position variables
    yp[ii] = Math.random()*doc_height;
    am[ii] = Math.random()*20;         // set amplitude variables
    stx[ii] = 0.02 + Math.random()/10; // set step variables
    sty[ii] = 0.7 + Math.random();     // set step variables
    if (ns4up) {                      // set layers
      if (ii == 0) {
        document.write("<layer name=\"dot"+ ii +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></a></layer>");
      } else {
        document.write("<layer name=\"dot"+ ii +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");
      }
    } else if (ie4up) {
      if (ii == 0) {
        document.write("<div id=\"dot"+ ii +"\" style=\"POSITION: absolute; Z-INDEX: "+ ii +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></a></div>");
      } else {
        document.write("<div id=\"dot"+ ii +"\" style=\"POSITION: absolute; Z-INDEX: "+ ii +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
      }
    }
  }
  
  function snowNS() {  // Netscape main animation function
    for (ii = 0; ii < no; ++ ii) {  // iterate for every dot
      yp[ii] += sty[ii];
      if (yp[ii] > doc_height-50) {
        xp[ii] = Math.random()*(doc_width-am[ii]-30);
        yp[ii] = 0;
        stx[ii] = 0.02 + Math.random()/10;
        sty[ii] = 0.7 + Math.random();
        doc_width = self.innerWidth;
        doc_height = self.innerHeight;
      }
      dx[ii] += stx[ii];
      document.layers["dot"+ii].top = yp[ii];
      document.layers["dot"+ii].left = xp[ii] + am[ii]*Math.sin(dx[ii]);
    }
    setTimeout("snowNS()", 10);
  }

  function snowIE() {  // IE main animation function
    for (ii = 0; ii < no; ++ ii) {  // iterate for every dot
      yp[ii] += sty[ii];
      if (yp[ii] > doc_height-50) {
        xp[ii] = Math.random()*(doc_width-am[ii]-30);
        yp[ii] = 0;
        stx[ii] = 0.02 + Math.random()/10;
        sty[ii] = 0.7 + Math.random();
        doc_width = document.body.clientWidth;
        doc_height = document.body.clientHeight;
      }
      dx[ii] += stx[ii];
      document.all["dot"+ii].style.pixelTop = yp[ii];
      document.all["dot"+ii].style.pixelLeft = xp[ii] + am[ii]*Math.sin(dx[ii]);
    }
    setTimeout("snowIE()", 10);
  }

  if (ns4up) {
    snowNS();
  } else if (ie4up) {
    snowIE();
  }
}