PLA= "pageLoadedI" // Name of additional function to execute after the page has loaded

JavaScriptForKeyG="setRepeatOption(0);location.href=((PLFN==IPL[0])?'../':thisFileName)+encodeURLI(true,false); // _indexATS.js";
                // Code to execute when the "G" key is pressed

numberOfAudioFiles=0;
itsaMainIndex=itsDOC=false;

function encodeURLI(itsG,includeIndex)
 {
 if(DM)
  alertDM('_indexATS.js - encodeUR\x4CI()')
 var T1=encodeURLcommon('sh347rhruf');
 for(var i=0;i<origColor.length;i++)
  {
  T2=colorVariableTags[i];
  if(((T2=='BG2')&&(BG2==BG))||((T2=='BG3')&&(BG3==BG)))
   continue;
  eval('T1+=(origColor['+i+']=='+T2+')?"":"&'+T2+'='+eval(T2)+'"');
  }
 if(itsG||!itsaMainIndex)
  {
  RO='';
  GEBI('fullScreen').checked=false;
  GEBI('videoMode').checked=false;
  }
 if(itsG||!GEBI('videoMode').checked)
  {
  if(!itsG)
   {
   T1+=(PLFN&&includeIndex&&(PLFN!=IPL[0]))?'&PLFN='+PLFN:'';
   T1+=RO?'&RO='+RO:'';
   if(itsaMainIndex)
    T1+='&VCM=0';
   }
  }
 else
  T1+='&VCM='+(RO?'0':(GEBI('fullScreen').checked?'0x0':'642x482')+'x4&SW=4');
 return(T1?'?'+T1.slice(1):'');
 }

function loadItI(theFileName)
 {
 setRepeatOption(0);
 PLFN=theFileName;
 location=thisFileName+encodeURLI(false,true);
 }

function pageLoadedI()
 {
 defaultDIM=DIM;
 IPL=IPL.split(',');
 for(i=0;i<IPL.length;i++)
  {
  if(PLFN==IPL[i])
   itsaMainIndex=true;
  }
 DPL=DPL.split(',');
 for(i=0;i<DPL.length;i++)
  {
  if(PLFN==DPL[i])
   itsDOC=true;
  }
 var T1='<p class=SmallFont>| ',T2,T3,T4,T5,T6;
 for(var i=0;i<thePlayLists.length;i++)
  T1+='<a href=javascript:loadItI("'+thePlayLists[i]+'") title='+thisURL2+'?PLFN='+thePlayLists[i]+'>'+thePlayLists[i].replace(/_/,'&nbsp;')+'</a> | ';

 T2=T1+'<p class=ColorBox style="font-size:135%">'+(PLFN.replace(/__/,'??').replace(/_/g,' '))+'<br>';
 if(itsDOC)
  {
  atEndDisplayed=false;
  T2+=DOC+'<input type=hidden id=videoMode><input type=hidden id=fullScreen>';
  }
 else
  {
  atEndDisplayed=true;
  if(itsaMainIndex)
   T2+='<p style="margin-bottom:1em">After playing one of the following&hellip; <input class=INP6 type=radio name=atEnd value=0 checked>Stop <input class=INP6 type=radio name=atEnd value=1>Repeat <input class=INP6 type=radio name=atEnd value=2>Play others <input class=INP6 type=radio name=atEnd value=3>Repeat all <input class=INP6 type=radio name=atEnd value=4>Repeat all at random <input class=INP6 type=checkbox id=videoMode onclick="switchToStop()" onfocus="switchToStop()">Video&nbsp;capture&nbsp;mode (VC mode uses the <a href='+((thisPathName.indexOf('llbest.com')+1)?'.':'http://llbest.com')+'/fonts/SegoeUI.zip title=http://llbest.com/fonts/SegoeUI.zip>&ldquo;Segoe&nbsp;UI&rdquo; font</a>) <input class=INP6 type=checkbox id=fullScreen>Full&nbsp;screen&nbsp;mode (Please be patient, &#8217;cause the <a href=100speeches/a/ target=_blank>MP3 file</a> may take a few seconds to load.)';
  else
   T2+='<input type=hidden id=videoMode><input type=hidden id=fullScreen>';
  grandTotalTime=0;
  PL=PL?(itsMSIE?PL.slice(0,-1):PL):'';
  for(i=0;i<PL.length;i++)
   {
   T3=PL[i].split('|');
   if(T3.length==1)
    {
    T4=0;
    T5=T3[0];
    }
   else
    {
    T4=(T3[1]|0);
    if(!T4)
     T4=0;
    T5=T3[2];
    }
   T6='';
   if(T4)
    {
    T6=Math.floor(unformatTheTime(T3[3]));
    grandTotalTime+=T6;
    T6=' ('+(Math.floor(T6/60)+':'+('0'+(T6%60)).replace(/.?(..)$/,'$1'))+')';
    }
   T2+='<p>'+(i+1)+'. <a href=javascript:playIt('+i+') title='+(location.href.replace(/\/[^\/]*$/,'/'))+(itsaMainIndex?TU1:TU2)+T3[0]+'.htm>'+T5+'</a>'+T6+(FS1&&((T3[1]==2)||(FS1==FS2))?'*':'');
   }
  if(grandTotalTime)
   {
   T3=Math.round(grandTotalTime/60);
   T4=Math.floor(T3/60);
   T3=T3%60;
   T2+='<p style="margin-top:1.5em">Total Playing Time: '+(T4?T4+' hour'+((T4==1)?'':'s')+', ':'')+T3+' minute'+((T3==1)?'':'s')+'.';
   T2+='<p>* indicates that &ldquo;Video capture mode&rdquo; text is available. ';
   T2+='<p>If the above listed audio/text synchronization web pages do not work, make sure that you are using Windows 98SE or later, that you are using Microsoft Internet Explorer 5.5 or later, and that your computer&rsquo;s speakers are working.';
   }
  }
 
 T2+='<p class=ColorBox style="font-size:135%;margin-top:1em;margin-bottom:0.7em">End'+T1;

 GEBI('theIndex').innerHTML=T2;

 window.scrollTo(0,TP*GEBI('textDiv').clientHeight/10000);

 if(RO&&(typeof(document.theForm.atEnd)!='undefined'))
  {
  T1='ny1ar'.indexOf(RO);
  if(T1<0)
   T1=2;
  }
 document.theForm.atEnd[T1].checked=true;
 }

