<?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_iphone
 * @copyright   Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/giftmessage.js') ?>"></script>
<?php if(!$this->getSaveMode()): ?>
<div class="page-head button-level">
    <h3><?php echo $this->__('Gift Message') ?></h3>
</div>
<form action="<?php echo $this->getSaveUrl() ?>" id="message-form" method="post">
    <ul class="form-list a-left">
        <li>
            <div class="input-box">
                <label for="sender"><?php echo $this->__('From') ?> <span class="required">*</span></label><br />
                <input type="text" name="sender" value="<?php echo $this->getEscaped($this->getMessage()->getSender()) ?>" title="<?php echo $this->__('From') ?>" class="required-entry input-text" />
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="recipient"><?php echo $this->__('To') ?> <span class="required">*</span></label><br />
                <input type="text" name="recipient" value="<?php echo $this->getEscaped($this->getMessage()->getRecipient()) ?>" title="<?php echo $this->__('To') ?>" class="required-entry input-text" />
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="email_address"><?php echo $this->__('Message') ?> <span class="required">*</span></label><br />
                <textarea name="messagetext" title="<?php echo $this->__('Message') ?>" class="required-entry input-text" cols="60" rows="5"><?php echo $this->getEscaped($this->getMessage()->getMessage()) ?></textarea>
            </div>
        </li>
    </ul>
    <div class="button-set">
        <p class="required"><?php echo $this->__('* Required Fields') ?></p>
        <button class="form-button" type="submit" name="send"><span><?php echo $this->__('Save') ?></span></button> &nbsp;
        <button class="form-button listen-cancel" type="button"><span><?php echo $this->__('Cancel') ?></span></button>
        <?php if($this->getMessage()->getGiftMessageId()): ?>
        <button class="form-button listen-remove" type="button"><span><?php echo $this->__('Remove') ?></span></button>
        <?php endif; ?>
    </div>
</form>
<?php elseif($this->getSaveMode()=='save'): ?>
<h3><?php echo $this->__('Your gift message has been successfully saved') ?></h3>
<br /><button class="form-button" type="button" onclick="giftMessageWindowObject.close()"><span><?php echo $this->__('Close') ?></span></button>
<?php else: ?>
<h3><?php echo $this->__('Your gift message has been successfully removed') ?></h3>
<br /><button class="form-button" type="button" onclick="giftMessageWindowObject.close()"><span><?php echo $this->__('Close') ?></span></button>
<?php endif; ?>
<script type="text/javascript">
<!--
<?php if(!$this->getSaveMode()): ?>
    var giftMessageWindowObject = new GiftMessageWindow('<?php echo $this->getUniqueId() ?>','message-form', '<?php echo $this->getRemoveUrl() ?>');
    giftMessageWindowObject.confirmMessage = '<?php echo $this->getEscapedForJs($this->__('Are you sure?')) ?>';
<?php else: ?>
    var giftMessageWindowObject = new GiftMessageWindow('<?php echo $this->getUniqueId() ?>', null, '<?php echo $this->getRemoveUrl() ?>');
    Event.observe(window, 'load', function(evt) {
        giftMessageWindowObject.updateParent('<?php echo $this->getEditUrl() ?>', '<?php echo $this->getButtonUrl() ?>');
    });
<?php endif; ?>
//-->
</script>
