<?php
/**
 * Avalanche for Magento 1.8+
 * Designed by Fast Division (http://fastdivision.com)
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://fastdivision.com/legal/license.txt
 *
 * @author     Fast Division
 * @version    1.5.0
 * @copyright  Copyright 2013 Fast Division
 * @license    http://fastdivision.com/legal/license.txt
 */
?>
<h1><?php echo $this->__('Share Your Wishlist') ?></h1>

<div class="page-messages">
	<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
</div>

<div class="white-box-inner">
	<form action="<?php echo $this->getSendUrl() ?>" id="form-validate" class="site-form" method="post">
	    <div class="fieldset">
	        <?php echo $this->getBlockHtml('formkey')?>
	        <ul class="form-list">
	            <li class="wide">
	                <label for="email_address" class="required"><?php echo $this->__('Email addresses, separated by commas') ?><em>*</em></label>
	                <div class="input-box">
	                    <textarea name="emails" cols="60" rows="5" id="email_address" class="validate-emails required-entry"><?php echo $this->getEnteredData('emails') ?></textarea>
	                </div>
	            </li>
	            <li class="wide">
	                <label for="message"><?php echo $this->__('Message') ?></label>
	                <div class="input-box">
	                    <textarea id="message" name="message" cols="60" rows="5"><?php echo $this->getEnteredData('message') ?></textarea>
	                </div>
	            </li>
	            <?php if($this->helper('wishlist')->isRssAllow()): ?>
	            <li class="control">
	                <div class="input-box">
	                    <input type="checkbox" name="rss_url" id="rss_url" value="1" title="<?php echo $this->__('Check this checkbox if you want to add a link to an rss feed to your wishlist.') ?>" class="checkbox" />
	                </div>
	                <label for="rss_url"><?php echo $this->__('Check this checkbox if you want to add a link to an rss feed to your wishlist.') ?></label>
	            </li>
	            <?php endif; ?>
	        </ul>
	    </div>
	    <div class="buttons-set form-buttons">
	        <button type="submit" title="<?php echo $this->__('Share Wishlist') ?>" class="action-button"><span><?php echo $this->__('Share Wishlist') ?></span></button>
	    </div>
	</form>
</div>
<script type="text/javascript">
//<![CDATA[
Validation.addAllThese([
    ['validate-emails', '<?php echo $this->__('Please enter a valid email addresses, separated by commas. For example johndoe@domain.com, johnsmith@domain.com.') ?>', function (v) {
    if(Validation.get('IsEmpty').test(v)) {
        return true;
    }

    var valid_regexp = /^[a-z0-9\._-]{1,30}@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i;
    var emails = v.split(',');

    for (var i=0; i<emails.length; i++) {
        if(!valid_regexp.test(emails[i].strip())) {
            return false;
        }
    }

    return true;
    }]
]);
var dataForm = new VarienForm('form-validate', true);
//]]>
</script>
