var flash = false;
function flashExists() {
  if (navigator.plugins && navigator.plugins.length) { 
    for(x=0; x<navigator.plugins.length; x++) { 
      if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) { 
        flash = navigator.plugins[x].description.split('Shockwave Flash ')[1]; 
        break; 
      } 
    } 
  } 
  else if (window.ActiveXObject) { 
    for (x=2; x<10; x++) { 
      try { 
        oFlash=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+x+"');"); 
        if (oFlash) { 
          flash = x+'.0'; 
        } 
      } 
      catch(e) {} 
    } 
  }   
  return flash;
}
function writeFlash(movie) {
  switch(movie) {
    case "teaser" :
      document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="267" height="245" vspace="3">\n');
      document.write('<param name="movie" value="/stat/metv/media/preview.swf" />\n');
      document.write('<param name="quality" value="high" />\n');
      document.write('<embed src="/stat/metv/media/preview.swf" width="267" height="245" vspace="3" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"/>\n');
      document.write('</object>\n');
    break;
    
    case "intro" :
      document.write('<a href="javascript:void(0);" onclick="pop();">Flash Introduction to ManagEnergy</a>');
    break;
  }
}

function writeNoFlash(movie) {
  switch(movie) {
    case "teaser" :
      document.write('<p id="noFlash">The managenergy site is best viewed with the Flash plugin. You can download it <a href="http://www.macromedia.com/shockwave/download/?P1_Prod_Version=ShockwaveFlash" target="_blank">here</a>.');
    break;
    
    case "intro" :
      document.write('Flash Introduction to ManagEnergy <em>(you need the flash plugin to view this introduction; get it <a href="http://www.macromedia.com/shockwave/download/?P1_Prod_Version=ShockwaveFlash" target="_blank">here</a>)</em>.');
    break;
  }
}
