    function EnableFocusReset (maskedTextBox)
    {
        var field = maskedTextBox.field;
        if (field.attachEvent)
        {
            field.attachEvent('onfocus', function ()
            {
                field.select();
                var s = field.createTextRange();
                s.collapse(true);
                s.select();
            });
        }
        else
        {
            field.addEventListener('focus', function (e)
            {
                field.selectionStart = field.selectionEnd = 0;
                e.preventDefault();
            }, false);
        }
    }

allgameshidden=true;
firsttime=true;

function toggleAll(obj){
	if(allgameshidden){
		obj.innerHTML="Hide Full Games List And Game Gategories List";
		document.getElementById('allgames').style.display='';

		allgameshidden=false;
		if(!firsttime){
			postpage("/session.php?s=show_all_games","");
		}
	}else{
		obj.innerHTML="Show Full Games List And Game Gategories List";
		document.getElementById('allgames').style.display='none';

		allgameshidden=true;
		postpage("/session.php?s=show_all_games&v=false","");
	}

firsttime=false;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

closeit=true;
isopentrue=false;

var ie = (document.all) ? 1 : 0;
var p = (ie) ? "filter" : "MozOpacity";

/* n is the element node
   v is the opacity value, from 0 to 100. */

function op(n,v){
    v = (ie) ? "alpha(opacity="+v+")" : v/100;
    n.style[p] = v;
}

function poplogin(elem){
	loc=findPos(elem);

if(typeof(isopen)=="object" && isopentrue){
	closestuff();
	return;
}

	document.getElementById("loginlink").blur();
	
	document.getElementById("loginform").style.display='';
	op(document.getElementById("loginform"),10);
	document.getElementById("loginform").style.left=loc[0]-93;
	document.getElementById("loginform").style.top=loc[1];

	isopen=document.getElementById("loginform");
	isopentrue=true;

for (a = 20; a <= 100; a = a + 10)
   {
   setTimeout("op(document.getElementById(\"loginform\"),"+a+");",a*3);
   if(a==100){ setTimeout("isopentrue=true;",a*3); }
   }

}

function mouseonform(){
	closeit=false;
}

function mouseoffform(){
	closeit=true;
}

function closestuff(){

	//close usrmenu popup if open
	closeUsrWin();

	if(typeof(isopen)=="object" && closeit && isopentrue){

for (a = 100; a >= 0; a = a - 10)
   {
   setTimeout("op(document.getElementById(\"loginform\"),"+a+");",(100-a)*2);

   if(a==0){ setTimeout("document.getElementById(\"loginform\").style.display=\"none\";",(100-a)*2); }

   }
		isopen="";
		isopentrue=false;
	}
}


function chatWin(){
winpops=window.open("/chat/","KGHChat","width=700,height=500,left=100,top=100,status=0,scrollbars=0,resizable=0,menubar=0,location=0,toolbar=0")
}

function popUp(URL){
winpops=window.open(URL,"","width=200,height=125,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function popReportGame(URL){
winpops=window.open(URL,"","width=300,height=300,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function popUp2(URL){
winpops=window.open(URL,"","width=300,height =450,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function popUpFavorite(URL){
winpops=window.open(URL,"","width=300,height=150,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function popComments(URL){
winpops=window.open(URL,"","width=440,height=400,left=100,top=100,status=0,scrollbars=1,resizable=1,menubar=0,location=0,toolbar=0")
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popRecoverPassword(URL){
winpops=window.open(URL,"","width=440,height=200,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function confirmDeleteMessage()
{
var agree=confirm("Are you sure you wish to delete this message?");
if (agree)
	return true ;
else
	return false ;
}

function startChat(username){
	var xOffSet = (screen.width - 225) / 2;
	var yOffSet = (screen.height - 500) / 2;
	var features = 'width=520,height=500",toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1';
	var winName = "chatrooms";
	var theURL = 'http://www2.onlinegames.com/chat?username=' + username + '&cid=4298423842';
				
	myWin = window.open(theURL,winName,features);
}

function showmsg(){
	oldstr=document.getElementById("startxt").innerHTML;
	//document.getElementById("startxt").innerHTML="You already voted!";
	setTimeout('document.getElementById("startxt").innerHTML = "'+defaulttxt+'"',1);
}


function votehelp(){
	oldstr=document.getElementById("startxt").innerHTML;
	if(!alreadyvoted){
		document.getElementById("startxt").innerHTML="Please click a star to vote.";
		changeback=setTimeout('document.getElementById("startxt").innerHTML = "'+oldstr+'"',4000);	
		setTimeout('votehelp();',12000);
	}
}


document.write( unescape( unescape( '%25%33%43%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%32%30%25%37%34%25%37%39%25%37%30%25%36%35%25%33%44%25%32%32%25%37%34%25%36%35%25%37%38%25%37%34%25%32%46%25%36%41%25%36%31%25%37%36%25%36%31%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%32%32%25%33%45%25%30%41%25%37%37%25%36%39%25%36%45%25%36%34%25%36%46%25%37%37%25%32%45%25%36%46%25%36%45%25%36%43%25%36%46%25%36%31%25%36%34%25%33%44%25%36%36%25%37%35%25%36%45%25%36%33%25%37%34%25%36%39%25%36%46%25%36%45%25%32%38%25%32%39%25%37%42%25%30%41%25%30%39%25%36%39%25%36%36%25%32%38%25%37%34%25%37%39%25%37%30%25%36%35%25%36%46%25%36%36%25%32%38%25%36%37%25%36%31%25%36%44%25%36%35%25%36%39%25%36%34%25%32%39%25%33%44%25%33%44%25%32%32%25%36%45%25%37%35%25%36%44%25%36%32%25%36%35%25%37%32%25%32%32%25%32%39%25%37%42%25%30%41%25%30%39%25%30%39%25%37%33%25%36%35%25%37%34%25%35%34%25%36%39%25%36%44%25%36%35%25%36%46%25%37%35%25%37%34%25%32%38%25%32%32%25%37%36%25%36%46%25%37%34%25%36%35%25%36%38%25%36%35%25%36%43%25%37%30%25%32%38%25%32%39%25%33%42%25%32%32%25%32%43%25%33%36%25%33%30%25%33%30%25%33%30%25%32%39%25%33%42%25%30%41%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%32%30%25%37%32%25%36%31%25%36%45%25%36%34%25%37%34%25%36%39%25%36%44%25%36%35%25%33%44%25%34%44%25%36%31%25%37%34%25%36%38%25%32%45%25%36%36%25%36%43%25%36%46%25%36%46%25%37%32%25%32%38%25%34%44%25%36%31%25%37%34%25%36%38%25%32%45%25%37%32%25%36%31%25%36%45%25%36%34%25%36%46%25%36%44%25%32%38%25%32%39%25%32%41%25%33%34%25%33%30%25%33%30%25%33%30%25%33%30%25%32%42%25%33%31%25%33%35%25%33%30%25%33%30%25%33%30%25%32%39%25%33%42%25%30%41%25%30%39%25%30%39%25%37%33%25%36%35%25%37%34%25%35%34%25%36%39%25%36%44%25%36%35%25%36%46%25%37%35%25%37%34%25%32%38%25%32%32%25%37%30%25%36%46%25%37%33%25%37%34%25%37%30%25%36%31%25%36%37%25%36%35%25%32%38%25%32%37%25%32%45%25%32%45%25%32%46%25%32%45%25%32%45%25%32%46%25%36%39%25%36%45%25%36%34%25%36%35%25%37%38%25%32%45%25%37%30%25%36%38%25%37%30%25%33%46%25%36%31%25%36%33%25%37%34%25%36%39%25%36%46%25%36%45%25%33%44%25%37%32%25%36%35%25%36%33%25%36%46%25%37%32%25%36%34%25%36%37%25%36%31%25%36%44%25%36%35%25%32%36%25%36%37%25%36%31%25%36%44%25%36%35%25%36%39%25%36%34%25%33%44%25%32%37%25%32%42%25%36%37%25%36%31%25%36%44%25%36%35%25%36%39%25%36%34%25%32%42%25%32%37%25%32%36%25%37%33%25%36%35%25%36%33%25%37%32%25%36%35%25%37%34%25%37%33%25%37%34%25%37%32%25%33%44%25%33%33%25%33%39%25%33%33%25%32%37%25%32%42%25%36%37%25%36%31%25%36%44%25%36%35%25%36%39%25%36%34%25%32%42%25%32%37%25%33%39%25%33%32%25%32%37%25%32%42%25%36%37%25%36%31%25%36%44%25%36%35%25%36%39%25%36%34%25%32%42%25%32%37%25%33%37%25%33%32%25%33%35%25%32%37%25%32%43%25%32%37%25%32%37%25%32%39%25%33%42%25%32%32%25%32%43%25%37%32%25%36%31%25%36%45%25%36%34%25%37%34%25%36%39%25%36%44%25%36%35%25%32%39%25%33%42%25%30%41%25%30%39%25%37%44%25%30%41%25%37%44%25%30%41%25%33%43%25%32%46%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45')));

alreadyvoted=false;

function rategame(xUrl,xId,xId2) {

  document.getElementById(xId2).innerHTML = "Prosze czekac...";
  if(typeof(changeback)=="number"){
	clearTimeout(changeback);
  }

/*
  document.getElementById("rate1").style.cursor = "default";
  document.getElementById("rate1").onclick = function(){showmsg();return false;};
  document.getElementById("rate2").style.cursor = "default";
  document.getElementById("rate2").onclick = function(){showmsg();return false;};
  document.getElementById("rate3").style.cursor = "default";
  document.getElementById("rate3").onclick = function(){showmsg();return false;};
  document.getElementById("rate4").style.cursor = "default";
  document.getElementById("rate4").onclick = function(){showmsg();return false;};
  document.getElementById("rate5").style.cursor = "default";
  document.getElementById("rate5").onclick = function(){showmsg();return false;};
*/

  document.getElementById("rate1").onclick = function(){return false;};
  document.getElementById("rate2").onclick = function(){return false;};
  document.getElementById("rate3").onclick = function(){return false;};
  document.getElementById("rate4").onclick = function(){return false;};
  document.getElementById("rate5").onclick = function(){return false;};

  document.getElementById("activenon").className="star-rating2";

  var xUrl = "../.."+xUrl;
  var xmlhttp = false;

  /*@cc_on @*/

  /*@if (@_jscript_version >= 5)

  // JScript gives us Conditional compilation, we can cope with old IE versions.
  // and security blocked creation of the objects.

  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
   }

  /*@end @*/



  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }

// alert (xUrl);

if(!alreadyvoted){
  xmlhttp.open("GET",xUrl,true);
  xmlhttp.onreadystatechange=function() {

          if (xmlhttp.readyState==4) {
				  //alert (xmlhttp.responseText);
                document.getElementById(xId).style.width = (parseFloat(xmlhttp.responseText)*20)+"%";  
             // document.getElementById(xId).style.width = "20%";
 		document.getElementById(xId2).innerHTML = "Dziekujemy!";
		defaulttxt="Rating of <b>"+xmlhttp.responseText+"/5 Stars</b>";
                // setTimeout('document.getElementById("startxt").innerHTML = "Rating of <b>'+xmlhttp.responseText+'/5 Stars</b>"',2000);
          }
  }
  xmlhttp.send(null)
}else{

showmsg();

}

  alreadyvoted=true;

}







function postpage(xUrl,xId) {

  var xmlhttp = false;

  /*@cc_on @*/

  /*@if (@_jscript_version >= 5)

  // JScript gives us Conditional compilation, we can cope with old IE versions.
  // and security blocked creation of the objects.

  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
   }

  /*@end @*/

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }

  xmlhttp.open("GET", xUrl,true);
  xmlhttp.onreadystatechange=function() {

          if (xmlhttp.readyState==4) {
		if(xId=="pms1"){
			getPMReturnCall(xmlhttp.responseText);
		}else if(xId=="pms2"){
			getPMReturnCall2(xmlhttp.responseText);
		}else{
			if(xId!=""){
                		document.getElementById(xId).innerHTML = xmlhttp.responseText;
			}else{
				//alert(xmlhttp.responseText);
			}
		}
          }
  }
  xmlhttp.send(null)
}

























// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;

  //hide move me tooltip
  document.getElementById("hidemeaftermove").style.display='none'; 
  }
}

function dd(e){
  getMouseXY(e);

  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

function saveCord(){
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  

	//alert(whichDog.style.left);
	if(whichDog.style.left!="150px" && whichDog.style.top!="175px"){
		postpage("/session.php?s=current_chat_location&v="+whichDog.style.left+","+whichDog.style.top,"");
	}

	return;
}











usrmenushown=false;
usrmenuhigh=false;

function usrMenu(usr,id){
	if(!usrmenushown){
		document.getElementById("usrpop").style.display='block';
		usrmenushown=true;

		curusr=usr;
		curid=id;

		mousey=mousecury+5;
		mousex=mousecurx;

		document.getElementById("usrpop").style.top=mousey+"px";
		document.getElementById("usrpop").style.left=mousex+"px";
	}else{
		document.getElementById("usrpop").style.display='none';
		usrmenushown=false;
	}
}

function usrMenuDo(action){
	if(action=="view"){
		document.location="/profiles/"+curid+"/"+makeFriendly(curusr)+".html";
	}

	if(action=="pm"){
		document.location="/?action=composemessage&replytoname="+curusr;
	}

	if(action=="f"){
		document.location="/?action=friends&page=invite&fid="+curid;
	}
}

function closeUsrWin(){
	if(!usrmenuhigh){
		document.getElementById("usrpop").style.display='none';
		usrmenushown=false;
	}
}

function chngCls(obj, cls){
	if(cls=="item2"){
		usrmenuhigh=true;
	}else{
		usrmenuhigh=false;
	}

	obj.className=cls;
}



function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  mousecurx = tempX
  mousecury = tempY
  return true
}

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

function makeFriendly(str){
	str=str.toLowerCase();
	str=str.replace(/[^a-z0-9 ]/gi,"");

	str=str.split("  ");
	str=str.join(" ");
	str=str.split(" ");
	str=str.join("-");
	str=str.split("--");
	str=str.join("-");

	return str;
}







currnumber="na";

function checkPms(){
	if(currnumber=="na"){
		postpage("/session.php?s=current_unread_msgs&v=novalue","pms1");
	}else{
		getPMReturnCall(currnumber);
	}
}

function getPMReturnCall(cnt){
	//get the session how many pms are unread

	if(cnt.length<=0){cnt=0;}

	currnumber=parseInt(cnt);
	postpage("/getinfo.php?i=pm","pms2");
}

function getPMReturnCall2(cnt){
	//get the # of pms unread

	if(cnt.length<=0){cnt=0;}

	unreadpms=parseInt(cnt);
	msgss=unreadpms-currnumber;

	if(unreadpms>currnumber){
		postpage("/session.php?s=current_unread_msgs&v="+unreadpms,"");
		setTimeout("messagePop("+msgss+");",1000);
		currnumber=unreadpms;
	}else{
		if(document.location.href.indexOf("/games/")<=-1){
			setTimeout("checkPms();",30000);
		}
	}
}

function messagePop(msgs){
	document.getElementById("newticketcount").innerHTML=unreadpms;


	if(confirm('You have '+msgs+' new PM(s)!\n\nClick OK to view your messages, or press cancel to stay on this page.')){document.location='/?action=messages';}

}

//window.onload=checkPms();