<?php $_product     = $this->getProduct() ?>
<?php $_priceModel  = $_product->getPriceModel() ?>
<?php list($_minimalPriceTax, $_maximalPriceTax) = $_priceModel->getTotalPrices($_product, null, null, false) ?>
<?php list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false) ?>
<?php $_id = $_product->getId() ?>

<?php $_weeeTaxAmount = 0; ?>

<?php
if ($_product->getPriceType() == 1) {
    $_weeeTaxAmount = Mage::helper('weee')->getAmount($_product);
    $_weeeTaxAmountInclTaxes = $_weeeTaxAmount;
    if (Mage::helper('weee')->isTaxable()) {
        $_attributes = Mage::helper('weee')->getProductWeeeAttributesForRenderer($_product, null, null, null, true);
        $_weeeTaxAmountInclTaxes = Mage::helper('weee')->getAmountInclTaxes($_attributes);
    }
    if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, array(0, 1, 4))) {
        $_minimalPriceTax += $_weeeTaxAmount;
        $_minimalPriceInclTax += $_weeeTaxAmountInclTaxes;
    }
    if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, 2)) {
        $_minimalPriceInclTax += $_weeeTaxAmountInclTaxes;
    }

    if (Mage::helper('weee')->typeOfDisplay($_product, array(1, 2, 4))) {
        $_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
    }
}
$_tpl = $this->helper('designer')->createTemplate('product/price/text');
$_regularPriceId = $this->getRegularPriceId();
$_oldPriceId = $this->getOldPriceId();
?>

