function getSelectionId(text, li) {
  var url = '/game/' + li.id;
  window.location = url;
}

function closeOverlay(){
  Effect.DropOut('popup_overlay'); 
  grayOut(false);
}

function vIE(){return (navigator.appName=='Microsoft Internet Explorer')?parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]):-1;}

function grayOut(vis, options) {
  if(vIE() >= 6 || vIE() < 0){
  var options = options || {};
 var zindex = options.zindex || 50;
 var opacity = options.opacity || 70;
 var opaque = (opacity / 100);
 var bgcolor = options.bgcolor || '#000000';
 var dark=document.getElementById('darkenScreenObject');
 if (!dark) {
 // The dark layer doesn't exist, it's never been created. So we'll
 // create it here and apply some basic styles.
 // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
   var tbody = document.getElementsByTagName("body")[0];
   var tnode = document.createElement('div'); // Create the layer.
   tnode.style.position='absolute'; // Position absolutely
   tnode.style.top='0px'; // In the top
   tnode.style.left='0px'; // Left corner of the page
   tnode.style.overflow='hidden'; // Try to avoid making scroll bars
   tnode.style.display='none'; // Start out Hidden
   tnode.id='darkenScreenObject'; // Name it so we can find it later
   tbody.appendChild(tnode); // Add it to the web pagea
   Event.observe(tnode, "click", closeOverlay); 
   dark=document.getElementById('darkenScreenObject'); // Get the object.
   }
  if (vis) {
		
  var myWidth = "100%", myHeight = "100%";
  if( typeof( window.innerWidth ) == 'number' ) {
     //Non-IE
   myWidth = "100%";
   myHeight =  document.body.scrollHeight+'px';
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
   myWidth = document.documentElement.clientWidth + "px";
     myHeight = document.body.scrollHeight+'px';
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
    myWidth = document.body.clientWidth + "px";
     myHeight = document.body.clientHeight + "px";
  }
 dark.style.opacity=opaque;
 dark.style.MozOpacity=opaque;
 dark.style.filter='alpha(opacity='+opacity+')';
 dark.style.zIndex=zindex;
 dark.style.backgroundColor=bgcolor;
 dark.style.width= myWidth;
 dark.style.height= myHeight;
 dark.style.display='block';
 dark.onclick="Effect.DropOut('popup_overlay'); grayOut(false);";
} else {
  dark.style.display='none';
}
  }
}
