var no = 5; // snow number
var speed = 80; // smaller number moves the snow faster
var snowflake = "img/vlocka.gif";

var test=666
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp;    // coordinate and position variables
var am, stx, sty;  // amplitude and step variables
var i, doc_width = 774, doc_height = 500;

var stop=0;

  //doc_width = 500;
  //doc_height = 500;

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;                        // set coordinate variables
  xp[i] = Math.random()*(doc_width-2);  // set position variables
  yp[i] = Math.random()*doc_height;
  am[i] = Math.random()*30;         // set amplitude variables
  stx[i] = 0.02 + Math.random()/50; // set step variables
  sty[i] = 0.7 + Math.random();     // set step variables
  
    if (i ==100) {
      document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
      document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
      document.write("visible; TOP: 15px; LEFT: 15px;\">");
      document.write("<img src=\""+snowflake + "\" border=\"0\"></div>");
    } else {
      document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
      document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
      document.write("visible; TOP: 15px; LEFT: 15px;\">");
      document.write("<img name='vlockaImg' src='"+snowflake+"' border=\"0\" onClick='snihControl();' onmouseover='submenuZmena(SUBvlocka);' onmouseout='submenuZmena(\"\");' style='CURSOR:hand;'/>");
	  document.write("<span id='vlockaText' onClick='snihControl();' style='CURSOR:hand;COLOR:white;FONT-SIZE:20pt;FONT-FAMILY:Times;'></span></div>");
	  //document.write("<font color=white size=5 onClick=snihControl() style='CURSOR:hand;'>"+"*"+"</font></div>");

    }
  }


function snowIE() {  // IE main animation function


  for (i = 0; i < no; ++ i) {  // iterate for every dot
    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();
      
      doc_width = document.body.clientWidth;
      doc_height = document.body.clientHeight;
    }
    dx[i] += stx[i];
    document.getElementById("dot"+i).style.pixelTop = yp[i];
    document.getElementById("dot"+i).style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
  }
  
  if(stop!=1){setTimeout("snowIE()", speed);}



}

function snihControl(){
	if(stop!=1){stop=1;}
	else{stop=0;snowIE();}
}
  snowIE();
