function getReal() 
{
	var result = 0 
	// On renvoie 0 si non detecté, 1 pour RealPlayer et 2 pour RealOne
	// If IE4 Mac, plugins can't be detected
	plgIe4Mac = false
	if (navigator.appVersion.indexOf("PPC")!=-1 && navigator.userAgent.indexOf("MSIE 4")!=-1) {plgIe4Mac = true}
	if(plgIe4Mac) {result = 0}
	// On teste les plug presents sous netscape
	plugInFound = getPlugIn("RealOne","RealOne","RealOne")
	if (plugInFound)
	{
		result = 2
	}
	else{
		plugInFound = getPlugIn("RealPlayer","G2","Plug-In")
		if (plugInFound)
		{result = 1}
	}
	if (result == 0)
	{	
		// Puis sous IE
		testObject = new ActiveXObject("rmocx.RealPlayer G2 Control.1")
		// Since G2 (Real 6), all Real player version numbers begin by 6
		embedVersion = testObject.GetVersionInfo()
		//document.writeln("Player Version Number : " + embedVersion + "<br/>")		
		// First version supported : 6.0.6.131 = G2 Gold
		versionArray = embedVersion.split(".")
		conditionA = versionArray[0]>=6
		conditionB = versionArray[1]>=0
		conditionC = versionArray[2]>=6
		conditionD = versionArray[3]>=131
		conditionE = versionArray[2]>=11   // RealOnePlayer
	
		if (conditionA && conditionB && conditionE)
		{
			//document.writeln("RealOne Player Detected !<br/>")
			result = 2
		}
		else if (conditionA && conditionB && conditionC && conditionD) 
		{
			//document.writeln("Real Player Detected !<br/>")
			//activeXFound = true
			result = 1
		} 	
	}
	return (result);
}

// Parse plugins collection with strings to find
// User has to pass strings to be found in plugin name and description
// Ex. "Shockwave","Flash","5"
function getPlugIn() {

	//document.writeln("<br/>-- getPlugIn() --<br/>")
	// search for the right plugin among all those have been installed
	allFound = false
	plugInsCollection = navigator.plugins
	//document.writeln("plugInsCollection (" + plugInsCollection.length + " element(s))<br/><br/>")
	for (i=0;i<plugInsCollection.length;i++) {// Get plugin description
	        plugInDescription = " " + plugInsCollection[i].description
		plugInName = " " + plugInsCollection[i].name
		//document.writeln(i+1 + " plugInName : " + plugInsCollection[i].name + " | plugInDescription : " + plugInDescription + "<br/>")
		for (j=0;j<arguments.length;j++) {		
			if (plugInDescription.indexOf(" " + arguments[j])!=-1 || plugInName.indexOf(" " + arguments[j])!=-1) {
				//document.writeln(arguments[j] + " found !<br/>")
				allFound = true
			} else {
				allFound = false
				break
			}
		}
		// Send back the search result
		if (allFound) {return true}
    }

	// Send back the search result
	return false
}
function ow2(journal,stream) { 
	if (arguments[1]==null )
	{
	theURL="http://www.tv-radio.com/station/rfi/ondemand/player.php?journal="+journal;

	}else
	{
	theURL="http://www.tv-radio.com/station/rfi/ondemand/player.php?journal=en_direct"+stream;

	}
 	window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');
}

function ow3(journal,format) { 
	theURL="http://www.tv-radio.com/station/rfi/ondemand/player_v2.php?journal="+journal + "&format="+format;

	
	
	
 	window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');

}
function ow7(journal,format) { 
	theURL="http://www.tv-radio.com/station/rfi_afrique/ondemand/player_v2.php?journal="+journal + "&format="+format;

	
	
	
 	window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');

}

function ow4(journal,format) { 
theURL="http://www.tv-radio.com/station/rfi/ondemand/player_v3.php?journal="+journal + "&format="+format;
window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');
}
function ow5(journal,format) { 

//alert (format)
if (format=='RM'){
	test = getReal();	
	if (test == 1)
	{
		//alert ("RealG2")
	}
	else if (test == 2)
	{
		format='RO'
		//alert ("RealOne")
	}
}
//theURL="http://www.tv-radio.com/station/rfi/ondemand/player_v5.php?journal="+journal + "&format="+format;
theURL="http://www.tv-radio.com/station/rfi/ondemand/player_v5.php?journal="+journal + "&format="+format + "&Navigator=" + navigator.appName;
window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');
}

function ow6(journal,format,hour) { 

//alert (format)
if (format=='RM'){
	test = getReal();	
	if (test == 1)
	{
		//alert ("RealG2")
	}
	else if (test == 2)
	{
		format='RO'
		//alert ("RealOne")
	}
}
theURL="http://www.tv-radio.com/station/rfi/ondemand/player_v5.php?journal="+journal + "&format="+format + "&Navigator=" + navigator.appName + "&hour=" + hour;
window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');
}
function ownew(journal,format) { 
theURL="http://www.tv-radio.com/station/rfi/ondemand/player_v4.php?journal="+journal + "&format="+format;
window.open(theURL,'TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=256,height=204');
}