function writeMediaCode(extension, source, width, height, id, display) {
  if (extension == "mpeg" || extension == "avi") extension = "mpg";
  //if (extension == "swf") extension = "flv";
  if(extension != "flv") height = parseInt(height) + 15;
  switch(extension) {
    case "flv":
      document.writeln('<object id="'+id+'" type="application/x-shockwave-flash" data="'+source+'" width="'+width+'" height="'+height+'">');
      document.writeln('<param name="movie" value="'+source+'" \/>');
      document.writeln('<param name="wmode" value="transparent" \/>');
      document.writeln('Für die Darstellung des Inhalts ist der Flash Player von Adobe erforderlich, den Sie unter folgender Adresse kostenlos herunterladen können:<br /> <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German" target="_blank">&raquo; Adobe Flash Player Download-Center</a><br \/><br \/>');
      document.writeln('<\/object>');
	  break;
	case "swf":
      document.writeln('<object id="'+id+'" type="application/x-shockwave-flash" data="'+source+'" width="'+width+'" height="'+height+'">');
      document.writeln('<param name="movie" value="'+source+'" \/>');
      document.writeln('<param name="wmode" value="transparent" \/>');
      document.writeln('Für die Darstellung des Inhalts ist der Flash Player von Adobe erforderlich, den Sie unter folgender Adresse kostenlos herunterladen können:<br /> <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German" target="_blank">&raquo; Adobe Flash Player Download-Center</a><br \/><br \/>');
      document.writeln('<\/object>');
	  break;
    case "wmv":
      height = parseInt(height) + 44;
      document.writeln('<object id="'+id+'" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" standby="Der Microsoft Windows Media Player wird geladen..." width="'+width+'" height="'+height+'">');      
        document.writeln('<param name="fileName" value="'+source+'" />');
        document.writeln('<param name="autostart" value="1" />');
        document.writeln('<param name="AnimationatStart" value="0" />');
        document.writeln('<param name="TransparentatStart" value="0" />');
        document.writeln('<param name="ShowControls" value="1" />');
        document.writeln('<param name="ShowPositionControls" value="0" />');
        document.writeln('<param name="ShowStatusBar" value="0" />');
        document.writeln('<embed id="'+id+'2" type="application/x-mplayer2" showcontrols="1" showpositioncontrols="0" animationatstart="0" transparentatstart="0" showstatusbar="0" src="'+source+'" width="'+width+'" height="'+height+'"></embed>');
      document.writeln('<\/object>');
      break;
    case "mpg":
      document.writeln('<object id="'+id+'" type="video/mpeg" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" style="display:'+display+'">');      
        document.writeln('<param name="type" value="video/mpeg" />');
        document.writeln('<param name="src" value="'+source+'" />');
        document.writeln('<param name="controls" value="ImageWindow" />');
        document.writeln('<param name="autostart" value="true" />');
        document.writeln('Für die Darstellung des Videos ist der Quicktime-Player von Apple erforderlich, den Sie unter folgender Adresse herunterladen können:<br /> <a href="http://www.apple.com/de/quicktime/download/" target="_blank">&raquo; http://www.apple.com/de/quicktime/download/</a>');
      document.writeln('<\/object>');
      break;
    case "mov":
      document.writeln('<object id="'+id+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" style="display:'+display+'">');
        document.writeln('<param name="controller" value="true" />');
        document.writeln('<param name="kioskmode" value="true" />');
        document.writeln('<param name="wmode" value="transparent" \/>');
        document.writeln('<param name="src" value="'+source+'" />');
        document.writeln('<param name="autostart" value="true" />');
        document.writeln('<object type="video/quicktime" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" class="mov">');
          document.writeln('<param name="controller" value="true" />'); 
          document.writeln('<param name="kioskmode" value="true" />');
          document.writeln('<param name="src" value="'+source+'" />');
          document.writeln('<param name="autostart" value="true" />');
          document.writeln('Für die Darstellung des Videos ist der Quicktime-Player von Apple erforderlich, den Sie unter folgender Adresse herunterladen können:<br /> <a href="http://www.apple.com/de/quicktime/download/" target="_blank">&raquo; http://www.apple.com/de/quicktime/download/</a>');
        document.writeln('</object>'); 
      document.writeln('</object>');
      break;
    case "rm":
      document.writeln('<object id="'+id+'" type="audio/x-pn-realaudio-plugin" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" style="display:'+display+'">');      
        document.writeln('<param name="type" value="audio/x-pn-realaudio-plugin" />');
        document.writeln('<param name="src" value="'+source+'" />');
        document.writeln('<param name="controls" value="ImageWindow" />');
        document.writeln('<param name="autostart" value="true" />');
        document.writeln('Für die Darstellung des Videos ist der RealPlayer erforderlich, den Sie unter folgender Adresse herunterladen können:<br /> <a href="http://de.real.com/player/" target="_blank">&raquo; http://de.real.com/player/</a>');
      document.writeln('<\/object>');
      break;
    case "mp3":
      var real_source = source.replace(/\/_components\/GEO\/article\/audio_player\/geo_audioplayer\.swf\?audio_file=/i,"");
      real_source = real_source.replace(/\&rubrik.*$/i,"");
      document.writeln('<object id="'+id+'" type="application/x-shockwave-flash" data="'+source+'" width="'+width+'" height="'+height+'">');
        document.writeln('<param name="movie" value="'+source+'" \/>');
        document.writeln('Zum Abspielen der Audio-Datei ist der Flash Player von Macromedia erforderlich, den Sie unter folgender Adresse herunterladen können: <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German" target="_blank">&raquo; Macromedia Flash Player Download-Center</a><br \/><br \/>');
        document.writeln('Alternativ können Sie auch folgende Datei aufrufen:<br /> <a href="'+real_source+'">&raquo; Audio starten</a>');
      document.writeln('<\/object>');
      break;
  }
}

function switchMedia(p, id) {
  // the number of media objects allowed for each paragraph
  nof_media = 10;
  // loop over media objects -> control display property
  for(var i = 0; i <= nof_media; i++) {
    if(document.getElementById("mediaObj"+p+i)) {
      if(i != id)
        document.getElementById("mediaObj"+p+i).style.display = "none";
      if(i == id)
        document.getElementById("mediaObj"+p+i).style.display = "block";
    }
  }
}

function checkCompatibility(alertID) {
  hideContainer = alertID;
  if(safari && !swf9) {    
    document.writeln('<div id="errorbox">');
    document.writeln('<strong>Hinweis:</strong> F&uuml;r eine optimale Darstellung des Videos ist der Adobe Flash Player ab Version 9 erforderlich, den Sie unter folgender Adresse kostenlos herunterladen k&ouml;nnen:<br />');
    document.writeln('<a href="http://www.adobe.com/de/products/flashplayer/" target="_blank">&#187; http://www.adobe.com/de/products/flashplayer/</a><br />');
    document.writeln('<a href="javascript:document.getElementById(\'errorbox\').style.display=\'none\'" style="font-size:82%; color:#666; display:block; float: right">Hinweis schlie&szlig;en [x]</a><br class="clearFloat" />');
    document.writeln('</div>');
	
  }
  if(swf9){
	document.getElementById(hideContainer).style.display = "none";
  }
  
}
