<!-- 
// This script determines correct code required to embed MEDIA files 
// for a large number of browsers, including AOL and WebTV
// Windows Media Player is required and always used, except for WebTV
// Written by Les Gorven, http://midistudio.com/ 
// Ver. 3.0  Last Updated: January 17, 2006


var Navegador=""
function playMedia(mediaURL,rpt,height,width,control) 
{
	var mediaURL,rpt,height,width

	if (GetBrowser() == "Netscape") {
		Navegador="NS";
		embedIEobject(mediaURL,rpt,height,width, control);
	}
	if (GetBrowser() == "IE") {
		Navegador="IE";
		embedIEobject(mediaURL,rpt,height,width, control);
	}
	if (navigator.appName.substring(0,5) == "WebTV") {
		Navegador="OT";
		embedSource(mediaURL,rpt,height,width, control)
	}
}

function embedSource(mediaURL,rpt,height,width,control) 
{
    var CodeGen = ""
    var mediaURL,rpt,height,width
 		 	
	 CodeGen = '<embed src="' + mediaURL + '"' + '\n' ;
	 CodeGen += ' height=' + height + ' width=' + width + ' autostart="true"' + '\n'
	 CodeGen += ' LOOP=' + rpt + '>'
	 
    document.write(CodeGen)
}

function embedMPlayer(mediaURL,rpt,height,width,control)	
{
/*	CodeGen = "" 
    var mediaURL,rpt,height,width

	CodeGen = '<object id="Player" name="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' ;
	CodeGen += '<param NAME="ShowStatusBar" VALUE= "false"> ';	
	CodeGen += '<param NAME="autoStart" VALUE="true"><param NAME="Volume" VALUE="-1">' + '\n' ;
	CodeGen += '<param NAME="playCount" VALUE=' + rpt + '>'		
	CodeGen += '<PARAM NAME="ShowControls" VALUE="' + control + '"></object>'		
     
	document.write(CodeGen)	
	
	if (GetBrowser() == "Netscape")
	{
		if(document.getElementById("Player").Filename==undefined)
		{
			document.getElementById("video").innerHTML="Debe instalar un plugin y reiniciar firefox. Si desea hacerlo <a href='javascript:installAxFF107();'>pulse aquí</a>"			
		}
	}
*/
}

function embedIEobject(mediaURL,rpt,height,width,control){	CodeGen = "" 
    var mediaURL,rpt,height,width

		// IE
	CodeGen = '<object id="Player" name="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' ;
	CodeGen += '<param NAME="ShowStatusBar" VALUE= "false"> ';	
	CodeGen += '<param NAME="autoStart" VALUE="true"><param NAME="Volume" VALUE="-1">' + '\n' ;
	CodeGen += '<param NAME="playCount" VALUE=' + rpt + '>'		
	CodeGen += '<PARAM NAME="ShowControls" VALUE="' + control + '">></object>'		
	
	document.write(CodeGen)
	
	if (GetBrowser() == "Netscape")
	{
		if(document.getElementById("Player").Filename==undefined)
		{
			document.getElementById("video").innerHTML="Debe instalar un plugin y reiniciar firefox. Si desea hacerlo <a href='javascript:installAxFF107();'>pulse aquí</a>"			
		}
	}	
}

function GetBrowser()
{
   var agt=navigator.userAgent.toLowerCase();
   if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
       return "IE";
   else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
         && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
         && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
       return "Netscape";
   else
       return "unknown";
}
//-->
function wmpPlay()
{
	document.getElementById("Player").play()
}
//-->
function wmpStop()
{
	document.getElementById("Player").stop();
}
//-->
function wmpFullScreen()
{
	if (document.getElementById("Player").playState == 2) {
		document.getElementById("Player").DisplaySize = 3
	}
}
//-->
function wmpPausa() 
{
	document.getElementById("Player").pause()
}
//--
function installAxFF107() 
{ 
		// Instala en firefox un plugin.
	xpi={'Mozilla Firefox 1.0.7 ActiveX Plug-in':'http://www.iol.ie/~locka/mozilla/mozactivex-ff-15.xpi'}; 
	InstallTrigger.install(xpi); 
} 

