var img = document.getElementById("img");
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;                     
var height = 0;                     
var Hoffset = 0;                    
var Woffset = 0;                     
var yon = 0;                    
var xon = 0;                     
var pause = true;                    
var interval;                    
img.style.top = parseInt(yPos) + "px";

function getSize(){

}

function changePos() { 
width = 0;
height = 0;
if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	width = window.innerWidth;
	height = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	width = document.documentElement.clientWidth;
	height = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	width = document.body.clientWidth;
	height = document.body.clientHeight;
}


Hoffset = img.offsetHeight;                    
Woffset = img.offsetWidth;                   
img.style.left = parseInt(xPos) + parseInt(document.documentElement.scrollLeft) + "px";                    
img.style.top = parseInt(yPos) + parseInt(document.documentElement.scrollTop) + "px";                    
if (yon) {                  
yPos = yPos + step;                    
}               
else {             
yPos = yPos - step;                    
}            
if (yPos < 0) {                  
yon = 1;                    
yPos = 0;                    
}                  
if (yPos >= (height - Hoffset)) {                    
yon = 0;                    
yPos = (height - Hoffset);                     
}                  
if (xon) {                    
xPos = xPos + step;                    
}                 
else {                 
xPos = xPos - step;                   
}                  
if (xPos < 0) {                    
xon = 1;                   
xPos = 0;                   
}         
if (xPos >= (width - Woffset)) {                    
xon = 0;           
xPos = (width - Woffset);                    
}                    
}
function start() {                    
img.style.visibility = "visible";                  
interval = setInterval('changePos()', delay);                    
}              
start();  