function playIt(theFileNumber)
 {
 if(PL)
  {
  setRepeatOption(theFileNumber);
  var T1=(PL[theFileNumber]).split('|');
  numberOfAudioFiles=T1[1]|0;
  if(GEBI('videoMode').checked&&((numberOfAudioFiles!=2)&&(FS1!=FS2)))
   alert('No video capture mode text available.');
  else
   {
   T1=(itsaMainIndex?TU1:TU2)+T1[0]+(GEBI('videoMode').checked?FS2:FS1)+'.htm';
   if(GEBI('fullScreen').checked||(!RO&&GEBI('videoMode').checked))
    {
    SW=GEBI('fullScreen').checked?SW|64:SW&63;
    T1+=encodeURLI(false,(!GEBI('videoMode').checked&&GEBI('fullScreen').checked));
    if(GEBI('fullScreen').checked)
     {
     if(confirm('If your web browser allows it, you are about to launch a full screen popup window.\n\n To close the popup window & return to this menu, press "G".\n\n For help, including how to close the window, press "H".'))
      open(T1,'','fullscreen=yes');
     }
    else
     open(T1,'','menubars=no,toolbars=no');
    }
   else
    {
    T1+=encodeURLI(false,true);
    location.href=T1;
    }
   }
  }
 else
  alert('Playlist not found. File "ATSplaylist.js" may be missing or improperly formatted.');
 }

function setRepeatOption(theFileNumber)
 {
 if(typeof(document.theForm.atEnd)=='undefined')
  RO='';
 else
  {
  for(var i=0;!document.theForm.atEnd[i].checked;i++);
  switch(i)
   {
   case 0:RO='';break;
   case 1:RO='y';break;
   case 2:RO=''+(theFileNumber+1);break;
   case 3:RO='a';break;
   case 4:RO='r';
   }
  }
 }

function switchToStop()
 {
 setTimeout("if(GEBI('videoMode').checked){document.theForm.atEnd[0].checked=true;GEBI('fullScreen').checked=false}",200);
 }

