var starblink=50;            // LENGTH OF TIME STARS TWINKLE ON IN MILLISECONDS
var stardelay=2;               // DELAY BETWEEN TWINKLES IN SECONDS

var starcolors=new Array( '#ffffff' , '#ffffff' , '#ffffff' , '#ffffff' );

var expDays = 360; var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); 

var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;

var windowW, windowH,star;

function getwindowdims(){
windowW=(ie4||ie5)? document.body.clientWidth: window.innerWidth;
windowH=(ie4||ie5)? document.body.clientHeight :window.innerHeight;
}

function twinkle(phs,c){
var x,y;
if(phs==2){
x=Math.floor(Math.random()*windowW-50);
y=Math.floor(Math.random()*windowH-50);
if(ns4){
star.visibility="hide"
star.moveTo(x,y);
star.bgColor=starcolors[c];
}else{
star.style.visibility="visible";
star.style.left=x+'px';
star.style.top=y+'px';
star.style.backgroundColor=starcolors[c];
}
setTimeout('twinkle(1,'+(Math.floor(Math.random()*starcolors.length))+')', stardelay);
}else{
(ns4)?star.visibility="show" : star.style.visibility="visible";
setTimeout('twinkle(2,'+c+')',starblink);
}}

document.write( (ns4)? '<layer name="star" left="0" top="0" width="2" height="2" bgcolor="white" visibility="hide"></layer>' : '<div id="star" style="position:absolute; width:10px; height:10px; top:0px; left:0px; font-size:5px; background-color:white; visibility:hidden"></div>');

function SetCookie (name, value) {  var argv = SetCookie.arguments;  var argc = SetCookie.arguments.length;  var expires = (argc > 2) ? argv[2] : null;  var path = "/";  var domain = ".topvoted.net";  var secure = (argc > 5) ? argv[5] : false;  document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) +  ((domain == null) ? "" : ("; domain=" + domain)) +    ((secure == true) ? "; secure" : "");}

function topvoted(){
star=(ns4)?document.layers['star']:(ie4)? document.all['star']:document.getElementById('star');
getwindowdims();
window.onresize=getwindowdims;
twinkle(2,0);
}
