
<!--
var LARGHEZZA_TIMELINE = 192;
var OFFSET_SLIDER_LABEL = -15;

var durataCounted=false;
var coeff=0;
var enableConspeedToMoveSlider=true;
var currPos=0;
var ID_CONSPEED = null;

function videoplay(){
	if (MPLAYER.controls.isAvailable('Play')){
		/* Start playback. */
		MPLAYER.controls.play();
		enableConspeedToMoveSlider=true;
	}
}
	
function videopause(){
	if (MPLAYER.controls.isAvailable('Pause'))
		MPLAYER.controls.pause();
}	
	
function videostop(){
	if (MPLAYER.controls.isAvailable('Stop'))
		/* Stop the Player. */
    	MPLAYER.controls.stop();
}	
function videoFwd(n){
	//Player.controls.Currentposition += n;
	if (MPLAYER.controls.isAvailable('FastForward'))
		MPLAYER.controls.fastForward();
}
function videoRew(n){
	//Player.controls.Currentposition -= n;
	if (MPLAYER.controls.isAvailable('FastReverse'))
        MPLAYER.controls.fastReverse();
}


function isPlaying(){ return (MPLAYER.playState == 3)}

function forceplay(){
	videoplay();
	if(MPLAYER.playState!=PLAYSTATE_PLAYING){
		setTimeout("forceplay()",500);
	}
}

function getDuration(){
	if(MPLAYER.playState!=3 && MPLAYER.currentMedia.duration<=0){
		setTimeout("getDuration()",500);
	}
	else
		return MPLAYER.currentMedia.duration;
}


function videoreload(){	
	videostop();
	MPLAYER.controls.currentPosition = 0;
	setTimeout('videoplay()',500);
}



function getFileNameVideo(src){
	var k = src.lastIndexOf('\\');
	if(k==-1)
		k = src.lastIndexOf('/');
	return src.substring(k+1);
}


function videozoom(){
	if(MPLAYER.playState == 3){
		//if(window.confirm("Para volver a visualizar la interfaz \n \t- pulsar la tecla Esc \n\t- o sino hacer doble click en el video."))
			MPLAYER.fullScreen = true;		
			if(!isVideoEnlarged())
				moveIT();
	}
}




function Paddparam(sec,len){
	secS=sec+"";
	rest = len - secS.length
	padd="";
	if(rest>0){
		for(i=0;i<rest;i++)
			padd+="0";
		secS = padd + secS
		}
	return secS
}

var dbg_counter = 0;




function conspeed(){
	//try{
		if((typeof MPLAYER == 'object') || (typeof MPLAYER == 'function')){
			if(MPLAYER.playState>1){
				var CURRENT_POS = MPLAYER.controls.currentPosition;
				if((CURRENT_POS > 0)){
					var cDuration_ = MPLAYER.currentMedia.duration;
					if(cDuration_ > 0 && !durataCounted){
						durataCounted = true;
						document.getElementById("label_mediaDuration").innerHTML = '/' + format_time(cDuration_);
					  	coeff = LARGHEZZA_TIMELINE / cDuration_;
						durataFilmato = format_time(cDuration_);
					}
					
					if(durataCounted && enableConspeedToMoveSlider){	
						var currPos = Math.round(CURRENT_POS * coeff);
						document.getElementById("label_currentPosition").innerHTML = format_time(CURRENT_POS);			
					//	document.getElementById("slider_indicator_timeline").style.left = currPos + 'px';
						document.getElementById("label_slider_indicator_timeline").style.width = currPos + 'px';
						//document.getElementById("label_slider_indicator_timeline").style.left = (currPos ) + 'px';
					}
				}	 		
			}
			else{
				//durataCounted = false;
			}
		}
	/*}catch(e){
		// alert('conspeed' + e.message);
	}*/
}

function conspeed_start(){
	ID_CONSPEED = setInterval('conspeed()',500);
}			

function conspeed_stop(){
	window.clearInterval(ID_CONSPEED);
	durataCounted = false;
}

	
function gotonPlay(time){
		if(MPLAYER.controls.currentPosition>0){		
			MPLAYER.controls.currentPosition = time;
			enableConspeedToMoveSlider = true;
		}
	}

function gotoandPlay(pixelLeft){
	if(coeff>0){
		MPLAYER.controls.currentPosition = pixelLeft/coeff;
		videoplay();
	}
}

function reportTimeOnCursor(pixelLeft){
	if(coeff>0 && pixelLeft>0)
		return format_time(pixelLeft/coeff);
	else
		return format_time(0);
}

	//// FUNZIONI AUSILIARIE ////////////
	////////////////////////////////////
function format_time(x){
 	var ore, minuti, secondi;
	var timer = Math.round(x);
    minuti = Math.floor(timer/60);
	secondi = Math.floor(timer%60);
	ore = Math.floor(minuti/60);
	minuti=Math.floor(minuti%60);
	if(secondi<10) secondi='0'+secondi;
	if(minuti<10) minuti='0'+minuti;		
	if(ore<10) ore='0'+ore;			
	return minuti+':'+secondi;
}
	
	