
var videoWindow = null;

function fixTitle(theTitle)
{
	if( theTitle.charAt(0)=='-' ) return theTitle.slice(1);
	else return '"' + theTitle + '"';
}

function js_OpenVideoWindow(theTitle,theFile,windWidth,windHeight,movWidth,movHeight)
{
	theParms = 'title='+fixTitle(theTitle)+'&movie='+theFile+'&width='+movWidth+'&height='+movHeight;

	w = screen.availWidth, h = screen.availHeight;
	if( w<800 ) W = 800;
	if( h<600 ) h = 600;

	windLeft = (w-windWidth)/2, windTop = (h-windHeight)/2;
	windTop = windTop - (windTop/4);

	// if the window already exists, the open will fail to resize so close it first
	if( videoWindow && videoWindow.open )
	{
		if( !videoWindow.closed ) videoWindow.close();
		delete videoWindow;
		videoWindow = null;
	}

	windName = 'wndMovie';
	videoWindow = window.open('videos_popup.php?'+theParms, windName,
		  'width=' + windWidth
		+ ',height=' + windHeight
		+ ',top=' + windTop
		+ ',left=' + windLeft
		+ ',status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no');

	return
}

// ---- addMovieEmbedHTML(parm_moviename,parm_width,parm_height) ----
//
// this function is called by the pop-up HTML to get around a problem in IE7
// if this code were directly in the pop-up HTML, then IE7 would force the user to press spacebar
// or click to play the movie... all to conform to some odd-ball patent
// by having this code separate it bypasses the patent problem
//

function js_AddMovieEmbedHTML(parm_moviename,parm_width,parm_height)
{
document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ' +
				'width="' + parm_width + '" ' +
				'height="' + parm_height + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab">' +
				'<param name="SRC" value="' + parm_moviename + '">' +
				'<param name="AUTOPLAY" value="true">' +
				'<param name="CONTROLLER" value="true">' +
				'<param name="SCALE" value="tofit">' +

				'<embed src="' + parm_moviename + '" width="' + parm_width + '" height="'+parm_height+'" ' +
				'scale="tofit" autoplay="true" CONTROLLER="true" ' +
				'pluginspace="http://www.apple.com/quicktime/download/"></embed>' +
				'</object>' );
}
