// JavaScript Document

function show_video_popup( file, format )
{
	var offset;
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = document.body.clientWidth-2;
	  winH = document.body.clientHeight-2;
	  offset = self.pageYOffset;
	  if (offset != 0) winH = document.body.parentNode.scrollHeight;
//	  alert("MOZILLA: H:"+winH+". W:"+winW+". OS:"+offset);
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth-19;
	  winH = document.body.offsetHeight-4;
	   offset = document.body.scrollTop;	  
	   if (offset > 0) winH = document.body.parentNode.scrollHeight;
//	  alert("MSIE: H:"+winH+". W:"+winW+". OS:"+offset);
	 }
	}

	var canvas = document.createElement('div');
	canvas.id = 'canvas';
	canvas.style.width = winW + "px";
	canvas.style.top = '0px';
	canvas.style.height = parseInt(document.body.parentNode.scrollHeight + offset) + "px";
	document.body.appendChild(canvas);
//	canvas.style.top = offset;

	var popup = document.createElement('div');
	popup.id = 'popup';
	popup.style.top = 50 + offset + 'px';
	popup.style.minHeight = "420px";
	var mywidth;
	if (format == '0') {
		popup.style.width = "180px";
		mywidth = 160;
	} else if (format == '1') {
		popup.style.width = "340px";
		mywidth = 320;
	} else if (format == '2') {
		popup.style.width = "660px";
		mywidth = 640;
	}
	
	var out = new Array();
	var size = " height='450px'";

	out.push("<div style=\"text-align: right; margin-top: -10px; margin-right: -10px;\"><span style=\"cursor: pointer; color: #FFFFFF;\" onclick=\"remove_video_popup();\">CLOSE</span></div>");
	out.push("<div style=\"text-align: center; margin: 5px;\" id=\"admin_container\"><div id='div_video_player'></div>");
	
	out.push("</div>");

	popup.innerHTML = out.join('');
	
	document.body.appendChild(popup);

	popup.style.left = ((winW / 2) - ((mywidth) / 2)) + 'px';
	
	var fo;
	if (format == '0') fo = new SWFObject( "flash/FlowPlayerLight.swf", "div_video_player", "160", "120", "9", "#fff", true );
	else if (format == '1')  fo = new SWFObject( "flash/FlowPlayerLight.swf", "div_video_player", "320", "240", "9", "#fff", true );
	else if (format == '2') fo = new SWFObject( "flash/FlowPlayerLight.swf", "div_video_player", "640", "480", "9", "#fff", true );
	fo.addVariable("config", "{ videoFile: \'../"+file+"\', loop: false, allowResize: true, initialScale : \'scale\', bufferLength: 20, showPlayList: false, controlsOverVideo: \'locked\', showFullScreenButton: false, showMenu: false, usePlayOverlay: true, autoPlay: true }" );
	fo.write("div_video_player");


}

function remove_video_popup()
{
	document.body.removeChild(document.getElementById('popup'));
	document.body.removeChild(document.getElementById('canvas'));
}
