if(window.ActiveXObject)
{ var rAjaxHandle = new ActiveXObject("Microsoft.XMLHTTP"); }
else if(window.XMLHttpRequest)
{ var rAjaxHandle = new XMLHttpRequest(); }

function LogonWorld(sServer, iUser)
{
	var sPostParam = "server=" + sServer + "&iUser=" + iUser;

	rAjaxHandle.open('POST', '/loginworld/check.do', true);
	rAjaxHandle.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	rAjaxHandle.setRequestHeader("Content-length", sPostParam.length);
	rAjaxHandle.setRequestHeader("Connection", "close");
	rAjaxHandle.send(sPostParam);
	rAjaxHandle.onreadystatechange = function()
	{
		switch(rAjaxHandle.readyState)
		{
			case 4:
			if(rAjaxHandle.status == 200)
			{
				var sData = rAjaxHandle.responseText;
				var aData = sData.split("|");

				switch(aData[0])
				{
					case '0':
					alert("Je account is vermoord op deze wereld, je kan een nieuw account aanmaken!");
					break;
					case '1':
					alert("Je account is verbannen op deze wereld, je kan geen nieuw account aanmaken!");
					break;
					case '2':
					alert("Je kan tijdelijk niet inloggen op deze wereld, omdat je account wordt onderzocht, mogelijk overtreed dit account de ToS!");
					break;
					case '3':
					alert("Deze wereld is tijdelijk offline, probeer het later opnieuw!");
					break;
					case '4':
					alert("Er ging iets mis tijdens het inloggen, probeer het later opnieuw!" + aData[1]);
					break;
					case '5':
					alert("De wereld die hebt geselecteerd bestaat niet!");
					self.location = 'http://www.gangstervision.nl/';
					break;
					case '6':
					if(gvtimertool_installed) 
						{
					      var sEvt = document.createEvent("Events");
					      sEvt.initEvent("GetData", true, false);
					      document.dispatchEvent(sEvt);
						}
					self.location = "/ingelogd/" + aData[1] + "/showFrame";
					break;
					case '7':
					alert("Je bent nog op non-actief ingesteld tot " + aData[1] + "!");
					break;
					case '8':
					alert("Je bent de vorige keer niet goed uitgelogd of er is nog iemand ingelogd!\nProbeer je opnieuw in te loggen!");
					self.location = 'http://www.gangstervision.nl/';
					break;
					case '9':
					alert("De wereld '" + aData[1] + "' is tijdelijk uitgeschakeld, onze excuses voor dit ongemakt!\nJe kan op de homepage de wereld statussen nakijken!");
					case '10':
					alert("Je bent nog aan het werken tot " + aData[1] + "!");
					break;
					default:
					alert("Er ging iets mis tijdens het inloggen, probeer het later opnieuw!");
					break;
				}
			}
			else
			{ alert("Wereld servers zijn offline, probeer het later opnieuw!"); }
			break;
		}
	}
	return;
}

function ShowStats(sWhich, iServer)
{
	var iWidth 	= 500;
	var iHeight = 500;	
	var iLeft 	= (screen.width / 2) - (iWidth / 2);
	var iTop 	= (screen.height / 2) - (iHeight / 2);
	
	switch(sWhich)
	{	
		case 'private':
		window.open('http://www.gangstervision.nl/information/' + iServer + '/private.do','GangsterVision','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + eval(iWidth) + ',height=' + eval(iHeight) + ',left=' + eval(iLeft) + ',top=' + eval(iTop) + '');
		break;
		case 'public':
		window.open('http://www.gangstervision.nl/information/' + iServer + '/public.do','GangsterVision','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + eval(iWidth) + ',height=' + eval(iHeight) + ',left=' + eval(iLeft) + ',top=' + eval(iTop) + '');
		break;
		default:
		alert("Er ging iets fout bij het opvragen van de statistieken!\nProbeer het nog eens!");
		break;
	}
}

function OpenInfo(sWhich)
{
	var iWidth 	= 500;
	var iHeight = 500;	
	var iLeft 	= (screen.width / 2) - (iWidth / 2);
	var iTop 	= (screen.height / 2) - (iHeight / 2);
	
	switch(sWhich)
	{
		case 'ipbound':
		window.open('http://www.gangstervision.nl/information/ipbound.info','GangsterVision','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + eval(iWidth) + ',height=' + eval(iHeight) + ',left=' + eval(iLeft) + ',top=' + eval(iTop) + '');
		break;
		case 'newsletter':
		window.open('http://www.gangstervision.nl/information/newsletter.info','GangsterVision','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + eval(iWidth) + ',height=' + eval(iHeight) + ',left=' + eval(iLeft) + ',top=' + eval(iTop) + '');
		break;
		case 'onlyalive':
		window.open('http://www.gangstervision.nl/information/onlyalive.info','GangsterVision','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + eval(iWidth) + ',height=' + eval(iHeight) + ',left=' + eval(iLeft) + ',top=' + eval(iTop) + '');
		break;
		case 'framestyle':
		window.open('http://www.gangstervision.nl/information/framestyle.info','GangsterVision','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + eval(iWidth) + ', height=' + eval(iHeight) + ', left=' + eval(iLeft) + ', top=' + eval(iTop) + '');
		break;
		case 'google':
		window.open('http://www.gangstervision.nl/index/openid/google.php','GangsterVision','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + eval(iWidth) + ', height=' + eval(iHeight) + ', left=' + eval(iLeft) + ', top=' + eval(iTop) + '');
		break;
		case 'hyves':
		window.open('http://www.gangstervision.nl/index/openid/hyves.php','GangsterVision','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + eval(iWidth) + ', height=' + eval(iHeight) + ', left=' + eval(iLeft) + ', top=' + eval(iTop) + '');
		break;
		default:
		alert("Er ging iets fout bij het opvragen van de juiste informatie!\nProbeer het nog eens!");
		break;
	}
}
