<script language="
javascript">
var xpos = 20;
var ypos = 10;
img.style.left= xpos;
img.style.top = ypos;
var step = 1;
var delay = 30;
var width,height,hoffset,woffset;
var y = 1;
var x = 1;
var interval;
img.visibility = "visible";
function changepos()
{
width = document.body.clientwidth;
height = document.body.clientheight;
hoffset = img.offsetheight;
woffset = img.offsetwidth;
if (y)
{
ypos = ypos + step;
}
else
{
ypos = ypos - step;
}
if (ypos < 0)
{
y = 1;
ypos = 0;
}
if (ypos >= (height - hoffset))
{
y = 0;
ypos = (height - hoffset);
}
if (x)
{
xpos = xpos + step;
}
else
{
xpos = xpos - step;
}
if (xpos < 0)
{
x = 1;
xpos = 0;
}
if (xpos >= (width - woffset))
{
x = 0;
xpos = (width - woffset);
}
img.style.left = xpos + document.body.scrollleft;
img.style.top = ypos + document.body.scrolltop;
}
function start()
{
interval = setinterval('changepos()', delay);
}
function pause_resume()
{
clearinterval(interval);
}
start();
</script>
</body>
</html>