home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / Chip_2004-04_cd1.bin / opsys / wmakeup / downloads / TheStick2.wmz / TheStick.js < prev    next >
Encoding:
JavaScript  |  2004-02-13  |  71.3 KB  |  2,621 lines

  1. // ----------------------------------------------------------------------
  2. // The Stick v2.0 - Windows Media Player Skin
  3. // Author: R. Al-Rawi, 2004
  4. // Contact: raada@hotmail.com 
  5. // ----------------------------------------------------------------------
  6. // TO DO
  7. //
  8. // - investigate possible issue with last playlist being an album
  9. // ----------------------------------------------------------------------
  10.  
  11.  
  12. // ----------------------------------------------------------------------
  13. // Set up some things
  14. // ----------------------------------------------------------------------
  15. var intOffset = 247;            // Offset of right part to left
  16. var intDiff = 142;                // Distance to move
  17. var intBrakeZone = 10;            // Point at which to slow down
  18. var intNumHelpPages = 7;        // Number of help pages
  19. var intCurrentHelpPage = 1;        // Current help page
  20.  
  21. var strInfoText = ""            // Keep track of Info text
  22. var blnSwitchingSkin = false;    // Skin is switching flag
  23. var blnIsOpen = true;            // Player open/closed flag
  24. var blnPlaylistOpen = false;    // Playlist open/closed flag
  25. var blnOpenPlaylist = false;    // open the Playlist view flag
  26. var blnSettingsOpen = false;    // Settings open/closed flag
  27. var blnOpenSettings = false;    // open the Settings view flag
  28. var blnMiniVisOpen = false;        // Mini-Vid/Vis open/closed flag
  29. var blnOpenMiniVis = false;        // Open the Video view flag
  30. var intSwitchSides = 1;            // Player is switching sides flag
  31. var blnClosePlayer = false;        // Player should be opened/closed flag
  32. var strMins = new String;
  33. var strSecs = new String;
  34. var intY = 1;                    // Y position for settings text
  35. var intNumMiniEffects = 5;        // How many mini-effects do we have
  36. var strMediaType = ""            // Media type
  37. var blnRepeatMode = true;
  38. var blnRestoreCrossfade = false    // Restore crossFade flag
  39. var blnResetOSI = true;            // Reset (i.e. hide) OSI flag
  40. var intVidMediaWidth = 0;        // video zoom width
  41. var intVidMediaHeight = 0;        // video zoom height
  42.  
  43. // TitleModes sets the track title mode:
  44. // A = Auto
  45. // C = Custom
  46. // D = Default (Author - Title)
  47. //
  48. // Auto mode senses if the track playing belongs to an album, and sets up
  49. // the track title as: [track#]. [Artist]: [album title] - [track title]
  50. //
  51. // Attributes available to custom mode:
  52. // TN = Track#
  53. // AT = Album Title
  54. // TT = Track Title
  55. // PT = Playlist Title
  56. // TA = Track Author
  57. //
  58. // CustomTitle holds the attributes for a custom title
  59. strCustomTitle = '["TT","PT","TA","AT","TN"]';
  60. strCustomTitleShow = '["1","1","1","0","1"]';
  61.  
  62. arrTitleAttributes = new Array("TN:Track Number", "AT:Album Title", "TT:Track Title", "PT:Playlist Title", "TA:Track Author")
  63.  
  64. // InfoMode tracks the mode for the track info text:
  65. // C = Current Position
  66. // D = Duration Left
  67. // T = Total Time
  68. //
  69.  
  70. var intIndex = 0;
  71.  
  72. arrInfoModes = new Array();
  73. arrInfoModes[intIndex++] = new Array("C","#FFFFAA");
  74. arrInfoModes[intIndex++] = new Array("D","#FFAAAA");
  75. arrInfoModes[intIndex++] = new Array("T","#AAFFFF");
  76.  
  77. var intIndex = 0;
  78.  
  79. arrOpenStates = new Array;
  80. arrOpenStates[intIndex++] = "Undefined";
  81. arrOpenStates[intIndex++] = "Changing Playlist";
  82. arrOpenStates[intIndex++] = "Locating Playlist";
  83. arrOpenStates[intIndex++] = "Connecting Playlist";
  84. arrOpenStates[intIndex++] = "Loading Playlist";
  85. arrOpenStates[intIndex++] = "Opening Playlist";
  86. arrOpenStates[intIndex++] = "Playlist Open";
  87. arrOpenStates[intIndex++] = "Playlist Changed";
  88. arrOpenStates[intIndex++] = "Changing Media";
  89. arrOpenStates[intIndex++] = "Locating Media";
  90. arrOpenStates[intIndex++] = "Connecting to Media";
  91. arrOpenStates[intIndex++] = "Loading Media";
  92. arrOpenStates[intIndex++] = "Opening Media";
  93. arrOpenStates[intIndex++] = "Media Open";
  94. arrOpenStates[intIndex++] = "Starting Codec Acquisition";
  95. arrOpenStates[intIndex++] = "Finished Codec Acquisition";
  96. arrOpenStates[intIndex++] = "Starting License Acquisition";
  97. arrOpenStates[intIndex++] = "Ending License Acquisition";
  98. arrOpenStates[intIndex++] = "Begin DRM";
  99. arrOpenStates[intIndex++] = "End DRM";
  100. arrOpenStates[intIndex++] = "Waiting For Media";
  101. arrOpenStates[intIndex++] = "Opening URL";
  102.  
  103. // Set up array for controls affected by different skin images
  104. var intIndex = 0;
  105.  
  106. arrVwMainControls = new Array();
  107.  
  108. // Most important bits first
  109. arrVwMainControls[intIndex++] = "svwPart1.backgroundImage";
  110. arrVwMainControls[intIndex++] = "svwPart2.backgroundImage";
  111. arrVwMainControls[intIndex++] = "btnLeftLight.image";
  112. arrVwMainControls[intIndex++] = "btnLeftLight.disabledImage";
  113. arrVwMainControls[intIndex++] = "btnRightLight.image";
  114. arrVwMainControls[intIndex++] = "btnRightLight.disabledImage";
  115.  
  116. // Part1 View
  117. arrVwMainControls[intIndex++] = "btnPlay.image";
  118. arrVwMainControls[intIndex++] = "btnPlay.hoverImage";
  119. arrVwMainControls[intIndex++] = "btnPause.image";
  120. arrVwMainControls[intIndex++] = "btnPause.hoverImage";
  121. arrVwMainControls[intIndex++] = "btnStop.image";
  122. arrVwMainControls[intIndex++] = "btnStop.hoverImage";
  123. arrVwMainControls[intIndex++] = "btnStop.disabledImage";
  124. arrVwMainControls[intIndex++] = "btnPrev.image";
  125. arrVwMainControls[intIndex++] = "btnPrev.hoverImage";
  126. arrVwMainControls[intIndex++] = "btnNext.image";
  127. arrVwMainControls[intIndex++] = "btnNext.hoverImage";
  128. arrVwMainControls[intIndex++] = "btnVolKnob.image";
  129. arrVwMainControls[intIndex++] = "btnVolKnob.hoverImage";
  130. arrVwMainControls[intIndex++] = "btnSeek.image";
  131. arrVwMainControls[intIndex++] = "sliSeek.foregroundImage";
  132. arrVwMainControls[intIndex++] = "sliSeek.backgroundImage";
  133. arrVwMainControls[intIndex++] = "sliSeek.thumbImage";
  134. arrVwMainControls[intIndex++] = "btnMute.image";
  135. arrVwMainControls[intIndex++] = "btnMute.hoverImage";
  136. arrVwMainControls[intIndex++] = "btnMute.downImage";
  137. arrVwMainControls[intIndex++] = "sliVolume.foregroundImage";
  138. arrVwMainControls[intIndex++] = "sliVolume.backgroundImage";
  139. arrVwMainControls[intIndex++] = "sliVolume.thumbImage";
  140. arrVwMainControls[intIndex++] = "csliVolume.image";
  141. arrVwMainControls[intIndex++] = "btnPlaylist.image";
  142. arrVwMainControls[intIndex++] = "btnPlaylist.hoverImage";
  143. arrVwMainControls[intIndex++] = "btnDispPlaylist.image";
  144. arrVwMainControls[intIndex++] = "btnDispPlaylist.hoverImage";
  145.  
  146. // Part2 View
  147. arrVwMainControls[intIndex++] = "btnVideo.image";
  148. arrVwMainControls[intIndex++] = "btnVideo.hoverImage";
  149. arrVwMainControls[intIndex++] = "btnSettings.image";
  150. arrVwMainControls[intIndex++] = "btnSettings.hoverImage";
  151. arrVwMainControls[intIndex++] = "btnInfoBackground.image";
  152. arrVwMainControls[intIndex++] = "btnInfoBackgroundBG.image";
  153. arrVwMainControls[intIndex++] = "btnRepeat.image";
  154. arrVwMainControls[intIndex++] = "btnRepeat.hoverImage";
  155. arrVwMainControls[intIndex++] = "btnRepeat.downImage";
  156. arrVwMainControls[intIndex++] = "btnShuffle.image";
  157. arrVwMainControls[intIndex++] = "btnShuffle.hoverImage";
  158. arrVwMainControls[intIndex++] = "btnShuffle.downImage";
  159. arrVwMainControls[intIndex++] = "btnClose.image";
  160. arrVwMainControls[intIndex++] = "btnClose.hoverImage";
  161. arrVwMainControls[intIndex++] = "btnFullMode.image";
  162. arrVwMainControls[intIndex++] = "btnFullMode.hoverImage";
  163. arrVwMainControls[intIndex++] = "btnOpenClose.image";
  164. arrVwMainControls[intIndex++] = "btnOpenClose.hoverImage";
  165.  
  166. // Settings View
  167. arrVwMainControls[intIndex++] = "svwSettingsL.backgroundImage";
  168. arrVwMainControls[intIndex++] = "svwSettingsR.backgroundImage";
  169. arrVwMainControls[intIndex++] = "svwSettingsBL.backgroundImage";
  170. arrVwMainControls[intIndex++] = "svwSettingsB.backgroundImage";
  171. arrVwMainControls[intIndex++] = "svwSettingsBR.backgroundImage";
  172.  
  173. // Mini-Vis View
  174. arrVwMainControls[intIndex++] = "svwMiniVisL.backgroundImage";
  175. arrVwMainControls[intIndex++] = "svwMiniVisR.backgroundImage";
  176. arrVwMainControls[intIndex++] = "svwMiniVisBL.backgroundImage";
  177. arrVwMainControls[intIndex++] = "svwMiniVisB.backgroundImage";
  178. arrVwMainControls[intIndex++] = "svwMiniVisBR.backgroundImage";
  179. arrVwMainControls[intIndex++] = "btnDetachVid.image";
  180. arrVwMainControls[intIndex++] = "btnDetachVid.hoverImage";
  181. arrVwMainControls[intIndex++] = "btnCloseVid.image";
  182. arrVwMainControls[intIndex++] = "btnCloseVid.hoverImage";
  183.  
  184. // Playlist View
  185. arrVwMainControls[intIndex++] = "svwPlaylistL.backgroundImage";
  186. arrVwMainControls[intIndex++] = "svwPlaylistR.backgroundImage";
  187. arrVwMainControls[intIndex++] = "svwPlaylistBL.backgroundImage";
  188. arrVwMainControls[intIndex++] = "svwPlaylistB.backgroundImage";
  189. arrVwMainControls[intIndex++] = "svwPlaylistBR.backgroundImage";
  190.  
  191.  
  192. // Set up player setting defaults
  193. blnVideoOpen = 0;            // vid/vis open setting        : 0 = closed, 1 = open
  194. blnSaveOnExit = 1;            // save settings mode        : 0 = don't save settings on exit, 1 = save settings on exit
  195. blnAutoPlay = 1;            // autoplay                    : 0 = off, 1 = on
  196. blnRestorePlaylist = 1;        // restore last playlist    : 0 = no, 1 = yes
  197.  
  198. strRepeatMode = "N";        // repeat mode                : Y = repeat on, N = repeat off, 1 = single track repeat
  199. strExpandMode = "L";        // expand/shrink side        : left [L] or right [R]
  200. strPlayerMode = "A:O";        // player mode                : 2-part - auto [A] or manual [M] : open [O] or closed [C]
  201. strTitleMode = "M:C";        // title mode                : 2-part - auto [A] or manual [M] : custom [C] or default [D]
  202. strSkinMode = "N";            // skin mode                : night [N], day [S]
  203. strInfoMode = "C";            // track info mode            : current position [C], duration left [D], total time [T] or auto [A]
  204. intCurrentEffect = 1;        // current mini-effect        : 1-5 = effect, 0 = no effect
  205. strPlaylist = "";            // current playlist            :
  206. strTextOnEffect = "Y";        // text on mini-effect        : Y = on, N = off, A = side-by-side (auto)
  207. blnTextOverEffect = 1;        // text over mini-effect    : 0 = no, 1 = yes
  208.  
  209. strVidMode = "VIS";            // video view mode            : display video [VID] or visuals [VIS] by default
  210. intVidWidth = 350;            // video view width            :
  211. intVidHeight = 262;            // video view height        :
  212. strDisplayVideo = "A:0";    // video view visible        : 2-part - auto [A] or manual [M] : 0 = hidden, 1 = displayed
  213. blnUseSoundFx = 1;            // Sound effects flag        : 1 = On, 0 = Off
  214. blnOnScreenIcons = 0;        // On-screen icons flag        : 1 = On, 0 = Off
  215. blnCrossfade = 0;            // Crossfade flag            : 1 = On, 0 = Off
  216. intCrossfadeWindow = 6000;    // Crossfade window            ; size of crossfade window in ms
  217.  
  218. // ----------------------------------------------------------------------
  219.  
  220.  
  221. function Startup()
  222. {
  223.     ReadSettings();
  224.     ApplySettings();
  225.     ConstructTrackInfo(true);
  226.     SetInfoMode();
  227.     InitMainView();
  228.     UpdateMainMetadata();
  229.     OnPlayStateChange();
  230.     toggleMiniEffects(intCurrentEffect);
  231.  
  232.     // load the preset popups
  233.     for (var n = 0; n < eqEqualizer.presetCount; n++) {
  234.         popPreset.appendItem(eqEqualizer.presetTitle(n));
  235.     }
  236.     
  237.     // Start playing if Autoplay is on
  238.     if (blnAutoPlay == 1) {
  239.         player.controls.play();
  240.     }
  241.  
  242. }
  243.  
  244. function Shutdown()
  245. {    
  246.     SaveSettings();    
  247. }
  248.  
  249.  
  250. function ReadSettings()
  251. {
  252.     // Get settings from registry
  253.     blnSaveOnExit = ((theme.loadPreference("SaveOnExit") != "--") ? parseInt(theme.loadPreference("SaveOnExit"),10) : blnSaveOnExit);
  254.     strTextOnEffect = ((theme.loadPreference("TextOnEffect") != "--") ? theme.loadPreference("TextOnEffect") : strTextOnEffect);
  255.     blnRestorePlaylist = ((theme.loadPreference("RestorePlaylist") != "--") ? parseInt(theme.loadPreference("RestorePlaylist"),10) : blnRestorePlaylist);
  256.     blnAutoPlay = ((theme.loadPreference("AutoPlay") != "--") ? parseInt(theme.loadPreference("AutoPlay"),10) : blnAutoPlay);
  257.     strExpandMode = ((theme.loadPreference("ExpandMode") != "--") ? theme.loadPreference("ExpandMode") : strExpandMode);
  258.     strPlayerMode = ((theme.loadPreference("PlayerMode") != "--") ? theme.loadPreference("PlayerMode") : strPlayerMode);
  259.     strTitleMode = ((theme.loadPreference("TitleMode") != "--") ? theme.loadPreference("TitleMode") : strTitleMode);
  260.     
  261.     strCustomTitle = ((theme.loadPreference("CustomTitle") != "--") ? theme.loadPreference("CustomTitle") : strCustomTitle);
  262.     arrCustomTitle = eval(strCustomTitle);
  263.     
  264.     strCustomTitleShow = ((theme.loadPreference("CustomTitleShow") != "--") ? theme.loadPreference("CustomTitleShow") : strCustomTitleShow);
  265.     arrCustomTitleShow = eval(strCustomTitleShow);
  266.  
  267.     strRepeatMode = ((theme.loadPreference("RepeatMode") != "--") ? theme.loadPreference("RepeatMode") : strRepeatMode);    
  268.     strPlaylist = ((theme.loadPreference("Playlist") != "--") ? theme.loadPreference("Playlist") : strPlaylist);
  269.     strSkinMode = ((theme.loadPreference("SkinMode") != "--") ? theme.loadPreference("SkinMode") : strSkinMode);
  270.     strInfoMode = ((theme.loadPreference("InfoMode") != "--") ? theme.loadPreference("InfoMode") : strInfoMode);
  271.     intCurrentEffect = ((theme.loadPreference("CurrentEffect") != "--") ? parseInt(theme.loadPreference("CurrentEffect"),10) : intCurrentEffect);
  272.  
  273.     strVidMode = ((theme.loadPreference("VidMode") != "--") ? theme.loadPreference("VidMode") : strVidMode);
  274.     intVidWidth = ((theme.loadPreference("VidWidth") != "--") ? theme.loadPreference("VidWidth") : intVidWidth);
  275.     intVidHeight = ((theme.loadPreference("VidHeight") != "--") ? theme.loadPreference("VidHeight") : intVidHeight);    
  276.     strDisplayVideo = ((theme.loadPreference("DisplayVideo") != "--") ? theme.loadPreference("DisplayVideo") : strDisplayVideo);
  277.     blnUseSoundFx = ((theme.loadPreference("UseSoundFx") != "--") ? parseInt(theme.loadPreference("UseSoundFx"),10) : blnUseSoundFx);
  278.     blnOnScreenIcons = ((theme.loadPreference("OnScreenIcons") != "--") ? parseInt(theme.loadPreference("OnScreenIcons"),10) : blnOnScreenIcons);
  279.     blnCrossfade = ((theme.loadPreference("Crossfade") != "--") ? parseInt(theme.loadPreference("Crossfade"),10) : blnCrossfade);
  280.     intCrossfadeWindow = ((theme.loadPreference("CrossfadeWindow") != "--") ? parseInt(theme.loadPreference("CrossfadeWindow"),10) : intCrossfadeWindow);
  281. }
  282.  
  283. function ApplySettings()
  284. {
  285.     toggleViewSkin('main',strSkinMode);
  286.     toggleSaveOnExit(blnSaveOnExit);
  287.     toggleTextOnEffect(strTextOnEffect);
  288.     toggleDisplayVideo(strDisplayVideo);
  289.     toggleRestorePlaylist(blnRestorePlaylist);
  290.     toggleAutoPlay(blnAutoPlay);
  291.     toggleUseSoundFx(blnUseSoundFx);
  292.     toggleOnScreenIcons(blnOnScreenIcons);
  293.     toggleCrossfade(intCrossfadeWindow);
  294.     toggleRepeatMode(strRepeatMode);
  295.     toggleExpandMode(strExpandMode);
  296.     // We togglePlayerMode(strPlayerMode) after a delay via the main view timer
  297.     toggleTitleMode(strTitleMode);
  298.     // We toggleMiniEffects(intCurrentEffect) after setting the track info, so that the
  299.     // text is set correctly.    
  300. }
  301.  
  302. function SaveSettings()
  303. {
  304.     theme.savePreference("SaveOnExit", blnSaveOnExit);
  305.  
  306.     if (blnSaveOnExit) {
  307.         var strTemp = '[';
  308.         var strTemp2 = '[';
  309.         
  310.         //theme.savePreference("DisplayVideo", strDisplayVideo);
  311.         theme.savePreference("TextOnEffect", strTextOnEffect);
  312.         theme.savePreference("RestorePlaylist", blnRestorePlaylist);
  313.         theme.savePreference("AutoPlay", blnAutoPlay);
  314.         theme.savePreference("ExpandMode", strExpandMode);
  315.         theme.savePreference("PlayerMode", strPlayerMode);
  316.         theme.savePreference("SkinMode", strSkinMode);
  317.         theme.savePreference("InfoMode", strInfoMode);
  318.         theme.savePreference("TitleMode", strTitleMode);
  319.         theme.savePreference("Playlist", strPlaylist);
  320.         theme.savePreference("CurrentEffect", intCurrentEffect);
  321.         theme.savePreference("UseSoundFx", blnUseSoundFx);
  322.         theme.savePreference("RepeatMode", strRepeatMode);
  323.         theme.savePreference("Crossfade", blnCrossfade);
  324.         theme.savePreference("CrossfadeWindow", intCrossfadeWindow);
  325.         
  326.         for (var n=0; n < arrCustomTitle.length; n++) {
  327.             strTemp = strTemp + '"' + arrCustomTitle[n] + '",';
  328.             strTemp2 = strTemp2 + '"' + arrCustomTitleShow[n] + '",';
  329.         }
  330.         
  331.         strTemp = strTemp.slice(0, strTemp.length - 1) + ']';
  332.         strTemp2 = strTemp2.slice(0, strTemp2.length - 1) + ']';
  333.  
  334.         theme.savePreference("CustomTitle", strTemp);
  335.         theme.savePreference("CustomTitleShow", strTemp2);
  336.     }
  337. }
  338.  
  339.  
  340. function InitMainView()
  341. {
  342.     // Play startup sound
  343.     Beep("startup");
  344.  
  345.     if (player.settings.autoStart) {
  346.         player.settings.autoStart = false;
  347.     }
  348.     
  349.     intMiniVisOffset = svwMiniVis.height;
  350.     intPlaylistOffset = svwPlaylist.height;
  351.     intSettingsOffset = svwSettings.height;
  352.  
  353.     // Initalise settings display
  354.     toggleSettings(1);
  355.     
  356.     // Set time info mode
  357.     UpdateTrackInfo();
  358.     
  359.     // Display Vid/Vis view
  360.     if (strDisplayVideo == "A:1" || strDisplayVideo == "M:1") {
  361.         theme.openView('vwVideoBig');
  362.     }
  363.     
  364.     // Restore last playlist
  365.     if (blnRestorePlaylist && player.playstate != 3) {
  366.         var strGetPlaylist = player.playlistCollection.getByName(strPlaylist).item(0);
  367.         //player.settings.autostart = false;
  368.         player.currentPlaylist = player.playlistCollection.getByName(strPlaylist).item(0);
  369.     }
  370.  
  371. }
  372.  
  373.  
  374. function OnPlayStateChange()
  375. {
  376.     if (player.playState == 8) {
  377.         RepeatMode();
  378.     }
  379.     
  380.     if (player.PlayState == 3 || player.PlayState == 9) {
  381.         UpdateScrolling('auto');
  382.         btnLeftLight.enabled = true;
  383.         btnRightLight.enabled = true;
  384.     } else {
  385.         btnLeftLight.enabled = false;
  386.         btnRightLight.enabled = false;
  387.         UpdateScrolling(false);
  388.     }
  389.     
  390.     if (player.playstate == 2) {
  391.         //btnRightLight.disabledimage = getControlImage("light-y-r-ani.gif");
  392.         //btnLeftLight.disabledimage = getControlImage("light-y-l-ani.gif");
  393.         btnPlay.image = getControlImage("unpause-ani.gif");
  394.         btnPlay.uptooltip = "Resume Play";
  395.         btnPlay.hoverimage = getControlImage("unpause-hover-ani.gif");
  396.     } else {
  397.         btnPlay.image = getControlImage("play.png");
  398.         //btnRightLight.disabledimage = getControlImage("light-b-r-off.png");
  399.         //btnLeftLight.disabledimage = getControlImage("light-b-l-off.png");
  400.         btnPlay.hoverimage = getControlImage("play-ani.gif");
  401.         btnPlay.uptooltip = "Play";
  402.     }
  403.  
  404. }
  405.  
  406.  
  407. function OnOpenStateChange()
  408. {
  409.     if (player.OpenState == osMediaOpen)
  410.     {
  411.         //UpdateMainMetadata();
  412.         SetMiniVis();
  413.     } else if (player.OpenState == osPlaylistChanged) {
  414.         strPlaylist = player.currentPlaylist.name;
  415.         txtPlaylist.value = strPlaylist;
  416.     } else {
  417.         txtInfo.value = ":" + arrOpenStates[player.OpenState] + ":";
  418.         UpdateScrolling(false);
  419.     }
  420.  
  421. }
  422.  
  423.  
  424. function UpdateMainMetadata()
  425. {
  426.  
  427.     strMediaType = player.currentmedia.getiteminfo("mediatype");
  428.  
  429.     // Set Track Info
  430.     strInfoText = GetMetadata();
  431.     
  432.     if (intCurrentEffect != 0 && blnTextOverEffect == 1) {
  433.         txtInfo.value = strInfoText;
  434.     } else {
  435.         txtInfo.value = strInfoText;
  436.     }
  437.     
  438.     btnInfoBackground.upToolTip = strInfoText;
  439.  
  440.     // Set Playlist Info
  441.     strPlaylist = player.currentPlaylist.name;
  442.     txtPlaylist.value = strPlaylist;
  443. }
  444.  
  445.  
  446. function InitVideoView()
  447. {
  448.     strVidMode = "VIS";        // video view mode            : display video [VID] or visuals [VIS] by default
  449.     intVidWidth = 350;        // video view width            :
  450.     intVidHeight = 262;        // video view height        :
  451.     strDisplayVideo = "A:0";// video view visible        : 2-part - auto [A] or manual [M] : 0 = hidden, 1 = displayed
  452.     strSkinMode = "N";        // skin flag                : N = Night, S = Silver        (crap I know, but I'm in a hurry!)
  453.  
  454.     // Video View Skin
  455.     var intIndex = 0;
  456.  
  457.     arrVwVideoBigControls = new Array();
  458.  
  459.     arrVwVideoBigControls[intIndex++] = "svwVideoTL.backgroundImage";
  460.     arrVwVideoBigControls[intIndex++] = "svwVideoT.backgroundImage";
  461.     arrVwVideoBigControls[intIndex++] = "svwVideoTR.backgroundImage";
  462.     arrVwVideoBigControls[intIndex++] = "svwVideoTBL.backgroundImage";
  463.     arrVwVideoBigControls[intIndex++] = "svwVideoTBR.backgroundImage";
  464.     arrVwVideoBigControls[intIndex++] = "svwVideoL.backgroundImage";
  465.     arrVwVideoBigControls[intIndex++] = "svwVideoR.backgroundImage";
  466.     arrVwVideoBigControls[intIndex++] = "svwVideoBL.backgroundImage";
  467.     arrVwVideoBigControls[intIndex++] = "svwVideoB.backgroundImage";
  468.     arrVwVideoBigControls[intIndex++] = "svwVideoBR.backgroundImage";
  469.     arrVwVideoBigControls[intIndex++] = "btnResize.image";
  470.     arrVwVideoBigControls[intIndex++] = "btnResize.hoverImage";
  471.     arrVwVideoBigControls[intIndex++] = "btnToggleVidVis.image";
  472.     arrVwVideoBigControls[intIndex++] = "btnToggleVidVis.hoverImage";
  473.     arrVwVideoBigControls[intIndex++] = "btnVisPrev.image";
  474.     arrVwVideoBigControls[intIndex++] = "btnVisPrev.hoverImage";
  475.     arrVwVideoBigControls[intIndex++] = "btnVisNext.image";
  476.     arrVwVideoBigControls[intIndex++] = "btnVisNext.hoverImage";
  477.     arrVwVideoBigControls[intIndex++] = "btnCloseMe.image";
  478.     arrVwVideoBigControls[intIndex++] = "btnCloseMe.hoverImage";
  479.     arrVwVideoBigControls[intIndex++] = "btnMax.image";
  480.     arrVwVideoBigControls[intIndex++] = "btnMax.hoverImage";
  481.     arrVwVideoBigControls[intIndex++] = "btnFS.image";
  482.     arrVwVideoBigControls[intIndex++] = "btnFS.hoverImage";
  483.  
  484.     strTitleMode = ((theme.loadPreference("TitleMode") != "--") ? theme.loadPreference("TitleMode") : strTitleMode);
  485.     strVidMode = ((theme.loadPreference("VidMode") != "--") ? theme.loadPreference("VidMode") : strVidMode);
  486.     intVidWidth = ((theme.loadPreference("VidWidth") != "--") ? parseInt(theme.loadPreference("VidWidth"), 10) : intVidWidth);
  487.     intVidHeight = ((theme.loadPreference("VidHeight") != "--") ? parseInt(theme.loadPreference("VidHeight"), 10) : intVidHeight);    
  488.     strSkinMode = ((theme.loadPreference("SkinMode") != "--") ? theme.loadPreference("SkinMode") : strSkinMode);
  489.     //strDisplayVideo = ((theme.loadPreference("DisplayVideo") != "--") ? theme.loadPreference("DisplayVideo") : strDisplayVideo);
  490.     
  491.     // Split the setting, so we can use the actual setting
  492.     // in Auto mode
  493.     var strDisplayVideoType = strDisplayVideo.split(":")[0];
  494.     var strDisplayVideoVal = strDisplayVideo.split(":")[1];
  495.     
  496.     if (strDisplayVideoType == "A") {strDisplayVideo = strDisplayVideoType + ":1";}
  497.  
  498.     // Set the view skin
  499.      toggleViewSkin('video',strSkinMode);
  500.  
  501.      // Show Video or Visuals
  502.     toggleBigVidVis(strVidMode);
  503.  
  504.     // Init the video view width & height;
  505.     vwVideoBig.width = intVidWidth;
  506.     vwVideoBig.height = intVidHeight;
  507.  
  508.     theme.savePreference("VideoOpen", 1);
  509. }
  510.  
  511.  
  512. function closePlayer()
  513. {
  514.     if ((event.ctrlKey != 0) && (event.shiftKey != 0)) {
  515.         Beep();
  516.         vwMain.alphaBlend = ((vwMain.alphaBlend == 126) ? 255 : 126);
  517.     } else {
  518.         Beep('shutdown');
  519.         view.close();
  520.     }
  521. }
  522.  
  523.  
  524. function CloseVideoView(self)
  525. {
  526.     // Split the setting, so we can use the actual setting
  527.     // in Auto mode
  528.     var strDisplayVideoType = strDisplayVideo.split(":")[0];
  529.     var strDisplayVideoVal = strDisplayVideo.split(":")[1];
  530.  
  531.     if (strDisplayVideoType == "A") {strDisplayVideo = strDisplayVideoType + ":0";}
  532.  
  533.     if (self) {
  534.         view.close();
  535.     } else {
  536.         theme.closeView('vwVideoBig');
  537.     }
  538.     
  539. }
  540.  
  541.  
  542. function SaveVideoView()
  543. {
  544.     // Save the video view width & height;
  545.     intVidWidth = vwVideoBig.width;
  546.     intVidHeight = vwVideoBig.height;
  547.  
  548.     theme.savePreference("VidMode", strVidMode);
  549.     theme.savePreference("VidWidth", intVidWidth);
  550.     theme.savePreference("VidHeight", intVidHeight);
  551.     theme.savePreference("DisplayVideo", strDisplayVideo);
  552.     theme.savePreference("VideoOpen", 0);    
  553. }
  554.  
  555.  
  556. function UpdateScrolling(scroll)
  557. {
  558.     if (scroll != "auto") {
  559.         txtInfo.scrolling = scroll;
  560.     } else {
  561.         txtInfo.scrolling = (txtInfo.textWidth > txtInfo.width);
  562.     }
  563. }    
  564.  
  565.  
  566. function GetMetadata()
  567. {
  568.     var strMetadata = "";
  569.     var strPT = player.currentplaylist.getiteminfo("title");
  570.     var strAlbumID = player.currentmedia.getiteminfo("albumid");
  571.     var strAT = player.currentmedia.getiteminfo("WM/AlbumTitle");
  572.     var strTN = player.currentmedia.getiteminfo("WM/TrackNumber");
  573.     var strTA = player.currentmedia.getiteminfo("author");
  574.     var strTT = player.currentmedia.getiteminfo("title");    
  575.  
  576.     // Split the setting, so we can use the actual setting
  577.     // in Auto mode
  578.     var strTitleModeType = strTitleMode.split(":")[0];
  579.     var strTitleModeVal = strTitleMode.split(":")[1];
  580.         
  581.     switch (strTitleModeType)
  582.     {
  583.     
  584.     // Auto mode - use pre-defined layout
  585.     case "A" :
  586.         if (strAlbumID != "") {
  587.             strMetadata = (strTA != "" ? strTA + " ù " : "") + (strAT != "" ? strAT + " : " : "") + (strTN != "" ? strTN + ". " : "") + strTT;
  588.         } else {
  589.             strMetadata = strTA + " ù " + strTT;
  590.         }
  591.     break;
  592.     
  593.     case "M" :
  594.     
  595.         switch (strTitleModeVal)
  596.         {
  597.     
  598.         // Custom mode - use CustomTitle array
  599.         case "C" :                
  600.             // Loop through CustomTitle array
  601.             for (var n=0; n < arrCustomTitle.length; n++) {
  602.  
  603.                 strCustomType = arrCustomTitle[n].toString();
  604.                 
  605.                 // Do we show the current item?
  606.                 var blnShow = (arrCustomTitleShow[n] == "1");
  607.                 blnShowNext = false;
  608.                 
  609.                 if (n < (arrCustomTitle.length-1)) {
  610.                     blnShowNext = (arrCustomTitleShow[n+1] == "1");
  611.                 }
  612.                                 
  613.                 // Loop round TitleAttributes array - find match to custom element
  614.                 for (var l=0; l < arrTitleAttributes.length; l++) {
  615.  
  616.                     // Construct new array from TitleAttributes
  617.                     var arrTAType = arrTitleAttributes[l].split(":");
  618.                     
  619.                     // If we match types, get content and append to metadata
  620.                     if (strCustomType == arrTAType[0] && blnShow) {
  621.                         
  622.                         switch (strCustomType)
  623.                         {
  624.                             
  625.                             case "PT" :
  626.                                 if (strPT != "") {
  627.                                     
  628.                                     if (n == 0) {
  629.                                         strPT = "[" + strPT + "] ";
  630.                                     } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
  631.                                         strPT = " [" + strPT + "]";
  632.                                     } else {
  633.                                         strPT = "[" + strPT + "] ";
  634.                                     }
  635.                                 }
  636.                             break;
  637.                             
  638.                             case "AT" :
  639.                                 if (strAT != "") {
  640.                                     
  641.                                     if (n == 0) {
  642.                                         strAT = strAT + " : ";
  643.                                     } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
  644.                                         strAT = " " + strAT;
  645.                                     } else {
  646.                                         strAT = strAT + " : ";
  647.                                     }
  648.                                 }
  649.                             break;
  650.                             
  651.                             case "TN" :
  652.                                 if (strTN != "") {
  653.                                     
  654.                                     if (n == 0) {
  655.                                         strTN = strTN + ".";
  656.                                     } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
  657.                                         strTN = "(" + strTN + ")";
  658.                                     } else {
  659.                                         strTN = strTN + ".";
  660.                                     }
  661.                                 }
  662.                             break;
  663.                             
  664.                             case "TA" :
  665.                                 if (strTA != "") {
  666.                                     
  667.                                     if (n == 0) {
  668.                                         strTA = strTA + " ù ";
  669.                                     } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
  670.                                         strTA = " " + strTA;
  671.                                     } else {
  672.                                         strTA = strTA + " ù ";
  673.                                     }
  674.                                 }
  675.                             break;
  676.                             
  677.                             case "TT" :
  678.                                 if (strTT != "") {
  679.                                     
  680.                                     if (n == 0) {
  681.                                         strTT = strTT + " | ";
  682.                                     } else if (n == (arrCustomTitle.length-1) || (!blnShowNext && n == (arrCustomTitle.length-2))) {
  683.                                         strTT = " " + strTT;
  684.                                     } else {
  685.                                         strTT = strTT + " | ";
  686.                                     }
  687.                                 }
  688.                             break;
  689.  
  690.                         }
  691.                         
  692.                         var strAttribValue = eval("str" + strCustomType);
  693.                         strMetadata = strMetadata + strAttribValue;
  694.                     }
  695.                 }
  696.             }
  697.             
  698.         break;
  699.     
  700.         case "D" :
  701.             strMetadata = strTA + " ù " + strTT;
  702.         break;
  703.         }
  704.     
  705.     break;
  706.     }    
  707.         
  708.     return strMetadata;
  709.     
  710. }
  711.  
  712.  
  713. function SetInfoMode()
  714. {
  715.     for (var n=0; n < arrInfoModes.length; n++) {
  716.         
  717.         if (arrInfoModes[n][0] == strInfoMode) {
  718.             intInfoMode = n;            
  719.             txtInfoB.foregroundcolor = arrInfoModes[n][1];
  720.         }
  721.     }
  722.     
  723. }
  724.  
  725.  
  726. function ToggleTrackInfo()
  727. {    
  728.     if (intInfoMode == (arrInfoModes.length - 1))
  729.     {
  730.         intInfoMode = 0;
  731.     }
  732.     else
  733.     {
  734.         intInfoMode++;
  735.     }
  736.  
  737.     strInfoMode = arrInfoModes[intInfoMode][0];
  738.     txtInfoB.foregroundcolor = arrInfoModes[intInfoMode][1];
  739.     
  740.     UpdateTrackInfo();    
  741. }
  742.  
  743.  
  744. function UpdateTrackInfo()
  745. {    
  746.     switch (strInfoMode)
  747.     {
  748.     case "C" :
  749.     txtInfoC.visible = true;
  750.     txtInfoD.visible = false;
  751.     txtInfoT.visible = false;
  752.     break;
  753.     
  754.     case "D" :
  755.     txtInfoC.visible = false;
  756.     txtInfoD.visible = true;
  757.     txtInfoT.visible = false;
  758.     break;
  759.     
  760.     case "T" :
  761.     txtInfoC.visible = false;
  762.     txtInfoD.visible = false;
  763.     txtInfoT.visible = true;
  764.     break;
  765.     
  766.     }
  767.  
  768. }
  769.  
  770.  
  771. function UpdateTrackMetadata()
  772. {
  773.     var intSecs = Math.floor(player.currentmedia.duration - player.controls.currentposition);
  774.     var intMins = Math.floor(intSecs / 60);
  775.  
  776.     intSecs = intSecs - (intMins * 60);
  777.     
  778.     if (intMins < 10) {
  779.         strMins = "0" + intMins;
  780.     } else {
  781.         strMins = intMins;
  782.     }
  783.     
  784.     if (intSecs < 10) {
  785.         strSecs = "0" + intSecs;
  786.     } else {
  787.         strSecs = intSecs;
  788.     }
  789.     
  790.     txtInfoD.value = "-" + strMins + ":" + strSecs
  791. }
  792.  
  793.  
  794. function UpdatePlaylistScrolling()
  795. {
  796.     txtPlaylist.scrolling = (!txtPlaylist.scrolling) && (txtPlaylist.textWidth > txtPlaylist.width);
  797.     if (txtPlaylist.scrolling) {
  798.         btnPlaylist.image = getControlImage("playlist-info-hi.png");
  799.     } else {
  800.         btnPlaylist.image = getControlImage("playlist-info.png");
  801.     }
  802. }
  803.  
  804.  
  805. function movePlaylist()
  806. {    
  807.     // If settings is open, close it first
  808.     if (blnSettingsOpen)    {
  809.         blnOpenPlaylist = true;
  810.         moveSettings();
  811.         return;
  812.     }
  813.  
  814.     blnFinishPlaylistMove = false;
  815.  
  816.     // If the playlist is open, switch the button image, hide the playlist, and start closing
  817.     if (blnPlaylistOpen)
  818.     {
  819.         btnDispPlaylist.image = getControlImage("playlist-btn-closing-ani.gif");
  820.         btnDispPlaylist.hoverimage = getControlImage("playlist-btn-closing-ani.gif");
  821.         svwPlaylist.moveTo(svwPlaylist.left, -(intPlaylistOffset - (18 * 2)), 300);
  822.         plyPlaylist.visible = false;
  823.     }
  824.     else
  825.     {
  826.         btnDispPlaylist.image = getControlImage("playlist-btn-opening-ani.gif");
  827.         btnDispPlaylist.hoverimage = getControlImage("playlist-btn-opening-ani.gif");
  828.         svwPlaylist.moveTo(svwPlaylist.left, 0, 300);
  829.     }
  830.  
  831. }
  832.  
  833.  
  834. function finishPlaylistMove()
  835. {
  836.     // If we have not finished moving, finish the move
  837.     if (!blnFinishPlaylistMove)
  838.     {
  839.         if (blnPlaylistOpen)
  840.         {
  841.             svwPlaylist.moveTo(svwPlaylist.left, -intPlaylistOffset, 1000);
  842.         }
  843.         else
  844.         {
  845.             svwPlaylist.moveTo(svwPlaylist.left, 18, 1000);
  846.         }
  847.  
  848.         blnFinishPlaylistMove = true;
  849.     }
  850.     else
  851.     {
  852.         if (blnPlaylistOpen)
  853.         {
  854.             btnDispPlaylist.image = getControlImage("playlist-btn-open.png");
  855.             btnDispPlaylist.hoverimage = getControlImage("playlist-btn-open-ani.gif");
  856.             blnPlaylistOpen = false;
  857.         }
  858.         else
  859.         {
  860.             btnDispPlaylist.image = getControlImage("playlist-btn-close.png");
  861.             btnDispPlaylist.hoverimage = getControlImage("playlist-btn-close-ani.gif");
  862.             blnPlaylistOpen = true;
  863.         }
  864.  
  865.          plyPlaylist.visible=blnPlaylistOpen;
  866.  
  867.          if (blnOpenSettings)
  868.          {
  869.              blnOpenSettings = false;
  870.              moveSettings();
  871.          }
  872.          
  873.         if (blnClosePlayer)
  874.         {
  875.             blnClosePlayer = false;
  876.             CloseOpen();
  877.         }
  878.  
  879.     }
  880.  
  881. }
  882.  
  883.  
  884. function moveSettings()
  885. {
  886.     // If player is closed
  887.     if (!blnIsOpen) {
  888.         // disable mini-vis button so it can't be opened at the same time :P
  889.         btnVideo.enabled = false;
  890.          
  891.         // If mini-vis is open, close it first
  892.         if (blnMiniVisOpen)    {
  893.             blnOpenSettings = true;
  894.             moveMiniVis();
  895.             return;
  896.         }
  897.     }
  898.  
  899.     // If playlist is open, close it first
  900.     if (blnPlaylistOpen)    {
  901.         blnOpenSettings = true;
  902.         movePlaylist();
  903.         return;
  904.     }
  905.     
  906.     blnFinishSettingsMove = false;
  907.  
  908.     // If settings is open, disable the button and start closing
  909.     if (blnSettingsOpen)
  910.     {
  911.         btnSettings.enabled = false;
  912.         svwSettings.moveTo(svwSettings.left, -(intSettingsOffset - (18 * 2)), 300);
  913.     }
  914.     else
  915.     {
  916.         btnSettings.image = getControlImage("settings-on.png");
  917.         btnSettings.enabled = false;
  918.         svwSettings.moveTo(svwSettings.left, 0, 300);
  919.     }
  920.  
  921. }
  922.  
  923.  
  924. function finishSettingsMove()
  925. {
  926.     // If we have not finished moving, finish the move
  927.     if (!blnFinishSettingsMove)
  928.     {
  929.         if (blnSettingsOpen)
  930.         {
  931.             svwSettings.moveTo(svwSettings.left, -intSettingsOffset, 1000);
  932.         }
  933.         else
  934.         {
  935.             svwSettings.moveTo(svwSettings.left, 18, 1000);
  936.         }
  937.  
  938.         blnFinishSettingsMove = true;
  939.     }
  940.     else
  941.     // We have finished the move, so set stuff accordingly.
  942.     {
  943.         if (blnSettingsOpen) {
  944.             btnSettings.image = getControlImage("settings.png");
  945.             btnSettings.enabled = true;
  946.             btnSettings.uptooltip = "Show Settings";
  947.             blnSettingsOpen = false;
  948.         } else {
  949.             btnSettings.enabled = true;
  950.             btnSettings.uptooltip = "Hide Settings";
  951.             blnSettingsOpen = true;
  952.         }
  953.  
  954.         if (blnClosePlayer) {
  955.             blnClosePlayer = false;
  956.             blnOpenSettings = true;
  957.             CloseOpen();
  958.             return;
  959.         }
  960.         
  961.         if (blnOpenPlaylist) {
  962.             blnOpenPlaylist = false;
  963.             movePlaylist();
  964.             return;
  965.         }
  966.         
  967.         if (blnOpenMiniVis) {
  968.             blnOpenMiniVis = false;
  969.             moveMiniVis();
  970.             return;
  971.         }
  972.  
  973.         btnVideo.enabled = true;
  974.         Beep("squeak");
  975.     }
  976.  
  977. }
  978.  
  979.     
  980. function moveMiniVis()
  981. {
  982.     if (!blnIsOpen) { btnSettings.enabled = false; }
  983.     
  984.     if (blnSettingsOpen && !blnIsOpen)
  985.     {
  986.         blnOpenMiniVis = true;
  987.         moveSettings();
  988.         return;
  989.     }
  990.  
  991.     blnFinishVideoMove = false;
  992.     btnVideo.enabled = false;
  993.     btnDetachVid.enabled = false;
  994.     
  995.     // If open, close it
  996.     if (blnMiniVisOpen)
  997.     {
  998.         vidVideo.visible = false;
  999.         effVis.visible = false;
  1000.         svwMiniVis.moveTo(svwMiniVis.left, -(intMiniVisOffset - (18 * 2)), 300);
  1001.     }
  1002.     else
  1003.     // Otherwise, open.
  1004.     {
  1005.         btnVideo.image = getControlImage("vis-on.png");
  1006.         svwMiniVis.moveTo(svwMiniVis.left, 0, 300);
  1007.     }
  1008.  
  1009. }
  1010.  
  1011.  
  1012. function finishVideoMove()
  1013. {
  1014.     // If we have not finished moving, finish the move
  1015.     if (!blnFinishVideoMove)
  1016.     {
  1017.         if (blnMiniVisOpen)
  1018.         {
  1019.             svwMiniVis.moveTo(svwMiniVis.left, -intMiniVisOffset, 1000);
  1020.         }
  1021.         else
  1022.         {
  1023.             svwMiniVis.moveTo(svwMiniVis.left, 18, 1000);
  1024.         }
  1025.  
  1026.         blnFinishVideoMove = true;
  1027.     }
  1028.     else
  1029.     // We have finished the move, so set stuff accordingly.
  1030.     {
  1031.         // If we were open, we must be closed now.
  1032.         if (blnMiniVisOpen)
  1033.         {
  1034.             btnVideo.image = getControlImage("vis.png");
  1035.             btnVideo.uptooltip="Show Mini-Vid/Vis Screen"
  1036.             blnMiniVisOpen = false;
  1037.         }
  1038.         else
  1039.         {
  1040.             btnVideo.uptooltip="Hide Mini-Vid/Vis Screen"
  1041.             blnMiniVisOpen = true;
  1042.         }
  1043.  
  1044.         btnVideo.enabled = true;
  1045.         btnDetachVid.enabled = true;
  1046.         
  1047.         SetMiniVis();
  1048.         
  1049.         if (blnClosePlayer)
  1050.         {
  1051.             blnClosePlayer = false;
  1052.             blnOpenMiniVis = true;
  1053.             CloseOpen();
  1054.             return;
  1055.         }
  1056.  
  1057.         if (blnOpenSettings) {
  1058.             blnOpenSettings = false;
  1059.             moveSettings();
  1060.             return;
  1061.         }
  1062.         
  1063.         btnSettings.enabled = true;
  1064.         Beep("squeak");
  1065.     }
  1066.  
  1067. }
  1068.  
  1069.  
  1070. function SetMiniVis()
  1071. {
  1072.     if (strMediaType == "video" ) {
  1073.         txtMiniVisTitle.value = "Video";
  1074.         vidVideo.visible = blnMiniVisOpen;
  1075.         effVis.visible = false;
  1076.         
  1077.         // Get video dimensions & save them
  1078.         intVidMediaWidth = player.currentMedia.ImageSourceWidth;
  1079.         intVidMediaHeight = player.currentMedia.ImageSourceHeight;
  1080.         theme.savePreference("VidZoomWidth", intVidMediaWidth);
  1081.         theme.savePreference("VidZoomHeight", intVidMediaHeight);
  1082.  
  1083.  
  1084.     } else {
  1085.         txtMiniVisTitle.value = "Visuals";
  1086.         vidVideo.visible = false;
  1087.         effVis.visible = blnMiniVisOpen;
  1088.     }
  1089.  
  1090. }
  1091.  
  1092.  
  1093. function CloseOpen()
  1094. {
  1095.     // If both settings and mini-vis are open, but we are closing
  1096.     // set only the mini-vis to re-open
  1097.     if (blnOpenSettings && blnOpenMiniVis && blnIsOpen) {
  1098.         blnOpenSettings = false;
  1099.     }
  1100.         
  1101.     if (blnPlaylistOpen) {
  1102.         blnClosePlayer = true;
  1103.         movePlaylist();
  1104.         return;
  1105.     }
  1106.  
  1107.     if (blnMiniVisOpen) {
  1108.         blnClosePlayer = true;
  1109.         moveMiniVis();
  1110.         return;
  1111.     }
  1112.     
  1113.     if (blnSettingsOpen) {
  1114.         blnClosePlayer = true;
  1115.         moveSettings();
  1116.         return;
  1117.     }
  1118.     
  1119.     blnFinishCloseOpen = false;
  1120.  
  1121.     // If we are open, animate the close arrow, set the offset, and start closing
  1122.     if (blnIsOpen) {
  1123.  
  1124.         intOffset = intOffset - intDiff;
  1125.         
  1126.         if (strExpandMode == "R") {
  1127.             btnOpenClose.image = getControlImage("expand-move-ani.gif");
  1128.             btnOpenClose.enabled = false;
  1129.             svwPart2.moveto(intOffset + intBrakeZone, 0, 300);
  1130.         } else {
  1131.             btnOpenClose.image = getControlImage("shrink-move-ani.gif");
  1132.             btnOpenClose.enabled = false;
  1133.             svwPart1.moveto(intDiff - intBrakeZone, 0, 300);
  1134.         }
  1135.     } else {
  1136.         // animate the open arrow, switch controls for open player and start opening
  1137.         btnVolKnob.visible = false;
  1138.         txtVolume.visible = false;
  1139.         csliVolume.visible = false;
  1140.  
  1141.         btnSeek.visible = true;
  1142.         sliSeek.visible = true;
  1143.         btnMute.visible = true;
  1144.         sliVolume.visible = true;
  1145.         btnPlaylist.visible = true;
  1146.         txtPlaylist.visible = true;
  1147.         btnDispPlaylist.visible = true;
  1148.         
  1149.         intOffset = intOffset + intDiff;
  1150.  
  1151.         if (strExpandMode == "R") {
  1152.             btnOpenClose.image = getControlImage("shrink-move-ani.gif");
  1153.             btnOpenClose.enabled = false;
  1154.             svwPart2.moveto(intOffset - intBrakeZone, 0, 300);
  1155.         } else {
  1156.             btnOpenClose.image = getControlImage("expand-move-ani.gif");
  1157.             btnOpenClose.enabled = false;
  1158.             svwPart1.moveto(0 + intBrakeZone, 0, 300);
  1159.         }
  1160.     }
  1161.  
  1162.     blnIsOpen = !blnIsOpen
  1163.  
  1164. }
  1165.  
  1166.  
  1167. function finishCloseOpen()
  1168. {
  1169.     // We have not finished the move, so switch stuff and finish the move
  1170.     if (!blnFinishCloseOpen) {
  1171.  
  1172.         // If we are closing, switch controls for closed player and finish closing
  1173.         // We need to adjust the mini-video view, if we are moving the LHS part
  1174.         if (!blnIsOpen) {
  1175.             btnVolKnob.visible = true;
  1176.             txtVolume.visible=true;
  1177.             csliVolume.visible=true;
  1178.  
  1179.             btnSeek.visible = false;
  1180.             sliSeek.visible=false;
  1181.             btnMute.visible = false;
  1182.             sliVolume.visible=false;
  1183.             btnPlaylist.visible=false;
  1184.             txtPlaylist.visible=false;
  1185.             btnDispPlaylist.visible=false;
  1186.             
  1187.             if (strExpandMode == "R") {
  1188.                 svwPart2.moveTo(intOffset, 0, 1000);
  1189.             } else {
  1190.                 svwPart1.moveTo(intDiff, 0, 1000);
  1191.                 svwMiniVis.left = svwMiniVis.left + intDiff;
  1192.             }
  1193.  
  1194.         } else {
  1195.             
  1196.             if (strExpandMode == "R") {
  1197.                 svwPart2.moveTo(intOffset, 0, 1000);
  1198.             } else {
  1199.                 svwPart1.moveTo(0, 0, 1000);
  1200.                 svwMiniVis.left = svwMiniVis.left - intDiff;
  1201.             }
  1202.         }
  1203.  
  1204.         blnFinishCloseOpen = true;
  1205.  
  1206.     } else {
  1207.         
  1208.         // We are finishing the move, so finish up
  1209.         
  1210.         // Split the setting, so we can use the actual setting
  1211.         // in Auto mode
  1212.         var strPlayerModeType = strPlayerMode.split(":")[0];
  1213.         var strPlayerModeVal = strPlayerMode.split(":")[1];
  1214.  
  1215.         // We have closed, so set stuff accordingly
  1216.         if (!blnIsOpen) {
  1217.             
  1218.             if (strPlayerModeType == "A") {strPlayerMode = strPlayerModeType + ":C";}
  1219.             
  1220.             if (strExpandMode == "R") {
  1221.                 btnOpenClose.image = getControlImage("shrink.png");
  1222.                 btnOpenClose.hoverimage = getControlImage("shrink-ani.gif");
  1223.                 btnOpenClose.enabled = true;
  1224.                 svwSettings.left = btnPlay.left;
  1225.             } else {
  1226.                 btnOpenClose.image = getControlImage("expand.png");
  1227.                 btnOpenClose.hoverimage = getControlImage("expand-ani.gif");
  1228.                 btnOpenClose.enabled = true;
  1229.                 svwSettings.left = btnPlaylist.left + 13;
  1230.             }
  1231.             
  1232.             btnOpenClose.uptooltip="Expand Player";
  1233.  
  1234.         } else {
  1235.             // We have opened
  1236.             if (strPlayerModeType == "A") {strPlayerMode = strPlayerModeType + ":O";}
  1237.  
  1238.             if (strExpandMode == "R") {
  1239.                 btnOpenClose.image = getControlImage("expand.png");
  1240.                 btnOpenClose.hoverimage = getControlImage("expand-ani.gif");
  1241.                 btnOpenClose.enabled = true;
  1242.             } else {
  1243.                 btnOpenClose.image = getControlImage("shrink.png");
  1244.                 btnOpenClose.hoverimage = getControlImage("shrink-ani.gif");
  1245.                 btnOpenClose.enabled = true;
  1246.             }
  1247.             
  1248.             svwSettings.left = btnPlaylist.left + 13;
  1249.             btnOpenClose.uptooltip="Shrink Player";
  1250.         }
  1251.         
  1252.         if (blnOpenMiniVis) {
  1253.             blnOpenMiniVis = false;
  1254.             moveMiniVis();
  1255.         }
  1256.         
  1257.         if (blnOpenSettings && intSwitchSides > 0) {
  1258.             blnOpenSettings = false;
  1259.             moveSettings();
  1260.         }
  1261.         
  1262.         if (intSwitchSides < 0) {
  1263.             intSwitchSides++;
  1264.             toggleExpandMode();
  1265.         }
  1266.         
  1267.     }
  1268.  
  1269. }
  1270.  
  1271.  
  1272. function SwitchToFullScreen()
  1273. {    
  1274.     if (effVisuals.visible) {
  1275.         effVisuals.fullscreen = true;
  1276.     } else if (vidVideoBig.visible) {
  1277.         vidVideoBig.fullscreen = true;
  1278.     }
  1279.         
  1280. }
  1281.  
  1282.  
  1283. function toggleSaveOnExit(value)
  1284. {
  1285.     if (value == undefined) {
  1286.         blnSaveOnExit = Math.abs(blnSaveOnExit - 1);
  1287.     } else {
  1288.         blnSaveOnExit = value;
  1289.     }
  1290.     
  1291.     btnSaveSettings.image = (blnSaveOnExit ? "on.png" : "off.png");
  1292.     txtSaveSettingsV.value = (blnSaveOnExit ? "on" : "off");
  1293.     btnSaveSettings.upTooltip = (blnSaveOnExit ? "settings will be saved" : "settings will NOT be saved");
  1294.     txtSettingMessage.value = btnSaveSettings.upTooltip;
  1295. }
  1296.  
  1297.  
  1298. function toggleUseSoundFx(value)
  1299. {
  1300.     if (value == undefined) {
  1301.         blnUseSoundFx = Math.abs(blnUseSoundFx - 1);
  1302.     } else {
  1303.         blnUseSoundFx = value;
  1304.     }
  1305.     
  1306.     btnUseSoundFx.image = (blnUseSoundFx ? "on.png" : "off.png");
  1307.     txtUseSoundFxV.value = (blnUseSoundFx ? "on" : "off");
  1308.     btnUseSoundFx.upTooltip = (blnUseSoundFx ? "sound effects are on" : "sound effects are off");
  1309.     txtSettingMessage.value = btnUseSoundFx.upTooltip;
  1310. }
  1311.  
  1312.  
  1313. function toggleAutoPlay(value)
  1314. {
  1315.     if (value == undefined) {
  1316.         blnAutoPlay = Math.abs(blnAutoPlay - 1);
  1317.     } else {
  1318.         blnAutoPlay = value;
  1319.     }
  1320.     
  1321.     btnAutoPlay.image = (blnAutoPlay ? "on.png" : "off.png");
  1322.     txtAutoPlayV.value = (blnAutoPlay ? "on" : "off");
  1323.     btnAutoPlay.upTooltip = (blnAutoPlay ? "autoplay is on" : "autoplay is off");
  1324.     txtSettingMessage.value = btnAutoPlay.upTooltip;
  1325. }
  1326.  
  1327.  
  1328. function toggleRestorePlaylist(value)
  1329. {
  1330.     if (value == undefined) {
  1331.         blnRestorePlaylist = Math.abs(blnRestorePlaylist - 1);
  1332.     } else {
  1333.         blnRestorePlaylist = value;
  1334.     }
  1335.     
  1336.     btnRestorePlaylist.image = (blnRestorePlaylist ? "on.png" : "off.png");
  1337.     btnRestorePlaylist.upTooltip = (blnRestorePlaylist ? "playlist will be restored" : "playlist will NOT be restored");
  1338.     txtRestorePlaylistV.value = (blnRestorePlaylist ? "on" : "off");
  1339.     txtSettingMessage.value = btnRestorePlaylist.upTooltip;
  1340. }
  1341.  
  1342.  
  1343. function toggleExpandMode(side)
  1344. {
  1345.     // If the player is closed, we need to open it before
  1346.     // switching sides.
  1347.     if (!blnIsOpen) {
  1348.         intSwitchSides = -1;
  1349.         CloseOpen();
  1350.         return;
  1351.     }
  1352.     
  1353.     // If no value supplied for side, we are toggling,
  1354.     // otherwise, set side explicitly.
  1355.     if (side == undefined) {
  1356.         
  1357.         if (strExpandMode == "L") {
  1358.             strExpandMode = "R"
  1359.         } else {
  1360.             strExpandMode = "L"
  1361.         }
  1362.     } else {
  1363.         strExpandMode = side;
  1364.     }
  1365.  
  1366.     btnExpandMode.image = ((strExpandMode == "L") ? "left.png" : "right.png");
  1367.     btnExpandMode.upTooltip = ((strExpandMode == "L") ? "player expands on left" : "player expands on right");
  1368.      txtExpandModeV.value = ((strExpandMode == "L") ? "left" : "right");
  1369.     txtSettingMessage.value = btnExpandMode.upTooltip;
  1370.     
  1371.     // Switch sides flag is set, so close up again
  1372.     if (intSwitchSides == 0) {
  1373.         intSwitchSides++;
  1374.         CloseOpen();
  1375.         return;
  1376.     }        
  1377.     
  1378. }
  1379.  
  1380.  
  1381. function toggleTitleMode(value)
  1382. {
  1383.     // Split the setting, so we can use the actual setting
  1384.     // in Auto mode
  1385.     var strTitleModeType = strTitleMode.split(":")[0];
  1386.     var strTitleModeVal = strTitleMode.split(":")[1];
  1387.  
  1388.     // If we don't have a value, we are being called
  1389.     // from the settings panel, so toggle the setting
  1390.     if (value == undefined) {
  1391.  
  1392.         switch (strTitleModeType)
  1393.         {
  1394.             case "M" :
  1395.             
  1396.                 switch (strTitleModeVal)
  1397.                 {
  1398.                 case "C" :
  1399.                     strTitleMode = "M:D";
  1400.                 break;
  1401.             
  1402.                 case "D" :
  1403.                     strTitleMode = "A:" + strTitleModeVal;
  1404.                 break;
  1405.                 }
  1406.             
  1407.             break;
  1408.             
  1409.             case "A" :
  1410.                 strTitleMode = "M:C";
  1411.             break;
  1412.         }
  1413.  
  1414.     } else {
  1415.         strTitleMode = value;
  1416.     }
  1417.  
  1418.     strTitleModeType = strTitleMode.split(":")[0];
  1419.     strTitleModeVal = strTitleMode.split(":")[1];
  1420.     
  1421.     switch (strTitleModeType)
  1422.     {
  1423.         case "M" :
  1424.             switch (strTitleModeVal)
  1425.             {
  1426.                 case "C" :
  1427.                     btnTrackInfoMode.image = "on.png";
  1428.                     btnTrackInfoMode.upTooltip = "custom configuration used";
  1429.                     txtTrackInfoModeV.value = "custom";
  1430.                 break;
  1431.             
  1432.                 case "D" :
  1433.                     btnTrackInfoMode.image = "off.png";
  1434.                     btnTrackInfoMode.upTooltip = "default configuration used (artist - title)";
  1435.                     txtTrackInfoModeV.value = "default";
  1436.                 break;
  1437.             }
  1438.             
  1439.         break;
  1440.                 
  1441.         case "A" :
  1442.             btnTrackInfoMode.image = "auto.png";
  1443.             btnTrackInfoMode.upTooltip = "auto configuration used";
  1444.             txtTrackInfoModeV.value = "auto";
  1445.         break;
  1446.     }
  1447.     
  1448.     if (value == undefined) {
  1449.         UpdateMainMetadata();
  1450.     }
  1451. }
  1452.  
  1453.  
  1454. function switchPlayerMode()
  1455. {
  1456.     // Split the setting, so we can use the actual setting
  1457.     // in Auto mode
  1458.     var strPlayerModeType = strPlayerMode.split(":")[0];
  1459.     var strPlayerModeVal = strPlayerMode.split(":")[1];
  1460.  
  1461.     switch (strPlayerModeType)
  1462.     {
  1463.         case "M" :
  1464.         
  1465.             switch (strPlayerModeVal)
  1466.             {
  1467.         
  1468.             case "C" :
  1469.                 strPlayerMode = "A:O";
  1470.             break;
  1471.         }
  1472.         
  1473.         togglePlayerMode()
  1474.         break;
  1475.         
  1476.         case "A" :
  1477.             CloseOpen();
  1478.         break;
  1479.     }
  1480.             
  1481. }
  1482.  
  1483.  
  1484. function togglePlayerMode(value)
  1485. {
  1486.     // Split the setting, so we can use the actual setting
  1487.     // in Auto mode
  1488.     var strPlayerModeType = strPlayerMode.split(":")[0];
  1489.     var strPlayerModeVal = strPlayerMode.split(":")[1];
  1490.  
  1491.     // If we don't have a value, we are being called
  1492.     // from the settings panel, so toggle the setting
  1493.     if (value == undefined) {
  1494.         
  1495.         switch (strPlayerModeType)
  1496.         {
  1497.             case "M" :
  1498.             
  1499.                 switch (strPlayerModeVal)
  1500.                 {
  1501.                 case "O" :
  1502.                     strPlayerMode = "M:C";
  1503.                 break;
  1504.             
  1505.                 case "C" :
  1506.                     strPlayerMode = "A:" + (blnIsOpen ? "O" : "C");
  1507.                 break;
  1508.             }
  1509.             break;
  1510.             
  1511.             case "A" :
  1512.                 strPlayerMode = "M:O";
  1513.             break;
  1514.         }
  1515.  
  1516.     } else {
  1517.         strPlayerMode = value;
  1518.     }
  1519.     
  1520.     strPlayerModeType = strPlayerMode.split(":")[0];
  1521.     strPlayerModeVal = strPlayerMode.split(":")[1];
  1522.     
  1523.     switch (strPlayerModeType)
  1524.     {
  1525.         case "M" :
  1526.             btnPlayerMode.left = txtPlayerMode.left + txtPlayerMode.width - 3;
  1527.             
  1528.             switch (strPlayerModeVal)
  1529.             {
  1530.                 case "O" :
  1531.                     btnPlayerMode.image = "open.png";
  1532.                     txtPlayerModeV.value = "open";
  1533.                     btnPlayerMode.upTooltip = "player mode is open";
  1534.                 break;
  1535.             
  1536.                 case "C" :
  1537.                     btnPlayerMode.image = "shrnk.png";
  1538.                     txtPlayerModeV.value = "closed";
  1539.                     btnPlayerMode.upTooltip = "player mode is closed";                    
  1540.                 break;
  1541.             }
  1542.         
  1543.         break;
  1544.                 
  1545.         case "A" :
  1546.             btnPlayerMode.left = txtPlayerMode.left + txtPlayerMode.width + 1;
  1547.             btnPlayerMode.image = "auto.png";
  1548.             txtPlayerModeV.value = "auto";
  1549.             btnPlayerMode.upTooltip = "player mode is set as current";
  1550.         break;
  1551.     }
  1552.  
  1553.     txtSettingMessage.value = btnPlayerMode.upTooltip;
  1554.  
  1555.     // Close player if necessary
  1556.     
  1557.     if (value != undefined) {
  1558.         
  1559.         // We are setting the state, based on a value passed in (usually on startup)
  1560.         // If state is closed, execute CloseOpen, as player always starts out open
  1561.         // - blnIsOpen is set to true
  1562.         if (strPlayerMode == "A:C" || strPlayerMode == "M:C") {
  1563.             CloseOpen();
  1564.         }
  1565.         
  1566.     }
  1567.  
  1568. }
  1569.  
  1570.  
  1571. function toggleDisplayVideo(value)
  1572. {    
  1573.     // Split the setting, so we can use the actual setting
  1574.     // in Auto mode
  1575.     var strDisplayVideoType = strDisplayVideo.split(":")[0];
  1576.     var strDisplayVideoVal = strDisplayVideo.split(":")[1];
  1577.  
  1578.     // If we don't have a value, we are being called
  1579.     // from the settings panel, so toggle the setting
  1580.     if (value == undefined) {
  1581.         
  1582.         switch (strDisplayVideoType)
  1583.         {
  1584.             case "M" :
  1585.             
  1586.                 switch (strDisplayVideoVal)
  1587.                 {
  1588.                 case "0" :
  1589.                     strDisplayVideo = "M:1";
  1590.                 break;
  1591.             
  1592.                 case "1" :
  1593.                     strDisplayVideo = "A:" + strDisplayVideoVal;
  1594.                 break;
  1595.             }
  1596.             break;
  1597.             
  1598.             case "A" :
  1599.                 strDisplayVideo = "M:0";
  1600.             break;
  1601.         }
  1602.  
  1603.     } else {
  1604.         strDisplayVideo = value;
  1605.     }
  1606.     
  1607.     strDisplayVideoType = strDisplayVideo.split(":")[0];
  1608.     strDisplayVideoVal = strDisplayVideo.split(":")[1];
  1609.     
  1610.     switch (strDisplayVideoType)
  1611.     {
  1612.         case "M" :
  1613.             switch (strDisplayVideoVal)
  1614.             {
  1615.                 case "0" :
  1616.                     btnDisplayVideo.image = "off.png";
  1617.                     txtDisplayVideoV.value = "off";
  1618.                     btnDisplayVideo.upTooltip = "video/visuals view is always hidden";
  1619.                 break;
  1620.             
  1621.                 case "1" :
  1622.                     btnDisplayVideo.image = "on.png";
  1623.                     txtDisplayVideoV.value = "on";
  1624.                     btnDisplayVideo.upTooltip = "video/visuals view is always displayed";
  1625.                 break;
  1626.             }
  1627.         break;
  1628.                 
  1629.         case "A" :
  1630.             btnDisplayVideo.image = "auto.png";
  1631.             txtDisplayVideoV.value = "auto";
  1632.             btnDisplayVideo.upTooltip = "video/visuals view is set as current";
  1633.         break;
  1634.     }
  1635.     
  1636.     txtSettingMessage.value = btnDisplayVideo.upTooltip;
  1637.     theme.savePreference("DisplayVideo", strDisplayVideo);
  1638.  
  1639. }
  1640.  
  1641.  
  1642. function toggleMiniEffects(value)
  1643. {
  1644.     // The mini-effect range is 0 to intNumMiniEffects
  1645.     // with 0 being off - so we need to go to zero, when
  1646.     // we reach intNumMiniEffects
  1647.     
  1648.     var strInfo = strInfoText;
  1649.     // Setting which mini-effect is displayed
  1650.     var intValue = parseInt(value,10);
  1651.  
  1652.     // Hack to set mini-effect explicitly (we need to be in the right position)
  1653.     if (value != undefined) {
  1654.         
  1655.         if (intValue != 0) {
  1656.             intCurrentEffect = intValue - 1;
  1657.         } else {
  1658.             intCurrentEffect = intNumMiniEffects;
  1659.         }
  1660.         
  1661.     }
  1662.  
  1663.     // Turn off current effect (if applicable - it might be 0)
  1664.     if (intCurrentEffect != 0) {
  1665.          eval('effBg' + intCurrentEffect + '.visible=false');
  1666.      }
  1667.     
  1668.     // Increment current effect
  1669.     if (intCurrentEffect < intNumMiniEffects) {
  1670.          intCurrentEffect = intCurrentEffect + 1;
  1671.      } else {
  1672.          // If we are in TextOnEffect mode, go to zero
  1673.          if (blnTextOverEffect == 1) {
  1674.              intCurrentEffect = 0;
  1675.          } else {
  1676.              // Otherwise go to 1, skipping 'no effect'
  1677.              intCurrentEffect = 1;
  1678.          }
  1679.      }
  1680.  
  1681.     // Turn on current effect (if applicable - it might be 0)
  1682.     if (intCurrentEffect != 0) {
  1683.         if (blnTextOverEffect == 1) { strInfo = strInfoText + "                                   "; }
  1684.          eval('effBg' + intCurrentEffect + '.visible=true');
  1685.      }
  1686.  
  1687.     switch (intCurrentEffect)
  1688.     {
  1689.         case 0 :
  1690.             btnMiniEffect.image = "off.png";
  1691.             txtMiniEffectV.value = "off";
  1692.             btnMiniEffect.upTooltip = "mini-effect is off";
  1693.         break;
  1694.           
  1695.         case 1 :
  1696.             btnMiniEffect.image = "on.png";
  1697.             txtMiniEffectV.value = "noise";
  1698.             btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
  1699.         break;
  1700.           
  1701.         case 2 :
  1702.             btnMiniEffect.image = "on.png";
  1703.             txtMiniEffectV.value = "matrix";
  1704.             btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
  1705.         break;
  1706.           
  1707.         case 3 :
  1708.             btnMiniEffect.image = "on.png";
  1709.             txtMiniEffectV.value = "bars";
  1710.             btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
  1711.         break;
  1712.           
  1713.         case 4 :
  1714.             btnMiniEffect.image = "on.png";
  1715.             txtMiniEffectV.value = "lightning";
  1716.             btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
  1717.         break;
  1718.  
  1719.         case 5 :
  1720.             btnMiniEffect.image = "on.png";
  1721.             txtMiniEffectV.value = "electricity";
  1722.             btnMiniEffect.upTooltip = "mini-effect: " + txtMiniEffectV.value;
  1723.         break;
  1724.     }
  1725.     
  1726.     txtSettingMessage.value = btnMiniEffect.upTooltip;
  1727.      txtInfo.value = strInfo;
  1728. }
  1729.  
  1730.  
  1731. function ConstructTrackInfo(move)
  1732. {
  1733.     // move dictates if we need to update the position of elements
  1734.     //         true => update pos & enable
  1735.     //         false => update enable only
  1736.     // we need this cause this routine deals with both enable/disable
  1737.     // and move, and it's more efficient to leave out moving stuff if
  1738.     // all we are doing is enabling/disabling!
  1739.     
  1740.     // Loop through CustomTitle array
  1741.     for (var n=0; n < arrCustomTitle.length; n++) {
  1742.  
  1743.         var strCustomType = arrCustomTitle[n];
  1744.         var strCustomTitleShow = arrCustomTitleShow[n];
  1745.  
  1746.         if (move) {
  1747.             eval("txt" + strCustomType + ".top=" + (txtTrackInfoMode.top + 12 + (n*9)));
  1748.             eval("btn" + strCustomType + "Up.top=txt" + strCustomType + ".top - 1");
  1749.             eval("btn" + strCustomType + "Down.top=txt" + strCustomType + ".top - 1");
  1750.             eval("btn" + strCustomType + "Show.top=txt" + strCustomType + ".top - 1");
  1751.             
  1752.             // If we are on the first item, disable move Up                                
  1753.             if (n == 0) {
  1754.                 eval("btn" + strCustomType + "Up.enabled=false");
  1755.             } else {
  1756.                 eval("btn" + strCustomType + "Up.enabled=true");
  1757.             }
  1758.             
  1759.             // If we are on the last item, disable move Down
  1760.             if (n == (arrCustomTitle.length-1)) {
  1761.                 eval("btn" + strCustomType + "Down.enabled=false");
  1762.             } else {
  1763.                 eval("btn" + strCustomType + "Down.enabled=true");
  1764.             }
  1765.         }
  1766.         
  1767.         if (strCustomTitleShow == "1") {
  1768.             eval("btn" + strCustomType + "Show.image='on.png'");
  1769.             eval("txt" + strCustomType + ".enabled=true");
  1770.         } else {
  1771.             eval("btn" + strCustomType + "Show.image='off.png'");
  1772.             eval("txt" + strCustomType + ".enabled=false");
  1773.         }
  1774.  
  1775.     }
  1776.  
  1777. }
  1778.  
  1779.  
  1780. function MoveTrackInfoItem()
  1781. {
  1782.     var strSE = event.srcElement.id;
  1783.     var strDirection = strSE.slice(5);
  1784.     var strType = strSE.slice(3,5);
  1785.     var intPos = 0;
  1786.     var intNewPos = 0;
  1787.     
  1788.     // Loop round TitleAttributes array - find match to custom element
  1789.     for (var n=0; n < arrCustomTitle.length; n++) {
  1790.         
  1791.         var strCustomType = arrCustomTitle[n]
  1792.         
  1793.         // If we match types, set the position
  1794.         if (strCustomType == strType) {
  1795.             intPos = n;
  1796.             break;
  1797.         }
  1798.     }
  1799.  
  1800.     if (strDirection == "Up" ) {
  1801.         intNewPos = intPos - 1;
  1802.     } else {
  1803.         intNewPos = intPos + 1;
  1804.     }
  1805.     
  1806.     // Now we need to swap array elements
  1807.     // First remove element
  1808.     var strRemoved = arrCustomTitle.splice(intPos, 1);
  1809.     var strShowRemoved = arrCustomTitleShow.splice(intPos, 1);
  1810.     
  1811.     // Then replace it in the new position
  1812.     arrCustomTitle.splice(intNewPos, 0, strRemoved);
  1813.     arrCustomTitleShow.splice(intNewPos, 0, strShowRemoved);
  1814.     
  1815.     // Finally, call construct routine to refresh display
  1816.     ConstructTrackInfo(true);
  1817.     UpdateMainMetadata();
  1818. }
  1819.  
  1820.  
  1821. function ToggleTrackInfoItem()
  1822. {    
  1823.     var strSE = event.srcElement.id;
  1824.     var strType = strSE.slice(3,5);
  1825.     
  1826.     // Loop round TitleAttributes array - find match to custom element
  1827.     for (var n=0; n < arrCustomTitle.length; n++) {
  1828.         
  1829.         // If we match types, toggle the visibility
  1830.         if (arrCustomTitle[n] == strType) {
  1831.             arrCustomTitleShow[n] = Math.abs(arrCustomTitleShow[n] - 1);
  1832.             break;
  1833.         }
  1834.     }
  1835.         
  1836.     // Call construct routine to refresh display
  1837.     ConstructTrackInfo();
  1838.     UpdateMainMetadata();
  1839. }
  1840.  
  1841.  
  1842. function toggleTextOverEffect(value)
  1843. {    
  1844.     // Toggle value if we are not setting explicitly
  1845.     if (value == undefined) {
  1846.         blnTextOverEffect = Math.abs(blnTextOverEffect - 1);
  1847.     } else {
  1848.         blnTextOverEffect = value;
  1849.     }
  1850.     
  1851.     // Initial setting is on, and we call this when we restore settings
  1852.     // so only act if we are doing this and the setting is OFF
  1853.     // (if it's on we don't want to do anything), OR we are toggling
  1854.     // if ((value != undefined && value != "1") || value == undefined) {
  1855.                 
  1856.         if (blnTextOverEffect == 1) {
  1857.             
  1858.             // It's on, so must have been off, so expand text
  1859.             txtInfo.moveto(txtInfo.left - 41, txtInfo.top, 1000);
  1860.             txtInfoShadow.moveto(txtInfoShadow.left - 41, txtInfo.top, 1000);
  1861.             txtInfo.width = txtInfo.width + 41;
  1862.             
  1863.             // and expand effects
  1864.             for (var n=1; n <= intNumMiniEffects; n++)
  1865.             {
  1866.                 eval("effBg" + n + ".width = effBg" + n + ".width + 80");
  1867.             }
  1868.             
  1869.         } else {
  1870.             // It's off, so must have been on, so contract
  1871.             // unless we are on mini-effect zero (none)
  1872.             // in which case, switch to mini-effect 1 first
  1873.             if (intCurrentEffect == 0) {
  1874.                 toggleMiniEffects();
  1875.             }
  1876.             txtInfo.moveto(txtInfo.left + 41, txtInfo.top, 1000);
  1877.             txtInfoShadow.moveto(txtInfoShadow.left + 41, txtInfo.top, 1000);
  1878.             txtInfo.width = txtInfo.width - 41;
  1879.             
  1880.             // and contract effects
  1881.             for (var n=1; n <= intNumMiniEffects; n++)
  1882.             {
  1883.                 eval("effBg" + n + ".width = effBg" + n + ".width - 80");
  1884.             }
  1885.  
  1886.         }
  1887.     
  1888.         // Set the effect to the current effect, to set the text correctly
  1889.         toggleMiniEffects(intCurrentEffect);
  1890.     //}
  1891.     
  1892. }
  1893.  
  1894.  
  1895. function toggleViewSkin(view, value)
  1896. {
  1897.     blnVideoOpen = ((theme.loadPreference("VideoOpen") != "--") ? parseInt(theme.loadPreference("VideoOpen"),10) : blnVideoOpen);
  1898.         
  1899.        if (blnVideoOpen) {
  1900.            CloseVideoView();
  1901.        }
  1902.     
  1903.     // Toggle value if we are not setting explicitly
  1904.     if (value == undefined) {
  1905.         
  1906.         if (strSkinMode =="N") {
  1907.             var strMorphImage="NS-ani.gif";
  1908.             strSkinMode = "S"
  1909.         } else {
  1910.             strSkinMode = "N"
  1911.             var strMorphImage="SN-ani.gif";
  1912.         }
  1913.         
  1914.     } else {
  1915.         strSkinMode = value;
  1916.     }
  1917.     
  1918.     if (view == undefined || view == "main") {
  1919.         var strViewArray = "arrVwMainControls";
  1920.         
  1921.         if (value == undefined) {
  1922.             svwSkinMorph.backgroundimage = strMorphImage;
  1923.             svwPart1.visible = false;
  1924.             svwPart2.visible = false;
  1925.             blnSwitchingSkin = true;
  1926.             vwMain.timerInterval = 1250;
  1927.         }
  1928.         
  1929.     } else {
  1930.         var strViewArray = "arrVwVideoBigControls";
  1931.     }
  1932.  
  1933.     var strControlImage = "";
  1934.     var intViewArrayLength = eval(strViewArray + ".length");
  1935.         
  1936.     // Loop round controls - set images accordingly.    
  1937.     for (var n=0; n < intViewArrayLength; n++)
  1938.     {
  1939.         var strCurrentControlImage = eval(eval(strViewArray + "[n]"));
  1940.         var strViewArrayControl = eval(strViewArray + "[n]");
  1941.         
  1942.         if(strSkinMode == "S"){
  1943.             strControlImage = strViewArrayControl + " = 's-" + strCurrentControlImage + "'";
  1944.         } else {
  1945.             
  1946.             // If we are toggling, we need to remove the first 2 chars, to revert image names
  1947.             // to default night ones.
  1948.             if (value == undefined) {
  1949.                 strControlImage = strViewArrayControl + " = '" + strCurrentControlImage.slice(2) + "'";
  1950.             } else {
  1951.                 // If we are switching to night skin, but not toggling (i.e. setting from startup)
  1952.                 // just use the current image.
  1953.                 strControlImage = strViewArrayControl + " = '" + strCurrentControlImage + "'";
  1954.             }
  1955.         }
  1956.  
  1957.         eval(strControlImage);
  1958.     }
  1959.  
  1960.     // Set various text colors & stuff accordingly
  1961.     if (strViewArray == "arrVwMainControls") {
  1962.  
  1963.         // We are changing the main view
  1964.         if(strSkinMode == "S"){
  1965.             txtPlaylist.foregroundColor = "#333333";
  1966.             txtPlaylistShadow.foregroundColor = "#778899";
  1967.             txtVolume.foregroundColor = "#000000";
  1968.             csliVolume.transparencyColor="#FFFFFF";
  1969.             btnPlayerSkin.image = "silver.png";
  1970.             txtPlayerSkinV.value = "silver";
  1971.             svwPlaylistBody.backgroundcolor="#CCCCCC";
  1972.             plyPlaylist.foregroundColor="#222222";
  1973.             plyPlaylist.backgroundColor="#AAAAAA";
  1974.             plyPlaylist.itemPlayingBackgroundColor="#222222";
  1975.             plyPlaylist.itemPlayingColor="#FFFFFF";
  1976.             plyPlaylist.statusColor="#888888";
  1977.             svwMiniVisBody.backgroundColor="#CCCCCC";
  1978.             txtMiniVisTitle.foregroundColor="#000000";
  1979.         } else {
  1980.             txtPlaylist.foregroundColor = "#000000";
  1981.             txtPlaylistShadow.foregroundColor = "#778899";
  1982.             txtVolume.foregroundColor = "#FFFFFF";
  1983.             csliVolume.transparencyColor="#000000";
  1984.             btnPlayerSkin.image = "night.png";
  1985.             txtPlayerSkinV.value = "night";
  1986.             svwPlaylistBody.backgroundcolor="#000000";
  1987.             plyPlaylist.foregroundColor="#88DDFF";
  1988.             plyPlaylist.backgroundColor="#001133";
  1989.             plyPlaylist.itemPlayingBackgroundColor="#88DDFF";
  1990.             plyPlaylist.itemPlayingColor="#000000";
  1991.             plyPlaylist.statusColor="#223355";
  1992.             svwMiniVisBody.backgroundColor="#000000";
  1993.             txtMiniVisTitle.foregroundColor="#FFFFFF";
  1994.         }
  1995.         
  1996.     } else {
  1997.  
  1998.         // We are displaying the video/vis view        
  1999.         if(strSkinMode == "S"){
  2000.             svwVideoTopBar.backgroundcolor="#DDDDDD";
  2001.             txtVisTitle.foregroundColor="#000000";
  2002.             txtVidTitle.foregroundColor="#000000";
  2003.             svwVideoMiddle.backgroundcolor="#DDDDDD";
  2004.             svwVideoBig.backgroundcolor="#DDDDDD";
  2005.             svwVisBig.backgroundcolor="#DDDDDD";
  2006.         } else {
  2007.             svwVideoTopBar.backgroundcolor="#000000";
  2008.             txtVisTitle.foregroundColor="#FFFFFF";
  2009.             txtVidTitle.foregroundColor="#FFFFFF";
  2010.             svwVideoMiddle.backgroundcolor="#000000";
  2011.             svwVideoBig.backgroundcolor="#000000";
  2012.             svwVisBig.backgroundcolor="#000000";
  2013.         }
  2014.  
  2015.     }
  2016.  
  2017.     theme.savePreference("SkinMode", strSkinMode);
  2018.     
  2019.      if (blnVideoOpen) {
  2020.            theme.openView('vwVideoBig');
  2021.        }
  2022.     
  2023. }
  2024.  
  2025.  
  2026. function getControlImage(image)
  2027. {
  2028.     var strNewControlImage = "";
  2029.     
  2030.     if(strSkinMode == "N"){
  2031.         strNewControlImage = image;
  2032.     } else {
  2033.         strNewControlImage = "s-" + image;
  2034.     }
  2035.     
  2036.     return strNewControlImage;
  2037. }
  2038.  
  2039.  
  2040.  
  2041. function Beep(sound)
  2042. {
  2043.     // Default sound
  2044.     if (sound == undefined) { sound = "beep"; }
  2045.     
  2046.     sound = sound + ".wav";
  2047.     
  2048.     if (blnUseSoundFx == 1) {
  2049.         theme.playsound(sound);
  2050.     }
  2051.     
  2052. }
  2053.  
  2054.  
  2055. function toggleSettings(page)
  2056. {
  2057.     for (var n=1; n <=3; n++) {
  2058.  
  2059.         if (n == page) {
  2060.             var intZindex = 1;
  2061.             var blnEnabled = false;
  2062.             var strBackground = "#001133";
  2063.         } else {
  2064.             var intZindex = 0;
  2065.             var blnEnabled = true;
  2066.             var strBackground = "#000000";
  2067.         }
  2068.         
  2069.         eval("svwSettings" + n + ".zindex=" + intZindex);
  2070.         eval("btnSettings" + n + ".enabled=" + blnEnabled);
  2071.     }
  2072.     
  2073. }
  2074.  
  2075.  
  2076. function toggleBigVidVis(mode)
  2077. {
  2078.     // If no mode supplied, we are toggling
  2079.     if (mode == undefined || mode == "" || mode == null) {
  2080.  
  2081.         if (strVidMode == "VID") {
  2082.             strVidMode = "VIS";
  2083.         } else {
  2084.             strVidMode = "VID";
  2085.         }
  2086.         
  2087.     } else {
  2088.         strVidMode = mode;
  2089.     }
  2090.         
  2091.     // If mode is Video, it was Visuals, so set Video on
  2092.     if (strVidMode == "VID") {
  2093.         var strMetadata = "";
  2094.         var strPT = player.currentplaylist.getiteminfo("title");
  2095.         var strAlbumID = player.currentmedia.getiteminfo("albumid");
  2096.         var strAT = player.currentmedia.getiteminfo("WM/AlbumTitle");
  2097.         var strTN = player.currentmedia.getiteminfo("WM/TrackNumber");
  2098.         var strTA = player.currentmedia.getiteminfo("author");
  2099.         var strTT = player.currentmedia.getiteminfo("title");    
  2100.  
  2101.         if (strAlbumID != "") {
  2102.             strMetadata = (strTA != "" ? strTA + " ù " : "") + (strAT != "" ? strAT + " : " : "") + (strTN != "" ? strTN + ". " : "") + strTT;
  2103.         } else {
  2104.             strMetadata = strTA + " ù " + strTT;
  2105.         }
  2106.  
  2107.         txtVidTitle.value = strMetadata;
  2108.         svwVisBig.visible = false;
  2109.         txtVisTitle.visible = false;
  2110.         txtVidTitle.visible = true;
  2111.         svwVideoBig.visible = true;
  2112.         btnToggleVidVis.image = getControlImage("btn-vis.png");
  2113.         btnToggleVidVis.hoverImage = getControlImage("btn-vis-hi.png");
  2114.         btnToggleVidVis.upTooltip = "show visuals";
  2115.     } else {
  2116.         svwVisBig.visible = true;
  2117.         txtVisTitle.visible = true;
  2118.         svwVideoBig.visible = false;
  2119.         txtVidTitle.visible = false;
  2120.         btnToggleVidVis.image = getControlImage("btn-vid.png");
  2121.         btnToggleVidVis.hoverImage = getControlImage("btn-vid-hi.png");
  2122.         btnToggleVidVis.upTooltip = "show video";
  2123.     }
  2124.     
  2125. }
  2126.  
  2127.  
  2128. function toggleTextOnEffect(value)
  2129. {
  2130.     // Toggle value if we are not setting explicitly
  2131.     if (value == undefined) {
  2132.         
  2133.         switch (strTextOnEffect)
  2134.         {
  2135.             case "Y" :
  2136.                 strTextOnEffect = "A";
  2137.             break;
  2138.             
  2139.             case "N" :
  2140.                 strTextOnEffect = "Y";
  2141.             break;
  2142.             
  2143.             case "A" :
  2144.                 strTextOnEffect = "N";
  2145.             break;            
  2146.         }
  2147.         
  2148.     } else {
  2149.         strTextOnEffect = value;
  2150.     }
  2151.     
  2152.     switch (strTextOnEffect)
  2153.     {
  2154.         case "Y" :
  2155.             //if (value == undefined) { toggleTextOverEffect(1); }
  2156.             txtInfo.visible = "true";
  2157.             txtInfoShadow.visible = "true";
  2158.             btnShowTextOnMiniVis.image = "on.png";
  2159.             btnShowTextOnMiniVis.upTooltip = "track text is displayed";
  2160.             txtShowTextOnMiniVisV.value = "on";
  2161.         break;
  2162.         
  2163.         case "N" :
  2164.             if (value == undefined) { toggleTextOverEffect(1); }
  2165.             txtInfo.visible = "false";
  2166.             txtInfoShadow.visible = "false";
  2167.             btnShowTextOnMiniVis.image = "off.png";
  2168.             btnShowTextOnMiniVis.upTooltip = "track text is NOT displayed";
  2169.             txtShowTextOnMiniVisV.value = "off";
  2170.         break;
  2171.         
  2172.         case "A" :
  2173.             txtInfo.visible = "true";
  2174.             txtInfoShadow.visible = "true";
  2175.             toggleTextOverEffect(0);
  2176.             btnShowTextOnMiniVis.image = "auto.png";
  2177.             btnShowTextOnMiniVis.upTooltip = "side-by-side mode";
  2178.             txtShowTextOnMiniVisV.value = "auto";
  2179.         break;            
  2180.     }
  2181.             
  2182.     txtSettingMessage.value = btnShowTextOnMiniVis.upTooltip;
  2183. }
  2184.  
  2185.  
  2186. function ViewTimer()
  2187. {
  2188.     if (blnSwitchingSkin) {
  2189.         svwPart1.visible = true;
  2190.         svwPart2.visible = true;
  2191.         svwSkinMorph.backgroundimage = "";
  2192.         blnSwitchingSkin = false;
  2193.     } else {
  2194.         togglePlayerMode(strPlayerMode);
  2195.     }
  2196.     
  2197.     view.timerInterval = 0;
  2198. }
  2199.  
  2200.  
  2201. function FadeSettingMessage(fader)
  2202. {
  2203.     eval("btnFader" + fader + ".image=''");
  2204.     eval("btnFader" + fader + ".image='dissolve-ani.gif'");        
  2205. }
  2206.  
  2207.  
  2208. function RepeatMode()
  2209. {    
  2210.     // If the repeat mode is single-track repeat, go to the previous track
  2211.     // We will have moved on by this time, as this function is called when
  2212.     // a playstate of 8 is detected (MediaEnded)
  2213.     
  2214.     if (strRepeatMode == "1" && blnRepeatMode) {
  2215.         blnRepeatMode = false;
  2216.         
  2217.         // If we want to repeat the first track in the playlist, we are now 
  2218.         // on the second track, we can go back but the player sometimes stops
  2219.         // (don't know why this happens!!) - we may have to pick things
  2220.         // up later (onopenstatechange) and start the player via a flag
  2221.         //var objFirstTrack = player.currentPlaylist.item(0);
  2222.         
  2223.         //if (player.currentMedia.isIdentical(objFirstTrack)) {
  2224.         //    player.controls.previous();
  2225.         //    blnRepeatTrigger = true;
  2226.         //} else {
  2227.             player.controls.previous();
  2228.         //}
  2229.         
  2230.     }
  2231.     
  2232.     blnRepeatMode = true;
  2233.     
  2234. }
  2235.  
  2236.  
  2237. function toggleRepeatMode(mode)
  2238. {
  2239.     if (mode == undefined ) {
  2240.     
  2241.         switch (strRepeatMode)
  2242.         {
  2243.             case "Y" :
  2244.                 strRepeatMode = "N";
  2245.             break;
  2246.             
  2247.             case "1" :
  2248.                 strRepeatMode = "Y";
  2249.             break;
  2250.             
  2251.             case "N" :
  2252.                 strRepeatMode = "1";
  2253.             break;            
  2254.         }
  2255.     
  2256.     } else {
  2257.         strRepeatMode = mode;
  2258.     }
  2259.     
  2260.     // Activate repeat mode
  2261.     switch (strRepeatMode)
  2262.     {
  2263.     
  2264.         case "Y" :
  2265.             // Restore crossfade
  2266.             if (blnRestoreCrossfade && (!eqEqualizer.crossFade)) {
  2267.                 toggleCrossfade();
  2268.                 eqEqualizer.crossFadeWindow = intRestoreCrossfadeWindow;
  2269.                 blnRestoreCrossfade = false;
  2270.             }
  2271.             
  2272.             player.settings.setMode("loop", true)
  2273.             btnRepeat.downImage = getControlImage("repeat-on.png");
  2274.             btnRepeat.downTooltip = "Repeat Mode is On";
  2275.             btnRepeat.down = true;
  2276.         break;
  2277.         
  2278.         case "1" :
  2279.             // We need to turn off crossfade, because it doesn't sound nice
  2280.             // when doing a single track repeat.
  2281.             if (eqEqualizer.crossFade) {
  2282.                 blnRestoreCrossfade = true;
  2283.                 intRestoreCrossfadeWindow = eqEqualizer.crossFadeWindow;
  2284.                 toggleCrossfade();
  2285.             }
  2286.  
  2287.             player.settings.setMode("loop", true)
  2288.             btnRepeat.downImage = getControlImage("repeat-1.png");
  2289.             btnRepeat.downTooltip = "Repeat Mode is Single Track";
  2290.             btnRepeat.down = true;
  2291.         break;
  2292.         
  2293.         case "N" :
  2294.             // Restore crossfade
  2295.             if (blnRestoreCrossfade && (!eqEqualizer.crossFade)) {
  2296.                 toggleCrossfade();
  2297.                 eqEqualizer.crossFadeWindow = intRestoreCrossfadeWindow;
  2298.             }
  2299.  
  2300.             player.settings.setMode("loop", false)
  2301.             btnRepeat.downImage = getControlImage("repeat-on.png");
  2302.             btnRepeat.downTooltip = "Repeat Mode is On";
  2303.             btnRepeat.down = false;
  2304.         break;            
  2305.     }
  2306.     
  2307. }
  2308.  
  2309.  
  2310. function toggleEqualizer()
  2311. {
  2312.     eqEqualizer.bypass = !eqEqualizer.bypass;
  2313.     btnEqualizer.down = !eqEqualizer.bypass;
  2314.     txtEqualizerV.value = (eqEqualizer.bypass ? 'off' : 'on');    
  2315. }
  2316.  
  2317.  
  2318. function toggleSRS()
  2319. {
  2320.     eqEqualizer.enhancedAudio = !eqEqualizer.enhancedAudio;
  2321.     btnSRSEffects.down = eqEqualizer.enhancedAudio;
  2322.     txtSRSEffectsV.value = (eqEqualizer.enhancedAudio ? 'on' : 'off');    
  2323. }
  2324.  
  2325.  
  2326. function toggleCrossfade(value)
  2327. {
  2328.     // if no value, we are toggling
  2329.     if (value == undefined) {
  2330.         eqEqualizer.crossFade = !eqEqualizer.crossFade;
  2331.         eqEqualizer.crossFadeWindow = intCrossfadeWindow;
  2332.     } else {
  2333.         // We are setting crossfade explicitly, plus we set the crossfade window
  2334.         eqEqualizer.crossFade = ((blnCrossfade == 1) ? true : false);
  2335.         intCrossfadeWindow = value;
  2336.         sliCrossfadeWindow.value = (intCrossfadeWindow / 1000);
  2337.         CrossfadeWindow();
  2338.     }
  2339.  
  2340.     blnCrossfade = (eqEqualizer.crossFade ? 1 : 0);
  2341.     btnCrossfade.down = eqEqualizer.crossFade;
  2342.     txtCrossfadeV.value = (eqEqualizer.crossFade ? 'on' : 'off');
  2343. }
  2344.  
  2345.  
  2346. function CrossfadeWindow()
  2347. {
  2348.     var intCFW = (Math.floor(sliCrossfadeWindow.value) * 1000);
  2349.     var strCFW = " secs";
  2350.     
  2351.     if (intCFW < 2000) { strCFW = " sec";}
  2352.     
  2353.     strCFW = ((intCFW/1000) + strCFW);
  2354.     
  2355.     eqEqualizer.crossFadeWindow = intCFW;
  2356.     intCrossfadeWindow = intCFW;
  2357.     sliCrossfadeWindow.toolTip = strCFW;
  2358. }
  2359.  
  2360.  
  2361. function toggleOnScreenIcons(value)
  2362. {
  2363.     if (value == undefined) {
  2364.         blnOnScreenIcons = Math.abs(blnOnScreenIcons - 1);
  2365.     } else {
  2366.         blnOnScreenIcons = value;
  2367.     }
  2368.     
  2369.     btnOnScreenIcons.image = (blnOnScreenIcons ? "on.png" : "off.png");
  2370.     txtOnScreenIconsV.value = (blnOnScreenIcons ? "on" : "off");
  2371.     btnOnScreenIcons.upTooltip = (blnOnScreenIcons ? "on-screen icons are shown" : "on-screen icons are NOT shown");
  2372.     txtSettingMessage.value = btnOnScreenIcons.upTooltip;
  2373.     
  2374.     theme.savePreference("OnScreenIcons", blnOnScreenIcons);
  2375. }
  2376.  
  2377.  
  2378. function ZoomVideo(pct)
  2379. {
  2380.     // default the vid view max height & width
  2381.     vwVideoBig.maxWidth = 800;
  2382.     vwVideoBig.maxHeight = 600;
  2383.                 
  2384.     switch (pct) {
  2385.         
  2386.         case 0 :
  2387.             vwVideoBig.width = intVidWidth;
  2388.             vwVideoBig.height = intVidHeight;
  2389.         break;
  2390.  
  2391.         case -1 :
  2392.             var intScreenWidth = event.screenWidth;
  2393.             var intScreenHeight = event.screenHeight;
  2394.             
  2395.             vwVideoBig.maxWidth = intScreenWidth;
  2396.             vwVideoBig.maxHeight = intScreenHeight;
  2397.             vwVideoBig.width = intScreenWidth;
  2398.             vwVideoBig.height = intScreenHeight;
  2399.         break;
  2400.                 
  2401.         default :
  2402.  
  2403.             // get media dimensions
  2404.             intVidMediaWidth = ((theme.loadPreference("VidZoomWidth") != "--") ? parseInt(theme.loadPreference("VidZoomWidth"), 10) : intVidWidth);
  2405.             intVidMediaHeight = ((theme.loadPreference("VidZoomHeight") != "--") ? parseInt(theme.loadPreference("VidZoomHeight"), 10) : intVidHeight);
  2406.     
  2407.             // calculate aspect ratio
  2408.             var intVidRatio = intVidMediaHeight/intVidMediaWidth;
  2409.             // calculate new width based on %zoom (net)
  2410.             var intVidZoomWidth = intVidMediaWidth * (pct/100);
  2411.             // calculate new height based on ratio (net)
  2412.             var intVidZoomHeight = intVidZoomWidth * intVidRatio;
  2413.             
  2414.             // calculate new width (gross)
  2415.             intVidZoomWidth = intVidZoomWidth + (2 * svwVideoTL.width);
  2416.             
  2417.             // calculate new height (gross)
  2418.             intVidZoomHeight = intVidZoomHeight + svwVideoTop.height + svwVideoTopBar.height + svwVideoBottom.height;
  2419.             
  2420.             // set new view dimensions
  2421.             vwVideoBig.width = intVidZoomWidth;
  2422.             vwVideoBig.height = intVidZoomHeight;
  2423.             
  2424.         break;
  2425.         
  2426.     }
  2427. }
  2428.  
  2429.  
  2430. function VideoKeyUp()
  2431. {
  2432.     
  2433.     var strOSI = "";
  2434.     var imgOSI = "";
  2435.     
  2436.     var strKeyModifier = (event.ctrlKey != 0 ? "C" : "N");
  2437.     var intKeyCode = event.keyCode;
  2438.     
  2439.     if (strKeyModifier == "N") { strKeyModifier = (event.altKey != 0 ? "A" : "N"); }
  2440.     
  2441.     switch (strKeyModifier) {
  2442.         
  2443.         // alt modified keys
  2444.         case "A" :
  2445.         
  2446.             switch (intKeyCode) {
  2447.                 
  2448.                 // alt-0 - reset
  2449.                 case 48 :
  2450.                 strOSI = "reset zoom";
  2451.                 imgOSI = "";
  2452.                 ZoomVideo(0);
  2453.                 break;
  2454.                 
  2455.                 // alt-1 - zoom to 50%
  2456.                 case 49 :
  2457.                 strOSI = "zoom 50%";
  2458.                 imgOSI = "";
  2459.                 ZoomVideo(50);
  2460.                 break;
  2461.                 
  2462.                 // alt-2 - zoom to 100%
  2463.                 case 50 :
  2464.                 strOSI = "zoom 100%";
  2465.                 imgOSI = "";
  2466.                 ZoomVideo(100);
  2467.                 break;
  2468.                 
  2469.                 // alt-3 - zoom to 200%
  2470.                 case 51 :
  2471.                 strOSI = "zoom 200%";
  2472.                 imgOSI = "";
  2473.                 ZoomVideo(200);
  2474.                 break;
  2475.             }
  2476.             
  2477.         break;
  2478.         
  2479.         case "C" :
  2480.  
  2481.             switch (intKeyCode) {
  2482.                 
  2483.                 // ctrl-p - pause
  2484.                 case 80 :
  2485.                 
  2486.                 if (player.playState == 2) {
  2487.                     strOSI = "paused";
  2488.                     imgOSI = "osi-pause-ani.gif";
  2489.                     blnResetOSI = false;
  2490.                 } else {
  2491.                     strOSI = "resumed";
  2492.                     imgOSI = "osi-play.png";
  2493.                     blnResetOSI = true;
  2494.                 }
  2495.  
  2496.                 break;
  2497.                 
  2498.                 // ctrl-s - stop
  2499.                 case 83 :
  2500.                 strOSI = "stopped";
  2501.                 imgOSI = "osi-stop.png";
  2502.                 break;                
  2503.             }
  2504.         
  2505.         break;
  2506.         
  2507.         // normal keys
  2508.         default :
  2509.         
  2510.             switch (intKeyCode) {
  2511.                 
  2512.                 // F8 - mute
  2513.                 case 119 :
  2514.                 
  2515.                 if (player.settings.mute) {
  2516.                     strOSI = "mute on";
  2517.                     imgOSI = "osi-mute.png";
  2518.                     blnResetOSI = false;
  2519.                 } else {
  2520.                     strOSI = "mute off";
  2521.                     imgOSI = "osi-unmute.png";
  2522.                     blnResetOSI = true;
  2523.                 }
  2524.                 
  2525.                 break;
  2526.                 
  2527.                 // F9 - vol down
  2528.                 case 120 :
  2529.                 strOSI = "vol- (" + player.settings.volume + ")";
  2530.                 imgOSI = "osi-unmute.png";
  2531.                 break;
  2532.                 
  2533.                 // F10 - vol up
  2534.                 case 121 :
  2535.                 strOSI = "vol+ (" + player.settings.volume + ")";
  2536.                 imgOSI = "osi-unmute.png";
  2537.                 break;
  2538.  
  2539.             }
  2540.             
  2541.         break;
  2542.  
  2543.     }
  2544.  
  2545.     // Set and display the OSI if appropriate
  2546.     if (strOSI != "") {
  2547.         
  2548.         // switch video windowless mode as appropriate
  2549.         blnOnScreenIcons = ((theme.loadPreference("OnScreenIcons") != "--") ? parseInt(theme.loadPreference("OnScreenIcons"),10) : blnOnScreenIcons);
  2550.  
  2551.         if (blnOnScreenIcons == 1 && !vidVideoBig.windowless) {
  2552.             vidVideoBig.visible = false;
  2553.             vidVideoBig.windowless = true;
  2554.             vidVideoBig.visible = true;
  2555.         } else if (blnOnScreenIcons == 0 && vidVideoBig.windowless) {
  2556.             vidVideoBig.visible = false;
  2557.             vidVideoBig.windowless = false;
  2558.             vidVideoBig.visible = true;
  2559.         }
  2560.         
  2561.         txtOSI.value = strOSI;
  2562.         btnOSI.image = imgOSI;
  2563.         vwVideoBig.timerInterval = 0;
  2564.         vwVideoBig.timerInterval = 3000;
  2565.         svwVideoOSI.visible = "true";
  2566.     }
  2567.     
  2568. }
  2569.  
  2570.  
  2571. function checkPage()
  2572. {
  2573.     var strPageImage = "btnInfoText.image";
  2574.     var strImage = "'e.gif'";
  2575.     eval(strPageImage + " = " + strImage);
  2576. }
  2577.  
  2578.  
  2579. function VideoViewTimer()
  2580. {
  2581.     // Disable the timer, and hide the OSI (unless it's a permanent one)
  2582.     vwVideoBig.timerInterval = 0;
  2583.     if (blnResetOSI) { svwVideoOSI.visible = "false"; }
  2584.     blnResetOSI = true;    
  2585. }
  2586.  
  2587.  
  2588. function SwitchPage(direction)
  2589. {    
  2590.     eval("btnHelp" + intCurrentHelpPage + ".visible='false'");
  2591.     
  2592.     if (direction == "F") {
  2593.         // We are trying next page
  2594.         if (intCurrentHelpPage < intNumHelpPages) { intCurrentHelpPage++; }
  2595.         
  2596.         if (intCurrentHelpPage == intNumHelpPages) {
  2597.             btnNextPage.visible="false";
  2598.         } else {
  2599.             btnNextPage.visible="true";
  2600.         }
  2601.         
  2602.         btnPrevPage.visible="true";
  2603.         
  2604.     } else {
  2605.         // Trying for previous page
  2606.         if (intCurrentHelpPage > 1) { intCurrentHelpPage--; }
  2607.         
  2608.         if (intCurrentHelpPage == 1) {
  2609.             btnPrevPage.visible="false";
  2610.         } else {
  2611.             btnPrevPage.visible="true";
  2612.         }
  2613.  
  2614.         btnNextPage.visible="true";
  2615.     }
  2616.     
  2617.     btnInfoText.image = "help" + intCurrentHelpPage + ".png";
  2618.     txtPage.value = "Page " + intCurrentHelpPage + "/" + intNumHelpPages;
  2619.     eval("btnHelp" + intCurrentHelpPage + ".visible='true'");
  2620. }
  2621.