// Scripts de gestion de l'affichage des pages dans les iframes et de l'affichage des vidéos a un TC donné :-] 



function size()
{
	window.resizeTo(730, 450)
	
}

function size2()
{
	window.resizeTo(620, 400)
	
}

function calcul_hours(tc)
{
  // on récupère le temps courant en secondes de la vidéo
	totalSec = tc;
	
	// on compte le nombre heures
	nbHeures = Math.floor(totalSec / 3600);
	if (nbHeures < 10) {nbHeures = "0" + nbHeures; }; 
	resteMin = totalSec % 3600;
	
	// on compte le nombre de minutes
	nbMinutes = Math.floor(resteMin / 60);
	if (nbMinutes < 10) { nbMinutes = "0" + nbMinutes; };
	resteSec = resteMin % 60;
	
	// On en déduit le nombre de secondes
	nbSecondes = resteSec;
	if (nbSecondes < 10) { nbSecondes = "0" + nbSecondes; };
	
	// On construit si nécessaire la chaine des millisecondes
	if (nbHeures != 0) { nbMillisecondes = ".00"; }
	else { nbMillisecondes = ""; }
	
	// On contruit la chaîne d'affichage
	tc_affichage = nbHeures + ":" + nbMinutes + ":" + nbSecondes;
        
  return tc_affichage;
}

function seekTo(id, pos)
{
	try
	{
    document.ecran.SetPosition(pos*1000);
	}
	catch(ex)
	{
		var div_video = document.getElementById(divVideo);
		var html="<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='"+videoHeight+"' width='"+videoWidth+"' id='ecran'>"+
						"<param name='CONTROLS' value='ImageWindow'>"+
						"<param name='AUTOSTART' value='true'>"+
						"<param name='SRC' value='"+media+"?start="+calcul_hours(pos)+"'>"+
						"<param name='console' value='one'>"+
						"<embed name='ecran' height='"+videoHeight+"' width='"+videoWidth+"' controls='ImageWindow' src='"+media+"?start="+calcul_hours(pos)+"' type='audio/x-pn-realaudio-plugin' autostart=true CONSOLE=one>"+
						"</embed>"+
  				"</object>"
  	div_video.innerHTML=html;
  }
}

<!--
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.
function rate_DoFSCommand(command, args) {
	var rateObj = isInternetExplorer ? document.all.rate : document.rate;
	if(command=='flux')
	{
		if(args=='WMHD')
		{
			location.href='http://partenaire.endirectv.com/window.php?FEN_ID=165';		}
		if(args=='WMBD')
		{
			location.href='http://partenaire.endirectv.com/window.php?FEN_ID=166';		}
		
	}
	//alert(args);
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub rate_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call rate_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}


// Handle all the FSCommand messages in a Flash movie.
function full_DoFSCommand(command, args) {
	var fullObj = isInternetExplorer ? document.all.full : document.full;
	var player = document.getElementById('player');
	if (player && player.playState == 3)
	{
		player.fullScreen = 'true';
	}

}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub full_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call full_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

// Handle all the FSCommand messages in a Flash movie.
function volume_DoFSCommand(command, args) {
	var volumeObj = isInternetExplorer ? document.all.volume : document.volume;
	var player = document.getElementById('player');
	if (player && player.playState == 3)
	{
		if(command=="volume")
		{
			player.settings.volume = parseInt(args);
		}
	}

}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub volume_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call volume_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
//ancien emagineurs /////////////////////////////////////////////


// Description : Fonction qui permet d'afficher la page HTML 'nomRapport' dans l'iframe nommée rapport
// Nom de la fonction : afficheRapport
// Paramètre 1 : char nomRapport
// Retour : null

function afficheRapport(nomRapport){
	top.rapport.location.href = "./rapports/" + nomRapport; 
}


// Description : Fonction qui permet de mettre la vidéo en pause au démarrage
// Nom de la fonction : pauseAuDepart
// Paramètre 1 : aucun
// Retour : null

function pauseAuDepart(){
	top.document.ecran.DoPause();
}


// Description : Fonction qui permet de jouer la vidéo 
// Nom de la fonction : btplay
// Paramètre 1 : aucun
// Retour : null

function btplay(){
	document.ecran.DoPlayPause();
}


// Description : Fonction qui permet de stopper la vidéo 
// Nom de la fonction : btplay
// Paramètre 1 : aucun
// Retour : null

function btstop(){
	if(document.ecran.CanStop())
		document.ecran.DoStop();
}


// Description : Fonction qui permet de mettre en pause la vidéo 
// Nom de la fonction : btplay
// Paramètre 1 : aucun
// Retour : null

function btpause(){
if(document.ecran.CanPause())
		document.ecran.DoPause();
}

// Description : Fonction qui permet d'eviter le problème de CACHE de REAL ONE sur IE
// Nom de la fonction : rafraichit
// Paramètre 1 : aucun
// Retour : null

function rafraichit(){
	var largeur = 750;
	var hauteur = 431;

	var top = (screen.height-hauteur)/2;
	var left = (screen.width-largeur)/2;

	window.open("http://www.e-magineurs.com/rhone/","","top="  + top + ",left=" + left + ",width= " + largeur + ",height=" + hauteur);
	self.close();
}

function afficheVideo(nomVideo,tc){
	
	// A modifier pour l'archivage...
	//baseVideo = "rtsp://real.jetmultimedia.fr/~emagineurs/cg69/";
	baseVideo = "rtsp://cast.erasme.org/rhone/";
	
	cheminVideo = "./videos/" + nomVideo;
	// tcVideo = tc * 1000;
	
	// on récupère le temps courant en secondes de la vidéo
	totalSec = tc;
	
	// on compte le nombre heures
	nbHeures = Math.floor(totalSec / 3600);
	if (nbHeures < 10) {nbHeures = "0" + nbHeures; }; 
	resteMin = totalSec % 3600;
	
	// on compte le nombre de minutes
	nbMinutes = Math.floor(resteMin / 60);
	if (nbMinutes < 10) { nbMinutes = "0" + nbMinutes; };
	resteSec = resteMin % 60;
	
	// On en déduit le nombre de secondes
	nbSecondes = resteSec;
	if (nbSecondes < 10) { nbSecondes = "0" + nbSecondes; };
	
	// On construit si nécessaire la chaine des millisecondes
	if (nbHeures != 0) { nbMillisecondes = ".00"; }
	else { nbMillisecondes = ""; }
	
	// On contruit la chaîne d'affichage
	tc_affichage = nbHeures + ":" + nbMinutes + ":" + nbSecondes;


	// on passe à l'objet l'url de la vidéo et la chaine d'affichage
	cheminVideo = baseVideo + nomVideo + ".rm?start=" + tc_affichage;
	top.document.ecran.SetSource(cheminVideo);
	top.document.ecran.DoPlay();
	// Syntaxe qui ne passe que sous IE
	//top.document.ecran.Source = cheminVideo;

}