function selectVideoImage(video_id)
{
	toggleSWF();
	showPopWin('/system/backbone/Video/modal_select_image.jsp?title=Select Image&video_id=' + video_id, 500, 400, null);

}

function setSelectedVideoImageId(image_id, video_id)
{
	ajax_obj = new sack();
	ajax_obj.setVar('processView', 'changeImage');
	ajax_obj.setVar('image_id', image_id);
	ajax_obj.setVar('video_id', video_id);
	ajax_obj.setVar('section', 'selected_image_section');
	ajax_obj.onCompletion = ajaxUtilReplaceSection;
	ajax_obj.postCompletion = reloadPlayer;
	ajax_obj.requestFile = '/system/backbone/Video/ajax_views.jsp';
	//ajax_obj.setVar('debug', 'debug');
	ajax_obj.runAJAX();
}

function reloadPlayer()
{
	toggleSWF();
	var selected_image_path = document.getElementById("selected_image_path");
	var preview_path = document.getElementById("preview_path");
	try
	{
		//var s1 = new SWFObject("/_swf/player.swf","ply","480","384","9","#FFFFFF");
		//var flashParam = "file=" + preview_path.value + "&image=/" + selected_image_path.value;
		//s1.addParam("allowfullscreen","true");
		//s1.addParam("allowscriptaccess","always");
		//s1.addParam("flashvars", flashParam);
		//s1.write("videoplayer");
		// new widescreen for TLC
		var s1 = new SWFObject("/_swf/player.swf","ply","480","290","9","#FFFFFF");
		var flashParam = "autostart=true&file=" + preview_path.value + "&image=/" + selected_image_path.value + "&stretching=exactfit";
		s1.addParam("allowfullscreen","true");
		s1.addParam("allowscriptaccess","always");
		s1.addParam("flashvars", flashParam);
		s1.write("videoplayer");
	}
	catch(err){}	
	//alert(flashParam);

}

function toggleSWF()
{
   //var swf = swfobject.getObjectById("ply");
   var swf =  document.getElementById("ply");
   if(swf)
   {
	   if(swf.className == "SWFhidden")
	   {
	      swf.className = "";
	   }
	   else 
	   {
	      swf.className = "SWFhidden";
	   }	
   }
}

function uploadVideo()
{	
	toggleSWF();
	startProcess();
	//toggleSWF();
}