function chkMsg(event, ipt, maxlen)
{
	keyCode = event.keyCode;
	if (keyCode == 46) { return true; } //Delete
	if (keyCode == 8) { return true; }  //Backspace
	if ((keyCode >= 35) && (keyCode <= 40)) { return true;} //End, Home, left, up, right, down
	len = ipt.value.length;
	return (ipt.value.length < maxlen);
}

function openGame(game)
{
	if (game == 'omara')
	{
		winWidth = 680;
		winHeight = 510;
		nameWin = 'omara'
	}
	else if (game == 'pobarvanka')
	{
		winWidth = 775;
		winHeight = 581;
		nameWin = 'pobarvanka'
	}
	else if (game == 'pustolovscine')
	{
		winWidth = 600;
		winHeight = 404;
		nameWin = 'pustolovscine'
	}
	else if (game == 'nogomet')
	{
		winWidth = 785;
		winHeight = 595;
		nameWin = 'nogomet'
	}
	else if (game == 'pismonosa')
	{
		winWidth = 620;
		winHeight = 420;
		nameWin = 'pismonosa'
	}
	else if (game == 'mahjong')
	{
		winWidth = 600;
		winHeight = 400;
		nameWin = 'mahjong'
	}

	
	sX = window.screen.width;
	sY = window.screen.height;
//	alert(sX + ' x ' + sY);
	
	wX = (sX / 2) - (winWidth / 2);
	wY = (sY / 2) - (winHeight / 2);
	
	url = 'play.php?game=' + game;
	params = 'width=' + winWidth + ',height=' + winHeight;
	
	if (game == 'omara')
	{
		omaraWin = window.open(url, 'omara', params);
		omaraWin.moveTo(wX,wY);
		omaraWin.focus();
	}
	else if (game == 'pobarvanka')
	{
		pobarvankaWin = window.open(url, 'pobarvanka', params);
		pobarvankaWin.moveTo(wX,wY);
		pobarvankaWin.focus();
	}
	else if (game == 'pustolovscine')
	{
		pustolovscineWin = window.open(url, 'pustolovscine', params);
		pustolovscineWin.moveTo(wX,wY);
		pustolovscineWin.focus();
	}
	else if (game == 'nogomet')
	{
		pustolovscineWin = window.open(url, 'nogomet', params);
		pustolovscineWin.moveTo(wX,wY);
		pustolovscineWin.focus();
	}
	else if (game == 'pismonosa')
	{
		pustolovscineWin = window.open(url, 'pismonosa', params);
		pustolovscineWin.moveTo(wX,wY);
		pustolovscineWin.focus();
	}
	else if (game == 'mahjong')
	{
		pustolovscineWin = window.open(url, 'mahjong', params);
		pustolovscineWin.moveTo(wX,wY);
		pustolovscineWin.focus();
	}

}

function openPopUp(url, width, height)
{
	params = 'width=' + width + ',height=' + height + ',scrollbars=yes,resize=yes';
	popupwin = window.open(url, 'popup', params);
	
	sX = window.screen.width;
	sY = window.screen.height;
//	alert(sX + ' x ' + sY);
	
	winWidth = width;
	winHeight = height;
	
	wX = (sX / 2) - (winWidth / 2);
	wY = (sY / 2) - (winHeight / 2);
	
	popupwin.moveTo(wX,wY);
	popupwin.focus();
}

function openEcard(url, width, height)
{
	params = 'width=' + width + ',height=' + height + ',scrollbars=no,resize=yes';
	popupwin = window.open(url, 'popup', params);
	
	sX = window.screen.width;
	sY = window.screen.height;
//	alert(sX + ' x ' + sY);
	
	winWidth = width;
	winHeight = height;
	
	wX = (sX / 2) - (winWidth / 2);
	wY = (sY / 2) - (winHeight / 2);
	
	popupwin.moveTo(wX,wY);
	popupwin.focus();
}

function formSubmit()
{
	if (document.form.dummy.value == 1)
	{
		document.form.submit();
	}
}

function openChat(url, width, height)
{
	params = 'width=' + width + ',height=' + height + ',scrollbars=no,resizable=yes';
	chatwin = window.open(url, 'chat', params);
	
	sX = window.screen.width;
	sY = window.screen.height;
//	alert(sX + ' x ' + sY);
	
	winWidth = width;
	winHeight = height;
	
	wX = (sX / 2) - (winWidth / 2);
	wY = (sY / 2) - (winHeight / 2);
	
	chatwin.moveTo(wX,wY);
	chatwin.focus();
}