home *** CD-ROM | disk | FTP | other *** search
/ Minami 79 / MINAMI79.iso / Extra / MPSetup.exe / 1033 / RCDATA / CABINET / wmploc.DLL / 256 / CORPORATE.JS < prev    next >
Text File  |  2002-12-14  |  8KB  |  283 lines

  1. //<script>
  2. //SKIN MUST INCLUDE res://wmploc/RT_TEXT/#169 as a scriptfile
  3.  
  4. var g_kCaptionWindowHeight=100;
  5. var g_kDefaultViewHeight=274;
  6. var g_kDefaultViewWidth=300;
  7. var g_kDefaultScreenHeight=204;
  8. var g_kDefaultViewHeightCaptions=(g_kDefaultViewHeight+g_kCaptionWindowHeight);
  9.  
  10. var g_kMinimumResizeHeight = 140;
  11. var g_kMinimumResizeWidth = g_kDefaultViewWidth;
  12.  
  13. function InitCorporate()
  14. {
  15.     var contrastView = 'corporate' + mediacenter.contrastMode;
  16.     if (contrastView != view.id) theme.currentViewID = contrastView;
  17.     DoSnapToSize();
  18.     svLogo.alphaBlendTo(0,1900); 
  19.     InitSamiDisplay();
  20.     InitVisualizations(); // Init the Video and Visualization windows
  21.     InitCorporateControls();
  22. }
  23.  
  24. var g_lastVideoHeight=-1;
  25. var g_lastVideoWidth=-1;
  26. var g_lastUserAudioHeight=-1;
  27. var g_lastUserAudioWidth=-1;
  28. var g_captionsWereShowingOnLastAudio=null;
  29.  
  30.  
  31. function DoSnapToSize()
  32. {
  33.     if (player.openState==osMediaOpen)
  34.     {
  35.         var h = player.currentMedia.imageSourceHeight; 
  36.         var w = player.currentMedia.imageSourceWidth;
  37.         // do this only if it is different than the previous file's height/width
  38.         if ( (h!=g_lastVideoHeight) || (w!=g_lastVideoWidth) )
  39.         {
  40.             if ( (h!=0) && (w!=0) )
  41.             {
  42.                 if (g_lastVideoHeight==0)
  43.                 {
  44.                     g_lastUserAudioHeight=view.height;
  45.                     g_lastUserAudioWidth=view.width;
  46.                     g_captionsWereShowingOnLastAudio = mediacenter.showCaptions;
  47.                 }             
  48.                 SnapToVideoSize(h,w);
  49.             }
  50.             else
  51.             {
  52.                 if ( (g_lastVideoHeight>0) && (g_lastUserAudioHeight>0))
  53.                 {
  54.                     if (g_captionsWereShowingOnLastAudio != mediacenter.showCaptions)
  55.                     {
  56.                         view.height = g_captionsWereShowingOnLastAudio ? g_lastUserAudioHeight - g_kCaptionWindowHeight : g_lastUserAudioHeight + g_kCaptionWindowHeight;
  57.                     }
  58.                     else
  59.                     {
  60.                         view.height = g_lastUserAudioHeight;
  61.                     }
  62.                     view.width=g_lastUserAudioWidth;
  63.                 }
  64.             }
  65.             g_lastVideoHeight = h;
  66.             g_lastVideoWidth = w;
  67.         }
  68.     }
  69. }
  70.  
  71. function SnapToVideoSize(isHeight, isWidth)
  72. {
  73.     if (null!=isHeight)
  74.     {    
  75.         isHeight = isHeight*(mediacenter.videoZoom/100);
  76.         var nonVideoHeight = view.height - svScreen.height;
  77.         var newWindowHeight = Math.max(isHeight+nonVideoHeight,g_kMinimumResizeHeight);
  78.         view.height = newWindowHeight;
  79.     }
  80.     
  81.     if (null!=isWidth)
  82.     {
  83.         isWidth = isWidth*(mediacenter.videoZoom/100);
  84.         var nonVideoWidth = view.width - svScreen.width;
  85.         var newWindowWidth = Math.max(isWidth + nonVideoWidth,g_kMinimumResizeWidth);
  86.         view.width = newWindowWidth;
  87.     }
  88. }
  89.  
  90. function InitVisualizations()
  91. {
  92.     if (player.openState==osMediaOpen)
  93.     {
  94.         if (player.currentMedia.ImageSourceWidth > 0)
  95.         {
  96.             myeffect.visible=false;
  97.             video1.visible=true;
  98.         } 
  99.         else 
  100.         { 
  101.             video1.visible=false;
  102.             myeffect.visible=mediacenter.showEffects;
  103.         }
  104.     }
  105. }
  106.  
  107. function OnPlayStateChangeViz()
  108. {
  109.     InitVisualizations();
  110. }
  111.  
  112. function OnOpenStateChangeViz()
  113. {
  114.     InitVisualizations();
  115. }
  116.  
  117. function AutoSize()
  118. {
  119.     if (player.openState==osMediaOpen)
  120.     {
  121.         DoSnapToSize();
  122.     }
  123.     else
  124.     {
  125.         if (mediacenter.showCaptions)
  126.         {
  127.             view.height=g_kDefaultViewHeightCaptions;
  128.         }
  129.         else
  130.         {
  131.             view.height=g_kDefaultViewHeight;
  132.         }
  133.         view.width=g_kDefaultViewWidth;
  134.     }
  135. }
  136.  
  137.  
  138. function CheckForAdBanner(media)
  139. {   
  140.     var oldHeight = svBanner.height;
  141.     if (media.getItemInfo('BannerURL') != '')
  142.     {
  143.         AdBanner.image="WMPImage_AdBanner";
  144.         svBanner.height=AdBanner.height;
  145.         AdBanner.tabStop=true;
  146.     }
  147.      
  148.     else
  149.     {
  150.         svBanner.height=0;
  151.         AdBanner.tabStop=false;
  152.     }
  153.     if (svBanner.height!=oldHeight)
  154.     {    
  155.         svVideo.height  = view.height - svTransport.height - svBanner.height; 
  156.         svVisual.height = view.height - svTransport.height - svBanner.height;
  157.         svBanner.top    = svVideo.top + svVideo.height;
  158.     }
  159. }
  160.  
  161. function OnBannerClick()
  162. {
  163.     if (player.openState==osMediaOpen)
  164.     {
  165.         var strTargetURL = player.currentmedia.getItemInfo("BannerInfoURL");
  166.         if ( strTargetURL != "")
  167.         {
  168.             player.launchURL(strTargetURL);   
  169.         }
  170.     }
  171. }
  172.  
  173. function OnBannerMouseOver()
  174. {
  175.     if (player.openState==osMediaOpen)
  176.     {
  177.         if ( player.currentmedia.getItemInfo("BannerInfoURL") != "")
  178.         {
  179.             AdBanner.cursor = "hand";
  180.         }
  181.         else
  182.         {
  183.             AdBanner.cursor = "system";
  184.         }
  185.     }
  186. }
  187.  
  188. function CaptionsView_OnOpenStateChangeEvent(NewState)
  189. {
  190.     switch (NewState)
  191.     {
  192.         case osMediaChanging:
  193.             ClearSamiDisplay();
  194.             break;
  195.     }
  196. }
  197.  
  198. function InitSamiDisplay()
  199. {
  200.     Browser1.loadSpecialPage("SAMI");
  201. }
  202.  
  203. function ClearSamiDisplay()
  204. {
  205.     handleScriptCommand("Text", "");
  206. }
  207.  
  208. function handleScriptCommand(scType, Param)
  209. {
  210.     var Document = 0;
  211.     var ElemCollection = 0;
  212.     var Element = 0;
  213.     scType = scType.toUpperCase();
  214.  
  215.     if(scType == "TEXT" ||  scType == "<SYNC" || scType == "CAPTION")
  216.     {
  217.         Browser1.showSAMIText(Param);
  218.     }
  219. }
  220.  
  221. function SetCaptions(visible)
  222. {
  223.     var oldWidth = view.width;
  224.     if (svTransport.top)
  225.     {
  226.         svScreen.verticalAlignment="top";
  227.         if (visible) 
  228.         {
  229.             var intendedHeight = svCaptions.top + g_kCaptionWindowHeight + svTransport.height;
  230.             view.height = intendedHeight;
  231.             if (view.height != intendedHeight)
  232.             {
  233.                theme.currentViewID=(view.id);              
  234.             }
  235.  
  236.             Browser1.height=g_kCaptionWindowHeight;
  237.         }
  238.         else
  239.         {
  240.             view.height = svCaptions.top + svTransport.height;            
  241.         }
  242.         svScreen.verticalAlignment="stretch";
  243.     }
  244.     if (view.width!=oldWidth)
  245.     {
  246.         theme.currentViewID=(view.id);              
  247.     }
  248. }
  249.  
  250. function InitCorporateControls()
  251. {
  252.     if (view.id=="corporateWB")
  253.     {
  254.         g_strPlayImage="res://wmploc/#1849";
  255.         g_strPlayHover="res://wmploc/#1849";
  256.         g_strPlayDown="res://wmploc/#1849";
  257.         g_strPauseUp="res://wmploc/#1851";
  258.         g_strPauseHover="res://wmploc/#1851";
  259.         g_strPauseDown="res://wmploc/#1851";
  260.     }
  261.     else if (view.id=="corporateBW")
  262.     {
  263.         g_strPlayImage="res://wmploc/#1864";
  264.         g_strPlayHover="res://wmploc/#1864";
  265.         g_strPlayDown="res://wmploc/#1864";
  266.         g_strPauseUp="res://wmploc/#1865";
  267.         g_strPauseHover="res://wmploc/#1865";
  268.         g_strPauseDown="res://wmploc/#1865";
  269.     }
  270.     else
  271.     {
  272.         g_strPlayImage="res://wmploc/#1815";
  273.         g_strPlayHover="res://wmploc/#1816";
  274.         g_strPlayDown="res://wmploc/#1817";
  275.         g_strPauseUp="res://wmploc/#1818";
  276.         g_strPauseHover="res://wmploc/#1819";
  277.         g_strPauseDown="res://wmploc/#1820";    
  278.     }
  279.  
  280.     OnOpenStateChangeTransport(player.openState);
  281.     OnPlayStateChangeTransport(player.playState);
  282.     OnStatusChangeTransport(player.status);
  283. }