


function OnLoad()
{
	   vid = document.getElementById( "video1" );
   addEvent( vid, "click", divClickHandler );
	
	   timerInit();
	
}
function SeekTime( Time )
{   
   if( document.QuickTimePlayer == undefined || document.QuickTimePlayer == null )
   {
      return;
   }
   
   document.QuickTimePlayer.SetTime( Time * 600 );
   
   document.QuickTimePlayer.Play();
}


function ScrollToIndex( DivID, destIndex ) 
{
   var nDestYCoord = destIndex.offsetTop; 
   var thisNode    = destIndex; 
   
   while ( thisNode.offsetParent && ( thisNode.offsetParent !=  document.body) ) 
   { 
      thisNode     = thisNode.offsetParent; 
      nDestYCoord += thisNode.offsetTop; 
   }

   nCurWindowYPos = GetCurrentScrollYPos( DivID.id );

   //Only scroll if it's needed..
   if( destIndex.offsetTop + destIndex.offsetHeight > DivID.clientHeight )
   {      
      nDestYCoord -= DivID.clientHeight;
      
      if( nDestYCoord > DivID.scrollTop )
      {
         DivID.scrollTop = nDestYCoord;
      }
   }
}

function GetCurrentScrollYPos( DivID ) 
{ 
   var aDivs = document.body.getElementsByTagName("DIV");

   for ( var i=0; i < aDivs.length; i++ ) 
   { 
      var Div = aDivs[i]; 

      if ( Div.id == DivID ) 
      { 
         return Div.scrollTop
      }
   }

   return 0;
}


function timerInit() 
{
   //Sets the timer to check every .1 second
   window.setInterval("timer()", 100);
}

function timer() 
{  
   if( document.QuickTimePlayer == undefined || document.QuickTimePlayer == null )
   {
      return;
   }
   
   var StartTime = document.QuickTimePlayer.GetTime();
   var destIndex = null;
   
   var curTime = QuickTimePlayer.GetTime() / 600;
      if( curTime >= 0.000000 && curTime < 353.466000 )
      {
         document.getElementById('Index0').style.backgroundColor = '#ffffcc';
         destIndex = document.getElementById('Index0');
      }
      else
      {
         document.getElementById('Index0').style.backgroundColor = '';
      }

   
   var EndTime = document.QuickTimePlayer.GetTime();
   
   if( destIndex != null && StartTime != EndTime )
   {
      ScrollToIndex( document.getElementById('indexlinks'), destIndex );
   }
}

   var toc1     = null;
   var toc2     = null;
   var vid      = null;
     
   //adds and event listener across major browser versions
   function addEvent( obj, type, fn )
   {
	   if ( obj.addEventListener )
	   {
		   obj.addEventListener( type, fn, true );
	   }
	   else if ( obj.attachEvent )
	   {
		   obj.attachEvent( "on" + type, fn );
	   }
	   else
	   {
		   obj["on" + type] = fn;
	   }
   }

   //removes event listeners across major browser versions
   function removeEvent( obj, type, fn )
   {
      if ( obj.removeEventListener )
	   {
	      obj.removeEventListener( type, fn, true );	
	   }
	   else if ( obj.detachEvent )
	   {
	     obj.detachEvent( "on" + type, fn );
	   }
	   else
	   {
		   delete obj["on" + type];	
	   }
   }
   
   function divClickHandler()
   {
      SwitchPlayer( "video1", "video2", "ITTransformation.mov", "640", "496", "ITTransformation_media/", "QuickTimePlayer", "CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", "http://www.apple.com/qtactivex/qtplugin.cab", "EmbedQuickTimePlayer", "true", "http://www.apple.com/quicktime/download/", "false", "true", "true", toc1, toc2 );
      
      removeEvent( vid, 'click', divClickHandler );
   } 
   toc1 = 
               '<table id="CsEmdPlr">'
             + '   <tr>'
             + '      <td class="top_center_clr">'
             + '         <div class="contentWrapper_left">'
             + '            <div class="content_left">'
             + '               <img src="ITTransformation_media/images/top_left_corner.jpg" alt=" " class="borderTL" />'
             + '               <img src="ITTransformation_media/images/top_right_corner.jpg" alt=" " class="borderTR" />'
             + '               <div id="indexlinks" class="indexlinks"><br/>'
             + '                  <h3>ITTransformation</h3>'
+ '                  <p id="Index0"><a href="javascript:SeekTime(0.000000);" title="Introduction">  Introduction</a></p>'

             + '               </div>'
             + '            </div>'
             + '         </div>'
             + '         <div id="menuBottom"></div>'
             + '      </td>'
             + '      <td class="top_center">'
             + '         <div class="contentWrapper">'
             + '            <div class="content">'
             + '               <img src="ITTransformation_media/images/top_left_corner.jpg" alt=" " class="borderTL" />'
             + '               <img src="ITTransformation_media/images/top_right_corner.jpg" alt=" " class="borderTR" /><br/><br/>';          

   toc2 = 
               '               <br/>  <div style="text-align: center; font-size:small; color:white" >Best viewed with QuickTime 6 or later. <a class="notdisplayed" href="http://www.techsmith.com/redirect.asp?target=quicktime&lang=enu">Download the latest version</a>.</div>'
             + '            </div>'
             + '         </div>'
             + '      </td>'
             + '   </tr>'
             + '   <tr>'
             + '      <td></td>'
             + '      <td class="bottom_center">'
             + '         <div class="contentWrapper">'
             + '            <div class="content">'
             + '               <img src="ITTransformation_media/images/bottom_left.jpg" alt=" " class="borderBL"  />'
             + '               <img src="ITTransformation_media/images/bottom_right.jpg" alt=" " class="borderBR" />'
             + '             </div>'
             + '         </div>'
             + '      </td>'
             + '   </tr>'
             + '</table>';

