var muted=false;

function controlNana(command)
{
	obj=document.getElementById('NanaPlayer');
	
	if(command=="play")
	{
		document.getElementById('play_btn').style.display="none";
		document.getElementById('pause_btn').style.display="block";
		obj.controls.play();
		showVideoImage(false);
		idTmr = window.setInterval("updateNanaTimer()",1000);		
	}
	if(command=="pause" || command=="fullscreen")
	{
		document.getElementById('pause_btn').style.display="none";
		document.getElementById('play_btn').style.display="block";
	
		obj.controls.pause();
	}
	if(command=="stop")
	{
		document.getElementById('pause_btn').style.display="none";
		document.getElementById('play_btn').style.display="block";
		obj.controls.stop();
	}
	if(command=="mute") obj.settings.mute=muted=(muted)?false:true;
	if(command=="fullscreen") 
		act=window.open("../nana_fullscreen.html?"+obj.URL ,''," fullscreen, !location, !toolbar, !resizable, !status, !top, !left, width="+screen.availWidth+", height="+screen.availHeight);
}
//---------------------------------------------------------------------------------------------------
function updateNanaTimer()
{
	position=document.getElementById('NanaPlayer').controls.currentPosition;
	duration=document.getElementById('NanaPlayer').currentMedia.duration;
	document.getElementById('nana_player_currenttime').innerHTML=((Math.floor(position/60)<10)?"0":"") +  Math.floor(position/60) + ":" + (((position%60)<10)?"0":"")+ Math.floor(position%60);

	document.getElementById('nana_player_totaltime').innerHTML=((Math.floor(duration/60)<10)?"0":" ") +  Math.floor(duration/60) + ":" + Math.floor(duration%60);


	if(document.getElementById('video_description_time')!=null)
	document.getElementById('video_description_time').innerHTML=((Math.floor(duration/60)<10)?"0":" ") +  Math.floor(duration/60) + ":" + Math.floor(duration%60) + " דקות ";
	
	if(position!=0 && duration!=0)
	document.getElementById('nana_player_progressbar').getElementsByTagName("p")[0].style.width=((position*433)/duration)+"px";
}
//---------------------------------------------------------------------------------------------------
function setVolume(vol)
{
	for(i=1;i<=6;i++)
	{	
		document.getElementById("volumeBar"+i).src="../images/volume"+i+"_"+ ((i<=vol)?"on":"off")+ ".gif";
	}
	document.getElementById('NanaPlayer').settings.volume = 20+(16*(vol-1)); 
}
//---------------------------------------------------------------------------------------------------

function switchVideoURL(newURL, videoName, subVideoName, txt, link, bigImages)
{
	document.getElementById('video_image').src="../files/WeeklyVideo/BigPic/"+bigImages;

	document.getElementById('NanaPlayer').settings.autoStart=true;
	document.getElementById('NanaPlayer').URL=newURL;
	document.getElementById('h3_txt').innerHTML=txt;
	document.getElementById('title_right').innerHTML=videoName;
	document.getElementById('h1_title').innerHTML=subVideoName;

	if(document.getElementById('videoLink')!=null) document.getElementById('videoLink').href=link;

	document.getElementById("bigVideo").focus();
	document.getElementById("videobox").focus();
}

function showVideoImage(flag)
{
	document.getElementById('video_image').style.display=(flag)?"block":"none";
}