SmallStars = 25; <!-- количество -->
LargeStars = 8; <!-- количество -->
SmallYpos = new Array();
SmallXpos = new Array();
LargeYpos = new Array();
LargeXpos = new Array();
Smallspeed= new Array();
Largespeed= new Array();
var ns6=document.getElementById&&!document.all?1:0;

document.write('<div class="starsmain"><div class="starsinner">');
for (i = 0; i < SmallStars; i++) { document.write('<div id="ss'+ns6*i+'" class="smallstar"></div>'); }
document.write('</div></div><div class="starsmain"><div class="starsinner">');
for (i = 0; i < LargeStars; i++) { document.write('<div id="ls'+ns6*i+'" class="bigstar"></div>'); }
document.write('</div></div>');

WinHeight = window.document.body.clientHeight/3;
WinWidth = window.document.body.clientWidth/3;

for (i = 0; i < SmallStars; i++) { Math.random() }

for (i = 0; i < SmallStars; i++) {
SmallYpos[i] = Math.round(2*Math.random()*(WinHeight) + WinHeight);
SmallXpos[i] = Math.round(Math.random() * WinWidth);
Smallspeed[i]= Math.floor(Math.random() * 5 + 1);
}
for (i = 0; i < LargeStars; i++) {
LargeYpos[i] = Math.round(2*Math.random()*(WinHeight) + WinHeight);
LargeXpos[i] = Math.round(Math.random() * WinWidth);
Largespeed[i] = Math.floor(Math.random() * 10 + 5);
}

/* begin: fly() */
function fly() {
	var WinHeight = window.document.body.clientHeight/5-20;
	var WinWidth = window.document.body.clientWidth-20;
	var hscrll = document.body.scrollTop;
	var wscrll = document.body.scrollLeft;
	for (i = 0; i < LargeStars; i++) {
		LargeXpos[i] -= Largespeed[i];
		if (LargeXpos[i] < -10) {
			LargeXpos[i] = WinWidth;
			do { LargeYpos[i] = 4*Math.floor(Math.random() * WinHeight)+WinHeight } while (LargeYpos[i] < 7)
			Largespeed[i] = (Math.random() * 10 + 5);
		}

		if (ns6) {
			var starObj = document.getElementById('ls'+i+'')
			starObj.style.left = ''+LargeXpos[i]+'px';
			starObj.style.top = ''+(LargeYpos[i] + hscrll)+'px';
		}
		else {
			ls0[i].style.pixelLeft = LargeXpos[i];
			ls0[i].style.pixelTop = LargeYpos[i] + hscrll;
		}
	}

	for (i = 0; i < SmallStars; i++) {
		SmallXpos[i] -= Smallspeed[i];
		if (SmallXpos[i] < -10) {
			SmallXpos[i] = WinWidth;
			SmallYpos[i] = 5*Math.floor(Math.random() * WinHeight)-3;
			if (SmallYpos[i] < 7) SmallXpos[i] = -1;
			Smallspeed[i] = Math.random() * 5 + 1;
		}

		if (ns6){
			var starObj = document.getElementById('ss'+i+'')
			starObj.style.left = ''+SmallXpos[i]+'px';
			starObj.style.top = ''+(SmallYpos[i] + hscrll)+'px';
		}
		else {
			ss0[i].style.pixelLeft = SmallXpos[i];
			ss0[i].style.pixelTop = SmallYpos[i]+hscrll;
		}

	}

	setTimeout('fly()', 5);
}
/* end: fly() */
