var pic="/images/fly.gif";
var alt="fuyuanbinguan";
var speed=120;
var light=0;
 
var stop=0;
var num=0;
 
var brok=false;
var mie=false;
var aver=parseint(navigator.appversion.substring(0,1));
var aname=navigator.appname;
 
var vmin=2;
var vmax=5;
var vr=2;
var timer1;
 
var allyes;
 
var ns = (document.layers) ? 1 : 0;
var ie = (document.all) ? 1 : 0;
var bfade=false;
 
function checkbrok(){
 if(aname.indexof("internet explorer")!=-1){
  if(aver>=4) brok=navigator.javaenabled();
  mie=true;
 }
 if(aname.indexof("netscape")!=-1){
  if(aver>=4) brok=navigator.javaenabled();
 }
}

function chip(chipname,width,height){
 this.named=chipname;
 this.vx=vmin+vmax*math.random();
 this.vy=vmin+vmax*math.random();
 this.w=width;
 this.h=height;
 this.xx=10;
 this.yy=10;
 this.timer1=null;
}
 
function movechip(chipname){
if (stop!=1){
if(brok){
 eval("chip="+chipname);
 if(!mie){
  pagex=window.pagexoffset;
  pagew=window.innerwidth;
  pagey=window.pageyoffset;
  pageh=window.innerheight;
 }
 else{
  pagex=window.document.body.scrollleft;
  pagew=window.document.body.offsetwidth;
  pagey=window.document.body.scrolltop;
  pageh=window.document.body.offsetheight;
 } 
 chip.xx=chip.xx+chip.vx;
 chip.yy=chip.yy+chip.vy;
 chip.vx+=vr*(math.random()-0.5);
 chip.vy+=vr*(math.random()-0.5);
 if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;
 if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
 if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;
 if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;
 if(chip.xx<=pagex){
  chip.xx=pagex;
  chip.vx=vmin+vmax*math.random();
 }
 if(chip.xx>=pagex+pagew-chip.w){
  chip.xx=pagex+pagew-chip.w;
  chip.vx=-vmin-vmax*math.random();
 }
 if(chip.yy<=pagey){
  chip.yy=pagey;
  chip.vy=vmin+vmax*math.random();
 }
 if(chip.yy>=pagey+pageh-chip.h){
  chip.yy=pagey+pageh-chip.h;
  chip.vy=-vmin-vmax*math.random();
 }
 if(!mie){
  eval("document."+chip.named+".top ="+chip.yy);
  eval("document."+chip.named+".left="+chip.xx);
 } 
 else{
  eval("document.all."+chip.named+".style.pixelleft="+chip.xx);
  eval("document.all."+chip.named+".style.pixeltop ="+chip.yy); 
 }
 chip.timer1=settimeout("movechip('"+chip.named+"')",speed);
}
}
else {chip.timer1=settimeout("movechip('"+chip.named+"')",speed);}
if (ie){
 if (light==1){
  var nopacity=oimg.filters.alpha.opacity;
  if (nopacity>=100) bfade=true;
  if (nopacity<=0) bfade=false;
  if (bfade) oimg.filters.alpha.opacity--;
  if (!bfade) oimg.filters.alpha.opacity++;
 }
}
 
}
 
function stopme(chipname){
 if(brok){
  eval("chip="+chipname);
  if(chip.timer1!=null){
   cleartimeout(chip.timer1)
  }
 }
}
 
function allyes1(){
if (num==0){
 checkbrok(); 
 allyes=new chip("allyes",100,80);
 if(brok) {
  movechip("allyes");
 }
}
 num++;
}
 
if (ie){
document.write("<div id='allyes' style='position:absolute;left: 10px; top: 10px;'>");
document.write("<a href='http://www.tafybg.com' target='blank'>");
if (light==1){
document.write("<dd><img src='" + pic + "' onload='allyes1()' id='oimg' border='0' alt='" + alt + "' style='position:absolute;left:200px;top:200px;filter:alpha(opacity=50);' onmouseover='stop=1;' onmouseout='stop=0;'></a></dd>");
}
else if (light==0){
document.write("<dd><img src='" + pic + "' onload='allyes1()' border='0' alt='" + alt + "' onmouseover='stop=1;' onmouseout='stop=0;'></a></dd>");
}
document.write("</div>");
}
else if (ns){
document.write("<layer name='allyes' visibility=\"show\" onmouseover='stop=1;' onmouseout='stop=0;'  onload='allyes1()' >");
document.write("<a href='http://www.tafybg.com' target='blank'>");
document.write("<dd><img src='" + pic + "' border='0' alt='" + alt + "'></a></dd>");
document.write("</layer>");
}





