window.onresize = myResize;
window.onload= doIEFIX;
function doIEFIX() 
{
	var topBanImage;
	var glitterImage;
	
	if((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined))
	{
		topBanImage = "url(winxImages/bg_images/iefix/TopPanel_Image.gif)";
		glitterImage = "url(winxImages/bg_images/iefix/1.1.2.gif)";
	}
	else
	{
		topBanImage = "url(winxImages/bg_images/TopPanel_Image.png)";
		glitterImage = "url(winxImages/bg_images/1.1.2.png)";
		
	}
	
	document.getElementById("topBody").style.backgroundImage = topBanImage;
	document.getElementById("glitters").style.backgroundImage = glitterImage;
	
	var isIE6 = checkIe6();
	if (document.getElementById("games") != null)
	{
		if(isIE6 == 0)
		{
			//alert("You rock - you dont have ie6");
			document.getElementById("games").style.paddingRight = '0px';
		}
		else
		{
			document.getElementById("games").style.paddingRight = '11px';
			//alert("You Suck - you have ie6");
		}
	}
	
	myResize();
}

function myResize() 
{
	var windowWidth;
	var leftImage;
	var rightImage;
	
	if((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined))
	{
		leftImage = "url(winxImages/bg_images/iefix/1.1.3-1.gif)";
		rightImage = "url(winxImages/bg_images/iefix/1.1.3-2.gif)";
	}
	else
	{
		leftImage = "url(winxImages/bg_images/1.1.3-1.png)";
		rightImage = "url(winxImages/bg_images/1.1.3-2.png)";
		
	}
	
	
	if(self.innerWidth!=undefined)
	{
		windowWidth = self.innerWidth-18;
	}
	else
	{
		var D= document.documentElement;
		if(D) 
		{
			windowWidth = D.clientWidth;
		}
		
		if(windowWidth == 0)
		{
			windowWidth = document.getElementsByTagName('body')[0].clientWidth;
		}
	}
	//alert(window.innerWidth);
	//alert(+windowWidth+"px");
	if(windowWidth > 1280)
	//if(windowWidth > 1040)
	{
		var imageWidth = +((windowWidth - 1040)/2)+"px";
		document.getElementById("leftImage").style.width = imageWidth;
		document.getElementById("rightImage").style.width = imageWidth;
		document.getElementById("leftImage").style.height = '650px';
		document.getElementById("rightImage").style.height = '650px';
		
		document.getElementById("leftImage").style.backgroundImage = leftImage;
		document.getElementById("rightImage").style.backgroundImage = rightImage;
	}
	else if(windowWidth <= 1280 && windowWidth > 1040)
	{
		var imageWidth = +((windowWidth - 1040)/2)+"px";
		document.getElementById("leftImage").style.width = imageWidth;
		document.getElementById("rightImage").style.width = imageWidth;
		document.getElementById("leftImage").style.height = '650px';
		document.getElementById("rightImage").style.height = '650px';
		
		document.getElementById("leftImage").style.backgroundImage = "none";
		document.getElementById("rightImage").style.backgroundImage = "none";
		
	}
	else
	{
		document.getElementById("leftImage").style.width = '0px';
		document.getElementById("rightImage").style.width = '0px';
		document.getElementById("leftImage").style.height = '0px';
		document.getElementById("rightImage").style.height = '0px';
		
		document.getElementById("leftImage").style.backgroundImage = "none";
		document.getElementById("rightImage").style.backgroundImage = "none";
	}
	/*var sideWidth = (windowWidth - 1040)/2;
	var leftImagePos = +0+"px";
	var bodyPos = +sideWidth+"px";
	var rightImagePos = +(sideWidth+1040)+"px";
	var isIE6 = checkIe6();
	if(isIE6 == 0)
	{
		//alert("You rock - you dont have ie6");
		document.getElementById("leftImage").style.left = leftImagePos;
		document.getElementById("mainContent").style.left = bodyPos;
		document.getElementById("rightImage").style.left = rightImagePos;
		//alert("sideWidth:"+sideWidth+", leftImagePos:"+leftImagePos+", bodyPos:"+bodyPos+",rightImagePos:"+rightImagePos);
	}
	else
	{
		//alert("You Suck - you have ie6");
	}*/
	
	
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function checkIe6()
{
  var ver = getInternetExplorerVersion();
  var result = 0;
  if ( ver > -1 )
  {
	  result = 1;
    /*if ( ver < 7.0 ) 
	{
      result = 1;
	}
    else
	{
      result = 0;
	}*/
  }
  return result;
}
