/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//   Idea, Art & other:            eggnot [eggnot@mail.ru]                 //
//                                                                         //
//                                                /2003y/                  //
/////////////////////////////////////////////////////////////////////////////

var no = 6;
var speed = 30;

var x,y;

var ydelta = 3;
var dy = ydelta;

var i,sn;

var ifcos = false;
var count = 0;

var doc_width = 800, doc_height = 600;

var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;

for (sn = 1; sn <= 3; ++ sn) { 
   for (i = 0; i < no * sn; ++ i) {  
     x =  10 + Math.random()* (doc_width - 50);
     y =  10 + Math.random()* (doc_height - 50); 
        if (ns4up) {                  
           document.write("<layer name='sn"+ sn + "i"+ i +" left='"+ x + "'");
           document.write("top='" + y +"' visibility='show'><img src='snow");
           document.write(sn + ".gif' border='0'></layer>");
        } else if (ie4up) {
           document.write("<div id='sn"+ sn + "i"+ i +"' style='POSITION: ");
           document.write("absolute; Z-INDEX: "+ sn +"; VISIBILITY: ");
           document.write("visible; TOP: "+ y +"px; LEFT: "+ x +"px;'>");
           document.write("<img src='snow" + sn + ".gif' border='0'></div>");
        }
   }


}

function angelsnow() { 

if (ie4up) {
     doc_width = document.body.clientWidth;
     doc_height = document.body.clientHeight;
} else {
     doc_width = document.body.clientWidth;
     doc_height = document.body.clientHeight;
}

for (sn = 1; sn <= 3; ++ sn) { 
   for (i = 0; i < no * sn; ++ i) {  
// для нетскейпа и експлорера
if (ie4up) {
    y = document.all["sn"+ sn + "i" + i].style.pixelTop;
    x = document.all["sn"+ sn + "i" + i].style.pixelLeft;
} else {
    y = document.all["sn"+ sn + "i" + i].top;
    x = document.all["sn"+ sn + "i" + i].left;
}
      // Демоническое
      if (ifcos) {
        count += 0.2;
        x += Math.sin(count) * 5 / sn;
        y += Math.cos(count) * 5 / sn;
      } else {
        y += dy / sn;
      }

   // check for y
     if ( y > (doc_height - 20 )  || y < 10 ) {
      x =  10 + Math.random()* (doc_width - 20);
       if (y > doc_height - 20){
        y = 10 + Math.random() * 50;
       } else if (y < 10) {
        y = doc_height - 20 - Math.random() * 50;
       }
     }

   // check for x
     if ( x > (doc_width - 20 )  || x < 10 ) {
      x =  10 + Math.random()* (doc_width - 20);
       if (x > doc_width - 20){
        x = 10;
       } else if (x < 10) {
        x = doc_width - 20;
       }
     }
// для нетскейпа и експлорера
if (ie4up) {
    document.all["sn"+ sn + "i" + i].style.pixelTop = y;
    document.all["sn"+ sn + "i" + i].style.pixelLeft = x;
} else {
    document.all["sn"+ sn + "i" + i].top = y;
    document.all["sn"+ sn + "i" + i].left = x;
}

   }
}
setTimeout("angelsnow()", speed);
}

angelsnow();