<?xml version='1.0' standalone='yes'?>
  <container xmlns="http://www.w3.org/1999/xhtml"
    xmlns:var="http://www.skyrix.com/od/binding"
    xmlns:const="http://www.skyrix.com/od/constant"
    xmlns:uix="OGo:uix"
    xmlns:rsrc="OGo:url"
    xmlns:label="OGo:label">
    <var:if condition="clientObject.hasAttachment">
      <div class="menu" const:id="attachmentsMenu">
        <ul>
          <li><var:string label:value="Save all"/></li>
          <li class="separator"><!-- separator --></li
          ><var:foreach list="attachmentAttrs" item="attachment">
          <li var:data-url="attachment.urlAsAttachment"><img rsrc:src="attachment.gif"/><var:string value="attachment.filename"
          /> <span class="muted">(<var:string value="attachment.size" formatter="sizeFormatter"/>)</span></li>
        </var:foreach
        ></ul>
      </div>
    </var:if>
    <span id="messageContent">
    <input type="hidden" const:id="shouldAskReceipt" var:value="shouldAskReceipt"/>
    <span id="actionButtons">
      <var:if var:condition="mailIsDraft"
      ><a href="#" const:id="editDraftButton" class="button"><span><var:string label:value="Edit Draft..."/></span></a
      ></var:if>
      <a href="#" const:name="loadImagesButton" const:id="loadImagesButton"
         class="button"><span><var:string label:value="Load Images"/></span></a>
    </span>
    <table class="mailer_fieldtable">
      <tr class="mailer_fieldrow">
        <td class="mailer_fieldname" ><var:string label:value="Subject"/>:</td>
        <td class="mailer_subjectfieldvalue" id="subject"><var:string value="messageSubject"/></td>
      </tr>
      <tr class="mailer_fieldrow">
        <td class="mailer_fieldname" ><var:string label:value="From"/>:</td>
        <td class="mailer_fieldvalue">
          <var:foreach list="clientObject.fromEnvelopeAddresses"
            item="currentAddress">
            <a var:href="currentAddressLink">
              <var:string value="currentAddress"
                formatter="context.mailEnvelopeFullAddressFormatter" /></a>
          </var:foreach>
        </td>
      </tr>
      <tr class="mailer_fieldrow">
        <td class="mailer_fieldname"><var:string label:value="Date"/>:</td>
        <td class="mailer_fieldvalue">
          <var:string value="clientObject.date" 
            formatter="context.mailDateFormatter"/>
        </td>
      </tr>

      <tr class="mailer_fieldrow">
        <td class="mailer_fieldname"><img rsrc:src="plus.png" class="collapse" style="display: none;" /><var:string label:value="To"/>:</td>
        <td class="mailer_fieldvalue">
          <span class="collapse"><var:foreach list="clientObject.toEnvelopeAddresses"
            item="currentAddress"
            ><a var:href="currentAddressLink">
              <var:string value="currentAddress"
                formatter="context.mailEnvelopeFullAddressFormatter"
                /></a>
          </var:foreach></span>
        </td>
      </tr>
      <var:if condition="hasCC">
        <tr class="mailer_fieldrow">
          <td class="mailer_fieldname"><img rsrc:src="plus.png" class="collapse" style="display: none;" /><var:string label:value="CC"/>:</td>
          <td class="mailer_fieldvalue">
            <span class="collapse"><var:foreach list="clientObject.ccEnvelopeAddresses" 
              item="currentAddress">
              <a var:href="currentAddressLink"
		><var:string value="currentAddress"
                  formatter="context.mailEnvelopeFullAddressFormatter"
                  /></a>
              <!-- TODO: better to use li+CSS -->
            </var:foreach></span>
          </td>
        </tr>
      </var:if>
      <var:if condition="hasBCC">
        <tr class="mailer_fieldrow">
          <td class="mailer_fieldname"><img rsrc:src="plus.png" class="collapse" style="display: none;" /><var:string label:value="Bcc"/>:</td>
          <td class="mailer_fieldvalue">
            <span class="collapse"><var:foreach list="clientObject.bccEnvelopeAddresses" 
              item="currentAddress">
              <a var:href="currentAddressLink"
		><var:string value="currentAddress"
                  formatter="context.mailEnvelopeFullAddressFormatter"
                  /></a>
              <!-- TODO: better to use li+CSS -->
            </var:foreach></span>
          </td>
        </tr>
      </var:if>
      <var:if condition="hasReplyTo">
        <tr class="mailer_fieldrow">
          <td class="mailer_fieldname"><var:string label:value="Reply-To"/>:</td>
          <td class="mailer_fieldvalue">
            <var:foreach list="clientObject.replyToEnvelopeAddresses" 
              item="currentAddress">
              <a var:href="currentAddressLink"
		><var:string value="currentAddress"
                  formatter="context.mailEnvelopeFullAddressFormatter"
                  /></a>
            </var:foreach>
          </td>
        </tr>
      </var:if>
      <var:if condition="clientObject.hasAttachment">
        <tr class="mailer_fieldrow">
          <td class="mailer_fieldname"><img rsrc:src="title_attachment_14x14.png"/></td>
          <td class="mailer_fieldvalue">
            <a href="#" const:id="attachmentsHref"><var:string value="attachmentAttrs.count"/> <var:string value="attachmentsText"/></a>
          </td>
        </tr>
      </var:if>
    </table>

    <div class="mailer_mailcontent">
      <var:component value="contentViewerComponent"
        bodyInfo="clientObject.bodyStructure" />
    </div>
  </span>
  </container>
