////////////////////////////////////////////////////////////////////////
// This file contains javascript functions that are used to link to
// external images and flash shockwave (.swf) files from inside a chm
// file.
// By using external resources, the multi-languae installation size can
// be decreased by 100s of megabytes in size since all the localized
// Rhino chm files use the same set of image/swf resources. 
////////////////////////////////////////////////////////////////////////



// Summary: Write HTML to display an external shockwave flash file (swf)
// Parameters:
//   swf_filename: [in] relative path to the swf file
function RhEmbedFlash(swf_filename, swf_width, swf_height)
{
  // get the path to the current html file
  var substr_start, substr_end;
  
  // some voodoo to trim of the prefix of the href.
  var ra, a;
  ra = /:/;
  a = location.href.search(ra);
  if (a == 2){ 
   substr_start = 14;} 
  else{ 
   substr_start = 7;} 
  
  substr_end = location.href.lastIndexOf("\\");
  
  var path;
  path = location.href.substring( substr_start, substr_end );
  
  // path now points to the directory that the CHM file is located in
  path = path.substring( 0, path.lastIndexOf("\\") ); 
  path = path.substring( 0, path.lastIndexOf("\\") );
  if ( path == "" )
    path = "..\\..\\..\\HelpMedia\\Animations";
  else
    path += "\\HelpMedia\\Animations";
  path += "\\"+ swf_filename;
  path = path.replace(/%20/g, " "); 
//  path = path.replace("%20", " "); 
//  path = path.replace("%20", " "); 

  //uncomment the following line if you want to print the path for debugging
//document.write('path = ' + path + '<br>');
  //return;

//  document.write('<EMBED src="' + path + '" quality="high" ');
//  document.write('HEIGHT="' + swf_width + '" WIDTH="' + swf_height + '" bgcolor="#FFFFFF" ');
//  document.write('TYPE="application/x-shockwave-flash" ');
//  document.write('PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'); 

  document.writeln('<object x-maintain-ratio=TRUE');
	document.writeln('  classid="CLSID:d27cdb6e-ae6d-11cf-96b8-444553540000"');
  document.writeln('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,12,0"');
  document.writeln('  type="application/x-oleobject"');
  document.writeln('  standby="Loading multimedia control..."');
  document.writeln('  style="width: ' + swf_width + 'px;');
  document.writeln('         height: ' + swf_height + 'px;');
  document.writeln('         border-left-style: Solid;');
  document.writeln('         border-left-width: 1px;');
  document.writeln('         border-right-style: Solid;');
  document.writeln('         border-right-width: 1px;');
  document.writeln('         border-top-style: Solid;');
  document.writeln('         border-top-width: 1px;');
  document.writeln('         border-bottom-style: Solid;');
  document.writeln('         border-bottom-width: 1px;');
  document.writeln('         border-left-color: #c0c0c0;');
  document.writeln('         border-right-color: #c0c0c0;');
  document.writeln('         border-top-color: #c0c0c0;');
  document.writeln('         border-bottom-color: #c0c0c0;');
  document.writeln('         float: none;"');
  document.writeln('  width=' + swf_width );
  document.writeln('  height=' + swf_height +'>');
  document.writeln('<param name="movie" value="' + path + '">');
  document.writeln('<param name="quality" value="high" >');
  document.writeln('<embed x-maintain-ratio=TRUE');
  document.writeln('  src="' + path + '"');
  document.writeln('  alt="Loading multimedia control..."');
  document.writeln('  pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"');
  document.writeln('  type="application/x-shockwave-flash"');
  document.writeln('  controller=false');
  document.writeln('  ShowControls=0');
  document.writeln('  style="width: ' + swf_width + 'px;');
  document.writeln('         height: ' + swf_height + 'px;');
  document.writeln('  border-left-style: Solid;');
  document.writeln('  border-left-width: 1px;');
  document.writeln('  border-right-style: Solid;');
  document.writeln('  border-right-width: 1px;');
  document.writeln('  border-top-style: Solid;');
  document.writeln('  border-top-width: 1px;');
  document.writeln('  border-bottom-style: Solid;');
  document.writeln('  border-bottom-width: 1px;');
  document.writeln('  border-left-color: #c0c0c0;');
  document.writeln('  border-right-color: #c0c0c0;');
  document.writeln('  border-top-color: #c0c0c0;');
  document.writeln('  border-bottom-color: #c0c0c0;');
  document.writeln('  float: none;"');
  document.writeln('  width=' + swf_width);
  document.writeln('  height=' + swf_height + '>');
  document.writeln('</embed></object>');
} 


// Summary: Write HTML to display an external image file
// Parameters:
//   image_filename: [in] relative path to the image file
function RhEmbedImage(image_filename)
{
}