/* Javascript by some@starbeck.net ( http://www.gagameme.com ), 
   Do not copy and use it without my permission. */

function input_copy( input ) 
{
	copied = input.createTextRange();
	input.focus();
	input.select();
	copied.execCommand("Copy");
}
var win = null; 
function Play(u) 
{
	win = window.open(u,'play','location=no, menubar=no, toolbar=no, resizable=yes, status=no, scrollbars=yes,width=640,height=480,top=20,left=20'); 
}
function InitAjax()
{
	var ajax = false;
	try
	{
		ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{
  		try
  		{
			ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
		catch(E)
		{
			ajax = false; 
		}
	}
	if (!ajax && typeof XMLHttpRequest != 'undefined')
	{
		ajax = new XMLHttpRequest(); 
	}
	return ajax;
}
function Add(game_id)
{
	if ( typeof(game_id) == 'undefined' )
	{
		return false;
	}
 	var url = "/add/"+ game_id;
	var show = document.getElementById("show_form"); 
	var status = document.getElementById("status_form"); 

	if ( !show.innerHTML )
	{
		var ajax = InitAjax();
		ajax.open("GET", url, true); 
		ajax.onreadystatechange = function() 
		{
			if (ajax.readyState == 4 && ajax.status == 200) 
			{
				show.innerHTML = ajax.responseText; 
			}
		}
 		ajax.send(null);
 		show.style.display = "block";
 		status.style.display = "none";
	}
	else
	{
		show.style.display = "none";
		show.innerHTML = '';
	}
}
function Remove(game_id)
{
	if ( typeof(game_id) == 'undefined' )
	{
		return false;
	}
 	var url = "/remove/"+ game_id;
	var show = document.getElementById("show_form"); 
	var status = document.getElementById("status_form"); 

	if ( !show.innerHTML )
	{
		var ajax = InitAjax();
		ajax.open("GET", url, true); 
		ajax.onreadystatechange = function() 
		{
			if (ajax.readyState == 4 && ajax.status == 200) 
			{
				show.innerHTML = ajax.responseText; 
			}
		}
 		ajax.send(null);
 		show.style.display = "block";
 		status.style.display = "none";
	}
	else
	{
		show.style.display = "none";
		show.innerHTML = '';
	}
}