home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2003 October / cmycha200310.iso / NHL2004 / NHL2004Demo.exe / fe / nhl / js / game_setup_interface.js < prev    next >
Text File  |  2003-08-20  |  53KB  |  1,815 lines

  1. //Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
  2. var oGameFace = window.external.GameInterface;
  3. var oLeagueServer       = oGameFace.LeagueServerInterface;
  4. var oExecutorServer = oGameFace.ExecutorServerInterface;
  5.  
  6. var homeTeamOwnerID;
  7. var awayTeamOwnerID;
  8. var skillArray = new Array('0' , nhlMsg('TASKLIST_LEVEL_BEGINNER', true) , '1' , nhlMsg('TASKLIST_LEVEL_EASY', true), '2', nhlMsg('TASKLIST_LEVEL_MEDIUM', true) , '3' , nhlMsg('TASKLIST_LEVEL_DIFFICULT', true));
  9. var awayTeamArray = new Array();
  10. var homeTeamArray = new Array();
  11. var leagueArray = new Array('0' , 'NHL' , '1' , 'International' , '2', 'Elitserien' , '3' , 'SM-liiga', '4', 'DEL');
  12. var leagueAbbrevArray = new Array('NHL/' , 'NHL/' , 'ES/' , 'SM/' , 'DEL/');
  13. var nullTeamID = 255;
  14. var readyClicked = false;
  15. var gameLaunched = false;
  16. var bRandom = false;
  17. var imgPath ="../../NHL/images2/logos/";
  18. var oAudioInterface = oGameFace.AudioInterface;
  19. var bIsOnline = false;
  20. var nAwayTeamIndex = 62;
  21. var nHomeTeamIndex = 62;
  22. var bUniformDialog = false;
  23.  
  24. var bReadyForSecondInit = false;
  25. var bDoneFirstInit = false;
  26.  
  27. var nEASOHomeTeam = 255;
  28. var nEASOAwayTeam = 255;
  29. var proPlay = System.GUI.general.data[0];  //boolean
  30. var gameType = System.GUI.general.data[1]; //int
  31. var bHost = System.GUI.general.data[5];
  32. var nAwaySide = 1;    // this is AWAY from the backend
  33. var nHomeSide = 0;    // this is HOME from the backend
  34. var nDefaultHomeTeam = 17;
  35. var nDefaultAwayTeam = 0;
  36.  
  37. function doSkin()
  38. {
  39.     skinChatTab.src = "../images2/widgets/" + System.GUI.getTeamSkin() + "/chat_tab.gif";
  40.     skinChatWindow.src = "../images2/widgets/" + System.GUI.getTeamSkin() + "/chat_window.gif";
  41. }
  42.  
  43. function initSettings()
  44. {        
  45.     oLeagueServer.LoadLeagueInternal(0,"");
  46.     System.Session.setPostGameLeague( "", 0 );
  47.     oExecutorServer.LoadExecutorInternal(0);
  48.     
  49.     
  50.     doSkin();
  51.  
  52.     // first thing to do is place ourselves in central if we are not currently
  53.     if (!oLeagueFace.ProviderInterface.IsInSetup())
  54.     {
  55.         oLeagueFace.ProviderInterface.EnterSetup();
  56.     }
  57.     else
  58.     {
  59.         bReadyForSecondInit = true;
  60.     }
  61.  
  62.     oCallbackTable = new CallbackTableObject();
  63.     inputDevice = new InputDeviceObject();
  64.     initGameInterface( oCallbackTable );
  65.  
  66.     if (oLeagueServer.LeagueType == 2)
  67.         initEASOGameType();    
  68.     
  69.     initSkillLevels();
  70.     initDrpAwayLeague();
  71.     initDrpHomeLeague();
  72.     drpAwayLeagues.Selected = getAwayLeagueIndex();
  73.     initDrpAwayTeam();
  74.     drpHomeLeagues.Selected = getHomeLeagueIndex();
  75.     initDrpHomeTeam();
  76.     initPlayers();
  77.     initOnline();    
  78.     initControllers();    
  79.  
  80.     if( !oLeagueFace.ProviderInterface.IsOnlineSetup() )
  81.     {
  82.         bReadyForSecondInit = true;        
  83.     }    
  84.     //else have to wait for gameInitClient 'ok' to proceed..
  85.     
  86.     bDoneFirstInit = true;
  87.     
  88.     if( bReadyForSecondInit )
  89.     {
  90.         initSettings2();
  91.     }    
  92.     
  93.     
  94.     //demo
  95.     drpAwayLeagues.style.visibility = "hidden";
  96.     drpHomeLeagues.style.visibility = "hidden";
  97.     drpAwayTeams.style.visibility = "hidden";
  98.     drpHomeTeams.style.visibility = "hidden";
  99. }
  100.  
  101. function OnReceivedGameSetup()
  102. {
  103.     bReadyForSecondInit = true;
  104.     
  105.     if( bDoneFirstInit )
  106.     {
  107.         initSettings2();
  108.     }
  109. }
  110.  
  111. //hooked to ReceivedGameSetup event in online case..
  112. function initSettings2()
  113. {
  114.     //gameInitClient is up, can proceed with init..
  115.  
  116.     if (!oGameData.CanSelectSide(1)) //can't select away
  117.     {
  118.         leftPlayers.style.visibility = 'hidden';
  119.         drpAwayLeagues.style.visibility = 'hidden';
  120.         drpAwayTeams.style.visibility = 'hidden';
  121.         arrow_0_left.style.visibility = 'hidden';
  122.         arrow_1_left.style.visibility = 'hidden';
  123.         arrow_2_left.style.visibility = 'hidden';
  124.         arrow_3_left.style.visibility = 'hidden';
  125.         arrow_4_left.style.visibility = 'hidden';
  126.         arrow_5_left.style.visibility = 'hidden';
  127.         btnSwap.style.visibility = 'hidden';
  128.         ratingsText.style.visibility = 'visible';
  129.         //awayRosterText.style.visibility = 'hidden';
  130.         //btnAwayRandom.style.visibility = 'hidden';
  131.  
  132.         controller_0.sliceTargetsHome();
  133.         controller_1.sliceTargetsHome();
  134.         controller_2.sliceTargetsHome();
  135.         controller_3.sliceTargetsHome();
  136.         controller_4.sliceTargetsHome();
  137.         controller_5.sliceTargetsHome();
  138.  
  139.         controller_0.targets="home_0,home_1,home_2,home_3,home_4,home_5";
  140.         controller_1.targets="home_0,home_1,home_2,home_3,home_4,home_5";
  141.         controller_2.targets="home_0,home_1,home_2,home_3,home_4,home_5";
  142.         controller_3.targets="home_0,home_1,home_2,home_3,home_4,home_5";
  143.         controller_4.targets="home_0,home_1,home_2,home_3,home_4,home_5";
  144.         controller_5.targets="home_0,home_1,home_2,home_3,home_4,home_5";
  145.     }
  146.  
  147.     if (!oGameData.CanSelectSide(0)) //can select away
  148.     {
  149.         rightPlayers.style.visibility = 'hidden';
  150.         drpHomeLeagues.style.visibility = 'hidden';
  151.         drpHomeTeams.style.visibility = 'hidden';
  152.         arrow_0_right.style.visibility = 'hidden';
  153.         arrow_1_right.style.visibility = 'hidden';
  154.         arrow_2_right.style.visibility = 'hidden';
  155.         arrow_3_right.style.visibility = 'hidden';
  156.         arrow_4_right.style.visibility = 'hidden';
  157.         arrow_5_right.style.visibility = 'hidden';
  158.         btnSwap.style.visibility = 'hidden';
  159.         ratingsText.style.visibility = 'visible';
  160.         //homeRosterText.style.visibility = 'hidden';
  161.         //btnHomeRandom.style.visibility = 'hidden';
  162.  
  163.         controller_0.sliceTargetsAway();
  164.         controller_1.sliceTargetsAway();
  165.         controller_2.sliceTargetsAway();
  166.         controller_3.sliceTargetsAway();
  167.         controller_4.sliceTargetsAway();
  168.         controller_5.sliceTargetsAway();
  169.  
  170.         controller_0.targets="away_0,away_1,away_2,away_3,away_4,away_5";
  171.         controller_1.targets="away_0,away_1,away_2,away_3,away_4,away_5";
  172.         controller_2.targets="away_0,away_1,away_2,away_3,away_4,away_5";
  173.         controller_3.targets="away_0,away_1,away_2,away_3,away_4,away_5";
  174.         controller_4.targets="away_0,away_1,away_2,away_3,away_4,away_5";
  175.         controller_5.targets="away_0,away_1,away_2,away_3,away_4,away_5";
  176.     }
  177.  
  178.     if (oGameData.getTeamList(1) == "")
  179.     {        
  180.         //hide drpdwn & arrows
  181.         drpAwayLeagues.style.visibility = 'hidden';
  182.         drpAwayTeams.style.visibility = 'hidden';
  183.         btnSwap.style.visibility = 'hidden';
  184.         ratingsText.style.visibility = 'visible';
  185.         drpSkillLevel.style.visibility = 'hidden';
  186.         skillHeader.style.visibility = 'visible';
  187.         //btnAwayRandom.style.visibility = 'hidden';
  188.     }
  189.  
  190.     if (oGameData.getTeamList(0) == "")
  191.     {        
  192.         //hide drpdwn & arrows
  193.         drpHomeLeagues.style.visibility = 'hidden';
  194.         drpHomeTeams.style.visibility = 'hidden';
  195.         btnSwap.style.visibility = 'hidden';
  196.         ratingsText.style.visibility = 'visible';
  197.         drpSkillLevel.style.visibility = 'hidden';
  198.         skillHeader.style.visibility = 'visible';
  199.         //btnHomeRandom.style.visibility = 'hidden';
  200.     }
  201.  
  202.     //FIXME Implement this: isLeagueGame()
  203.     if (!oGameData.canChangeRules() || oLeagueServer.LeagueType == 2)
  204.     {
  205.         drpSkillLevel.style.visibility = 'hidden';
  206.         skillHeader.style.visibility = 'visible';
  207.     }
  208.     else
  209.     {
  210.         drpSkillLevel.style.visibility = 'visible';
  211.         skillHeader.style.visibility = 'hidden';
  212.     }
  213.  
  214.     // add the play now button
  215.     System.GUI.nowBtns.showPlay();
  216.     System.GUI.nowBtns.onplayclick = OnReadyGame;
  217.     readyClicked = false;
  218.  
  219.     // set up the device callback
  220.     oGameFace.DeviceInterface.StartDevicePoll();
  221.  
  222.     localizeArt();    
  223. }
  224.  
  225. function localizeArt()
  226. {
  227.     var sFolder = "";
  228.     switch (window.external.GameInterface.ActiveLanguage)
  229.     {
  230.         case 1:        sFolder = "local_SWED";    break;
  231.         case 2:        sFolder = "local_GER";    break;
  232.         case 3:        sFolder = "local_FINN";    break;
  233.         case 4:        sFolder = "local_FR";    break;
  234.     }
  235.  
  236.     btnSwapImg.src = "../../nhl/images2/widgets/" + sFolder + "/swap00.gif";
  237.     top.document.all.menu_1_toggler_img.src = "../../nhl/images2/common/" + sFolder + "/top_menu_gamemodes00.gif";
  238.     top.document.all.menu_2_toggler_img.src = "../../nhl/images2/common/" + sFolder + "/top_menu_mynhl00.gif";
  239.     top.document.all.menu_3_toggler_img.src    = "../../nhl/images2/common/" + sFolder + "/top_menu_options00.gif";
  240.  
  241.     top.document.all.playNow_btn.children(0).src = "../../nhl/images2/widgets/" + sFolder + "/play_00.gif";    
  242. }
  243.  
  244. function initEASOGameType()
  245. {
  246.     System.Session.setPostGameNavigation( "1899", nhlMsg("EASO_MATCHUP_LOBBY") );
  247.     
  248.     proPlay = System.GUI.general.data[0];  //boolean
  249.     gameType = System.GUI.general.data[1]; //int
  250.             
  251.     //get awayTeam to appropriately display in game setup    
  252.     if (System.GUI.general.data[2] != "")
  253.     {            
  254.         setTimeout("initEASOAwayTeam()", 2000);
  255.     }
  256.  
  257.     //get homeTeam to appropriately display in game setup    
  258.     if (System.GUI.general.data[3] != "")
  259.     {            
  260.         setTimeout("initEASOHomeTeam()", 2000);
  261.     }            
  262.     
  263.     setEASOObjects();    
  264. }
  265.  
  266. function initEASOAwayTeam()
  267. {
  268.     if (oGameData.HomeTeam != nullTeamID) 
  269.     {
  270.         oGameData.AwayTeam = nEASOAwayTeam = parseInt(System.GUI.general.data[2]);                        
  271.         System.GUI.general.data[2] = "";            
  272.     }
  273.     else
  274.     {
  275.         OnHomeTeamChanged();
  276.         setTimeout("initEASOAwayTeam()", 2000);
  277.     }
  278. }
  279.  
  280. function initEASOHomeTeam()
  281. {
  282.     oGameData.HomeTeam = nEASOHomeTeam = parseInt(System.GUI.general.data[3]);                
  283.     System.GUI.general.data[3] = "";    
  284.     
  285.     if (parseInt(System.GUI.general.data[4]) != 0)
  286.     {
  287.         oGameData.LineChange(0) = parseInt(System.GUI.general.data[4]);
  288.         oGameData.LineChange(1) = parseInt(System.GUI.general.data[4]);
  289.     }            
  290. }
  291. function setEASOObjects()
  292. {
  293.     if (gameType == 0) //tournament
  294.     {
  295.         //can't select teams
  296.         //hide dropdowns & dice
  297.         //btnAwayRandom.style.visibility = "hidden";
  298.         //btnHomeRandom.style.visibility = "hidden";
  299.         drpAwayLeagues.style.visibility = "hidden";
  300.         drpAwayTeams.style.visibility = "hidden";
  301.         drpHomeLeagues.style.visibility = "hidden";
  302.         drpHomeTeams.style.visibility = "hidden";
  303.     }
  304.     else //matchup
  305.     {        
  306.         if (proPlay == "true")
  307.         {            
  308.             //can't select teams
  309.             //hide dropdowns & dice
  310.             //btnAwayRandom.style.visibility = "hidden";
  311.             //btnHomeRandom.style.visibility = "hidden";
  312.             drpAwayLeagues.style.visibility = "hidden";
  313.             drpAwayTeams.style.visibility = "hidden";
  314.             drpHomeLeagues.style.visibility = "hidden";
  315.             drpHomeTeams.style.visibility = "hidden";
  316.         }
  317.     }
  318.  
  319.     //hide "AT" & "SKILL LEVEL"
  320.     //drpSkillLevel.style.visibility = "hidden";
  321.     btnSwap.style.visibility = "hidden";
  322.     drpSkillLevel.style.visibility = "hidden";
  323.     skillText.style.visibility = "visible";            
  324. }
  325.  
  326. function clearSettings()
  327. {
  328.     oGameFace.RemoveLocalEventTable();
  329. }
  330.  
  331. function canExitScreen( /*screenID*/ )
  332. {
  333.     // drop the play now button
  334.     System.GUI.nowBtns.hide();
  335.  
  336.     // any access of transient interfaces needs to be handled in canExit
  337.     shutdownOnline();
  338.  
  339.     // kill the device callback
  340.     oGameFace.DeviceInterface.StopDevicePoll();
  341.  
  342.     //oLeagueFace.ManagerInterface.SaveGameSettings( oGameData );
  343.  
  344.     //mprjk: this check may be excessive, as canExitScreen currently isn't called on game launch..
  345.     /*
  346.     if( !gameLaunched )
  347.     {
  348.         oGameFace.CommInterface.ReportNoStart();
  349.         oGameFace.CommInterface.PurgeGameReporter();
  350.     }
  351.     */
  352.  
  353.     return true;
  354. }
  355.  
  356. var nCount = 0;
  357. function doRandom( nTeamSide )
  358. {
  359.     bRandom = true;    
  360.     //var aTeamId = oGameData.getTeamList( nTeamSide ).split(',');
  361.  
  362.     //var nRandomNumber = Math.round(Math.random()*parseInt(aTeamId.length/2 -1));
  363.     // temporary random function for NHL teams only
  364.  
  365.     //oLeagueFace.ManagerInterface.GetTeamInfo( aTeamId[nRandomNumber*2], oTeamInfo );
  366.  
  367.  
  368.     if ( nTeamSide )
  369.     {
  370.         var nRandomNumber = Math.round(Math.random()*parseInt(drpAwayTeams.Lists-1));
  371.         var oTeamInfo = new TeamInfoObject();
  372.         oLeagueFace.ManagerInterface.GetTeamInfo( awayTeamArray[nRandomNumber*2], oTeamInfo );
  373.     }
  374.     else
  375.     {
  376.         var nRandomNumber = Math.round(Math.random()*parseInt(drpHomeTeams.Lists-1));
  377.         var oTeamInfo = new TeamInfoObject();
  378.         oLeagueFace.ManagerInterface.GetTeamInfo( homeTeamArray[nRandomNumber*2], oTeamInfo );
  379.     }
  380.  
  381.     var sTeamLogoPath = "";
  382.     sTeamLogoPath = imgPath + oTeamInfo.sLogoFile;
  383.  
  384.     if ( nTeamSide )
  385.     {
  386.         window.document.all.awayTeamImage.src = sTeamLogoPath;
  387.     }
  388.     else
  389.     {
  390.         window.document.all.homeTeamImage.src = sTeamLogoPath;
  391.     }
  392.  
  393.     if (nCount < 5)
  394.     {
  395.         setTimeout("doRandom("+ nTeamSide + ")", 0);
  396.     }
  397.     else
  398.     {
  399.         nCount = 0;
  400.         ( nTeamSide ) ? changeAwayTeam( nRandomNumber ) : changeHomeTeam( nRandomNumber );
  401.         oAudioInterface.PlaySFX(1066);
  402.     }
  403.  
  404.     bRandom = false;
  405.     nCount++;
  406. }
  407.  
  408. function initOnline()
  409. {
  410.     if (oLeagueFace.ProviderInterface.IsOnlineSetup())
  411.     {    
  412.         drawerSpan.style.visibility = "visible";
  413.         initChat(20, 87, true);
  414.         bIsOnline = true;
  415.     }
  416.     else
  417.     {
  418.         drawerSpan.style.visibility = "hidden";
  419.         bIsOnline = false;
  420.     }
  421. }
  422.  
  423. function initSkillLevels()
  424. {
  425.     drpSkillLevel.Justify(0);
  426.     drpSkillLevel.FontPercent(95);
  427.  
  428.     drpSkillLevel.ClearAll();
  429.     for (var i=1; i<skillArray.length; i+=2)
  430.     {
  431.         drpSkillLevel.AddString(skillArray[i]);
  432.     }
  433.     oCallbackTable.LevelChanged();
  434. }
  435.  
  436. function initDrpAwayLeague()
  437. {
  438.     drpAwayLeagues.ClearAll();        
  439.     var leagueArray = oGameData.GetLeagueList().split(',');
  440.     
  441.     for (var i=0; i<leagueArray.length; i++)
  442.     {
  443.         drpAwayLeagues.AddString(leagueArray[i]);
  444.     }
  445. }
  446.  
  447. function initDrpAwayTeam()
  448. {    
  449.     drpAwayTeams.ClearAll();
  450.     if (oLeagueFace.ProviderInterface.IsOnlineSetup())
  451.         awayTeamArray = oGameData.GetLeagueTeamListOnline( drpAwayLeagues.Selected ).split(',');
  452.     else
  453.         awayTeamArray = oGameData.GetLeagueTeamList( drpAwayLeagues.Selected ).split(',');
  454.  
  455.     for (var i=1; i<awayTeamArray.length; i+=2)
  456.     {
  457.         drpAwayTeams.AddString(awayTeamArray[i]);
  458.     }
  459.  
  460.     drpAwayTeams.Selected = getIntArrayIndex(oGameData.AwayTeam, awayTeamArray);    
  461.     oCallbackTable.AwayTeamChanged();
  462. }
  463.  
  464. function initDrpHomeLeague()
  465. {
  466.     drpHomeLeagues.ClearAll();
  467.     var leagueArray = oGameData.GetLeagueList().split(',');
  468.     
  469.     for (var i=0; i<leagueArray.length; i++)
  470.     {
  471.         drpHomeLeagues.AddString(leagueArray[i]);
  472.     }
  473. }
  474.  
  475. function initDrpHomeTeam()
  476. {
  477.     drpHomeTeams.ClearAll();
  478.     if (oLeagueFace.ProviderInterface.IsOnlineSetup())
  479.         homeTeamArray = oGameData.GetLeagueTeamListOnline( drpHomeLeagues.Selected ).split(',');
  480.     else
  481.         homeTeamArray = oGameData.GetLeagueTeamList( drpHomeLeagues.Selected ).split(',');
  482.  
  483.     for (var i=1; i<homeTeamArray.length; i+=2)
  484.     {
  485.         drpHomeTeams.AddString(homeTeamArray[i]);
  486.     }
  487.  
  488.     drpHomeTeams.Selected = getIntArrayIndex(oGameData.HomeTeam, homeTeamArray);
  489.        oCallbackTable.HomeTeamChanged();
  490. }
  491.  
  492. function updateAwayTeam()
  493. {
  494.     oGameData.AwayTeam = awayTeamArray[0];
  495.     oCallbackTable.AwayTeamChanged();
  496. }
  497.  
  498. function updateHomeTeam()
  499. {
  500.     oGameData.HomeTeam = homeTeamArray[0];
  501.     oCallbackTable.HomeTeamChanged();
  502. }
  503.  
  504. function initControllers()
  505. {
  506.     if(inputDevice.keyboard)
  507.     {
  508.         controller_0.style.visibility = 'visible';
  509.         if(controller_0.playerId == null )
  510.         {
  511.             arrow_0_left.style.visibility      = 'visible';
  512.             arrow_0_right.style.visibility      = 'visible';
  513.         }
  514.     }
  515.     else
  516.     {
  517.         controller_0.style.visibility           = 'hidden';
  518.         arrow_0_left.style.visiblity          = 'hidden';
  519.         arrow_0_right.style.visiblity          = 'hidden';
  520.     }
  521.  
  522.     if(inputDevice.joystick1)
  523.     {
  524.         controller_1.style.visibility = 'visible';
  525.         if(controller_1.playerId == null )
  526.         {
  527.             arrow_1_left.style.visibility      = 'visible';
  528.             arrow_1_right.style.visibility      = 'visible';
  529.         }
  530.     }
  531.     else
  532.     {
  533.         controller_1.style.visibility       = 'hidden';
  534.         arrow_1_left.style.visibility      = 'hidden';
  535.         arrow_1_right.style.visibility      = 'hidden';
  536.     }
  537.  
  538.     if(inputDevice.joystick2)
  539.     {
  540.         controller_2.style.visibility = 'visible';
  541.         if(controller_2.playerId == null )
  542.         {
  543.             arrow_2_left.style.visibility      = 'visible';
  544.             arrow_2_right.style.visibility      = 'visible';
  545.         }
  546.     }
  547.     else
  548.     {
  549.         controller_2.style.visibility     = 'hidden';
  550.         arrow_2_left.style.visibility      = 'hidden';
  551.         arrow_2_right.style.visibility      = 'hidden';
  552.     }
  553.  
  554.     if(inputDevice.joystick3)
  555.     {
  556.         controller_3.style.visibility = 'visible';
  557.         if(controller_3.playerId == null )
  558.         {
  559.             arrow_3_left.style.visibility      = 'visible';
  560.             arrow_3_right.style.visibility      = 'visible';
  561.         }
  562.     }
  563.     else
  564.     {
  565.         controller_3.style.visibility     = 'hidden';
  566.         arrow_3_left.style.visibility      = 'hidden';
  567.         arrow_3_right.style.visibility      = 'hidden';
  568.     }
  569.  
  570.     if(inputDevice.joystick4)
  571.     {
  572.         controller_4.style.visibility = 'visible';
  573.         if(controller_4.playerId == null )
  574.         {
  575.             arrow_4_left.style.visibility      = 'visible';
  576.             arrow_4_right.style.visibility      = 'visible';
  577.         }
  578.     }
  579.     else
  580.     {
  581.         controller_4.style.visibility     = 'hidden';
  582.         arrow_4_left.style.visibility      = 'hidden';
  583.         arrow_4_right.style.visibility      = 'hidden';
  584.     }
  585.  
  586.     if(inputDevice.joystick5)
  587.     {
  588.         controller_5.style.visibility = 'visible';
  589.         if(controller_5.playerId == null )
  590.         {
  591.             arrow_5_left.style.visibility      = 'visible';
  592.             arrow_5_right.style.visibility      = 'visible';
  593.         }
  594.     }
  595.     else
  596.     {
  597.         controller_5.style.visibility     = 'hidden';
  598.         arrow_5_left.style.visibility      = 'hidden';
  599.         arrow_5_right.style.visibility      = 'hidden';
  600.     }
  601. }
  602.  
  603. function initPlayers()
  604. {
  605.     oCallbackTable.ControlsChanged();
  606. }
  607.  
  608. function chatUsersUpdatedCallback()
  609. {    
  610. }
  611.  
  612. function TeamInfoObject()
  613. {
  614.     this.OwnerID = 0;
  615.     this.Name = "";
  616.     this.FullName ="";
  617.     this.sLogoFile = "";
  618.     this.AbbrName = "";
  619.     this.Overall = 0;
  620.     this.Scoring = 0;
  621.     this.Defense = 0;
  622.     this.Checking = 0;
  623.     this.Powerplay = 0;
  624.     this.Goaltending = 0;
  625.     this.ArtID = -1;
  626. }
  627.  
  628. function getIntArrayIndex(nInt, oArray)
  629. {
  630.     if (nInt != "")
  631.     {
  632.         for (var i=0; i<oArray.length; i+=2)
  633.         {
  634.             if (oArray[i] == nInt)
  635.             {
  636.                 return i/2;
  637.             }
  638.         }
  639.     }
  640. }
  641.  
  642. function OnHomeTeamChanged()
  643. {        
  644.     if (oGameData.HomeTeam != nullTeamID)
  645.     {        
  646.         if (oLeagueServer.LeagueType != 2) 
  647.         {                    
  648.             setHomeTeam();        
  649.         }
  650.         else //easo                
  651.         {    
  652.             //if server
  653.             if (bHost)
  654.             {
  655.                 if (!System.GUI.general.data[6])
  656.                 {
  657.                     //if home team is easo team        
  658.                     if (oGameData.HomeTeam == nEASOHomeTeam)
  659.                     {                                    
  660.                         setHomeTeam();
  661.                         System.GUI.general.data[6] = true;
  662.                     }
  663.                     else //display Waiting for player msg
  664.                     {
  665.                         error_box_home.style.visibility = "visible";
  666.                     }
  667.                 }
  668.                 else
  669.                 {
  670.                     setHomeTeam();
  671.                 }
  672.             }
  673.             else
  674.             {
  675.                 setHomeTeam();
  676.             }
  677.         }                
  678.     }
  679.     else //display Waiting for player msg
  680.     {
  681.         error_box_home.style.visibility = "visible";
  682.     }
  683. }
  684.  
  685. function setHomeTeam()
  686. {        
  687.     teamInfo = new TeamInfoObject();
  688.     oGameData.GetTeamInfo(0,teamInfo);
  689.     error_box_home.style.visibility = "hidden";
  690.     changeTeamProperties( teamInfo , 0 );
  691.  
  692.     if (drpHomeLeagues.Selected != oGameData.HomeLeague)
  693.     {
  694.         drpHomeLeagues.Selected = oGameData.HomeLeague;        
  695.         setTimeout("initDrpHomeTeam()", 100);
  696.     }
  697.     drpHomeTeams.Selected = getIntArrayIndex(oGameData.HomeTeam, homeTeamArray);            
  698. }
  699.  
  700. function setEASOHomeTeam()
  701. {        
  702.     if (oGameData.HomeTeam == nEASOHomeTeam && !bHomeSet)
  703.     {        
  704.         bHomeSet = true;
  705.         teamInfo = new TeamInfoObject();
  706.         oGameData.GetTeamInfo(0,teamInfo);
  707.         error_box_home.style.visibility = "hidden";
  708.         changeTeamProperties( teamInfo , 0 );
  709.     
  710.         if (drpHomeLeagues.Selected != oGameData.HomeLeague)
  711.         {
  712.             drpHomeLeagues.Selected = oGameData.HomeLeague;        
  713.             setTimeout("initDrpHomeTeam()", 100);
  714.         }
  715.         drpHomeTeams.Selected = getIntArrayIndex(nEASOHomeTeam, homeTeamArray);            
  716.     }
  717.     else if (oGameData.HomeTeam != nEASOHomeTeam)
  718.     {    
  719.         oGameData.HomeTeam = nEASOHomeTeam;        
  720.     }
  721. }
  722.  
  723.  
  724. function OnAwayTeamChanged()
  725. {    
  726.     
  727.     if (oGameData.AwayTeam != nullTeamID)
  728.     {          
  729.         if (oLeagueServer.LeagueType != 2) 
  730.         {        
  731.             setAwayTeam();        
  732.         }
  733.         else //easo
  734.         {    
  735.             //if client    
  736.             if (!bHost)
  737.             {                
  738.                 //easo away team not yet set            
  739.                 if (!System.GUI.general.data[6])
  740.                 {                        
  741.                     //if away team is easo team        
  742.                     if (oGameData.AwayTeam == nEASOAwayTeam)
  743.                     {                            
  744.                         setAwayTeam();
  745.                         System.GUI.general.data[6] = true;                        
  746.                     }
  747.                     else //display Waiting for player msg
  748.                     {                        
  749.                         error_box_away.style.visibility = "visible";
  750.                     }
  751.                 }
  752.                 // now set.. so continue as usual
  753.                 else
  754.                 {                    
  755.                     setAwayTeam();
  756.                 }
  757.             }            
  758.             //if host... continue as usual
  759.             else
  760.             {                    
  761.                 setAwayTeam();
  762.             }
  763.         }
  764.     }
  765.     else //display Waiting for player msg
  766.     {
  767.         error_box_away.style.visibility = "visible";
  768.     }
  769. }
  770.  
  771. function setAwayTeam()
  772. {    
  773.     teamInfo = new TeamInfoObject();
  774.     oGameData.GetTeamInfo( 1,teamInfo );
  775.     error_box_away.style.visibility = "hidden";
  776.     changeTeamProperties( teamInfo , 1 );
  777.  
  778.     if (drpAwayLeagues.Selected != oGameData.AwayLeague)
  779.     {        
  780.         drpAwayLeagues.Selected = oGameData.AwayLeague;        
  781.         setTimeout("initDrpAwayTeam()", 100);
  782.     }
  783.     drpAwayTeams.Selected = getIntArrayIndex(oGameData.AwayTeam, awayTeamArray);        
  784. }
  785.  
  786. function setEASOAwayTeam()
  787. {    
  788.     if (oGameData.AwayTeam == nEASOAwayTeam && !bAwaySet)
  789.     {        
  790.         bAwaySet = true;
  791.         nEASOAwayTeam = -1;
  792.         teamInfo = new TeamInfoObject();
  793.         oGameData.GetTeamInfo(0,teamInfo);
  794.         error_box_away.style.visibility = "hidden";
  795.         changeTeamProperties( teamInfo , 0 );
  796.     
  797.         if (drpAwayLeagues.Selected != oGameData.AwayLeague)
  798.         {
  799.             drpAwayLeagues.Selected = oGameData.AwayLeague;        
  800.             setTimeout("initDrpAwayTeam()", 100);
  801.         }
  802.         drpAwayTeams.Selected = getIntArrayIndex(nEASOAwayTeam, awayTeamArray);            
  803.     }
  804.     else if (oGameData.AwayTeam != nEASOAwayTeam && !bHost)
  805.     {        
  806.         oGameData.AwayTeam = nEASOAwayTeam;
  807.     }
  808. }
  809.  
  810. function OnLevelChanged()
  811. {
  812.     drpSkillLevel.Selected = oGameData.Level;
  813.     skillText.innerText = skillArray[(oGameData.Level*2)+1];    
  814. }
  815.  
  816. function ControlSetObject()
  817. {
  818.     this.homeSlot0Local = 0;
  819.     this.homeSlot0Name = 0;
  820.     this.homeSlot0Control = 0;
  821.     this.homeSlot0Locked = 0;
  822.     this.homeSlot0Ready = 0;
  823.  
  824.     this.homeSlot1Local = 0;
  825.     this.homeSlot1Name = 0;
  826.     this.homeSlot1Control = 0;
  827.     this.homeSlot1Locked = 0;
  828.     this.homeSlot1Ready = 0;
  829.  
  830.     this.homeSlot2Local = 0;
  831.     this.homeSlot2Name = 0;
  832.     this.homeSlot2Control = 0;
  833.     this.homeSlot2Locked = 0;
  834.     this.homeSlot2Ready = 0;
  835.  
  836.     this.homeSlot3Local = 0;
  837.     this.homeSlot3Name = 0;
  838.     this.homeSlot3Control = 0;
  839.     this.homeSlot3Locked = 0;
  840.     this.homeSlot3Ready = 0;
  841.  
  842.     this.homeSlot4Local = 0;
  843.     this.homeSlot4Name = 0;
  844.     this.homeSlot4Control = 0;
  845.     this.homeSlot4Locked = 0;
  846.     this.homeSlot4Ready = 0;
  847.  
  848.     this.homeSlot5Local = 0;
  849.     this.homeSlot5Name = 0;
  850.     this.homeSlot5Control = 0;
  851.     this.homeSlot5Locked = 0;
  852.     this.homeSlot5Ready = 0;
  853.  
  854.     this.awaySlot0Local = 0;
  855.     this.awaySlot0Name = 0;
  856.     this.awaySlot0Control = 0;
  857.     this.awaySlot0Locked = 0;
  858.     this.awaySlot0Ready = 0;
  859.  
  860.     this.awaySlot1Local = 0;
  861.     this.awaySlot1Name = 0;
  862.     this.awaySlot1Control = 0;
  863.     this.awaySlot1Locked = 0;
  864.     this.awaySlot1Ready = 0;
  865.  
  866.     this.awaySlot2Local = 0;
  867.     this.awaySlot2Name = 0;
  868.     this.awaySlot2Control = 0;
  869.     this.awaySlot2Locked = 0;
  870.     this.awaySlot2Ready = 0;
  871.  
  872.     this.awaySlot3Local = 0;
  873.     this.awaySlot3Name = 0;
  874.     this.awaySlot3Control = 0;
  875.     this.awaySlot3Locked = 0;
  876.     this.awaySlot3Ready = 0;
  877.  
  878.     this.awaySlot4Local = 0;
  879.     this.awaySlot4Name = 0;
  880.     this.awaySlot4Control = 0;
  881.     this.awaySlot4Locked = 0;
  882.     this.awaySlot4Ready = 0;
  883.  
  884.     this.awaySlot5Local = 0;
  885.     this.awaySlot5Name = 0;
  886.     this.awaySlot5Control = 0;
  887.     this.awaySlot5Locked = 0;
  888.     this.awaySlot5Ready = 0;
  889. }
  890.  
  891. function setSlotIcon (slot, slotName, slotLocal, slotReady)
  892. {
  893.  
  894.     if (slotName != "")
  895.     {
  896.         if (!slotLocal)
  897.         {
  898.             if (!slotReady)
  899.             {
  900.                 document.all[slot.id + "_icon"].style.visibility = "visible";
  901.                 document.all[slot.id + "_ready"].style.visibility = "hidden";
  902.             }
  903.             else
  904.             {
  905.                 document.all[slot.id + "_icon"].style.visibility = "hidden";
  906.                 document.all[slot.id + "_ready"].style.visibility = "visible";
  907.             }
  908.         }
  909.     }
  910.     else
  911.     {
  912.         document.all[slot.id + "_icon"].style.visibility = "hidden";
  913.         document.all[slot.id + "_ready"].style.visibility = "hidden";
  914.     }
  915. }
  916.  
  917. function OnControlsChanged()
  918. {
  919.     controlSet = new ControlSetObject();
  920.  
  921.     oGameData.GetSlotControllers(controlSet);
  922.  
  923.     home_0.controllerLocal        = controlSet.homeSlot0Local;
  924.     home_0.controllerName         = controlSet.homeSlot0Name;
  925.     home_0.controllerId           = controlSet.homeSlot0Control;
  926.     home_0_lock.controllerLocked  = controlSet.homeSlot0Locked;
  927.  
  928.     setSlotIcon(home_0, controlSet.homeSlot0Name, controlSet.homeSlot0Local, controlSet.homeSlot0Ready);
  929.  
  930.     home_1.controllerLocal        = controlSet.homeSlot1Local;
  931.     home_1.controllerName         = controlSet.homeSlot1Name;
  932.     home_1.controllerId           = controlSet.homeSlot1Control;
  933.     home_1_lock.controllerLocked  = controlSet.homeSlot1Locked;
  934.     //(!controlSet.homeSlot1Local && controlSet.homeSlot1Name!="") ? home_1_icon.style.visibility = "visible" : home_1_icon.style.visibility = "hidden";
  935.     //(controlSet.homeSlot1Ready) ? home_1_icon.style.visibility = "hidden" : home_1_ready.visibility = "visible";
  936.     setSlotIcon(home_1, controlSet.homeSlot1Name, controlSet.homeSlot1Local, controlSet.homeSlot1Ready);
  937.  
  938.     home_2.controllerLocal        = controlSet.homeSlot2Local;
  939.     home_2.controllerName         = controlSet.homeSlot2Name;
  940.     home_2.controllerId           = controlSet.homeSlot2Control;
  941.     home_2_lock.controllerLocked  = controlSet.homeSlot2Locked;
  942.     //(!controlSet.homeSlot2Local && controlSet.homeSlot2Name!="") ? home_2_icon.style.visibility = "visible" : home_2_icon.style.visibility = "hidden";
  943.     //(controlSet.homeSlot2Ready) ? home_2_icon.style.visibility = "hidden" : home_2_ready.visibility = "visible";
  944.     setSlotIcon(home_2, controlSet.homeSlot2Name, controlSet.homeSlot2Local, controlSet.homeSlot2Ready);
  945.  
  946.     home_3.controllerLocal        = controlSet.homeSlot3Local;
  947.     home_3.controllerName         = controlSet.homeSlot3Name;
  948.     home_3.controllerId           = controlSet.homeSlot3Control;
  949.     home_3_lock.controllerLocked  = controlSet.homeSlot3Locked;
  950.     //(!controlSet.homeSlot3Local && controlSet.homeSlot3Name!="") ? home_3_icon.style.visibility = "visible" : home_3_icon.style.visibility = "hidden";
  951.     //(controlSet.homeSlot3Ready) ? home_3_icon.style.visibility = "hidden" : home_3_ready.visibility = "visible";
  952.     setSlotIcon(home_3, controlSet.homeSlot3Name, controlSet.homeSlot3Local, controlSet.homeSlot3Ready);
  953.  
  954.     home_4.controllerLocal        = controlSet.homeSlot4Local;
  955.     home_4.controllerName         = controlSet.homeSlot4Name;
  956.     home_4.controllerId           = controlSet.homeSlot4Control;
  957.     home_4_lock.controllerLocked  = controlSet.homeSlot4Locked;
  958.     //(!controlSet.homeSlot4Local && controlSet.homeSlot4Name!="") ? home_4_icon.style.visibility = "visible" : home_4_icon.style.visibility = "hidden";
  959.     //(controlSet.homeSlot4Ready) ? home_4_icon.style.visibility = "hidden" : home_4_ready.visibility = "visible";
  960.     setSlotIcon(home_4, controlSet.homeSlot4Name, controlSet.homeSlot4Local, controlSet.homeSlot4Ready);
  961.  
  962.     home_5.controllerLocal        = controlSet.homeSlot5Local;
  963.     home_5.controllerName         = controlSet.homeSlot5Name;
  964.     home_5.controllerId           = controlSet.homeSlot5Control;
  965.     home_5_lock.controllerLocked  = controlSet.homeSlot5Locked;
  966.     //(!controlSet.homeSlot5Local && controlSet.homeSlot5Name!="") ? home_5_icon.style.visibility = "visible" : home_5_icon.style.visibility = "hidden";
  967.     //(controlSet.homeSlot5Ready) ? home_5_icon.style.visibility = "hidden" : home_5_ready.visibility = "visible";
  968.     setSlotIcon(home_5, controlSet.homeSlot5Name, controlSet.homeSlot5Local, controlSet.homeSlot5Ready);
  969.  
  970.     away_0.controllerLocal        = controlSet.awaySlot0Local;
  971.     away_0.controllerName         = controlSet.awaySlot0Name;
  972.     away_0.controllerId           = controlSet.awaySlot0Control;
  973.     away_0_lock.controllerLocked  = controlSet.awaySlot0Locked;
  974.     //(!controlSet.awaySlot0Local && controlSet.awaySlot0Name!="") ? away_0_icon.style.visibility = "visible" : away_0_icon.style.visibility = "hidden";
  975.     //(controlSet.awaySlot0Ready) ? away_0_icon.style.visibility = "hidden" : away_0_ready.visibility = "visible";
  976.     setSlotIcon(away_0, controlSet.awaySlot0Name, controlSet.awaySlot0Local, controlSet.awaySlot0Ready);
  977.  
  978.     away_1.controllerLocal        = controlSet.awaySlot1Local;
  979.     away_1.controllerName         = controlSet.awaySlot1Name;
  980.     away_1.controllerId           = controlSet.awaySlot1Control;
  981.     away_1_lock.controllerLocked       = controlSet.awaySlot1Locked;
  982.     //(!controlSet.awaySlot1Local && controlSet.awaySlot1Name!="") ? away_1_icon.style.visibility = "visible" : away_1_icon.style.visibility = "hidden";
  983.     //(controlSet.awaySlot1Ready) ? away_1_icon.style.visibility = "hidden" : away_1_ready.visibility = "visible";
  984.     setSlotIcon(away_1, controlSet.awaySlot1Name, controlSet.awaySlot1Local, controlSet.awaySlot1Ready);
  985.  
  986.     away_2.controllerLocal        = controlSet.awaySlot2Local;
  987.     away_2.controllerName         = controlSet.awaySlot2Name;
  988.     away_2.controllerId           = controlSet.awaySlot2Control;
  989.     away_2_lock.controllerLocked       = controlSet.awaySlot2Locked;
  990.     //(!controlSet.awaySlot2Local && controlSet.awaySlot2Name!="") ? away_2_icon.style.visibility = "visible" : away_2_icon.style.visibility = "hidden";
  991.     //(controlSet.awaySlot2Ready) ? away_2_icon.style.visibility = "hidden" : away_2_ready.visibility = "visible";
  992.     setSlotIcon(away_2, controlSet.awaySlot2Name, controlSet.awaySlot2Local, controlSet.awaySlot2Ready);
  993.  
  994.     away_3.controllerLocal        = controlSet.awaySlot3Local;
  995.     away_3.controllerName         = controlSet.awaySlot3Name;
  996.     away_3.controllerId           = controlSet.awaySlot3Control;
  997.     away_3_lock.controllerLocked       = controlSet.awaySlot3Locked;
  998.     //(!controlSet.awaySlot3Local && controlSet.awaySlot3Name!="") ? away_3_icon.style.visibility = "visible" : away_3_icon.style.visibility = "hidden";
  999.     //(controlSet.awaySlot3Ready) ? away_3_icon.style.visibility = "hidden" : away_3_ready.visibility = "visible";
  1000.     setSlotIcon(away_3, controlSet.awaySlot3Name, controlSet.awaySlot3Local, controlSet.awaySlot3Ready);
  1001.  
  1002.     away_4.controllerLocal        = controlSet.awaySlot4Local;
  1003.     away_4.controllerName         = controlSet.awaySlot4Name;
  1004.     away_4.controllerId           = controlSet.awaySlot4Control;
  1005.     away_4_lock.controllerLocked       = controlSet.awaySlot4Locked;
  1006.     //(!controlSet.awaySlot4Local && controlSet.awaySlot4Name!="") ? away_4_icon.style.visibility = "visible" : away_4_icon.style.visibility = "hidden";
  1007.     //(controlSet.awaySlot4Ready) ? away_4_icon.style.visibility = "hidden" : away_4_ready.visibility = "visible";
  1008.     setSlotIcon(away_4, controlSet.awaySlot4Name, controlSet.awaySlot4Local, controlSet.awaySlot4Ready);
  1009.  
  1010.     away_5.controllerLocal        = controlSet.awaySlot5Local;
  1011.     away_5.controllerName         = controlSet.awaySlot5Name;
  1012.     away_5.controllerId           = controlSet.awaySlot5Control;
  1013.     away_5_lock.controllerLocked  = controlSet.awaySlot5Locked;
  1014.     //(!controlSet.awaySlot5Local && controlSet.awaySlot5Name!="") ? away_5_icon.style.visibility = "visible" : away_5_icon.style.visibility = "hidden";
  1015.     //(controlSet.awaySlot5Ready) ? away_5_icon.style.visibility = "hidden" : away_5_ready.visibility = "visible";
  1016.     setSlotIcon(away_5, controlSet.awaySlot5Name, controlSet.awaySlot5Local, controlSet.awaySlot5Ready);
  1017. }
  1018.  
  1019. /* Game Launch */
  1020.  
  1021. function OnReadyGame()
  1022. {
  1023.     if (System.GUI.isNavigating()) { return; }
  1024.     
  1025.     //if easo or online mode, make sure user has selected a side
  1026.     //if (oLeagueServer.LeagueType == 1 || oLeagueServer.LeagueType == 2)
  1027.     //{
  1028.     //}    
  1029.         
  1030.  
  1031.     if (!readyClicked)
  1032.     {
  1033.         // put up a dialog box and indicate we are in ready to go mode
  1034.         if (oLeagueFace.ProviderInterface.IsOnlineSetup())
  1035.         {
  1036.             //if (oGameData.CanAlterSide(0) || oGameData.CanAlterSide(1))
  1037.             //{
  1038.             
  1039.             if (controller_0.playerId == null && controller_1.playerId == null &&
  1040.                 controller_2.playerId == null && controller_3.playerId == null &&
  1041.                 controller_4.playerId == null && controller_5.playerId == null)
  1042.             {        
  1043.                 
  1044.                 oAudioInterface.PlayWarningSFX();
  1045.                 System.GUI.dialog.innerHTML = nhlMsg("NO_SIDE_MESSAGE");
  1046.                 System.GUI.dialog.setSize( 350 , 120 );
  1047.                 System.GUI.dialog.align = "center";
  1048.                 System.GUI.dialog.addButton( "okButton" , nhlMsg("OK", true), OnUnReadyGame);
  1049.                 System.GUI.dialog.show(true);        
  1050.             }
  1051.             else
  1052.             {
  1053.                 oAudioInterface.PlayWarningSFX();
  1054.                 System.GUI.dialog.innerHTML = nhlMsg("WAITING_READY");
  1055.                 System.GUI.dialog.setSize( 350 , 120 );
  1056.                 System.GUI.dialog.align = "center";
  1057.                 System.GUI.dialog.addButton( "okButton" , nhlMsg("NOT_READY", true), OnUnReadyGame);
  1058.                 System.GUI.dialog.show(true);
  1059.     
  1060.                 //halt chat detection..
  1061.                 shutdownOnline();
  1062.     
  1063.                 // kill the device callback
  1064.                 oGameFace.DeviceInterface.StopDevicePoll();
  1065.                 oGameData.ReadyGame();
  1066.                 readyClicked = true;
  1067.             }
  1068.             /*
  1069.             }
  1070.             else
  1071.             {
  1072.                 oAudioInterface.PlayWarningSFX();
  1073.                 // need to select a side
  1074.                 System.GUI.dialog.innerHTML = nhlMsg("HUMAN_CONTROLLED_MSG");
  1075.                 System.GUI.dialog.setSize( 350 , 120 );
  1076.                 System.GUI.dialog.align = "center";
  1077.                 System.GUI.dialog.addButton( "okButton" , nhlMsg("OKAY", true));
  1078.                 System.GUI.dialog.show(true);
  1079.             }
  1080.             */
  1081.         }
  1082.         else
  1083.         {
  1084.             // kill the device callback
  1085.             oGameFace.DeviceInterface.StopDevicePoll();
  1086.             oGameData.ReadyGame();
  1087.             readyClicked = true;
  1088.         }
  1089.     }    
  1090. }
  1091.  
  1092. function OnUnReadyGame()
  1093. {
  1094.     if (readyClicked && !gameLaunched)
  1095.     {
  1096.         oGameData.UnReadyGame();
  1097.         // set up the device callback
  1098.         oGameFace.DeviceInterface.StartDevicePoll();
  1099.         oGameFace.CommInterface.InitGameChat();
  1100.  
  1101.         readyClicked = false;
  1102.     }
  1103. }
  1104.  
  1105. function OnStartGame()
  1106. {
  1107.     if (oLeagueServer.LeagueType == 2)
  1108.     {
  1109.         oGameFace.OnlinGameState = "EASO";        
  1110.     }
  1111.     
  1112.     gameLaunched = true;
  1113.  
  1114.     oAudioInterface.PlayPlayGameSFX();
  1115.     // tell the user we are going into game
  1116.     System.GUI.dialog.innerHTML = "<center>" + nhlMsg("LOADING_GAME") + "</center><br><br><img src='" + System.getInstallFolder() + "fe/nhl/images2/widgets/load_sm.gif'>";
  1117.     System.GUI.dialog.setSize( 400 , 100 );
  1118.     System.GUI.dialog.align = "center";
  1119.     System.GUI.dialog.setStyle("NONE");
  1120.     System.GUI.dialog.show( true );
  1121.  
  1122. }
  1123.  
  1124. function OnExecuteGame()
  1125. {
  1126.     //oLeagueFace.ManagerInterface.SaveGameSettings( oGameData );
  1127.     oLeagueFace.ProviderInterface.ExitSetup(0);
  1128.     // the correct executor should have been loaded
  1129.     oGameFace.ExecutorServerInterface.ExecutorDispatch.ExecuteGame(oLeagueFace.ProviderInterface.GameDataInterface,oLeagueFace.ProviderInterface.GleanDataInterface);
  1130. }
  1131.  
  1132. /* End Game Launch */
  1133.  
  1134. function CallbackTableObject()
  1135. {
  1136.     this.HomeTeamChanged = OnHomeTeamChanged;
  1137.     this.AwayTeamChanged = OnAwayTeamChanged;
  1138.     this.LevelChanged = OnLevelChanged;
  1139.     this.ControlsChanged = OnControlsChanged;
  1140.     this.ExecuteGame = OnExecuteGame;
  1141.     this.StartGame = OnStartGame;
  1142.     this.ChatUsersUpdated = OnChatUsersUpdated;
  1143.     this.ChatUpdated = OnChatUpdated;
  1144.     this.DeviceInputDetected = OnDeviceMove;
  1145.     this.ReceivedGameSetup = OnReceivedGameSetup;
  1146. }
  1147.  
  1148. function OnDeviceMove()
  1149. {
  1150.     // this means someone has moved a device attached to the game
  1151.     // we can choose to do what we want with it.
  1152.  
  1153.     var deviceEvent = new Object();
  1154.     deviceEvent.deviceID = 0;
  1155.     deviceEvent.event = 0;
  1156.  
  1157.     var controller;
  1158.  
  1159.     if (oGameFace.DeviceInterface.GetDevicePoll(deviceEvent))
  1160.     {
  1161.         switch (deviceEvent.deviceID)
  1162.         {
  1163.             case 0:
  1164.                 //keyboard
  1165.                 controller = controller_0;
  1166.                 break;
  1167.             case 1:
  1168.                 //joystick
  1169.                 controller = controller_1;
  1170.                 break;
  1171.             case 2:
  1172.                 //joystick
  1173.                 controller = controller_2;
  1174.                 break;
  1175.             case 3:
  1176.                 //joystick
  1177.                 controller = controller_3;
  1178.                 break;
  1179.             case 4:
  1180.                 //joystick
  1181.                 controller = controller_4;
  1182.                 break;
  1183.             case 5:
  1184.                 //joystick
  1185.                 controller = controller_5;
  1186.                 break;
  1187.         }
  1188.  
  1189.         if (!(deviceEvent.deviceID == 0 && bChatHasFocus))
  1190.         {
  1191.             switch (deviceEvent.event)
  1192.             {
  1193.                 case 0:
  1194.                     //up
  1195.                     moveControllerUp(controller);
  1196.                     break;
  1197.                 case 1:
  1198.                     //down
  1199.                     moveControllerDown(controller);
  1200.                     break;
  1201.                 case 2:
  1202.                     //left
  1203.                     moveControllerLeft(controller);
  1204.                     break;
  1205.                 case 3:
  1206.                     // right
  1207.                     moveControllerRight(controller);
  1208.                     break;
  1209.             }
  1210.         }
  1211.     }
  1212. }
  1213.  
  1214. function moveControllerLeft(controllerId)
  1215. {
  1216.     //find out where the keyboard pog is
  1217.     if (controllerId.playerId != null)
  1218.     {
  1219.         //if it's on home_x then move back to the middle
  1220.         if (controllerId.playerId.match("home"))
  1221.         {
  1222.             controllerId.resetPosition();
  1223.             controllerId.DoSetController(0);
  1224.             oAudioInterface.PlayControllerMoveSFX();
  1225.         }
  1226.     }
  1227.     else
  1228.     {
  1229.         //else if it's on the middle then move to away_x
  1230.         if(controllerId.targets.match("away"))
  1231.         {
  1232.             controllerId.moveToPlayer("away_0");
  1233.             //moveController(away_0, 0);
  1234.             controllerId.DoSetController(0);
  1235.             oAudioInterface.PlayControllerMoveSFX();
  1236.         }
  1237.     }
  1238. }
  1239.  
  1240.  
  1241. function moveControllerRight(controllerId)
  1242.  
  1243. {
  1244.     //find out where the keyboard pog is
  1245.     if (controllerId.playerId != null)
  1246.     {
  1247.         //if it's on away_x then move back to the middle
  1248.         if (controllerId.playerId.match("away"))
  1249.         {
  1250.             controllerId.resetPosition();
  1251.             controllerId.DoSetController(0);
  1252.             oAudioInterface.PlayControllerMoveSFX();
  1253.         }
  1254.     }
  1255.     else
  1256.     {
  1257.         //else if it's on the middle then move to home_x
  1258.         if(controllerId.targets.match("home"))
  1259.         {
  1260.             controllerId.moveToPlayer("home_0");
  1261.             //moveController(home_0, 0);
  1262.             controllerId.DoSetController(0);
  1263.             oAudioInterface.PlayControllerMoveSFX();
  1264.         }
  1265.     }
  1266.  
  1267. }
  1268.  
  1269. function moveControllerUp(controllerId)
  1270. {
  1271.     var i = 0;
  1272.     var count = 1;
  1273.  
  1274.     //find out where the keyboard pog is
  1275.     if (controllerId.playerId != null)
  1276.     {
  1277.         //if it's not on 0 slot move it up
  1278.         if (!controllerId.playerId.match("_0"))
  1279.         {
  1280.             //parse the number out of the id
  1281.             var nSlotNum = parseInt(controllerId.playerId.substring(controllerId.playerId.indexOf("_")+1, controllerId.playerId.length));
  1282.             //parse the name out of the id
  1283.             var sSlotName = controllerId.playerId.substring(0, controllerId.playerId.indexOf("_")+1);
  1284.  
  1285.             //loop if spot is taken until first available slot
  1286.             do
  1287.             {
  1288.                 i = nSlotNum - count;
  1289.                 count++;
  1290.             }
  1291.             while (document.all[sSlotName + i].hasController == "true" && i > 0)
  1292.  
  1293.             //if -1, no avail. spots: do not move controller
  1294.             if (i > -1)
  1295.             {
  1296.                 controllerId.moveToPlayer(sSlotName + i);
  1297.                 //moveController(document.all[sSlotName + i], 0);
  1298.                 oAudioInterface.PlayControllerMoveSFX();
  1299.  
  1300.                 if (!bIsOnline)
  1301.                     controllerId.DoSetController((count-1));
  1302.                 else
  1303.                     controllerId.DoSetController(0);
  1304.             }
  1305.         }
  1306.     }
  1307. }
  1308.  
  1309. function moveControllerDown(controllerId)
  1310. {
  1311.     var i = 0;
  1312.     var count = 1;
  1313.  
  1314.     //find out where the keyboard pog is
  1315.     if (controllerId.playerId != null)
  1316.     {
  1317.         //if it's not on 5th slot move it down
  1318.         if (!controllerId.playerId.match("_5"))
  1319.         {
  1320.             //parse the number out of the id
  1321.             var nSlotNum = parseInt(controllerId.playerId.substring(controllerId.playerId.indexOf("_")+1, controllerId.playerId.length));
  1322.             //parse the name out of the id
  1323.             var sSlotName = controllerId.playerId.substring(0, controllerId.playerId.indexOf("_")+1);
  1324.  
  1325.             //loop if spot is taken until last available slot
  1326.             do
  1327.             {
  1328.                 i = nSlotNum + count;
  1329.                 count++;
  1330.  
  1331.                 if (i == 6)
  1332.                     break;
  1333.             }
  1334.             while (document.all[sSlotName + i].hasController == "true")
  1335.  
  1336.             //if -1, no avail. spots: do not move controller
  1337.             if (i < 6)
  1338.             {
  1339.                 controllerId.moveToPlayer(sSlotName + i);
  1340.                 //moveController(document.all[sSlotName + i], 0);
  1341.                 oAudioInterface.PlayControllerMoveSFX();
  1342.  
  1343.                 if (!bIsOnline)
  1344.                     controllerId.DoSetController((count-1)*-1);
  1345.                 else
  1346.                     controllerId.DoSetController(0);
  1347.             }
  1348.         }
  1349.     }
  1350. }
  1351.  
  1352. function InputDeviceObject()
  1353. {
  1354.     this.keyboard = 0;
  1355.     this.joystick1 = 0;
  1356.     this.joystick2 = 0;
  1357.     this.joystick3 = 0;
  1358.     this.joystick4 = 0;
  1359.     this.joystick5 = 0;
  1360.  
  1361.     oGameFace.DeviceInterface.GetInputDevices(this);
  1362. }
  1363.  
  1364. function changeLevel()
  1365. {
  1366.     oGameData.Level = drpSkillLevel.Selected;
  1367. }
  1368.  
  1369. function changeHomeTeam( nIndex )
  1370. {
  1371.     //(arguments.length == 0) ? oGameData.HomeTeam = drpHomeTeam.value : oGameData.HomeTeam = nIndex;
  1372.     (arguments.length == 0) ? oGameData.HomeTeam = homeTeamArray[drpHomeTeam.Selected*2] : oGameData.HomeTeam = homeTeamArray[nIndex*2];
  1373. }
  1374.  
  1375. function changeAwayTeam( nIndex )
  1376. {    
  1377.     //(arguments.length == 0) ? oGameData.AwayTeam = drpAwayTeam.value : oGameData.AwayTeam = nIndex;
  1378.     (arguments.length == 0) ? oGameData.AwayTeam = awayTeamArray[drpAwayTeams.Selected*2] : oGameData.AwayTeam = awayTeamArray[nIndex*2];
  1379. }
  1380.  
  1381. function changeController(team, control, slot)
  1382. {
  1383.     oGameData.SetControllerToSlot(team, control, slot);
  1384. }
  1385.  
  1386. function removeController(team, control, slot)
  1387. {
  1388.     oGameData.RemoveControllerFromSlot(team, control, slot)
  1389. }
  1390.  
  1391. function changeControllerLock(team, lock, slot)
  1392. {
  1393.     if( lock )
  1394.     {
  1395.         oAudioInterface.PlayLockCloseSFX();
  1396.     }
  1397.     else
  1398.     {
  1399.         oAudioInterface.PlayLockOpenSFX();
  1400.     }
  1401.     oGameData.SetSlotLockStatus(team, lock, slot);
  1402. }
  1403.  
  1404. function SwapTeams()
  1405. {
  1406.     oAudioInterface.PlaySFX(1103);
  1407.     
  1408.     //swap league drop downs
  1409.     var nHomeLeague = drpHomeLeagues.Selected;
  1410.     var nAwayLeague = drpAwayLeagues.Selected;
  1411.  
  1412.     drpHomeLeagues.Selected = nAwayLeague;
  1413.     drpAwayLeagues.Selected = nHomeLeague;
  1414.  
  1415.     initDrpHomeTeam();
  1416.     initDrpAwayTeam();
  1417.     
  1418.     oGameData.SwapTeams();
  1419. }
  1420.  
  1421. /* ////////////////// DROP DOWN ///////////////////////////*/
  1422. function nextItem( oSelectBox , nAway )
  1423. {
  1424.     oAudioInterface.PlaySpinnerSFX();
  1425.     if (nAway==1)
  1426.         var nNextIndex = nAwayTeamIndex + 1;
  1427.     else
  1428.         var nNextIndex = nHomeTeamIndex + 1;
  1429.  
  1430.     ( nNextIndex < oSelectBox.length ) ? oSelectBox.SetSelectionIndex( nNextIndex ):oSelectBox.SetSelectionIndex( 1 );
  1431.     ( nAway == 1 ) ? changeAwayTeam( oSelectBox.value ) : changeHomeTeam( oSelectBox.value );
  1432. }
  1433.  
  1434. function previousItem( oSelectBox , nAway )
  1435. {
  1436.     oAudioInterface.PlaySpinnerSFX();
  1437.     if (nAway==1)
  1438.         var nPrevIndex = nAwayTeamIndex - 1;
  1439.     else
  1440.         var nPrevIndex = nHomeTeamIndex - 1;
  1441.  
  1442.     ( nPrevIndex > 0 ) ? oSelectBox.SetSelectionIndex( nPrevIndex ) : oSelectBox.SetSelectionIndex( oSelectBox.length-1 );
  1443.     ( nAway == 1 ) ? changeAwayTeam( oSelectBox.value ) : changeHomeTeam( oSelectBox.value );
  1444. }
  1445.  
  1446. /* TEAM SWAP*/
  1447. function changeTeamProperties( oTeam , nAway )
  1448. {
  1449.     var oOverall;
  1450.     var oScoring;
  1451.     var oDefense;
  1452.     var oChecking;
  1453.     var oPowerPlay;
  1454.     var oGoalTending;
  1455.     var oFullName;
  1456.     var oImage=null;
  1457.  
  1458.     if(!nAway)
  1459.     {
  1460.         oOverall        = window.document.all.homeTeamOverall;
  1461.         oScoring        = window.document.all.homeTeamScoring;
  1462.         oDefense        = window.document.all.homeTeamDefense;
  1463.         oChecking       = window.document.all.homeTeamChecking;
  1464.         oPowerPlay      = window.document.all.homeTeamPowerPlay;
  1465.         oGoalTending    = window.document.all.homeTeamGoalTending;
  1466.         oFullName       = window.document.all.homeTeamFullName;
  1467.         oImage          = window.document.all.homeTeamImage;
  1468.         //homeTeam_name_white.innerText     = oTeam.Name.toUpperCase();
  1469.         //homeTeam_name.innerText          = oTeam.Name.toUpperCase();
  1470.         homeTeamOwnerID = oTeam.OwnerID;
  1471.         //homeRosterText.innerText = nhlMsg("ROSTER") + ": " + getPlayerName(homeTeamOwnerID);
  1472.     }
  1473.     else
  1474.     {
  1475.         oOverall        = window.document.all.awayTeamOverall;
  1476.         oScoring        = window.document.all.awayTeamScoring;
  1477.         oDefense        = window.document.all.awayTeamDefense;
  1478.         oChecking       = window.document.all.awayTeamChecking;
  1479.         oPowerPlay      = window.document.all.awayTeamPowerPlay;
  1480.         oGoalTending    = window.document.all.awayTeamGoalTending;
  1481.         oFullName       = window.document.all.awayTeamFullName;
  1482.         oImage          = window.document.all.awayTeamImage;
  1483.         //awayTeam_name_white.innerText     = oTeam.Name.toUpperCase();
  1484.         //awayTeam_name.innerText          = oTeam.Name.toUpperCase();
  1485.         awayTeamOwnerID = oTeam.OwnerID;
  1486.         //awayRosterText.innerText = nhlMsg("ROSTER") + ": " + getPlayerName(awayTeamOwnerID);
  1487.     }
  1488.  
  1489.      oOverall.innerText     = oTeam.Overall;
  1490.      oScoring.innerText     = oTeam.Scoring;
  1491.      oDefense.innerText     = oTeam.Defense;
  1492.      oChecking.innerText    = oTeam.Checking;
  1493.      oPowerPlay.innerText   = oTeam.Powerplay;
  1494.      oGoalTending.innerText = oTeam.Goaltending;
  1495.      //oFullName.innerText    = oTeam.FullName;
  1496.  
  1497.     var sTeamLogoPath = imgPath + oTeam.sLogoFile;
  1498.  
  1499.      if (!bRandom)
  1500.          xFadeTransition(oImage, sTeamLogoPath);
  1501.      else
  1502.            oImage.src = sTeamLogoPath;
  1503. }
  1504.  
  1505. function xFadeTransition (oImage, sNewImage)
  1506. {
  1507.     oImage.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=.15);";
  1508.     oImage.filters[0].Apply();
  1509.     oImage.src=sNewImage;
  1510.     oImage.filters[0].Play();
  1511. }
  1512.  
  1513. /* PLAYER */
  1514. //var nCount=0;
  1515. function doSelect()
  1516. {
  1517.     //System.GUI.console.println(nCount);
  1518.     //nCount++;
  1519.  
  1520.     var oPlayer = event.srcElement;
  1521.  
  1522.     /*controller event */
  1523.     if(event.propertyName == "newController" )
  1524.     {
  1525.            var oController                      = document.all[oPlayer.newController];
  1526.         var intSlot                          = returnObjectId( oPlayer.id  );
  1527.         var intController                    = returnObjectId( oController.id );
  1528.         var intTeam                          = String(oPlayer.id).match(RegExp("home")) ? 0 : 1;
  1529.         var oLock                            = document.all[oPlayer.id + "_lock"];
  1530.  
  1531.        changeController( intTeam , intController , intSlot);
  1532.  
  1533.        if(returnObjectId( oPlayer.id ) == 5)
  1534.        {
  1535.             var oLock                            = document.all[oPlayer.id + "_lock"];
  1536.            doLock( true , oLock )
  1537.        }
  1538.  
  1539.      }
  1540.     if(event.propertyName == "oldController" )
  1541.     {
  1542.            var oController                 = document.all[oPlayer.oldController];
  1543.         var intSlot                     = returnObjectId( oPlayer.id  );
  1544.         var intController               = returnObjectId( oController.id );
  1545.         var intTeam                     = String(oPlayer.id).match(RegExp("home")) ? 0 : 1;
  1546.         var oLock                       = document.all[oPlayer.id + "_lock"]
  1547.  
  1548.         removeController( intTeam , intController , intSlot);
  1549.      }
  1550.      /*
  1551.      if(event.propertyName == "controllerLocked")
  1552.      {
  1553.         var oLock                            = document.all[oPlayer.id + "_lock"];
  1554.         doLock( element.controllerLocked , oLock);
  1555.      }
  1556.         */
  1557.      /*game interface callback */
  1558.      if(event.propertyName == "controllerId")
  1559.      {
  1560.         var oController;
  1561.         /*debug       */
  1562.         var intSlot                     = returnObjectId( oPlayer.id  );
  1563.         var intControllerId             = oPlayer.controllerId;
  1564.         var intTeam                     = String(oPlayer.id).match(RegExp("home")) ? 0 : 1;
  1565.  
  1566.         switch( oPlayer.controllerId)
  1567.         {
  1568.             case 6:
  1569.                    toggleVisibility( oPlayer , false );
  1570.             break;
  1571.             case 5:
  1572.                 moveController( oPlayer , "5");
  1573.             break;
  1574.             case 4:
  1575.                 moveController( oPlayer , "4");
  1576.             break;
  1577.             case 3:
  1578.                 moveController( oPlayer , "3");
  1579.             break;
  1580.             case 2:
  1581.                 moveController( oPlayer , "2");
  1582.             break;
  1583.             case 1:
  1584.                 moveController( oPlayer , "1");
  1585.             break;
  1586.             case 0:
  1587.                 moveController( oPlayer , "0");
  1588.             break;
  1589.         }
  1590.      }
  1591. }
  1592.  
  1593. function moveController( oPlayer, sId )
  1594. {
  1595.     var oController = document.all["controller_" + sId]
  1596.     //if (oController.playerId != null)
  1597.     //    document.all[oController.playerId].hasController = "false";
  1598.     oPlayer.hasController = "true";
  1599.  
  1600.     if(oPlayer.controllerLocal)
  1601.         oController.moveToPlayer( oPlayer.id );
  1602.     toggleVisibility( oPlayer , true );
  1603. }
  1604.  
  1605.  
  1606. function toggleVisibility( oPlayer , visible )
  1607. {
  1608.         //var oText               = document.getElementById(oPlayer.id + "_position");
  1609.         var oStatus             = document.getElementById(oPlayer.id + "_status");
  1610.         var oLock               = document.getElementById(oPlayer.id + "_lock");
  1611.  
  1612.         if(visible)
  1613.         {
  1614.             //oText.style.visibility = 'visible';
  1615.             oStatus.style.visibility = 'visible';
  1616.             oLock.style.visibility = 'visible';
  1617.             oStatus.innerText = oPlayer.controllerName;
  1618.         }
  1619.  
  1620.         else
  1621.         {
  1622.            // oText.style.visibility = 'hidden';
  1623.             oStatus.style.visibility = 'hidden';
  1624.             oLock.style.visibility = 'hidden';
  1625.             oStatus.innerText = "";
  1626.             oPlayer.hasController = "false";
  1627.         }
  1628. }
  1629.  
  1630. function returnObjectId( sValue )
  1631. {
  1632.     var intPos = 1;
  1633.     intPos += sValue.search( RegExp( "_" ));
  1634.     return parseInt( sValue.substr( intPos ));
  1635. }
  1636.  
  1637. /*    END PLAYER  */
  1638.  
  1639.  
  1640. /*     LOCK      */
  1641. function handleLock()
  1642. {
  1643.     if(event.propertyName == "controllerLocked")
  1644.     {
  1645.         var oLock                 = event.srcElement;
  1646.         toggleLock( oLock );
  1647.         var intPos                 = 2;
  1648.         intPos                     += oLock.id.search( RegExp( "_" ));
  1649.         var sPlayerId            =  oLock.id.substr( 0, intPos );
  1650.         var oPlayerPosition        = document.all[ sPlayerId + "_position" ];
  1651.         ( parseInt(oLock.controllerLocked) ) ?    oPlayerPosition.style.visibility = 'visible' : oPlayerPosition.style.visibility = 'hidden';
  1652.     }
  1653. }
  1654. function toggleLock( oLock )
  1655. {
  1656.     var sPropsUnlocked          = "../images2/screen_images/gamesetup_unlock00.gif";
  1657.     var sPropsLocked            = "../images2/screen_images/gamesetup_lock00.gif";
  1658.     ( oLock.controllerLocked == 1 ) ? oLock.src = sPropsLocked : oLock.src = sPropsUnlocked;
  1659. }
  1660.  
  1661. function doClick()
  1662. {
  1663.     var oLock                = event.srcElement;
  1664.     var locked              = (oLock.src.indexOf('unlock') != -1) ? 1 : 0;
  1665.     var intSlot             = returnObjectId( oLock.id  );
  1666.     var intTeam             = String(oLock.id).match(RegExp("home")) ? 0 : 1;
  1667.     changeControllerLock( intTeam , locked , intSlot);
  1668. }
  1669.  
  1670. function doLock( bValue , oLock )
  1671. {
  1672.     var intLocked           = bValue ? 1 : 0 ;
  1673.     var intSlot             = returnObjectId( oLock.id  );
  1674.     var intTeam             = String(oLock.id).match(RegExp("home")) ? 0 : 1;
  1675.  
  1676.     changeControllerLock( intTeam , intLocked , intSlot);
  1677. }
  1678.  
  1679. function doMouseOver()
  1680. {
  1681.     var oLock                    = event.srcElement;
  1682.     var sPropsUnlocked          = "../images2/screen_images/gamesetup_unlock01.gif";
  1683.     var sPropsLocked            = "../images2/screen_images/gamesetup_lock01.gif";
  1684.     System.GUI.console.println(oLock);
  1685.     System.GUI.console.println(oLock.id);
  1686.     if (oLock.src != null)
  1687.     {
  1688.         if ( oLock.src.match(/unlock/) )
  1689.             oLock.src = sPropsUnlocked
  1690.         else if ( oLock.src.match(/lock/) )
  1691.             oLock.src = sPropsLocked;
  1692.     }
  1693. }
  1694.  
  1695. function doMouseOut()
  1696. {
  1697.     var oLock                    = event.srcElement;
  1698.     var sPropsUnlocked          = "../images2/screen_images/gamesetup_unlock00.gif";
  1699.     var sPropsLocked            = "../images2/screen_images/gamesetup_lock00.gif";
  1700.     if (oLock.src != null)
  1701.     {
  1702.         if ( oLock.src.match(/unlock/) )
  1703.             oLock.src = sPropsUnlocked
  1704.         else if ( oLock.src.match(/lock/) )
  1705.             oLock.src = sPropsLocked;
  1706.     }
  1707. }
  1708.  
  1709. /*     END LOCK     */
  1710.  
  1711. function drpSkillLevelOnDropDown()
  1712. {
  1713.     drpSkillLevel.style.height=90;
  1714.     drpSkillLevel.style.zIndex=100;
  1715. }
  1716. function drpSkillLevelOnPullUp()
  1717. {
  1718.     drpSkillLevel.style.zIndex=0;
  1719.     drpSkillLevel.style.height=20;
  1720. }
  1721.  
  1722. function drpAwayTeamsOnDropDown()
  1723. {
  1724.     drpAwayTeams.style.height=115;
  1725.     drpAwayTeams.style.zIndex=100;
  1726. }
  1727. function drpAwayTeamsOnPullUp()
  1728. {
  1729.     drpAwayTeams.style.zIndex=0;
  1730.     drpAwayTeams.style.height=20;
  1731. }
  1732.  
  1733. function drpHomeTeamsOnDropDown()
  1734. {
  1735.     drpHomeTeams.style.height=115;
  1736.     drpHomeTeams.style.zIndex=100;
  1737. }
  1738. function drpHomeTeamsOnPullUp()
  1739. {
  1740.     drpHomeTeams.style.zIndex=0;
  1741.     drpHomeTeams.style.height=20;
  1742. }
  1743.  
  1744. function drpAwayLeaguesOnDropDown()
  1745. {
  1746.     drpAwayLeagues.style.height=120;
  1747.     drpAwayLeagues.style.zIndex=100;
  1748. }
  1749. function drpAwayLeaguesOnPullUp()
  1750. {
  1751.     drpAwayLeagues.style.zIndex=0;
  1752.     drpAwayLeagues.style.height=20;
  1753. }
  1754.  
  1755. function drpHomeLeaguesOnDropDown()
  1756. {
  1757.     drpHomeLeagues.style.height=120;
  1758.     drpHomeLeagues.style.zIndex=100;
  1759. }
  1760. function drpHomeLeaguesOnPullUp()
  1761. {
  1762.     drpHomeLeagues.style.zIndex=0;
  1763.     drpHomeLeagues.style.height=20;
  1764. }
  1765.  
  1766. function showUniform()
  1767. {
  1768.     oAudioInterface.PlaySFX(1099);    
  1769.     
  1770.     clearSettings();
  1771.  
  1772.     System.GUI.dialog.document_src = "fe/nhl/html/uniforms.html";
  1773.     System.GUI.dialog.addButton("btnBuddyCancel",     scMsg("OK", true), function() { bUniformDialog = true;removeCallbackTable();initGameInterface( oCallbackTable ); OnHomeTeamChanged(); OnAwayTeamChanged(); });
  1774.     System.GUI.dialog.setSize(515, 295);    
  1775.     System.GUI.dialog.show();    
  1776.     System.GUI.dialog.setBackgroundImage("fe/nhl/images2/screen_images/gamesetup_pop.gif", -15);
  1777. }
  1778.  
  1779. function hideDialogCallback()
  1780. {
  1781. }
  1782.  
  1783. function getHomeLeagueIndex()
  1784. {
  1785.     switch (oLeagueServer.LeagueType)
  1786.     {
  1787.         case 5:
  1788.             return 1;
  1789.         case 8:
  1790.             return 2;
  1791.         case 9:
  1792.             return 3;
  1793.         case 10:
  1794.             return 4;
  1795.         default:
  1796.             return oGameData.HomeLeague;
  1797.     }
  1798. }
  1799.  
  1800. function getAwayLeagueIndex()
  1801. {
  1802.     switch (oLeagueServer.LeagueType)
  1803.     {
  1804.         case 5:
  1805.             return 1;
  1806.         case 8:
  1807.             return 2;
  1808.         case 9:
  1809.             return 3;
  1810.         case 10:
  1811.             return 4;
  1812.         default:
  1813.             return oGameData.AwayLeague;
  1814.     }
  1815. }