///Updated by Cong Minh

var slideTime = 2000;
var floatAtBottom = false;

function pepsi_floating_init()
{
	xMoveTo('floating_banner_right', 887 - (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) - 772, y+90, slideTime);
  		xSlideTo('floating_banner_right', (screen.width - (800-777) + 775)/2-117, y+90, slideTime);
	}
 else
	{
		xSlideTo('floating_banner_left', (screen.width - (800-777) - 772)/2-117 , y+75, slideTime);
  		xSlideTo('floating_banner_right', 1+(screen.width - (800-777) + 775)/2, y+75, slideTime);
	}
}
function checkScreenWidth()
{	
	var nsCheck = (navigator.appName.indexOf("Netscape") != -1);
	// check if not firefox we'll set the width of the  div id = 0
	
	if(nsCheck== false)
		document.getElementById('divAdLeft').style.width=0;
	// check if resolution 800X600 divAd will not display
	if( screen.width <= 800 )
	{
		document.getElementById('floating_banner_left').style.display = 'none';
		document.getElementById('divAdLeft').style.display='none';
	}

	if(screen.width < 1024)
	{
		
		document.getElementById('floating_banner_right').style.display = 'none';
	}
}
