var xPos1 =1024;
var yPos1 = 0;
var yon1 = 0;
var xon1 = 0;

function changePos1() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img1.offsetHeight;
Woffset = img1.offsetWidth;

img1.style.left = xPos1 + document.body.scrollLeft;
img1.style.top = yPos1 + document.body.scrollTop;


if (yon1) {
yPos1 = yPos1 + step;
}
else {
yPos1 = yPos1 - step;
}
if (yPos1 < 0) {
yon1 = 1;
yPos1 = 0;
}
if (yPos1 >= (height - Hoffset)) {
yon1 = 0;
yPos1 = (height - Hoffset);
}
if (xon1) {
xPos1 = xPos1 + step;
}
else {
xPos1 = xPos1 - step;
}
if (xPos1 < 0) {
xon1 = 1;
xPos1 = 0;
}
if (xPos1 >= (width - Woffset)) {
xon1 = 0;
xPos1 = (width - Woffset);
}
}

function start1() {
img1.visibility = "visible";
interval = setInterval('changePos1()', delay);
}

function pause_resume1() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos1()',delay);
pause = true;
}
}