//Nguoi viet : Ho Quoc Dat (hoquocdat@yahoo.com)

var slideTime = 1500;
var floatAtBottom = false;

function pepsi_floating_init()
{
	xMoveTo('floating_banner_right', 905 - (1024-screen.width), 0);
	
	winOnResize(); 
	xAddEventListener(window, 'resize', winOnResize, false);
	xAddEventListener(window, 'scroll', winOnScroll, false);
}
function winOnResize() {
	checkScreenWidth();
	winOnScroll(); 
}
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) - 800, y+100, slideTime);
  		xSlideTo('floating_banner_right', (screen.width -  780)/2-115, y+100, slideTime);
	}
	else
	{
		xSlideTo('floating_banner_left', (screen.width - (800-777) - 800)/2-115 , y+100, slideTime);
  		xSlideTo('floating_banner_right', 1+(screen.width + 780)/2, y+100, 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';
	}
}
