var supportActiveX = (browserName() == 1 && browserVersion() >= 4.0) ? true : false;

function browserName() {
  if (navigator.appName == 'Microsoft Internet Explorer') {
    return 1;
  }
  if (navigator.appName == 'Netscape') {
    return 2;
  }
  return 0;
}

function browserVersion() {
	return parseFloat(navigator.appVersion)
}

function setBeitrag(url) {
        if (supportActiveX) {
                document.MediaPlayer.fileName     = url;
		document.MediaPlayer.showControls = false;
        } else {
                //document.MediaPlayer.src = url;
        }
}

function doPlay() {
        if (document.play.src.indexOf('play_deactive.gif') > 0) {
                return true;
        }
        if (supportActiveX) {
                document.MediaPlayer.Play();
        } else {
                document.MediaPlayer.controls.play();
        }
        //document.stop.src='http://www.erba.de/wmplayer/stop_active.gif';
        //document.pause.src='http://www.erba.de/wmplayer/pause_active.gif';
        //document.play.src='http://www.erba.de/wmplayer/play_deactive.gif';
        document.stop.src='images/button_stop.gif';                     
        document.pause.src='images/button_pause.gif';                     
        document.play.src='images/button_play.gif';     
}

function doPause() {
        if (document.pause.src.indexOf('pause_deactive.gif') > 0) {
                return true;
        }
        if (supportActiveX) {
                document.MediaPlayer.Pause();
        } else {
                document.MediaPlayer.controls.pause();
        }
        //document.play.src='http://www.erba.de/wmplayer/play_active.gif';
        //document.pause.src='http://www.erba.de/wmplayer/pause_deactive.gif';
        //document.stop.src='http://www.erba.de/wmplayer/stop_deactive.gif';
        document.stop.src='images/button_stop.gif';                     
        document.pause.src='images/button_pause.gif';                     
        document.play.src='images/button_play.gif';     
}

function doStop() {
        if (document.stop.src.indexOf('stop_deactive.gif') > 0) {
                return true;
        }
        if (supportActiveX) {
                document.MediaPlayer.Stop();
        } else {
                document.MediaPlayer.Stop();
        }
        //document.stop.src='http://www.erba.de/wmplayer/stop_deactive.gif';
        //document.pause.src='http://www.erba.de/wmplayer/pause_deactive.gif';
        //document.play.src='http://www.erba.de/wmplayer/play_active.gif';
        document.stop.src='images/button_stop.gif';                     
        document.pause.src='images/button_pause.gif';                     
        document.play.src='images/button_play.gif';     
}

function audioPlayer(imageUrl, mediaUrl) {
	mediaPlayer(imageUrl, mediaUrl, false);
}

function videoPlayer(mediaUrl) {
	mediaPlayer("", mediaUrl, true, 176, 144);
}

function videoPlayer0050(mediaUrl) {
	videoPlayer(mediaUrl);
}
function videoPlayer0500(mediaUrl) {
	mediaPlayer("", mediaUrl, true, 360, 288);
}

