<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/LICENSE-M1.txt
 *
 * @category   AW
 * @package    AW_Mobile
 * @copyright  Copyright (c) 2010-2011 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
 */
?>
<?php if ($this->helper('giftmessage/message')->getIsMessagesAvailable('items', $this->getOrder())): ?>
<script type="text/javascript">
//<![CDATA[
function giftMessageToogle(giftMessageIdentifier)
{
    var link = $('order-item-gift-message-link-'+giftMessageIdentifier);
    var container = $('order-item-gift-message-'+giftMessageIdentifier);
    var row = $('order-item-row-'+giftMessageIdentifier);
    if(link.expanded) {
        link.expanded = false;
        link.removeClassName('collapse');
        link.addClassName('expand');
        if(container.hasClassName('last')) {
            row.addClassName('last');
        }
        container.hide();
    } else {
        link.expanded = true;
        link.addClassName('collapse');
        link.removeClassName('expand');
        if(container.hasClassName('last')) {
            row.removeClassName('last');
        }
        container.show();
    }

    return false;
}
//]]>
</script>
<?php endif; ?>
<?php  $_order = $this->getOrder() ?>
<div class="page-head">
<h4><?php echo $this->__('Items Ordered') ?>
<?php  if ($_order->getTracksCollection()->count()) : ?>
    <span class="separator">|</span> <a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track your order') ?>"><?php echo $this->__('Track your order') ?></a>
<?php endif; ?>
</h4></div>

<?php echo $this->getChildHtml('order_items') ?>

<?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order', $_order) && $_order->getGiftMessageId()): ?>
<div class="giftmessage">
    <?php $_giftMessage=$this->helper('giftmessage/message')->getGiftMessageForEntity($_order); ?>
    <strong><?php echo $this->__('Gift Message for this Order') ?></strong>
     <ul>
        <li>
            <label><?php echo $this->__('From') ?></label> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?>
        </li>
        <li>
            <label><?php echo $this->__('To') ?></label> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?>
        </li>
        <li><?php echo $this->helper('giftmessage/message')->getEscapedGiftMessage($_order) ?></li>
     </ul>
</div>
<?php endif; ?>
<?php $_history = $this->getOrder()->getVisibleStatusHistory() ?>
<?php if (count($_history)): ?>
    <div class="clear"></div>
    <div class="about-your-order"> 
    <div class="page-head">
    <h4><?php echo $this->__('About Your Order') ?></h4></div>
    <div class="body">
        <dl>
            <?php foreach ($_history as $_historyItem): ?>
                <dt><?php echo $this->formatDate($_historyItem->getCreatedAtStoreDate(), 'medium', true) ?></dt>
                <?php if (Mage::helper('awmobile')->checkVersion('1.4.0.0')): ?>
                <dd><?php echo $this->escapeHtml($_historyItem->getComment()) ?></dd>
                <?php else: ?>                
                <dd><?php echo Mage::helper('awmobile')->escapeHtml($_historyItem->getComment()) ?></dd>
                <?php endif; ?>
            <?php endforeach; ?>
        </dl>
    </div>
    </div>
<?php endif; ?>
