var xPos1 = 300;
var yPos1 = 200; 
var xPos2 = 600;
var yPos2 = 400; 
var xPos3 = 900;
var yPos3 = 600; 
var step = 1;
var delay = 30; 
var height = 0;
var Hoffset1 = 0;
var Woffset1 = 0;
var Hoffset2 = 0;
var Woffset2 = 0;
var Hoffset3 = 0;
var Woffset3 = 0;
var yon1 = 0;
var yon2 = 0;
var yon3 = 0;
var xon1 = 0;
var xon2 = 0;
var xon3 = 0;
var pause = true;
var interval;
img1.style.top = yPos1;
img2.style.top = yPos2;
img3.style.top = yPos3;
function changePos() 
{
	width = document.body.clientWidth;
	height = document.body.clientHeight;
	Hoffset1 = img1.offsetHeight;
	Woffset1 = img1.offsetWidth;
	Hoffset2 = img2.offsetHeight;
	Woffset2 = img2.offsetWidth;
	Hoffset3 = img3.offsetHeight;
	Woffset3 = img3.offsetWidth;
	img1.style.left = xPos1 + document.body.scrollLeft;
	img1.style.top = yPos1 + document.body.scrollTop;
	img2.style.left = xPos2 + document.body.scrollLeft;
	img2.style.top = yPos2 + document.body.scrollTop;
	img3.style.left = xPos3 + document.body.scrollLeft;
	img3.style.top = yPos3 + document.body.scrollTop;
	if (yon1) 
	{
		yPos1 = yPos1 + step;
	}
	else 
	{
		yPos1 = yPos1 - step;
	}
	
	if(yon2)
	{
		yPos2 = yPos2 + step;
	}
	else
	{
		yPos2 = yPos2 - step;
	}
	
	if(yon3)
	{
		yPos3 = yPos3 + step;
	}
	else
	{
		yPos3 = yPos3 - step;
	}
	
	if (yPos1 < 0) 
		{yon1 = 1;yPos1 = 0;}
	if (yPos1 >= (height - Hoffset1)) 
		{yon1 = 0;yPos1 = (height - Hoffset1);}
	if (xon1) 
		{xPos1 = xPos1 + step;}
	else 
		{xPos1 = xPos1 - step;}
	if (xPos1 < 0) 
		{xon1 = 1;xPos1 = 0;}
	if (xPos1 >= (width - Woffset1)) 
		{xon1 = 0;xPos1 = (width - Woffset1);   }
		
	if (yPos2 < 0) 
		{yon2 = 1;yPos2 = 0;}
	if (yPos2 >= (height - Hoffset2)) 
		{yon2 = 0;yPos2 = (height - Hoffset2);}
	if (xon2) 
		{xPos2 = xPos2 + step;}
	else 
		{xPos2 = xPos2 - step;}
	if (xPos2 < 0) 
		{xon2 = 1;xPos2 = 0;}
	if (xPos2 >= (width - Woffset2)) 
		{xon2 = 0;xPos2 = (width - Woffset2);   }
		
		
	if (yPos3 < 0) 
		{yon3 = 1;yPos3 = 0;}
	if (yPos3 >= (height - Hoffset3)) 
		{yon3 = 0;yPos3 = (height - Hoffset3);}
	if (xon3) 
		{xPos3 = xPos3 + step;}
	else 
		{xPos3 = xPos3 - step;}
	if (xPos3 < 0) 
		{xon3 = 1;xPos3 = 0;}
	if (xPos3 >= (width - Woffset3)) 
		{xon3 = 0;xPos3 = (width - Woffset3);   }
}
	
function start()
 {
	img1.visibility = "visible";
	img2.visibility = "visible";
	img3.visibility = "visible";
	interval = setInterval('changePos()', delay);
}
function pause_resume() 
{
	if(pause) 
	{
		clearInterval(interval);
		pause = false;
	}
	else 
	{
		interval = setInterval('changePos()',delay);
		pause = true; 
	}
}
start();