document.writeln(''); var fishRurl='fish_right.gif'; var fishLurl='fish_left.gif'; document.write('');



var speed=50;
var change=5000;
var xmax=5;
var ymax=3;

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 px = (window.opera)?'':'px';
var w_x, w_y, bothfish,pich,picw;
var incrx=Math.floor(Math.random()*xmax);
var incry=Math.floor(Math.random()*ymax);
var xdir=true;
var ydir=true;
var imagex=new Image(); imagex.src=fishLurl;
var t=(ns4)? '<layer name="bothfish" top="-100" left="0">' : '<div id="bothfish" style="position:absolute; top:0px; left;0px; width:1px; height:1px">'; 
t+='<img src="'+fishRurl+'" border="0" name="fishpic">';
t+=(ns4)?'</layer>':'</div>';
document.write(t);

function getid(id){
if(ns4) return document.layers[id];
else if(ie4)return document.all[id];
else return document.getElementById(id);
}

function moveidto(id,x,y){
if(ns4)id.moveTo(x,y);
else{
id.style.left=x+px;
id.style.top=y+px;
}}

function moveidby(id,x,y){
if(ns4)id.moveBy(x,y);
else{
id.style.left=parseInt(id.style.left)+x+px;
id.style.top=parseInt(id.style.top)+y+px;
}}

function getwindowsize(){
if((ie4||ie5)&&!window.opera){
w_x=document.body.clientWidth;
w_y=document.body.clientHeight;
}else{
w_x=window.innerWidth-15;
w_y=window.innerHeight-15;
}}

function changedirs(){
if(Math.floor(Math.random()*5)>2)xdir=(Math.floor(Math.random()*2)==0);
if(Math.floor(Math.random()*5)>2)ydir=(Math.floor(Math.random()*2)==0);
if(Math.floor(Math.random()*5)>2)incrx=Math.floor(Math.random()*xmax);
if(Math.floor(Math.random()*5)>2)incry=Math.floor(Math.random()*ymax);
checkdirs();
setTimeout('changedirs()',Math.ceil(Math.random()*change));
}

function checkdirs(){
if(xdir) (ns4)? bothfish.document.images["fishpic"].src=fishRurl:document.images["fishpic"].src=fishRurl;
else (ns4)? bothfish.document.images["fishpic"].src=fishLurl:document.images["fishpic"].src=fishLurl;
}

function animate(){
tx=(ns4)?bothfish.left:parseInt(bothfish.style.left);
ty=(ns4)?bothfish.top:parseInt(bothfish.style.top);
if((ie4||ie5)&&!window.opera){
xo=document.body.scrollLeft;
yo=document.body.scrollTop;
}else{
xo=window.pageXOffset;
yo=window.pageYOffset;
}
if(ydir) if((ty+incry+pich)>(w_y+yo)){ydir=false; checkdirs(); moveidby(bothfish,0,-incry);}else{ moveidby(bothfish,0,incry); }
else if((ty-incry)<yo){ ydir=true; checkdirs(); moveidby(bothfish,0,incry); }else{ moveidby(bothfish,0,-incry); }
if(xdir) if((tx+incrx+picw)>(w_x+xo)){ xdir=false; checkdirs(); moveidby(bothfish,-incrx,0); }else{ moveidby(bothfish,incrx,0); }
else if((tx-incrx)<xo){ xdir=true; checkdirs(); moveidby(bothfish,incrx,0); }else{ moveidby(bothfish,-incrx,0); }
}

window.onresize=function(){
if(ns4)setTimeout('history.go(0)',400);
else getwindowsize();
}

window.onload=function(){
bothfish=getid('bothfish');
if(ns4){
picw=bothfish.document.images['fishpic'].width;
pich=bothfish.document.images['fishpic'].height;
}else{
picw=document.images['fishpic'].width;
pich=document.images['fishpic'].height;
}
getwindowsize();
moveidto(bothfish,(w_x-picw)/2,(w_y-pich)/2);
setInterval('animate()',speed);
changedirs();
}



//DO NOT MODIFY
/*
<APPLETINFO>
appletname=jsfishimage
applettype=JAVASCRIPT
created=1051539263420
appletfilename=jsfishimage1.js
</APPLETINFO>
<JAVASCRIPT>
speed=50
change=5000
xmax=5
ymax=3
</JAVASCRIPT>
<HTMLGENERATOR>
mystarttag=-
mystarttag_GS=1;rim;lim
rim=fish_right.gif
rim_GS=4;
lim=fish_left.gif
lim_GS=4;
</HTMLGENERATOR>
*/