/************************************************************************/
var agt=navigator.userAgent.toLowerCase();
var isIE  = (agt.indexOf("msie") != -1);
var isNetscape  = (navigator.appName.indexOf("Netscape") != -1);
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
var isWin = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var isMac = (agt.indexOf("mac")!=-1);
var flashinstalled = false;
var flashversion = 0;

DetectFlash();
/************************************************************************/

function DetectFlash()
{
 if (isIE && isWin)
 {
  document.write('<SCRIPT LANGUAGE="VBScript">\n');
  document.write('\n');
  document.write('on error resume next\n');
  document.write('\n');
  document.write('For i = 2 to 25\n');
  document.write('If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then\n');
  document.write('\n');
  document.write('Else\n');
  document.write('flashinstalled = true\n');
  document.write('flashversion = i\n');
  document.write('End If\n');
  document.write('Next\n');
  document.write('</SCRIPT>\n');
 }
 else
 {
  if (navigator.plugins && navigator.plugins.length)
  {
   if (navigator.plugins["Shockwave Flash"])
   {
    flashinstalled = true;
    if (navigator.plugins["Shockwave Flash"].description)
    {
     flashversion = navigator.plugins["Shockwave Flash"].description.charAt(navigator.plugins["Shockwave Flash"].description.indexOf('.')-1);
    }
   }
   else
   {
    if (navigator.plugins["Shockwave Flash 2.0"]) { flashinstalled = true; flashversion = 2; }
   }
  }
  else if (navigator.mimeTypes && navigator.mimeTypes.length)
  {
   if (navigator.mimeTypes['application/x-shockwave-flash'] && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) { flashinstalled = true }
  }
 }
}

function DisplayFlash(divname, flashurl, objwidth, objheight, noflashhtml)
{
 if (flashinstalled)
 {
  if (isIE && divname.length > 0)
  {
   var d = document.getElementById(divname);
   var myObj = document.createElement('object');
   d.appendChild(myObj);
   myObj.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
   myObj.width = objwidth;
   myObj.height = objheight;
   myObj.URL = flashurl;
   myObj.movie = flashurl;
   myObj.menu = "false";
   myObj.codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.#version=5,0,30,0";
  }
  else
  {
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.#version=5,0,30,0" width="'+objwidth+'" height="'+objheight+'">');
   document.write('<param name="src" value="'+flashurl+'">');
   document.write('<param name="movie" value="'+flashurl+'">');
   document.write('<param name="quality" value="best">');
   document.write('<param name="play" value="true">');
   document.write('<param name="menu" value="false">');
   document.write('<embed pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'+objwidth+'" height="'+objheight+'" src="'+flashurl+'" type="application/x-shockwave-flash" quality="best" play="true" menu="false">');
   document.write('</object>');
  }
 }
 else
 {
  if (noflashhtml.length > 0) { document.write(noflashhtml); }
 }
}

/* Execution
<div id="Flash1"></div>
<script language="javascript">DisplayFlash('Flash1','hdv-show.swf','<img border="0" src="noflash-1.jpg" width="360" height="325">',360,325);</script>
<noscript><img border="0" src="noflash-1.jpg" width="360" height="325"></noscript>
*/
