var quicktimeVersion = 0;

function getQuicktimeVersion()
{
	var agent = navigator.userAgent.toLowerCase(); 
	
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Quicktime plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0)
	{
		for (i=0; i < navigator.plugins.length; i++ )
		{
			var plugin = navigator.plugins[i];
			if (plugin.name.indexOf("QuickTime") > -1)
			{
				quicktimeVersion = parseFloat(plugin.name.substring(18));
			}
		}
	}
	
	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1)
	{
		document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('dim obQuicktime \n');
		document.write('set obQuicktime = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1") \n');
		document.write('if IsObject(obQuicktime) then \n');
		document.write('	if obQuicktime.IsQuickTimeAvailable(0) then \n');
		document.write('		quicktimeVersion = CInt(Hex(obQuicktime.QuickTimeVersion) / 1000000) \n');
		document.write('	end if \n');
		document.write('end if \n');
		document.write('</scr' + 'ipt\> \n');
	}

	// Can't detect in all other cases
	else {
		quicktimeVersion = -1;
	}

	return quicktimeVersion;
}

function playQuicktime(file_id, qt_width, qt_height, args)
{
	if (args == undefined)
	{
		args = '';
	}
	var url = '/play.php?fid=' + file_id + '&qtw=' + qt_width + '&qth=' + qt_height + args;
	
	var width = qt_width + 100;
	var height = qt_height + 100 + 16;
	
	var x = (790 - width) / 2;
	var y = (558 - height) / 2; 
	
    if (screen)
    {
        y = (screen.availHeight - height) / 2; 
        x = (screen.availWidth - width) / 2;
        
        if (screen.availWidth > 1800)
        {  
			x = ((screen.availWidth / 2) - width) / 2;  
   		}  
    } 
 	
 	x = Math.round(x);
 	y = Math.round(y);
 	
	window.open(url, name, 'width=' + width + ',height=' + height + ',screenX=' + x + ',screenY=' + y + ',top=' + y + ',left=' + x + ',scrollbars=no,resizable=no'); 
}