function Play_wmv(filename, title, width, height) {
         //features=',scrollbars,location,toolbar,titlebar';
	 features = ',resizable=yes,titlebar=no,menubar=no,location=no';

         height = height + 65;  // leave enough room for controller

         mediaPopWin = window.open("", 'mediaPopWin', 'width=' + width + ',height=' + height + features);
	 strContents = template_wmv();
         strContents = strContents.replace("$filename", filename);
         strContents = strContents.replace("$title", title);
         strContents = strContents.replace("$width", width);
         strContents = strContents.replace("$height", height);

	// do it again to get the <embed> don't know why
         strContents = strContents.replace("$filename", filename);
         strContents = strContents.replace("$width", width);
         strContents = strContents.replace("$height", height);

         mediaPopWin.document.writeln(strContents);
}

function Play_flv(htmlfile, title, width, height) { 
         //features=',scrollbars,location,toolbar,titlebar';
	 features = ',resizable=yes,titlebar=no,menubar=no,location=no';

         height = height + 55;  // leave enough room for controller

         mediaPopWin = window.open(htmlfile, 'mediaPopWin', 'width=' + width + ',height=' + height + features);
}

function template_wmv() {

var strContent = 
  '<html>' + "\n"
+ '<head>' + "\n"
+ '<title>$title</title>' + "\n"
+ '<style type="text/css"> <!-- body { overflow:hidden; } --> </style>' + "\n"
+ '</head>' + "\n"
+ ' ' + "\n"
+ '<body bgcolor="#45556E" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">' + "\n"
+ '<object id="mediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"' + "\n"
         + 'width="100%" height="100%"' + "\n"
         + ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"' + "\n"
         + ' standby="Loading Microsoft Windows Media Player components..."' + "\n"
         + ' type="application/x-oleobject">' + "\n"
         + '   <param name="autoStart" value="true"/>' + "\n"
         + '   <param name="url"       value="$filename" />' + "\n"
         + '   <param name="wmode"     value="transparent" />' + "\n"
         + '   <param name="uiMode"    value="full" />' + "\n"
         + '   <param name="loop"      value="false" />'                + "\n"
	 + '  <PARAM NAME="StretchToFit" VALUE="true">' + "\n"
         + '   <embed id       ="EmbedmediaPlayer"' + "\n"
         + '       type        ="application/x-mplayer2"' + "\n"
         + '       src         ="' + "$filename" + '"' + "\n"
         + '       width       ="100%"'  + "\n"
         + '       height      ="100%">' + "\n"
         + '   </embed>' + "\n"
         + '</object>' + "\n"
+'</body>' + "\n"
+'</html>' + "\n" ;
  return(strContent);
}

/*
 * template_flv didn't work
 */
function template_flv() {

var strContent = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + "\n"
      +'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' + "\n"
      +  '<head>' + "\n"
      +    '<!-- saved from url=(0025)http://www.techsmith.com/ -->' + "\n"
      +    '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' + "\n"
      +    '<meta name="DC.date" content="Tuesday, August 14, 2007" />' + "\n"
      +    '<title>$title</title>' + "\n"
      +    '<script type="text/javascript" src="include/flash/swfobject.js"></script>' + "\n"
      +    '<script type="text/javascript" src="include/flash/args.js"></script>' + "\n"
      +    '<link rel="stylesheet" type="text/css" href="include/flash/FlashTemplate.css"/>' + "\n"
      + '</head>' + "\n"
      + '<body id="cs_flashBody">' + "\n"
      + '   <div id="flashcontent">' + "\n"
      + '                     <div id="cs_noexpressUpdate">' + "\n"
      + '                      <p>The Camtasia Studio video content presented here requires JavaScript to be enabled and the  latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by <a href="http://www.macromedia.com/go/getflashplayer">downloading here</a>. </p>' + "\n"
      +'                     </div>' + "\n"
      +'   </div>' + "\n"
      +'	<script type="text/javascript">' + "\n"
      + ' alert("fo"); '
      +'   var fo = new SWFObject( "controller.swf", "controller.swf", "$width", "$height", "8", "#FFFFFF", false, "best" );'
      + ' alert("fo"); '
      +'   fo.addVariable( "csConfigFile", "$config"  );' + "\n"
      + ' alert("fo"); '
      +'   fo.addVariable( "csColor"     , "FFFFFF"           );' + "\n"
      +'   fo.addVariable( "csPreloader" , "include/flash/preload.swf" );' + "\n"
      +'   if( args.movie )' + "\n"
      +'   {' + "\n"
      +'      fo.addVariable( "csFilesetBookmark", args.movie );' + "\n"
      +'   }' + "\n"
      +'   fo.write("flashcontent");' + "\n"
      +'</script>' + "\n"
      +' </body>' + "\n"
      +'</html>' + "\n";
  return(strContent);
}
