	/*
	Summary		: Script that generates a movieplayer with a controller
	Started 	: 19/12/2007
	Version 	: 
*/
	var OW_OraoWeb_version				= '2.0';
	var OW_OraoWeb_version_release_date	= '14/04/08';
	var OW_OraoWeb_host					= 'http://www.opsomai.eu/data/oraoweb';
	// var OW_OraoWeb_host					= 'http://oraoweb.vrarchitect.net';
/*
	Owner		: Opsomai (http://www.opsomai.com)
	Author		: Pascal Vuylsteker <pascal.vuylsteker@opsomai.com>
    -------------------------------------------------------------------------
	OW_OraoWeb_Player
	
	Description:
	
	Shows a movie player based on Quicktime an Javascript with its controls. 
	
	Usage:
	
	var player = new OW_OraoWeb_Player(container, options)
	
	container	: an 'Prototypejs' object that target a div in which the player will be written	
	options		: a hash with the following parameters, format: { option1: value1, option2: value2, ... }
	
	  Main one  :
		url			: the URL of the movie, must start with http:// or be an URL relative to the calling page
		width		: width of the movie
		height		: height of the movie
		
	For a detailled list of the options, see :
	Development version : pseudoEval(OW_OraoWeb_host)/dev/ow_help.html
	Stable version 		: pseudoEval(OW_OraoWeb_host)/stable/ow_help.html
	or
	ow_help.html in your own installation		
*/

