public function get_content_position($content, $allowed_length)
	{
		$content = $this->restore_square_brackets_in_smilies($content);

		if (utf8_strpos(utf8_substr($content, 0, $allowed_length), '<') === false)
		{
			/**
			* If we did not find any HTML in our section, we can cut it.
			* Exp:     sample<markup>text<markup2>	AL = 3
			* Content: ^^^               Text-Position = 3
			*/
			return $allowed_length;
		}

		$content_length = $allowed_length;
		$start_position = 0;
		$last_smiley = false;
		while (($last_html_opening = utf8_strpos(utf8_substr($content, 0, $content_length), '<', $start_position)) !== false)
		{
			// foreach markup we find in the string, we enlarge our text-size.
			$last_html_closing = utf8_strpos($content, '>', $last_html_opening);
			$content_length += ($last_html_closing - $last_html_opening) + 1;

			$smiley_code = utf8_substr($content, $last_html_opening + 6, ($last_html_closing - $last_html_opening - 9));
			if (($smiley_code != '--') && (utf8_strpos($smiley_code, 'c="{SMILIES_PATH}/') === false))
			{

				if ($last_smiley == $smiley_code)
				{
					$content_length -= utf8_strlen($smiley_code);
					$last_smiley = false;
				}
				else
				{
					$last_smiley = $smiley_code;
				}
			}

			$start_position = $last_html_opening + 1;
		}

		return $content_length;
	}