<?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_default
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
    $_disabled = '';
    if ($this->getElement()->getDisabled()) {
        $_disabled = ' disabled="disabled"';
    }
?>
<?php
    foreach ($this->getStoreViews() as $_store) {
?>
<tr>
    <td class="label">
        <label for="conversion_url_<?php echo $_store->getCode() ?>"><?php echo Mage::helper('googleoptimizer')->__('Conversion Page URL') ?> (<?php echo $_store->getName() ?>)</label>
    </td>
    <td class="value">
        <input type="text" class="input-text googleoptimizer conversion_urls" readonly="readonly" name="conversion_url_<?php echo $_store->getCode() ?>" id="conversion_url_<?php echo $_store->getCode() ?>"<?php echo $_disabled ?>/>
    </td>
    <td class="note"><small><?php echo Mage::helper('googleoptimizer')->__('Please copy and paste this value to experiment edit form') ?></small></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
</tr>
<?php
    }
?>
<script type="text/javascript">
//<![CDATA[
    function googleOptimizerConversionCmsPageAction(elm) {
        var urls = <?php echo $this->getJsonConversionPagesUrl() ?>;
        var storeViews = <?php echo $this->getJsonStoreViews() ?>;
        if (elm) {
            if (elm.value == '' || elm.value == 'other') {
                $$('.conversion_urls').each(function(elm){
                    elm.value = '';
                });
                return;
            } else {
                for (var i=0; i<=storeViews.length; i++) {
                    if ($('conversion_url_'+storeViews[i]) && urls[storeViews[i]][elm.value]) {
                        $('conversion_url_'+storeViews[i]).value = urls[storeViews[i]][elm.value];
                    }
                }
            }
        }
        return;
    }
//]]>
</script>
