home *** CD-ROM | disk | FTP | other *** search
/ XMANGA 27 / XMANGA27.ISO / Extra / mp10setup.exe / wmploc.DLL / 256 / NOWPLAYING.JS < prev    next >
Encoding:
JavaScript  |  2004-08-11  |  19.4 KB  |  885 lines

  1. // Windows Media Player - Copyright 2000 Microsoft Corporation.
  2. //<script>
  3.  
  4. // Dimensions must match globals.cpp
  5.  
  6. var g_BannerHeight        = 36;
  7. var g_SepWidth            = 3;
  8. var g_SepHeight         = 3;
  9. var g_ControlbarHeight    = 29;
  10.  
  11. var g_SettingsMinHeight = 21;
  12. var g_SettingsMaxHeight = 500;
  13. var g_SidebarMinWidth    = 100;
  14. var g_SidebarMaxWidth    = 500;
  15. var g_PlaylistMinHeight = 35;
  16. var g_MetadataMinHeight = 26;
  17.  
  18. var g_DisplayMinWidth    = 200;
  19. var g_DisplayMinHeight    = 39;
  20. var g_MediaMinHeight    = 20;
  21.  
  22. var PLUGIN_TYPE_BACKGROUND                =        1;
  23. var PLUGIN_TYPE_SEPARATEWINDOW            =        2;
  24. var PLUGIN_TYPE_DISPLAYAREA             =        3;
  25. var PLUGIN_TYPE_SETTINGSAREA            =        4;
  26. var PLUGIN_TYPE_METADATAAREA            =        5;
  27. var PLUGIN_TYPE_BANNERAREA                =        240;
  28.  
  29. var PLUGIN_PROP_CURRENTPRESET            = "CurrentPreset"
  30. var PLUGIN_PROP_SKINFILE                = "SkinFile"
  31.  
  32. var VIEW_FLAGSEX_ATTEMPTEDAUTORUN        =        0x0001;
  33.  
  34. var g_VResize = false;
  35. var g_HResize = false;
  36. var g_SResize = false;
  37.  
  38. var g_fCaptionsDetected = false;
  39. var g_fShowCaptions = false;
  40. var g_fShowBanner    = false;
  41. var g_fClosing = false;
  42.  
  43. var g_rgSettings = new Array(
  44.     "AppColorView",
  45.     "CrossFadeView",
  46.     "EQView",
  47.     "MediaLinkView",
  48.     "AdvancedVideoSettingsView",
  49.     "AdvancedAudioView",
  50.     "SRSView",
  51.     "VideoSettingsView"
  52.     );
  53.  
  54. var g_nSettingsTitleLeft = 0;
  55.  
  56. function OnLoad()
  57. {
  58.     g_nSettingsTitleLeft = txtSettingsTitle.left;
  59.     g_fCaptionsDetected = helper.captionsAvailable;
  60.  
  61.     plMedia.setColumnResizeMode( 0, "Stretches" );
  62.     plMedia.setColumnResizeMode( 1, "AutosizeData" );
  63.  
  64.     ResetDisplayPlugin();
  65.     UpdateCaptions();
  66.     UpdateBannerPlugin();
  67.     UpdateSettingsPlugin();
  68.     UpdateMetadataPlugin();
  69.     UpdateVizControls();
  70.     UpdatePanels();
  71.     UpdateFullScreenButton();
  72.     UpdateSettingsTitle();
  73.     UpdateCustomize();
  74.     SyncBrowserStatus();
  75. }
  76.  
  77. function OnOpenStateChange()
  78. {
  79.     if( osMediaOpen == player.OpenState )
  80.     {
  81.         g_fCaptionsDetected = helper.captionsAvailable;
  82.         ResetDisplayPlugin();
  83.         UpdateCaptions();
  84.         UpdateBannerPlugin();
  85.         UpdatePanels();
  86.         UpdateVizControls();
  87.     }
  88.  
  89.     UpdateFullScreenButton();
  90. }
  91.  
  92. function OnPlayStateChange()
  93. {
  94.     if( psPlaying == player.playState )
  95.     {
  96.         ResetDisplayPlugin();
  97.         UpdateCaptions();
  98.         UpdatePanels();
  99.         UpdateVizControls();
  100.     }
  101.  
  102.     UpdateFullScreenButton();
  103. }
  104.  
  105. function OnScriptCommand(scType, Param)
  106. {
  107.     scType = scType.toUpperCase();
  108.     
  109.     if(scType == "TEXT" ||    scType == "<SYNC" || scType == "CAPTION" || scType == "SYNCHRONIZEDLYRICLYRIC")
  110.     {
  111.         g_fCaptionsDetected = true;
  112.         UpdateCaptions();
  113.         UpdatePanels();
  114.     }
  115. }
  116.  
  117. function UpdatePanels()
  118. {
  119.    if( !g_fClosing )
  120.    {
  121.     var lSettings = 0;
  122.     var lSidebar = 0;
  123.     var lMetadata = 0;
  124.     var lPlaylist = 0;
  125.     var lDisplay = 0;
  126.     var lCaptions = 0;
  127.     var lBanner = 0;
  128.  
  129.     helper.calcLayout( vMain.width, vMain.height, g_fShowCaptions, g_fShowBanner );
  130.  
  131.     lSettings = helper.getLayoutSize( 1 );
  132.     lSidebar = helper.getLayoutSize( 2 );
  133.     lMetadata = helper.getLayoutSize( 3 );
  134.     lPlaylist = helper.getLayoutSize( 4 );
  135.     lDisplay = helper.getLayoutSize( 5 );
  136.     lCaptions = helper.getLayoutSize( 6 );
  137.     lBanner = helper.getLayoutSize( 7 );
  138.  
  139.     if( 0 != lSettings )
  140.     {
  141.         svSettings.verticalAlignment="top";
  142.         svSettings.top=svMain.height-lSettings;
  143.         svSettings.height=lSettings;
  144.         svSettings.verticalAlignment="bottom";
  145.         svSettings.visible = true;
  146.         svMedia.height = svMain.height-svMedia.top-g_SepHeight-lSettings ;
  147.     }
  148.     else
  149.     {
  150.         svSettings.visible = false;
  151.         svMedia.height = svMain.height-svMedia.top;
  152.     }
  153.  
  154.     if( 0 != lSidebar )
  155.     {
  156.         svSidebar.width = lSidebar;
  157.         svMain.width = vMain.width - lSidebar - g_SepWidth;
  158.         svSidebar.visible = true;
  159.     }
  160.     else
  161.     {
  162.         svSidebar.visible = false;
  163.         svSidebar.width = lSidebar;
  164.         svMain.width = vMain.width;
  165.     }
  166.  
  167.     if( 0 != lMetadata )
  168.     {
  169.         if (0 != lPlaylist)
  170.         {
  171.             piMetadata.top = lPlaylist + g_SepHeight;
  172.         }
  173.         else
  174.         {
  175.             piMetadata.top = 0;
  176.         }
  177.  
  178.         piMetadata.height = lMetadata;
  179.         piMetadata.visible = true;
  180.     }
  181.     else
  182.     {
  183.         piMetadata.visible = false;
  184.     }
  185.  
  186.     if( 0 != lPlaylist )
  187.     {
  188.         plMedia.top = 0;
  189.         plMedia.height = lPlaylist;
  190.         plMedia.visible = true;
  191.     }
  192.     else
  193.     {
  194.         plMedia.visible = false;
  195.     }
  196.  
  197.     UpdateResizeBars();
  198.  
  199.     if( 0 != lDisplay )
  200.     {
  201.         piDisplay.height = lDisplay;
  202.         piDisplay.visible = true;
  203.     }
  204.     else
  205.     {
  206.         piDisplay.visible = false;
  207.     }
  208.  
  209.     piBanner.visible = ( 0 != lBanner );
  210.  
  211.     if( 0 != lCaptions )
  212.     {
  213.         piCaptions.verticalAlignment = "top";
  214.         piCaptions.top = lDisplay;
  215.         piCaptions.height = lCaptions;
  216.         piCaptions.verticalAlignment = "bottom";
  217.         piCaptions.visible = true;
  218.     }
  219.     else
  220.     {
  221.         piCaptions.visible = false;
  222.     }
  223.    }
  224. }
  225.  
  226. function ResetDisplayPlugin()
  227. {
  228.         mediacenter.displayView = helper.resolveDisplayView(false);
  229.         UpdateDisplayPlugin();
  230.         UpdateDisplayPreset();
  231. }
  232.  
  233. var g_fSetQuickHideForBorder=false;
  234.  
  235. function OnClose()
  236. {
  237.    g_fClosing = true;
  238.    if( g_fSetQuickHideForBorder )
  239.    {
  240.       QuickHideForBorder( false );
  241.    }
  242. }
  243.  
  244. function QuickHideForBorder(fHide)
  245. {
  246.     if (fHide && (!mediacenter.quickHide) && (!g_fSetQuickHideForBorder))
  247.     {
  248.         g_fSetQuickHideForBorder = true;
  249.         mediacenter.quickHide=true;
  250.     }
  251.     else if ( (!fHide) && g_fSetQuickHideForBorder)
  252.     {
  253.         mediacenter.quickHide=false;
  254.         g_fSetQuickHideForBorder=false;
  255.     }
  256. }
  257.  
  258. function UpdateDisplayPlugin()
  259. {
  260.     piDisplay.objectID = mediacenter.displayView;
  261.  
  262.     // handle skin
  263.  
  264.     if( piDisplay.objectID == "BorderView" )
  265.     {
  266.         QuickHideForBorder(true);        
  267.         var skinfile = helper.getSkinFile();
  268.         piDisplay.setProperty( PLUGIN_PROP_SKINFILE, skinfile );
  269.  
  270.         // Reset if error
  271.  
  272.         if( ( piDisplay.getProperty( PLUGIN_PROP_SKINFILE ) != skinfile ) || ( "" == skinfile ) )
  273.         {
  274.             mediacenter.displayView = helper.resolveDisplayView(true);
  275.             UpdateDisplayPreset();
  276.             QuickHideForBorder(false);
  277.         }
  278.     }
  279.     else
  280.     {        
  281.         QuickHideForBorder(false);        
  282.     }
  283.  
  284.     // Clear the security goo for anything that isn't a border view or metadata view
  285.     if( piDisplay.objectID != "BorderView" && piDisplay.objectID != "MetadataView" )
  286.     {
  287.         helper.htmlViewBaseURL = "";
  288.         helper.htmlViewFullURL = "";
  289.         helper.htmlViewSecureLock = 0;
  290.         helper.htmlViewBusy = false;
  291.     }
  292.  
  293.  
  294.  
  295.     // Reset if error
  296.  
  297.     if( "" == piDisplay.objectID )
  298.     {
  299.             mediacenter.displayView = helper.resolveDisplayView(true);
  300.             UpdateDisplayPreset();
  301.     }
  302.  
  303.     // Reset full screen
  304.  
  305.     if( piDisplay.objectID != "VideoView" && piDisplay.objectID != "VizView" )
  306.     {
  307.             mediacenter.fullScreenAvailable = false;
  308.     }
  309.  
  310.     // Sync back
  311.  
  312.     mediacenter.displayView = piDisplay.objectID;
  313.  
  314. }
  315.  
  316. function UpdateDisplayPreset()
  317. {
  318.     var displayPreset = 0;
  319.  
  320.     if( piDisplay.objectID != "VideoView" && piDisplay.objectID != "VizView" && piDisplay.objectID != "BorderView" && piDisplay.objectID != "MetadataView" )
  321.     {
  322.         piDisplay.setProperty( PLUGIN_PROP_CURRENTPRESET, mediacenter.displayPreset );
  323.  
  324.         // Sync back
  325.  
  326.         displayPreset = piDisplay.getProperty( PLUGIN_PROP_CURRENTPRESET );
  327.         mediacenter.displayPreset = displayPreset;
  328.     }
  329. }
  330.  
  331. function UpdateCaptions()
  332. {
  333.     var fShowCaptions = false;
  334.     
  335.     if ( mediacenter.showCaptions && !PlayingDVD() )
  336.     {
  337.         if( piDisplay.objectID == "VideoView" || piDisplay.objectID == "VizView" || piDisplay.objectID == "AlbumArtView" )
  338.         {        
  339.             fShowCaptions = g_fCaptionsDetected;
  340.         }
  341.     }
  342.     
  343.     g_fShowCaptions = fShowCaptions;
  344. }
  345.  
  346. function UpdateBannerPlugin()
  347. {
  348.     if(player.currentMedia && (player.currentmedia.getItemInfo("BannerURL") != ""))
  349.     {
  350.         g_fShowBanner = true;
  351.     }
  352.     else
  353.     {
  354.         g_fShowBanner = false;
  355.     }
  356. }
  357.  
  358. function UpdateSettingsPlugin()
  359. {
  360.     var settingsPreset = 0;
  361.  
  362.     piSettings.objectID = mediacenter.settingsView;
  363.     piSettings.setProperty( PLUGIN_PROP_CURRENTPRESET, mediacenter.settingsPreset );
  364.  
  365.     // Reset if error
  366.  
  367.     if( "" == piSettings.objectID )
  368.     {
  369.             piSettings.objectID = "EQView";
  370.     }
  371.  
  372.     // Sync back
  373.  
  374.     settingsPreset = piSettings.getProperty( PLUGIN_PROP_CURRENTPRESET );
  375.     mediacenter.settingsView = piSettings.objectID;
  376.     mediacenter.settingsPreset = settingsPreset;
  377.  
  378.     // Update spinners and text
  379.  
  380.     if( 0 <= MapSettingsToIndex( mediacenter.settingsView ) )
  381.     {
  382.         btnSettingsPrev.visible = true;
  383.         txtSettingsTitle.horizontalAlignment="left";
  384.         txtSettingsTitle.left = g_nSettingsTitleLeft;
  385.         txtSettingsTitle.width = btnSettingsClose.left-txtSettingsTitle.left;
  386.         txtSettingsTitle.horizontalAlignment="stretch";
  387.     }
  388.     else
  389.     {
  390.         btnSettingsPrev.visible = false;
  391.         txtSettingsTitle.horizontalAlignment="left";
  392.         txtSettingsTitle.left = btnSettingsPrev.left;
  393.         txtSettingsTitle.width = btnSettingsClose.left-txtSettingsTitle.left;
  394.         txtSettingsTitle.horizontalAlignment="stretch";
  395.     }
  396. }
  397.  
  398. function UpdateMetadataPlugin()
  399. {
  400.     var metadataPreset = 0;
  401.  
  402.     piMetadata.objectID = mediacenter.metadataView;
  403.     piMetadata.setProperty( PLUGIN_PROP_CURRENTPRESET, mediacenter.metadataPreset );
  404.  
  405.     // Reset if error
  406.  
  407.     if( "" == piMetadata.objectID )
  408.     {
  409.             piMetadata.objectID = "MediaInfoView";
  410.             mediacenter.showMetadata = false;
  411.     }
  412.  
  413.     // Sync back
  414.  
  415.     metadataPreset = piMetadata.getProperty( PLUGIN_PROP_CURRENTPRESET );
  416.     mediacenter.metadataView = piMetadata.objectID;
  417.     mediacenter.metadataPreset = metadataPreset;
  418.  
  419. }
  420.  
  421.  
  422. function UpdateVizControls()
  423. {
  424.     // DVD?
  425.  
  426.     if( ( "VideoView" == piDisplay.objectID ) && PlayingDVD() )
  427.     {
  428.             txtVizTitle.visible = false;
  429.             txtVizTitle2.visible = false;
  430.             btnDVDMenu.visible =  ( ("videoManagerMenu" != player.dvd.domain) && ("videoTitleSetMenu" != player.dvd.domain) ); 
  431.             btnDVDResume.visible = !btnDVDMenu.visible;
  432.  
  433.             return;
  434.     }
  435.  
  436.     // No Viz or Border or Video?
  437.  
  438.     if( ( ( mediacenter.showEffects == false ) && ( "VizView" == piDisplay.objectID ) ) || 
  439.             ( "BorderView" == piDisplay.objectID ) || ( "VideoView" == piDisplay.objectID ) )
  440.     {
  441.             txtVizTitle.visible = false;
  442.             txtVizTitle2.visible = false;
  443.             btnDVDMenu.visible = false;
  444.             btnDVDResume.visible = false;
  445.  
  446.             return;
  447.     }
  448.  
  449.     // Viz or Plugin
  450.  
  451.     UpdateVizTitle();
  452.  
  453.     if( ( "VizView" == piDisplay.objectID ) || ( 1 < helper.viewPresetCount( piDisplay.objectID ) ) )
  454.     {
  455.             txtVizTitle2.visible = false; 
  456.             btnDVDMenu.visible = false;
  457.             btnDVDResume.visible = false;
  458.             txtVizTitle.visible = true;
  459.  
  460.             if( "VizView" == piDisplay.objectID )
  461.             {
  462.                 btnVizPrev.upTooltip="res://wmploc/RT_STRING/#1842";
  463.                 btnVizNext.upTooltip="res://wmploc/RT_STRING/#1843";
  464.             }
  465.             else
  466.             {
  467.                 btnVizPrev.upTooltip="res://wmploc/RT_STRING/#1422";
  468.                 btnVizNext.upTooltip="res://wmploc/RT_STRING/#1423";
  469.             }
  470.  
  471.             btnVizPrev.accName = btnVizPrev.upTooltip;
  472.             btnVizNext.accName = btnVizNext.upTooltip;
  473.     }
  474.     else
  475.     {
  476.             txtVizTitle.visible = false; 
  477.             btnDVDMenu.visible = false;
  478.             btnDVDResume.visible = false;
  479.             txtVizTitle2.visible = true; 
  480.     }
  481. }
  482.  
  483. function UpdateVizTitle()
  484. {
  485.     var viewName;
  486.     var presetName;
  487.  
  488.     if( "VizView" == piDisplay.objectID )
  489.     {
  490.             viewName = helper.effectFriendlyName( mediacenter.effectType );
  491.             presetName = helper.effectPresetName( mediacenter.effectType, mediacenter.effectPreset );
  492.     }
  493.     else
  494.     {
  495.             viewName = helper.viewFriendlyName( piDisplay.objectID );
  496.             presetName = helper.viewPresetName( piDisplay.objectID, mediacenter.displayPreset );
  497.     }
  498.  
  499.     if (""!=presetName)
  500.     {
  501.             txtVizTitle.value = viewName + " : " + presetName;
  502.     }
  503.     else
  504.     {
  505.             txtVizTitle.value = viewName;
  506.     }
  507.  
  508.     txtVizTitle2.value = txtVizTitle.value;
  509. }
  510.  
  511. function PreviousDisplay()
  512. {
  513.     if( "VizView" == piDisplay.objectID )
  514.     {
  515.         if (event.shiftKey)
  516.         {
  517.             mediacenter.vizRequest = VR_VIZ_PREV;
  518.         }
  519.         else
  520.         {
  521.             mediacenter.vizRequest = VR_PRESET_PREV;
  522.         }
  523.     }
  524.     else
  525.     {
  526.         var presetCount = helper.viewPresetCount( piDisplay.objectID );
  527.         var preset = mediacenter.displayPreset;
  528.  
  529.         preset = preset - 1;
  530.  
  531.         if( preset < 0 )
  532.         {
  533.             preset = presetCount - 1;
  534.         }
  535.  
  536.         mediacenter.displayPreset = preset;
  537.     }
  538. }
  539.  
  540. function NextDisplay()
  541. {
  542.     if( "VizView" == piDisplay.objectID )
  543.     {
  544.         if (event.shiftKey)
  545.         {
  546.             mediacenter.vizRequest = VR_VIZ_NEXT;
  547.         }
  548.         else
  549.         {
  550.             mediacenter.vizRequest = VR_PRESET_NEXT;
  551.         }
  552.     }
  553.     else
  554.     {
  555.         var presetCount = helper.viewPresetCount( piDisplay.objectID );
  556.         var preset = mediacenter.displayPreset;
  557.  
  558.         preset = preset + 1;
  559.  
  560.         if( preset >= presetCount )
  561.         {
  562.             preset = 0;
  563.         }
  564.  
  565.         mediacenter.displayPreset = preset;
  566.     }
  567. }
  568.  
  569. function PreviousSettings()
  570. {
  571.     var nIndex = MapSettingsToIndex( mediacenter.settingsView );
  572.     var nCurrentIndex = nIndex;
  573.     
  574.     do
  575.     {
  576.         nIndex = nIndex - 1;
  577.  
  578.         if( 0 > nIndex )
  579.         {
  580.             nIndex = g_rgSettings.length - 1;
  581.         }
  582.  
  583.         mediacenter.settingsView = g_rgSettings[ nIndex ];
  584.  
  585.     } while( ( MapSettingsToIndex( mediacenter.settingsView ) == nCurrentIndex ) && ( nCurrentIndex != nIndex ) );
  586. }
  587.  
  588. function NextSettings()
  589. {
  590.     var nIndex = MapSettingsToIndex( mediacenter.settingsView );
  591.     var nCurrentIndex = nIndex;
  592.     
  593.     do
  594.     {
  595.         nIndex = nIndex + 1;
  596.  
  597.         if( g_rgSettings.length <= nIndex )
  598.         {
  599.             nIndex = 0;
  600.         }
  601.  
  602.         mediacenter.settingsView = g_rgSettings[ nIndex ];
  603.  
  604.     } while( ( MapSettingsToIndex( mediacenter.settingsView ) == nCurrentIndex ) && ( nCurrentIndex != nIndex ) );
  605. }
  606.  
  607. function UpdateResizeBars()
  608. {
  609.         if( plMedia.visible && piMetadata.visible )
  610.         {
  611.                 btnSResize.top = plMedia.height;
  612.                 btnSResize.height = g_SepWidth;
  613.                 btnSResize.visible = true;
  614.         }
  615.         else
  616.         {
  617.                 btnSResize.visible = false;
  618.         }
  619.  
  620.         if( plMedia.visible || piMetadata.visible )
  621.         {
  622.                 btnVResize.horizontalAlignment='left';
  623.                 btnVResize.left = vMain.width - plMedia.width - g_SepWidth;
  624.                 btnVResize.width = g_SepWidth;
  625.                 btnVResize.horizontalAlignment='right';
  626.                 btnVResize.visible = true;
  627.         }
  628.         else
  629.         {
  630.                 btnVResize.visible = false;
  631.         }
  632.  
  633.         if( svSettings.visible )
  634.         {
  635.                 btnHResize.verticalAlignment='top';
  636.                 btnHResize.top = svMain.height - svSettings.height - g_SepHeight;
  637.                 btnHResize.height = g_SepHeight;
  638.                 btnHResize.verticalAlignment='bottom';
  639.                 btnHResize.visible = true;
  640.         }
  641.         else
  642.         {
  643.                 btnHResize.visible = false;
  644.         }
  645. }
  646.  
  647. function UpdateFullScreenButton()
  648. {
  649.     if( mediacenter.fullScreenAvailable && ( osMediaOpen == player.openState ) &&
  650.             ( ( player.playState >= psPaused ) && ( player.playState <= psScanReverse ) ) )
  651.     {
  652.             btnFullScreen.enabled=true;
  653.     }
  654.     else
  655.     {
  656.             btnFullScreen.enabled=false;
  657.     }
  658. }
  659.  
  660. function UpdateSettingsTitle()
  661. {
  662.         var viewName = helper.viewFriendlyName( piSettings.objectID );
  663.  
  664.         txtSettingsTitle.value = viewName;
  665. }
  666.  
  667. function OnVResizeStart()
  668. {
  669.         btnVResize.horizontalAlignment='left';
  670.         svSidebar.horizontalAlignment='left';
  671.         g_VResize=true;
  672. }
  673.  
  674. function OnVResize(xPos)
  675. {
  676.         var plLeft=xPos+g_SepWidth;
  677.  
  678.         if(xPos<g_DisplayMinWidth)
  679.         {
  680.                 xPos=g_DisplayMinWidth;
  681.                 plLeft=xPos+g_SepWidth;
  682.         }
  683.         else if(vMain.width-plLeft<g_SidebarMinWidth)
  684.         {
  685.                 plLeft=vMain.width-g_SidebarMinWidth;
  686.                 xPos=plLeft-g_SepWidth;
  687.         }
  688.         else if(vMain.width-plLeft>g_SidebarMaxWidth)
  689.         {
  690.                 plLeft=vMain.width-g_SidebarMaxWidth;
  691.                 xPos=plLeft-g_SepWidth;
  692.         }
  693.  
  694.         btnVResize.left = xPos;
  695.         btnVResize.width = g_SepWidth;
  696.         svMain.width = xPos;
  697.         svSidebar.left = plLeft;
  698.         svSidebar.width = vMain.width-plLeft;
  699.         vMain.updateWindow();
  700. }
  701.  
  702. function OnVResizeEnd()
  703. {
  704.         g_VResize=false;
  705.         btnVResize.horizontalAlignment='right';
  706.         svSidebar.horizontalAlignment='right';
  707.         mediacenter.playlistWidth=svSidebar.width;
  708.         mediacenter.metadataWidth=svSidebar.width;
  709. }
  710.  
  711. function OnHResizeStart()
  712. {
  713.         btnHResize.verticalAlignment='top';
  714.         svSettings.verticalAlignment='top';
  715.         g_HResize=true;
  716. }
  717.  
  718. function OnHResize(yPos)
  719. {
  720.         var plTop=yPos+g_SepHeight;
  721.  
  722.         if(yPos<g_DisplayMinHeight)
  723.         {
  724.                 yPos=g_DisplayMinHeight;
  725.                 plTop=yPos+g_SepHeight;
  726.         }
  727.         else if(svMain.height-g_ControlbarHeight-plTop<g_SettingsMinHeight)
  728.         {
  729.                 plTop=svMain.height-g_ControlbarHeight-g_SettingsMinHeight;
  730.                 yPos=plTop-g_SepHeight;
  731.         }
  732.         else if(svMain.height-g_ControlbarHeight-plTop>g_SettingsMaxHeight)
  733.         {
  734.                 plTop=svMain.height-g_ControlbarHeight-g_SettingsMaxHeight;
  735.                 yPos=plTop-g_SepHeight;
  736.         }
  737.  
  738.         btnHResize.top = yPos;
  739.         btnHResize.height = g_SepHeight;
  740.         svMedia.height=yPos-svMedia.top;
  741.         svSettings.top=plTop;
  742.         svSettings.height=svMain.height-g_ControlbarHeight-plTop;
  743.         vMain.updateWindow();
  744. }
  745.  
  746. function OnHResizeEnd()
  747. {
  748.         g_HResize=false;
  749.         btnHResize.verticalAlignment='bottom';
  750.         svSettings.verticalAlignment='bottom';
  751.         mediacenter.settingsHeight=svSettings.height;
  752. }
  753.  
  754. function OnSResizeStart()
  755. {
  756.         g_SResize=true;
  757. }
  758.  
  759. function OnSResize(yPos)
  760. {
  761.         var plTop=yPos+g_SepHeight;
  762.  
  763.         if(svSidebar.height-plTop<g_PlaylistMinHeight)
  764.         {
  765.                 plTop=svSidebar.height-g_PlaylistMinHeight;
  766.                 yPos=plTop-g_SepHeight;
  767.         }
  768.  
  769.         if(yPos<g_MetadataMinHeight)
  770.         {
  771.                 yPos=g_MetadataMinHeight;
  772.                 plTop=yPos+g_SepHeight;
  773.         }
  774.  
  775.         btnSResize.top = yPos;
  776.         btnSResize.height = g_SepHeight;
  777.         plMedia.height=yPos;
  778.         piMetadata.top=plTop;
  779.         piMetadata.height=svSidebar.height-plTop;
  780.         vMain.updateWindow();
  781. }
  782.  
  783. function OnSResizeEnd()
  784. {
  785.         g_SResize=false;
  786.         mediacenter.metadataHeight=piMetadata.height;
  787. }
  788.  
  789. function UpdateCustomize()
  790. {
  791.         btnCustomize.enabled = mediacenter.showTitles || mediacenter.showPlaylist || mediacenter.showMetadata || mediacenter.showSettings || mediacenter.quickHide;
  792.         btnCustomize.downimage = btnCustomize.down ? "res://wmploc/#1730" : "res://wmploc/#1734";
  793.         btnCustomize.accName = btnCustomize.down ? btnCustomize.downTooltip : btnCustomize.upTooltip;
  794. }
  795.  
  796. function CustomizeMenu()
  797. {
  798.         mnuCustomize.top = btnCustomizeMenu.top+btnCustomizeMenu.height;
  799.         mnuCustomize.left = btnCustomizeMenu.left;
  800.  
  801.         mnuCustomize.showEx( 3 );
  802. }
  803.  
  804. function OnLinkRequest()
  805. {
  806.     theme.CurrentViewID="vBrowser";
  807. }
  808.  
  809. function OnBrowserLoad()
  810. {
  811.     Browser1.SetProperty( "linkRequestParams", helper.linkRequestParams );
  812.     Browser1.SetProperty( "linkRequest", helper.linkRequest );
  813. }
  814.  
  815. function OnBrowserBack()
  816. {
  817.     Browser1.visible=false;
  818.     vBrowser.updateWindow();
  819.     theme.CurrentViewID="vMain";
  820. }
  821.  
  822. function PlayingDVD()
  823. {
  824.     return ( (player.currentPlaylist.count>0) && (player.currentPlaylist.item(0).sourceURL.indexOf("wmpdvd:")==0));
  825. }
  826.  
  827. function MapSettingsToIndex( View )
  828. {
  829.     for (var i = 0; i < g_rgSettings.length; i++)
  830.     {
  831.         if (View == g_rgSettings[i])
  832.         {
  833.             return( i );
  834.         }
  835.     }
  836.  
  837.     return( -1 );
  838. }
  839.  
  840.  
  841. function SyncBrowserStatus()
  842. {
  843.     UpdateBrowserIcon();
  844.     txtBrowserBaseURL.value = helper.htmlViewBaseURL;
  845. }
  846.  
  847. function UpdateBrowserIcon()
  848. {
  849.     /*
  850.         Here's the enum from IE.  Can't really use it in script:
  851.         
  852.             typedef enum SecureLockIconConstants {
  853.                 secureLockIconUnsecure = 0,
  854.                 secureLockIconMixed = 0x1,    
  855.                 secureLockIconUnknownBits = 0x2,
  856.                 secureLockIcon40Bit = 0x3,
  857.                 secureLockIcon56Bit = 0x4,
  858.                 secureLockIconFortezza = 0x5,
  859.                 secureLockIcon128Bit = 0x6
  860.             } SecureLockIconConstants;        
  861.     */
  862.  
  863.     //We're reusing the toolbar strip here, so our customslider needs to be
  864.     //kept between 35 and (36+15).  This is actually simpler than it looks at first.
  865.     if (helper.htmlViewSecureLock>=2)
  866.     {
  867.         //this means we have actual security.  2 is secureLockIconUnknownBits.  36 is the index of the lock
  868.         //note that we don't animate if there is security
  869.         browserIcon.value=35;
  870.     }
  871.     else 
  872.     { 
  873.         if (helper.htmlViewBusy)
  874.         {
  875.             //36 is the index of the first frame of the spinning globe.
  876.             browserIcon.value = 36 + (((browserIcon.value-36)%15)+1);
  877.             browserIcon.moveTo(browserIcon.left,browserIcon.top,100);
  878.         } 
  879.         else
  880.         { 
  881.             browserIcon.value=36;
  882.         } 
  883.     }
  884. }
  885.