<?php
/**
 * Maho
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2022-2024 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/** @var Mage_Usa_Block_Adminhtml_Dhl_Unitofmeasure $this */
?>
<script type="text/javascript">
    //<![CDATA[
    function changeDimensions()
    {
        var dimensionUnit = '(<?= $this->getInch() ?>)';
        var dhlintUnitOfMeasureNote = '<?= $this->getDivideOrderWeightNoteLbp() ?>';
        if ($("carriers_dhlint_unit_of_measure").value == "K") {
            dimensionUnit = '(<?= $this->getCm() ?>)';
            dhlintUnitOfMeasureNote = '<?= $this->getDivideOrderWeightNoteKg() ?>';
        }
        $$('[for="carriers_dhlint_height"]')[0].innerHTML = '<?= $this->getHeight() ?> ' + dimensionUnit;
        $$('[for="carriers_dhlint_depth"]')[0].innerHTML = '<?= $this->getDepth() ?> ' + dimensionUnit;
        $$('[for="carriers_dhlint_width"]')[0].innerHTML = '<?= $this->getWidth() ?> ' + dimensionUnit;

        $('carriers_dhlint_divide_order_weight').next().down().innerHTML = dhlintUnitOfMeasureNote;
    }
    document.observe("dom:loaded", function() {
        $("carriers_dhlint_unit_of_measure").observe("change", changeDimensions);
        changeDimensions();
    });
    //]]>
</script>
