var tabVideos = new Array();
tabVideos = [];
var indice = new Number();
var videoURL = new String();
var videoTitle = new String();

tabVideos[0] = new Object();
tabVideos[0]["id"]=100;
tabVideos[0]["nom"]="LE&nbsp;WEB3&nbsp;-&nbsp;11,12&nbsp;décembre&nbsp;2007";
tabVideos[0]["video9"]="mms://wm.narrowstream.net/ampilive3/";
tabVideos[1] = new Object();
tabVideos[1]["id"]=200;
tabVideos[1]["nom"]="LE&nbsp;WEB3&nbsp;-&nbsp;11,12&nbsp;décembre&nbsp;2007";
tabVideos[1]["video9"]="mms://wm.narrowstream.net/ampilive3/";
tabVideos[2] = new Object();
tabVideos[2]["id"]=300;
tabVideos[2]["nom"]="LE&nbsp;WEB3&nbsp;-&nbsp;11,12&nbsp;décembre&nbsp;2007";
tabVideos[2]["video9"]="mms://wm.narrowstream.net/ampilive3/";
tabVideos[3] = new Object();
tabVideos[3]["id"]=400;
tabVideos[3]["nom"]="LE&nbsp;WEB3&nbsp;-&nbsp;11,12&nbsp;décembre&nbsp;2007";
tabVideos[3]["video9"]="mms://wm.narrowstream.net/ampilive1/";
tabVideos[4] = new Object();
tabVideos[4]["id"]=500;
tabVideos[4]["nom"]="LE&nbsp;WEB3&nbsp;-&nbsp;11,12&nbsp;décembre&nbsp;2007";
tabVideos[4]["video9"]="mms://wm.narrowstream.net/sables/TVLS/OTLS2006_vfr_stream_02_250kb.wmv";

