function playMedia(mediaURL, avtoPlay, rpt, height, width) {

	if (GetBrowser() == "Netscape") embedMPlayer(mediaURL,avtoPlay, rpt, height, width); 
	if (GetBrowser() == "IE") embedIEobject(mediaURL,avtoPlay, rpt, height, width);
}

function embedMPlayer(mediaURL, avtoPlay, rpt, height, width)	{
		var CodeGen = '';
				 	
		CodeGen = '<embed type="application/x-mplayer2" ' + '\n' ;
    	CodeGen += ' pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" ' + '\n' ;
	 	CodeGen += 'Name="MediaPlayer" ' + 'src="' + mediaURL + '" ' + '\n' ;
	 	if (avtoPlay == true) CodeGen += 'autoStart=1 ';
	 	else CodeGen += 'autoStart=0 ';
	 	
		if ((height == 24) && (width == 299)) CodeGen += 'ShowStatusBar=1 '; 
		if ((height >= 50) && (width >= 200)) CodeGen += 'ShowStatusBar=1 '; 
		if ((height <= 49) && (width != 299))CodeGen += 'ShowStatusBar=0 '; 
		
		CodeGen += 'playCount=' + rpt + ' ' ;
		CodeGen += 'volume=-1 ' ;
		CodeGen += 'HEIGHT=' + height + ' WIDTH=' + width + '>';
		 
		document.write(CodeGen);
}

function embedIEobject(mediaURL, avtoPlay, rpt, height, width){
		var CodeGen = '';

		CodeGen = '<object id=Player' + '\n' ;
		CodeGen += 'codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' + '\n' ;
		CodeGen += 'type=application/x-oleobject height=' + height + ' width=' + width + '\n' ;
		CodeGen += ' standby="Loading Microsoft Windows Media Player components..." ' + '\n' ;
		CodeGen += 'classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> ' + '\n' ;
		CodeGen += '<param NAME="Filename" VALUE="' + mediaURL + '">' + '\n' ;
		
		if ((height == 24) && (width == 299)) CodeGen += '<param NAME="ShowStatusBar" VALUE= "true">';
		if ((height >= 50) && (width >= 200)) CodeGen += '<param NAME="ShowStatusBar" VALUE= "true">'; 
		if ((height <= 49) && (width != 299)) CodeGen += '<param NAME="ShowStatusBar" VALUE= "false"> ';
		
		if (avtoPlay == true) CodeGen += '<param NAME="autoStart" VALUE="true">';
		else CodeGen += '<param NAME="autoStart" VALUE="false">';
		
		CodeGen += '<param NAME="Volume" VALUE="-1">' + '\n' ;
		CodeGen += '<param NAME="playCount" VALUE=' + rpt + '></object>';
		
		document.write(CodeGen);
}

function GetBrowser() {
   var agt=navigator.userAgent.toLowerCase();
   
   if (((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)))  return "IE";
   else if ((agt.indexOf('mozilla')!=-1)) return "Netscape";
   else return "unknown";
}

