var showVideo = {
    so_vfile: null,
    so_title: null,
    so_desc: null,
    listItems: null,
    check_count: 0,
    
    '_container': null,
    '_scrollingPosition': null,
    '_viewPortSize': null,
    '_left': 0,
    '_top': 0,
 
    initSetup: function()  {            
                    	
       $$('.anchor').each(function(o) {      
           Event.observe(o, 'click', function(event) {                 
              stopDefaultAction(event);
          }); 
       });  

       $$('.anchor').each(function(o) {  
          Event.observe(o, 'click', showVideo.findVideo.bindAsEventListener(showVideo));   
        });          
        
 //      new Draggable('sermons');
     },
    
    findVideo: function(event)  {
       var params = Event.element(event).toString().toQueryParams();
       so_vfile=params.vfile;
       so_title=params.title;
       so_desc=params.desc;
       
     //  alert ("In the findVideo thing on thing thing--> " + so_vfile + " " + so_title + " " + so_desc);
     
      var isVideo = $('video1');       
 
    // Remove the Video DIV if it is already on the page 
      if (isVideo == null) {
        listItems=1;
      }
      else {
         $('video1').remove();
      }
 
      
      var contentDiv = $('content');
      
      var video1Div = Builder.node('div', {id: 'video1', style: 'display:none' } ,
                   [Builder.node('p',{id: 'vidtitle2'}, so_title ) ]);
                   
                   
/**************** code not need to build 'object' (keep for later)  **********                   
      var objectId = Builder.node('object', {id: 'videodisplay', classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000', codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0', 
           width: '320', height: '274', align: 'middle'});
           
      objectId.appendChild(Builder.node('param', { name: 'allowScriptAccess', value: 'sameDomain' }));
      objectId.appendChild(Builder.node('param', { name: 'movie', value: 'player.swf' }));
      objectId.appendChild(Builder.node('param', { name: 'FlashVars', value: 'flvURL=videos/' + so_vfile + '&ControlPanelColor=0xccff00&buttonColor=0x000000&ControlPanelPosition=0&showControlPanel=1&ShowtimeColor=0xffffff&bAutoPlay=1&bAutoRepeat=0&BufferTime=5&tmeColor=0xffffff&loaColor=0x666666&GroundColor=0x000000&conNum=5&bShowtime=1&startvolume=100' }));
      objectId.appendChild(Builder.node('param', { name: 'quality', value: 'high' }));
      objectId.appendChild(Builder.node('param', { name: 'bgcolor', value: '#000000' }));
      objectId.appendChild(Builder.node('param', { name: 'scale', value: 'noscale' }));
      objectId.appendChild(Builder.node('param', { name: 'salign', value: 'lt' }));
      video1Div.appendChild(objectId);  // add Object ID
*************************************************************/
                                                                            // orig width: 320  height: 274
      var btwembed = Builder.node('embed', { id: 'videodisplay', src: 'player.swf', width: '450', height: '386', align: 'middle', quality: 'high', bgcolor: '#000000', scale: 'noscale', 
         salign: 'lt', FlashVars: 'flvURL=videos/' + so_vfile + '&ControlPanelColor=0xccff00&buttonColor=0x000000&ControlPanelPosition=0&showControlPanel=1&ShowtimeColor=0xffffff&bAutoPlay=1&bAutoRepeat=0&BufferTime=5&tmeColor=0xffffff&loaColor=0x666666&GroundColor=0x000000&conNum=5&bShowtime=1&startvolume=100',
         allowScriptAccess: 'sameDomain', type: 'application/x-shockwave-flash', pluginspage: 'http://www.macromedia.com/go/getflashplayer'  });                  
      video1Div.appendChild(btwembed);  

      var pgraph = Builder.node('p', { id: 'viddesc'} , so_desc );
      video1Div.appendChild(pgraph);  // add Paragraph
            
      contentDiv.appendChild(video1Div);   
      
      Effect.Appear('video1', { duration: 3.0 });  // make the border around the video fade in for three seconds
  
     }
     
}

Event.observe(window, 'load', showVideo.initSetup);
