function GetXMLHttpObject()
{  
	var xmlHttp = null;
	try
	{    
		// Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{    
		// Internet Explorer    
		try
		{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{      
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;
			}
		}
	} 
	return xmlHttp;
}
function getadsforpage(page,ntype,starget)
{
 	var xhr = new GetXMLHttpObject();
	var url='ad.asp?p=' + page + '&t=' + ntype + '&sid=' + Math.random();

	if (xhr == null)
	{
		return false;
	}
	else
	{
		xhr.onreadystatechange = function()
		{
			if (xhr.readyState == 4 && xhr.status == 200)
			{
				document.getElementById(starget).innerHTML=xhr.responseText;
			}
		
		}
		xhr.open("GET",url,true);
		xhr.send(null);  
    }
}
function cycleaddsforpage()
{

}
function testImage(URL)
{
    var tester=new Image();
    tester.onLoad=1;
    tester.onError=0;
    tester.src=URL;
}
function createCookie(name,value,days) 
{
	if (days) 
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return "NO";
}

function eraseCookie(name) 
{
	createCookie(name,"",-1);
}

//THIS FUNCTION SETS THE PROPERTIES OF THE DIV AS A FUNCTION OF THE DISPLAY WIDTH AND HEIGHT
//HEIGHT = 80% of browser height / WIDTH=80% of browser width
//TOP = 10% of browser width / LEFT = 10% of browser width

function setdiv()
{
	//SET HEIGHT/WIDTH/TOP/LEFT OF OUTER FRAMING DIV
	//document.getElementById('resize').style.top =  Math.round((getHeight()-500)/2) + 'px';
	document.getElementById('resize').style.left = Math.round((getWidth()-700)/2) + 'px';
	
}

//THIS FUNCTION RETURNS THE WIDTH OF THE VISIBLE DISPLAY OF THE BROWSER
function getWidth()
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) 
  {
    //Non-IE
    myWidth = window.innerWidth;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
  {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
  {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
	return myWidth;
}

//THIS FUNCTION RETURNS THE HEIGHT OF THE VISIBLE DISPLAY OF THE BROWSER
function getHeight() 
{
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' )
  {
    myHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
  {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
  {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
	return myHeight;
}

//addEvent() by John Resig
function addEvent( obj, type, fn )
{ 
   if (obj.addEventListener)
   { 
      obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent)
   { 
      obj["e"+type+fn] = fn; 
      obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
      obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 
} 

//addEvent(window, 'load', setdiv);
//addEvent(window, 'resize', setdiv);

function highlight(n)
{
	document.getElementById('menu' + n).style.border  = '1px groove #444;';
	document.getElementById('menu' + n).style.width  = '118px';
	document.getElementById('menu' + n).style.height  = '18px';
}
function lowlight(n)
{
	document.getElementById('menu' + n).style.border  = '';
	document.getElementById('menu' + n).style.width  = '120px';
	document.getElementById('menu' + n).style.height  = '20px';
}
function setgamecountry()
{
	parent.document.location.href  = 'default.asp?country=' + document.frmgamecntry.selectgamecountry.value;
}