FindFirstHtmlVersion just returning more html - html

The openPop function just returns a load of HTML which is difficult to find a way to parse. Has anyone got any ideas on how I should further parse the html so I can get the body of text I need? I've tried getbodyastext method which didn't seem to be of any use.
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-
com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
#font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
#font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
#font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
#page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Test Email for dev_sitehelpdesk<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:EN-GB'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:EN-GB'> <o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:EN-GB'>NAME HERE</span></b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:EN-GB'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:EN-GB'>Technical Manager<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>=

I use this function I modified from the comment link below:
private string GetMessageBodyAsTextNew(Message message)
{//http://www.limilabs.com/blog/tag/html
string body;
MessagePart plainTextPart = message.FindFirstPlainTextVersion();
if (plainTextPart != null)
{
// The message had a text/plain version - show that one
body = plainTextPart.GetBodyAsText();
}
else
{
// Try to find a body to show in some of the other text versions
MessagePart html = message.FindFirstHtmlVersion();//http://hpop.sourceforge.net/exampleSpecificParts.php
if (html != null)
{
// Save the plain text to a file, database or anything you like
//body = GetMessageBodyAsText(message);
body = GetTextFromHtml_Xpath(html.GetBodyAsText());
}
else
{
body = "The system was unable to get the body text of this message";
}
}
return body;
}

Used regex to strip out most of the HTML and put in carriage returns. I know you shouldn't use regex to parse html, but this is limited HTML that I just wanted to get rid of. Works fairly well.

Related

CSS and HTML 4.0 errors causing blank spaces in rich text method(QT)

There is a method called drawRichText where is a input parameter 'option' containing string text. The bag is caused by string "]]>ibroketheconfig". The Qt translate it to HTML 4.0 strict. I need to solve this bug. There are several error on validator W3, but on the others it seems to be working.
HTML and CSS code causing blank field.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/1998/REC-html40/strict.dtd">
<html>
<head>
<meta name="qrichtext" content="1" />
<style type="text/css">
 p, li { white-space: pre-wrap; }
 </style>
</head>
<body style=" font-family:'Segoe UI'; font-size:8.25pt; font-weight:400; font-style:normal;">

<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">]]>ibroketheconfig</p>
</body>
</html>
int DItemDelegate::drawRichText(QPainter* painter, const QStyleOptionViewItem& option)
{
DTextDocument textDocument;
textDocument.setDefaultFont(option.font);
textDocument.setExtendedHtml(option.text);
textDocument.setDocumentMargin(0.0);
// Nastaveni barvy textu podle Qt::ForegroundRole
QTextCharFormat format;
format.setForeground(getTextColor(option));
QTextBlockFormat textBlockFormat;
textBlockFormat.setAlignment(option.displayAlignment);
textDocument.setTextWidth(-1);
qreal idealTextWidth = textDocument.idealWidth();
if ((option.displayAlignment.testFlag(Qt::AlignRight) || option.displayAlignment.testFlag(Qt::AlignHCenter))
&& idealTextWidth < option.rect.width()) // posledni podminka kontroluje, zda vubec ma smysl uvazovat alignment textu
{
// nastavime sirku kresleneho textu (jinak nebude fungovat alignment)
textDocument.setTextWidth(option.rect.width());
}
QTextCursor cursor(&textDocument);
cursor.select(QTextCursor::Document);
cursor.mergeCharFormat(format);
cursor.select(QTextCursor::Document);
cursor.mergeBlockFormat(textBlockFormat);
if (option.rect.width() > 0)
{
painter->save();
QRect clip(0, 0, option.rect.width(), option.rect.height());
qreal idealWidth = textDocument.idealWidth();
if (idealWidth > option.rect.width())
{
QString additionalText("...");
painter->setPen(getTextColor(option));
painter->drawText(clip, Qt::AlignRight, additionalText);
// Orez nevejduvsiho se textu provest na sirku "..." od praveho okraje vykreslovaci oblasti
// aby nedoslo k jeho prekryti naslednym obsahem radku
QFontMetrics fontMetrics(textDocument.defaultFont());
clip.setWidth(option.rect.width() - fontMetrics.width(additionalText));
}
if (option.rect.height() > textDocument.size().height())
{
if (option.displayAlignment.testFlag(Qt::AlignVCenter))
{
painter->translate(0, (option.rect.height() - textDocument.size().height()) / 2.0);
}
else if (option.displayAlignment.testFlag(Qt::AlignBottom))
{
painter->translate(0, option.rect.height() - textDocument.size().height());
}
}
textDocument.drawContents(painter, clip);
painter->restore();
}
return idealTextWidth;
}

Some links with accented characters and dot doesn't open on Chrome, Explorer and Edge

