 function embedQuicktime( src, qtsrc, height, width, autoplay ) {
   
   var content = openObject( height, width ) +
     param( "src", src ) +
     param( "autoplay", (autoplay ? 'true' : 'false' ) );
               
   if ( qtsrc ) {
     content += param( "qtsrc", qtsrc );
   }
   
   var embedValues = new Array();
   embedValues.push( [ "AUTOPLAY", (autoplay ? 'true' : 'false' ) ] );
   
   if ( qtsrc ) {
     embedValues.push( [ "QTSRC", qtsrc ] );
   }
   
   content += embed( src, height, width, embedValues ) +
     '</OBJECT>';
   
   document.write( content );
    
 }
 
 function quicktimePopup( src, qtsrc, height, width ) {
 	 //don't output anything if we aren't given any qt to open
   if ( !qtsrc ) {
     return;
   }
   var attributes = new Array();
   attributes.push( [ "CONTROLLER", "False" ] );
   attributes.push( [ "HREF", qtsrc ] );
   attributes.push( [ "TARGET", "QuickTimePlayer" ] );
   
   var content = '<a href="#">' +
     openObject( height, width ) +
     param( "src", src ) +
     param( "CONTROLLER", "False" ) +
     param( "HREF", qtsrc ) +
     param( "TARGET", "QuickTimePlayer" ) +
     embed( src, height, width, attributes ) +
     '</OBJECT></a>';
     
     document.write( content );
 }

function openObject( height, width ) {
  return '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"' +
     ' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"' +
     ' HEIGHT="' + height + '" WIDTH="' + width + '">';
}

function param( name, value ) {
	return '<PARAM NAME="' + name + '" VALUE="' + value + '">';
}

function embed( src, height, width, attributes ) {
  var content = '<EMBED SRC="' + src + '" HEIGHT="' + height + '" WIDTH="' + width +
     '" TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/"';
     
  for( var i = 0; i < attributes.length; i++ ) {
    content += ' ' + attributes[i][0] + '="' + attributes[i][1] + '"';
  }
  content += '/>';
 
  return content;
}

