// JavaScript Document

function playVideo() { 
	movie.Play();
}
function pauseVideo() {
	movie.Stop();
}
function stopVideo() {
	movie.Stop();
	movie.Rewind();
}
function getStatus() {
	return movie.GetPluginStatus();
}
function getTime() {
	return movie.GetTime() / movie.GetTimeScale();
}
function getDuration() {
	return movie.GetDuration() / movie.GetTimeScale();
}
function setTime(sec) {
	movie.SetTime( sec * movie.GetTimeScale() );
}
function setPercent(percent) {
	var durationtemp=getDuration();
	var newseconds = (percent/100)*durationtemp;
	setTime(newseconds);
	myJsProgressBarHandler.setPercentage('element1',percent);
}
function getVolume() { 
	return parseInt( movie.GetVolume() * 100 / 255 );
}
function setVolume(vol) { 
	movie.SetVolume( vol * 255 / 100 );
}
function loadURL(url) { 
	movie.SetURL(url);
	movie.SetControllerVisible(false);
}
var intervalID=0;
function moveProgress() {
	var tmp = Math.round(getTime()/getDuration() * 100);
	
	//myJsProgressBarHandler.setPercentage('element1',tmp);
	
	s.setValue(tmp);
	
	document.getElementById('duration').innerHTML=Math.round(getTime()*10)/10;
	
	return false;
}

function play_button() {
	if(playpause) {
		//alert('hello');
		playpause=false;
		document.getElementById('playpause').src='images/qtpauseplay.png';
		clearInterval(intervalID); 
		document.getElementById('visible_layer').style.visibility='hidden';
		
		pauseVideo();
	}
	else {
		//alert('goodbye');
		playpause=true;
		document.getElementById('playpause').src='images/qtplaypause.png';
		intervalID=setInterval('moveProgress()',100);
		document.getElementById('visible_layer').style.visibility='visible';
		
		playVideo();
	}
	//alert(document.getElementById('playpause').src);
}
