/* Essex Ents website version 3.0 */
  //code for running randon twinkling of stars & shooting star
 
starTwinkle1= new Array("stars/starA_1.jpg","stars/starA_0.gif"); 
starTwinkle2= new Array("stars/starB_1.jpg","stars/starB_0.gif");

twinky2=0;
thisStar2=0;
imgCt2=starTwinkle2.length;
imgCt1=starTwinkle1.length;
thisStar1=0;
twinky1=0
function twinkle(){

if(document.images){
animateStar1();
animateStar2();
}
}

function animateStar1(){
document.star1.src=starTwinkle1[thisStar1];
thisStar1++; twinky1++;
if (thisStar1==imgCt1){ thisStar1=0;}
if(twinky1<4){setTimeout("animateStar1()",350);}
else { x=Math.floor((Math.random()*10));
setTimeout("animateStar1()", x*1000); twinky1=0;}
}



function animateStar2(){
document.star2.src=starTwinkle2[thisStar2];
thisStar2++; twinky2++;
if (thisStar2==imgCt2){ thisStar2=0;}
if(twinky2<4){setTimeout("animateStar2()",350);}
else { x=Math.floor((Math.random()*10));
setTimeout("animateStar2()", x*1000); twinky2=0;}
}

function shooting(){
var y=Math.floor((Math.random()*20));
 setTimeout("shoot()",y*100);
}
function shoot(){
if(document.images){ 
document.startrail.src="stars/shootStar5.gif";

}
}


