
var slideTime = 500;
var floatAtBottom =false;

function floating_init()
{
	xMoveTo('floating_banner_right', 887 - (1024-screen.width), 0);

	winOnResize(); // set initial position
	xAddEventListener(window, 'resize', winOnResize, false);
	xAddEventListener(window, 'scroll', winOnScroll, false);
}
function winOnResize() {
	checkScreenWidth();
	winOnScroll(); // initial slide
}
function winOnScroll() {
  var y = xScrollTop();
  if (floatAtBottom) {
    y += xClientHeight() - xHeight('floating_banner_left');
  }

	if( screen.width <= 800 )
	{
		xSlideTo('floating_banner_left', screen.width - (800-777) - 772, y, slideTime);
  		xSlideTo('floating_banner_right', (screen.width - (800-777) + 772)/2-117, y, slideTime);
	}
  if(screen.width<=1024)
	{
		xSlideTo('floating_banner_left', (screen.width - (800-577) - 772)/2-47 , y+140, slideTime);
  		xSlideTo('floating_banner_right', 1+(screen.width - (800-577) + 772)/2+170+124, y+140, slideTime);
	}
	if(screen.width>1024)
	{
		xSlideTo('floating_banner_left', (screen.width - (800-577) - 772)/2-117 , y+140, slideTime);
  		xSlideTo('floating_banner_right', 1+(screen.width - (800-577) + 772)/2+170, y+140, slideTime);
	}
}
function checkScreenWidth()
{
	if( screen.width <= 800 )
	{
		document.getElementById('floating_banner_left').style.display = 'none';
	}

	if(screen.width < 1024)
	{
		
		document.getElementById('floating_banner_right').style.display = 'none';
	}
}
