//Insert these lines at once after tag <body> (not in the other place).
//----   Choice of variables   ----\\

numb_s=16 		// - stars number (we have 20 ones).
speed_s=3 		// - speed of movement of stars

keepRunning = 1

//This and others free scripts you can find on a site:  artdhtml.com
//The script works both with Internet Explorer (4-6) and with Netscape (4,6).

ns=document.layers?1:0
ie=document.all?1:0
ns6=document.getElementById&&!document.all?1:0
function moveSlide(name,sLeft, sTop) {
 if (ns) {document.layers[name].top=sTop;document.layers[name].left=sLeft}
 if (ie) {document.all[name].style.top=sTop;document.all[name].style.left=sLeft}
 if (ns6) {document.getElementById(name).style.top=sTop;document.getElementById(name).style.left=sLeft}
}
function sizeSlide(name,sWdh, sHgt) {
 if (ns){document.layers[name].clip.width=sWdh; document.layers[name].clip.height=sHgt}
 if (ie){document.all[name].style.width=sWdh; document.all[name].style.height=sHgt}
 if (ns6){document.getElementById(name).style.width=sWdh; document.getElementById(name).style.height=sHgt}
}
function positions(){
 hei_scr=(ie)?window.document.body.clientHeight:window.innerHeight
 wid_scr=(ie)?window.document.body.clientWidth:window.innerWidth
 y_scrl=(ie)?document.body.scrollTop:window.pageYOffset
 x_scrl=(ie)?document.body.scrollLeft:window.pageXOffset
}
posX=new Array()
posY=new Array()
posR=new Array()
radi=new Array()
tx=""
positions()
if (ns)
{
	//tx=tx+"<layer z-Index=100 left="+(wid_scr-35)+" top="+(hei_scr-35)+" ><a href='http://www.artdhtml.com'><img border=0 width=30 height=30 src='http://www.artdhtml.com/log.gif' alt='Art dhtml - scripts,designing.'></a></layer>"
}
else
{
	//document.write("<div><a href='http://www.artdhtml.com'><img border=0 width=30 height=30 src='http://www.artdhtml.com/log.gif' style='position:absolute; left:"+(wid_scr-35)+";top:0;z-Index:100' alt='Art dhtml - scripts,designing.'></a></div>")
}
for (i=0; i<numb_s;i++) 
 {                                                                
 posY[i]=hei_scr/2
 posX[i]=wid_scr/2
 posR[i]=Math.random()*6.283
 radi[i]=0
 if (ns)
  {
  tx+="<layer z-Index=-100 name=star_"+i+" left=0 top=0 width=1 height=1 bgColor=#ffffff></layer>"
  }
  else
  {
  document.write("<div id=star_"+i+"  style='z-index:-100; position:absolute; left:0;top:0;width:1;height:1;background:#ffffff'><img  width=1 height=1></div>")
  }
 if(ns){document.write (tx);tx=""}
}
function restartStarfield(){
keepRunning = 1;
}
function pauseStarfield(){
keepRunning = 0;
}
function go_stars(){
	if (keepRunning == 1) {
		positions()
		rad_max=Math.sqrt(wid_scr*wid_scr+hei_scr*hei_scr)/2
		for (i=0; i < numb_s;i++){
			rad=Math.sqrt(Math.pow((posY[i]-hei_scr/2),2)+Math.pow((posX[i]-wid_scr/2),2))/rad_max*4+1
		 	posY[i]+=Math.round(Math.sin(posR[i])*rad*speed_s);
		 	posX[i]+=Math.round(Math.cos(posR[i])*rad*speed_s);
		 	if ((posX[i] > wid_scr-rad*2) || (posY[i] < 0 ) || (posY[i] > hei_scr-rad*2) || (posX[i] < 0)){
	  			posY[i]=hei_scr/2
  				posX[i]=wid_scr/2
  				posR[i]=Math.random()*6.283
  				sizeSlide("star_"+i,1,1)
  				moveSlide("star_"+i,posX[i]+x_scrl,posY[i]+y_scrl)
  			}
 			else{
  				if(Math.floor(rad)!=radi[i]){
					sizeSlide("star_"+i,rad,rad);radi[i]=rad
				}
  				moveSlide("star_"+i,posX[i]+x_scrl,posY[i]+y_scrl)
			}
  		} 
 	}
}
starSpeed=setInterval('go_stars()',80);