function mediaPlayer(imageUrl, mediaUrl, video, width, height) {
	//document.write("<table width='133' border='0' cellspacing='0' cellpadding='0'>");
        //document.write("<tr>");
        //document.write("<td align='right' valign='bottom' height='2' width='13'><img src='http://www.erba.de/wmplayer/Rahmen1.jpg' width='14' height='14'/></td>");
        //document.write("<td align='left' valign='bottom' height='2' width='105'><img src='http://www.erba.de/wmplayer/Rahmen2.jpg' width='176' height='14'/></td>");
        //document.write("<td height='2' width='82' align='left' valign='bottom'><img src='http://www.erba.de/wmplayer/Rahmen3.jpg' width='14' height='14'/></td>");
        //document.write("</tr>");
        //document.write("<tr>");
        //document.write("<td width='13' align='right' height='130'><img src='http://www.erba.de/wmplayer/Rahmen8.jpg' width='14' height='144'/></td>");
	//document.write("<td height='130' width='105' valign='top'>");
	if (video) {
		document.write("<div align='center'><OBJECT ID='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='" + width + "' height='" + height + "' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'><PARAM NAME='FileName' VALUE='" + mediaUrl + "'><PARAM NAME='ShowControls' VALUE='False'><PARAM NAME='AutoStart' Value='true'><PARAM NAME='ShowStatusBar' Value='False'><Embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' filename='" + mediaUrl + "' src='" + mediaUrl + "' Name='MediaPlayer' width='" + width + "' height='" + height + "' transparentAtStart='1' autostart='1' animationAtStart='0' ShowControls='0' ShowAudioControls='0' ShowPositionControls='0' autoSize='0' ShowStatusBar='0' displaySize='false'></embed></OBJECT></div>");
		//document.write("<OBJECT ID='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='" + width + "' height='" + height + "' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'><PARAM NAME='FileName' VALUE='http://'><PARAM NAME='ShowControls' VALUE='False'><PARAM NAME='ShowStatusBar' Value='False'></OBJECT>");
	} else {
	        document.write("<img src='" + imageUrl + "'>");
	}
        //document.write("</td><td width='82' align='left' height='130'><img src='http://www.erba.de/wmplayer/Rahmen4.jpg' width='14' height='144'/></td>");
        //document.write("</tr>");
      	//document.write("<tr>");
        //document.write("<td width='13' valign='top' align='right'><img src='http://www.erba.de/wmplayer/Rahmen7.jpg' width='14' height='13'/></td>");
        //document.write("<td width='105' valign='top'><img src='http://www.erba.de/wmplayer/Rahmen6.jpg' width='176' height='13'/></td>");
        //document.write("<td width='82' align='left' valign='top'><img src='http://www.erba.de/wmplayer/Rahmen5.jpg' width='14' height='13'/></td>");
        //document.write("</tr>");
        //document.write("<tr align='left'>");
        //document.write("<td colspan='3' valign='top' align='center'>");
        //document.write("<img src='images/blind.gif' width='10' height='3'/><BR/>");
	document.write("<br>");
	if (supportActiveX) {
		document.write("<div align='center'>");
		document.write("<a href='#' onclick='doStop();'><img name='stop' src='images/button_stop.gif' width='25' height='21' border='0'></a>");
		document.write("<a href='#' onclick='doPause();'><img name='pause' src='images/button_pause.gif' width='25' height='21' border='0'></a>");
		document.write("<a href='#' onclick='doPlay();'><img name='play' src='images/button_play.gif' width='25' height='21' border='0'></a>");
		document.write("</div>");
	} else {
	}
	if (!video) {
		document.write("<OBJECT ID='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='0' height='0' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'><PARAM NAME='FileName' VALUE='" + mediaUrl + "'><PARAM NAME='ShowControls' VALUE='0'><PARAM NAME='ShowDisplay' VALUE='0'><PARAM NAME='AutoSize' VALUE='0'><PARAM NAME='TransparentAtStart' Value='true'><PARAM NAME='AutoStart' Value='true'><PARAM NAME='AnimationatStart' Value='false'><PARAM NAME='ShowStatusBar' Value='false'><PARAM NAME='displaySize' Value='false'><PARAM NAME='ShowAudioControls' Value='false'><PARAM NAME='ShowPositionControls' Value='false'><Embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' filename='" + mediaUrl + "' src='" + mediaUrl + "' Name='MediaPlayer' width='80' height='26' transparentAtStart='1' autostart='1' animationAtStart='0' ShowControls='1' ShowAudioControls='0' ShowPositionControls='0' autoSize='0' ShowStatusBar='0' displaySize='false'></embed></OBJECT>");
	} else if (video && !supportActiveX) {
		//document.write("<OBJECT ID='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='0' height='0' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'><PARAM NAME='FileName' VALUE='http://'><PARAM NAME='ShowControls' VALUE='0'><PARAM NAME='ShowDisplay' VALUE='0'><PARAM NAME='AutoSize' VALUE='0'><PARAM NAME='TransparentAtStart' Value='true'><PARAM NAME='AutoStart' Value='true'><PARAM NAME='AnimationatStart' Value='false'><PARAM NAME='ShowStatusBar' Value='false'><PARAM NAME='displaySize' Value='false'><PARAM NAME='ShowAudioControls' Value='false'><PARAM NAME='ShowPositionControls' Value='false'><Embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' filename='" + mediaUrl + "' src='" + mediaUrl + "' Name='MediaPlayer' width='80' height='26' transparentAtStart='1' autostart='1' animationAtStart='0' ShowControls='1' ShowAudioControls='0' ShowPositionControls='0' autoSize='0' ShowStatusBar='0' displaySize='false'></embed></OBJECT>");
	}
        //document.write("</td></tr></table>");
	/*if (navigator.appName == "Netscape") {
        	navigator.plugins.refresh();
        	document.write("\x3C" + "applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class archive=npds.zip")
        	document.writeln(" width=0 height=0 name=appObs\x3E \x3C/applet\x3E")
     	}*/
	setBeitrag(mediaUrl);
}

function loader(){
   /*if ( navigator.appName == "Netscape" ) {
      var plugIn = document.MediaPlayer;
      document.appObs.setByProxyDSScriptCommandObserver(plugIn,true);   
   }*/
}
