<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php $_order = $this->getOrder() ?>
<div>
    <div id="order-messages">
        <?php echo $this->getChildHtml('order_messages') ?>
    </div>
    <?php echo $this->getChildHtml('order_info') ?>
    <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
    <?php if ($_order->getIsVirtual()): ?>
    <div class="box-right">
    <?php else: ?>
    <div class="box-left">
    <?php endif; ?>
        <!--Payment Method-->
        <div class="entry-edit">
            <div class="entry-edit-head">
                <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
            </div>
            <fieldset>
                <?php echo $this->getPaymentHtml() ?>
                <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
            </fieldset>
        </div>
    </div>
    <?php if (!$_order->getIsVirtual()): ?>
    <div class="box-right">
        <!--Shipping Method-->
        <div class="entry-edit">
            <div class="entry-edit-head">
                <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
            </div>
            <fieldset>
                <?php  if ($_order->getTracksCollection()->count()) : ?>
                <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 Order') ?>"><?php echo $this->__('Track Order') ?></a>
                <br/>
                <?php endif; ?>
                <?php if ($_order->getShippingDescription()): ?>
                    <strong><?php echo $_order->getShippingDescription() ?></strong>

                    <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
                        <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
                    <?php else: ?>
                        <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
                    <?php endif; ?>
                    <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>

                    <?php echo $_excl; ?>
                    <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
                        (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
                    <?php endif; ?>
                <?php else: ?>
                    <?php echo $this->helper('sales')->__('No shipping information available'); ?>
                <?php endif; ?>
            </fieldset>
        </div>
    </div>
    <?php endif; ?>
    <div class="clear"></div>
    <?php echo $this->getGiftOptionsHtml() ?>
    <div class="clear"></div>
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
        </div>
    </div>
    <?php echo $this->getItemsHtml() ?>
    <div class="clear"></div>

    <div class="box-left">
        <div class="entry-edit">
            <div class="entry-edit-head">
                <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
            </div>
            <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
        </div>
    </div>
    <div class="box-right entry-edit">
        <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
        <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
    </div>
    <div class="clear"></div>
</div>

<?php echo $this->getChildHtml('popup_window');?>
<script type="text/javascript">
//<![CDATA[
    /**
     * Retrieve gift options tooltip content
     */
    function getGiftOptionsTooltipContent(itemId) {
        var contentLines = [];
        var headerLine = null;
        var contentLine = null;

        $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
            if (element.down(0)) {
                headerLine = element.down(0).innerHTML;
                contentLine = element.down(0).next().innerHTML;
                if (contentLine.length > 30) {
                    contentLine = contentLine.slice(0,30) + '...';
                }
                contentLines.push(headerLine + ' ' + contentLine);
            }
        });
        return contentLines.join('<br/>');
    }
    giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
//]]>
</script>
