/* Script from http://rainbow.arch.scriptmania.com
   Modifie pour ne pas avoir les changements de couleur des etoiles
*/
// Star Dust - Background with twinkle stars
// This script and many more from :
// http://rainbow.arch.scriptmania.com

//----   Choice of variables   ----\\
var widt=0;
    if (document.documentElement){
        widt = (document.documentElement.clientWidth);
    }
    else {
        widt = (window.innerWidth);
    }
widt-=25;
var heig=700;
var numb=70;
//---------The description---------\\
/*
widt - the variable indicates the width of your page (you can change it as you like).
heig - you can choose a height, e.g. 1000 px., whatever you like.
numb - stars number (we have 200).
*/
//-----------  DO  NOT  Change  Below  this line -----------\\

//
//The script works both with Internet Explorer (4-6) and with Netscape (4,6).

var ns=document.layers?1:0;
var ie4=document.all?1:0;
var ns6=document.getElementById&&!document.all?1:0;

var NN=(document.layers ? true:false);
var colo=new Array(numb);
var  j=0;
var tx="";

var cols=new Array("#ffee99","#eedd88","#ffffff","#ddcc77","#ccbb66","#eeeeff","#ddddee","#ccccdd","#bbbbcc","#ffffff","#ffaa88","#ee9977","#dd8866","#cc7755","#000000");


var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
var x=0;
var y=0;
var wi=0;
var he=0;
var nam="";

if( h >= BEG_NIGHT || h < END_NIGHT ){
    if(ns){
        tx=tx+"<layer  left="+(widt-35)+" top="+(heig-35)+" ></layer>";
    }
    else{
        document.write(".");
    }
    for (i=0; i <numb ; i++){
        x=Math.floor(Math.random()*widt);
        y=Math.floor(Math.random()*heig)
        wi=Math.random()*1.8+1;
        var col="#ffee99";
        var n=0;
        if (wi<1.2){col="#eeeeff";n=4;}
        if (wi>2.6){col="#ffaa88";n=8;}
        if (Math.random()>0.7){nam="r"+j; colo[j]=n;j=j+1;}
        else{nam="";}
        wi=Math.floor(wi);
        he=wi;
        if (ns){
            tx=tx+"<layer z-Index=0 "+((nam)?"name="+nam:"")+" left="+x+" top="+y+" width="+wi+" height="+he+" bgColor="+col+"></layer>";
        }
        else{
            document.write("<div "+((nam)?"id="+nam:"")+"  style='z-index:0; position:absolute; left:"+x+"px;top:"+y+"px;width:"+wi+"px;height:"+he+"px;background:"+col+"'><img  width='1' height='1' /></div>");
        }
        if(ns){document.write (tx);tx="";}
    }
}


function recolor(){
    for (i=0; i<j; i++){
            if (colo[i]==0){co=cols[Math.floor(Math.random()*4)];}
            if (colo[i]==4){co=cols[4+Math.floor(Math.random()*4)];}
            if (colo[i]==8){co=cols[8+Math.floor(Math.random()*4)];}

            if (ns) {document.layers["r"+i].bgColor=co;}
            if (ie4){document.all["r"+i].style.background=co;}
            if (ns6){document.getElementById("r"+i).style.background=co;}
    }
}





