<?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     base_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 $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>
    <div class="add-to-cart">
        <?php if(!$_product->isGrouped()): ?>
        <label for="qty"><?php echo $this->__('Qty:') ?></label>
        <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
        <?php endif; ?>
        <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
        <?php echo $this->getChildHtml('', true, true) ?>
        
        <?php if ($_product->getEcczoPid() && $rid = Mage::helper('ssologin')->getRid()): ?>

            <!-- 步骤一：在合适的位置放置定制提示文字
            <a class='diybtn' onclick="ShowDiyWin({'pid':'<?php echo $_product->getEcczoPid(); ?>', 'rid':'<?php echo $rid; ?>'});">开始定制</a>
            -->
            
            <button type="button" title="开始定制" class="button btn-cart" onclick="ShowDiyWin({'pid':'<?php echo $_product->getEcczoPid(); ?>', 'rid':'<?php echo $rid; ?>'});"><span><span>开始定制</span></span></button>
            <!-- 或者图片 -->
            <!--
            <img onclick="ShowDiyWin({'pid':'<?php echo $_product->getEcczoPid(); ?>', 'rid':'<?php echo $rid; ?>'});" alt="开始定制" title="开始定制" src="http://webimg.ecczo.cn/linyanying/%E8%A3%85%E4%BF%AE%E5%9B%BE%E7%89%87/%E7%AB%8B%E5%88%BB%E5%AE%9A%E5%88%B6.gif"/>
            -->
             
              
              <script type="text/javascript">
                  function _DesignSaved(did) {
                      jQuery('#_divDialogContent').append('<div class="add-to-cart" id="diy_submit"></div>');
                      jQuery('.add-to-cart button.btn-cart:eq(0)').clone().appendTo('#diy_submit');
                      jQuery('#diy_submit').click(function(){
                          _closeDialog();
                      })
                  }
              </script>
              <style>
                  #diy_submit {
                      position: absolute;
                      top: 63%;
                      left: 45%;
                      z-index:2;
                  }
              </style>
              
              
             
            <!-- 步骤二：在页脚引入diy定制代码 -->
            <script>


              (function(){
                  var ac = document.createElement('script'); ac.type = 'text/javascript'; ac.async = true; 
                  ac.src = 'http://www.ecczo.cn/_diyWidget/diy.js?t='+new Date().getTime();
                  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ac, s);
              })();
            </script>


        <?php endif; ?>
    </div>
<?php endif; ?>



