public static function addComponentScript($component, $script = '', $dir = 'js')
	{
		if ($dir != 'js')
		{
			$script = $dir . '/' . $script;
		}

		$asset = new Javascript($component, $script);

		if (defined('JPATH_GROUPCOMPONENT'))
		{
			$base = substr(JPATH_GROUPCOMPONENT, strlen(PATH_ROOT));

			$asset->setPath('source', $base . DS . 'assets' . DS . ($dir ? DS . $dir : '') . DS . $asset->file());
			$asset->setPath('override', $base . DS . 'assets' . DS . ($dir ? DS . $dir : '') . DS . $asset->file());
		}

		if ($asset->exists())
		{
			if ($document = self::app('document'))
			{
				$document->addScript($asset->link());
			}
		}
	}