	var myListener = new Object();
	var url_movie = '';
	var id_block_photo = '';
	var movie_started = false;
	var stop_now = true;
	
	/**
	 * Initialisation
	 */
	myListener.onInit = function()
	{

	};
	/**
	 * onClick event on the video
	 */
	myListener.onClick = function()
	{
		var total = $("info_click").val();
		$("#info_click").html(Number(total)+1);
	};
	/**
	 * onKeyUp event on the video
	 */
	myListener.onKeyUp = function(pKey)
	{
		$("#info_key").html(pKey);
	};
	/**
	 * onComplete event
	 */
	myListener.onFinished = function()
	{
	    if (id_block_photo != '')
	    {
	        //$('#myFlash').hide();
	        getFlashObject().SetVariable("method:pause", "");
	        getFlashObject().SetVariable("method:setPosition", 0);
	        html = $(id_block_photo).html();
	        $('#new_content_screen').html(html);
	    }
	};
	
	/**
	 * Update
	 */
	myListener.onUpdate = function()
	{
	    if (stop_now)
	    {
    	    if (movie_started == false)
    	    {
    	        play();
    	        movie_started = true;
    	    }
	    }
	    
		$("#info_playing").html(this.isPlaying);
    	$("#info_url").html(this.url);
    	$("#info_volume").html(this.volume);
    	$("#info_position").html(this.position);
    	$("#info_duration").html(this.duration);
    	$("#info_buffer").html(this.bufferLength + "/" + this.bufferTime);
    	$("#info_bytes").html(this.bytesLoaded + "/" + this.bytesTotal + " (" + this.bytesPercent + "%)");
    	
    	var isPlaying = (this.isPlaying == "true");
   		document.getElementById("playerplay").style.display = (isPlaying)?"none":"block";
   		document.getElementById("playerpause").style.display = (isPlaying)?"block":"none";
   		
   		var timelineWidth = 931;
    	var sliderWidth = 40;
    	var sliderPositionMin = 79;
    	var sliderPositionMax = sliderPositionMin + timelineWidth - sliderWidth;
    	var sliderPosition = sliderPositionMin + Math.round((timelineWidth - sliderWidth) * this.position / this.duration);
    	
    	if (sliderPosition < sliderPositionMin) {
    		sliderPosition = sliderPositionMin;
    	}
    	if (sliderPosition > sliderPositionMax) {
    		sliderPosition = sliderPositionMax;
    	}
    	
    	document.getElementById("playerslider").style.left = sliderPosition+"px";
	};
	
	function getFlashObject()
	{
		return document.getElementById("myFlash");
	}
    function play()
    {
        if (myListener.position == 0) {
            getFlashObject().SetVariable("method:setUrl", url_movie);
        }
        getFlashObject().SetVariable("method:play", "");
    }
    function pause()
    {
        getFlashObject().SetVariable("method:pause", "");
    }
    function stop()
    {
        getFlashObject().SetVariable("method:stop", "");
    }
    function setIDphoto(id)
    {
        id_block_photo = id;
    }
    function setUrl(url)
    {
        url_movie = url;
    }
    function setWidth()
    {
    	var width = document.getElementById("inputWidth").value;
    	getFlashObject().width = width+"px";
    }
    function setHeight()
    {
    	var height = document.getElementById("inputHeight").value;
    	getFlashObject().height = height+"px";
    }
    function setPosition()
    {
    	var position = document.getElementById("inputPosition").value;
    	getFlashObject().SetVariable("method:setPosition", position);
    }
    function setVolume()
    {
    	var volume = document.getElementById("inputVolume").value;
    	getFlashObject().SetVariable("method:setVolume", volume);
    }
    function loadImage()
    {
    	var url = document.getElementById("inputImage").value;
    	var depth = document.getElementById("inputImageDepth").value;
    	var verticalAlign = document.getElementById("inputImageVertical").value;
    	var horizontalAlign = document.getElementById("inputImageHorizontal").value;
    	
    	getFlashObject().SetVariable("method:loadMovieOnTop", url+"|"+depth+"|"+verticalAlign+"|"+horizontalAlign);
    }
    function unloadImage()
    {
    	var depth = document.getElementById("inputUnloadDepth").value;
    	getFlashObject().SetVariable("method:unloadMovieOnTop", depth);
    }