private static function _pushScriptTo($index, $url, $type = 'text/javascript', $defer = false, $async = false)
	{
		if (!App::has('document'))
		{
			return;
		}

		$document = App::get('document')->instance();

		if ($document instanceof \Hubzero\Document\Type\Html)
		{
			$pushed = false;

			// Get the old data
			$data = $document->getHeadData();
			$scripts = $data['scripts'];

			// Reset the scripts data
			// We need a fresh array to reorganize things
			$data['scripts'] = array();

			// We can't reset the script data with $document->setHeadData($data); and then
			// use $document->addScript() because Document will ignore the empty array we
			// just set $data['scripts'] to and keep the old data. So, all we'd end up
			// doing is appending items. SO, we populate a new array and set the head data
			// to that.

			// Loop through old data and look for the
			// spot to insert the new data
			$i = 0;
			foreach ($scripts as $key => $foo)
			{
				// Found the spot?
				if ($i == $index)
				{
					$data['scripts'][$url] = array(
						'mime'  => $type,
						'defer' => $defer,
						'async' => $async
					);
					$pushed = true;
				}
				$data['scripts'][$key] = $foo;

				$i++;
			}

			// We didn't find out spot?
			// Append to the end
			if (!$pushed)
			{
				$data['scripts'][$url] = array(
					'mime'  => $type,
					'defer' => $defer,
					'async' => $async
				);
			}

			$document->setHeadData($data);
		}
	}