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

  1. //Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
  2. var oGameFace           = window.external.GameInterface;
  3. document.onselectstart = function() { return false; };
  4.  
  5. var TIME         = 4000;
  6. var MAX_PAGES    = 35;
  7.  
  8. var currentPage    = 0;
  9. var nValue         = 0;
  10. var bStopAnim    = false;
  11.  
  12. function initCredits()
  13. {
  14.     System.GUI.setLeftNavBackground("fe/NHL/images2/backgrounds/background_left_credits.jpg");
  15.     System.GUI.setBackground("fe/NHL/images2/backgrounds/background_right_credits.jpg");
  16.     
  17.     credits0.innerHTML =    "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>" +
  18.                             oGameFace.GetCreditsText(0) + "<BR><BR>" + 
  19.                             oGameFace.GetCreditsText(1) + "<BR><BR>" + 
  20.                             oGameFace.GetCreditsText(2) + "<BR><BR>" + 
  21.                             oGameFace.GetCreditsText(3) + "<BR><BR>" + 
  22.                             
  23.                             oGameFace.GetCreditsText(4).substring(0, oGameFace.GetCreditsText(4).indexOf("STATS, Inc")) +
  24.                             "<img src='../images2/screen_images/credits_statsinc.jpg' />" +
  25.                             oGameFace.GetCreditsText(4).substring(oGameFace.GetCreditsText(4).indexOf("STATS, Inc")-3, oGameFace.GetCreditsText(4).length) +
  26.                             "<BR><BR>" +                             
  27.                             
  28.                             oGameFace.GetCreditsText(5) + "<BR><BR>" + 
  29.                             oGameFace.GetCreditsText(6) + "<BR><BR>" + 
  30.                             "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>";
  31.  
  32.     var oElOuterContainer     = document.getElementById("container");
  33.     var oElInnerContainer     = document.getElementById("credits0");
  34.     verticalScroller.max_value = parseInt((oElInnerContainer.offsetHeight < oElOuterContainer.offsetHeight ) ? 0 : (oElInnerContainer.offsetHeight - oElOuterContainer.offsetHeight));
  35.     verticalScroller.style.visibilty = "visible";
  36.  
  37.     setTimeout("doAnimation()", 1500);
  38. }
  39.  
  40. function verticalScroll()
  41. {
  42.     var oElOuterContainer     = document.getElementById("container");
  43.     var oElInnerContainer     = document.getElementById("credits0");
  44.  
  45.     oElInnerContainer.style.pixelTop = 0 - verticalScroller.value;
  46.     nValue = verticalScroller.value;
  47. }
  48.  
  49. function doAnimation()
  50. {
  51.     if (!bStopAnim)
  52.     {
  53.         if (nValue != verticalScroller.max_value)
  54.         {
  55.             nValue+=1;
  56.             credits0.style.pixelTop = -5 - nValue;
  57.         }
  58.         else
  59.         {
  60.             credits0.style.pixelTop = -5;
  61.             nValue=0;
  62.         }
  63.  
  64.         setTimeout("doAnimation()", 125);
  65.     }
  66. }
  67.  
  68. function changePage()
  69. {
  70.     if (currentPage > 0 && currentPage <= MAX_PAGES)
  71.     {
  72.         document.all[ "credits" + (currentPage-1) ].style.visibility = "hidden";
  73.         document.all[ "credits" + currentPage ].style.visibility = "visible";
  74.         document.all[ "credits" + (currentPage+1) ].style.visibility = "hidden";
  75.     }
  76.     else if (currentPage > MAX_PAGES || currentPage == 0)
  77.     {
  78.         document.all[ "credits35" ].style.visibility = "hidden";
  79.         document.all[ "credits0" ].style.visibility = "visible";
  80.         document.all[ "credits1" ].style.visibility = "hidden";
  81.         currentPage = 0;
  82.     }
  83.     else if (currentPage < 0)
  84.     {
  85.         document.all[ "credits34" ].style.visibility = "hidden";
  86.         document.all[ "credits35" ].style.visibility = "visible";
  87.         document.all[ "credits0" ].style.visibility = "hidden";
  88.         currentPage = MAX_PAGES;
  89.     }
  90. }
  91.  
  92. function keyListener()
  93. {
  94.     if (event.keyCode == 52)
  95.     {
  96.         pageBackward();
  97.     }
  98.     else if (event.keyCode == 53 || event.keyCode == 27)
  99.     {
  100.         pagePause();
  101.     }
  102.     else
  103.     {
  104.         pageForward();
  105.     }
  106. }
  107.  
  108. function mouseListener()
  109. {
  110.     if (event.button == 2)
  111.     {
  112.         pageForward();
  113.     }
  114.     else if (event.button == 1)
  115.     {
  116.         pageBackward();
  117.     }
  118.     else if (event.button == 3 || event.button == 4)
  119.     {
  120.         pagePause;
  121.     }
  122. }
  123.  
  124. function pageForward()
  125. {
  126.     bStopAnim = true;
  127.     changePage();
  128.     currentPage++;
  129.     changePage();
  130.     setTimeout("bStopAnim=false", TIME);
  131. }
  132.  
  133. function pageBackward()
  134. {
  135.     bStopAnim = true;
  136.     changePage();
  137.     currentPage--;
  138.     changePage();
  139.     setTimeout("bStopAnim=false", TIME);
  140. }
  141.  
  142. function pagePause()
  143. {
  144.  
  145.     bStopAnim = !bStopAnim;
  146.     setTimeout("bStopAnim=false", TIME);
  147. }