function CasinoGameOpenDemo()
{
   var nCasinoGameId = arguments[0];
   var sLang = arguments.length > 1 ? arguments[1] : null;
   var sPath = arguments.length > 2 ? arguments[2] : null;
   CasinoGameOpen2(nCasinoGameId, -1, null, null, sPath, sLang);
}

function CasinoGameOpenLogin()
{
   var nCasinoGameId = arguments[0];
   var sLogin = arguments[1];
   var sPassword = arguments[2];
   var sLang = arguments.length > 3 ? arguments[3] : null;
   var sPath = arguments.length > 4 ? arguments[4] : null;
   CasinoGameOpen2(nCasinoGameId, 1, sLogin, sPassword, sPath, sLang);
}

function CasinoGameOpen()
{
   var nCasinoGameId = arguments[0];
   var nAccountId = arguments.length > 1 ? arguments[1] : null;
   var sLang = arguments.length > 2 ? arguments[2] : null;
   var sPath = arguments.length > 3 ? arguments[3] : null;
   var sLogin = document.forms[0].login.value;
   var sPassword = document.forms[0].password.value;
   CasinoGameOpen2(nCasinoGameId, nAccountId, sLogin, sPassword, sPath, sLang);
}

function CasinoGameOpen2(nCasinoGameId, nAccountId, sLogin, sPassword, sPath, sLang)
{
   if (sLang == null) sLang = "en";
   if (sPath == null) sPath = "../../";
   if (sPath.charAt(sPath.length-1) != "/") sPath += "/";
   var sUrl = sPath + "aspNET/Launch/Enter.aspx";
   sUrl += "?CasinoGameId=" + nCasinoGameId;
   sUrl += "&Lang=" + sLang;
   if (nAccountId != null) sUrl += "&AccountId=" + nAccountId;
   if (sLogin != null) sUrl += "&Login=" + sLogin;
   if (sPassword != null) sUrl += "&Password=" + sPassword;
   
  // var nHeight = screen.height - 28;
   //var nWidth = Math.round(screen.height / 0.75) - 10;
   
   //if (nWidth > screen.width)
   //{
   //   nWidth = screen.width - 10;
   //   nHeight = Math.round(screen.width * 0.75) - 28;
   //}
   
   //var nLeft = 0; //(screen.width - nWidth) / 2;
   
   var sOptions = "noscrollbars"; // "resizable=1"; //"scrollbars=0,resizable=0,toolbar=0,menubar=0,status=0,location=0,titlebar=1,top=0,left=" + nLeft + ",height=" + nHeight + ",width=" + nWidth;
   var wWindow = window.open("","casinogamingflashwindow",sOptions);
   if (wWindow == null)
   {
      alert("Pop-up blocker?");
   }
   try 
   {
      wWindow.moveTo(0,0);
   } 
   catch(e)
   {
      //alert(e.description); // comment out this line
   }
   try 
   {
      //wWindow.resizeTo(nWidth + 10, nHeight + 28);
      wWindow.resizeTo(screen.width,screen.height);
      wWindow.focus();
   } 
   catch(e)
   {
      //alert(e.description); // comment out this line
   }
   wWindow.location = sUrl;
}

function RefreshLobby()
{
   document.forms[0].submit();
}

function popupNews(url, width, height)
{
   settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height;
   winpops=window.open(url,"",settings);
}