/* insertFlash.js

    Implementation of JavaScript functions useful for embedding the
    Flash client control in a web page in order to bypass the
    'Press SPACEBAR or ENTER to activate and use this control'
    message in the updated IE version, this function must exist in a seperate
    ".js" file.

    To use functions found in this file, you should include the following line
    somewhere in the '<head>' portion of your HTML file:

    <head>
        <script language="JavaScript" type="text/javascript" src="<PATH_TO THIS_FILE>/insertFlash.js"></script>
    </head>


    Usage example:
    ...
    <body>
        ...
        <script language="JavaScript" type="text/javascript">
        <!--
            show_flash("HomePage", "flash/homepage.swf", "370", "270", "#ffffff", "images/homepage.jpg",
                          "Alt text goes here", "http://www.mysite.com/", false, 3, "href=http://www.mysite.com/");
        //-->
        </script>
        ...
    </body>
    ...
*/


var plugin = 0;

function check_flash () {

  if ((navigator.appName == "Microsoft Internet Explorer" &&
    navigator.appVersion.indexOf("Mac") == -1 &&   navigator.appVersion.indexOf("3.1") == -1) ||

    (navigator.plugins && navigator.plugins["Shockwave Flash"])
                       || navigator.plugins["Shockwave Flash 2.0"]){

   //Load a pre-defined HTML page with Flash Player in it into the browser window.
    plugin = true;
  } else {
    //Load a pre-defined HTML page without Flash Player into the browser window.
    plugin = false;
  }
}


function show_flash (objectId, movie, width, height, bgColor, altImg, altText, altHref, ff, flashVars) {

var ff = (ff) ? ff : false; //force_flash

  check_flash ();

  if ( plugin ) {
  	var tag =
        '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\r\n'
        + '  codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"\r\n'
        + '  width="' + width + '" height="' + height + '" id="' + objectId + '">\r\n'
        + '  <param name="movie" value="' + movie + '" />\r\n'
        + '  <param name="quality" value="high" />\r\n'
    //    + '  <param name="scale" value="exactfit" />\r\n'
        + '  <param name="play" value="true" />\r\n'
        + '  <param name="wmode" value="transparent" />\r\n'
	//	+ '  <param name="allowFullScreen" value="true" />\r\n'
	//	+ '  <param name="allowscriptaccess" value="always" />\r\n'
        + '  <param name="bgcolor" value="' + bgColor + '" />\r\n'
    //    + '  <param name="flashvars" value="' + flashVars + '" />\r\n'
        + '\r\n'
        + '  <embed swliveconnect="true" type="application/x-shockwave-flash"\r\n'
        + '    pluginspage="https://www.macromedia.com/go/getflashplayer"\r\n'
        + '    width="' + width + '" height="' + height + '" name="' + objectId + '"\r\n'
        + '    src="' + movie + '"\r\n'
//		+ '    swliveconnect="true"\r\n'
		+ '    play="true"\r\n'
        + '    quality="high"\r\n'
        + '    wmode="transparent"\r\n'
 //		+ '    allowFullScreen="true"\r\n'
 //		+ '    allowscriptaccess="always"\r\n'
 //       + '    scale="exactfit"\r\n'
        + '    bgcolor="' + bgColor + '"\r\n'
   //     + '    flashvars="' + flashVars + '"\r\n'
        + '    >\r\n'
        + '  <\/embed>\r\n'
        + '<\/object>';
    document.write(tag);
//	alert(tag);
	} else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
		if (altHref != '') document.write('<a href="' + altHref + '">');
		document.write('<img src="' + altImg +'" alt="' + altText + '" width="' + width + '" height="' + height + '" border="0">');
		if (altHref != '') document.write('</a>');
	}
}


