
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="col2-set addresses-list">
    <h1>地址管理</h1>
    <div class="col-1 addresses-primary">
         <h2><?php echo $this->__('Default Shipping Address') ?></h2>
        <ol>    
        <?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping()): ?>
            <li class="addresslist">               
                <address>
                    <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
                </address>
                <p class="operation"><a href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('修改') ?></a></p>
            </li>
        <?php else: ?>
            <li>                
                <p><?php echo $this->__('You have no default shipping address in your address book.') ?></p>
            </li>
        <?php endif ?>
        </ol><br />

         <button type="button" title="<?php echo $this->__('Add New Address') ?>" class="button" onclick="window.location='<?php echo $this->getAddAddressUrl() ?>';"><span><span><?php echo $this->__('Add New Address') ?></span></span></button>
    </div>
    <div class="col-2 addresses-additional">
            <h2><?php echo $this->__('Additional Address Entries') ?></h2>
        <ol>
        <?php if($_pAddsses = $this->getAdditionalAddresses()): ?>
            <?php foreach($_pAddsses as $_address): ?>
            <li class="item addresslist">
                <address>
                    <?php echo $this->getAddressHtml($_address) ?>
                </address>
                <p class="operation"><a href="<?php echo $this->getUrl('customer/address/edit', array('id'=>$_address->getId())) ?>"><?php echo $this->__('修改') ?></a> <span class="separator">|</span> <a href="#" class="link-remove" onclick="return deleteAddress('<?php echo $_address->getId() ?>');"><?php echo $this->__('删除') ?></a></p>
            </li>
            <?php endforeach; ?>
        <?php else: ?>
            <li class="item empty addresslist">
                <p class="operation"><?php echo $this->__('You have no additional address entries in your address book.') ?></p>
            </li>
        <?php endif ?>
        </ol>
    </div>
</div>
   
<script type="text/javascript">
//<![CDATA[
	hoverdiv(".addresslist",".operation");
    function deleteAddress(addressId) {
        if(confirm('<?php echo $this->__('Are you sure you want to delete this address?') ?>')) {
            window.location='<?php echo $this->getDeleteUrl() ?>id/'+addressId;
        }
        return false;
    }
//]]>
</script>
