home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / ReportPublic04 / PMSreporttothepublic04-05_files / script.js < prev    next >
Text File  |  2004-10-21  |  27KB  |  1,033 lines

  1. function LoadSld()
  2. {
  3.     var sld=GetObj("SlideObj")
  4.     if( !g_supportsPPTHTML ) {        
  5.         sld.style.visibility="visible"
  6.         return
  7.     }
  8.  
  9.     if( MakeNotesVis() ) return
  10.  
  11.     runAnimations = _InitAnimations();
  12.     
  13.     if( IsWin("PPTSld") )
  14.         parent.SldUpdated(GetSldId())
  15.     g_origSz=parseInt(SlideObj.style.fontSize)
  16.     g_origH=sld.style.posHeight
  17.     g_origW=sld.style.posWidth
  18.     g_scaleHyperlinks=(document.all.tags("AREA").length>0)
  19.     if( g_scaleHyperlinks )
  20.         InitHLinkArray()
  21.     if( g_scaleInFrame||(IsWin("PPTSld") && parent.IsFullScrMode() ) )
  22.         document.body.scroll="no"
  23.     _RSW()
  24.     if( IsWin("PPTSld") && parent.IsFullScrMode() )
  25.         FullScrInit();
  26.     
  27.     MakeSldVis();
  28.     ChkAutoAdv()
  29.  
  30.     if( runAnimations )
  31.     {
  32.         if( document.all("NSPlay") )
  33.             document.all("NSPlay").autoStart = false;
  34.  
  35.         if( sld.filters && sld.filters.revealtrans )
  36.             setTimeout( "document.body.start()", sld.filters.revealtrans.duration * 1000 );
  37.         else
  38.             document.body.start();
  39.     }
  40. }
  41.  
  42. function MakeSldVis() 
  43. {
  44.     var fTrans=g_showAnimation && SldHasTrans()
  45.     if( fTrans )    
  46.     {
  47.         if( g_bgSound ) {
  48.             idx=g_bgSound.indexOf(",");
  49.             pptSound.src=g_bgSound.substr( 0, idx );
  50.             pptSound.loop= -(parseInt(g_bgSound.substr(idx+1)));
  51.         }
  52.         SlideObj.filters.revealtrans.Apply()    
  53.     }
  54.     SlideObj.style.visibility="visible"
  55.     if( fTrans )
  56.         SlideObj.filters.revealtrans.Play()
  57. }
  58. function MakeNotesVis() 
  59. {
  60.     if( !IsNts() ) return false 
  61.     SlideObj.style.display="none"
  62.     nObj = document.all.item("NotesObj")
  63.     parent.SetHasNts(0)
  64.     if( nObj ) { 
  65.         nObj.style.display=""
  66.         parent.SetHasNts(1)
  67.     }
  68.     return 1
  69. }
  70. function ChkAutoAdv()
  71. {
  72.     if(SldHasTrans())
  73.         SlideObj.onfilterchange=AutoAdv
  74.     else
  75.         AutoAdv()
  76. }
  77. function AutoAdv()
  78. {
  79.     if(!IsWin("PPTSld") || !gUseSldTimings )return
  80.     var sld=GetCurSld()
  81.     if( (sld.mAdvDelay>0) && !parent.IsFramesMode() )
  82.         setTimeout("parent.GoToNextSld()",sld.mAdvDelay)
  83. }
  84. function GetObj(id)
  85. {
  86.     if(g_supportsPPTHTML) return document.all(id);
  87.     else return document.getElementById(id);
  88. }
  89. function SldHasTrans() { return SlideObj.style.filter != ""; }
  90. function GetSldId() { return sId=location.href.substring(location.href.lastIndexOf('/')+1) }
  91. function HideMenu() { if( frames["PPTSld"] && PPTSld.document.all.item("ctxtmenu") && PPTSld.ctxtmenu.style.display!="none" ) { PPTSld.ctxtmenu.style.display='none'; return true } return false }
  92. function IsWin( name ) { return window.name == name }
  93. function IsNts() { return IsWin("PPTNts") }
  94. function IsSldOrNts() { return( IsWin("PPTSld")||IsWin("PPTNts") ) }
  95. function SupportsPPTAnimation() { return( navigator.platform == "Win32" && navigator.appVersion.indexOf("Windows")>0 ) }
  96. function SupportsPPTHTML()
  97. {
  98.     var appVer=navigator.appVersion, msie=appVer.indexOf("MSIE "), ver=0
  99.     if( msie >= 0 )
  100.         ver=parseFloat( appVer.substring( msie+5, appVer.indexOf(";",msie) ) )
  101.     else
  102.         ver=parseInt(appVer)
  103.  
  104.     return( ver >= 4 && msie >= 0 )
  105. }
  106. function _RSW()
  107. {
  108.     if( !g_supportsPPTHTML || IsNts() ||
  109.       ( !g_scaleInFrame && (!IsWin("PPTSld") || !parent.IsFullScrMode()) ) )
  110.         return
  111.  
  112.         var padding=0;
  113.         if( IsWin("PPTSld") && parent.IsFramesMode() ) padding=6
  114.  
  115.     cltWidth=document.body.clientWidth-padding
  116.     cltHeight=document.body.clientHeight-padding
  117.     factor=(1.0*cltWidth)/g_origW
  118.     if( cltHeight < g_origH*factor )
  119.         factor=(1.0*cltHeight)/g_origH
  120.  
  121.     newSize = g_origSz * factor
  122.     if( newSize < 1 ) newSize=1
  123.  
  124.     s=SlideObj.style
  125.     s.fontSize=newSize+"px"
  126.     s.posWidth=g_origW*factor
  127.     s.posHeight=g_origH*factor
  128.     s.posLeft=(cltWidth-s.posWidth+padding)/2
  129.     s.posTop=(cltHeight-s.posHeight+padding)/2
  130.  
  131.     if( g_scaleHyperlinks )
  132.         ScaleHyperlinks( factor )
  133. }
  134. function _InitAnimations()
  135. {
  136.     animRuntimeInstalled = ''+document.body.localTime != 'undefined';
  137.     isFullScreen = (window.name == "PPTSld") && !parent.IsFramesMode();
  138.     g_animUseRuntime = g_showAnimation && animRuntimeInstalled && !(isFullScreen && parent.IsSldVisited());
  139.     if( g_animUseRuntime ) {
  140.         collSeq = document.all.tags("seq");
  141.         if( collSeq != null ) {
  142.             for(ii=0;ii<collSeq.length;ii++) {
  143.                 if( collSeq[ii].getAttribute( "p:nodeType" ) == "mainSeq" ) {
  144.                     g_animMainSequence = collSeq[ii];
  145.                     break;
  146.                 }
  147.             }
  148.         }
  149.     
  150.         if( g_animItemsToHide && document.body.playAnimations != false ) {
  151.             for(jj = 0; jj < g_animItemsToHide.length; jj++) {
  152.                 if( hideObj = GetObj(g_animItemsToHide[jj]) )
  153.                     hideObj.runtimeStyle.visibility="hidden";
  154.             }
  155.         }
  156.  
  157.         if( g_animInteractiveItems ){
  158.             for(jj = 0; jj < g_animInteractiveItems.length; jj++) {
  159.                 if( triggerObj = GetObj(g_animInteractiveItems[jj]) )
  160.                     triggerObj.runtimeStyle.cursor="hand";
  161.             }
  162.         }
  163.         
  164.         if( gUseSldTimings && ''+g_animSlideTime != 'undefined' ) {
  165.             adjustedTime = document.body.calculateAutoAdvanceTimes( g_animSlideTime, g_animEffectTimings );
  166.             if( IsWin("PPTSld") && adjustedTime != g_animSlideTime ) {
  167.                var sld = GetCurSld();
  168.                sld.mAdvDelay = adjustedTime * 1000;
  169.             }
  170.         }
  171.     }
  172.  
  173.     return g_animUseRuntime;
  174. }
  175.  
  176. gSldJump = 0, gSldJumpTrack = 0, gSldJumpIdx = "";
  177.  
  178. function _KPH()
  179.     if( IsNts() ) return;
  180.  
  181.     if( !parent.IsFramesMode() && event.keyCode == 27 && !HideMenu() )
  182.         parent.window.close( self );
  183.     else if( event.keyCode == 32 ) {
  184.         if( window.name == "PPTSld" )
  185.             parent.PPTSld.DocumentOnClick();
  186.         else
  187.             parent.GoToNextSld();
  188.     }
  189.  
  190.     CatchNumKeys( parent, event );
  191. }
  192.  
  193. function CatchNumKeys( win, event ) {
  194.     if( win.IsFullScrMode() && (48<=event.keyCode) && (event.keyCode<=57) ) {
  195.         gSldJump = 1;
  196.         gSldJumpIdx += (event.keyCode-48).toString();
  197.     }
  198.     if( win.IsFullScrMode() && gSldJump && event.keyCode == 13 ) {
  199.         var numSlds = parent.GetSldList().mList.length
  200.         if ( gSldJumpIdx > numSlds )
  201.             gSldJumpIdx = numSlds;
  202.         if ( gSldJumpIdx >= 0 ) {
  203.             if ( gSldJumpIdx == 0 )
  204.                 gSldJumpIdx = 1;
  205.             var jumpTo = parseInt(gSldJumpIdx);
  206.             gSldJump = 0; gSldJumpIdx = "";
  207.             win.GoToSld( parent.GetSldList().mList[jumpTo-1].mSldHref )
  208.         }
  209.     }
  210. }
  211.  
  212. function _KDH()
  213. {
  214.     if( event.keyCode == 8 ) {
  215.         event.returnValue = 0;
  216.         parent.GoToPrevSld();
  217.     }
  218. }
  219. function DocumentOnClick()
  220. {
  221.     if( IsNts() || parent.HideMenu() ) return;
  222.     if( ( g_allowAdvOnClick && !parent.IsFramesMode() ) ||
  223.         (event && (event.keyCode==32) ) )
  224.         parent.GoToNextSld();
  225. }
  226.  
  227.  
  228.  
  229. var g_supportsPPTHTML = SupportsPPTHTML(), g_scaleInFrame = 1, gId="", g_bgSound="",
  230.     g_scaleHyperlinks = false, g_allowAdvOnClick = 1, g_showInBrowser = 0, gLoopCont = 0, gUseSldTimings = 0;
  231. var g_showAnimation = g_supportsPPTHTML && SupportsPPTAnimation() && ( (window.name=="PPTSld" && !parent.IsFramesMode()) || g_showInBrowser );var g_animManager = null;
  232. var g_animUseRuntime = false;
  233. var g_animItemsToHide, g_animInteractiveItems, g_animSlideTime;
  234. var g_animMainSequence = null;
  235.  
  236. var ENDSHOW_MESG="End of slide show, click to exit.", SCREEN_MODE="Frames", gIsEndShow=0, NUM_VIS_SLDS=6, SCRIPT_HREF="script.js", FULLSCR_HREF="fullscreen.htm";
  237. var gCurSld = gPrevSld = 1, g_offset = 0, gNtsOpen = gHasNts = gOtlTxtExp = 0, gHasNarration = 0, gOtlOpen = true
  238. window.gPPTHTML=SupportsPPTHTML()
  239. var gMainDoc=new Array(new hrefList("slide0001.htm",1,-1,1),new hrefList("slide0007.htm",1,-1,1),new hrefList("slide0012.htm",1,-1,1),new hrefList("slide0002.htm",1,-1,1),new hrefList("slide0011.htm",1,-1,1),new hrefList("slide0013.htm",1,-1,1));
  240.  
  241. /*********************************************
  242.  Frameset functions
  243.  
  244.  These functions control slide navigation
  245.  and state of the frameset.
  246. **********************************************/
  247.  
  248. function FullScrInit()
  249. {
  250.     g_allowAdvOnClick = GetCurSld().mAdvOnClk
  251.     document.body.style.backgroundColor="black"
  252.     document.oncontextmenu=parent._CM;
  253.     document.onkeydown = _KDH;
  254.     document.ondragstart=Cancel
  255.     document.onselectstart=Cancel
  256.     self.focus()
  257. }
  258.  
  259. function Redirect( frmId )
  260. {    
  261.     var str=document.location.hash,idx=str.indexOf('#'), sId=GetSldId()
  262.     if(idx>=0) str=str.substr(1);
  263.     if( window.name != frmId && ( sId != str) ) {
  264.         obj = GetObj("Main-File")
  265.         window.location.href=obj.href+"#"+sId
  266.         return 1
  267.     }
  268.     return 0
  269. }
  270.  
  271. var MHTMLPrefix = CalculateMHTMLPrefix(); 
  272. function CalculateMHTMLPrefix()
  273. {
  274.     if ( document.location.protocol == 'mhtml:') { 
  275.         href=new String(document.location.href) 
  276.         Start=href.indexOf('!')+1 
  277.         End=href.lastIndexOf('/')+1 
  278.         if (End < Start) 
  279.             return href.substring(0, Start) 
  280.         else 
  281.         return href.substring(0, End) 
  282.     }
  283.     return '';
  284. }
  285.  
  286. function GetTags(base,tag)
  287. {
  288.     if(g_supportsPPTHTML) return base.all.tags(tag);
  289.     else return base.getElementsByTagName(tag);
  290. }
  291.  
  292.  
  293. function UpdNtsPane(){ if(frames["PPTNts"]) PPTNts.location.replace( MHTMLPrefix+GetHrefObj( gCurSld ).mNtsHref ) }
  294.  
  295. function UpdNavPane( sldIndex ){ if(gNavLoaded) PPTNav.UpdNav() }
  296.  
  297. function UpdOtNavPane(){ if(gOtlNavLoaded) PPTOtlNav.UpdOtlNav() }
  298.  
  299. function UpdOtlPane(){ if(gOtlLoaded) PPTOtl.UpdOtl() }
  300.  
  301. function SetHasNts( fVal )
  302. {
  303.     if( gHasNts != fVal ) {
  304.         gHasNts=fVal
  305.         UpdNavPane()
  306.     }
  307. }
  308.  
  309. function ToggleOtlText()
  310. {
  311.     gOtlTxtExp=!gOtlTxtExp
  312.     UpdOtlPane()
  313. }
  314.  
  315. function ClearMedia()
  316. {
  317.     // Clear any sounds playing before launching another browser window. Otherwise,
  318.     // in fullscreen mode, you'll continue to hear the sound in the frames mode.
  319.     if (PPTSld.pptSound) PPTSld.pptSound.loop = 0;
  320. }
  321.  
  322. function FullScreen()
  323.     if ( PPTSld.g_animUseRuntime )
  324.         PPTSld.document.body.pause();
  325.     ClearMedia();
  326.     var href = ( document.location.protocol == 'mhtml:') ? FULLSCR_HREF : FULLSCR_HREF+"#"+GetHrefObj(gCurSld).mSldHref;
  327.     if(PPTNav.event.ctrlKey) {
  328.         var w = (window.screen.availWidth * 1.0) / 2.0
  329.         var h = w * (PPTSld.g_origH * 1.0) / PPTSld.g_origW
  330.         win = window.open( MHTMLPrefix+href,null,"toolbar=0,resizable=1,top=0,left=0," + "width="+ w + ",height=" + h );
  331.         if( win.document.body && PPTSld.g_animUseRuntime )
  332.             win.document.body.PPTSldFrameset=window;
  333.     }
  334.     else
  335.     {
  336.         win = window.open( MHTMLPrefix+href,null,"fullscreen=yes" );
  337.         if( win.document.body && PPTSld.g_animUseRuntime )
  338.             win.document.body.PPTSldFrameset=window;
  339.     }
  340. }
  341.  
  342. function ToggleVNarration()
  343. {
  344.     rObj=PPTSld.document.all("NSPlay")
  345.     if( rObj && !PPTSld.g_animUseRuntime ) {
  346.         if( (rObj.playState == 1)||(rObj.playState == 0) )
  347.             rObj.Play()
  348.         else if( rObj.playState == 2 )
  349.             rObj.Pause()
  350.         else
  351.             return;
  352.     }
  353.     else if( PPTSld.g_animUseRuntime )
  354.     {
  355.         narObj = PPTSld.document.all("narrationID")
  356.         if( narObj )
  357.             narObj.togglePause()
  358.     }
  359. }
  360.  
  361. function GetCurSldNum()
  362. {   
  363.     obj=GetHrefObj(gCurSld)
  364.     if( obj.mOrigVis == 1 )
  365.         return obj.mSldIdx
  366.     else   
  367.         return gCurSld
  368. }
  369.  
  370. function GetNumSlds()
  371. {   
  372.     if( GetHrefObj(gCurSld).mOrigVis == 1 )
  373.         return GetSldList().mNumVisSlds;
  374.     else
  375.         return GetSldList().mList.length
  376. }
  377.  
  378. function GetSldNum( href )
  379. {
  380.     for(ii=0; ii<GetSldList().mList.length; ii++) {
  381.         if ( GetSldList().mList[ii].mSldHref == href )
  382.             return ii+1
  383.     }
  384.     return 1
  385. }
  386.  
  387. function GetHrefObj( sldIdx ){ return GetSldList().mList[sldIdx-1] }
  388.  
  389. function IsFramesMode(){ return ( SCREEN_MODE == "Frames" ) }
  390.  
  391. function IsFullScrMode(){ return ( SCREEN_MODE == "FullScreen" ) }
  392.  
  393. function GoToNextSld()
  394. {
  395.     ii=gCurSld + 1
  396.     if( GetHrefObj( ii-1 ).mOrigVis == 0 ) {
  397.         if( ii<=GetSldList().mList.length ) {
  398.             obj=GetHrefObj(ii)
  399.             obj.mVis=1
  400.             GoToSldNum(ii)
  401.             return
  402.         }
  403.     }
  404.     else {
  405.         obj=GetHrefObj( ii )
  406.         while ( obj && ( obj.mOrigVis == 0 ) )
  407.             obj=GetHrefObj(++ii)
  408.         if( obj && obj.mOrigVis ) {
  409.             GoToSldNum(ii)
  410.             return
  411.         }
  412.     }
  413.     if( gSldStack.length > 1 )
  414.         PopSldList();
  415.     else if( !IsFramesMode() ) {
  416.                 if( gLoopCont )
  417.             GoToFirst()
  418.                 else
  419.             EndShow()
  420.     }
  421. }
  422.  
  423. function GoToPrevSld()
  424. {
  425.     ii=gCurSld-1
  426.     if( ii > 0 ) {
  427.         obj=GetHrefObj(ii)
  428.         while ( obj && ( obj.mVis == 0 ) && ( ii>0 ) )
  429.             obj=GetHrefObj(--ii)
  430.         if( ii == 0 ) ii=1
  431.         GoToSldNum(ii)
  432.     }
  433. }
  434.  
  435. function GoToFirst(){ GoToSld( GetHrefObj(1).mSldHref ) }
  436.  
  437. function GoToLast()
  438. {
  439.     ii=GetSldList().mList.length
  440.     if( ii != gCurSld )
  441.         GoToSld( GetHrefObj(ii).mSldHref )
  442. }
  443.  
  444. function GoToSldNum( num )
  445. {
  446.     if( PPTSld.event ) PPTSld.event.cancelBubble=true
  447.     obj = GetHrefObj( num )
  448.     obj.mVis=1
  449.     gPrevSld=gCurSld
  450.     gCurSld = num;
  451.     PPTSld.location.replace(MHTMLPrefix+obj.mSldHref)
  452.     if( IsFramesMode() ) {
  453.         UpdNavPane(); UpdOtlPane(); UpdNtsPane()
  454.     }
  455. }
  456.  
  457. function GoToSld( href )
  458. {
  459.     if( PPTSld.event ) PPTSld.event.cancelBubble=true
  460.     GetHrefObj( GetSldNum(href) ).mVis=1
  461.     PPTSld.location.replace(MHTMLPrefix+href)
  462. }
  463.  
  464. function SldUpdated( id )
  465. {
  466.     if( id == GetHrefObj(gCurSld).mSldHref ) return
  467.     gPrevSld=gCurSld
  468.     gCurSld=GetSldNum(id)
  469.     if( IsFramesMode() ) {
  470.         UpdNavPane(); UpdOtlPane(); UpdNtsPane()
  471.     }
  472. }
  473.  
  474. function PrevSldViewed(){ GoToSld( GetHrefObj(gPrevSld).mSldHref ) }
  475. function HasPrevSld() { return ( gIsEndShow || ( gCurSld != 1 && GetHrefObj( gCurSld-1 ).mVis == 1 )||( GetCurSldNum() > 1 ) ) }
  476. function HasNextSld() { return (GetCurSldNum() != GetNumSlds()) }
  477.  
  478. function CloseWindow() {
  479.     if( HideMenu() ) return;
  480.     
  481.     var event = PPTSld.event;
  482.     if( !IsFramesMode() && event && (event.keyCode==27 || event.keyCode==32 || event.type=="click" ) )
  483.         window.close( self );
  484.     CatchNumKeys( self, event );
  485. }
  486.  
  487. function Unload() { gIsEndShow=0; }
  488.  
  489. function SetupEndShow() {
  490.     gIsEndShow=1;
  491.     PPTSld.document.body.scroll="no";
  492.     PPTSld.document.onkeypress=CloseWindow;
  493.     PPTSld.document.onclick=CloseWindow;
  494.     PPTSld.document.oncontextmenu=_CM;
  495. }
  496.  
  497. function EndShow()
  498. {
  499.     if( IsFramesMode() ) return
  500.     if( PPTSld.event ) PPTSld.event.cancelBubble=true
  501.  
  502.     doc=PPTSld.document
  503.     var dir = doc.body.dir
  504.     if( dir != "rtl" ) dir = "ltr";
  505.     doc.open()
  506.     doc.writeln('<html><body dir=' + dir + ' bgcolor=black onload=parent.SetupEndShow() onunload=parent.Unload()><center><p><font face=Tahoma color=white size=2><br><b>' + ENDSHOW_MESG + '</b></font></p></center></body></html>')
  507.     doc.close()
  508. }
  509.  
  510. function SetSldVisited(){ GetSldList().mList[gCurSld-1].mVisited=true }
  511.  
  512. function IsSldVisited(){ return GetSldList().mList[gCurSld-1].mVisited }
  513.  
  514. function hrefList( sldHref, visible, advDelay, advClk )
  515. {
  516.     this.mSldHref= this.mNtsHref = sldHref
  517.     this.mOrigVis= this.mVis = visible
  518.     this.mVisited= false
  519.     this.mAdvDelay= advDelay
  520.     this.mAdvOnClk= advClk
  521. }
  522.  
  523. function SldList(arr,curSld,fEnd)
  524. {
  525.     this.mCurSld = curSld;
  526.     this.mList = new Array();
  527.  
  528.     var idx = 1;
  529.     for(ii=0;ii<arr.length;ii++) {
  530.         this.mList[ii] = new hrefList( arr[ii].mSldHref, arr[ii].mOrigVis, arr[ii].mAdvDelay, arr[ii].mAdvOnClk );
  531.         if( arr[ii].mOrigVis )
  532.             this.mList[ii].mSldIdx = idx++;
  533.     }
  534.     this.mNumVisSlds = idx-1;
  535.     this.fEndShow = fEnd;
  536. }
  537.  
  538. function GetSldList() {    return gSldStack[gSldStack.length-1] }
  539. function GetCurSld() { return parent.GetSldList().mList[parent.gCurSld - 1] }
  540.  
  541. gSldStack = new Array();
  542. gSldStack[0] = new SldList(gMainDoc,gCurSld,1)
  543. function ToggleOtlPane()
  544. {
  545.     frmset=document.all("PPTHorizAdjust")
  546.     frm=document.all("PPTOtl")
  547.  
  548.     if( gOtlOpen )
  549.         frmset.cols="*,100%"
  550.     else
  551.         frmset.cols="25%,*"
  552.  
  553.     gOtlOpen=!gOtlOpen
  554.     frm.noResize=!frm.noResize
  555.     UpdOtNavPane()
  556. }
  557.  
  558. function ToggleNtsPane()
  559. {
  560.     frmset=document.all("PPTVertAdjust")
  561.     frm=document.all("PPTNts")
  562.  
  563.     if( gNtsOpen )
  564.         frmset.rows="100%,*"
  565.     else
  566.         frmset.rows="*,20%"
  567.  
  568.     gNtsOpen=!gNtsOpen
  569.     UpdNtsPane()
  570. }
  571.  
  572. /*********************************************
  573. Custom Shows implementation
  574.  
  575. When ViewCustomShow() is called, we create
  576. a new array that is a subset of the slides in 
  577. the main doc. This list pushed on a stack so
  578. we can return after the end of the custom
  579. show.
  580. *********************************************/
  581. function ViewCustomShow(idx,fEnd)
  582. {
  583.     if( !IsFullScrMode() ) return;
  584.     var sldList = new Array();
  585.     var custShow = custShowList[idx-1];
  586.     var jj = 0;
  587.     for( ii=0;ii<custShow.length;ii++ ) {
  588.         if( custShow[ii] <= gMainDoc.length )
  589.             sldList[jj++] = gMainDoc[custShow[ii]-1];
  590.     }
  591.     if (sldList.length > 0) {
  592.     PushSldList(sldList,fEnd);
  593.     gCurSld = 1;
  594.     }
  595.     else
  596.         if( PPTSld.event ) PPTSld.event.cancelBubble=true
  597. }
  598.  
  599. function PushSldList(arr,fEnd) {
  600.     var ii = gSldStack.length;
  601.     gSldStack[ii] = new SldList(arr,gCurSld,fEnd);
  602.     GoToSld( gSldStack[ii].mList[0].mSldHref );
  603. }
  604.  
  605. function PopSldList() {
  606.     if (gSldStack[gSldStack.length-1].fEndShow)
  607.         EndShow()
  608.     else {
  609.     gCurSld = gSldStack[gSldStack.length-1].mCurSld;
  610.     gSldStack[gSldStack.length-1] = null;
  611.     gSldStack.length--;
  612.     var sldList = gSldStack[gSldStack.length-1];
  613.     GoToSld( sldList.mList[gCurSld - 1].mSldHref );
  614.     }
  615. }
  616. var custShowList=new Array();
  617.  
  618. /*********************************************
  619.  Navigation button implementation
  620.  
  621.  There are 2 types of buttons: ImgBtn, TxtBtn
  622.  implemented as function objects. They share
  623.  a similiar interface so the event handlers
  624.  can call SetActive, for example, on a button 
  625.  object without needing to know exactly 
  626.  what type of button it is.
  627. **********************************************/
  628.  
  629. //----------------------------------
  630. function ImgBtn( oId,bId,w,action )
  631. //----------------------------------
  632. {
  633.     var t=this
  634.     t.Perform    = _IBP
  635.     t.SetActive  = _IBSetA
  636.     t.SetInactive= _IBSetI
  637.     t.SetPressed = _IBSetP
  638.     t.SetDisabled= _IBSetD
  639.     t.Enabled    = _IBSetE
  640.     t.ChangeIcon = null
  641.     t.UserAction = action
  642.     t.ChgState   = _IBUI
  643.     t.mObjId   = oId
  644.     t.mBorderId= bId
  645.     t.mWidth   = w
  646.     t.mIsOn    = t.mCurState = 0
  647. }
  648.  
  649. function _IBSetA()
  650. {
  651.     if( this.mIsOn ) {
  652.         obj=this.ChgState( gHiliteClr,gShadowClr,2 )
  653.         obj.style.posTop=0
  654.     }
  655. }
  656.  
  657. function _IBSetI()
  658. {
  659.     if( this.mIsOn ) {
  660.         obj=this.ChgState( gFaceClr,gFaceClr,1 )
  661.         obj.style.posTop=0 
  662.     }
  663. }
  664.  
  665. function _IBSetP()
  666. {
  667.     if( this.mIsOn ) {
  668.         obj=this.ChgState( gShadowClr,gHiliteClr,2 )
  669.         obj.style.posLeft+=1; obj.style.posTop+=1
  670.     }
  671. }
  672.  
  673. function _IBSetD()
  674. {  
  675.     obj=this.ChgState( gFaceClr,gFaceClr,0 )
  676.     obj.style.posTop=0 
  677. }
  678.  
  679. function _IBSetE( state )
  680. {
  681.     var t=this
  682.     GetObj( t.mBorderId ).style.visibility="visible"
  683.     if( state != t.mIsOn ) {
  684.         t.mIsOn=state
  685.         if( state )
  686.             t.SetInactive()
  687.         else
  688.             t.SetDisabled()
  689.     }
  690. }
  691.  
  692. function _IBP()
  693. {
  694.     var t=this
  695.     if( t.mIsOn ) {
  696.         if( t.UserAction != null )
  697.             t.UserAction()
  698.         if( t.ChangeIcon ) {
  699.             obj=GetObj(t.mObjId)
  700.             if( t.ChangeIcon() )
  701.                 obj.style.posLeft=obj.style.posLeft+(t.mCurState-4)*t.mWidth
  702.             else
  703.                 obj.style.posLeft=obj.style.posLeft+(t.mCurState-0)*t.mWidth
  704.         }
  705.         t.SetActive()
  706.     }  
  707. }
  708.  
  709. function _IBUI( clr1,clr2,nextState )
  710. {
  711.     var t=this
  712.     SetBorder( GetObj( t.mBorderId ),clr1,clr2 )
  713.     obj=GetObj( t.mObjId )
  714.     obj.style.posLeft=obj.style.posLeft+(t.mCurState-nextState)*t.mWidth-obj.style.posTop
  715.     t.mCurState=nextState
  716.     return obj
  717. }
  718.  
  719. //-----------------------------------------
  720. function TxtBtn( oId,oeId,action,chkState )
  721. //-----------------------------------------
  722. {
  723.     var t=this
  724.     t.Perform    = _TBP
  725.     t.SetActive  = _TBSetA
  726.     t.SetInactive= _TBSetI
  727.     t.SetPressed = _TBSetP
  728.     t.SetDisabled= _TBSetD
  729.     t.SetEnabled = _TBSetE
  730.     t.GetState   = chkState
  731.     t.UserAction = action
  732.     t.ChgState   = _TBUI
  733.     t.mObjId      = oId
  734.     t.m_elementsId= oeId
  735.     t.mIsOn       = 1
  736. }
  737.  
  738. function _TBSetA()
  739. {
  740.     var t=this
  741.     if( t.mIsOn && !t.GetState() )
  742.         t.ChgState( gHiliteClr,gShadowClr,0,0 )
  743. }
  744.  
  745. function _TBSetI()
  746. {
  747.     var t=this
  748.     if( t.mIsOn && !t.GetState() )
  749.         t.ChgState( gFaceClr,gFaceClr,0,0 )
  750. }
  751.  
  752. function _TBSetP()
  753. {
  754.     if( this.mIsOn )
  755.         this.ChgState( gShadowClr,gHiliteClr,1,1 )
  756. }
  757.  
  758. function _TBSetD()
  759. {   
  760.     this.ChgState( gFaceClr,gFaceClr,0,0 )
  761.     this.mIsOn = 0
  762. }
  763.  
  764. function _TBSetE()
  765. {
  766.     var t=this
  767.     if( !t.GetState() )
  768.         t.ChgState( gFaceClr,gFaceClr,0,0 )
  769.     else
  770.         t.ChgState( gShadowClr,gHiliteClr,1,1 )
  771.     t.mIsOn = 1
  772. }
  773.  
  774. function _TBP()
  775. {
  776.     var t=this
  777.     if( t.mIsOn ) { 
  778.         if( t.UserAction != null )
  779.             t.UserAction()
  780.         if( !t.GetState )
  781.             return
  782.         if( t.GetState() )
  783.             t.SetPressed()
  784.         else
  785.             t.SetActive()
  786.     }  
  787. }
  788.  
  789. function _TBUI( clr1,clr2,lOffset,tOffset )
  790. {
  791.     SetBorder( GetObj( this.mObjId ),clr1,clr2 )
  792.     Offset( GetObj( this.m_elementsId ),lOffset,tOffset )
  793. }
  794.  
  795. function Offset( obj, top, left ){ obj.style.top=top; obj.style.left=left }
  796.  
  797. function SetBorder( obj, upperLeft, lowerRight )
  798. {
  799.     s=obj.style;
  800.     s.borderStyle      = "solid"
  801.     s.borderWidth      = 1 
  802.     s.borderLeftColor  = s.borderTopColor = upperLeft
  803.     s.borderBottomColor= s.borderRightColor = lowerRight
  804. }
  805.  
  806. function GetBtnObj(){ return gBtnArr[window.event.srcElement.id] }
  807.  
  808. function BtnOnOver(){ b=GetBtnObj(); if( b != null ) b.SetActive() }
  809.  
  810. function BtnOnDown(){ b=GetBtnObj(); if( b != null ) b.SetPressed() }
  811.  
  812. function BtnOnOut(){ b=GetBtnObj(); if( b != null ) b.SetInactive() }
  813.  
  814. function BtnOnUp()
  815. {
  816.     b=GetBtnObj()
  817.     if( b != null )
  818.         b.Perform()
  819.     else
  820.         Upd()
  821. }
  822. function GetNtsState(){ return parent.gNtsOpen }
  823.  
  824. function GetOtlState(){ return parent.gOtlOpen }
  825.  
  826. function GetOtlTxtState(){ return parent.gOtlTxtExp }
  827.  
  828. function NtsBtnSetFlag( fVal )
  829. {
  830.     s=document.all.item( this.m_flagId ).style
  831.     s.display="none"
  832.     if( fVal )
  833.         s.display=""
  834.     else
  835.         s.display="none"
  836. }
  837.  
  838. function _BSetA_Border(){ b = gBtnArr[this.mObjId]; if( b != null ) b.SetActive() }
  839.  
  840. function _BSetI_Border(){ b = gBtnArr[this.mObjId]; if( b != null ) b.SetInactive() }
  841.  
  842. function _BSetP_Border(){ b = gBtnArr[this.mObjId]; if( b != null ) b.SetPressed() }
  843.  
  844. function _BSetA_BorderImg()
  845.     b = gBtnArr[this.mBorderId] 
  846.     if( b != null && this.mIsOn && !b.GetState() ) {
  847.         obj=this.ChgState( gHiliteClr,gShadowClr,2 )
  848.         obj.style.posTop=0
  849.     }
  850. }
  851.  
  852. function _BSetI_BorderImg()
  853.     b = gBtnArr[this.mBorderId]
  854.     if( b != null && this.mIsOn && !b.GetState() ) {
  855.         obj=this.ChgState( gFaceClr,gFaceClr,1 )
  856.         obj.style.posTop=0
  857.     }
  858. }
  859.  
  860.  
  861. var gHiliteClr="THREEDHIGHLIGHT",gShadowClr="THREEDSHADOW",gFaceClr="THREEDFACE"
  862. var gBtnArr = new Array()
  863. gBtnArr["nb_otl"] = new TxtBtn( "nb_otl","nb_otlElem",parent.ToggleOtlPane,GetOtlState )
  864. gBtnArr["nb_otlElem"] = new TxtBtn( "nb_otl","nb_otlElem",parent.ToggleOtlPane,GetOtlState )
  865. gBtnArr["nb_nts"] = new ImgBtn( "nb_nts","nb_ntsBorder",10,parent.ToggleNtsPane )
  866. gBtnArr["nb_nts"].SetActive = _BSetA_BorderImg;
  867. gBtnArr["nb_nts"].SetInactive = _BSetI_BorderImg;
  868. gBtnArr["nb_ntsBorder"] = new TxtBtn( "nb_ntsBorder","nb_ntsElem",parent.ToggleNtsPane,GetNtsState )
  869. gBtnArr["nb_ntsElem"] = new TxtBtn( "nb_ntsBorder","nb_ntsElem",parent.ToggleNtsPane,GetNtsState )
  870. gBtnArr["nb_prevBorder"] = gBtnArr["nb_prev"]= new ImgBtn( "nb_prev","nb_prevBorder",30,parent.GoToPrevSld )
  871. gBtnArr["nb_nextBorder"] = gBtnArr["nb_next"]= new ImgBtn( "nb_next","nb_nextBorder",30,parent.GoToNextSld )
  872. gBtnArr["nb_sldshw"]= new ImgBtn( "nb_sldshw","nb_sldshwBorder",18,parent.FullScreen )
  873. gBtnArr["nb_sldshwBorder"] = new TxtBtn( "nb_sldshw","nb_sldshwBorder",parent.FullScreen,null )
  874. gBtnArr["nb_sldshwBorder"].SetActive = _BSetA_Border;
  875. gBtnArr["nb_sldshwBorder"].SetInactive = _BSetI_Border;
  876. gBtnArr["nb_sldshwText"] = new TxtBtn( "nb_sldshw","nb_sldshwText",parent.FullScreen,null )
  877. gBtnArr["nb_sldshwText"].SetActive = _BSetA_Border;
  878. gBtnArr["nb_sldshwText"].SetInactive = _BSetI_Border;
  879. gBtnArr["nb_voice"] = gBtnArr["nb_voiceBorder"] = new ImgBtn( "nb_voice","nb_voiceBorder",18,parent.ToggleVNarration )
  880. gBtnArr["nb_otlTxtBorder"] = gBtnArr["nb_otlTxt"]= new ImgBtn( "nb_otlTxt","nb_otlTxtBorder",23,parent.ToggleOtlText )
  881. gBtnArr["nb_ntsBorder"].m_flagId= "nb_nts"
  882. gBtnArr["nb_ntsBorder"].SetFlag = NtsBtnSetFlag
  883. gBtnArr["nb_otlTxt"].ChangeIcon= GetOtlTxtState
  884.  
  885. /*********************************************
  886.  Context menu implementation
  887.  
  888.  _CM() is the function that's hooked up to
  889.  the oncontextmenu event. Once we're asked to
  890.  show the menu, we first build it by creating
  891.  DIVs on-the-fly. Then we position it 
  892.  within the screen area so it doesn't get
  893.  clipped.
  894.  
  895.  Creating the DIVs using createElement() means
  896.  we don't have to write out any extra HTML
  897.  into the slide HTML files.
  898. **********************************************/
  899. var sNext="Next",sPrev="Previous",sEnd="End Show",sFont="Arial",sArrow="Arrow",sFreeform="Freeform",sRect="Rectangle",sOval="Oval"
  900.  
  901. function ShowMenu()
  902. {
  903.     BuildMenu();
  904.     var doc=PPTSld.document.body,x=PPTSld.event.clientX+doc.scrollLeft,y=PPTSld.event.clientY+doc.scrollTop
  905.     m = PPTSld.document.all.item("ctxtmenu")
  906.     m.style.pixelLeft=x
  907.     if( (x+m.scrollWidth > doc.clientWidth)&&(x-m.scrollWidth > 0) )
  908.         m.style.pixelLeft=x-m.scrollWidth
  909.  
  910.     m.style.pixelTop=y
  911.     if( (y+m.scrollHeight > doc.clientHeight)&&(y-m.scrollHeight > 0) )
  912.         m.style.pixelTop=y-m.scrollHeight
  913.  
  914.     m.style.display=""
  915. }
  916.  
  917. function _CM()
  918. {
  919.     if( !parent.IsFullScrMode() ) return;
  920.     if(!PPTSld.event.ctrlKey) {
  921.         ShowMenu()
  922.         return false
  923.     } else
  924.         HideMenu()
  925. }
  926.  
  927. function BuildMenu()
  928. {
  929.     if( PPTSld.document.all.item("ctxtmenu") ) return
  930.  
  931.     var mObj=CreateItem( PPTSld.document.body )
  932.     mObj.id="ctxtmenu"
  933.     mObj.style.visibility="hidden"
  934.     var s=mObj.style
  935.     s.position="absolute"
  936.     s.cursor="default"
  937.     s.width="120px"
  938.     SetCMBorder(mObj,"menu","black")
  939.  
  940.     var iObj=CreateItem( mObj )
  941.     SetCMBorder( iObj, "threedhighlight","threedshadow" )
  942.     iObj.style.padding=2
  943.     CreateMenuItem( iObj,sNext,M_GoNextSld,M_True )
  944.     CreateMenuItem( iObj,sPrev,M_GoPrevSld,M_HasPrevSld )
  945.     
  946.     CreateSeparator( iObj )
  947.     CreateMenuItem( iObj,sEnd,M_End,M_True )
  948.     mObj.style.visibility="visible"
  949. }
  950.  
  951. function Cancel() { window.event.cancelBubble=true; window.event.returnValue=false }
  952.  
  953. function Highlight() { ChangeClr("activecaption","threedhighlight") }
  954.  
  955. function Deselect() { ChangeClr("threedface","menutext") }
  956.  
  957. function Perform()
  958. {
  959.     e=PPTSld.event.srcElement
  960.     if( e.type=="menuitem" && e.IsActive() )
  961.         e.Action()
  962.     else
  963.         PPTSld.event.cancelBubble=true
  964. }
  965. function ChangeClr( bg,clr )
  966. {
  967.     e=PPTSld.event.srcElement
  968.     if( e.type=="menuitem" && e.IsActive() ) {
  969.         e.style.backgroundColor=bg
  970.         e.style.color=clr
  971.     }
  972. }
  973.  
  974. function M_HasPrevSld() { return( parent.HasPrevSld() ) }
  975.  
  976. function M_GoNextSld() { if( gIsEndShow ) M_End(); else GoToNextSld() }
  977.  
  978. function M_GoPrevSld() { if( gIsEndShow ) { gIsEndShow=0; history.back(); PPTSld.event.cancelBubble=true; } else GoToPrevSld() }
  979.  
  980. function M_True() { return true }
  981.  
  982. function M_End() { window.close( self ) }
  983.  
  984. function CreateMenuItem( node,text,action,eval )
  985. {
  986.     var e=CreateItem( node )
  987.     e.type="menuitem"
  988.     e.Action=action
  989.     e.IsActive=eval
  990.     e.innerHTML=text
  991.  
  992.     if( !e.IsActive() )
  993.         e.style.color="threedshadow"
  994.  
  995.     e.onclick=Perform
  996.     e.onmouseover=Highlight
  997.     e.onmouseout=Deselect
  998.     s=e.style;
  999.     s.fontFamily=sFont
  1000.     s.fontSize="9pt"
  1001.     s.paddingLeft=2
  1002. }
  1003.  
  1004. function CreateSeparator( node )
  1005. {
  1006.     var sObj=CreateItem( node )
  1007.     SetCMBorder(sObj,"menu","menu")
  1008.     var s=sObj.style
  1009.     s.borderTopColor="threedshadow"
  1010.     s.borderBottomColor="threedhighlight"
  1011.     s.height=1
  1012.     s.fontSize="0px"
  1013. }
  1014.  
  1015. function CreateItem( node )
  1016. {
  1017.     var elem=PPTSld.document.createElement("DIV")
  1018.     node.insertBefore( elem )
  1019.     return elem
  1020. }
  1021.  
  1022. function SetCMBorder( o,ltClr,rbClr )
  1023. {
  1024.     var s=o.style
  1025.     s.backgroundColor="menu"
  1026.     s.borderStyle="solid"
  1027.     s.borderWidth=1
  1028.     s.borderColor=ltClr+" "+rbClr+" "+rbClr+" "+ltClr
  1029. }