// add the extension translations
PluginObject.Util.ExtensionTranslation.Quicktime = ['mov', 'mpeg', 'mpg', 'avi', 'mp3', 'acc', 'qt', 'wav', 'au', '3gp', '3gpp'];
PluginObject.Util.AliasTranslation.Quicktime = ['qt', 'quicktime'];

PluginObject.Plugins.Quicktime = function()
{
};

PluginObject.Plugins.Quicktime.prototype = {

	options:{
		upgrade_url			: 'http://www.apple.com/quicktime/download/',
		_class_id			: 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		_type				: 'video/quicktime'
	},

	_initiate: function(constructor, src, options)
	{
//		merge the default options with the plugin defaults
		PluginObject.Util.mergeObjects(constructor.options, this.options || {});

		constructor.installedVer = this._getPlayerVersion(constructor);
		if(options.bgcolor)
		{
			constructor.addParam('bgcolor', options.bgcolor);
		}
	},

	_getPlayerVersion: function(constructor)
	{
		var PlayerVersion = new PluginObject.Util.PlayerVersion([0,0,0]);
		var foundPlayerVersion;
		if(navigator.plugins && navigator.mimeTypes.length)
		{
			for (var i=0; i < navigator.plugins.length; i++)
			{
				var x = navigator.plugins[i];
				if (x.name.indexOf("QuickTime") > -1)
				{
					// if multiple plugins are installed, find the latest version
					if (!foundPlayerVersion)
					{
						PlayerVersion = new PluginObject.Util.PlayerVersion([1,0,0]);
					}
					foundPlayerVersion = new PluginObject.Util.PlayerVersion(x.name.replace(/([a-z]|[A-Z]|-|\s)+/, "").split("."));
					if (foundPlayerVersion.versionIsValid(PlayerVersion))
					{
						PlayerVersion = foundPlayerVersion;
					}
				}
			}
		}
		else
		{
			var axo = null;
			try
			{
				axo = new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1");
			}
			catch(e)
			{
				axo = null;
			}
			if (axo)
			{
				PlayerVersion = new PluginObject.Util.PlayerVersion([1,0,0]);
				if (axo.QuickTimeVersion)
				{
					// get the leading 3 hex digits
					var v = axo.QuickTimeVersion >> 16;
					PlayerVersion = new PluginObject.Util.PlayerVersion([(v & 0xf00) >> 8, (v & 0x0f0) >> 4, v & 0x00f]);
				}
			}
		}
		return PlayerVersion;
	},

	_detect: function(constructor, version)
	{
		return (constructor.installedVer.versionIsValid(version));
	}

};