﻿var sparkles=40,x=ox=400,y=oy=300,swide=800,shigh=600,sleft=sdown=0,tiny=[],star=[],starv=[],starx=[],stary=[],tinyx=[],tinyy=[],tinyv=[];window.onload=function(){if(document.getElementById){var b,a,d,c;for(var b=0;b<sparkles;b++){var a=createDiv(3,3);a.style.visibility="hidden";document.body.appendChild(tiny[b]=a);starv[b]=0;tinyv[b]=0;var a=createDiv(5,5);a.style.backgroundColor="transparent";a.style.visibility="hidden";var d=createDiv(1,5),c=createDiv(5,1);a.appendChild(d);a.appendChild(c);d.style.top="2px";d.style.left="0px";c.style.top="0px";c.style.left="2px";document.body.appendChild(star[b]=a)}set_width();sparkle()}};function sparkle(){var a;if(x!=ox||y!=oy){ox=x;oy=y;for(a=0;a<sparkles;a++)if(!starv[a]){star[a].style.left=(starx[a]=x)+"px";star[a].style.top=(stary[a]=y)+"px";star[a].style.clip="rect(0px, 5px, 5px, 0px)";star[a].style.visibility="visible";starv[a]=50;break}}for(a=0;a<sparkles;a++){if(starv[a])update_star(a);if(tinyv[a])update_tiny(a)}setTimeout("sparkle()",40)}function update_star(a){if(--starv[a]==25)star[a].style.clip="rect(1px, 4px, 4px, 1px)";if(starv[a]){stary[a]+=1+Math.random()*3;if(stary[a]<shigh+sdown){star[a].style.top=stary[a]+"px";starx[a]+=(a%5-2)/5;star[a].style.left=starx[a]+"px"}else{star[a].style.visibility="hidden";starv[a]=0;return}}else{tinyv[a]=50;tiny[a].style.top=(tinyy[a]=stary[a])+"px";tiny[a].style.left=(tinyx[a]=starx[a])+"px";tiny[a].style.width="2px";tiny[a].style.height="2px";star[a].style.visibility="hidden";tiny[a].style.visibility="visible"}}function update_tiny(a){if(--tinyv[a]==25){tiny[a].style.width="1px";tiny[a].style.height="1px"}if(tinyv[a]){tinyy[a]+=1+Math.random()*3;if(tinyy[a]<shigh+sdown){tiny[a].style.top=tinyy[a]+"px";tinyx[a]+=(a%5-2)/5;tiny[a].style.left=tinyx[a]+"px"}else{tiny[a].style.visibility="hidden";tinyv[a]=0;return}}else tiny[a].style.visibility="hidden"}document.onmousemove=mouse;function mouse(a){set_scroll();y=a?a.pageY:event.y+sdown;x=a?a.pageX:event.x+sleft}function set_scroll(){if(typeof self.pageYOffset=="number"){sdown=self.pageYOffset;sleft=self.pageXOffset}else if(document.body.scrollTop||document.body.scrollLeft){sdown=document.body.scrollTop;sleft=document.body.scrollLeft}else if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft)){sleft=document.documentElement.scrollLeft;sdown=document.documentElement.scrollTop}else{sdown=0;sleft=0}}window.onresize=set_width;function set_width(){if(typeof self.innerWidth=="number"){swide=self.innerWidth;shigh=self.innerHeight}else if(document.documentElement&&document.documentElement.clientWidth){swide=document.documentElement.clientWidth;shigh=document.documentElement.clientHeight}else if(document.body.clientWidth){swide=document.body.clientWidth;shigh=document.body.clientHeight}}function createDiv(b,c){var a=document.createElement("div");a.style.position="absolute";a.style.height=b+"px";a.style.width=c+"px";a.style.overflow="hidden";couleur="multicolore";if(couleur=="multicolore"){Rouge=Math.floor(Math.random()*256);Vert=Math.floor(Math.random()*256);Bleu=Math.floor(Math.random()*256);a.style.backgroundColor="rgb("+Rouge+","+Vert+","+Bleu+")"}else a.style.backgroundColor=couleur;return a}
