function getCookie (name)
{
        var dc = document.cookie;
        var prefix = name + "=";
        var begin = dc.indexOf ("; " + prefix);
        if (begin == -1) {
                begin = dc.indexOf (prefix);
                if (begin != 0) return null;
        }
        else begin += 2;
        var end = document.cookie.indexOf (";", begin);
        if (end == -1) end = dc.length;
        return unescape (dc.substring(begin + prefix.length, end));
}

function deleteCookie (name, path)
{
    // EGMT 09-13-01

        if (getCookie(name)) {
                document.cookie = name + "=" +
          ((path) ? "; path=" + path : "/") +
          "; expires=Thu, 01-Jan-70 00:00:01 GMT";
          location.reload();
        }

}

// Handle all the the FSCommand messages in a Flash movie
function bg_DoFSCommand(command, args) {
  var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
  var bgObj = InternetExplorer ? bg : document.bg;

// EGMT 09-13-01
   if (command == "getAlias")
   {
                var gAlias = getCookie( "365Alias" );
        if (gAlias == null || gAlias == "" || gAlias == '' )
                        alias = "";
                else
                {
                        alias = gAlias.toUpperCase();
                        tmp = alias.substring(0,5);


                        if (tmp == "GUEST" )
                                 alias = "";
                }

            if(InternetExplorer)
                bgObj.setVariable("aliasInfo",alias);
        else
                bgObj.SetVariable("aliasInfo",alias);

  }

   if (command == "getPlayerCount")
   {
            if(InternetExplorer)
            {
                bgObj.setVariable("p31",p31);
                bgObj.setVariable("c31",c31);
                bgObj.setVariable("p43",p43);
                bgObj.setVariable("c43",c43);
                bgObj.setVariable("p46",p46);
                bgObj.setVariable("c46",c46);
                bgObj.setVariable("p64",p64);
                bgObj.setVariable("c64",c64);
                bgObj.setVariable("p65",p65);
                bgObj.setVariable("c65",c65);
                bgObj.setVariable("p91",p91);
                bgObj.setVariable("c91",c91);
        }
        else
        {
                bgObj.SetVariable("p31",p31);
                bgObj.SetVariable("c31",c31);
                bgObj.SetVariable("p43",p43);
                bgObj.SetVariable("c43",c43);
                bgObj.SetVariable("p46",p46);
                bgObj.SetVariable("c46",c46);
                bgObj.SetVariable("p64",p64);
                bgObj.SetVariable("c64",c64);
                bgObj.SetVariable("p65",p65);
                bgObj.SetVariable("c65",c65);
                bgObj.SetVariable("p91",p91);
                bgObj.SetVariable("c91",c91);
        }
  }

}


function openGameWindow (i)
{
        //openGameWindow2 (0);
        openGameWindow2 (Math.round (Math.random()), i);
}

// ronald 09242001
function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL)
{ //v4.0
return(true);
  var newURL="", verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);

  if (app.indexOf('Netscape') != -1)
  {
    if (version >= NSvers)
    {
        if (NSpass>0) newURL = (NSpass==1)?URL:altURL;
    }
    else
    {
        if (NSnoPass>0)
                newURL=(NSnoPass==1)?URL:altURL;
    }
  }
  else
  if (app.indexOf('Microsoft') != -1)
  {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
    {
        if (IEpass>0)
                newURL=(IEpass==1)?URL:altURL;
        }
        else
        {
                if (IEnoPass>0)
                        newURL=(IEnoPass==1)?URL:altURL;
        }
  }
  else
  if (OBpass>0)
        newURL = (OBpass==1)?URL:altURL;
  if (newURL != "")
  {
        return(false);
  }
  else
  {
        return(true);
  }
}

var gameWin = null;

function openGameWindow2 (theme, i, game)
{
        var openNew = true;

        if (openNew)
        {
                var m = 1.0;
                if (i == -1) {
                        if (window.screen) {
                                if (screen.width<800 || screen.height<600) m = 0.8;
                                else m = screen.height / 600.0;
                        }
                }
                else if (i == 0) m = 0.8;
                else if (i == 2) m = 1.28;
                var w = 770*m;
                var h = 535*m;

                // ronald 09242001
                //alert(MM_checkBrowser(6.1,1,2,6.0,0,0,1,'sorry.html','sorry.html'));
                //if (1==1)
                // ronald 10022001 // change alt url to null & change 6.1 to 4.8
                if (MM_checkBrowser(4.8,1,2,6.0,0,0,1,'sorry.html',''))
                {
                        if (game == 31){
                        gameWin = window.open ("3cards1/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        }
                        else if (game == 43){
                        gameWin = window.open ("4cards3/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        }
                        else if (game == 431){
                        gameWin = window.open ("4cards3/flashbingoyoutube.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        }
                        else if (game == 46){
                        gameWin = window.open ("4cards6/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        }
                        else if (game == 64){
                        gameWin = window.open ("6cards4/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        //gameWin = window.open ("4cards3/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
}
                        else if (game == 65){
                        gameWin = window.open ("6cards5/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        //gameWin = window.open ("4cards3/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
}
                        else if (game == 91){
                        gameWin = window.open ("9cards1/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        //gameWin = window.open ("4cards3/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        }
                        else {
                        gameWin = window.open ("6cards5/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        //gameWin = window.open ("4cards3/flashbingo.php?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme, "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                        }
                }
                else
                {
                        gameWin = window.open ("sorry.html?width=" + w + "&height=" + h + "&mult=" + m + "&theme=" + theme,     "bingo", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1," + "resizable=0, width=" + w + ",innerWidth=" + (w+3) + ",height=" + h + ",innerHeight=" + (h+3));
                }
                //window.close("home.htm");
        }
		//openSpecialWindow();
		gameWin.focus();
}

function openRegWin()
{

var RegWin = window.open("register.php","Rca","top=0, left=0");
RegWin.creator=self;
RegWin.creator.name="RCA";
self.RC=RegWin;
}

//ronald 11-16-2001
function openPrizeGalleryWin()
{
        var PrizeGalleryWin = window.open("prizegallery.php","PrizeGallery","top=0, left=0, status=yes, scrollbars=yes");
        PrizeGaleryWin.creator = self;
        PrizeGalleryWin.creator.name = "PrizeGallery";
        self.PrizeGallery = PrizeGalleryWin;
}

function MM_openBrWindow1(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow2(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow3(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openSpecialWindow()
{
var OpenMyWin = window.open("special.php","Bingo","top=0, left=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=740, height=600");
OpenMyWin.focus();
}

