<?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) 2010 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>
				<!-- Added Tracking Information -->
				<?php $_results = $this->getTrackingInfo() ?>
				<?php if(sizeof($_results)>0): ?>
				<?php foreach($_results as $shipid => $_result): ?>
				    <?php if($shipid): ?>
				    <h3><?php echo $this->__('Shipment #').$shipid; ?></h3>
				    <?php endif; ?>
				    <?php if(sizeof($_result)>0): ?>
				        <?php foreach($_result as $track): ?>
								<?php echo ($track['title'] ? $this->escapeHtml($track['title']) : $this->__('N/A'));?>
								<?php echo (isset($track['number']) ? $this->escapeHtml($track['number']) : '');?>
				                <div class="divider"></div>

				        <?php endforeach; ?>
				    <?php else: ?>
				        <p><?php echo $this->__('There is no tracking available for this shipment.'); ?></p>
				    <?php endif; ?>

				<?php endforeach; ?>
				<?php else: ?>
			    	<div><?php echo $this->__('There is no tracking available.'); ?></div>
				<?php endif; ?>
				<!-- End Added Tracking Information -->
                <?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 echo $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
                <?php else: ?>
                    <?php echo $this->helper('sales')->__('No shipping information available'); ?>
                <?php endif; ?>
                 <?php if ($this->canShowShippingBestTime()): ?>
                 	<br/>
                    <?php echo $this->helper('sales')->__('Shipping Date:'); ?>
                    <?php echo $this->getChildHtml('shipping_time') ?>
                 <?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>

    <!-- Customer Comment -->
    <?php echo $this->getCustomerCommentHtml() ?>
    <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 contentLine = null;

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