
// *** launch ShockWave file in separate window ***
function launchModule(vModuleCode, vWindowTitle) {
  vBGCOLOR = "#FFFFFF";
  vWidth = 800;
  vHeight = 600;
  vFileName = "http://www.retrorocket.com/portfolio/unc/main.dcr";
  vStretchStyle = "none";
  vSaveEnabled = "FALSE";
  vVolume = "TRUE";
  vRestart = "TRUE";
  vPausePlay = "FALSE";
  vFastForward = "FALSE";
  vContextMenu = "TRUE";


  x = '<HTML>\n';
  x += '<HEAD>\n';
  x += '<TITLE>' + vWindowTitle + '</TITLE>\n';
  x += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n';
  x += '<SCRIPT LANGUAGE="JavaScript">\n';
  x += 'function launchResourceWindow(vResourceURL, vResourceWidth, vResourceHeight, vCaption) {\n';
  x += '  vWindowWidth = vResourceWidth + 100;\n';
  x += '  vWindowHeight = vResourceHeight + 100;\n';
  x += '  if ( (resourceWindow == null) || (resourceWindow.closed) ) {\n';
  x += '    resourceWindowConfig = "directories=no,location=no,menubar=no,status=no,scrollbars=yes,toolbar=no,resizable=yes,width=" + vWindowWidth + ",height=" + vWindowHeight;\n\n';

  x += '    var vCurrentWidth=0, vCurrentHeight=0;\n';
  x += '    if( typeof( window.innerWidth ) == \'number\' ) {\n';

  //Netscape compliant
  x += '      vCurrentWidth = window.innerWidth;\n';
  x += '      vCurrentHeight = window.innerHeight;\n';
  x += '    } else {\n';

  //DOM compliant
  x += '      if( document.documentElement &&\n';
  x += '        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {\n';
  x += '        vCurrentWidth = document.documentElement.clientWidth;\n';
  x += '        vCurrentHeight = document.documentElement.clientHeight;\n';
  x += '      } else {\n';
  x += '        if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {\n';

  //IE6 standards compliant mode
  x += '        vCurrentWidth = document.body.clientWidth;\n';
  x += '        vCurrentHeight = document.body.clientHeight;\n';
  x += '      }\n';
  x += '    }\n';
  x += '  }\n\n';


  x += '    if (navigator.appName.indexOf(\"Microsoft\")>=0) {\n';
  x += '      vCurrentLeft = self.screenLeft;\n';
  x += '      vCurrentTop  = self.screenTop;\n';
  x += '      vNewLeft = Math.floor( (vCurrentWidth - vWindowWidth) / 2) + vCurrentLeft;\n';
  x += '      vNewTop  = Math.floor( (vCurrentHeight - vWindowHeight) / 2) + vCurrentTop;\n';
  x += '      resourceWindowConfig += \',left=\' + vNewLeft + \',top=\' + vNewTop;\n';
  x += '    }else{\n';
  x += '      vCurrentLeft    = self.screenX;\n';
  x += '      vCurrentTop     = self.screenY;\n';
  x += '      vNewLeft = Math.floor( (vCurrentWidth - vWindowWidth) / 2) + vCurrentLeft;\n';
  x += '      vNewTop  = Math.floor( (vCurrentHeight - vWindowHeight) / 2) + vCurrentTop;\n';
  x += '      resourceWindowConfig += \',screenX=\' + vNewLeft + \',screenY=\' + vNewTop;\n';
  x += '    }\n';
  x += '    var resourceWindow = window.open("", "resource", resourceWindowConfig);\n';
  x += '    if (resourceWindow.opener == null) resourceWindow.opener = window;\n';
  x += '  }\n\n';

  x += '  resourceWindow.document.open();\n\n';

  x += '  resourceWindow.document.write(\'<HTML>\\n\');\n';
  x += '  resourceWindow.document.write(\'<HEAD>\\n\');\n';
  x += '  resourceWindow.document.write(\'<TITLE>Media Viewer</TITLE>\\n\');\n';
  x += '  resourceWindow.document.write(\'<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\\n\');\n';
  x += '  resourceWindow.document.write(\'<STYLE TYPE=\"text/css\">P, TD, BODY {  font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;}</STYLE>\\n\');\n';
  x += '  resourceWindow.document.write(\'</HEAD>\\n\');\n';
  x += '  resourceWindow.document.write(\'<BODY TOPMARGIN=\"0\" BOTTOMMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" BGCOLOR=\"#FFFFFF\">\\n\\n\');\n';
  x += '  resourceWindow.document.write(\'<BR>\\n\');\n';
  x += '  resourceWindow.document.write(\'<CENTER>\\n\');\n';
  x += '  resourceWindow.document.write(\'<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0\" width=\"\' + vResourceWidth + \'\" height=\"\' + (vResourceHeight + 16) + \'\" align=\"middle\">\\n\');\n';
  x += '  resourceWindow.document.write(\'  <param name=\"src\" value=\"\' + vResourceURL + \'\" />\\n\');\n';
  x += '  resourceWindow.document.write(\'  <param name=\"autoplay\" value=\"true\" />\\n\');\n';
  x += '  resourceWindow.document.write(\'<embed src=\"\' + vResourceURL + \'\" autoplay=\"true\" width=\"\' + vResourceWidth + \'\" height=\"\' + (vResourceHeight + 16) + \'\" align=\"middle\" bgcolor=\"#FFFFFF\" pluginspage=\"http://www.apple.com/quicktime/download/\"></embed>\\n\');\n';
  x += '  resourceWindow.document.write(\'</object>\\n\');\n';
  x += '  resourceWindow.document.write(\'<BR><BR>\\n\');\n';
  x += '  resourceWindow.document.write(\'<P>\' + vCaption + \'</P>\\n\');\n';
  x += '  resourceWindow.document.write(\'</CENTER>\\n\');\n';
  x += '  resourceWindow.document.write(\'</BODY>\\n\');\n';
  x += '  resourceWindow.document.write(\'</HTML>\\n\');\n';

  x += '  resourceWindow.document.close();\n';
  x += '  resourceWindow.focus();\n';
  x += '}\n';
  x += '</SCRIPT>\n';


  x += '</HEAD>\n';
  x += '<BODY TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" BGCOLOR="' + vBGCOLOR  + '">\n\n';
  x += '<OBJECT classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000"\n';
  x += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0"\n';
  x += ' ID=MAIN WIDTH=' + vWidth + ' HEIGHT=' + vHeight + '>\n';
  x += '  <PARAM NAME=sw1 VALUE="' + vModuleCode + '">\n';
  x += '  <PARAM NAME=src VALUE="' + vFileName + '">\n';
  x += '  <PARAM NAME=swStretchStyle VALUE=' + vStretchStyle + '>\n';
  x += '  <PARAM NAME=swRemote VALUE="';
  x += "swSaveEnabled=\'" + vSaveEnabled + "\' swVolume=\'" + vVolume + "\' swRestart=\'" + vRestart + "\' swPausePlay=\'" + vPausePlay + "\' swFastForward=\'" + vFastForward + "\' swContextMenu=\'" + vContextMenu + "\'";
  x += '\">\n';
  x += '  <EMBED SRC="' + vFileName + '" sw1="' + vModuleCode + '"\n';
  x += ' bgColor="' + vBGCOLOR + '" WIDTH="' + vWidth + '" HEIGHT="' + vHeight + '" swStretchStyle="' + vStretchStyle + '" ';
  x += 'swRemote="';
  x += "swSaveEnabled=\'" + vSaveEnabled + "\' swVolume=\'" + vVolume + "\' swRestart=\'" + vRestart + "\' swPausePlay=\'" + vPausePlay + "\' swFastForward=\'" + vFastForward + "\' swContextMenu=\'" + vContextMenu + "\'";
  x += '"';
  x += ' TYPE="application/x-director" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveDirector">\n';
  x += '  </EMBED>\n';
  x += '</OBJECT>\n';
  x += '</BODY>\n';
  x += '</HTML>\n';

  if ( (shockWindow == null) || (shockWindow.closed) ) {
    shockWindowConfig = 'directories=no,location=no,menubar=no,status=no,scrollbars=yes,toolbar=no,resizable=yes,width=' + (vWidth + 20) + ',height=' + vHeight;

    if (navigator.appName.indexOf("Microsoft")>=0) {
      shockWindowConfig +=',left=10,top=10'
    }else{
      shockWindowConfig +=',screenX=10,screenY=10'
    }

    var shockWindow = window.open('', 'player', shockWindowConfig);
    shockWindow.screenX = 0;
    shockWindow.screenY = 0;
    shockWindow.left = 0;
    shockWindow.right = 0;
    if (shockWindow.opener == null) shockWindow.opener = window;
  }

  shockWindow.document.open();
  shockWindow.document.write(x);
  shockWindow.document.close();
  shockWindow.focus();
}