<!-- b:price -->
<?php if ($_product->getPriceView()): ?>
    <div class="minimal-price">
    <?php echo $this->__('As low as') ?>:
    <?php if ($this->displayBothPrices()): ?>

        <?php $_tpl->section('price') ?>
            <?php echo Mage::helper('tax')->__('Excl. Tax:') ?>
            <?php echo Mage::helper('core')->currency($_minimalPriceTax, true, false) ?>
        <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

        <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
            <span class="weee">(<small>
                <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                    <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                        <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                    <?php else: ?>
                        <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                    <?php endif; ?>

                    <?php echo $_weeeSeparator; ?>
                    <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                    <?php $_weeeSeparator = ' + '; ?>
                <?php endforeach; ?>
            </small>)</span>
        <?php endif; ?>

        <?php $_tpl->section('price') ?>
            <?php echo Mage::helper('tax')->__('Incl. Tax:') ?>
            <?php echo Mage::helper('core')->currency($_minimalPriceInclTax, true, false) ?>
        <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

    <?php else: ?>

        <?php $_tpl->section('price') ?>
            <?php echo Mage::helper('core')->currency($_minimalPriceTax, false, true) ?>
        <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

        <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
            <span class="weee">(<small>
                <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                    <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                        <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                    <?php else: ?>
                        <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                    <?php endif; ?>

                    <?php echo $_weeeSeparator; ?>
                    <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                    <?php $_weeeSeparator = ' + '; ?>
                <?php endforeach; ?>
            </small>)</span>
        <?php endif; ?>

        <?php if (Mage::helper('weee')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>

            <?php $_tpl->section('price') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceInclTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

        <?php endif; ?>

    <?php endif; ?>
    </div>
<?php else: ?>
    <?php if ($_minimalPriceTax <> $_maximalPriceTax): ?>
    <div class="price-from" style="display: inline-block">
        <?php if ($this->displayBothPrices()): ?>

            <?php $_tpl->section('price') ?>
               <?php echo Mage::helper('tax')->__('Excl. Tax:') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
                <span class="weee">(<small>
                    <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                        <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                        <?php else: ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                        <?php endif; ?>

                        <?php echo $_weeeSeparator; ?>
                        <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                        <?php $_weeeSeparator = ' + '; ?>
                    <?php endforeach; ?>
                </small>)</span>
            <?php endif; ?>

            <?php $_tpl->section('price') ?>
                <?php echo Mage::helper('tax')->__('Incl. Tax:') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceInclTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

        <?php else: ?>

            <?php $_tpl->section('price') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
                <span class="weee">(<small>
                    <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                        <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                        <?php else: ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                        <?php endif; ?>

                        <?php echo $_weeeSeparator; ?>
                        <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                        <?php $_weeeSeparator = ' + '; ?>
                    <?php endforeach; ?>
                </small>)</span>
            <?php endif; ?>
            <?php if (Mage::helper('weee')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>

                <?php $_tpl->section('price') ?>
                    <?php echo Mage::helper('core')->currency($_minimalPriceInclTax, true, false) ?>
                <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php endif; ?>
        <?php endif; ?>
    </div>
        <?php
            if ($_product->getPriceType() == 1) {
                if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, array(0, 1, 4))) {
                    $_maximalPriceTax += $_weeeTaxAmount;
                    $_maximalPriceInclTax += $_weeeTaxAmountInclTaxes;
                }
                if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, 2)) {
                    $_maximalPriceInclTax += $_weeeTaxAmountInclTaxes;
                }
            }
        ?>
        <span class="price-label">-</span>
        <div class="price-to" style="display: inline-block">
            <?php if ($this->displayBothPrices()): ?>

                <?php $_tpl->section('price') ?>
                    <?php echo Mage::helper('tax')->__('Excl. Tax:') ?>
                    <?php echo Mage::helper('core')->currency($_maximalPriceTax, true, false) ?>
                <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

                <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
                    <span class="weee">(<small>
                        <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                            <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                                <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                            <?php else: ?>
                                <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                            <?php endif; ?>

                            <?php echo $_weeeSeparator; ?>
                            <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                            <?php $_weeeSeparator = ' + '; ?>
                        <?php endforeach; ?>
                    </small>)</span>
                <?php endif; ?>

                <?php $_tpl->section('price') ?>
                    <?php echo Mage::helper('tax')->__('Incl. Tax') ?>
                    <?php echo Mage::helper('core')->currency($_maximalPriceInclTax, true, false) ?>
                <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php else: ?>

                <?php $_tpl->section('price') ?>
                    <?php echo Mage::helper('core')->currency($_maximalPriceTax, true, false) ?>
                <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

                <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
                    <span class="weee">(<small>
                        <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                            <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                                <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                            <?php else: ?>
                                <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                            <?php endif; ?>

                            <?php echo $_weeeSeparator; ?>
                            <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                            <?php $_weeeSeparator = ' + '; ?>
                        <?php endforeach; ?>
                    </small>)</span>
                <?php endif; ?>
                <?php if (Mage::helper('weee')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>

                    <?php $_tpl->section('price') ?>
                        <?php echo Mage::helper('core')->currency($_maximalPriceInclTax, true, false) ?>
                    <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

                <?php endif; ?>
            <?php endif; ?>
        </div>
    <?php else: ?>
        <?php if ($this->displayBothPrices()): ?>

            <?php $_tpl->section('price') ?>
                <?php echo Mage::helper('tax')->__('Excl. Tax:') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
                <span class="weee">(<small>
                    <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                        <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                        <?php else: ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                        <?php endif; ?>

                        <?php echo $_weeeSeparator; ?>
                        <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                        <?php $_weeeSeparator = ' + '; ?>
                    <?php endforeach; ?>
                </small>)</span>
            <?php endif; ?>

            <?php $_tpl->section('price') ?>
                <?php echo Mage::helper('tax')->__('Incl. Tax:') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceInclTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

        <?php else: ?>

            <?php $_tpl->section('price') ?>
                <?php echo Mage::helper('core')->currency($_minimalPriceTax, true, false) ?>
            <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
                <span class="weee">(<small>
                    <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
                        <?php if (Mage::helper('weee')->typeOfDisplay($_product, array(2, 4))): ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
                        <?php else: ?>
                            <?php $amount = $_weeeTaxAttribute->getAmount(); ?>
                        <?php endif; ?>

                        <?php echo $_weeeSeparator; ?>
                        <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo Mage::helper('core')->currency($amount, true, true); ?>
                        <?php $_weeeSeparator = ' + '; ?>
                    <?php endforeach; ?>
                </small>)</span>
            <?php endif; ?>
            <?php if (Mage::helper('weee')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>

                <?php $_tpl->section('price') ?>
                    <?php echo Mage::helper('core')->currency($_minimalPriceInclTax, true, false) ?>
                <?php echo $_tpl->setControlId($_regularPriceId)->render() ?>

            <?php endif; ?>
        <?php endif; ?>
    <?php endif; ?>
<?php endif; ?>
<!-- e:price -->