document.writeln(''); 
var iR='controls/ac/Para_right.gif'; 
var iL='controls/ac/Para_left.gif'; 
var iRLoop='controls/ac/Para_right_loop2.gif'; 
var ParaLurl=iL; 
var ParaRurl=iR; 
document.write('');

var speed=50;
var change=5000;
var xmax=4;
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, runpara,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=ParaLurl;
var t=(ns4)? '<layer name="runpara" top="-100" left="0">' : '<div id="runpara" style="position:absolute; top:0px; left;0px; width:1px; height:1px">'; 
t+='<img src="'+ParaRurl+'" border="0" name="Parapic">';
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;
	}
	//if(x>0){
	//	if(Math.floor(Math.random()*50)>48) ParaRurl=iRLoop
	//}
}

function getwindowsize(){
	if((ie4||ie5)&&!window.opera){
	w_x=document.body.clientWidth;
	w_y=150;
	//w_y=document.body.clientHeight;
	}else{
	w_x=window.innerWidth-15;
	//w_y=window.innerHeight-15;
	w_y=100;
	}
}

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)+1;
	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)? runpara.document.images["Parapic"].src=ParaRurl: document.images["Parapic"].src=ParaRurl;
	else (ns4)? runpara.document.images["Parapic"].src=ParaLurl:     document.images["Parapic"].src=ParaLurl;
}

function animate(){
	tx=(ns4)?runpara.left:parseInt(runpara.style.left);
	ty=(ns4)?runpara.top:parseInt(runpara.style.top);

	if((ie4||ie5)&&!window.opera){
		xo=document.body.scrollLeft;
		yo=document.body.scrollTop;
	}else{
		xo=window.pageXOffset;
		yo=window.pageYOffset;
	}
	if(xo<130){xo=130}

	if(ydir) if((ty+incry+pich)>(w_y+yo)){ydir=false; checkdirs(); moveidby(runpara,0,-incry);}else{ moveidby(runpara,0,incry); }
	else if((ty-incry)<yo){ ydir=true; checkdirs(); moveidby(runpara,0,incry); }else{ moveidby(runpara,0,-incry); }
	if(xdir) if((tx+incrx+picw)>(w_x+xo)){ xdir=false; checkdirs(); moveidby(runpara,-incrx,0); }else{ moveidby(runpara,incrx,0); }
	else if((tx-incrx)<xo){ xdir=true; checkdirs(); moveidby(runpara,incrx,0); }else{ moveidby(runpara,-incrx,0); }
}

window.onresize=function(){
	if(ns4)setTimeout('history.go(0)',400);
	else getwindowsize();
}

window.onload=function(){
	runpara=getid('runpara');
	if(ns4){
	picw=runpara.document.images['Parapic'].width;
	pich=runpara.document.images['Parapic'].height;
	}else{
	picw=document.images['Parapic'].width;
	pich=document.images['Parapic'].height;
	}
	getwindowsize();
	//moveidto(runpara,(w_x-picw)/2,(w_y-pich)/2);
	moveidto(runpara,150,0);
	setInterval('animate()',speed);
	changedirs();
}
