var xPos = 300;
var yPos = 200; 
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;
imgfloatbanner.style.top = yPos;
function changePos() 
{
	
	width = document.body.clientWidth;
	//height = document.body.clientHeight;	
	height = document.body.scrollTop + 560;	
   
	
	Hoffset = imgfloatbanner.offsetHeight;
	Woffset = imgfloatbanner.offsetWidth;
	imgfloatbanner.style.left = xPos + document.body.scrollLeft;
	imgfloatbanner.style.top = yPos + document.body.scrollTop;


	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);   }
		
         floatSwapImg();
	}
	
	function start()
	 {
	 	imgfloatbanner.visibility = "visible";	 	
		interval = setInterval('changePos()', delay);
	}
	function pause_resume() 
	{
		if(pause) 
		{
			clearInterval(interval);
			pause = false;}
		else 
		{
			interval = setInterval('changePos()',delay);
			pause = true; 
			}
		}
	start();
	
	
function floatSwapImg()
{	
  var objdiv = document.getElementById("imgfloatbanner");
  var count = objdiv.delayCount;
  if(isNaN(count)) count = 0;
  if(count >= 50)
  {
 	 var lastid = objdiv.lastid;
	 if(isNaN(lastid)) lastid = 0;
 	 if(lastid>objdiv.childNodes.length) lastid = 0;
	 
	 var bShow = false;
	 var lastobj,lastindex;
 	 for(i=objdiv.childNodes.length-1;i>=0;i--)
  	 {
   	  var objchild = objdiv.childNodes[i];
	  if(objchild.tagName != null)
	  {	     
	    lastobj = objchild;
		if(!bShow) lastindex = i;
		if(i>lastid&&(!bShow))
	    {
	      objchild.style.display = "block";
		  bShow = true;	
		 
	  	}	     
		else
		{
		   objchild.style.display = "none";
		}
   }	  	
  }
  
	if(!bShow)
	{
	   lastobj.style.display = "block";
	}
	count = -1;
	objdiv.lastid = lastindex;
  }
  objdiv.delayCount = count+1;  
}