function openGameWin(myurl) {
    params = 'width=1024,height=768,top=0,left=0,status=no,resizable=yes,scrollbars=yes';
    var gamewin = window.open(myurl,'nof',params);
    if(window.focus) { gamewin.focus(); }
    return false;
}


function openHelpWin(myurl) {
    params = 'width=990,height=600,top=0,left=0,status=no,resizable=yes,scrollbars=yes';
    var helpwin = window.open(myurl,'help_win',params);
    if(window.focus) { helpwin.focus(); }
    return false;
}
function brWin(myurl) {
    params = 'width=800,height=550,top=0,left=0,status=no,resizable=yes,scrollbars=yes';
    var mywin = window.open(myurl,'brw',params);
    if(window.focus) { mywin.focus(); }
    return false;
}
function brWin_big(myurl) {
    params = 'width=900,height=550,top=0,left=0,status=no,resizable=yes,scrollbars=yes';
    var mywin = window.open(myurl,'brwb',params);
    if(window.focus) { mywin.focus(); }
    return false;
}

function urldecode(url) //function decode URL
{
// Replace + with ' '
// Replace %xx with equivalent character
// Put [ERROR] in output if %xx is invalid.
var HEXCHARS = "0123456789ABCDEFabcdef";
var encoded = url;
var plaintext = "";
var i = 0;
while (i < encoded.length) {
var ch = encoded.charAt(i);
if (ch == "+") {
plaintext += " ";
i++;
} else if (ch == "%") {
if (i < (encoded.length-2)
&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
plaintext += unescape( encoded.substr(i,3) );
i += 3;
} else {
alert( 'Bad escape combination near ...' + encoded.substr(i) );
plaintext += "%[ERROR]";
i++;
}
} else {
plaintext += ch;
i++;
}
} // while

return plaintext;
}; 


function  HttpRequest(){
 
 this.xmlhttp=false;
 this.url = ''
 this.method = 'Post';
 this.data = '';
 
 /*@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 {
  this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   this.xmlhttp = false;
  }
 }
@end @*/

if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
    try {
        this.xmlhttp = new XMLHttpRequest();
    } catch (e) {
        this.xmlhttp=false;
    }
}
if (!this.xmlhttp && window.createRequest) {
    try {
        this.xmlhttp = window.createRequest();
    } catch (e) {
        this.xmlhttp=false;
    }
}



}
 
HttpRequest.prototype.Send = function(){
 
 var req = this.xmlhttp;
 
 this.xmlhttp.open(this.method, this.url,true);
 this.xmlhttp.onreadystatechange=function() {
  if (req.readyState==4) {
   //alert(req.responseText)
  }
 }
 this.xmlhttp.setRequestHeader('Accept','message/xml-data')
 this.xmlhttp.send(this.data)
 
} 

function getObj(name)
{

  if (document.all)
  {
    if(!document.all[name]) return false;
    this.obj = document.all[name];
    this.style = document.all[name].style;
  }
  else if (document.getElementById)
  {
    if(!document.getElementById(name)) return false;
    this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;
  }
  else if (document.layers)
  {
    this.obj = getObjNN4(document,name);
    this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
    var x = obj.layers;
    var foundLayer;
    for (var i=0;i<x.length;i++)
    {
        if (x[i].id == name)
            foundLayer = x[i];
        else if (x[i].layers.length)
            var tmp = getObjNN4(x[i],name);
        if (tmp) foundLayer = tmp;
    }
    return foundLayer;
}




function clock(prefixStatus,timeZone) {
var cs="";
ctSeconds=ctSeconds+1;
if(ctSeconds>=60) { 
    ctMinutes=ctMinutes+1;
    ctSeconds=0;
}
if(ctMinutes>=60) { 
    ctHours=ctHours+1;
    ctMinutes=0;
}
if(ctHours>=24) { 
    ctHours=0;
}
cs=cs+(ctHours<10?"0":"");
cs=cs+ctHours+":";
cs=cs+(ctMinutes<10?"0":"");
cs=cs+ctMinutes+":";
cs=cs+(ctSeconds<10?"0":"");
cs=cs+ctSeconds;
var e=document.getElementById('globalClockLabel');
if(e)e.innerHTML=prefixStatus+"<strong>"+cs+" "+timeZone+"</strong>";
window.status=prefixStatus+""+cs+" "+timeZone+"";
setTimeout("clock('"+prefixStatus+"','"+timeZone+"')",1000);
}


function getURLParam(strParamName){
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) {
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ) {
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	return strReturn;
}

/* live */
function toggleLiveNotif(eid,th) {
	$.get("/_support/lb_server.php?a=n&eid="+eid,function(data){
		$("#notif"+eid).text(data);
		$("#notifleft"+eid).text(data);
		$("#notifDetail"+eid).text(data);
	});
}
