/**
 * Gets value of specified attribute out of some HTML Tag
 * @param pElem HTML element pointer
 * @param bstrText Name of the attribute
 * @param sValue Reference of the string that will hold the value
 * @return true if attribute is present false otherwise
 */
bool COfflineBrowser::GetAttribute(MSHTML::IHTMLElementPtr pElem, BSTR bstrText, std::string& sValue)
{
	try
	{
		CComVariant var = pElem->getAttribute(bstrText, 0);
		USES_CONVERSION;
		if (var.vt == VT_BSTR && var.bstrVal != NULL)
			sValue = (LPCTSTR)OLE2T(var.bstrVal);
		else
			sValue = "";
	}
	//Attribute not present
	catch (_com_error e)
	{
		sValue = "";
	}
	//Special condition for about:blank, keep remember it
	int nIndex = sValue.find("about:blank");
	if(nIndex == 0)
	{
		int nLen = strlen("about:blank");
		sValue = sValue.substr(nLen, sValue.length()-nLen);
	}
	return sValue.length() ? true : false;
}