var OW_OraoWeb_Player =  Class.create(
	{ 
		// Containers hierarchy
		container					: null	,
		container_width				: 0   ,
		offset_width				: 0		,	// Offset between the the with of a window and its inner html width
		offset_height				: 0		,	// Offset between the the height of a window and its inner html height
		player_panel				: null	,
		movie_panel					: null	,
		movie_logo					: null	,
		theVideo					: null	,
		controller_panel			: null	,
		end_movie_panel				: null	,
		end_fullscreen_movie_panel	: null	,
		debug_panel					: null  ,
		help_panel					: null	,
		fs_window					: null	,
		button_play					: null	,
		button_pause				: null	,
		button_fast_forward			: null	,
		button_fast_reward			: null	,
		tooltips 					: null	,
		controller_attached			: false	,
		quicktime_version			: null 	,
		timecode					: null	,
		selectionEventHandler		: null	,
		flag_sub_selection_set		: false	,	// true if a selection smaller that tcin/tcout is set (and the selected bar is showned)	
		// Variable that deal with the restriction of the move  in QTTime
		beg_current_selection		: 0		,	// When an extract is selected, should receive the beginning time, 
												// in the movie timescale of the selection, otherwise, TCin ( >= 0)
		end_current_selection		: 0		,	// When an extract is selected, should receive the en time, 
												// in the movie timescale of the selection, otherwise, TCout <= the duration of the movie
		beg_current_selection_TC	: 0		,	// The litterate TC
		end_current_selection_TC	: 0		,	// The litterate TC
		beg_current_selection_vis	: 0		,	// Take into account the loading state
		end_current_selection_vis	: 0		,	// Take into account the loading state
		tmpMaxTimeLoaded			: 0		,	// Max Time Loaded
		tcIN_in_QTTime				: 0		,	// This is TCin , in the in the movie timescale (usually = 0, and >=0 in case of MPEG1 extraction)
		tcOUT_in_QTTime				: 0		,	// This is TCout, in the in the movie timescale (usually = duration and <= duration in case of MPEG1 extraction)
		
		button_play_pause_exist		: false ,	// true when a play/pause button had been detected in the template, implying that its state has to be switch each time one modify the rate of the movie
		copyright					: null	,	// Info about the player, calculated automatically from the version variables in the header
		// Default Generic Options
		movie_options: {
			url						: ''	,
			width					: 400	,
			height					: 300	,
			timecode_lag			: null	, 	// Timecode of the first frame of the video file
			timecode_IN				: null	,   // Timecode of the theoritical begininng of the video (if it could be cropped at any frame) : timecode_IN >= timecode_lag
			timecode_OUT			: null	,   // Timecode of the theoritical end of the video (if it could be cropped at any frame) : timecode_OUT <= timecode of the last frame
			timecode_lag_in_second	: 0		,
			timecode_with_frame		: false	,	// if true, the frame are displayed
			config_help				: false	,	// to get the help instead of the player
			help					: false	, 	//	shortcut for config_help
			name					: 'movie1',
			autoplay				: true	,
			movie_background_color	: 'black',
			fullscreen				: false	,
			popUpFullscreen			: true	, 
			urlOfFullscreenPage		: 'ow_template_fullscreen.html'	,	// PHP: document.location.href.gsub(/[#]/, '') + '&FS=on',
			onMovieFinished			: null	,	// Not yet implemented
			onMovieFullScreen		: null	,	
			onMovieEndFullScreen	: null	,
			onLoadingUpdate			: null	,
			doNothingOnMovieFinished: false	,
			urlOfReplacementImage	: 'ow_images/videoPlayer/Play.gif'	,
			urlOfEndImage			: 'ow_images/videoPlayer/Play.gif'	,
			imageRootURL			: 'ow_images/'			,	// location of the images 
			typeMime				: 'video/quicktime'		,
			webmasterEmail			: null	,
			language				: 'fr'	,	// 'en' or 'fr' to get tooltips in French or English
			debug_mode				: false	,
			expectedQTversion		: '7.2.1'	,
			quicktimeDetection		: true	,
			simulateQTnotAvailable	: false ,
			sound_handle_variable	: true	,
			sound_slider_height		: 20	,
			sound_slider_width		: 270	, 
			position_slider_width	: 300	,
			controller_panel_height	: 60	,
			controller_panel_width	: null	,
			free_vertical_height	: 65	,	// implicitly below
			free_height_above		: 0		,
			window_position_x		: 50	,
			window_position_y		: 50	,
			window_default_width	: 400	,
			window_default_height	: 500	,
			free_lateral_width_in_FS: 0		,
			code_controller 		: '<!-- Controller Design -->								\
				<table border="0" cellpadding="0" cellspacing="0" id="tableSlider">				\
					<!-- First Line +++++++++++++++++++++++++++++++++++++++++++++++     -->		\
					<tr id="ligne-one">															\
						<!-- Progress Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_progress_slider" class="controller" colspan="4">	</td>	\
						<!-- TimeCode +++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="controller-timecode" 											\
						class="controller"><p id="ow_id_timecode">--:--:--</p></td>				\
					</tr>																		\
					<tr id="ligne-two">															\
						<!-- Play  Pause la video +++++++++++++++++++++++++++++++++ 	-->		\
						<td id="navigation-play-pause" class="controller">						\
							<a id="ow_bouton_play"><img/></a>									\
							<a id="ow_bouton_pause"><img/></a>									\
						</td>																	\
						<!-- Avance Retour Rapide +++++++++++++++++++++++++++++++++ 	-->		\
						<td id="navigation-fast">												\
							<a id="ow_bouton_fast_rewind"><img/></a> 							\
							<a id="ow_bouton_fast_forward"><img/></a>							\
						</td>																	\
						<!-- Full Screen  +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="navigation-zone-full-screen" class="controller">				\
							<a id="ow_bouton_fullscreen"><img/></a>								\
							<a id="ow_bouton_mute_sound"><img/></a>								\
						</td>																	\
						<td id="empty"></td>													\
						<!-- Sound  +++++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_sound_slider">	</td>									\
					</tr>																		\
				</table>',
			code_panel_end 			: '<a id="ow_image_end_restart_video"><img></a><br><a id="ow_bouton_play_again"><img></a>',
			code_panel_end_FS		: '<a id="ow_image_end_restart_video"><img></a><br><a id="ow_bouton_fullscreen_end"><img/></a>\
										<a id="ow_bouton_play_again"><img></a>',
			code_end_FS_movie_panel	: '<a id="ow_image_wentFS_restart_video"><img></a><br><a id="ow_bouton_play_again_afterFS"><img></a>',					
			code_panel_help 		: '<div id="ow_help_panel_panel"><h3 id="ow_help_panel_title"> </h3><div id="ow_help_panel_content"> </div></div>',
			help_panel_target		: null	,	// if not null, receive an html object to which the help panel will be attached
			images					: {
				'ow_bouton_play'				: 'Play.gif'			,
				'ow_bouton_pause'				: 'Pause.gif'			,
				'ow_bouton_play_pause'			: 'Play.gif'			,
				'ow_bouton_play_again'			: 'Play.gif'			,
				'ow_bouton_fast_rewind'			: 'FastRewind.gif'		,
				'ow_bouton_fast_forward'		: 'FastForward.gif'		,
				'ow_bouton_step_rewind'			: 'FastRewind.gif'		,
				'ow_bouton_step_forward'		: 'FastForward.gif'		,
				'ow_bouton_go_to_beginning'		: 'FastRewind.gif'		,
				'ow_bouton_go_to_end'			: 'FastForward.gif'		,
				'ow_bouton_fullscreen_open'		: 'CloseFS.gif'			,
				'ow_bouton_fullscreen_close'	: 'CloseFS.gif'			,
				'ow_bouton_mute_sound'			: 'BTsonOff.png'		,				
				'ow_bouton_max_sound'			: 'BTsonOff.png'		,
				'ow_bouton_help'				: 'boutons/b_aide_petit.gif'	,
				'ow_bouton_logo_player'			: 'logo.gif'			,	
				'ow_logo_quicktime'				: 'logo_qtlogo.gif'		,	
				'ow_background_sound_slider'	: 'Sound.gif'			,
				'ow_background_jog_slider'		: 'jogshuttle/barre_jogshuttle.png'		,
				'ow_bouton_beg_selection'		: 'boutons/b_definir_debut_petit.gif'	,	
				'ow_bouton_end_selection'		: 'boutons/b_definir_fin_petit.gif'		,	
				'ow_bouton_save_selection'		: 'boutons/b_disquette_petit.png'		,	
				'ow_bouton_new_selection'		: 'boutons/b_nouv_chap_petit.gif'		,	
				'ow_bouton_annotate_selection'	: 'boutons/b_annoter_petit.gif'
			},
			tooltips_fr				: {
				'ow_id_timecode' 				: 'Time Code (HH:mm:ss)',
				'ow_id_timecodeLong' 			: 'Time Code (HH:mm:ss.frame)',
				'ow_id_sound_slider'			: 'Volume sonore',
				'ow_id_progress_slider'			: 'Barre de progression',
				'ow_id_jog_slider'				: 'Jog Shuttle',
				'ow_bouton_play' 				: 'Lecture',
				'ow_bouton_pause' 				: 'Pause',
				'ow_bouton_play_pause' 			: 'Lecture ou Pause (suivant contexte)',
				'ow_bouton_play_again'			: 'Relance la visionneuse',
				'ow_bouton_fast_rewind' 		: 'Retour rapide',
				'ow_bouton_fast_forward' 		: 'Avance rapide',
				'ow_bouton_step_rewind'			: 'Reculer d\'une image',
				'ow_bouton_step_forward'		: 'Avancer d\'une image',
				'ow_bouton_go_to_beginning'		: 'Retourner au début du film',
				'ow_bouton_go_to_end'			: 'Aller à la fin',
				'ow_bouton_fullscreen_open'		: 'Passer en plein écran',
				'ow_bouton_fullscreen_close'	: 'Revenir à la taille normale',
				'ow_bouton_mute_sound' 			: 'Coupe le son',
				'ow_bouton_max_sound' 			: 'Son au maximum',
				'ow_bouton_logo_player'			: 'OraoWeb : Player Quicktime + Javascript ',	
				'ow_selection_start_handle'		: 'Début de l\'extrait',
				'ow_selection_end_handle'		: 'Fin de l\'extrait',
				'ow_selection_slider'			: 'Extrait sélectionné',
				'ow_bouton_help'				: 'Afficher l\'écran d\'aide',
				'mes_help'						: '<h4>Pour créer vos propres extraits</h4><p>- sélectionnez le début de l\'extrait : cliquez sur ow_bouton_beg_selection<br>- sélectionnez la fin de l\'extrait : cliquez sur ow_bouton_end_selection<br>- saisissez votre titre<br>- sauvegardez votre extrait : cliquez sur ow_bouton_save_selection</p><h4>Pour créer d\'autres extraits, cliquez sur ow_bouton_new_selection</h4><h4>Pour annoter vos extraits, cliquez sur ow_bouton_annotate_selection</h4><h5>[ retour au visionnage ]</h5>',
				'mes_help_title'				: 'Aide',
				'mes_copyright'					: 'OraoWeb : Player QuickTime. Ver.'+ OW_OraoWeb_version +' ('+OW_OraoWeb_version_release_date+'). Copyright Opsomai',
				'mes_copyright_title'			: 'OraoWeb : Player Quicktime + Javascript ',

				'mes_quicktime_not_up_to_date'	: '<h4>Votre version de QuickTime n\'est pas &agrave; jour</h4><h5>La version attendue est au moins la version : <span id="ow_quicktime_expected_version"></span></h5> <h5>Pour installer une version plus récente de QuickTime <a href="http://www.apple.com/fr/quicktime/download/">téléchargez l\'installeur sur le site d\'Apple (suivez ce lien)</a></h5>',
				'mes_quicktime_not_available'	: '<h4>Vous n\'avez pas QuickTime install&eacute;</h4> <h5>Pour installer QuickTime <a href="http://www.apple.com/fr/quicktime/download/">téléchargez l\'installeur sur le site d\'Apple (suivez ce lien)</a></h5><h5>Si QuickTime est correctement install&eacute; sur votre machine et que ce message apparait quand m&ecirc;me, <a href="mailto:orao@opsomai.com">n\'hésitez pas à nous contacter</a> avec une description de votre configuration (nom et version de votre navigateur, système d\'exploitation et version de Quicktime installée)</h5>'
			},
			tooltips_en				: {
				'ow_id_timecode' 				: 'Time Code (HH:mm:ss)',
				'ow_id_timecodeLong' 			: 'Time Code (HH:mm:ss.frame)',
				'ow_id_sound_slider'			: 'Sound volume',
				'ow_id_progress_slider'			: 'Progress bar',
				'ow_id_jog_slider'				: 'Jog Shuttle',
				'ow_bouton_play' 				: 'Play',
				'ow_bouton_pause' 				: 'Pause',
				'ow_bouton_play_pause' 			: 'Play or Pause (switch)',
				'ow_bouton_play_again'			: 'Restart the player',
				'ow_bouton_fast_rewind' 		: 'Fast rewind',
				'ow_bouton_fast_forward' 		: 'Fast forward',
				'ow_bouton_step_rewind'			: 'Back up one image',
				'ow_bouton_step_forward'		: 'Forward by one image',
				'ow_bouton_go_to_beginning'		: 'Go to the beginning',
				'ow_bouton_go_to_end'			: 'Go to the end',
				'ow_bouton_fullscreen_open'		: 'Show full screen',
				'ow_bouton_fullscreen_close'	: 'Exit full screen',
				'ow_bouton_mute_sound' 			: 'Sound off',
				'ow_bouton_max_sound' 			: 'Max the sound',
				'ow_bouton_logo_player'			: 'OraoWeb : QuickTime + Javascript Player',	
				'ow_selection_start_handle'		: 'Extract beginning',
				'ow_selection_end_handle'		: 'Extract end',
				'ow_selection_slider'			: 'Selected exctract',
				'ow_bouton_help'				: 'Show help screen',
				'mes_help'						: '<h4>To create your own extract:</h4><p>- select the beginning of the extract: click on ow_bouton_beg_selection<br>- select the end of the extract: click on ow_bouton_end_selection<br>- key in your title<br>- save your extract: click on ow_bouton_save_selection</p><h4>To create another extract: click on ow_bouton_new_selection</h4><h4>To annotate your extract: click on ow_bouton_annotate_selection</h4><h5>[ return to viewing ]</h5>',
				'mes_help_title'				: 'Help',
				'mes_copyright'					: 'OraoWeb : QuickTime Player. Ver.'+ OW_OraoWeb_version +' ('+OW_OraoWeb_version_release_date+'). Copyright Opsomai',
				'mes_copyright_title'			: 'OraoWeb : Quicktime + Javascript Player',

				'mes_quicktime_not_up_to_date'	: '<h4>Your QuickTime is not up to date</h4><h5>The expected version is at least : <span id="ow_quicktime_expected_version"></span></h5>  <h5>To install a recent version of QuickTime, please <a href="http://www.apple.com/quicktime/download/">visit the Apple web site and follow the procedure.</a><h5>',
				'mes_quicktime_not_available'	: '<h4>QuickTime is not installed on your machine</h4> <h5>To install this tool, please <a href="http://www.apple.com/quicktime/download/">visit the Apple web site and follow the procedure.</a><h5><h5>If QuickTime is indeed intalled on your machine, please <a href="mailto:orao@opsomai.com">send us an email</a> with a description of your configuration (name and version of your web browser and Operating System, version of installed QuickTime)</h5>'
			}
		},

		//  Global variables
		basic_function_button			: null 	,	// Will host the list of function directly attach to a button
		qt_progress_events				: 0		,	// Count the number of qtload event to reduce the number of used one
		//	Pointeur vers les timers	
		timer_position					: null 	,	// pointeur vers timer du controller
		// Flags
		// ne pas changer la position de la video quand le onChange est du a l'idle de la video
		context_update_position			: false ,
		context_update_chargement		: false ,
		video_should_be_relaunched		: false , // keep start that the video should be relaunch after the use of the jog
		reach_the_beginning				: true	,
		reach_the_end					: false ,

		position_slider					: null	, // slider de la position
		selection_slider				: null	,
		plugin_status					: '' 	, // status du plugin
		plugin_ID						: '' 	, // ID of the plugin (read from a received event)
		plugin_to_register_events		: null 	, // always the enclosing object

		//  The jog is not activated in this version
		jog_slider						: null	,  // slider du jog
		jogWasSlided					: false	,
		jogWasSet						: false ,
		jogWasSlidedAndSet			: false ,

		// Global values
		duration						: 0 ,
		movie_time_scale				: 1 ,
		movie_time						: 0 ,
		time_last_position_update		: 0 ,
		min_time_between_position_update: 40, // 40ms = 1000 ms / 25 frame
		chargement						: 0 , // etat du chargement de la video
		chargementDone 					: false,
		position						: 0 , // last set position of the slider
		new_position					: 0 , // next position of the slider
		rate							: 0 , // playing Rate
								// declare outside the function where it is used only to 
								// alleviate garbage collection issue

			// Management of the rewind mode when QT lt = 7.2
		last_QT_version_for_manual_rewind	: '8.5' , // Can be modified to decide if one should rewind manually or through QT
											// 	N.B.: A string is expected here, to be compatible with for instance 7.3.2
		manual_rewind_timer				: null ,			  // update of the position when rewind and QTvers lt 7.3
		rewind_speed					: 0 ,		// then the speed is memorize in this variable
		last_time_for_rewind			: 0 ,
		last_position_for_rewind		: 0 ,
		new_time_for_rewind				: 0 ,
		new_position_for_rewind			: 0 ,
		date_for_rewind					: 0 ,

			// Management of the sound
		sound_slider_set_volume_flag	: false ,
		sound_slider					: null ,
		sound_handle_height				: 10 ,
			// Management of direct interaction with Quicktime
			// When the user interract directly with the quicktime plugin, without passing trough javascript, it happens that 
			// the update loop is not started. We have to check that time to time
		last_sound_value	: 0 ,
		// The are stil lsome variables declared at the end of this file : the debug related ones.
		
		// Methods Declarations ===============================================================	
		
		//      Initialisation of the object      =============================================
		initialize: function(_container, _options) {		
			this.container = $(_container);
			this.container.update("");
			this.container.setStyle({position: 'relative'});
			this.copyright = 'OraoWeb : Player QuickTime. Ver.'+ OW_OraoWeb_version +' ('+OW_OraoWeb_version_release_date+'). Copyright Opsomai';

			// Loading of a preset
			if(_options.preset)	{
				if(this[_options.preset])	{
					var preset = this[_options.preset];
					for (o in preset) {
						this.movie_options[o] = preset[o];
					}
				}
			}
					
			for (o in _options) {
				this.movie_options[o] = _options[o];
			}
			
			if (this.movie_options.language == 'fr')			
				this.tooltips = this.movie_options['tooltips_fr'];
			else
				this.tooltips = this.movie_options['tooltips_en'];
			
			if (this.movie_options.webmasterEmail)	{
				this.tooltips['mes_quicktime_not_available'] = this.tooltips['mes_quicktime_not_available'].gsub(/orao\@opsomai\.com/, this.movie_options.webmasterEmail);
				this.tooltips['mes_quicktime_not_up_to_date'] = this.tooltips['mes_quicktime_not_up_to_date'].gsub(/orao\@opsomai\.com/, this.movie_options.webmasterEmail);
				
			}
					
			if (!this.movie_options.controller_panel_width)	{
				this.movie_options.controller_panel_width = this.width;
			}	
										
			// Writing of the help ++++++++++++++++++++++++++++++++++++++++++++++
			if ((this.movie_options.config_help)	||	(this.movie_options.help))		{
				this.AttachConfigHelpPanel();
				return;
			}			
																
			
			if(this.movie_options.quicktimeDetection)	{
				if(this.GetQuicktimeDetector().isQTInstalled() && !this.movie_options.simulateQTnotAvailable)	{
					this.quicktime_version = this.GetQuicktimeDetector().getQTVersion();
					if (this.GetQuicktimeDetector().isQTCompatible(this.movie_options.expectedQTversion, this.quicktime_version))	{
						// Normal case, when QT is available in the right version
						this.AttachPlayer();
						this.CheckThePluginIsLoaded.bind(this).delay(5);
					}	else	{	// QT is installed, but not the expected version
						this.container.update('<div id="ow_quicktime_alert">' + this.tooltips['mes_quicktime_not_up_to_date'] + '</div>');
						$('ow_quicktime_expected_version').update(this.movie_options.expectedQTversion);
						$('ow_quicktime_alert').setStyle({backgroundImage: 'url('+ this.movie_options.imageRootURL+this.movie_options.images['ow_logo_quicktime'] +')'});
					}
				}	else	{		// QT is not available				
					this.container.update('<div id="ow_quicktime_alert">' + this.tooltips['mes_quicktime_not_available'] + '</div>');
					$('ow_quicktime_alert').setStyle({backgroundImage: 'url('+ this.movie_options.imageRootURL+this.movie_options.images['ow_logo_quicktime'] +')'});
				}	
			}	else	{
				this.AttachPlayer();
				this.CheckThePluginIsLoaded.bind(this).delay(5);
			}				
		},
		
		AttachPlayer: function() {					
			if (this.movie_options.fullscreen) {
				window.moveTo(0,0);
				window.resizeTo(window.screen.availWidth,window.screen.availHeight);
				window.focus();
				window.moveTo(0,0);
				this.movie_options.width = document.viewport.getWidth();
				this.movie_options.height = document.viewport.getHeight() - this.movie_options.controller_panel_height;
			}			

			if (this.movie_options.timecode_with_frame) {
				this.timecode = this.LongTimeCode.bind(this);
				this.tooltips['ow_id_timecode'] = this.tooltips['ow_id_timecodeLong'];
			} else	{
				this.timecode = this.ShortTimeCode.bind(this);
			}

			if (this.movie_options.timecode_lag)	{ 
				this.movie_options.timecode_lag_in_second = this.LongTimeCodeToTimeInSecond(this.movie_options.timecode_lag);
			}

			if (this.movie_options.images['ow_background_player'])	{ 
				this.container.setStyle({backgroundImage: 'url('+this.movie_options.imageRootURL+this.movie_options.images['ow_background_player']+')'});
			}
			
			
			// for IE: remove QuickTime from browser memory
			Event.observe(window, 'unload', function() {
				// alert('About to unload the page');
				this.DetachMovie();
				// alert('About to close the door');
				}.bind(this)
			);

			this.basic_function_button	= {
				'ow_bouton_play'				: this.PlayTheVideo.bind(this),
				'ow_bouton_pause'				: this.StopTheVideo.bind(this),
				'ow_bouton_fast_rewind'			: this.FastRewind.bind(this),
				'ow_bouton_fast_forward'		: this.FastForward.bind(this),
				'ow_bouton_step_rewind'			: this.StepTheVideo.bind(this, -1),
				'ow_bouton_step_forward'		: this.StepTheVideo.bind(this, 1),
				'ow_bouton_mute_sound'			: this.SetSoundVolume.bind(this, 0),				
				'ow_bouton_max_sound'			: this.SetSoundVolume.bind(this, 255),
				'ow_bouton_go_to_beginning'		: this.GoToBegSelection.bind(this),
				'ow_bouton_go_to_end'			: this.GoToEndSelection.bind(this)
			},

			this.AttachMovie();
			
			document.observe('dom:loaded', this.LaunchAfterLoaded.bind(this));
		},
		
		LaunchAfterLoaded: function() { 
			this.player_panel = $('videoplayer');
			this.movie_panel = $('movieplayer');
			this.AttachMovieController();			
			this.AttachOtherPanels.bind(this).defer();	
			this.RegisterEvents.bind(this).defer();
		},
				
		AttachMovie: function() {
			var opts = this.movie_options;
		
			/*if (this.container.getStyle('position') == 'static') {
				this.container.setStyle({position: 'relative'});
			}*/

			// Player and  Movie Panels ======================================================
		
			// this.player_panel 	= new Element('div', { 'id': 'videoplayer'});
			// this.movie_panel 	= new Element('div', { 'id': 'movieplayer'});
			// this.player_panel.appendChild(this.movie_panel);
			// this.container.appendChild(this.player_panel);
		
			var code = '<div id="videoplayer">  <div id="movieplayer"> ';
			code += QT_GenerateOBJECTText_XHTML(
								opts.url, opts.width, opts.height, '', 
								'autoplay', 		opts.autoplay	, 
								'controller', 		'false'			, 
								'kioskmode', 		'true'			, 
								'showlogo', 		'true'			, 
								'bgcolor', 			opts.movie_background_color			, 
								'scale', 			'aspect'		, 
								'align', 			'middle'		,
								'enablejavascript', 'true'			,
								'postdomevents', 	'true'			,
								'target', 			'myself'		,
								'cache', 			'false'			,
								'qtsrcdontusebrowser', 'true'		,
								'type', 			opts.typeMime	,
								'obj#id',			opts.name		,
								'emb#NAME',			opts.name		,
								'emb#id',			opts.name+'emb'	
								);	
			code += '</div>  </div>';
			// alert(code);
			// this.movie_panel.update(code);	
			// this.container.innerHTML=code;
			document.writeln(code);
			
				
		},

		AttachMovieController: function() {
			var opts = this.movie_options;
			this.controller_panel = new Element('div', { 'id': 'ow_controllerpanel'});
			this.controller_panel.setStyle({	width	: opts.controller_panel_width+'px',	
												height	: opts.controller_panel_height+'px'});
			
			this.controller_panel.update(opts.code_controller);
			this.player_panel.appendChild(this.controller_panel);
			
			if ($('ow_id_timecode'))	{
				if (this.movie_options.timecode_with_frame) {
					$('ow_id_timecode').update('--:--:--:--');
				} else	{
					$('ow_id_timecode').update('--:--:--');
				}			

				$('ow_id_timecode').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_id_timecode'],
													'title'	: this.tooltips['ow_id_timecode']	});
			}
			
			//Debug
			if(opts.debug_mode)	{
// 				alert('Mode Debug On');
				this.debug_panel = new Element('div', { 'id': 'ow_debugArea'});
				this.debug_panel.setStyle({width: opts.width+'px'});
				this.debug_panel.update(this.debug_feedback);			
				this.container.appendChild(this.debug_panel);
				
			}

			// All the basic function buttons at once  ++++++++++++++++++++++++++++++++++++++++
			
			for (var _bouton in this.basic_function_button) {
				//alert('About to add ' + _bouton);
 				if($(_bouton)) 	{
					$(_bouton).writeAttribute({'href'	: '#', 
														'alt'	: this.tooltips[_bouton],
														'title'	: this.tooltips[_bouton]	});
					$(_bouton).onclick = this.basic_function_button[_bouton];
					var imgInBouton = $(_bouton).childElements().find(function(_el) {	return _el.match('img'); });
					if (imgInBouton) imgInBouton.writeAttribute('src',  opts.imageRootURL+opts.images[_bouton]);
				}
			}
			
			// Play / Pause button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			if($('ow_bouton_play_pause')) 	{
				this.button_play_pause_exist = true;
				$('ow_bouton_play_pause').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_bouton_play_pause'],
													'title'	: this.tooltips['ow_bouton_play_pause']	});
				$('ow_bouton_play_pause').onclick = this.ToggleTheVideo.bind(this);
				if(opts.autoplay)	{
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_pause']);
				}	else	{
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_play']);	
				}
				
			}			
			
			// Open/Close Full Screen button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			if($('ow_bouton_fullscreen'))	{
			
				if (opts.fullscreen) {	// Close the FullScreen
					$('ow_bouton_fullscreen').writeAttribute({
						'href'	: '#', 
						'alt'	: this.tooltips['ow_bouton_fullscreen_close'],
						'title'	: this.tooltips['ow_bouton_fullscreen_close']	});
					$('ow_bouton_fullscreen').onclick =  function(){window.close();}; 
					$$('#ow_bouton_fullscreen img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_fullscreen_close']);
				}	else	{	// open the Full Screen
					$('ow_bouton_fullscreen').writeAttribute({
						'href'	: '#', 
						'alt'	: this.tooltips['ow_bouton_fullscreen_open'],
						'title'	: this.tooltips['ow_bouton_fullscreen_open']	});
						if (opts.popUpFullscreen)	{
							$('ow_bouton_fullscreen').onclick = this.OpenFullScreen.bind(this);
						}	else	{
							$('ow_bouton_fullscreen').onclick = this.SwitchToFullScreen.bind(this);
						}
					$$('#ow_bouton_fullscreen img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_fullscreen_open']);
				};
			}			

			// Help button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			if($('ow_bouton_help')) 	{
				$('ow_bouton_help').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_bouton_help'],
													'title'	: this.tooltips['ow_bouton_help']	});
				$$('#ow_bouton_help img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_help']);
				$('ow_bouton_help').observe('click', this.ShowHelpPanel.bindAsEventListener(this)) ;
				// $('ow_bouton_help').onclick = this.DetachMovie.bind(this);
				
				// alert('mes help : \n'+this.tooltips['mes_help']);
				// User Help Panel ++++++++++++++++++++++++++++++++++++++
				for (var img in opts.images) {	// XXXXXXXXXXXXXXXXXXXXXXX
					this.tooltips['mes_help'] = this.tooltips['mes_help'].sub(img,
							function(match) { 
								// alert(match[0] + '\n' + opts.images[match[0]] );
								return '<img src="'+ 
												opts.imageRootURL+opts.images[match[0]] +	'">'; 
							}
					)
				}				
				
				this.help_panel = new Element('div', { 'id'	: 'ow_id_code_panel_help'	, 
													'style'	: 'display: none;'			,
													'class' : 'ow_hiddenBelow'			});
				this.help_panel.update(opts.code_panel_help);
				this.container.appendChild(this.help_panel);
				if (opts.help_panel_target)	{
					$(opts.help_panel_target).appendChild(this.help_panel);
				}	else	{
					this.container.appendChild(this.help_panel);
				}
				$('ow_help_panel_title').update(this.tooltips['mes_help_title']);
				$('ow_help_panel_content').update(this.tooltips['mes_help']);				

			}			

			// Logo button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			
			if($('ow_bouton_logo_player')) 	{
				$('ow_bouton_logo_player').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_bouton_logo_player'],
													'title'	: this.tooltips['ow_bouton_logo_player']	});
				$$('#ow_bouton_logo_player img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_logo_player']);
				new Tip('ow_bouton_logo_player', this.tooltips['mes_copyright'], {
					closeButton: true,
					className: 'INAtip',
					showOn: 'click',
					hideOn: {
						element:'tip',
						event: 'click'
					},
					hook:{target: 'topRight', tip: 'topRight'},
					offset: {x:0, y:-46 },
					title: this.tooltips['mes_copyright_title']
				});
			}			

			// Position Slider ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
			
			if($('ow_id_progress_slider'))	{
				var ow_position_slider_template = '	<div id="ow_navigation-wrap1">  \
		<div id="ow_navigation-wrap2">						\
			<div id="ow_navigation-track-start"> </div>		\
			<div id="ow_navigation-slider">					\
				<div id="ow_navigation-position-handle" style="cursor:col-resize;"> </div> \
				<div id="ow_navigation-chargement-handle"></div>	\
				<div id="ow_navigation-track-end"></div>	\
			</div> <!-- End ow_navigation-slider -->		\
		</div> <!-- End ow_navigation-wrap2 -->				\
		<div id="ow_navigation_selected_extract"></div> \
		<div id="ow_navigation_selected_target"></div> \
	</div> <!-- End ow_navigation-wrap1 -->';
				$('ow_id_progress_slider').update(ow_position_slider_template);
				$('ow_navigation-chargement-handle').writeAttribute({
					'alt'	: this.copyright,
					'title'	: this.copyright	});
				$('ow_navigation-track-end').writeAttribute({
					'alt'	: this.copyright,
					'title'	: this.copyright	});
				if(opts.images['ow_image_position_slider'])	{
					$('ow_navigation-position-handle').update('');
					var position_handle_image = new Element('img', {	'id'	: 'ow_position_handle_image',
																	'src'	: opts.imageRootURL+opts.images['ow_image_position_slider']});
					$('ow_navigation-position-handle').appendChild(position_handle_image);					
				}
				$('ow_navigation-wrap1').setStyle({ width:opts.position_slider_width+'px' });
				$('ow_navigation-wrap2').setStyle({ width:opts.position_slider_width+'px' });
				$('ow_navigation-slider').setStyle({ width:opts.position_slider_width+'px' });
				$('ow_id_progress_slider').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_id_progress_slider'],
													'title'	: this.tooltips['ow_id_progress_slider']	});
				$('ow_navigation_selected_extract').setStyle({ 	width:opts.position_slider_width+'px',
				 												visibility:'hidden' });
				$('ow_navigation_selected_target').setStyle({ 	width:opts.position_slider_width+'px',																 	
																visibility:'hidden' });
				
				this.selectionEventHandler = this.SelectionReceiveAClick.bindAsEventListener(this);
			}				
				
			// Jog Shuttle Slider ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			if($('ow_id_jog_slider'))	{
				var ow_jog_slider_template ='<div id="ow_jog-slider">	<div id="ow_jog-handle"> </div>	</div>';
				$('ow_id_jog_slider').update(ow_jog_slider_template);
				$('ow_jog-slider').setStyle({backgroundImage: 'url('+ opts.imageRootURL+opts.images['ow_background_jog_slider'] +')'});
				if(opts.images['ow_image_jog_slider'])	{
					$('ow_jog-handle').update('');
					var jog_handle_image = new Element('img', {	'id'	: 'ow_jog_handle_image',
																	'src'	: opts.imageRootURL+opts.images['ow_image_jog_slider']});
					$('ow_jog-handle').appendChild(jog_handle_image);					
				}
				$('ow_jog-slider').setStyle({ width:opts.position_slider_width+'px' });
				$('ow_id_jog_slider').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_id_jog_slider'],
													'title'	: this.tooltips['ow_id_jog_slider']	});				
			}



			// Sound Slider ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			if($('ow_id_sound_slider'))	{
				var ow_sound_slider_template ='<div id="ow_sound-slider">	<div id="ow_sound-handle"></div>	</div>';
				$('ow_id_sound_slider').update(ow_sound_slider_template);
				$('ow_sound-slider').setStyle({backgroundImage: 'url('+ opts.imageRootURL+opts.images['ow_background_sound_slider'] +')'});
				if(opts.images['ow_image_sound_slider'])	{
					$('ow_sound-handle').update('');
					var sound_handle_image = new Element('img', {	'id'	: 'ow_sound_handle_image',
																	'src'	: opts.imageRootURL+opts.images['ow_image_sound_slider']});
					$('ow_sound-handle').appendChild(sound_handle_image);					
				}
				if(opts.sound_handle_variable)	{
					this.sound_handle_height = 1+Math.round((127+15)*(this.movie_options.sound_slider_height-1)/270);
					$('ow_sound-handle').setStyle({ top		: (opts.sound_slider_height-this.sound_handle_height)+'px',	
													height	: (this.sound_handle_height)+'px' });
				}	else	{
					$('ow_sound-handle').setStyle({ top		: '0px',	
													height	: opts.sound_slider_height+'px' });
				}
				$('ow_id_sound_slider').writeAttribute({'href'	: '#', 
													'alt'	: this.tooltips['ow_id_sound_slider'],
													'title'	: this.tooltips['ow_id_sound_slider']	});				
			}

			
			this.controller_attached = true;			
		},
		
		AttachOtherPanels: function() {
			var opts = this.movie_options;
			
			// End of Movie Panel ===========================================================
			if(!opts.doNothingOnMovieFinished)	{	// Add End of movie panel only when it will be used
				this.end_movie_panel = new Element('div', { 'id'	: 'ow_id_end_restart_video'	, 
															'style'	: 'display: none;'			,
															'class' : 'ow_hiddenBelow'				});
				if (opts.fullscreen) {
					this.end_movie_panel.update(opts.code_panel_end_FS);
				}	else	{
					this.end_movie_panel.update(opts.code_panel_end);
				};
				this.container.appendChild(this.end_movie_panel);

				// Play Again button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				if($('ow_bouton_play_again')) 	{
					$('ow_bouton_play_again').writeAttribute({
						'href'	: '#', 
						'alt'	: this.tooltips['ow_bouton_play_again'],
						'title'	: this.tooltips['ow_bouton_play_again']	
					});
					$('ow_bouton_play_again').onclick = this.LetTheVideoBeVisibleAgain.bind(this);
					$$('#ow_bouton_play_again img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_play_again']);
				}
				// Play again ... End Image
				if($('ow_image_end_restart_video')) 	{
					$('ow_image_end_restart_video').writeAttribute({
						'href'	: '#', 
						'alt'	: this.tooltips['ow_bouton_play_again'],
						'title'	: this.tooltips['ow_bouton_play_again']
					});
					$('ow_image_end_restart_video').onclick = this.LetTheVideoBeVisibleAgain.bind(this);
					$$('#ow_image_end_restart_video img')[0].writeAttribute({
						'src':  opts.urlOfEndImage,
						'width'	: opts.width,
						'height': opts.height,
						'border': 0
					});
				}				
			}	// End of End of Movie Panel =============
			
			
			// Close FS  button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			if($('ow_bouton_fullscreen_end')) 	{
				$('ow_bouton_fullscreen_end').writeAttribute({
					'href'	: '#', 
					'alt'	: this.tooltips['ow_bouton_fullscreen_close'],
					'title'	: this.tooltips['ow_bouton_fullscreen_close']	
				});
				$('ow_bouton_fullscreen_end').onclick = function(){window.close();};
				$$('#ow_bouton_fullscreen_end img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_fullscreen_close']);
			}
			
			// Movie-went-to-fullscreen-in-a-different-window Panel ===========================================================			
			if ( (! opts.fullscreen) && (opts.popUpFullscreen) ){	// we are not in full screen, AND
				 													// we will pop up a new window when going in FS
				this.end_fullscreen_movie_panel = new Element('div', { 'id'	: 'ow_id_wentFS_restart_video'	, 
															'style'	: 'display: none;'			,
															'class' : 'ow_hiddenBelow'				});
				this.end_fullscreen_movie_panel.update(opts.code_end_FS_movie_panel);
				this.container.appendChild(this.end_fullscreen_movie_panel);

				// Play Again button ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				if($('ow_bouton_play_again_afterFS')) 	{
					$('ow_bouton_play_again_afterFS').writeAttribute({
						'href'	: '#', 
						'alt'	: this.tooltips['ow_bouton_play_again'],
						'title'	: this.tooltips['ow_bouton_play_again']	
					});
					$('ow_bouton_play_again_afterFS').onclick = function(){window.location.reload();};
					$$('#ow_bouton_play_again_afterFS img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_play_again']);
				}
				// Play again ... End Image
				if($('ow_image_wentFS_restart_video')) 	{
					$('ow_image_wentFS_restart_video').writeAttribute({
						'href'	: '#', 
						'alt'	: this.tooltips['ow_bouton_play_again'],
						'title'	: this.tooltips['ow_bouton_play_again']
					});
					$('ow_image_wentFS_restart_video').onclick = function(){window.location.reload();};
					$$('#ow_image_wentFS_restart_video img')[0].writeAttribute({
						'src':  opts.urlOfReplacementImage,
						'width'	: opts.width,
						'height': opts.height,
						'border': 0
					});
				}

			};
						
		},
		
		CreateSliders		 : function()	{

			//  =======================================  Selection Slider			
			this.position_slider = new Control.Slider(
				['ow_navigation-position-handle','ow_navigation-chargement-handle'],'ow_navigation-slider',{
					range		: $R(0,1000),
					sliderValue	: [0,1000],
					startSpan	: 'ow_navigation-track-start',
					endSpan		: 'ow_navigation-track-end',
					restricted	: true,
					// alignX		: [-2, 0], 
					alignY		: -5,
					
					onSlide:function(v){							
							if ((this.quicktime_version <= this.last_QT_version_for_manual_rewind) && (this.rewind_speed<0))	{
								this.manual_rewind_timer.stop();
								this.rewind_speed = 0;
							}

							if  (this.theVideo.GetRate() != 0) 	{
								this.theVideo.Stop();
								if (this.button_play_pause_exist)	{ 
									$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
								}
								this.video_should_be_relaunched = true;
							}

							if ( ! ( this.context_update_position || this.context_update_chargement))	{
								this.GoToPercent(v[0]/10);
								// this.movie_time = this.theVideo.GetTime();
								// this.position = Math.round(this.movie_time/this.duration * 1000);								
								// $('ow_id_timecode').update(this.timecode());
							}	
					}.bind(this),
					onChange:function(v){
						if ( ! ( this.context_update_position || this.context_update_chargement)) {
							// dans le cadre d'un deplacement manuel du slider

							this.position = v[0];
							if (this.position == 0)	{
								this.reach_the_beginning = true;
								this.reach_the_end = false
							} else if (this.position >= 1000)	{
								this.reach_the_beginning = false;
								this.reach_the_end = true
							} else {
								this.reach_the_beginning = false;
								this.reach_the_end = false
							}

							if  (this.rewind_speed<0)	{
								this.manual_rewind_timer.stop();
								this.theVideo.Stop();
								if (this.button_play_pause_exist)	{ 
									$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
								}
								this.rewind_speed = 0;
							}

							if  (this.theVideo.GetRate() != 0) 	{
								this.theVideo.Stop();
								if (this.button_play_pause_exist)	{ 
									$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
								}
								this.video_should_be_relaunched = true;
							}

							this.GoToPercent(v[0]/10);

							//if (this.jogWasSet)	{
							//	this.jogWasSlidedAndSet = true;
							//	this.jog_slider.setValue(2);
							//	this.jogWasSet = false;
							//}

							// this.movie_time = this.theVideo.GetTime();
							// $('ow_id_timecode').update(this.timecode());
							// this.position = Math.round(this.movie_time/this.duration * 1000);

							if ((this.video_should_be_relaunched) && !this.reach_the_end)	{
								this.resetJogleIfNecessary();
								this.theVideo.Play();
								this.video_should_be_relaunched = false;
							}

							// Cas ou l'on touche au slider de chargement
							// (cela n'est pas censé arriver, mais pourtant...)

							if ((v[1] != 1000) && (this.chargementDone)) {
								if (this.duration != 0)	{
									this.chargement = Math.round(this.theVideo.GetMaxTimeLoaded()/this.duration * 1000);
									if (this.chargement>950)	{
										this.chargement = 1000;
									}

									if ( !this.context_update_chargement)	{
										this.context_update_chargement=true;
										this.position_slider.setValue(this.chargement, 1);

										if ( !this.context_update_position)	{
											this.context_update_position=true;
											this.position_slider.setValue(this.position, 0);	
											this.context_update_position=false;
										}						
										this.context_update_chargement=false;	
									}						
								}	
							}
						}						
					}.bind(this)
				}
			);




			//  =======================================  Sound Slider
			if($('ow_id_sound_slider'))	{
				this.sound_slider = new Control.Slider(
					'ow_sound-handle', 'ow_sound-slider',{
						range:$R(0,255),
						sliderValue:128,
						onSlide:function(v){
							this.sound_slider_set_volume_flag=true;
							this.last_sound_value = Math.round(v);
							this.theVideo.SetVolume(this.last_sound_value);
							this.sound_handle_height = 1+Math.round((this.last_sound_value+15)*(this.movie_options.sound_slider_height-1)/270);
							if(this.movie_options.sound_handle_variable)	{
								$('ow_sound-handle').setStyle({ top		: (this.movie_options.sound_slider_height - this.sound_handle_height)+'px',	
																height	: this.sound_handle_height+'px' });
							}
						
						}.bind(this),
						onChange:function(v){
							this.sound_slider_set_volume_flag=true;
							this.last_sound_value = Math.round(v);
							this.theVideo.SetVolume(this.last_sound_value);
							this.sound_handle_height = 1+Math.round((this.last_sound_value+15)*(this.movie_options.sound_slider_height-1)/270);
							if(this.movie_options.sound_handle_variable)	{
								$('ow_sound-handle').setStyle({ top		: (this.movie_options.sound_slider_height - this.sound_handle_height)+'px',	
																height	: this.sound_handle_height+'px' });
							}
						}.bind(this)
					}
				);
			}
			
			//  =======================================  Jog Shuttle Slider     XXXXXXXXXXXXXXXXXXXXXXXXXXXXX playerQT13
			if($('ow_id_jog_slider'))	{
				this.jog_slider = new Control.Slider(
					'ow_jog-handle', 'ow_jog-slider',{
						range:$R(0,4),
						sliderValue:2,
						onSlide:function(v){
							var value = (v-2);
							if (v < 0.5)	{		// entre -2 et -1.5
								value = 16 * value + 22;  	// -2 => -10 et -1.5 => -2
							}	else if (v<1)	{	// entre -1.5 et -1
								value = 2 * value + 1;		
							}	else if (v<=3) 	{	
								//	(entre -1 et 1 on reste en identique)
							}	else if (v<3.5)	{	// entre 1 et 1.5  
								value = 2 * value -1;
							}	else 	{	// entre 1.5 et 2
								value = 16 * value -22;		// 1.5 => 2 et 2 => 10;
							}	
							if ( ((this.reach_the_end) && (value > 0)) || ((this.reach_the_beginning) && (value < 0)) )	{
								if (this.quicktime_version <= this.last_QT_version_for_manual_rewind) 	{
									if(this.manual_rewind_timer)	{
										this.manual_rewind_timer.stop();
									}									
									this.rewind_speed = 0;
								}
								this.theVideo.Stop();
								this.jogWasSlided = true;
							}	else	{
								if (this.reach_the_end || this.reach_the_beginning)	{
									this.reach_the_end = false;
									this.reach_the_beginning = false;
									// this.theVideo.Start();
								}
								if ((this.quicktime_version <= this.last_QT_version_for_manual_rewind) && ((this.rewind_speed<0) || (value<0))) 	{
									if ((this.rewind_speed<0) && (value<0))	{
										this.rewind_speed = value;
									}	else if (value >=0)	{	// On vient juste de passer de v<0 a v >0 : on passe en mode normal
										this.manual_rewind_timer.stop();
										this.rewind_speed = 0;
										// lanceVideoAvecTimer();
										this.theVideo.SetRate(value);
									}	else	{	// On passe d'un mode normal (this.rewind_speed == 0) en mode saut en arriere (value <0)
										this.rewind_speed = value;
										this.theVideo.Stop();
										this.date_for_rewind = new Date();
										this.last_time_for_rewind = this.date_for_rewind.getTime();
										this.last_position_for_rewind = this.theVideo.GetTime();
										if (this.manual_rewind_timer)	{
											this.manual_rewind_timer.start();
										}	else	{
											this.manual_rewind_timer = new PeriodicalExecuter( this.UpdatePosWhenRewind.bind(this), 0.099);
										}			
									}			
								}	else	{
									this.theVideo.SetRate(value);
								}
									
								if($('ow_id_jog_value'))	{
									$('ow_id_jog_value').update('x '+Math.round(value*10) / 10);
								}
								this.jogWasSlided = true;
								this.jogWasSlidedAndSet = false;
								this.jogWasSet = false;		// a la fin du slide, on va eteindre le jogle
								// donc plus besoin de suivre son etat						
							}
						}.bind(this),
						onChange:function(v){
							var value = (v-2);
							if (v < 0.5)	{		// entre -2 et -1.5
								value = 16 * value + 22;  	// -2 => -10 et -1.5 => -2
							}	else if (v<1)	{	// entre -1.5 et -1
								value = 2 * value + 1;		
							}	else if (v<=3) 	{	
								//	(entre -1 et 1 on reste en identique)
							}	else if (v<3.5)	{	// entre 1 et 1.5  
								value = 2 * value -1;
							}	else 	{	// entre 1.5 et 2
								value = 16 * value -22;		// 1.5 => 2 et 2 => 10;
							}	
							if ( (this.reach_the_end && (value>0)) || (this.reach_the_beginning && (value<0)) )	{
								this.jogWasSlided = true;
								// then the next test will reset everything to 0 : same behaviour than at the end of a slide
							}
							if (this.jogWasSlided)	{ // fin d'une utilisation par slide : retour a zero
								if (this.quicktime_version <= this.last_QT_version_for_manual_rewind) 	{
									if(this.manual_rewind_timer)	{
										this.manual_rewind_timer.stop();
									}								
									this.rewind_speed = 0;	
								}
								this.StopTheVideo();
								this.jogWasSlided = false;
								this.jogWasSlidedAndSet = true;
								this.jog_slider.setValue(2);
								
								if($('ow_id_jog_value'))	{
									$('ow_id_jog_value').update(' ');
								}
								
							} else if (!this.jogWasSlidedAndSet)	{ // on ne vient pas d\'un reset apres un slide, donc c\'est un set initial
														// en debut de slide, ou sans slide
								if ((this.quicktime_version <= this.last_QT_version_for_manual_rewind) && (this.rewind_speed<0))	{
									this.manual_rewind_timer.stop();
									this.rewind_speed = 0;	
								}
								if ((this.quicktime_version <= this.last_QT_version_for_manual_rewind) && (value<0))	{
									this.rewind_speed = value;
									this.theVideo.Stop();
									this.date_for_rewind = new Date();
									this.last_time_for_rewind = this.date_for_rewind.getTime();
									this.last_position_for_rewind = this.theVideo.GetTime();
									if (this.manual_rewind_timer)	{
										this.manual_rewind_timer.start();
									}	else	{
										this.manual_rewind_timer = new PeriodicalExecuter( this.UpdatePosWhenRewind.bind(this), 0.099);
									}
									if (this.button_play_pause_exist)	{ 
										$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
									}
									
								}	else	{
									this.theVideo.SetRate(value);
								}
								if($('ow_id_jog_value'))	{
									if (value) {
										$('ow_id_jog_value').update('x '+Math.round(value*10) / 10);
									}	else	{
										$('ow_id_jog_value').update(' ');
									}
									
								}								
								this.jogWasSet = true;  // Si on ne passe pas par un slide, il va falloir faire qqchose (reinit le joggle)
							}	else	{			// on reviens ici apres avoir valide un fin de slide
								// donc on remet le flag a false
								this.jogWasSlidedAndSet = false;
							}
						}.bind(this)
					}
				);
			}
			
			
			
			
		},
		
		// lanceVideoAvecTimer  : function() {
		// 	//if(this.movie_options.debug_mode)  $('debug2').update('LVAT '+this.plugin_status);			
		// 	if((this.plugin_status=='OK') && (! this.reach_the_end))	{
		// 		this.theVideo.Play();
		// 		if (this.button_play_pause_exist)	{ 
		// 			$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
		// 		}
		// 		this.reach_the_beginning = false;
		// 	}
		// },

		PlayTheVideo  : function() {	
			if (this.rewind_speed < 0) {
				this.manual_rewind_timer.stop();
				this.rewind_speed=0;
			}
			this.resetJogleIfNecessary();
			if((this.plugin_status=='OK') && (! this.reach_the_end))	{
				this.theVideo.Play();
				if (this.button_play_pause_exist)	{ 
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
				}
				this.reach_the_beginning = false;
			}
			this.FocusToTheVideo();
		},

		StopTheVideo  : function() {
			if (this.rewind_speed < 0) {
				this.manual_rewind_timer.stop();
				this.rewind_speed=0;
			}
			this.resetJogleIfNecessary();
			this.theVideo.Stop();

			if (this.button_play_pause_exist)	{ 
				$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
			}
			this.movie_time = this.theVideo.GetTime();
			$('ow_id_timecode').update(this.timecode());	
			this.FocusToTheVideo();
		},
		
		ToggleTheVideo  : function() {
			//alert('GetRate : '+this.theVideo.GetRate() + ' / rewind_speed : ' + this.rewind_speed);
			if ( (this.theVideo.GetRate() == 0) && (this.rewind_speed == 0)){
				this.PlayTheVideo();
			} else {
				this.StopTheVideo();
			}
		},
	
		StepTheVideo  : function(_step) {
			if (this.button_play_pause_exist)	{ 
				$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
			}
			if (this.rewind_speed < 0) {
				this.manual_rewind_timer.stop();
				this.rewind_speed=0;
			}

			this.theVideo.Step(_step);
			
			this.movie_time = this.theVideo.GetTime();
			$('ow_id_timecode').update(this.timecode());
			
			if (_step < 0)	{
				this.reach_the_end = false
			} else if (_step > 0)	{
				this.reach_the_beginning = false;
			}
			
			this.FocusToTheVideo();
		},
		
		// open full screen and kill all timer (or the other way arround :-)
		OpenFullScreen  : function() {
			var opts = this.movie_options;

			this.fs_window = window.open(opts.urlOfFullscreenPage, 'videoFS','top=0, left=0, toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=no, directories=no, channelmode=yes');

			if (this.rewind_speed < 0) {
				this.manual_rewind_timer.stop();
				this.rewind_speed=0;
			}
			this.theVideo.Stop();
			if (this.button_play_pause_exist)	{ 
				$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  opts.imageRootURL+opts.images['ow_bouton_play']);	
			}

			this.theVideo.SetURL(opts.urlOfReplacementImage);
			this.player_panel.style.visibility= 'hidden';

			this.end_fullscreen_movie_panel.show();
			this.end_fullscreen_movie_panel.removeClassName('ow_hiddenBelow');	
			this.end_fullscreen_movie_panel.addClassName('ow_floatingAboveAll');		
		},

		SwitchToFullScreen : function() {
			if (this.plugin_status=='OK')	{
				this.container_width = this.container.getWidth();

				window.moveTo(0,0);
				window.resizeTo(window.screen.availWidth,window.screen.availHeight);
				// alert('offset : '+ window.screen.availWidth + ' , '+ window.screen.availHeight );
				// window.resizeTo(1000,800);
				window.focus();
				window.moveTo(0,0);

				var newWidth = document.viewport.getWidth() - this.movie_options.free_lateral_width_in_FS;
				this.container.setStyle({ width: newWidth+'px' });
				
				// A explorer XXXXXXXXXXX
				// this.movie_panel.setStyle({	width: opts.width+'px',	
				// 							height	: opts.height+'px' });
				// var maxWidth = (opts.controller_panel_width>opts.width ? opts.controller_panel_width : opts.width);
				// this.player_panel.setStyle({	width	: maxWidth+'px',	
				// 								height	: (opts.height+opts.controller_panel_height)+'px' });
				
				this.theVideo.width		= newWidth;

				
				this.theVideo.height	= document.viewport.getHeight() - this.movie_options.free_vertical_height - this.movie_options.free_height_above;
				// this.theVideo.height	= document.viewport.getHeight() - this.movie_options.controller_panel_height;
				$('ow_bouton_fullscreen').onclick = this.FromFullScreenToPoUp.bind(this);
				$('ow_bouton_fullscreen').writeAttribute({
					'alt'	: this.tooltips['ow_bouton_fullscreen_close'],
					'title'	: this.tooltips['ow_bouton_fullscreen_close']	});
				
				if (this.sound_slider) this.sound_slider.setValue(this.last_sound_value); 	// display issue with IE
				if (this.theVideo.GetRate() == 1) {
					if (this.jog_slider) this.jog_slider.setValue(2); 	// display issue with IE
					this.PlayTheVideo.bind(this).defer();
				}	else	{
					if (this.jog_slider) this.jog_slider.setValue(2); 	// display issue with IE
				}
				
				if (this.movie_options.onMovieFullScreen) this.movie_options.onMovieFullScreen();
				
				// first guestimation of the offset
				if(!this.offset_width) this.offset_width 	= window.screen.availWidth - document.viewport.getWidth();
				if(!this.offset_height) this.offset_height	= window.screen.availHeight - document.viewport.getHeight();
			}
		},

		FromFullScreenToPoUp : function() {
			var opts = this.movie_options;

			this.theVideo.width	= opts.width;
			this.theVideo.height= opts.height;
			this.container.setStyle({ width: this.container_width+'px' });
			$('ow_bouton_fullscreen').onclick = this.SwitchToFullScreen.bind(this);
			$('ow_bouton_fullscreen').writeAttribute({
				'alt'	: this.tooltips['ow_bouton_fullscreen_open'],
				'title'	: this.tooltips['ow_bouton_fullscreen_open']	});
			if (this.sound_slider) this.sound_slider.setValue(this.last_sound_value); 	// display issue with IE
			if (this.theVideo.GetRate() == 1) {
				if (this.jog_slider) this.jog_slider.setValue(2); 	// display issue with IE
				this.PlayTheVideo.bind(this).defer();
			}	else	{
				if (this.jog_slider) this.jog_slider.setValue(2); 	// display issue with IE
			}
			
			if (this.movie_options.onMovieEndFullScreen) this.movie_options.onMovieEndFullScreen();

			window.moveTo(opts.window_position_x,opts.window_position_y);
			window.resizeTo(opts.window_default_width + this.offset_width, opts.window_default_height + this.offset_height);

			// second guestimation of the offset
			// necessary because Firefox mixed up its full screen available height on MacOSX
			var _offset_width 	= opts.window_default_width + this.offset_width - document.viewport.getWidth();
			var _offset_height	= opts.window_default_height + this.offset_height - document.viewport.getHeight();
			if ((this.offset_width != _offset_width) || (this.offset_height != _offset_height)) {
				this.offset_width = _offset_width;
				this.offset_height = _offset_height;
				window.resizeTo(opts.window_default_width + this.offset_width, opts.window_default_height + this.offset_height);				
				// alert('NEW offset : '+ this.offset_width + ' , '+ this.offset_height );
			};

			window.focus();
			window.moveTo(opts.window_position_x,opts.window_position_y);

			if (this.sound_slider) this.sound_slider.setValue(this.last_sound_value); 	// display issue with IE
			
		},
		
		EndOfVideo  : function() {
			this.theVideo.Stop();
			if (this.button_play_pause_exist)	{ 
				$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
			}
			
			if (! this.movie_options.doNothingOnMovieFinished)	{				
				this.new_position = 0;
				this.position = 0;
				this.theVideo.SetTime(0);
				this.movie_time = 0;

				this.player_panel.style.visibility= 'hidden';
				this.end_movie_panel.show();
				this.end_movie_panel.removeClassName('ow_hiddenBelow');	
				this.end_movie_panel.addClassName('ow_floatingAboveAll');		
			}	else	{
				this.movie_time = this.theVideo.GetEndTime();
				this.theVideo.SetTime(this.movie_time);
				this.new_position = 1000;
				this.position = 1000;				
				
				this.reach_the_end = true;
				this.reach_the_beginning = false;				
			}
			
			if (!this.context_update_position)	{
				this.context_update_position=true;
				this.position_slider.setValue(this.new_position, 0);	
				this.context_update_position=false;
				this.position = this.new_position;
				$('ow_id_timecode').update(this.timecode());
			}
		},
		
		GoToBegSelection	: function()	{
			this.StopTheVideo();
			this.reach_the_end = false;
			var maxTime = this.theVideo.GetMaxTimeLoaded();
			
			if(this.beg_current_selection<=maxTime){
					this.theVideo.SetTime(this.beg_current_selection);
					this.movie_time = this.beg_current_selection;					
			}	else	{
				this.theVideo.SetTime(maxTime);
				this.movie_time = maxTime;
			}
			this.position = Math.round(this.movie_time/this.duration * 1000);
			this.reach_the_beginning = true;
			if (!this.context_update_position)	{
				this.context_update_position=true;
				this.position_slider.setValue(this.position, 0);	
				this.context_update_position=false;
				$('ow_id_timecode').update(this.timecode());
			}
			
		},

		GoToEndSelection	: function()	{
			this.StopTheVideo();			
			this.reach_the_beginning = false;
			var maxTime = this.theVideo.GetMaxTimeLoaded();			
			// alert('GoTo  : '+this.end_current_selection+' / duration : '+this.duration);
			
			if(this.end_current_selection<=maxTime){
					this.theVideo.SetTime(this.end_current_selection);
					this.movie_time = this.end_current_selection;
					this.reach_the_end = true;
			}	else	{
				this.theVideo.SetTime(maxTime);
				this.movie_time = maxTime;
			}
			if (!this.context_update_position)	{
				this.context_update_position=true;
				this.position_slider.setValue(this.position, 0);	
				this.context_update_position=false;
				$('ow_id_timecode').update(this.timecode());
			}
		},

		LetTheVideoBeVisibleAgain  : function() {
			this.player_panel.style.visibility= 'visible';

			if(this.end_fullscreen_movie_panel)	{
				this.end_fullscreen_movie_panel.removeClassName('ow_floatingAboveAll');
				this.end_fullscreen_movie_panel.addClassName('ow_hiddenBelow');
				this.end_fullscreen_movie_panel.hide();
			}
			
			this.end_movie_panel.removeClassName('ow_floatingAboveAll');
			this.end_movie_panel.addClassName('ow_hiddenBelow');
			this.end_movie_panel.hide();

			this.LetTheVideoBeVisibleAgainBis.bind(this).defer();
		},

		LetTheVideoBeVisibleAgainBis  : function() {	
			try {
				this.theVideo.SetRate(1);
				this.theVideo.Play();
				this.movie_time = this.theVideo.GetTime();
				$('ow_id_timecode').update(this.timecode());
				if (this.button_play_pause_exist)	{ 
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
				}
			} catch (e) {
				alert('Looks like your browser can not catch back the video object. Please send an email to oroa@opsomai.com');	
				LetTheVideoBeVisibleAgainBis.bind(this).defer();
			}
		},

		ShowHelpPanel: function(_event)	{
			if (_event) {
				_event.stop();
			}			
			if (this.help_panel.hasClassName('ow_helpFloatingAboveAll'))	{
				this.HideHelpPanel();
				return;
			}
			// $(this.plugin_to_register_events).stopObserving();

			if (!this.movie_options.help_panel_target)	{	// in that case the help panel is attach to the container
				this.StopTheVideo();
				this.player_panel.style.visibility= 'hidden';
			}
			this.help_panel.show();
			this.help_panel.removeClassName('ow_hiddenBelow');	
			this.help_panel.addClassName('ow_helpFloatingAboveAll');
			this.help_panel.observe('click', this.HideHelpPanel.bindAsEventListener(this));			
		},

		HideHelpPanel: function(_event)	{
			if (_event) {
				_event.stop();
			}

			this.help_panel.removeClassName('ow_helpFloatingAboveAll');	
			this.help_panel.addClassName('ow_hiddenBelow');		
			this.help_panel.hide();
			this.help_panel.stopObserving();
			if (! this.movie_options.help_panel_target)	{	// in that case the help panel is attach to the container
				this.player_panel.style.visibility= 'visible';	
			}
			
			// this.RegisterEvents.bind(this).defer();		
		},
				
				
		RegisterEvents:	function() {
			this.plugin_to_register_events = document.getElementById(this.movie_options.name);
			if ( null == this.plugin_to_register_events )	{
				this.plugin_to_register_events = document.getElementById(this.movie_options.name+'emb');
				if ( null == this.plugin_to_register_events )	{               
					alert("Bug when trying to get a pointer to the encapsulating object. Please contact pascal.vuylsteker@opsomai.com ");
                	return;
				}
            }	else	{
				
			}
 
            this.AddListener('qt_begin',       	this.IsPluginReady.bindAsEventListener(this), false);
            this.AddListener('qt_abort',         	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_canplay',       	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_canplaythrough',	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_durationchange',	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_ended',         	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_error',         	this.CheckThePluginIsLoaded.bindAsEventListener(this), false);
            this.AddListener('qt_load',         	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_loadedfirstframe',	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_loadedmetadata',	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_pause',         	this.StopTimerPosition.bindAsEventListener(this), false);
            this.AddListener('qt_play',          	this.StartTimerPosition.bindAsEventListener(this), false);
            this.AddListener('qt_progress',      	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_stalled',       	this.OnEvent.bindAsEventListener(this), false);
            this.AddListener('qt_timechanged',   	this.UpdatePosition.bindAsEventListener(this), false);
            this.AddListener('qt_volumechange',  	this.SoundChangedFromQT.bindAsEventListener(this), false);            
            this.AddListener('qt_waiting',        	this.OnEvent.bindAsEventListener(this), false);          
		},
		
		AddListener:	function(_event, _function, _captures) {
			
			$(this.plugin_to_register_events).observe(_event, _function) 
			
			// if ( document.addEventListener )
			// 	this.plugin_to_register_events.addEventListener(_event, _function, _captures);
			// else  if ( document.attachEvent )
			// 	this.plugin_to_register_events.attachEvent('on' + _event, _function); // IE requires this form
			// else
			// 	this.plugin_to_register_events["on" + type] = func;
		},
		
		StartTimerPosition: function(_event)	{
			if (this.timer_position)	{
				this.timer_position.start();
			}	else	{
				this.OnEvent(_event);
			}
			
			if (this.button_play_pause_exist)	{ 
				$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
			}
			this.FocusToTheVideo();
		},
		StopTimerPosition:function(_event)	{
			this.timer_position.stop();
			if (this.button_play_pause_exist)	{ 
				if (this.rewind_speed < 0) {
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
				}	else	{
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
				}
			}
			this.resetJogleIfNecessary();
			// this.UpdatePosition();  // One last time ? XXXXXXXXXXXX
			this.FocusToTheVideo();
		},
		
		
		IsPluginReady: function()	{
			if (this.theVideo)	{
				return(true);	// The reference is already known
			}	else 	{
				// this.theVideo = this.plugin_to_register_events;

				// this.theVideo = document.getElementById(this.movie_options.name);
				// if ( null == this.theVideo )	{
				// 	this.theVideo = document.getElementById(this.movie_options.name+'emb');
				// 	if ( null == this.theVideo )	{               
				// 		alert("Bug when trying to get a pointer to the encapsulating object. Please contact pascal.vuylsteker@opsomai.com ");
				// 	                	return(false);
				// 	}
				// 	            }

				this.theVideo = document.movie1;
				
				this.plugin_status = '';
				try {
					this.plugin_status = this.theVideo.GetPluginStatus();

					if (this.plugin_status == '')	{
						this.theVideo = null;
						return(false);
					}	else	{
						// if(this.movie_options.debug_mode) $('debug1').update('Plugin is ready');
						return(true);
					}
				}
				catch(err)	{
					txt="The plugin was not ready yet.\n";
					txt+="Error description: " + err.description + "\n";
				//	alert(txt);
					if(this.movie_options.debug_mode) $('debug1').update('updateChargementError '+ this.debug1++ +txt);
					this.theVideo = null;
					return(false);
				}
			}
		},
		
		OnEvent: function(_event)	{
			var opts = this.movie_options;

			if ((this.plugin_status != 'OK') &&	this.IsPluginReady()) {
				this.plugin_status = this.theVideo.GetPluginStatus();
				this.duration = this.theVideo.GetDuration(); 
				this.movie_time_scale = this.theVideo.GetTimeScale();

				if (		(this.plugin_status=='Playable' || this.plugin_status=='Complete') 
						&&	(this.duration > 0)
						&& 	(this.movie_time_scale > 0)	)	{	
					// Done the first time a event is sent while the plugin is ready							

					this.CreateSliders();

					// Set the timecode as soon as the movie is playable
					if ($('ow_id_timecode'))	{
						// if(opts.debug_mode) $('debug2').update('movie OK PAS  OK '+ this.debugProb++);
						this.movie_time = 0;
						$('ow_id_timecode').update(this.timecode());
					}

					if(opts.timecode_IN)	{
						this.tcIN_in_QTTime = this.LongTimeCodeToQTTime(opts.timecode_IN) - opts.timecode_lag_in_second*this.movie_time_scale;
						this.tcIN_in_QTTime = (this.tcIN_in_QTTime>=0 ? this.tcIN_in_QTTime : 0);
					} 	else	{
						this.tcIN_in_QTTime = 0;
					}
					this.beg_current_selection = this.tcIN_in_QTTime;					

					if(opts.autoplay)   this.reach_the_beginning=false;

					this.theVideo.SetVolume(128);


					this.timer_position = new PeriodicalExecuter( this.UpdatePosition.bind(this), 0.69);
									
					this.plugin_status ='OK';										
				}				
			}	
			if (this.plugin_status != 'OK')	return(false);
				
			// =================== The plugin is ready to deal with the event
			switch ( _event.type )	{
				case 'qt_play':
				// 	this.timer_position.start();
					break;
				case 'qt_pause':
				// 	this.timer_position.stop();
					break;
				case 'qt_canplay':
					// document.getElementById("movie_duration").innerHTML = plugin.GetDuration();
					// document.getElementById("movie_volume").innerHTML = plugin.GetVolume();
					// document.getElementById("movie_rate").innerHTML = plugin.GetRate();
					break;
				case 'qt_volumechange':
					// document.getElementById("movie_volume").innerHTML = plugin.GetVolume();
					break;
				case 'qt_progress':
					this.qt_progress_events++;
					if (this.qt_progress_events%3 > 0) {
						// $('debug3').update('Skipped qt_progress event '+ this.debug3++);
						break;
					}
				case 'qt_load':
					this.UpdateChargement(_event.type);
					break;
				case 'qt_stalled':
					break;
			}
			// if(this.movie_options.debug_mode) 
			// 	$('debugProb').update('event:'+_event.type+' / qt_progress_events%3: '+ (this.qt_progress_events%3) + ' / '+ this.debugProb++);
		},
		
		// Called through event, when the some download progress is detected if the plugin is OK
		UpdateChargement: function(_event_type) {
			// if(this.movie_options.debug_mode) 
			// 	$('debugChar').update('UpdateChargement '+ _event_type + ' / ' + this.debugChar++);

			var opts = this.movie_options;

			this.duration = this.theVideo.GetDuration(); 	
			this.tmpMaxTimeLoaded = this.theVideo.GetMaxTimeLoaded();
			this.chargement = Math.round(this.tmpMaxTimeLoaded/this.duration * 1000);
			
			// update des tcin et tcout en tenant compte de la derniere evaluation de la duree de la video
			if(opts.timecode_OUT)	{
				this.tcOUT_in_QTTime = this.LongTimeCodeToQTTime(opts.timecode_OUT) - 
										opts.timecode_lag_in_second*this.movie_time_scale;
				this.tcOUT_in_QTTime = (this.tcOUT_in_QTTime <= this.duration ? 
										this.tcOUT_in_QTTime : this.duration);
			} 	else	{
				this.tcOUT_in_QTTime = this.duration;
			}
			
			if(!this.flag_sub_selection_set) {
				this.end_current_selection = this.tcOUT_in_QTTime;
				this.theVideo.SetEndTime(this.end_current_selection);
			}	
							
			// if (this.chargement>950)	
			if ( (this.theVideo.GetPluginStatus() =='Complete') && (this.chargement>=950) )	{
				this.chargement = 1000;
				this.chargementDone = true;
				// Let's get the latest one, because with some format, QT use an estimation of their value at the beginning of the download
				this.duration = this.theVideo.GetDuration(); 
				this.movie_time_scale = this.theVideo.GetTimeScale();
				if(opts.timecode_OUT)	{
					this.tcOUT_in_QTTime = this.LongTimeCodeToQTTime(opts.timecode_OUT) - opts.timecode_lag_in_second*this.movie_time_scale;
					this.tcOUT_in_QTTime = (this.tcOUT_in_QTTime <= this.duration ? this.tcOUT_in_QTTime : this.duration);
				} 	else	{
					this.tcOUT_in_QTTime = this.duration;
				}
				if(opts.timecode_IN)	{
					this.tcIN_in_QTTime = this.LongTimeCodeToQTTime(opts.timecode_IN) - opts.timecode_lag_in_second*this.movie_time_scale;
					this.tcIN_in_QTTime = (this.tcIN_in_QTTime>=0 ? this.tcIN_in_QTTime : 0);
				} 	else	{
					this.tcIN_in_QTTime = 0;
				}
				
				
				if(!this.flag_sub_selection_set) {
					this.end_current_selection = this.tcOUT_in_QTTime;
					this.beg_current_selection = this.tcIN_in_QTTime;
					
					this.theVideo.SetEndTime(this.end_current_selection);
					this.theVideo.SetStartTime(this.beg_current_selection);
				}	else	{
					this.SetSelection.bind(this).delay(1,this.beg_current_selection_TC, this.end_current_selection_TC);
				}
				if (opts.timecode_with_frame) {
					this.timer_position.changeFrequency(0.19);
				}				
				
			} 

			this.context_update_chargement=true;				
			this.position_slider.setValue(this.chargement, 1);

			if ( !this.context_update_position)	{
				this.context_update_position=true;
				this.position_slider.setValue(this.position, 0);	
				this.context_update_position=false;
			}			

			this.context_update_chargement=false;
			
			this.tmpMaxTimeLoaded = this.theVideo.GetMaxTimeLoaded();
			if(this.flag_sub_selection_set)	{		// une selection est deja en cours				
				this.beg_current_selection_vis = (	this.beg_current_selection > this.tmpMaxTimeLoaded ?  
													this.tmpMaxTimeLoaded : this.beg_current_selection );
				this.end_current_selection_vis = (	this.end_current_selection > this.tmpMaxTimeLoaded ?
					 								this.tmpMaxTimeLoaded : this.end_current_selection);
				this.SetSelectionBar(	1000*this.beg_current_selection_vis/this.duration,
					 					1000*this.end_current_selection_vis/this.duration);						
			}
			
			if (opts.onLoadingUpdate) opts.onLoadingUpdate(this.chargement/10);
			// this.FocusToTheVideo();
		},
		
		FocusToTheVideo: function()	{
			// this.plugin_to_register_events.focus();
			document.movie1.focus();
			// document.movie1emb.focus();
			// $('movieplayer').focus();
		},

		// Fonction appelee regulierement pour positionner correctement la timeline 
		UpdatePosition: function(timer) {
			// if(this.movie_options.debug_mode) $('debugPos').update(this.debugPos++);
			// if less than one frame since the last update, just forget it
			var time = new Date().getTime();
			if (	( time - this.time_last_position_update ) < this.min_time_between_position_update	)	{
				// if(this.movie_options.debug_mode) $('debug2').update('Positions jumped over '+ this.debug2++ + ' / '+ ( time - this.time_last_position_update ));
				return(false);
			}				

			if (this.duration > 0)	{
				this.movie_time = this.theVideo.GetTime();
				this.new_position = Math.round(this.movie_time/this.duration * 1000);
				this.rate = this.theVideo.GetRate();

				//if(this.movie_options.debug_mode) $('debug2').update('NP'+this.new_position+' R'+this.rate);
				//	DEBUG071109 this.new_position<100 =  this.new_position<10
				// 		des clics vers le debut de la barre de progression cause des sauts en fin de barre
				// 		risque potentiel de dereglage de la protection en avance rapide
				//		if ( (this.rate>0) && ( ( (this.new_position<position) && (this.new_position<100) ) || (this.new_position>998) ) )	
				if  (this.rate>0)	{
					if (this.rewind_speed < 0) {
						this.manual_rewind_timer.stop();
						this.rewind_speed=0;
					}
					if (	((this.new_position<this.position) && (this.new_position<10))	
							||	(this.new_position>998)	) {	
						// Quand QT retourne au debut de la video apres avoir atteint le bout
						// ou quand on arrive a la fin de la video
					this.EndOfVideo();
					};

				}   
				else if (	(this.rate<0)  
							&&	(  ((this.new_position>this.position) && (this.new_position>990)) 
								||	(this.new_position < 2) 	)	)	{
					// Quand on saute a la fin de la video apres avoir atteint 
					// le debut en retour rapide
					// ou quand on arrive au debut de la video
					if (this.rewind_speed < 0) {
						this.manual_rewind_timer.stop();
						this.rewind_speed=0;
					}
					this.theVideo.Stop();
					if (this.button_play_pause_exist)	{ 
						$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
					}
					this.new_position = 0;
					this.movie_time = 0;
					this.theVideo.SetTime(0);
					$('ow_id_timecode').update(this.timecode());
					this.reach_the_end = false;
					this.reach_the_beginning = true;				
				}	
				// else if ( (this.rate == 0) &&  (this.new_position>998) )	{			
				// Le tempon precedent etait util quand on coupait le timer position quand une video atteignait la fin, ce qui n'est plus le cas aujourd'hui	
				else if ( (this.rate == 0) &&  (this.new_position>=1000) && (! this.movie_options.doNothingOnMovieFinished) )	{			
					// Quand QT arrive a la fin et s'arrete sans que javascript 
					// n'ai eu le temps de le detecter
					this.EndOfVideo();
				}
				if (this.new_position != this.position)	{
					if (!this.context_update_position)	{
						// if(this.movie_options.debug_mode) $('debug1').update('Position updated '+ this.debug1++);
						this.context_update_position=true;
						this.position_slider.setValue(this.new_position, 0);	
						this.context_update_position=false;
						this.position = this.new_position;						
					}
				}
				$('ow_id_timecode').update(this.timecode());
				this.time_last_position_update = new Date().getTime();
			}
			return true;
		},

		UpdatePosWhenRewind  : function() {
			this.date_for_rewind = new Date();
			this.new_time_for_rewind = this.date_for_rewind.getTime();
			this.new_position_for_rewind = this.last_position_for_rewind + ((this.new_time_for_rewind - this.last_time_for_rewind)/1000)  * this.rewind_speed * this.theVideo.GetTimeScale();
			if ( this.new_position_for_rewind<this.beg_current_selection ) {
				this.new_position_for_rewind = this.beg_current_selection;
				this.manual_rewind_timer.stop();
				this.rewind_speed=0;
				this.theVideo.Stop();
				this.resetJogleIfNecessary();
				if (this.button_play_pause_exist)	{ 
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
				}
			}
			this.theVideo.SetTime(this.new_position_for_rewind);
			this.last_position_for_rewind = this.new_position_for_rewind;
			this.last_time_for_rewind = this.new_time_for_rewind;
			return true;
		},

		resetJogleIfNecessary  : function() {
			if (this.jogWasSet)	{
				this.jogWasSlidedAndSet = true;
				this.jogWasSet = false;
				this.jog_slider.setValue(2);
				if($('ow_id_jog_value'))	{
					$('ow_id_jog_value').update(' ');
				}
			}
		},

		Rewind  : function() { 	// Called by the Rewind button
			this.last_position_for_rewind = this.theVideo.GetTime();
			if((this.plugin_status=='OK') && !this.reach_the_beginning && (this.last_position_for_rewind>this.beg_current_selection))	{
				this.video_should_be_relaunched = false;
				this.resetJogleIfNecessary();
				// this.lanceVideoAvecTimer();
				this.rate = -1;
				if (this.quicktime_version <= this.last_QT_version_for_manual_rewind)	{
					this.theVideo.Stop();
					if (this.button_play_pause_exist)	{ 
						$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_play']);
					}
					this.rewind_speed = -1;
					this.date_for_rewind = new Date();
					this.last_time_for_rewind = this.date_for_rewind.getTime();
					this.last_position_for_rewind = this.theVideo.GetTime();
					if (this.manual_rewind_timer)	{
						this.manual_rewind_timer.start();
					}	else	{
						this.manual_rewind_timer = new PeriodicalExecuter( this.UpdatePosWhenRewind.bind(this), 0.099);
					}			

				}	else	{
					this.theVideo.SetRate(-1);
				}

				this.reach_the_end = false;
			}
			this.FocusToTheVideo();
		},

		FastRewind  : function() { 	// Called by the Fast Rewind button
			this.last_position_for_rewind = this.theVideo.GetTime();
			if((this.plugin_status=='OK') && !this.reach_the_beginning && (this.last_position_for_rewind>this.beg_current_selection))	{
				this.video_should_be_relaunched = false;
				this.resetJogleIfNecessary();
				// this.lanceVideoAvecTimer();
				this.rate = -2;
				if (this.button_play_pause_exist)	{ 
					$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
				}
				if (this.quicktime_version <= this.last_QT_version_for_manual_rewind)	{
					this.theVideo.Stop();
					this.rewind_speed = -2;
					this.date_for_rewind = new Date();
					this.last_time_for_rewind = this.date_for_rewind.getTime();
					this.last_position_for_rewind = this.theVideo.GetTime();
					if (this.manual_rewind_timer)	{
						this.manual_rewind_timer.start();
					}	else	{
						this.manual_rewind_timer = new PeriodicalExecuter( this.UpdatePosWhenRewind.bind(this), 0.099);
					}			
				}	else	{
					this.theVideo.SetRate(-2);
				}
				this.reach_the_end = false;
			}
			this.FocusToTheVideo();
		},

		FastForward  : function() { 	// Called by the Fast Foward button
			if (this.button_play_pause_exist)	{ 
				$$('#ow_bouton_play_pause img')[0].writeAttribute('src',  this.movie_options.imageRootURL+this.movie_options.images['ow_bouton_pause']);
			}
			if((this.plugin_status=='OK') && !this.reach_the_end)	{
				if (this.rewind_speed < 0) {
					this.manual_rewind_timer.stop();
					this.rewind_speed=0;
				}
				this.video_should_be_relaunched = false;
				this.resetJogleIfNecessary();
				// this.lanceVideoAvecTimer();
				this.theVideo.SetRate(2.5);
				this.reach_the_beginning = false;
			}
			this.FocusToTheVideo();
		},

		SoundChangedFromQT	: function()	{ 
			if (this.sound_slider_set_volume_flag)	{
				this.sound_slider_set_volume_flag = false;
				return;
			}
			this.sound_slider.setValue(this.theVideo.GetVolume());
		},

		SetSoundVolume: function(theVolume) {
			if(this.plugin_status=='OK') {
				this.sound_slider.setValue(theVolume);
				this.sound_set_once=true;			
			}
			this.FocusToTheVideo();
		},

		SetSelectionBar: function(_beginning, _end)	{
			var opts = this.movie_options;
			var cursorWidth = 7;     				// XXXXXXXXXXXXXXXX
			// alert('About to set the width : '+Math.round(opts.position_slider_width*(1-(1000-_end+_beginning)/1000)));
			$('ow_navigation_selected_extract').setStyle({
				width:Math.round((opts.position_slider_width-cursorWidth)*(_end-_beginning)/1000 + cursorWidth)+'px',
			 	left:Math.round(1+opts.position_slider_width*_beginning/1000)+'px' });			
			 	// left:Math.round(1+opts.position_slider_width*_beginning/1000)+'px' });			
		},
		
		SetSelectionBarTarget: function(_beginning, _end)	{
			var opts = this.movie_options;
			// alert('About to set the width : '+Math.round(opts.position_slider_width*(1-(1000-_end+_beginning)/1000)));
			$('ow_navigation_selected_target').setStyle({ width:Math.round(opts.position_slider_width*(1-(1000-_end+_beginning)/1000))+'px',
			 												left:Math.round(1+opts.position_slider_width*_beginning/1000)+'px' });			
		},
		
		SetSelection: function(_begTC, _endTC)	{
			var opts = this.movie_options;
			this.flag_sub_selection_set = true;
			this.beg_current_selection_TC = _begTC;
			this.end_current_selection_TC = _endTC;
			
			this.beg_current_selection = this.LongTimeCodeToQTTime(_begTC) - opts.timecode_lag_in_second*this.movie_time_scale;
			this.beg_current_selection = (this.tcIN_in_QTTime <= this.beg_current_selection ? this.beg_current_selection : this.tcIN_in_QTTime);

			this.end_current_selection = this.LongTimeCodeToQTTime(_endTC) - opts.timecode_lag_in_second*this.movie_time_scale;
			this.end_current_selection = (this.end_current_selection <= this.tcOUT_in_QTTime ? this.end_current_selection : this.tcOUT_in_QTTime);
			
			if (this.beg_current_selection > this.end_current_selection)	{
				var tmp = this.beg_current_selection;
				this.beg_current_selection = this.end_current_selection;
				this.end_current_selection = tmp;
			}
			
			this.theVideo.SetStartTime(this.beg_current_selection);
			this.theVideo.SetEndTime(this.end_current_selection);
			
			this.tmpMaxTimeLoaded = this.theVideo.GetMaxTimeLoaded();
			this.beg_current_selection_vis = (this.beg_current_selection > this.tmpMaxTimeLoaded ?   this.tmpMaxTimeLoaded : this.beg_current_selection );
			this.end_current_selection_vis = (this.end_current_selection > this.tmpMaxTimeLoaded ? this.tmpMaxTimeLoaded : this.end_current_selection);
			
			
			this.SetSelectionBarTarget(1000*this.beg_current_selection/this.duration, 1000*this.end_current_selection/this.duration);	
			$('ow_navigation_selected_target').setStyle({ visibility:'visible' });
			
			this.SetSelectionBar(1000*this.beg_current_selection_vis/this.duration, 1000*this.end_current_selection_vis/this.duration);	
			$('ow_navigation_selected_extract').setStyle({ visibility:'visible' });
			$('ow_navigation_selected_extract').observe("mousedown", this.selectionEventHandler );
		    
			// this.GoToBegSelection();	
		},

		SelectionReceiveAClick: function(theEvent)  {
			// alert("MouseDown : " + theEvent + ' Xpos : ' + theEvent.pointerX() +"\nCorrected : " + (theEvent.pointerX() - $('ow_navigation-slider').cumulativeOffset().left -3) +  "\nScaled : " + ((theEvent.pointerX() - $('ow_navigation-slider').cumulativeOffset().left -3)*1000/300)); 
			this.position = ((theEvent.pointerX() - $('ow_navigation-slider').cumulativeOffset().left -3)*1000/300) ;
			this.position_slider.setValue(this.position, 0);	
		},
		
		GetCurrentSelectionEnd: function()	{
			return this.QTTimeToLongTimeCode(this.end_current_selection);
		},

		GetCurrentSelectionBeginning: function()	{
			return this.QTTimeToLongTimeCode(this.beg_current_selection);
		},
		
		UnSetSelection: function()	{
			$('ow_navigation_selected_extract').stopObserving("mousedown", this.selectionEventHandler );
			
			if (this.beg_current_selection>this.tcIN_in_QTTime)	{
				this.reach_the_beginning = false;
			}
			this.beg_current_selection = this.tcIN_in_QTTime;
			if (this.end_current_selection < this.tcOUT_in_QTTime)	{
				this.reach_the_end = false;
			}
			this.end_current_selection = this.tcOUT_in_QTTime;

			this.theVideo.SetStartTime(this.beg_current_selection);
			this.theVideo.SetEndTime(this.end_current_selection);
			
			this.SetSelectionBar(0, 0);	
			$('ow_navigation_selected_extract').setStyle({ visibility:'hidden' });

			this.SetSelectionBarTarget(0, 0);	
			$('ow_navigation_selected_target').setStyle({ visibility:'hidden' });

			this.flag_sub_selection_set = false;
		},
		
		GoToPercent: function(_percent){
			var t = Math.round(_percent * this.duration / 100);
			if(t<=this.theVideo.GetMaxTimeLoaded()){
					this.theVideo.SetTime(t);
			}	else	{
				this.theVideo.SetTime(this.theVideo.GetMaxTimeLoaded());
			}
		},

		// this.movie_time, this.movie_time_scale must had be set properly before the usage of this function
		ShortTimeCode: function() {
			var i=(this.movie_time/this.movie_time_scale) + this.movie_options.timecode_lag_in_second;
			if(i<0) i=-i;
			var s = Math.floor(i%60);
			i=(i-s)/60;
			var m = Math.floor(i%60);
			i=(i-m)/60;
			var h = Math.floor(i%24);
			if(h<10) hx = "0"+h;
			else hx=h;
			if(m<10) mx = "0"+m;
			else mx=m;
			if(s<10) sx = "0"+s;
			else sx=s;
			return hx + ":" + mx + ":" + sx;
		},

		GetCurrentLongTimeCode: function() {
			this.movie_time = this.theVideo.GetTime();
			if ( this.movie_time<this.tcIN_in_QTTime )	{
				this.movie_time = this.tcIN_in_QTTime;
				this.theVideo.SetTime(this.movie_time);
			}
			if ( this.movie_time>this.tcOUT_in_QTTime )	{
				this.movie_time = this.tcOUT_in_QTTime;
				this.theVideo.SetTime(this.movie_time);
			}
			$('ow_id_timecode').update(this.timecode());
			return this.LongTimeCode();
		},
		
		// this.movie_time, this.movie_time_scale must had been set properly before the usage of this function
		LongTimeCode: function() {
			var i=((this.movie_time/this.movie_time_scale)+this.movie_options.timecode_lag_in_second)*25;
			if(i<0) i=-i;
			var f =Math.floor(i%25);
			i=(i-f)/25;
			var s = Math.floor(i%60);
			i=(i-s)/60;
			var m = Math.floor(i%60);
			i=(i-m)/60;
			var h = Math.floor(i%24);
			if(h<10) hx = "0"+h;
			else hx=h;
			if(m<10) mx = "0"+m;
			else mx=m;
			if(s<10) sx = "0"+s;
			else sx=s;
			if(f<10) fx = "0"+f;
			else fx=f;
			return hx + ":" + mx + ":" + sx+ ":" + fx;
		},
		
		QTTimeToLongTimeCode: function(_qtTime) {
			var i=((_qtTime/this.movie_time_scale)+this.movie_options.timecode_lag_in_second)*25;
			if(i<0) i=-i;
			var f =Math.floor(i%25);
			i=(i-f)/25;
			var s = Math.floor(i%60);
			i=(i-s)/60;
			var m = Math.floor(i%60);
			i=(i-m)/60;
			var h = Math.floor(i%24);
			if(h<10) hx = "0"+h;
			else hx=h;
			if(m<10) mx = "0"+m;
			else mx=m;
			if(s<10) sx = "0"+s;
			else sx=s;
			if(f<10) fx = "0"+f;
			else fx=f;
			return hx + ":" + mx + ":" + sx+ ":" + fx;
		},
		
		// this.movie_time_scale must had been set properly before the usage of this function
		// And the Timecode is expected to be properly formated : 'hh:mm:ss:ff or hh:mm:ss.ff'
		LongTimeCodeToQTTime: function(_timecode) {
			var h=parseInt(_timecode.substring(0,2),10);
			var m=parseInt(_timecode.substring(3,5),10);
			var s=parseInt(_timecode.substring(6,8),10);
			var f=parseInt(_timecode.substring(9,11),10);
			var qttime=(((h*60+m)*60+s)*25+f)*(this.movie_time_scale)/25;
			return qttime;
		},
		
		// And the Timecode is expected to be properly formated : 'hh:mm:ss:ff or hh:mm:ss.ff'
		LongTimeCodeToTimeInSecond: function(_timecode) {
			var h=parseInt(_timecode.substring(0,2),10);
			var m=parseInt(_timecode.substring(3,5),10);
			var s=parseInt(_timecode.substring(6,8),10);
			var f=parseInt(_timecode.substring(9,11),10);
			var time=(((h*60+m)*60+s)*25+f)/25;
			return time;
		},
		
		CheckThePluginIsLoaded: function()	{
			// var thisVideo = this.plugin_to_register_events;	
			try	{
				var thisVideo = document.movie1;	
				var thisPluginStatus = thisVideo.GetPluginStatus();
				// ”Error: <error number>”
				if (thisPluginStatus.match(/^Error:\s*(\d*)/))	{
					// alert("Little checking of the state of the plugin : " + thisPluginStatus);
					window.location.reload();
				}
			} catch(e) {
				alert('It looks like the video player cannot reach the video plugin. It will try again in 3s. Please check that quicktime plugin is authorised');
				this.CheckThePluginIsLoaded.bind(this).delay(3);
			}			
		},
		
		DetachMovie: function() {
			// alert('About to detach movie');
			try {
				this.StopTheVideo();
				var movie;
				try {
					movie = document.getElementById(this.movie_options.name);
					if (movie != null) {
						movie.style.display = 'none';
						this.movie_panel.removeChild(movie);
						movie = null;
					}
				} catch(e) {
					// alert('Pas Glop')
					
					try {
						movie = document.getElementsByName(this.movie_options.name)[0];
						if (movie != null) {
							movie.style.display = 'none';
							this.movie_panel.removeChild(movie);
							movie = null;
						}
					} catch (e) {
						// alert('Pas Glop 2')
					}
				}
				try	{
					this.theVideo.remove();
				}	catch (e) {}
								
				this.movie_panel.remove();
				this.controller_panel.remove();
				if (this.end_movie_panel) this.end_movie_panel.remove();
				if (this.end_fullscreen_movie_panel) this.end_fullscreen_movie_panel.remove();
				this.player_panel.remove();
				this.container.remove();
			} catch (e) {
				// alert ('Too Much');
			}

			this.theVideo	 	= null;
			this.movie_panel	= null;
			// alert('Movie detached');
		},
		
		GetQuicktimeDetector: function() {
			return {
				isQTInstalled:function(){
					var U=false;
					if(navigator.plugins&&navigator.plugins.length){
						for(var M=0;M<navigator.plugins.length;M++){
							var g=navigator.plugins[M];
							if(g.name.indexOf("QuickTime")>-1){
								U=true;
							}
						}
					}else{
						qtObj=false;
						execScript("on error resume next: qtObj = IsObject(CreateObject(\"QuickTimeCheckObject.QuickTimeCheck.1\"))","VBScript");
						U=qtObj;
					}
					return U;
				},
				getQTVersion:function(){
					var U="0";
					if(navigator.plugins&&navigator.plugins.length){
						for(var g=0;g<navigator.plugins.length;g++){
							var S=navigator.plugins[g];
							var M=S.name.match(/quicktime\D*([\.\d]*)/i);
							if(M&&M[1]){
								U=M[1];
							}
						}
					}else{
						ieQTVersion=null;
						execScript("on error resume next: ieQTVersion = CreateObject(\"QuickTimeCheckObject.QuickTimeCheck.1\").QuickTimeVersion","VBScript");
						if(ieQTVersion){
							var temp = "";
							U=(ieQTVersion).toString(16)/1000000+"";//(ieQTVersion>>24).toString(16);
							temp += parseInt(U)+".";
							temp += ((parseFloat(U)-parseInt(U))*1000)/100+"";

							//alert(temp);
							U = temp;
						}
					}
					return U;
				},
				isQTCompatible:function(g,j){
					function M(w,R){
						var i=parseInt(w[0],10);
						if(isNaN(i)){
							i=0;
						}
						var V=parseInt(R[0],10);
						if(isNaN(V)){
							V=0;
						}
						if(i===V){
							if(w.length>1){
								return M(w.slice(1),R.slice(1));
							}else{
								return true;
							}
						}else{
							if(i<V){
								return true;
							}else{
								return false;
							}
						}
					}
					var S=g.split(/\./);
					var U=j?j.split(/\./):this.getQTVersion().split(/\./);
					return M(S,U);
				},
				isValidQTAvailable:function(U){
					return this.isQTInstalled()&&this.isQTCompatible(U);
				}
			}
		},

		//  ===========================================================================
		//  PRESETS : Options For some specific web site

		// And the Timecode is expected to be properly formated : 'hh:mm:ss:ff or hh:mm:ss.ff'


		movie_options_LNR: {
			controller_panel_height	: 60	,
			controller_panel_height	: 80 	, 
			timecode_lag			: null	, 
			timecode_lag_in_second	: 0		,
			timecode_with_frame		: false	,	// if true, the frame are displayed
			config_help				: false	,	// to get the help instead of the player
			help					: false	, 	//	shortcut for config_help
			name					: 'movie1',
			autoplay				: true	,
			fullscreen				: false	,
			popUpFullscreen			: true	, 
			urlOfFullscreenPage		: 'ow_template_fullscreen.html'	,	// PHP: document.location.href.gsub(/[#]/, '') + '&FS=on',
			onMovieFinished			: null	,	// Not yet implemented
			onMovieFullScreen		: null	,	
			urlOfReplacementImage	: 'ow_images_LNR/videoPlayer/Play.gif'	,
			urlOfEndImage			: 'ow_images_LNR/videoPlayer/Play.gif'	,
			imageRootURL			: 'ow_images_LNR/',	// location of the images 
			typeMime				: 'video/quicktime',
			language				: 'fr'	,	// 'en' or 'fr' to get tooltips in French or English
			debug_mode				: false	,
			expectedQTversion		: '7.3'	,
			quicktimeDetection		: false	,	
			code_controller 		: '<!-- Controller Design -->								\
				<table border="0" cellpadding="0" cellspacing="0" id="tableSlider">				\
					<!-- First Line +++++++++++++++++++++++++++++++++++++++++++++++     -->		\
					<tr id="ligne-one">															\
						<!-- Progress Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_progress_slider" class="controller" colspan="4">	</td>	\
						<!-- TimeCode +++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="controller-timecode" 											\
						class="controller"><p id="ow_id_timecode">--:--:--</p></td>				\
					</tr>																		\
					<tr id="ligne-two">															\
						<!-- Play  Pause la video +++++++++++++++++++++++++++++++++ 	-->		\
						<td id="navigation-play-pause" class="controller">						\
							<a id="ow_bouton_play"><img/></a>									\
							<a id="ow_bouton_pause"><img/></a>									\
						</td>																	\
						<!-- Avance Retour Rapide +++++++++++++++++++++++++++++++++ 	-->		\
						<td id="navigation-fast">												\
							<a id="ow_bouton_fast_rewind"><img/></a> 							\
							<a id="ow_bouton_fast_forward"><img/></a>							\
						</td>																	\
						<!-- Full Screen  +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="navigation-zone-full-screen" class="controller">				\
							<a id="ow_bouton_fullscreen"><img/></a>								\
							<a id="ow_bouton_mute_sound"><img/></a>								\
						</td>																	\
						<td id="empty"></td>													\
						<!-- Sound  +++++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_sound_slider">	</td>									\
					</tr>																		\
				</table>',
			code_panel_end 			: '<a id="ow_image_end_restart_video"><img></a><br><a id="ow_bouton_play_again"><img></a>',
			code_panel_end_FS		: '<a id="ow_image_end_restart_video"><img></a><br><a id="ow_bouton_fullscreen_end"><img/></a>\
										<a id="ow_bouton_play_again"><img></a>',
			code_end_FS_movie_panel	: '<a id="ow_image_wentFS_restart_video"><img></a><br><a id="ow_bouton_play_again_afterFS"><img></a>',					
			images					: {
				'ow_bouton_play'				: 'Play.gif',
				'ow_bouton_pause'				: 'Pause.gif',
				'ow_bouton_play_pause'			: 'Play.gif',
				'ow_bouton_play_again'			: 'Play.gif',
				'ow_bouton_fast_rewind'			: 'FastRewind.gif',
				'ow_bouton_fast_forward'		: 'FastForward.gif',
				'ow_bouton_fullscreen_open'		: 'CloseFS.gif',
				'ow_bouton_fullscreen_close'	: 'CloseFS.gif',
				'ow_bouton_mute_sound'			: 'BTsonOff.png',				
				'ow_bouton_max_sound'			: 'BTsonOff.png',
				'ow_logo_quicktime'				: 'logo_qtlogo.gif',	
				'ow_background_sound_slider'	: 'Sound.gif'		
			},
			tooltips_fr				: {
				'ow_id_timecode' 				: 'Timecode (HH:mm:ss)',
				'ow_id_timecodeLong' 			: 'Timecode (HH:mm:ss.frame)',
				'ow_id_sound_slider'			: 'Volume sonore',
				'ow_id_progress_slider'			: 'Barre de progression',
				'ow_bouton_play' 				: 'Lance la vidéo',
				'ow_bouton_pause' 				: 'Pause la vidéo',
				'ow_bouton_play_pause' 			: 'Lance ou Pause la vidéo',
				'ow_bouton_play_again'			: 'Relance la vidéo',
				'ow_bouton_fast_rewind' 		: 'Retour Rapide',
				'ow_bouton_fast_forward' 		: 'Avance Rapide',
				'ow_bouton_fullscreen_open'		: 'Ouvre en plein écran',
				'ow_bouton_fullscreen_close'	: 'Ferme la fenêtre',
				'ow_bouton_mute_sound' 			: 'Coupe le son',
				'ow_bouton_max_sound' 			: 'Son au maximum',

				'mes_quicktime_not_up_to_date'	: '<h4>Votre version de QuickTime n\'est pas &agrave; jour</h4><h5>La version attendue est au moins la version : <span id="ow_quicktime_expected_version"></span></h5> <h5>Pour installer une version plus récente de QuickTime <a href="http://www.apple.com/fr/quicktime/download/">téléchargez l\'installeur sur le site d\'Apple (suivez ce lien)</a></h5>',
				'mes_quicktime_not_available'	: '<h4>Vous n\'avez pas QuickTime install&eacute;</h4> <h5>Pour installer QuickTime <a href="http://www.apple.com/fr/quicktime/download/">téléchargez l\'installeur sur le site d\'Apple (suivez ce lien)</a></h5><h5>Si QuickTime est correctement install&eacute; sur votre machine et que ce message apparait quand m&ecirc;me, <a href="mailto:orao@opsomai.com">n\'hésitez pas à nous contacter</a> avec une description de votre configuration (nom et version de votre navigateur, système d\'exploitation et version de Quicktime installée)</h5>'
			},
			tooltips_en				: {
				'ow_id_timecode' 				: 'Timecode (HH:mm:ss)',
				'ow_id_timecodeLong' 			: 'Timecode (HH:mm:ss.frame)',
				'ow_id_sound_slider'			: 'Sound volume',
				'ow_id_progress_slider'			: 'Progress bar',
				'ow_bouton_play' 				: 'Play the video',
				'ow_bouton_pause' 				: 'Stop the video',
				'ow_bouton_play_pause' 			: 'Play or Stop the video (switch)',
				'ow_bouton_play_again'			: 'Restart the video',
				'ow_bouton_fast_rewind' 		: 'Fast rewind',
				'ow_bouton_fast_forward' 		: 'Fast forward',
				'ow_bouton_fullscreen_open'		: 'Switch to FullScreen',
				'ow_bouton_fullscreen_close'	: 'Close the fullscreen window',
				'ow_bouton_mute_sound' 			: 'Sound off',
				'ow_bouton_max_sound' 			: 'Max the sound',

				'mes_quicktime_not_up_to_date'	: '<h4>Your QuickTime is not up to date</h4><h5>The expected version is at least : <span id="ow_quicktime_expected_version"></span></h5>  <h5>To install a recent version of QuickTime, please <a href="http://www.apple.com/quicktime/download/">visit the Apple web site and follow the procedure.</a><h5>',
				'mes_quicktime_not_available'	: '<h4>QuickTime is not installed on your machine</h4> <h5>To install this tool, please <a href="http://www.apple.com/quicktime/download/">visit the Apple web site and follow the procedure.</a><h5><h5>If QuickTime is indeed intalled on your machine, please <a href="mailto:orao@opsomai.com">send us an email</a> with a description of your configuration (name and version of your web browser and Operating System, version of installed QuickTime)</h5>'
			}
		},


		//  ===========================================================================
		//  Preset pour le CNRS

		movie_options_CNRS: {
			width					: 320	,
			height					: 240	,
			window_default_width	: 400	,
			window_default_height	: 350	,
			timecode_with_frame		: true	,	// if true, the frame are displayed
			autoplay				: true	,
			urlOfFullscreenPage		: 'ow_template_fullscreen_CNRS.html'	,	// PHP: document.location.href.gsub(/[#]/, '') + '&FS=on',
			urlOfReplacementImage	: 'ow_images_CNRS/videoPlayer/Play.gif'	,
			urlOfEndImage			: 'ow_images_CNRS/videoPlayer/Play.gif'	,
			imageRootURL			: 'ow_images_CNRS/',	// location of the images 
			doNothingOnMovieFinished: true	,
			popUpFullscreen			: false	, 
			sound_handle_variable	: false	,
			debug_mode				: false	,
			sound_slider_height		: 11	,
			sound_slider_width		: 51	,
			position_slider_width	: 300	,
			controller_panel_height	: 80 	, 
			free_vertical_height	: 110	,
			language				: 'fr'	,	// 'en' or 'fr' to get tooltips in French or English
			expectedQTversion		: '7.3'	,
			quicktimeDetection		: false	,	
			// </td>																	\
			// <!-- Play  Pause la video +++++++++++++++++++++++++++++++++ 	-->		\
			// <td id="navigation-play-pause">											\
			// </td>																	\
			// <!-- Avance  Rapide +++++++++++++++++++++++++++++++++ 	-->				\
			// <td id="navigation-forward">											\
			// </td>																	\
			// <!-- Full Screen  +++++++++++++++++++++++++++++++++++++++++ 	-->		\
			// <td id="navigation-zone-full-screen" class="controller">				\

			code_controller 		: '<!-- Controller Design -->								\
				<table border="0" cellpadding="0" cellspacing="0" id="tableSlider">				\
					<!-- First Line +++++++++++++++++++++++++++++++++++++++++++++++     -->		\
					<tr id="ligne-one">															\
						<!-- Progress Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_progress_slider" class="controller" colspan="2">	</td>	\
					</tr>																		\
					<tr id="ligne-one-bis">														\
						<!-- TimeCode +++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="controller-timecode" colspan="2"								\
						class="controller"><p id="ow_id_timecode">--:--:--</p></td>				\
					</tr>																		\
					<tr id="ligne-two">															\
						<!-- Sound  +++++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_sound_slider">	</td>									\
						<!--  Retour Rapide +++++++++++++++++++++++++++++++++ 	-->				\
						<td id="navigation">												\
							<a id="ow_bouton_go_to_beginning"><img/></a><a id="ow_bouton_fast_rewind"><img/></a><a id="ow_bouton_step_rewind"><img/></a><a id="ow_bouton_play_pause"><img/></a><a id="ow_bouton_step_forward"><img/></a><a id="ow_bouton_fast_forward"><img/></a><a id="ow_bouton_go_to_end"><img/></a><a id="ow_bouton_fullscreen"><img/></a>								\
						</td>																	\
					</tr>																		\
				</table>',
			images					: {
				'ow_bouton_play'				: 'boutons/b_play_petit.gif',
				'ow_bouton_pause'				: 'boutons/b_pause_petit.gif',
				'ow_bouton_play_pause'			: 'boutons/b_play_petit.gif',
				'ow_bouton_play_again'			: 'boutons/b_play_petit.gif',
				'ow_bouton_fast_rewind'			: 'boutons/b_retour_rapide_petit.gif',
				'ow_bouton_fast_forward'		: 'boutons/b_avance_rapide_petit.gif',
				'ow_bouton_step_rewind'			: 'boutons/b_image_avant_petit.gif',
				'ow_bouton_step_forward'		: 'boutons/b_image_apres_petit.gif',
				'ow_bouton_go_to_end'			: 'boutons/b_aller_fin_petit.gif',
				'ow_bouton_go_to_beginning'		: 'boutons/b_aller_debut_petit.gif',
				'ow_bouton_fullscreen_open'		: 'boutons/b_plein_ecran_petit.gif',
				'ow_bouton_fullscreen_close'	: 'boutons/b_plein_ecran_petit.gif',
				'ow_bouton_mute_sound'			: 'boutons/b_hp_droit_petit.png',				
				'ow_bouton_max_sound'			: 'boutons/b_hp_droit_petit.png',
				'ow_bouton_help'				: 'boutons/b_aide_petit.gif',
				'ow_bouton_logo_player'			: 'logo.gif',	
				'ow_logo_quicktime'				: 'logo_qtlogo.gif',
				'ow_image_sound_slider'			: 'volume_slider/b_curseur_volume_petit.png',	
				'ow_background_sound_slider'	: 'volume_slider/sound_bg_petit.gif'		
			}
		},

		//  ===========================================================================
		//  Preset pour OPSIS : defaut pour les client Opsomai opsomai OPSOMAI

		movie_options_OPSIS: {
			width					: 320	,
			height					: 240	,
			controller_panel_width	: 344	,
			controller_panel_height	: 105 	, 
			window_position_x		: 50	,
			window_position_y		: 50	,
			window_default_width	: 400	,
			window_default_height	: 350	,
			free_lateral_width_in_FS: 360	,
			free_vertical_height	: 110	,
			movie_background_color	: '#CCCCCC',
			popUpFullscreen			: false	, 
			timecode_with_frame		: true	,	// if true, the frame are displayed
			autoplay				: true	,
			urlOfReplacementImage	: 'ow_images_OPSIS/boutons/b_play_petit.gif'	,
			urlOfEndImage			: 'ow_images_OPSIS/boutons/b_play_petit.gif'	,
			doNothingOnMovieFinished: true	,
			sound_handle_variable	: true	,
			debug_mode				: false	,
			sound_slider_height		: 11	,
			sound_slider_width		: 51	,
			position_slider_width	: 300	,
			imageRootURL			: 'ow_images_OPSIS/',	// location of the images 
			language				: 'fr'	,	// 'en' or 'fr' to get tooltips in French or English
			expectedQTversion		: '7.1'	,	
			quicktimeDetection		: false	,	
			code_controller 		: '<!-- Controller Design -->								\
				<table border="0" cellpadding="0" cellspacing="0" id="tableSlider">				\
					<!-- First Line +++++++++++++++++++++++++++++++++++++++++++++++     -->		\
					<tr id="ligne-one">															\
						<!-- Progress Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_progress_slider" class="controller" colspan="3">	</td>	\
					</tr>																		\
					<tr id="ligne-one-bis">														\
						<td id="controller-help"><a id="ow_bouton_help"><img/></a></td>			\
						<!-- TimeCode +++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="controller-timecode"><p id="ow_id_timecode">--:--:--:--</p></td>\
						<td id="controller-logo"></td>		\
					</tr>																		\
					<tr id="ligne-two">															\
						<!-- Sound  +++++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_sound_slider">	</td>									\
						<!--  Retour Rapide +++++++++++++++++++++++++++++++++ 	-->				\
						<td id="navigation"  colspan="2">										\
							<a id="ow_bouton_go_to_beginning"><img/></a><a id="ow_bouton_fast_rewind"><img/></a><a id="ow_bouton_step_rewind"><img/></a><a id="ow_bouton_play_pause"><img/></a><a id="ow_bouton_step_forward"><img/></a><a id="ow_bouton_fast_forward"><img/></a><a id="ow_bouton_go_to_end"><img/></a><a id="ow_bouton_fullscreen"><img/></a>								\
						</td>																	\
					</tr>																		\
				</table>',
				
			images					: {
				'ow_bouton_play'				: 'boutons/b_play_petit.png',
				'ow_bouton_pause'				: 'boutons/b_pause_petit.png',
				'ow_bouton_play_pause'			: 'boutons/b_play_petit.png',
				'ow_bouton_play_again'			: 'boutons/b_play_petit.png',
				'ow_bouton_fast_rewind'			: 'boutons/b_retour_rapide_petit.png',
				'ow_bouton_fast_forward'		: 'boutons/b_avance_rapide_petit.png',
				'ow_bouton_step_rewind'			: 'boutons/b_image_avant_petit.png',
				'ow_bouton_step_forward'		: 'boutons/b_image_apres_petit.png',
				'ow_bouton_go_to_end'			: 'boutons/b_aller_fin_petit.png',
				'ow_bouton_go_to_beginning'		: 'boutons/b_aller_debut_petit.png',
				'ow_bouton_fullscreen_open'		: 'boutons/b_plein_ecran_petit.png',
				'ow_bouton_fullscreen_close'	: 'boutons/b_plein_ecran_petit.png',
				'ow_bouton_mute_sound'			: 'boutons/b_hp_droit_petit.png',				
				'ow_bouton_max_sound'			: 'boutons/b_hp_droit_petit.png',
				'ow_bouton_logo_player'			: 'logo.png',	
				'ow_bouton_help'				: 'boutons/b_aide_petit.gif',
				'ow_logo_quicktime'				: 'logo_qtlogo.gif',
				'ow_image_position_slider'		: 'timeline/b_curseur_petit.png',
				'ow_image_selection_start_handle': 'timeline/LCDSliderSelectionStartMarker.gif',	
				'ow_image_selection_end_handle': 'timeline/LCDSliderSelectionEndMarker.gif',	
				// 'ow_image_sound_slider'			: 'volume_slider/b_curseur_volume_petit.png',	
				'ow_background_sound_slider'	: 'volume_slider/sound_bg_petit.gif',
				'ow_background_player'			: 'boutons/cache_fond_bt.png'		
			}

		},



		//  ===========================================================================
		//  Preset pour l'INA : inamediapro

		movie_options_INA: {
			width					: 320	,
			height					: 240	,
			controller_panel_width	: 320	,
			controller_panel_height	: 110 	, 
			free_vertical_height	: 125	,
			window_position_x		: 50	,
			window_position_y		: 50	,
			window_default_width	: 340	,
			window_default_height	: 334	,
			movie_background_color	: '#6c9bb2',
			popUpFullscreen			: false	, 
			timecode_with_frame		: true	,	// if true, the frame are displayed
			autoplay				: true	,
			urlOfFullscreenPage		: 'ow_template_fullscreen_INA.html'	,	// PHP: document.location.href.gsub(/[#]/, '') + '&FS=on',
			urlOfReplacementImage	: 'ow_images_INA/boutons/b_play_petit.gif'	,
			urlOfEndImage			: 'ow_images_INA/boutons/b_play_petit.gif'	,
			doNothingOnMovieFinished: true	,
			sound_handle_variable	: true	,
			debug_mode				: false	,
			sound_slider_height		: 11	,
			sound_slider_width		: 51	,
			position_slider_width	: 300	,
			typeMime				: 'video/mpeg',
			imageRootURL			: 'ow_images_INA/',	// location of the images 
			language				: 'fr'	,	// 'en' or 'fr' to get tooltips in French or English
			expectedQTversion		: '7.3'	,
			quicktimeDetection		: false	,	
//			<td id="controller-logoINA"><a id="ow_bouton_logo_player"><img/></a></td>		\
//			<td id="controller-help"><a id="ow_bouton_help"><img/></a></td>			\
			code_controller 		: '<!-- Controller Design -->								\
				<table border="0" cellpadding="0" cellspacing="0" id="tableSlider">				\
					<!-- First Line +++++++++++++++++++++++++++++++++++++++++++++++     -->		\
					<tr id="ligne-one">															\
						<!-- Progress Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_progress_slider" class="controller" colspan="3">	</td>	\
					</tr>																		\
					<tr id="ligne-jog">															\
						<!-- Jog Shuttle Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_jog_slider" class="controller" colspan="3">	</td>	\
					</tr>																		\
					<tr id="ligne-one-bis">														\
						<td id="controller-help"><a id="ow_bouton_help"><img/></a></td>			\
						<!-- TimeCode +++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="controller-timecode"><p id="ow_id_timecode">--:--:--:--</p></td>\
						<td id="controller-logoINA"><p id="ow_id_jog_value"> </p></td>			\
					</tr>																		\
					<tr id="ligne-two">															\
						<!-- Sound  +++++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_sound_slider">	</td>									\
						<!--  Retour Rapide +++++++++++++++++++++++++++++++++ 	-->				\
						<td id="navigation"  colspan="2">										\
							<a id="ow_bouton_go_to_beginning"><img/></a><a id="ow_bouton_fast_rewind"><img/></a><a id="ow_bouton_step_rewind"><img/></a><a id="ow_bouton_play_pause"><img/></a><a id="ow_bouton_step_forward"><img/></a><a id="ow_bouton_fast_forward"><img/></a><a id="ow_bouton_go_to_end"><img/></a><a id="ow_bouton_fullscreen"><img/></a>								\
						</td>																	\
					</tr>																		\
				</table>',
			images					: {
				'ow_bouton_play'				: 'boutons/b_play_petit.gif'			,
				'ow_bouton_pause'				: 'boutons/b_pause_petit.gif'			,
				'ow_bouton_play_pause'			: 'boutons/b_play_petit.gif'			,
				'ow_bouton_play_again'			: 'boutons/b_play_petit.gif'			,
				'ow_bouton_fast_rewind'			: 'boutons/b_retour_rapide_petit.gif'	,
				'ow_bouton_fast_forward'		: 'boutons/b_avance_rapide_petit.gif'	,
				'ow_bouton_step_rewind'			: 'boutons/b_image_avant_petit.gif'		,
				'ow_bouton_step_forward'		: 'boutons/b_image_apres_petit.gif'		,
				'ow_bouton_go_to_end'			: 'boutons/b_aller_fin_petit.gif'		,
				'ow_bouton_go_to_beginning'		: 'boutons/b_aller_debut_petit.gif'		,
				'ow_bouton_fullscreen_open'		: 'boutons/b_plein_ecran_petit.gif'		,
				'ow_bouton_fullscreen_close'	: 'boutons/b_plein_ecran_petit.gif'		,
				'ow_bouton_mute_sound'			: 'boutons/b_hp_droit_petit.gif'		,			
				'ow_bouton_max_sound'			: 'boutons/b_hp_droit_petit.gif'		,
				'ow_bouton_logo_player'			: 'logo.gif'							,	
				'ow_bouton_help'				: 'boutons/b_aide_petit.gif'			,
				'ow_logo_quicktime'				: 'logo_qtlogo.gif'						,
				'ow_image_position_slider'		: 'timeline/curseur.gif'				,
				// 'ow_image_sound_slider'			: 'volume_slider/b_curseur_volume_petit.gif',	
				'ow_background_sound_slider'	: 'volume_slider/sound_bg_petit.gif'	,	
				'ow_background_jog_slider'		: 'jogshuttle/barre_jogshuttle.png'		,
				'ow_image_jog_slider'			: 'jogshuttle/b_curseur_jogshuttle_petit.png'		,
				'ow_bouton_beg_selection'		: 'boutons/b_definir_debut_petit.gif'	,	
				'ow_bouton_end_selection'		: 'boutons/b_definir_fin_petit.gif'		,	
				'ow_bouton_save_selection'		: 'boutons/b_disquette_petit.png'		,	
				'ow_bouton_new_selection'		: 'boutons/b_nouv_chap_petit.gif'		,	
				'ow_bouton_annotate_selection'	: 'boutons/b_annoter_petit.gif'
			}
			
		},


		//  ===========================================================================
		//  Preset pour le site de Demo

		movie_options_DEMO: {
			width					: 320	,
			height					: 240	,
			controller_panel_width	: 320	,
			controller_panel_height	: 110 	, 
			free_vertical_height	: 125	,
			window_position_x		: 50	,
			window_position_y		: 50	,
			window_default_width	: 340	,
			window_default_height	: 334	,
			movie_background_color	: '#6c9bb2',
			popUpFullscreen			: false	, 
			timecode_with_frame		: true	,	// if true, the frame are displayed
			autoplay				: true	,
			urlOfReplacementImage	: 'ow_images_Demo/boutons/b_play_petit.gif'	,
			urlOfEndImage			: 'ow_images_Demo/boutons/b_play_petit.gif'	,
			doNothingOnMovieFinished: true	,
			sound_handle_variable	: true	,
			debug_mode				: false	,
			sound_slider_height		: 11	,
			sound_slider_width		: 51	,
			position_slider_width	: 300	,
			typeMime				: 'video/mpeg',
			imageRootURL			: 'ow_images_Demo/',	// location of the images 
			language				: 'fr'	,	// 'en' or 'fr' to get tooltips in French or English
			expectedQTversion		: '7.3'	,
			quicktimeDetection		: false	,	
			code_controller 		: '<!-- Controller Design -->								\
				<table border="0" cellpadding="0" cellspacing="0" id="tableSlider">				\
					<!-- First Line +++++++++++++++++++++++++++++++++++++++++++++++     -->		\
					<tr id="ligne-one">															\
						<!-- Progress Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_progress_slider" class="controller" colspan="3">	</td>	\
					</tr>																		\
					<tr id="ligne-jog">															\
						<!-- Jog Shuttle Bar +++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_jog_slider" class="controller" colspan="3">	</td>	\
					</tr>																		\
					<tr id="ligne-one-bis">														\
						<td id="controller-help"><a id="ow_bouton_help"><img/></a></td>			\
						<!-- TimeCode +++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="controller-timecode"><p id="ow_id_timecode">--:--:--:--</p></td>\
						<td id="controller-logoINA"><p id="ow_id_jog_value"> </p></td>			\
					</tr>																		\
					<tr id="ligne-two">															\
						<!-- Sound  +++++++++++++++++++++++++++++++++++++++++++++++ 	-->		\
						<td id="ow_id_sound_slider">	</td>									\
						<!--  Retour Rapide +++++++++++++++++++++++++++++++++ 	-->				\
						<td id="navigation"  colspan="2">										\
							<a id="ow_bouton_go_to_beginning"><img/></a><a id="ow_bouton_fast_rewind"><img/></a><a id="ow_bouton_step_rewind"><img/></a><a id="ow_bouton_play_pause"><img/></a><a id="ow_bouton_step_forward"><img/></a><a id="ow_bouton_fast_forward"><img/></a><a id="ow_bouton_go_to_end"><img/></a><a id="ow_bouton_fullscreen"><img/></a>								\
						</td>																	\
					</tr>																		\
				</table>',
			images					: {
				'ow_bouton_play'				: 'boutons/b_play_petit.gif'			,
				'ow_bouton_pause'				: 'boutons/b_pause_petit.gif'			,
				'ow_bouton_play_pause'			: 'boutons/b_play_petit.gif'			,
				'ow_bouton_play_again'			: 'boutons/b_play_petit.gif'			,
				'ow_bouton_fast_rewind'			: 'boutons/b_retour_rapide_petit.gif'	,
				'ow_bouton_fast_forward'		: 'boutons/b_avance_rapide_petit.gif'	,
				'ow_bouton_step_rewind'			: 'boutons/b_image_avant_petit.gif'		,
				'ow_bouton_step_forward'		: 'boutons/b_image_apres_petit.gif'		,
				'ow_bouton_go_to_end'			: 'boutons/b_aller_fin_petit.gif'		,
				'ow_bouton_go_to_beginning'		: 'boutons/b_aller_debut_petit.gif'		,
				'ow_bouton_fullscreen_open'		: 'boutons/b_plein_ecran_petit.gif'		,
				'ow_bouton_fullscreen_close'	: 'boutons/b_plein_ecran_petit.gif'		,
				'ow_bouton_mute_sound'			: 'boutons/b_hp_droit_petit.gif'		,			
				'ow_bouton_max_sound'			: 'boutons/b_hp_droit_petit.gif'		,
				'ow_bouton_logo_player'			: 'logo.gif'							,	
				'ow_bouton_help'				: 'boutons/b_aide_petit.gif'			,
				'ow_logo_quicktime'				: 'logo_qtlogo.gif'						,
				'ow_image_position_slider'		: 'timeline/curseur.gif'				,
				// 'ow_image_sound_slider'			: 'volume_slider/b_curseur_volume_petit.gif',	
				'ow_background_sound_slider'	: 'volume_slider/sound_bg_petit.gif'	,	
				'ow_background_jog_slider'		: 'jogshuttle/barre_jogshuttle.png'		,
				'ow_image_jog_slider'			: 'jogshuttle/b_curseur_jogshuttle_petit.png'		,
				'ow_bouton_beg_selection'		: 'boutons/b_definir_debut_petit.gif'	,	
				'ow_bouton_end_selection'		: 'boutons/b_definir_fin_petit.gif'		,	
				'ow_bouton_save_selection'		: 'boutons/b_disquette_petit.png'		,	
				'ow_bouton_new_selection'		: 'boutons/b_nouv_chap_petit.gif'		,	
				'ow_bouton_annotate_selection'	: 'boutons/b_annoter_petit.gif'
			}

		},


				
		//  ===========================================================================
		//  HELP to the Installation and the configuration / Aide config help aide

		// And the Timecode is expected to be properly formated : 'hh:mm:ss:ff or hh:mm:ss.ff'
		AttachConfigHelpPanel: function() {
			var code = '<div id="ow_configuration_panel"><h1>How to Configure OroaWeb</h1>\n';
			code += '<p>Start with a look at the two main template : <a href="ow_template.html">ow_template</a> for the main page or the iFrame and <a href="ow_template_fullscreen.html">ow_template_fullscreen</a> which is the page that will be used when opening a full screen window (there is no need for this second template when the option \'popUpFullscreen\' is set to false).</p>';
			code += '<p>Then have a look at the template <b>using a preset</b> : <ul><li>CNRS "<code> preset :\'movie_options_CNRS\', </code>" : <a href="ow_template_CNRS.html">ow_template_CNRS</a> for the main page or the iFrame and <a href="ow_template_fullscreen_CNRS.html">ow_template_fullscreen_CNRS</a> ( +  <a href="ow_css_CNRS.css">ow_css_CNRS.css</a>)</li><li>INA  "<code> preset :\'movie_options_INA\', </code>" : a window that will be resized by the the player and with a lateral div to place the extract list : <a href="ow_template_INA.html">ow_template_INA</a> ( +  <a href="ow_css_INA.css">ow_css_INA.css</a>)</li><li>LNR  "<code> preset :\'movie_options_LNR\', </code>" : <a href="ow_template_LNR.html">ow_template_LNR</a> for the main page or the iFrame and <a href="ow_template_fullscreen_LNR.html">ow_template_fullscreen_LNR</a> ( +  <a href="ow_css_LNR.css">ow_css_LNR.css</a>)</li><li>OPSIS  "<code> preset :\'movie_options_OPSIS\', </code>" , the latest one, default for OPSIS project, eg the "Ateliers des Images" : a window that will be resized by the the player and with a lateral div to place the extract list : <a href="ow_template_OPSIS.html">ow_template_OPSIS</a> ( +  <a href="ow_css_OPSIS.css">ow_css_OPSIS.css</a>)</li></ul><br> There are just two slight modifications :<ul><li>a <a href="ow_css_CNRS.css">complementary CSS file (\'ow_css_CNRS\')</a> is added to the header AFTER the default one (Note that you should do the same when you want to alterate the default preset)</li><li>a property (<a href="#Preset">see info on \'preset\'</a>) is added to specify a preset (if you want to add one, otherwise, the default one is used)</li></ul></p>';
			code += '<p>You will notice that all the configuration (except for the name of the container) is done by filling an hash table of properties. For instance as soon as this hash table set the \'config_help\' property to  \'true\', this present help panel is diplayed instead of the actual OraoWeb Quicktime viewer</p>';
			code += '<h4>To install OroaWeb, you need</h4> <ol><li><a href="'+ this.movie_options.imageRootURL +'">A directory full of images</a> (<b>Opsis:</b> \'/design/images/ow_images/\')</li><li>Two CSS files :<a href="ow_css.css">the default ow_css.css</a>  and the preset specific one (<b>Opsis:</b> \'/design/ow_css.css\')</li><li><a href="ow_javascript/">A set of 4 javascript files</a> (<b>Opsis:</b>\'/ow_javascript/\') : AC_QuickTime (Apple, to write the QT plugin call), OPS_prototype1602 (modified version of prototype 1.6.0.2), slider (Spriptaculous) and OW_Player : the main work from Opsomai</li><li>One or two template files (<a href="ow_template.html">ow_template</a> and <a href="ow_template_fullscreen.html">ow_template_fullscreen</a>) as examples of inclusion of the player into an HTML page (<b>Opsis:</b> visualisationQT.inc.php and video.html)</li></ol>';
			code += '<h3>The version of OraoWeb you are looking at is : '+ OW_OraoWeb_version + ' released on the '+ OW_OraoWeb_version_release_date + '</h3>';
			code += '<p>You can allways get the <b>latest stable version</b> at : <a href="'+OW_OraoWeb_host+'/stable/ow_help.html">'+OW_OraoWeb_host+'/stable/ow_help.html</a><br> This stable release is also available on the official opsomai demo web site : <a href="http://demo.opsismedia.com">http://demo.opsismedia.com</a></p>';
			code += '<p>You can allways get <b>the latest work in progress (beta)</b> at : <a href="'+OW_OraoWeb_host+'/dev/ow_help.html">'+OW_OraoWeb_host+'/dev/ow_help.html</a></p>';
			
			code += ' See the end of this file to get the <b><a href="#ReleasesNotes">Releases Notes</a></b>, the <b><a href="#ToDo">ToDo List</a></b> or the <b><a href="#Bug">Bug List</a></b>. And now, ...  <b><a href="#ConfigAPI">the Public API</a></b>';
			
			
			code += '\n <hr>\n';			
			code += '\n <h3>Properties</h3>\n';			
			code += '<p>Here after, the list of the properties, their present values (the default ones if you haven\'t overwritten them), and a short explanation of their usage</p>';
			code += '\n<table>';
			for (var property in this.config_description) {
				code += '<tr id="ow_config_property_'+property+ '" class="ow_config_property"><td class="ow_config_property_key">'+property+'</td> <td class="ow_config_property_description">'+this.config_description[property]+'</td></tr>\n';
				if ( (this.movie_options[property]) && (this.movie_options[property].escapeHTML) )
					code += '<tr class="ow_config_value"><td class="ow_config_value_title">Default value : </td> <td class="ow_config_value_default">'+this.movie_options[property].escapeHTML() +'</td></tr>\n';
				else
					code += '<tr class="ow_config_value"><td class="ow_config_value_title">Default value : </td> <td class="ow_config_value_default"> '+this.movie_options[property] +' </td></tr>\n';
			}				
			code += '</table>\n';
			
			code += '\n <h3>Containers for main interaction tools</h3>\n';
			code += '\n <p>Each div or a element which id match one of the following one will be automatically added the matching callback ';
			code += '\n function trough an onclick, if it contains an \'img\' element, this contained img will be attributed the correct image ';
			code += '\n and the matching tooltips ';
			code += '\n <br>Eg : <br><code>';
			code += '\n <a id="ow_bouton_play"><img></a>'.escapeHTML();
			code += '\n </code><br>would be replaced by the javascript equivalent of <br><code>';
			code += '\n <a id="ow_bouton_play" href="#" onclick="..."><img src="../images/videoPlayer/Play.gif" alt="Lance la vidéo" title="Lance la vidéo"/></a> '.escapeHTML();
			code += '\n </code><br>The container (td, p, div, span...) with the matching id will host the matching complex object ';
			code += '\n <table>\n';
			for (var property in this.config_container) {
				code += '<tr class="ow_config_property"><td class="ow_config_property_key">'+property+'</td> <td class="ow_config_property_description">'+this.config_container[property]+'</td></tr>\n';
			}				
			code += '\n</table>\n';				
			
			
			code += '\n <h3>Buttons and images</h3>\n';			
			code += '<table>';
			for (var property in this.config_images) {
				code += '<tr class="ow_config_property"><td class="ow_config_property_key">'+property+'</td> <td class="ow_config_property_description">'+this.config_images[property]+'</td></tr>\n';
				code += '<tr id="ow_config_value"><td id="ow_config_extract" colspan="2"><code> \''+ property +'\'\t\t: \''+this.movie_options.images[property] +'\' , </code></td></tr>\n';
			}				
			code += '</table>\n';
			
			code += '\n <h3>Tooltips and other translated messages</h3>\n';			
			code += '<table>';
			for (var property in this.config_tooltips) {
				code += '<tr class="ow_config_property"><td class="ow_config_property_key">'+property+'</td> <td class="ow_config_property_description">'+this.config_tooltips[property]+'</td></tr>\n';
				code += '<tr id="ow_config_value"><td id="ow_config_extract" colspan="2"><code>FR: \''+ property +'\'\t\t: \''+this.movie_options.tooltips_fr[property].escapeHTML() +'\' , <br>EN: \''+ property +'\'\t\t: \''+this.movie_options.tooltips_en[property].escapeHTML() +'\'</code></td></tr>\n';
			}				
			code += '</table>\n';


			code += '\n <h3 id="ConfigAPI">API : How to interact with the player</h3>\n';			
			code += '<p>Theoritically, one may directly access any function define in the OW_OraoWeb_Player object. If one use <code>var OW_Player = new OW_OraoWeb_Player(\'container\', player_options);</code> to define a player, then one may call a function LetDoSomething by : <code>OW_Player.LetDoSomething()</code>.<br>For stability reason, only the following listed functions are expected to be public (and should not change)';
			code += '\n<table>';
			for (var property in this.config_API) {
				code += '<tr class="ow_config_function"><td class="ow_config_function_call">'+property+'</td> <td class="ow_config_function_description">'+this.config_API[property]+'</td></tr>\n';
			}				
			code += '</table>\n';
			
			
			code += '\n <h3 id="ReleasesNotes">Releases Notes</h3>\n';			
			code += 'Clic on the version number to get to its archive';
			code += '<table>';
			$A(this.releases_notes).each(function(version) {
 				code += '<tr class="ow_config_property"><td class="ow_config_property_key"><a href="'+ version.url + '">' +version.version+'</a></td> <td class="ow_config_property_key">'+version.release+'</td> <td class="ow_config_property_description">'+version.description;
				if (version.todos_and_bugs)	{
					$A(version.todos_and_bugs).each(function(modif) {
						if(!modif.priority) return;
						if (modif.bug)	{
							code += '<br> + Bug : \n'+modif.description;
						}	else	{
							code += '<br> + Plus : \n'+modif.description;
						}
					});
				}
				code += '</td></tr>\n';
			});
			code += '</table>\n';
			
			code += '\n <h3 id="ToDo">ToDo List</h3>\n';			
			code += '<table id="ow_config_todos">';
			$A(this.todos).each(function(todo) {
				if(!todo.priority) return;
 				code += '<tr class="ow_config_todo"><td class="ow_config_todo_priority">'+todo.priority+'</td> <td class="ow_config_todo_description">'+todo.description+'</td></tr>\n';
			});
			code += '</table>\n';
			
			code += '\n <h3 id="Bug">Bug List</h3>\n';			
			code += '<table id="ow_config_bugss">';
			$A(this.bugs).each(function(bug) {
				if(!bug.priority) return;
 				code += '<tr class="ow_config_bug"><td class="ow_config_bug_priority">'+bug.priority+'</td> <td class="ow_config_bug_description">'+bug.description+'</td></tr>\n';
			});
			code += '</table>\n';
			
			
			code += '\n</div>\n';
			this.container.update(code);
		},
		


		config_description: {
			url						: 'URL of the video of the movie to display. Must start with http:// or be an URL relative to the calling page'	,
			width					: 'Width of the video'	,
			height					: 'Height of the video'	,
			window_position_x		: 'Dist from the left side of the screen to the left side of the current window. Window position when coming back from a full screen switch (case of the scaling of an unique window)'	,
			window_position_y		: 'Dist from the top side of the screen to the top side of the current window. Window position when coming back from a full screen switch (case of the scaling of an unique window)'	,
			window_default_width	: 'Window (indeed innerHTML : avaible space for the actual web page) Width when coming back from a full screen switch (case of the scaling of an unique window)'	,
			window_default_height	: 'Window (indeed innerHTML : avaible space for the actual web page) Height when coming back from a full screen switch (case of the scaling of an unique window)'	,
			free_lateral_width_in_FS: 'In full screen mode, the video container width will be the availble width minus this value'		,
			free_height_above		: 'a new parameter for when one want to book some space above the video, especially in full screen mode. Not to be confused with free_vertical_height which is used when coming back from fullscreen',
			free_vertical_height	: 'Free vertical space booked below the video to let room to the controller',
			preset					: '<a id="Preset">the name of a set of configuration.</a> There should be about 3 or 4 of them. Right now there are only two (in addition to the default one): \'movie_options_CNRS\' and \'movie_options_LNR\' (this latest is the same as the default one for the moment). The default config is loaded first, then the one from the preset overwrite the parameter set in the optional chosen preset and eventually the options define in the call to create the viewer overwrite everything else, getting indeed the highest priority. If one want to know what is in a given preset, one way is to look at it, the other is to just call the viewer with two option set : \'help\' (true) and \'preset\' with the name of the preset as a parameter', 
			timecode_lag			: 'This value is added to the displayed timecode. A properly formated timecode is expected : \'hh:mm:ss:ff or hh:mm:ss.ff\'',
			timecode_lag_in_second	: 'If \'timecode_lag\' is set, then it gets the priority and is converted into timecode_lag_in_second, overwise, one can set the timecode lag directly in second, by setting this property',
			timecode_IN				: 'Timecode of the theoritical beginning of the video (if it could be cropped at any frame) : timecode_IN >= timecode_lag. Default to timecode_lag if not set',
			timecode_OUT			: 'Timecode of the theoritical end of the video (if it could be cropped at any frame) : timecode_OUT <= timecode of the last frame. Default to the timecode of the last frame if not set',
			timecode_with_frame		: 'If true, the frame number are displayed',
			config_help				: 'To get the help the present help instead of the player',
			help					: 'shortcut for config_help',
			help_panel_target		: 'name of a page object (usually the application panel div), to which the help_panel will be attached (instead of the default container). This is because of IE bug, that does not allow the hidding/showing of the quicktime plugin when listening to the events',		
			name					: 'Name of the Plugin object. Not that useful to set',
			autoplay				: 'Load the video in autoplay mode'	,
			fullscreen				: 'Should be set to true in the FullScreen template'	,
			popUpFullscreen			: 'When set to false the full screen is done by an adjustement of the main window, and not by the opening of a new window as it is the case for the LNR preset for instance'	, 
			urlOfFullscreenPage		: 'URL of the fullscreen page. In the case of a PHP script that manage both the main page and the fullscreen one, one can use something like : <br> <code>document.location.href.gsub(/[#]/,\'\') +\'&FS=on\'</code><br>N.B. : The gsub is there to remove any # from the URL, because all the links are set to  # and dynamically replaced by onclick calls.',
			onMovieFinished			: 'Not yet implemented. When implemented, will receive a function that should be call when the movie reach the end',
			onMovieFullScreen		: 'Receive a function that is called when the full screen mode is activated',
			onMovieEndFullScreen	: 'Receive a function that is called when the full screen mode is deactivated (when using window resizing mode)',
			onLoadingUpdate			: 'Receive a function that is called after each checkup of the status of the download. That funtion receive the percent of file loaded. A value of 1oo is sent once when the video is fully loaded)',
			urlOfReplacementImage	: 'URL of the image that is displayed when one switch towards the full screen window'	,
			urlOfEndImage			: 'URL of the image that is displayed when the movie reach the end'	,
			typeMime				: 'Type mime used by the plugin',
			webmasterEmail			: 'Email included in error message... Not yet implemented',
			language				: '\'en\' or \'fr\' to get tooltips in French or English'	,
			debug_mode				: 'When true, diplay an additional panel where sone debug value are set'	,
			expectedQTversion		: 'Expected Quicktime version (If not there, an message is displayed to invite the dowloading of the latest version on Apple web site). The messages that would be diplayed are set within the tooltips. <br>N.B.: A string is expected here, to be compatible with, for instance, \'7.3.2\''		,
			quicktimeDetection		: 'When set to false, no quicktime detection, nor version control is done (\'expectedQTversion\' is then useless). Should be set to false when the application already tests the presence of quicktime',
			simulateQTnotAvailable	: 'For the designer : when set to true, simulate what you get when Quicktime is not installed on the machine, if you want to view what is displayed when QT is not up to date, just use expectedQTversion with a version of QT that does not exist yet. . Of course,  the quicktimeDetection parameter is to be set to true !'	,
			sound_handle_variable	: 'If set to true, its means that the sound handle as a height proportional to the sound value. In that case, the sound_handle_width and sound_slider_height should be set too'	,
			sound_slider_height		: 'Height of the Sound Handle'	,
			sound_slider_width		: 'Width of the Sound Slider'	, 
			position_slider_width	: 'Width of the position slider, in order to be able to set a different one in normal size and full screen mode'	,
			controller_panel_height	: 'Height of the controller, in pixel, especially for the full screen mode'	,
			controller_panel_width	: 'Width of the Controller Panel. If not set, then will be set to the width of the video',
			code_controller 		: 'Template for the Controller (See the Containers part here after)',
			code_panel_end 			: 'Template for the panel that is displayed when the video reach the end',
			code_panel_end_FS		: 'Template for the panel that is displayed when the video reach the end, in FullScreen',
			code_end_FS_movie_panel		: 'Template for the panel that is displayed in the main window when a FullScreen windo is opened',					
			imageRootURL			: 'Relative URL of the directory where the images are located',	 
			images					: 'Names of the image files located in the directory set by the imageRootURL',
			
			tooltips_fr				: 'Tooltips and messages in French',
			tooltips_en				: 'Tooltips and messages in English'
		},

		config_container					: {
			'ow_id_progress_slider'			: 'Progress Slider',
			'ow_id_timecode'				: 'Timecode',
			'ow_id_sound_slider'			: 'Sound Slider',
//			'ow_id_end_restart_video'		: 'div displayed when the video end',
			'ow_image_end_restart_video'	: 'Default image displayed when the end is reached (See \'code_panel_end\')',
//			'ow_id_wentFS_restart_video'	: 'div displayed when the player switch to new window FS mode',
			'ow_image_wentFS_restart_video'	: 'Default image displayed when the player switch to new window FS mode (See \'code_end_FS_movie_panel\')',

			'ow_bouton_fullscreen'			: 'Go to FullScreen when not, and close the window (or resize down) if already in FS, one tag only for both button',
			
			'ow_bouton_etc'					: 'See the list of Images for other buttons'
		},

		config_images					: {
			'ow_bouton_play'				: 'Bouton Start the video',
			'ow_bouton_pause'				: 'Bouton Pause the video',
			'ow_bouton_play_pause'			: 'Bouton Switch between Play and Pause (Not Yet Implemented)',
			'ow_bouton_play_again'			: 'Bouton Start the video again after reaching the end',
			'ow_bouton_fast_rewind'			: 'Bouton Fast Rewind',
			'ow_bouton_fast_forward'		: 'Bouton Fast Forward',
			'ow_bouton_step_rewind'			: 'Bouton Step rewind',
			'ow_bouton_step_forward'		: 'Bouton Step forward',
			'ow_bouton_go_to_beginning'		: 'Bouton Go to the Beginning of the movie',
			'ow_bouton_go_to_end'			: 'Bouton Go to the End of the movie',
			'ow_bouton_fullscreen_open'		: 'Bouton Go to FullScreen when not, and close the window (or resize down) if already in FS, one tag only for both button : ow_bouton_fullscreen',
			'ow_bouton_fullscreen_close'	: 'Bouton Go to FullScreen when not, and close the window (or resize down) if already in FS, one tag only for both button : ow_bouton_fullscreen',
			'ow_bouton_mute_sound'			: 'Bouton Shut Down the sound',				
			'ow_bouton_max_sound'			: 'Bouton Max the sound',
			'ow_bouton_logo_player'			: 'Bouton Player (or Client)\'s logo',	
			'ow_bouton_help'				: 'Bouton Help',
			'ow_logo_quicktime'				: 'logo_qtlogo.gif',	
			'ow_background_sound_slider'	: 'Background Image for the Sound Slider',
			'ow_background_player'			: 'Optional : set a backgroung image for the container'		,	
			'ow_background_sound_slider'	: 'Background of the sound slider'							,	
			'ow_bouton_beg_selection'		: 'Setting the beginning of an extract (application side)'	,	
			'ow_bouton_end_selection'		: 'Setting the end of an extract (application side)'		,	
			'ow_bouton_save_selection'		: 'Saving an extract (application side)'					,	
			'ow_bouton_new_selection'		: 'Creating a new selection (application side)'				,	
			'ow_bouton_annotate_selection'	: 'Tagging a extract (application side)'			
		},

		config_tooltips				: {
			'ow_id_timecode' 				: 'Timecode (HH:mm:ss)',
			'ow_id_timecodeLong' 			: 'Timecode (HH:mm:ss.frame)',
			'ow_id_sound_slider'			: 'Volume sonore',
			'ow_id_progress_slider'			: 'Barre de progression',
			'ow_bouton_play' 				: 'Lance la vidéo',
			'ow_bouton_pause' 				: 'Pause la vidéo',
			'ow_bouton_play_pause' 			: 'Lance ou Pause la vidéo',
			'ow_bouton_play_again'			: 'Relance la vidéo',
			'ow_bouton_fast_rewind' 		: 'Retour Rapide',
			'ow_bouton_fast_forward' 		: 'Avance Rapide',
			'ow_bouton_go_to_beginning'		: 'Go to the Beginning of the movie',
			'ow_bouton_go_to_end'			: 'Go to the End of the movie',
			'ow_bouton_fullscreen_open'		: 'Ouvre en plein écran',
			'ow_bouton_fullscreen_close'	: 'Ferme la fenêtre',
			'ow_bouton_mute_sound' 			: 'Coupe le son',
			'ow_bouton_max_sound' 			: 'Son au maximum',
			'ow_bouton_logo_player'			: 'Player (or Client)\'s logo',	
			'ow_bouton_help'				: 'Display an Help panel',

			'mes_quicktime_not_up_to_date'	: 'Message displayed when QT is installed, but not up to date',
			'mes_quicktime_not_available'	: 'Message displayed when QT is not available'
		},
		
		config_API				: {
			'GoToBegSelection()' 			: 'Go to the beginning of the current selection',
			'GoToEndSelection()' 			: 'Go to the end of the current selection',
			'SetSelection(_tc_beg, _tc_end)': 'Set a new selection by specifying its beginning and its end with two timecode (These timecodes are aware of the timecode_lag value). The video keeps playing if it was playing before. The head is positionned within the selection if necessary when the video is playing',
			'UnSetSelection()'				: 'Unset the selection : which translate to using timecode_IN (default to 0) as _tc_beg and timecode_OUT (default to the movie duration) as _tc_end. Then it hides the selction bar',
			'GetCurrentSelectionBeginning()': 'Return the Long timcode of the beginning of the current selection, or timecode_IN if no selection is set',
			'GetCurrentSelectionEnd()': 'Return the Long timcode of the end of the current selection, or timecode_OUT if no selection is set',
			'GetCurrentLongTimeCode()' 		: 'Check (and force) the current position to be within timecode_IN and timecode_OUT. Then <b>return</b> the time code of the displayed frame'
		},
		

/*See 		var OW_OraoWeb_version				= '1.0';
		var OW_OraoWeb_version_release_date	= '10/01/08';
*/		
		releases_notes	: [
			{
				version		: '1.0',
				release		: '10/01/08', 
				description	: '<b>First Major release of OraoWeb</b>',
				url			: '/OraoWeb_DemoOpsis_10/',
				todos_and_bugs	: [
					{priority:5, description:"Multilingual Tip/tool", bug:false},
					{priority:5, description:"Simple to call API", bug:false},
					{priority:5, description:"Fully configurable interface", bug:false},
					{priority:0, description:"", bug:false}					
				]
			},
			{
				version		: '1.1',
				started		: '10/01/08 afternoon',
				release		: '10/01/08 evening', 
				description	: 'Versionning information',
				url			: '/OraoWeb_DemoOpsis_11.zip',
				todos_and_bugs	: [
					{priority:5, description:"position slider lost IE5/PC", bug:true},
					{priority:5, description:"move of some Style info from Prototype SetStyle to CSS file for better IE compatibility", bug:false},
					{priority:0, description:"", bug:false}					
				]
			},
			{
				version		: '1.2',
				release		: '16/01/08', 
				started		: '11/01/08',
				description	: 'Towards Presets, and especially CNRS one',
				url			: '/OraoWeb_CNRS_12.zip',
				todos_and_bugs	: [
					{priority:3, description:"Re-Organise Orao Version in a flateen hierarchy", bug:false},
					{priority:3, description:"Liste des ToDo et Bugs", bug:false},
					{priority:5, description:"New option : position_slider_width : Width of the position slider, in order to be able to set a different one in normal size and full screen mode", bug:false},
					{priority:5, description:"New option : controller_panel_width : If not set, then will be set to the width of the video", bug:false},
					{priority:3, description:"New option : sound_handle_variable : If set to true, its means that the sound handle as a height proportional to the sound value. In that case, the sound_handle_width and sound_slider_height should be set too", bug:false},
					{priority:5, description:"Preset system (applied to CNRS as a test)", bug:false},
					{priority:3, description:"Play/Pause Button : a unique toggle button for both action", bug:false},
					{priority:4, description:"Pas a pas de la video, Frame by frame forward/rewind", bug:false},
					{priority:3, description:"Go to Beginning / End", bug:false},
					{priority:3, description:"Step backward from the end of the movie was not possible. Fixed", bug:true},
					{priority:4, description:"FastRewind could not be the first action to be asked by the user (it would work only after a start/stop or something similar). Fixed", bug:true},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.3',
				release		: '21/01/08', 
				started		: '16/01/08',
				description	: 'INA Preset',
				url			: '/OraoWeb_INA_13.zip',
				todos_and_bugs	: [
					{priority:5, description:"Look INA (et preset associé)", bug:false},
					{priority:3, description:"Addition of the prototip library to display richer tooltips", bug:false},
					{priority:3, description:"Text INA for tooltips", bug:false},
					{priority:3, description:"Help Button", bug:false},
					{priority:3, description:"Logo Button", bug:false},
					{priority:3, description:"Cleaning some visual artifact (sound slider habdle, step forward icon)", bug:true},
					{priority:3, description:"Sound not set to the right value after a return trip to FS", bug:true},
					{priority:3, description:'Icone du logo QT non géré par la variable idoine', bug:true},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.3.1',
				release		: '23/01/08', 
				started		: '21/01/08',
				description	: 'INA Preset : debug of the first INA release',
				url			: '/OraoWeb_INA_131.zip',
				todos_and_bugs	: [
					{priority:5, description:"INA: 'Times Codes' => 'timecodes' => 'Time Codes'", bug:false},
					{priority:3, description:"End of Movie Panel was still built even when not needed", bug:true},
					{priority:3, description:"INA/CNRS Color corrections for some icons (?)", bug:true},
					{priority:4, description:"INA Timecode initial (--:--...) on one ligne ", bug:true},
					{priority:5, description:"Detach the movie (QT plugin + lots of including div) right before unloading the page, to take into account some memory leaking in IE 6 (to be validated)", bug:true},
					{priority:4, description:"Room for lateral interface in FS switch : the new parameter  <a href=\"#ow_config_property_free_lateral_width_in_FS\">'free_lateral_width_in_FS'</a> can be set such as, in full screen mode, the video container width will be the availble width minus this value.", bug:false},								
					{priority:4, description:'Div on the right in FS mode', bug:false},
					{priority:4, description:'Reintroduire la varible de pointage vers le player et tester les commandes au viewer, de l\'exterieur de celui ci', bug:false},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.3.2',
				release		: '25/01/08', 
				started		: '24/01/08',
				description	: 'INA Preset : debug 2 of the first INA release',
				url			: '/OraoWeb_INA_132.zip',
				todos_and_bugs	: [
					{priority:3, description:"Reevaluation of the duration of the movie when the download is completed", bug:true},
					{priority:3, description:"Issue with the resizing", bug:true},
					{priority:3, description:"Set the timecode as soon as the movie is playable", bug:true},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.3.3',
				release		: '28/01/08', 
				started		: '28/01/08',
				description	: 'INA Preset : debug 3 of the first INA release',
				url			: '/OraoWeb_INA_133.zip',
				todos_and_bugs	: [
					{priority:3, description:"Switch to prototype 1.6.0.2", bug:false},
					{priority:3, description:"No space between button anymore : they would cause issue with a change of size of the default police by the user + timecode arera more tolerant with police size changes", bug:true},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.3.4',
				release		: '29/01/08', 
				started		: '29/01/08',
				description	: 'INA Preset : debug 4 of the first INA release',
				url			: '/OraoWeb_INA_134.zip',
				todos_and_bugs	: [
					{priority:3, description:"fullscreen button tooltip", bug:true},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.4',
				release		: '29/01/08', 
				started		: '28/01/08',
				description	: 'OPSIS Preset',
				url			: '/OraoWeb_OPSIS_14.zip',
				todos_and_bugs	: [
					{priority:5, description:"Optimisation of window size guestimate (Cf Loic trick). Now the value given by the paramters 	<a href=\"#ow_config_property_window_default_width\">window_default_width</a> and <a href=\"#ow_config_property_window_default_height\">window_default_height</a> are really about innerHTML. They are the exact avaible space for the actual web page (and not the window)", bug:false},
					{priority:5, description:"OPSIS preset, for the Atelier des Archives", bug:false},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.5.1',
				release		: '6/02/08', 
				started		: '31/01/08',
				description	: 'Selection extracts',
				url			: '/OraoWeb_OPSIS_151/ow_help.html',
				todos_and_bugs	: [
					{priority:5, description:"Management of selections : <a href=\"#ConfigAPI\">opening of the public API</a>. There are still limitations (See todo), but development may start on the application side", bug:false},
					{priority:5, description:"Full suport of <a href=\"#ow_config_property_timecode_lag\">'timecode_lag'</a>, <a href=\"#ow_config_property_timecode_lag_in_second\">'timecode_lag_in_second'</a>, <a href=\"#ow_config_property_timecode_IN\">'timecode_IN'</a>, and <a href=\"#ow_config_property_timecode_OUT\">'timecode_OUT'</a>", bug:false},
					{priority:5, description:"Full suport of <a href=\"#ow_config_property_onMovieFullScreen\">'onMovieFullScreen'</a>, <a href=\"#ow_config_property_onMovieEndFullScreen\">'onMovieEndFullScreen'</a> callback functions", bug:false},
					{priority:5, description:"Reevaluation of the duration of the movie when the download is completed (Yes, again : there was a bug in the previous debugging of that issue)", bug:true},
					{priority:5, description:"Allow a play right after a backward step, when stating from the end", bug:true},
					{priority:5, description:"Right after the plugin was launched, the timecode was updated with a value of 0, without taking into account the timecode_lag parameter.", bug:true},
					{priority:4, description:"Update of the timecode after a pause", bug:false},
					{priority:0, description:"", bug:false}					
				]
			}	,
			{
				version		: '1.5.2',
				release		: '6/02/08', 
				started		: '6/02/08',
				description	: 'Selection extracts : Behaviours Limitations',
				url			: '/OraoWeb_OPSIS_152/ow_help.html',
				todos_and_bugs	: [
					{priority:5, description:"Gestion des selections : restriction of the fast forward, fast rewind, step forward, step rewind behaviour according to the current selection. Use of QT plugin restriction", bug:false},
					{priority:5, description:"Two new functions <a href=\"#ConfigAPI\">in the API : 'GetCurrentSelectionBeginning' and 'GetCurrentSelectionEnd'</a>. See <a href=\"ow_template_INA_popup151.html\">the template</a> for an example of their usage", bug:false},
					{priority:5, description:"The sound can be set again directly through the QT plugin in Safari", bug:true},
					{priority:4, description:'Quicktime detection is now optional (to avoid doing it twice when the calling application does it already). The parameter is <a href=\"#ow_config_property_quicktimeDetection\">\'quicktimeDetection\'</a>, set to true per default, and to false for INA, OPSIS and other presets', bug:false},
					{priority:0, description:""}					
				]
			}		,
			{
				version		: '1.5.3',
				release		: '22/02/08', 
				started		: '19/02/08',
				description	: 'Bug : unset selection when time in and time out not manually defined  version 1.5.3c',
				url			: '/OraoWeb_OPSIS_153/ow_help.html',
				todos_and_bugs	: [
					{priority:5, description:"a) When timecode_IN and timecode_OUT are not manually set, the following sequence of calls bring the video to the end: UnSetSelection() GoToBegSelection() PlayTheVideo()", bug:true},
					{priority:4, description:"b) Rajout du typeMime : 'video/mpeg', dans le preset INA", bug:true},
					{priority:4, description:"c) Bug Define End do not set the slider back to the beginning of the selection", bug:true},
					{priority:0, description:""}					
				]
			}			,
			{
				version		: '1.6',
				release		: '13/03/08', 
				started		: '13/08/08',
				description	: 'Last INA modifications before reengineering of the core',
				url			: '/OraoWeb_OPSIS_16/ow_help.html',
				todos_and_bugs	: [
					{priority:5, description:"Free_height_above is a new parameter for when one want to book some space above the video, especially in full screen mode. Not to be confused with free_vertical_height which is used when coming back from fullscreen", bug:false},
					{priority:4, description:"INA preset : controller_panel_height preset value for INA was too big, potentially producing a window scrolling bar", bug:true},
					{priority:3, description:"New parameter : onLoadingUpdate : potentially Receive a function that is called after each checkup of the status of the download. That funtion receive the percent of file loaded. A value of 1oo is sent once (and only once) when the video is fully loaded', ", bug:false},
					{priority:3, description:"When passing an mpeg1 file and setting a selection outside of the curently loaded part of the movie, the loading would stop under IE6. This does not happen when the media file is encapsulated into a quicktime qtref, which is the case when a logo is applied within INAcontext', ", bug:true},
					{priority:5, description:"Logo overlapping, not ppossible with SMIL, done (and checked against) a QTkit script (addLogoQTToMovie) that will produce a quicktime reference to the mpeg movie", bug:false},
					{priority:0, description:""}					
				]
			}				,
			{
				version		: '1.6.1',
				release		: '19/03/08', 
				started		: '14/03/08',
				description	: 'New cursor, Dynamic selection bar, Help Panel ...',
				url			: '/OraoWeb_OPSIS_161/ow_help.html',
				todos_and_bugs	: [
					{priority:3, description:"Sound level was set to 100% by the end of the loading phase", bug:true},
					{priority:5, description:"INA preset : New image for the position handle", bug:false},
					{priority:5, description:"Catching of the click event on the extract bar", bug:false},
					{priority:3, description:"SetSelection behaviour : back to basic : 1) Does NOT modify the playing mode : keep playing if and only if it was playing before the selection 2) Does NOT set the playing positon back to the beginning : this is still done on the application side (could be implemented within version 2)", bug:false},
					{priority:4, description:"Dynamic Selection bar : The selection bar now take into account the status of the dowload. It is no more possible to access the part that is no yet dowloaded. There is a need to define a CSS for a new div : ow_navigation_selected_target, in a complement to ow_navigation_selected_extract (Which represent the full selection in the background, even if it is not yet available)", bug:false},
					{priority:4, description:"Help panel updated, with the option to include images in it", bug:false},
					{priority:2, description:"New parameter : simulateQTnotAvailable : For the designer : when set to true, simulate what you get when Quicktime is not installed on the machine, if you want to view what is displayed when QT is not up to date, just use expectedQTversion with a version of QT that does not exist yet. Of course,  the quicktimeDetection parameter is to be set to true !", bug:false},
					{priority:5, description:'Safari loading sequence : sometime, one as too reload the page. Possible Clue : Check that the mime type are properly set both on the viewer and on the server side. The present fix is to check the status of the page after 3s and if an error is returned, to reload the page', bug:true},
					{priority:0, description:"", bug:false}					
				]
			}					,
			{
				version		: '1.6.2',
				release		: '25/03/08', 
				started		: '20/03/08',
				description	: 'Tests adding a logo with ... DIV, CSS z-index, wmode...',
				url			: '/OraoWeb_OPSIS_162/ow_help.html',
				todos_and_bugs	: [
					{priority:3, description:"Not yet appropriate : does not work on FF Mac, and bug on IE", bug:false},
					{priority:0, description:"wmode is promising, but not yet ready. If we were to adopt this option, the position of the logo would have to be adjusted when going to FS", bug:false},
					{priority:0, description:"", bug:false}															
				]
			}
								,
			{
				version		: '2.0',
				release		: '14/4/08', 
				started		: '1/4/08',
				description	: 'New architecture using Apple event, which bring the jog shuttle back...',
				url			: '/OraoWeb_OPSIS_2/ow_help.html',
				todos_and_bugs	: [
					{priority:5, description:"Jog Shuttle", bug:false},
					{priority:5, description:"Integration of quicktime plugin events : getting rid of of two idle loops and diminishing the importance of the last one", bug:false},
					{priority:3, description:'Organisation/optimisation of the loading phase', bug:false},
					{priority:2, description:'The javascript call has now to be done within the container div (as usual, to fix an issue with IE), and there is no more a need to observe a \'dom:loaded\' event : it is now done internally within the player - see the template for details', bug:true},
					{priority:3, description:"The help panel can be attached to a different div than the default container, in order to avoid some bug with IE", bug:true},
					{priority:3, description:'Inclusion of the latest apple ac_quicktime library to include quicktime plugin', bug:false},
					{priority:0, description:"", bug:false}					
				]
			}						
		],
		
		todos	: [
			{priority:4, description:"d) On IE6, a Beg or End setting stop the loading of the video !!!", bug:true},
			{priority:2, description:'Loading phase panel : "Loading ... Please be patient ..."'},
			{priority:1, description:"Sound level propagate from first screen to full screen and between videos (cookies)"},
			{priority:1, description:"Tooltip different pour debut et fin suivant context d'extrait ou non"},
			{priority:1, description:"Tooltip different pour play/pause suivant context"},
			{priority:0, description:""},
			{priority:0, description:""}
		],
		bugs	: [
			{priority:5, description:'When trying to measure the correct available sapce in IE, it introduces a lateral slider and thefore a bug in the measurement!'},
			{priority:3, description:'Preloading of Images'},
			{priority:3, description:'When switching to a new sequence/extract, the time it takes is proportional to the length of the extract, or at least, it is not constant (See http://opsisnew.opsomai.eu/)'},
			{priority:4, description:'VP : issue with a big file : the player doesn\'t seems to use the right value for the duration of the movie : http://atelierdesarchives.opsismedia.com/media/visionnage/1201883779.18909000/KADAV384_VIS1421_1437.mp4'},
			{priority:3, description:'Usage of \'#\' in href attribute see some pages scroll'},
			{priority:3, description:'Set Balance : a bug had been logged with Apple. No news yet'},
			{priority:1, description:'Bug to report : a video added to QT plugin through a Set URL would not send any correct cookie (the session would be broken)'},
			{priority:0, description:'bug'},
			{priority:0, description:'bug'}
		],

							
		// debug_feedback				: '<a id="debuglance1" href="#" id="debuglance1">Lance1</a> // <a id="debuglance2" href="#" id="debuglance2">Lance2</a> // <a id="debuglance3" href="#" id="debuglance3">Lance3</a><br>d1(<span id="debug1">-1</span>) / d2(<span id="debug2">-1</span>)  / d3(<span id="debug3">-1</span>)  / dPos(<span id="debugPos">-1</span>)  / dChar(<span id="debugChar">-1</span>)  / dProb(<span id="debugProb">-1</span>)',
		debug_feedback				: '<br>d1(<span id="debug1">-1</span>) / d2(<span id="debug2">-1</span>)  / d3(<span id="debug3">-1</span>)  / dPos(<span id="debugPos">-1</span>)  / dChar(<span id="debugChar">-1</span>)  / dProb(<span id="debugProb">-1</span>)',
		debug1						: 0 ,
		debug2						: 0	,
		debug3						: 0	,
		debugPos					: 0	,
		debugChar					: 0	,
		debugProb					: 0 ,
		
		toto						: 2   

	}
);