indice = getQueryStringByName("id");
videoTitle = rechercheByID(tabVideos,indice,"nom");
videoURL = rechercheByID(tabVideos,indice,"video9");
/********************************************************************************************************************/
function rechercheByID(aTab,sID, sProperty) 
{	
	var i = 0;
  		while (i < aTab.length)
		{
			if (aTab[i].id == sID) 
			{
				return aTab[i][sProperty];break;
			} 
			else 
			{
				i++;
			}		
		}	
		return "";
}
/********************************************************************************************************************/
function getNextVideo()
{
	try
	{
		var currentIndice = getQueryStringByName("id");
		currentIndice = parseInt(currentIndice);
		if(currentIndice == 600)
			currentIndice = 100;
		else
			currentIndice += 100;
		
		self.location.replace("videos1.htm?id="+currentIndice);
		//alert(currentIndice);
	}
	catch(e)
	{
		alert("Erreur n°2 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function getPreviousVideo()
{
	try
	{	
		var currentIndice = getQueryStringByName("id");
		currentIndice = parseInt(currentIndice);
		if(currentIndice == 100)
			currentIndice = 600;
		else
			currentIndice -= 100;
		self.location.replace("videos1.htm?id="+currentIndice);
	}
	catch(e)
	{
		alert("Erreur n°3 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function lecture() // uniquement valable pour IE
{
	try
	{
  		if(window.VideoPlayerObj)
			window.VideoPlayerObj.Play();
	}
	catch(e)
	{
 		alert("Erreur n°4 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
 	}
}
/********************************************************************************************************************/
function pause() // uniquement valable pour IE
{
	try
	{
  		if(window.VideoPlayerObj)
			window.VideoPlayerObj.Pause();
	}
	catch(e)
	{
 		alert("Erreur n°5 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function stop() // uniquement valable pour IE
{
	try
	{
  		if(window.VideoPlayerObj)
			window.VideoPlayerObj.Stop();
	}
	catch(e)
	{
	 	alert("Erreur n°6 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function fullScreen() // uniquement valable pour IE
{
	try
	{
		if(window.VideoPlayerObj)
			window.VideoPlayerObj.DisplaySize = 3;
	}
	catch(e)
	{
		alert("Erreur n°7 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function incrVolume()
{
	try
	{
		if(window.VideoPlayerObj)
		{
			if(window.VideoPlayerObj.Volume <= -100)
				window.VideoPlayerObj.Volume += 100;
			else
				window.VideoPlayerObj.Volume = 0;
		}	
		else if(window.VideoPlayerEmb)
		{
			if(window.VideoPlayerEmb.Volume <= -100)
				window.VideoPlayerEmb.Volume += 100;
			else
				window.VideoPlayerEmb.Volume = 0;
		}
	}
	catch(e)
	{
		alert("Erreur n°8 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function decrVolume()
{
	try
	{
		if(window.VideoPlayerObj)
		{
			if(window.VideoPlayerObj.Volume >= -9900)
				window.VideoPlayerObj.Volume -= 100;
			else
				window.VideoPlayerObj.Volume = -10000;
		}
		else if(window.VideoPlayerEmb)
		{
			if(window.VideoPlayerEmb.Volume >= -9900)
				window.VideoPlayerEmb.Volume -= 100;
			else
				window.VideoPlayerEmb.Volume = -10000;
		}

	}
	catch(e)
	{
		alert("Erreur n°9 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/
function recharger()
{
	try
	{
		self.location.reload();
	}
	catch(e)
	{
		alert("Erreur n°10 à l'exécution du fichier :\n"+e.fileName+"\n\nLigne : "+e.lineNumber+"\n\nType d'erreur : "+e.name+"\n\nMessage d'erreur : "+e.message);
	}
}
/********************************************************************************************************************/	
function openPlayer(URL)
{
	document.writeln("<object name='ObjectVideoPlayer'");
	document.writeln(" id='VideoPlayerObj' ");
	document.writeln("class = 'object_player'");
	document.writeln("classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'");
	document.writeln("codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'");
	document.writeln("STANDBY='Patientez pendant le chargement de la vidéo...'");
	document.writeln(">");
	document.writeln("<PARAM NAME='FileName' VALUE='"+ URL +"'>");
	document.writeln("<PARAM NAME='ShowControls' VALUE='false'>");
	document.writeln("<PARAM NAME='AutoStart' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='AnimationAtStart' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='TransparentAtStart' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='ShowStatusbar' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='enableContextMenu' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='invokeURLs' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='AllowChangeDisplaySize' VALUE='TRUE'>");
	document.writeln("<PARAM NAME='AutoSize' VALUE='FALSE'>");
	document.writeln("<PARAM NAME='stretchToFit' VALUE='false'>");
	document.writeln("<PARAM NAME='EnableFullScreenControls' VALUE='true'>");
	document.writeln("<PARAM NAME='Volume' VALUE='-500'>");
	document.writeln("<PARAM NAME='PlayCount' VALUE='1000'>");
	document.writeln("<PARAM NAME='DisplaySize' VALUE='4'>");
		
	document.writeln("<embed src='"+ URL +"' ");
	document.writeln("name='EmbedVideoPlayer' id='VideoPlayerEmb'");
	document.writeln("type='application/x-mplayer2'");
	//document.writeln("class = 'embed_player' ");
	document.writeln("pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/'");
	document.writeln("width=360");
	document.writeln("height=352");
	document.writeln("autostart=1 ");
	document.writeln("showcontrols=0");
	document.writeln("PlayCount = 1000");
	document.writeln("AllowChangeDisplaySize=1");
	document.writeln("AutoSize=1");
	document.writeln("DisplaySize=4");
	document.writeln("enableContextMenu=1");
	document.writeln("windowless=0");
	document.writeln("ShowStatusBar=1");
	document.writeln("invokeURLs=1");
	document.writeln("stretchToFit=0");
	document.writeln("volume=-500");
	document.writeln(">");
	document.writeln("</object>");
}