I'm dealing with an issue at my work that I had never seen. When I'm developing I use always Firefox and generating an HTML by a XSL on JAVA I tested the links on Firefox and ALL works, even if they have or not accented characters or dots at the end of the URL (https://..........some words**.**) When you click on the link it sends you to the bottom of the page where is the info of that link (https://...............#name displayed on the clicked link
But today, my boss openned an issue telling me that on Chrome, Edge and Explorer, the links with accented characters or dots on the URL can't be openned. So I tried click some links and on Chrome, some works and others not work..... On Explorer and Edge none works. I'm very rookie dealing with display browser problems.
So, I've checked the code that transforms the XML template to HTML and I tried to add this two lines:
transformer.setOutputProperty(OutputKeys.METHOD, "text/html");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
(With these two lines, the browser shows a ? instead the accented characters, I don't know why)
Moreover, on the XML template I've added:
<xsl:template match="/">
<html>
<head>
<meta charset="UTF-8"></meta>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> </meta>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> </meta>
</head>
...... more template code ......
But the result it's the same. On Firefox all links work, on Chrome some yes and some no, on Explorer and Edge none of them.
Why it works on Firefox and on the rest of all no?
Regards.
------------- UPDATE -------------
The file it's generated by a desktop application and creates a html file that it's opened at the end of the process by the default browser of the system.
I thought that the problem was not encoding on UTF-8, but I've changed the encondig to the original (ISO-8859-1) because the result it's the same.
The code is:
public URL createHTML(ReportValidationTO validationTO) throws IOException, SAXException, IntrospectionException {
try {
PATH_XML = File.createTempFile("validacion", ".xml").getAbsolutePath();
String path_xsl = ConfigurationParametersManager.getParameter(PATH_XSL);
BeanReader reader = new BeanReader();
reader.registerBeanClass("validation", ReportValidationTO.class);
BeanWriter bWriter = initHTML();
AttributeDescriptor a1 = new AttributeDescriptor("validationName");
ElementDescriptor e1 = new ElementDescriptor();
e1.addAttributeDescriptor(a1);
XMLBeanInfo xmlInfo = new XMLBeanInfo(ReportValidationTO.class);
xmlInfo.setElementDescriptor(e1);
bWriter.write("validationTO", validationTO);
bWriter.flush();
InputStream inputXSL = getClass().getResourceAsStream(path_xsl);
URL retorno = (URL) transformToHTML(PATH_XML, inputXSL);
return retorno;
} catch (Exception e) {
logger.info("No se pudo cargar el archivo ");
logger.info("El error fue : " + e.getClass().getName() + " " + e.getMessage());
return null;
}
}
private BeanWriter initHTML() throws IOException, MissingConfigurationParameterException {
FileWriter fWriter = new FileWriter(PATH_XML);
BeanWriter bWriter = new BeanWriter(fWriter);
bWriter.setIndent("\t");
String path_xsl = ConfigurationParametersManager.getParameter(PATH_XSL);
URL url_xsl = getClass().getResource(path_xsl);
String encoding = "<?xml version=" + "\"1.0\"" + " encoding=" + "\"ISO-8859-1\"" + " standalone=" + "\"yes\"" + "?>";
String xslFile = "<?xml-stylesheet type=" + "\"text/xsl\"" + " href=" + "\"" + url_xsl + "\"" + "?>";
bWriter.writeXmlDeclaration(encoding);
bWriter.writeXmlDeclaration(xslFile);
return bWriter;
}
And then:
private URL transformToHTML(String sXMLData, InputStream inputXSL) {
try {
Source xmlSource = new StreamSource(new File(sXMLData));
Source xsltSource = new StreamSource(inputXSL);
StringWriter cadenaSalida = new StringWriter();
Result bufferResultado = new StreamResult(cadenaSalida);
TransformerFactory factoriaTrans = TransformerFactory.newInstance();
Transformer transformador = factoriaTrans.newTransformer(xsltSource);
transformador.setOutputProperty(OutputKeys.METHOD, "html");
transformador.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
transformador.transform(xmlSource, bufferResultado);
File salida = File.createTempFile("validacion", ".html");
FileOutputStream out = new FileOutputStream(salida);
byte[] bytesSalida = cadenaSalida.toString().getBytes();
out.write(bytesSalida);
out.close();
URL url = salida.toURI().toURL();
return url;
} catch (Exception e) {
logger.info("\nERROR EN TRANSFORM HTML VALIDACIONES");
logger.error(LoggerHelper.getStackTrace(e));
return null;
}
}
------- Update with some HTML code -------
<font face="Verdana" color="#003399"><b>Title Example</b></font>
<ul type="disc">
<li>
<font size="-1" face="Verdana">SERIALNUMER2: Frase con acentos, el estado está en ejecución</font><a><font size="-1" color="red" face="Verdana">
[Fails:
3
]
</font></a>
</li>
</ul>
<a name="Linked Example"></a><b><font size="+1" face="Verdana">After click on the second link from above, it should send you here</font></b>
<hr color="black" WIDTH="100%">
<br>
<a name="Link 1: Frase con acentos, el estado est%C3%A1 en ejecuci%C3%B3n"></a><b><font size="-1" face="Verdana">Validacion:</font></b><font size="-1" face="Verdana">SERIALNUMER2: Frase con acentos, el estado está en ejecución</font>
<br>
<b><font size="-1" face="Verdana">Solution:</font></b><font size="-1" face="Verdana">None</font>
<br>
<br>
<table WIDTH="100%" BORDER="1">
<caption>
<font size="+1" face="Verdana" color="red">Error list</font>
</caption>
<tr>
<th align="LEFT" bgcolor="dddddd"><b>column1</b></th><th align="LEFT" bgcolor="dddddd"><b>column2</b></th><th align="LEFT" bgcolor="dddddd"><b>column3</b></th><th align="LEFT" bgcolor="dddddd"><b>column4</b></th><th align="LEFT" bgcolor="dddddd"><b>column5</b></th><th align="LEFT" bgcolor="dddddd"><b>column6</b></th><th align="LEFT" bgcolor="dddddd"><b>column7</b></th>
</tr>
<tr>
<td align="LEFT">2000</td><td align="LEFT">15</td><td align="LEFT">019</td><td align="LEFT">001</td><td align="LEFT">1087</td><td align="LEFT">0</td><td align="LEFT">B</td>
</tr>
<tr>
<td align="LEFT">2000</td><td align="LEFT">15</td><td align="LEFT">019</td><td align="LEFT">001</td><td align="LEFT">1113</td><td align="LEFT">0</td><td align="LEFT">B</td>
</tr>
<tr>
<td align="LEFT">2000</td><td align="LEFT">15</td><td align="LEFT">069</td><td align="LEFT">001</td><td align="LEFT">125</td><td align="LEFT">0</td><td align="LEFT">B</td>
</tr>
</table>
<br>
<b><font size="-1" color="#FF0000" face="Verdana">
Total:
3
fail(s)
</font></b>
<br>
<b><font size="-1" face="Verdana">
The end
:
</font></b><b><font color="red" size="-1" face="Verdana">Problems found</font></b>
On the snippet, here:
href="#Link 1: Frase con acentos, est%C3%A1 en ejecuci%C3%B3n"
and here:
name="Link 1: Frase con acentos, el estado est%C3%A1 en ejecuci%C3%B3n"
To make it work on Edge, I need replace %C3%A1 with a and %C3%B3 with o if you want to get redirected to the position on the page where are the details of the link.
So what is the aim, writing out a HTML file with the Java Transformer? In which encoding? And if you want to write out a file why are you using a StringWriter in between? Consider to declare in the XSLT with e.g. <xsl:output method="html" encoding="UTF-8"/> which output method and encoding you want, then, to write with your Transformer to the HTML file named validacion.html simply create a new StreamResult("validacion.html") (https://docs.oracle.com/javase/8/docs/api/javax/xml/transform/stream/StreamResult.html#StreamResult-java.lang.String-)and pass that to the transform method. And don't put any encoding info (like <meta http-equiv="content-type" content="text/html; charset=UTF-8"> literally into the HTML your XSLT creates, the Transformer will do its job based on the xsl:output directive, as long as you let it do its job with properly used StreamResult. Trying to create a temporary StringWriter result and converting a string to bytes to write them out to a FileOutputStream is not necessary and probably causing encoding/decoding inconsistency.
<font>
is depreciated. Use css font-family instead. Web browsers have a default font-family that they will fall back to if any of the css font-families are not installed on the OS. IE has an accessibility setting to "Ignore font styles specified on web pages".
Wikipedia uses this style rule.
.uc {
font-family: Code2000, "TITUS Cyberbit Basic", "Doulos SIL",
"Chrysanthi Unicode", "Bitstream Cyberbit",
"Bitstream CyberBase", Thryomanes, Gentium, GentiumAlt,
"Lucida Grande", "Arial Unicode MS", "Microsoft Sans Serif",
"Lucida Sans Unicode";
font-family /**/:inherit; /* resets fonts for everyone but IE6 */
}
add the uc class to the body tag.
To debug your web page output use the DOM Explorer of the dev tool, to inspect the css rules applied to the element or textContent of an element.
Ok, finally I got the links work. Thanks to Rob Parsons and Martin Honnen
The problems where these two:
The URL at href was being generated with spaces (thanks Martin)
href="#Link 1: Frase con acentos, est%C3%A1 en ejecuci%C3%B3n" <- I removed the spaces on the XSLT with translate(validationName, ' ','-')
On the reference of the href link as these was a legacy code, there was name but in HTML5 it's deprecated so now you must use "id" so here:
I changed:
**name**="Link 1: Frase con acentos, el estado est%C3%A1 en ejecuci%C3%B3n" (also removed spaces with translate(validationName, ' ','-'))
by
**id**="Link 1: Frase con acentos, el estado est%C3%A1 en ejecuci%C3%B3n" (also removed spaces with translate(validationName, ' ','-'))

Write HTML code to open PDF in browser

I generate an html file from word document which has some links to pdf file. When I open it in some browsers, they download prompt comes up. What I need, is to open the pdf file in the same browser window.
I read that one solution is to include the following commands in header file:
Content-Type: application/pdf
Content-Disposition: inline; "filename.pdf"
However, I don't know which part of my pdf file I have to put them. Here is the header of my html code.
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 14 (filtered)">
<base href=x>
<title>Welcome to SELSE-1, which we anticipate will be the first of a series of
annual workshops to bring together experts from both industry and academia to
discuss current and future trends in Soft Error Upset (SEU) rates and the state
of the art and possible</title>
<style>
<!--
/* Font Definitions */
#font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
#font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
#font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
#font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
#font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
#font-face
{font-family:"Lucida Grande";}
#font-face
{font-family:"\#MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
h2
{mso-style-link:"Heading 2 Char";
margin-right:0in;
margin-left:0in;
font-size:18.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
p.MsoCommentText, li.MsoCommentText, div.MsoCommentText
{mso-style-link:"Comment Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoHeader, li.MsoHeader, div.MsoHeader
{mso-style-link:"Header Char";
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{mso-style-link:"Footer Char";
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p
{margin-right:0in;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoCommentSubject, li.MsoCommentSubject, div.MsoCommentSubject
{mso-style-link:"Comment Subject Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
p.MsoRMPane, li.MsoRMPane, div.MsoRMPane
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.maroon
{mso-style-name:maroon;}
span.HeaderChar
{mso-style-name:"Header Char";
mso-style-link:Header;
font-family:"Times New Roman","serif";}
span.FooterChar
{mso-style-name:"Footer Char";
mso-style-link:Footer;
font-family:"Times New Roman","serif";}
span.Title1
{mso-style-name:Title1;}
span.authors
{mso-style-name:authors;}
span.CommentTextChar
{mso-style-name:"Comment Text Char";
mso-style-link:"Comment Text";}
span.CommentSubjectChar
{mso-style-name:"Comment Subject Char";
mso-style-link:"Comment Subject";
font-weight:bold;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-link:"Heading 2";
font-family:"Times New Roman","serif";
font-weight:bold;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin-right:0in;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.Default, li.Default, div.Default
{mso-style-name:Default;
margin:0in;
margin-bottom:.0001pt;
text-autospace:none;
font-size:12.0pt;
font-family:"Arial","sans-serif";
color:black;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
.MsoChpDefault
{font-size:10.0pt;}
/* Page Definitions */
#page WordSection1
{size:8.5in 11.0in;
margin:1.0in 89.85pt 64.9pt 89.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
</head>
You can't force a browser to display a PDF, but you can tell it that it can if it is already set up to do so.
What you need to do is serve the file with the headers you mentioned. This tells the browser that the content it's loading is actually a PDF, and if it set up to open PDF's it will. Otherwise, a download is likely to be initiated.
More specifically, you need to attach the headers to the response given by the web-server when it fetches the file. The actual application can vary widely depending on your web-server and on how you're serving the file.
For example, if the file is served through a servlet, you can set the content-type inside the servlet (java):
response.setContentType("application/pdf");
If it is served directly (as in, you're just linking to the file with <a>) then you need to set this up on a server scale. For example, in tomcat you set this up in the web.xml file like so:
<mime-mapping>
<extension>pdf</extension>
<mime-type>application/pdf</mime-type>
</mime-mapping>
This sets the server in a way that any file served with a .pdf extension automatically receives the proper content-type.

ActiveSync Fetch Command. How to Get MessageID

Use ItemOperations to get a message:
How do I get the Headers in Particular the MessageID for the Email?
I'm confused the example on MSDN clearly shows the email Header.
http://msdn.microsoft.com/en-us/library/ee220018%28v=EXCHG.80%29.aspx
Am I missing an additional command/field/Flag?
Thanks,
Pat
Environment
Exchange 2003 Protocol: 12.1 ActiveSync
IN:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ItemOperations xmlns:airsync=\"AirSync:\" xmlns:airsyncbase=\"AirSyncBase:\" xmlns=\"ItemOperations:\">
<Fetch>
<Store>Mailbox</Store>
<airsync:CollectionId>6</airsync:CollectionId>
<airsync:ServerId>6:1</airsync:ServerId>
<Options>
<airsync:MIMESupport>1</airsync:MIMESupport>
<airsyncbase:BodyPreference>
<airsyncbase:Type>2</airsyncbase:Type>
<airsyncbase:TruncationSize>5120</airsyncbase:TruncationSize>
<airsyncbase:AllOrNone>0</airsyncbase:AllOrNone>
</airsyncbase:BodyPreference>
</Options>
</Fetch>
</ItemOperations>
OUTPUT:
XML Response:
<?xml version="1.0" encoding="utf-8"?>
<itemoperations:ItemOperations xmlns:itemoperations="ItemOperations:">
<itemoperations:Status>1</itemoperations:Status>
<itemoperations:Response>
<itemoperations:Fetch>
<itemoperations:Status>1</itemoperations:Status>
<airsync:CollectionId xmlns:airsync="AirSync:">6</airsync:CollectionId>
<airsync:ServerId xmlns:airsync="AirSync:">6:1</airsync:ServerId>
<airsync:Class xmlns:airsync="AirSync:">Email</airsync:Class>
<itemoperations:Properties>
<email:To xmlns:email="Email:">"pat2 pm. mol" <pat2.test#dhmars.loc&g
t;</email:To>
<email:From xmlns:email="Email:">"pat2 pm. mol" <pat2.test#dhmars.loc
></email:From>
<email:Subject xmlns:email="Email:">TESTMAIL</email:Subject>
<email:DateReceived xmlns:email="Email:">2011-12-06T15:22:24.613Z</email
:DateReceived>
<email:DisplayTo xmlns:email="Email:">pat2 pm. mol</email:DisplayTo>
<email:ThreadTopic xmlns:email="Email:">TESTMAIL</email:ThreadTopic>
<email:Importance xmlns:email="Email:">1</email:Importance>
<email:Read xmlns:email="Email:">1</email:Read>
<airsyncbase:Body xmlns:airsyncbase="AirSyncBase:">
<airsyncbase:Type>2</airsyncbase:Type>
<airsyncbase:EstimatedDataSize>1627</airsyncbase:EstimatedDataSize>
<airsyncbase:Data><html>
<head>
<style>
<!--
#font-face
{font-family:"Cambria Math"}
#font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
span.EmailStyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-family:"Calibri","sans-serif"}
#page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
{}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">&nbsp;</p>
</div>
</body>
</html>
</airsyncbase:Data>
</airsyncbase:Body>
<email:MessageClass xmlns:email="Email:">IPM.Note</email:MessageClass>
<email:InternetCPID xmlns:email="Email:">20127</email:InternetCPID>
<email:Flag xmlns:email="Email:" />
<email:ContentClass xmlns:email="Email:">urn:content-classes:message</em
ail:ContentClass>
<airsyncbase:NativeBodyType xmlns:airsyncbase="AirSyncBase:">2</airsyncb
ase:NativeBodyType>
</itemoperations:Properties>
</itemoperations:Fetch>
</itemoperations:Response>
</itemoperations:ItemOperations>
You have set airsyncbase:Type = 2. This gives you an HTML response.
You need to set Type = 4 if you want a full MIME response. That will have all the headers that you need.
See 2.2.2.22 Type of [MS-ASAIRS]: Exchange ActiveSync: AirSyncBase Namespace Protocol at http://msdn.microsoft.com/en-us/library/hh475675(v=exchg.80).aspx.
Seems ok, but, first of all, you have to check if the request support a ASAcceptMultiPart:
http://msdn.microsoft.com/en-us/library/ee159875%28v=EXCHG.80%29.aspx

h1 and h2 classes not showing up in Internet Explorer

I'm having trouble getting the h1 and h2 tags to display at all in Internet Explorer. I looked at the CSS file but still couldn't see why it wouldn't work with IE9.
Here is the CSS code for the headers that are not showing up in IE:
.person h1
{
color: #475261;
font-size: 48px;
font-weight: 400;
letter-spacing: -1px;
margin-left: -60px;
}
.item h2
{
color: #06A;
font-family: Georgia, serif;
font-size: 22px;
font-weight: 400;
letter-spacing: -1px;
}
.item h2 a
{
color: #06A;
text-decoration: none;
}
Link: http://ItsNotch.com/experience
Cause of Problem
It appears that the h1 elements are being replaced by canvas elements by the cufon-yui.js script. According to this FAQ, it is known to not work in IE 9 Beta.
First Solution
However, they state there is a fix for it in their version 1.09i available at their official site.
Second Solution
If you look at item 8 of the FAQ, they say that if you don't want to update your js file, you can try some other code:
<!--[if gte IE 9]>
<script type="text/javascript">
Cufon.set('engine', 'canvas');
</script>
<![endif]-->
Read the FAQ for further instructions. I'm not sure if it will work though, just a warning.
Third Solution
You may also be interested in trying Typekit instead, which according to the cufon main site, also has the advantage of the text being selectable, which it currently isn't using cufon:
You might also want to take this
opportunity to try Typekit, a hosted,
#font-face-based alternative. Yes,
that means they support text
selection. It's the easiest way to
embrace standards.
Fourth Solution
You also always have the option of just not using one of these JavaScript-injected special fonts at all.
Replace cufon.js with the code given below, and problem solved.
/*
* Copyright (c) 2009 Simo Kinnunen.
* Licensed under the MIT license.
*
* #version 1.09i
*/
var Cufon=(function(){var m=function(){return m.replace.apply(null,arguments)};var x=m.DOM={ready:(function(){var C=false,E={loaded:1,complete:1};var B=[],D=function(){if(C){return}C=true;for(var F;F=B.shift();F()){}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",D,false);window.addEventListener("pageshow",D,false)}if(!window.opera&&document.readyState){(function(){E[document.readyState]?D():setTimeout(arguments.callee,10)})()}if(document.readyState&&document.createStyleSheet){(function(){try{document.body.doScroll("left");D()}catch(F){setTimeout(arguments.callee,1)}})()}q(window,"load",D);return function(F){if(!arguments.length){D()}else{C?F():B.push(F)}}})(),root:function(){return document.documentElement||document.body}};var n=m.CSS={Size:function(C,B){this.value=parseFloat(C);this.unit=String(C).match(/[a-z%]*$/)[0]||"px";this.convert=function(D){return D/B*this.value};this.convertFrom=function(D){return D/this.value*B};this.toString=function(){return this.value+this.unit}},addClass:function(C,B){var D=C.className;C.className=D+(D&&" ")+B;return C},color:j(function(C){var B={};B.color=C.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(E,D,F){B.opacity=parseFloat(F);return"rgb("+D+")"});return B}),fontStretch:j(function(B){if(typeof B=="number"){return B}if(/%$/.test(B)){return parseFloat(B)/100}return{"ultra-condensed":0.5,"extra-condensed":0.625,condensed:0.75,"semi-condensed":0.875,"semi-expanded":1.125,expanded:1.25,"extra-expanded":1.5,"ultra-expanded":2}[B]||1}),getStyle:function(C){var B=document.defaultView;if(B&&B.getComputedStyle){return new a(B.getComputedStyle(C,null))}if(C.currentStyle){return new a(C.currentStyle)}return new a(C.style)},gradient:j(function(F){var G={id:F,type:F.match(/^-([a-z]+)-gradient\(/)[1],stops:[]},C=F.substr(F.indexOf("(")).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);for(var E=0,B=C.length,D;E<B;++E){D=C[E].split("=",2).reverse();G.stops.push([D[1]||E/(B-1),D[0]])}return G}),quotedList:j(function(E){var D=[],C=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,B;while(B=C.exec(E)){D.push(B[3]||B[1])}return D}),recognizesMedia:j(function(G){var E=document.createElement("style"),D,C,B;E.type="text/css";E.media=G;try{E.appendChild(document.createTextNode("/**/"))}catch(F){}C=g("head")[0];C.insertBefore(E,C.firstChild);D=(E.sheet||E.styleSheet);B=D&&!D.disabled;C.removeChild(E);return B}),removeClass:function(D,C){var B=RegExp("(?:^|\\s+)"+C+"(?=\\s|$)","g");D.className=D.className.replace(B,"");return D},supports:function(D,C){var B=document.createElement("span").style;if(B[D]===undefined){return false}B[D]=C;return B[D]===C},textAlign:function(E,D,B,C){if(D.get("textAlign")=="right"){if(B>0){E=" "+E}}else{if(B<C-1){E+=" "}}return E},textShadow:j(function(F){if(F=="none"){return null}var E=[],G={},B,C=0;var D=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(B=D.exec(F)){if(B[0]==","){E.push(G);G={};C=0}else{if(B[1]){G.color=B[1]}else{G[["offX","offY","blur"][C++]]=B[2]}}}E.push(G);return E}),textTransform:(function(){var B={uppercase:function(C){return C.toUpperCase()},lowercase:function(C){return C.toLowerCase()},capitalize:function(C){return C.replace(/\b./g,function(D){return D.toUpperCase()})}};return function(E,D){var C=B[D.get("textTransform")];return C?C(E):E}})(),whiteSpace:(function(){var D={inline:1,"inline-block":1,"run-in":1};var C=/^\s+/,B=/\s+$/;return function(H,F,G,E){if(E){if(E.nodeName.toLowerCase()=="br"){H=H.replace(C,"")}}if(D[F.get("display")]){return H}if(!G.previousSibling){H=H.replace(C,"")}if(!G.nextSibling){H=H.replace(B,"")}return H}})()};n.ready=(function(){var B=!n.recognizesMedia("all"),E=false;var D=[],H=function(){B=true;for(var K;K=D.shift();K()){}};var I=g("link"),J=g("style");function C(K){return K.disabled||G(K.sheet,K.media||"screen")}function G(M,P){if(!n.recognizesMedia(P||"all")){return true}if(!M||M.disabled){return false}try{var Q=M.cssRules,O;if(Q){search:for(var L=0,K=Q.length;O=Q[L],L<K;++L){switch(O.type){case 2:break;case 3:if(!G(O.styleSheet,O.media.mediaText)){return false}break;default:break search}}}}catch(N){}return true}function F(){if(document.createStyleSheet){return true}var L,K;for(K=0;L=I[K];++K){if(L.rel.toLowerCase()=="stylesheet"&&!C(L)){return false}}for(K=0;L=J[K];++K){if(!C(L)){return false}}return true}x.ready(function(){if(!E){E=n.getStyle(document.body).isUsable()}if(B||(E&&F())){H()}else{setTimeout(arguments.callee,10)}});return function(K){if(B){K()}else{D.push(K)}}})();function s(D){var C=this.face=D.face,B={"\u0020":1,"\u00a0":1,"\u3000":1};this.glyphs=D.glyphs;this.w=D.w;this.baseSize=parseInt(C["units-per-em"],10);this.family=C["font-family"].toLowerCase();this.weight=C["font-weight"];this.style=C["font-style"]||"normal";this.viewBox=(function(){var F=C.bbox.split(/\s+/);var E={minX:parseInt(F[0],10),minY:parseInt(F[1],10),maxX:parseInt(F[2],10),maxY:parseInt(F[3],10)};E.width=E.maxX-E.minX;E.height=E.maxY-E.minY;E.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")};return E})();this.ascent=-parseInt(C.ascent,10);this.descent=-parseInt(C.descent,10);this.height=-this.ascent+this.descent;this.spacing=function(L,N,E){var O=this.glyphs,M,K,G,P=[],F=0,J=-1,I=-1,H;while(H=L[++J]){M=O[H]||this.missingGlyph;if(!M){continue}if(K){F-=G=K[H]||0;P[I]-=G}F+=P[++I]=~~(M.w||this.w)+N+(B[H]?E:0);K=M.k}P.total=F;return P}}function f(){var C={},B={oblique:"italic",italic:"oblique"};this.add=function(D){(C[D.style]||(C[D.style]={}))[D.weight]=D};this.get=function(H,I){var G=C[H]||C[B[H]]||C.normal||C.italic||C.oblique;if(!G){return null}I={normal:400,bold:700}[I]||parseInt(I,10);if(G[I]){return G[I]}var E={1:1,99:0}[I%100],K=[],F,D;if(E===undefined){E=I>400}if(I==500){I=400}for(var J in G){if(!k(G,J)){continue}J=parseInt(J,10);if(!F||J<F){F=J}if(!D||J>D){D=J}K.push(J)}if(I<F){I=F}if(I>D){I=D}K.sort(function(M,L){return(E?(M>=I&&L>=I)?M<L:M>L:(M<=I&&L<=I)?M>L:M<L)?-1:1});return G[K[0]]}}function r(){function D(F,G){if(F.contains){return F.contains(G)}return F.compareDocumentPosition(G)&16}function B(G){var F=G.relatedTarget;if(!F||D(this,F)){return}C(this,G.type=="mouseover")}function E(F){C(this,F.type=="mouseenter")}function C(F,G){setTimeout(function(){var H=d.get(F).options;m.replace(F,G?h(H,H.hover):H,true)},10)}this.attach=function(F){if(F.onmouseenter===undefined){q(F,"mouseover",B);q(F,"mouseout",B)}else{q(F,"mouseenter",E);q(F,"mouseleave",E)}}}function u(){var C=[],D={};function B(H){var E=[],G;for(var F=0;G=H[F];++F){E[F]=C[D[G]]}return E}this.add=function(F,E){D[F]=C.push(E)-1};this.repeat=function(){var E=arguments.length?B(arguments):C,F;for(var G=0;F=E[G++];){m.replace(F[0],F[1],true)}}}function A(){var D={},B=0;function C(E){return E.cufid||(E.cufid=++B)}this.get=function(E){var F=C(E);return D[F]||(D[F]={})}}function a(B){var D={},C={};this.extend=function(E){for(var F in E){if(k(E,F)){D[F]=E[F]}}return this};this.get=function(E){return D[E]!=undefined?D[E]:B[E]};this.getSize=function(F,E){return C[F]||(C[F]=new n.Size(this.get(F),E))};this.isUsable=function(){return !!B}}function q(C,B,D){if(C.addEventListener){C.addEventListener(B,D,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){return D.call(C,window.event)})}}}function v(C,B){var D=d.get(C);if(D.options){return C}if(B.hover&&B.hoverables[C.nodeName.toLowerCase()]){b.attach(C)}D.options=B;return C}function j(B){var C={};return function(D){if(!k(C,D)){C[D]=B.apply(null,arguments)}return C[D]}}function c(F,E){var B=n.quotedList(E.get("fontFamily").toLowerCase()),D;for(var C=0;D=B[C];++C){if(i[D]){return i[D].get(E.get("fontStyle"),E.get("fontWeight"))}}return null}function g(B){return document.getElementsByTagName(B)}function k(C,B){return C.hasOwnProperty(B)}function h(){var C={},B,F;for(var E=0,D=arguments.length;B=arguments[E],E<D;++E){for(F in B){if(k(B,F)){C[F]=B[F]}}}return C}function o(E,M,C,N,F,D){var K=document.createDocumentFragment(),H;if(M===""){return K}var L=N.separate;var I=M.split(p[L]),B=(L=="words");if(B&&t){if(/^\s/.test(M)){I.unshift("")}if(/\s$/.test(M)){I.push("")}}for(var J=0,G=I.length;J<G;++J){H=z[N.engine](E,B?n.textAlign(I[J],C,J,G):I[J],C,N,F,D,J<G-1);if(H){K.appendChild(H)}}return K}function l(D,M){var C=D.nodeName.toLowerCase();if(M.ignore[C]){return}var E=!M.textless[C];var B=n.getStyle(v(D,M)).extend(M);var F=c(D,B),G,K,I,H,L,J;if(!F){return}for(G=D.firstChild;G;G=I){K=G.nodeType;I=G.nextSibling;if(E&&K==3){if(H){H.appendData(G.data);D.removeChild(G)}else{H=G}if(I){continue}}if(H){D.replaceChild(o(F,n.whiteSpace(H.data,B,H,J),B,M,G,D),H);H=null}if(K==1){if(G.firstChild){if(G.nodeName.toLowerCase()=="cufon"){z[M.engine](F,null,B,M,G,D)}else{arguments.callee(G,M)}}J=G}}}var t=" ".split(/\s+/).length==0;var d=new A();var b=new r();var y=new u();var e=false;var z={},i={},w={autoDetect:false,engine:null,forceHitArea:false,hover:false,hoverables:{a:true},ignore:{applet:1,canvas:1,col:1,colgroup:1,head:1,iframe:1,map:1,optgroup:1,option:1,script:1,select:1,style:1,textarea:1,title:1,pre:1},printable:true,selector:(window.Sizzle||(window.jQuery&&function(B){return jQuery(B)})||(window.dojo&&dojo.query)||(window.Ext&&Ext.query)||(window.YAHOO&&YAHOO.util&&YAHOO.util.Selector&&YAHOO.util.Selector.query)||(window.$$&&function(B){return $$(B)})||(window.$&&function(B){return $(B)})||(document.querySelectorAll&&function(B){return document.querySelectorAll(B)})||g),separate:"words",textless:{dl:1,html:1,ol:1,table:1,tbody:1,thead:1,tfoot:1,tr:1,ul:1},textShadow:"none"};var p={words:/\s/.test("\u00a0")?/[^\S\u00a0]+/:/\s+/,characters:"",none:/^/};m.now=function(){x.ready();return m};m.refresh=function(){y.repeat.apply(y,arguments);return m};m.registerEngine=function(C,B){if(!B){return m}z[C]=B;return m.set("engine",C)};m.registerFont=function(D){if(!D){return m}var B=new s(D),C=B.family;if(!i[C]){i[C]=new f()}i[C].add(B);return m.set("fontFamily",'"'+C+'"')};m.replace=function(D,C,B){C=h(w,C);if(!C.engine){return m}if(!e){n.addClass(x.root(),"cufon-active cufon-loading");n.ready(function(){n.addClass(n.removeClass(x.root(),"cufon-loading"),"cufon-ready")});e=true}if(C.hover){C.forceHitArea=true}if(C.autoDetect){delete C.fontFamily}if(typeof C.textShadow=="string"){C.textShadow=n.textShadow(C.textShadow)}if(typeof C.color=="string"&&/^-/.test(C.color)){C.textGradient=n.gradient(C.color)}else{delete C.textGradient}if(!B){y.add(D,arguments)}if(D.nodeType||typeof D=="string"){D=[D]}n.ready(function(){for(var F=0,E=D.length;F<E;++F){var G=D[F];if(typeof G=="string"){m.replace(C.selector(G),C,true)}else{l(G,C)}}});return m};m.set=function(B,C){w[B]=C;return m};return m})();Cufon.registerEngine("vml",(function(){var e=document.namespaces;if(!e){return}e.add("cvml","urn:schemas-microsoft-com:vml");e=null;var b=document.createElement("cvml:shape");b.style.behavior="url(#default#VML)";if(!b.coordsize){return}b=null;var h=(document.documentMode||0)<8;document.write(('<style type="text/css">cufoncanvas{text-indent:0;}#media screen{cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}cufoncanvas{position:absolute;text-align:left;}cufon{display:inline-block;position:relative;vertical-align:'+(h?"middle":"text-bottom")+";}cufon cufontext{position:absolute;left:-10000in;font-size:1px;}a cufon{cursor:pointer}}#media print{cufon cufoncanvas{display:none;}}</style>").replace(/;/g,"!important;"));function c(i,j){return a(i,/(?:em|ex|%)$|^[a-z-]+$/i.test(j)?"1em":j)}function a(l,m){if(m==="0"){return 0}if(/px$/i.test(m)){return parseFloat(m)}var k=l.style.left,j=l.runtimeStyle.left;l.runtimeStyle.left=l.currentStyle.left;l.style.left=m.replace("%","em");var i=l.style.pixelLeft;l.style.left=k;l.runtimeStyle.left=j;return i}function f(l,k,j,n){var i="computed"+n,m=k[i];if(isNaN(m)){m=k.get(n);k[i]=m=(m=="normal")?0:~~j.convertFrom(a(l,m))}return m}var g={};function d(p){var q=p.id;if(!g[q]){var n=p.stops,o=document.createElement("cvml:fill"),i=[];o.type="gradient";o.angle=180;o.focus="0";o.method="sigma";o.color=n[0][1];for(var m=1,l=n.length-1;m<l;++m){i.push(n[m][0]*100+"% "+n[m][1])}o.colors=i.join(",");o.color2=n[l][1];g[q]=o}return g[q]}return function(ac,G,Y,C,K,ad,W){var n=(G===null);if(n){G=K.alt}var I=ac.viewBox;var p=Y.computedFontSize||(Y.computedFontSize=new Cufon.CSS.Size(c(ad,Y.get("fontSize"))+"px",ac.baseSize));var y,q;if(n){y=K;q=K.firstChild}else{y=document.createElement("cufon");y.className="cufon cufon-vml";y.alt=G;q=document.createElement("cufoncanvas");y.appendChild(q);if(C.printable){var Z=document.createElement("cufontext");Z.appendChild(document.createTextNode(G));y.appendChild(Z)}if(!W){y.appendChild(document.createElement("cvml:shape"))}}var ai=y.style;var R=q.style;var l=p.convert(I.height),af=Math.ceil(l);var V=af/l;var P=V*Cufon.CSS.fontStretch(Y.get("fontStretch"));var U=I.minX,T=I.minY;R.height=af;R.top=Math.round(p.convert(T-ac.ascent));R.left=Math.round(p.convert(U));ai.height=p.convert(ac.height)+"px";var F=Y.get("color");var ag=Cufon.CSS.textTransform(G,Y).split("");var L=ac.spacing(ag,f(ad,Y,p,"letterSpacing"),f(ad,Y,p,"wordSpacing"));if(!L.length){return null}var k=L.total;var x=-U+k+(I.width-L[L.length-1]);var ah=p.convert(x*P),X=Math.round(ah);var O=x+","+I.height,m;var J="r"+O+"ns";var u=C.textGradient&&d(C.textGradient);var o=ac.glyphs,S=0;var H=C.textShadow;var ab=-1,aa=0,w;while(w=ag[++ab]){var D=o[ag[ab]]||ac.missingGlyph,v;if(!D){continue}if(n){v=q.childNodes[aa];while(v.firstChild){v.removeChild(v.firstChild)}}else{v=document.createElement("cvml:shape");q.appendChild(v)}v.stroked="f";v.coordsize=O;v.coordorigin=m=(U-S)+","+T;v.path=(D.d?"m"+D.d+"xe":"")+"m"+m+J;v.fillcolor=F;if(u){v.appendChild(u.cloneNode(false))}var ae=v.style;ae.width=X;ae.height=af;if(H){var s=H[0],r=H[1];var B=Cufon.CSS.color(s.color),z;var N=document.createElement("cvml:shadow");N.on="t";N.color=B.color;N.offset=s.offX+","+s.offY;if(r){z=Cufon.CSS.color(r.color);N.type="double";N.color2=z.color;N.offset2=r.offX+","+r.offY}N.opacity=B.opacity||(z&&z.opacity)||1;v.appendChild(N)}S+=L[aa++]}var M=v.nextSibling,t,A;if(C.forceHitArea){if(!M){M=document.createElement("cvml:rect");M.stroked="f";M.className="cufon-vml-cover";t=document.createElement("cvml:fill");t.opacity=0;M.appendChild(t);q.appendChild(M)}A=M.style;A.width=X;A.height=af}else{if(M){q.removeChild(M)}}ai.width=Math.max(Math.ceil(p.convert(k*P)),0);if(h){var Q=Y.computedYAdjust;if(Q===undefined){var E=Y.get("lineHeight");if(E=="normal"){E="1em"}else{if(!isNaN(E)){E+="em"}}Y.computedYAdjust=Q=0.5*(a(ad,E)-parseFloat(ai.height))}if(Q){ai.marginTop=Math.ceil(Q)+"px";ai.marginBottom=Q+"px"}}return y}})());Cufon.registerEngine("canvas",(function(){var b=document.createElement("canvas");if(!b||!b.getContext||!b.getContext.apply){return}b=null;var a=Cufon.CSS.supports("display","inline-block");var e=!a&&(document.compatMode=="BackCompat"||/frameset|transitional/i.test(document.doctype.publicId));var f=document.createElement("style");f.type="text/css";f.appendChild(document.createTextNode(("cufon{text-indent:0;}#media screen,projection{cufon{display:inline;display:inline-block;position:relative;vertical-align:middle;"+(e?"":"font-size:1px;line-height:1px;")+"}cufon cufontext{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}"+(a?"cufon canvas{position:relative;}":"cufon canvas{position:absolute;}")+"}#media print{cufon{padding:0;}cufon canvas{display:none;}}").replace(/;/g,"!important;")));document.getElementsByTagName("head")[0].appendChild(f);function d(p,h){var n=0,m=0;var g=[],o=/([mrvxe])([^a-z]*)/g,k;generate:for(var j=0;k=o.exec(p);++j){var l=k[2].split(",");switch(k[1]){case"v":g[j]={m:"bezierCurveTo",a:[n+~~l[0],m+~~l[1],n+~~l[2],m+~~l[3],n+=~~l[4],m+=~~l[5]]};break;case"r":g[j]={m:"lineTo",a:[n+=~~l[0],m+=~~l[1]]};break;case"m":g[j]={m:"moveTo",a:[n=~~l[0],m=~~l[1]]};break;case"x":g[j]={m:"closePath"};break;case"e":break generate}h[g[j].m].apply(h,g[j].a)}return g}function c(m,k){for(var j=0,h=m.length;j<h;++j){var g=m[j];k[g.m].apply(k,g.a)}}return function(V,w,P,t,C,W){var k=(w===null);if(k){w=C.getAttribute("alt")}var A=V.viewBox;var m=P.getSize("fontSize",V.baseSize);var B=0,O=0,N=0,u=0;var z=t.textShadow,L=[];if(z){for(var U=z.length;U--;){var F=z[U];var K=m.convertFrom(parseFloat(F.offX));var I=m.convertFrom(parseFloat(F.offY));L[U]=[K,I];if(I<B){B=I}if(K>O){O=K}if(I>N){N=I}if(K<u){u=K}}}var Z=Cufon.CSS.textTransform(w,P).split("");var E=V.spacing(Z,~~m.convertFrom(parseFloat(P.get("letterSpacing"))||0),~~m.convertFrom(parseFloat(P.get("wordSpacing"))||0));if(!E.length){return null}var h=E.total;O+=A.width-E[E.length-1];u+=A.minX;var s,n;if(k){s=C;n=C.firstChild}else{s=document.createElement("cufon");s.className="cufon cufon-canvas";s.setAttribute("alt",w);n=document.createElement("canvas");s.appendChild(n);if(t.printable){var S=document.createElement("cufontext");S.appendChild(document.createTextNode(w));s.appendChild(S)}}var aa=s.style;var H=n.style;var j=m.convert(A.height);var Y=Math.ceil(j);var M=Y/j;var G=M*Cufon.CSS.fontStretch(P.get("fontStretch"));var J=h*G;var Q=Math.ceil(m.convert(J+O-u));var o=Math.ceil(m.convert(A.height-B+N));n.width=Q;n.height=o;H.width=Q+"px";H.height=o+"px";B+=A.minY;H.top=Math.round(m.convert(B-V.ascent))+"px";H.left=Math.round(m.convert(u))+"px";var r=Math.max(Math.ceil(m.convert(J)),0)+"px";if(a){aa.width=r;aa.height=m.convert(V.height)+"px"}else{aa.paddingLeft=r;aa.paddingBottom=(m.convert(V.height)-1)+"px"}var X=n.getContext("2d"),D=j/A.height;X.scale(D,D*M);X.translate(-u,-B);X.save();function T(){var x=V.glyphs,ab,l=-1,g=-1,y;X.scale(G,1);while(y=Z[++l]){var ab=x[Z[l]]||V.missingGlyph;if(!ab){continue}if(ab.d){X.beginPath();if(ab.code){c(ab.code,X)}else{ab.code=d("m"+ab.d,X)}X.fill()}X.translate(E[++g],0)}X.restore()}if(z){for(var U=z.length;U--;){var F=z[U];X.save();X.fillStyle=F.color;X.translate.apply(X,L[U]);T()}}var q=t.textGradient;if(q){var v=q.stops,p=X.createLinearGradient(0,A.minY,0,A.maxY);for(var U=0,R=v.length;U<R;++U){p.addColorStop.apply(p,v[U])}X.fillStyle=p}else{X.fillStyle=P.get("color")}T();return s}})());