<?php echo $header; ?>
<section class="main-container col1-layout">
    <div class="breadcrumbs">
        <ul>
            <?php foreach ($breadcrumbs as $breadcrumb) { ?>
            <li class="category11"> <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a> </li>
            <?php } ?>
        </ul>
    </div>
    <article class="col-main">
        <div class="product-view">
            <div id="content">
                <?php echo $content_top; ?>

                <div class="product-essential product-info"> 

                    <div class="product-img-box">
                        <?php if ($thumb || $images) { ?>
                        <?php if ($thumb) { ?>
                        <div class="product-image image"> <a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" /></a></div>

                        <?php } ?>
                        <?php if ($images) { ?>
                        <div class="more-images">
                            <div class="more-views">
                                <div class="more-views thumbnailscroller carousel">
                                    <a href="#" class="jcarousel-prev-horizontal" id="products_slider_prev2"></a> <a href="#" class="jcarousel-next-horizontal" id="products_slider_next2"></a>
                                    <div class="thumbnail-viewport mage-additional">
                                        <ul class="thumbscroller slides" id="thumbscroller" >
                                            <?php foreach ($images as $image) { ?>
                                            <li> <a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
                                            <?php } ?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <?php } ?>

                        <?php } ?>

                        <script type="text/javascript">
                            jQuery(document).ready(function($) {

                            function mycarousel_initCallback(carousel) {
                            $('#products_slider_next2').bind('click', function() {
                            carousel.next();
                            return false;
                        });
                        $('#products_slider_prev2').bind('click', function() {
                        carousel.prev();
                        return false;
                    });
                };

                $('#thumbscroller').jcarousel({
                scroll: 1,
                initCallback: mycarousel_initCallback,
                buttonNextHTML: null,
                buttonPrevHTML: null
            });
        });
                        </script>        



                        <!-- end: more-images -->
                    </div>
                    <div class="product-shop"  >
                        <div class="product-name">
                            <h1><?php echo $heading_title; ?></h1>
                            <div class="ratings">
                                <div class="rating-box">
                                    <?php if ($review_status) { ?>

                                    <img src="catalog/view/theme/vista/image/stars-<?php echo $rating; ?>.png" alt="<?php echo $reviews; ?>" />&nbsp;&nbsp;
                                    <p class="rating-links">
                                        <a onclick="$('a[href=\'#tab-review\']').trigger('click');"><?php echo $reviews; ?></a> <span class="separator">|</span><a onclick="$('a[href=\'#tab-review\']').trigger('click');"><?php echo $text_write; ?></a>
                                    </p>

                                    <div class="share"><!-- AddThis Button BEGIN -->
                                        <div class="addthis_default_style"><a class="addthis_button_compact"><?php echo $text_share; ?></a> <a class="addthis_button_email"></a><a class="addthis_button_print"></a> <a class="addthis_button_facebook"></a> <a class="addthis_button_twitter"></a></div>
                                        <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
                                        <!-- AddThis Button END --> 
                                    </div>

                                    <?php } ?>
                                </div>

                            </div>
                        </div>

                        <div class="description">
                            <?php if ($manufacturer) { ?>
                            <p><?php echo $text_manufacturer; ?><span><a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a></span><br />
                                <?php } ?>
                            <p><?php echo $text_model; ?> <span><?php echo $model; ?><br /></span></p>
                            <?php if ($reward) { ?>
                            <p> <?php echo $text_reward; ?> <span><?php echo $reward; ?></span><br /></p>
                            <?php } ?>
                            <p class="availability in-stock"> <?php echo $text_stock; ?> <span><?php echo $stock; ?></span></p>
                        </div>


                        <?php if ($price) { ?>

                        <div class="price-box price">
                            <?php echo $text_price; ?>
                            <?php if (!$special) { ?>
                            <p class="special-price">  <span  class="price"><?php echo $price; ?></p>
                            <?php } else { ?>
                            <p class="old-price"> <span class="price-old price"><?php echo $price; ?></span></p> <p class="special-price"> <span class="price-new price"><?php echo $special; ?></span></p>
                            <?php } ?>
                            <br />
                            <?php if ($tax) { ?>
                            <?php echo $text_tax; ?>
                            <p class="special-price">  <span  class="price price-tax"> <?php echo $tax; ?></p>
                            <?php } ?>
                            <?php if ($points) { ?>
                            <p><span class="reward"><small><?php echo $text_points; ?> <span><?php echo $points; ?></span></small></span></p>
                            <?php } ?>
                            <?php if ($discounts) { ?>
                            <div class="discount">
                                <?php foreach ($discounts as $discount) { ?>
                                <?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
                                <?php } ?>
                            </div>
                            <?php } ?>
                        </div>
                        <?php } ?>


                        <?php if ($profiles): ?>
                        <div class="option">
                            <h2><span class="required">*</span><?php echo $text_payment_profile ?></h2>
                            <br />
                            <select name="profile_id">
                                <option value=""><?php echo $text_select; ?></option>
                                <?php foreach ($profiles as $profile): ?>
                                <option value="<?php echo $profile['profile_id'] ?>"><?php echo $profile['name'] ?></option>
                                <?php endforeach; ?>
                            </select>
                            <br />
                            <br />
                            <span id="profile-description"></span>
                            <br />
                            <br />
                        </div>
                        <?php endif; ?>
                        <?php if ($options) { ?>
                        <div class="options">
                            <h2><?php echo $text_option; ?></h2>
                            <br />
                            <?php foreach ($options as $option) { ?>
                            <?php if ($option['type'] == 'select') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <select name="option[<?php echo $option['product_option_id']; ?>]">
                                    <option value=""><?php echo $text_select; ?></option>
                                    <?php foreach ($option['option_value'] as $option_value) { ?>
                                    <option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                                        <?php if ($option_value['price']) { ?>
                                        (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                                        <?php } ?>
                                    </option>
                                    <?php } ?>
                                </select>
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'radio') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <?php foreach ($option['option_value'] as $option_value) { ?>
                                <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]"  value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
                                <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                                    <?php if ($option_value['price']) { ?>
                                    (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                                    <?php } ?>
                                </label>
                                <br />
                                <?php } ?>
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'checkbox') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <?php foreach ($option['option_value'] as $option_value) { ?>
                                <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
                                <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                                    <?php if ($option_value['price']) { ?>
                                    (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                                    <?php } ?>
                                </label>
                                <br />
                                <?php } ?>
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'image') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <table class="option-image">
                                    <?php foreach ($option['option_value'] as $option_value) { ?>
                                    <tr>
                                        <td style="width: 1px;"><input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" /></td>
                                        <td><label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><img src="<?php echo $option_value['image']; ?>" alt="<?php echo $option_value['name'] . ($option_value['price'] ? ' ' . $option_value['price_prefix'] . $option_value['price'] : ''); ?>" /></label></td>
                                        <td><label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                                                <?php if ($option_value['price']) { ?>
                                                (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                                                <?php } ?>
                                            </label></td>
                                    </tr>
                                    <?php } ?>
                                </table>
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'text') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <input type="text" class="input-text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" />
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'textarea') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <textarea class="input-text" name="option[<?php echo $option['product_option_id']; ?>]" cols="40" rows="5"><?php echo $option['option_value']; ?></textarea>
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'file') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <input type="button" value="<?php echo $button_upload; ?>" id="button-option-<?php echo $option['product_option_id']; ?>" class="button">
                                <input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" />
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'date') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <input type="text"  name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="date input-text" />
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'datetime') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="datetime input-text" />
                            </div>
                            <br />
                            <?php } ?>
                            <?php if ($option['type'] == 'time') { ?>
                            <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                                <?php if ($option['required']) { ?>
                                <span class="required">*</span>
                                <?php } ?>
                                <b><?php echo $option['name']; ?>:</b><br />
                                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="time input-text" />
                            </div>
                            <br />
                            <?php } ?>
                            <?php } ?>
                        </div>
                        <?php } ?>

                        <div class="add-to-box">
                            <div class="add-to-cart">
                                <label for="qty"><?php echo $text_qty; ?></label>
                                <input name="qty" id="qty" maxlength="12" value="1" title="<?php echo $text_qty; ?>" class="input-text qty" type="text">
                                <input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
                                <button type="button" class="button-arrow button-up">&nbsp;</button>
                                <button type="button" class="button-arrow button-down">&nbsp;</button>
                                <script type="text/javascript">
                //<![CDATA[
                jQuery(function($) {
                $('.add-to-cart .button-up').click(function() {
                $qty = $(this).parent().find('.qty');
                qty = parseInt($qty.val()) + 1;
                $qty.val(qty);
            });
            $('.add-to-cart .button-down').click(function() {
            $qty = $(this).parent().find('.qty');
            qty = parseInt($qty.val()) - 1;
            if (qty < 0)
                qty = 0;
            $qty.val(qty);
        });
    });
    //]]>
                                </script>
                            </div>
                            <div class="add-to-cart">
                                <button id="button-cart" type="button"  title="<?php echo $button_cart; ?>" class="button btn-cart"><span><?php echo $button_cart; ?></span></button>
                                <ul class="add-to-links">
                                    <li><a onclick="addToWishList('<?php echo $product_id; ?>');" class="button link-wishlist" title="<?php echo $button_wishlist; ?>"><?php echo $button_wishlist; ?></a><span><?php echo $button_wishlist; ?></span></li>
                                    <li><a onclick="addToCompare('<?php echo $product_id; ?>');" class="button link-compare" title="Add to Compare"><?php echo $button_compare; ?></a><span><?php echo $button_compare; ?></span></li>
                                </ul>
                            </div>
                        </div> 
                    </div>
                    
                    
                    <?php 
                     if($this->config->get('wg24_p_pag_sidebar')=="enable") { 
                    $default_lang=$this->config->get('config_language_id');
                    $produtc_c_content=$this->config->get('wg24_l_sideb_cc');
                    echo html_entity_decode($produtc_c_content[$default_lang]);
                    
                    }
                    ?>
                    
                    
                </div>
                <div class="product-collateral">
                    <div class="addtional-info">
                        <div id="tabs" class="htabs tab-box">
                            <ul class="product-tabs">
                                <li class="tabLink">  <a href="#tab-description"><?php echo $tab_description; ?></a></li>
                                <?php if ($attribute_groups) { ?>
                                <li class="tabLink"><a href="#tab-attribute"><?php echo $tab_attribute; ?></a></li>
                                <?php } ?>
                                <?php if ($review_status) { ?>
                                <li class="tabLink"><a href="#tab-review"><?php echo $tab_review; ?></a></li>
                                <?php } ?>
                        <?php 
                              if($this->config->get('wg24_l_custom_tab')=="enable") { 
                              ?>
                      
                                <li class="tabLink"><a href="#product1_tabs_custom_contents">             
                                        <?php 
                    $default_lang=$this->config->get('config_language_id');
                    $tab_title=$this->config->get('wg24_l_tab_title');
                    echo html_entity_decode($tab_title[$default_lang]);
                    ?>
                                 </a></li>
                                
                                <?php  } ?>

                            </ul>
                        </div>

                        <div id="tab-description" class="tab-content tabcontent"><?php echo $description; ?></div>
                        <?php if ($attribute_groups) { ?>
                        <div id="tab-attribute" class="tab-content tabcontent">
                            <table class="attribute">
                                <?php foreach ($attribute_groups as $attribute_group) { ?>
                                <thead>
                                    <tr>
                                        <td colspan="2"><?php echo $attribute_group['name']; ?></td>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
                                    <tr>
                                        <td><?php echo $attribute['name']; ?></td>
                                        <td><?php echo $attribute['text']; ?></td>
                                    </tr>
                                    <?php } ?>
                                </tbody>
                                <?php } ?>
                            </table>
                        </div>
                        <?php } ?>
                        <?php if ($review_status) { ?>
                        <div id="tab-review" class="tab-content tabcontent">
                            <div id="review"></div>
                            <h2 id="review-title"><?php echo $text_write; ?></h2>
                            <b><?php echo $entry_name; ?></b><br />
                            <input class="input-text" type="text" name="name" value="" />
                            <br />
                            <br />
                            <b><?php echo $entry_review; ?></b>
                            <textarea  class="input-text" name="text" cols="40" rows="8" style="width: 98%;"></textarea>
                            <span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
                            <br />
                            <b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>&nbsp;
                            <input type="radio" name="rating" value="1" />
                            &nbsp;
                            <input type="radio" name="rating" value="2" />
                            &nbsp;
                            <input type="radio" name="rating" value="3" />
                            &nbsp;
                            <input type="radio" name="rating" value="4" />
                            &nbsp;
                            <input type="radio" name="rating" value="5" />
                            &nbsp;<span><?php echo $entry_good; ?></span><br />
                            <br />
                            <b><?php echo $entry_captcha; ?></b><br />
                            <input type="text" name="captcha" value="" />
                            <br />
                            <img src="index.php?route=product/product/captcha" alt="" id="captcha" /><br />
                            <br />
                            <div class="buttons">
                                <div class="right"><a id="button-review" class="button"><?php echo $button_continue; ?></a></div>
                            </div>
                        </div>
                        <?php } ?>
    <?php 
                              if($this->config->get('wg24_l_custom_tab')=="enable") { 
                              ?>
                      
                                <div  class="tabcontent tab-content" id="product1_tabs_custom_contents">           
                                        <?php 
                    $default_lang=$this->config->get('config_language_id');
                    $tab_content=$this->config->get('wg24_l_tabc');
                    echo html_entity_decode($tab_content[$default_lang]);
                    ?>
                                   </div>
                                
                                <?php  } ?>
                     
                            
                    
                        <?php if ($tags) { ?>
                        <div class="tags"><b><?php echo $text_tags; ?></b>
                            <?php for ($i = 0; $i < count($tags); $i++) { ?>
                            <?php if ($i < (count($tags) - 1)) { ?>
                            <a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>,
                            <?php } else { ?>
                            <a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>
                            <?php } ?>
                            <?php } ?>
                        </div>
                        <?php } ?>     
                        <!--tab-box-->
                    </div>
                    <?php echo $content_bottom; ?>

                    <?php if ($products) { ?>


                    <div class="products_related_slider">
                        <div class="product-title"> <span><?php echo $tab_related; ?> (<?php echo count($products); ?>)</span></div>
                        <a href="#" class="jcarousel-prev-horizontal" id="products_slider_prev4"></a> <a href="#" class="jcarousel-next-horizontal" id="products_slider_next4"></a>
                        <div class="slider-container">
                            <div class=" jcarousel-skin-tango">
                                <ul id="products_slider4" class="products-grid-home">
                                    <?php foreach ($products as $product) { ?>     
                                    <li> 

                                       <?php if ($product['thumb']) { ?>
              <a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>" class="product-image">
               
                    <?php if ($product['price'] && $product['special']) { ?>
                         <div class="sale-label sale-top-right"><?php echo $this->language->get('lang_sale'); ?> </div>
                  <?php } ?>
                <img class="small-image" src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>"> 
                 <img class="thumbnail" src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>"> 
                 
             </a> 
              <?php } ?>
                                        <a class="product-detail-bnt" rel="category-gallery" title="" href="<?php echo $product['href']; ?>">&nbsp;</a>
                                        <div class="prod_image_detail">
                                            <div class="inner">
                                                <a class="product-name" href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>"><?php echo html_entity_decode(substr($product['name'],0,30))."..";?></a>
                                                <div class="rating">
                                                    <div class="ratings">
                                                        <div class="rating-box">
                                                            <?php if ($product['rating']) { ?>
                                                            <div class="rating"><img src="catalog/view/theme/vista/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
                                                            <?php } ?>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="price-box">
                                                    <?php if ($product['price']) { ?>
                                                    <?php if (!$product['special']) { ?>
                                                    <span class="regular-price">
                                                        <span class="price"> <?php echo $product['price']; ?></span>
                                                    </span>

                                                    <?php } else { ?>
                                                    <span class="old-price">
                                                        <span class="price"><?php echo $product['price']; ?></span>
                                                    </span>

                                                    <span class="regular-price">
                                                        <span class="price"><?php echo $product['special']; ?></span>
                                                    </span>
                                                    <?php } ?>

                                                    <?php } ?>


                                                </div>

                                            </div>
                                            <div class="actions">
                                                <button type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button btn-cart" title="<?php echo $button_cart; ?>">
                                                    <span><?php echo $button_cart; ?></span>
                                                </button>
                                                <span class="add-to-links">                           
                                                    <a title="<?php echo $button_wishlist; ?>" class="button link-wishlist" onclick="addToWishList('<?php echo $product['product_id']; ?>');"><?php echo $button_wishlist; ?></a> 
                                                    <a title="<?php echo $button_compare; ?>" class="button link-compare" onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a> 
                                                </span>
                                            </div>
                                        </div>
                                    </li>
                                    <?php } ?>

                                </ul>
                            </div>
                        </div>
                        <script type="text/javascript">
jQuery(document).ready(function($) {

function mycarousel_initCallback(carousel) {
$('#products_slider_next4').bind('click', function() {
carousel.next();
return false;
});
$('#products_slider_prev4').bind('click', function() {
carousel.prev();
return false;
});
};

$('#products_slider4').jcarousel({
scroll: 1,
initCallback: mycarousel_initCallback,
buttonNextHTML: null,
buttonPrevHTML: null
});
});
                        </script>
                    </div>	
                    <?php } ?>		
                </div>            
            </div>
        </div>
    </article>
</section>








<script type="text/javascript"><!--
$(document).ready(function() {
$('.colorbox').colorbox({
overlayClose: true,
opacity: 0.5,
rel: "colorbox"
});
});
//--></script> 
<script type="text/javascript"><!--

$('select[name="profile_id"], input[name="quantity"]').change(function(){
$.ajax({
url: 'index.php?route=product/product/getRecurringDescription',
type: 'post',
data: $('input[name="product_id"], input[name="quantity"], select[name="profile_id"]'),
dataType: 'json',
beforeSend: function() {
$('#profile-description').html('');
},
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
            
if (json['success']) {
$('#profile-description').html(json['success']);
}	
}
});
});
    
$('#button-cart').bind('click', function() {
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
			
if (json['error']) {
if (json['error']['option']) {
for (i in json['error']['option']) {
$('#option-' + i).after('<span class="error">' + json['error']['option'][i] + '</span>');
}
}
                
if (json['error']['profile']) {
$('select[name="profile_id"]').after('<span class="error">' + json['error']['profile'] + '</span>');
}
} 
			
if (json['success']) {
$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
					
$('.success').fadeIn('slow');
					
$('#cart-total').html(json['total']);
				
$('html, body').animate({ scrollTop: 0 }, 'slow'); 
}	
}
});
});
//--></script>
<?php if ($options) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'file') { ?>
<script type="text/javascript"><!--
new AjaxUpload('#button-option-<?php echo $option['product_option_id']; ?>', {
action: 'index.php?route=product/product/upload',
name: 'file',
autoSubmit: true,
responseType: 'json',
onSubmit: function(file, extension) {
$('#button-option-<?php echo $option['product_option_id']; ?>').after('<img src="catalog/view/theme/default/image/loading.gif" class="loading" style="padding-left: 5px;" />');
$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', true);
},
onComplete: function(file, json) {
$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', false);
		
$('.error').remove();
		
if (json['success']) {
alert(json['success']);
			
$('input[name=\'option[<?php echo $option['product_option_id']; ?>]\']').attr('value', json['file']);
}
		
if (json['error']) {
$('#option-<?php echo $option['product_option_id']; ?>').after('<span class="error">' + json['error'] + '</span>');
}
		
$('.loading').remove();	
}
});
//--></script>
<?php } ?>
<?php } ?>
<?php } ?>
<script type="text/javascript"><!--
$('#review .pagination a').live('click', function() {
$('#review').fadeOut('slow');
		
$('#review').load(this.href);
	
$('#review').fadeIn('slow');
	
return false;
});			

$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');

$('#button-review').bind('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
type: 'post',
dataType: 'json',
data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
beforeSend: function() {
$('.success, .warning').remove();
$('#button-review').attr('disabled', true);
$('#review-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
complete: function() {
$('#button-review').attr('disabled', false);
$('.attention').remove();
},
success: function(data) {
if (data['error']) {
$('#review-title').after('<div class="warning">' + data['error'] + '</div>');
}
			
if (data['success']) {
$('#review-title').after('<div class="success">' + data['success'] + '</div>');
								
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
$('input[name=\'rating\']:checked').attr('checked', '');
$('input[name=\'captcha\']').val('');
}
}
});
});
//--></script> 
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script> 
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript"><!--
$(document).ready(function() {
if ($.browser.msie && $.browser.version == 6) {
$('.date, .datetime, .time').bgIframe();
}

$('.date').datepicker({dateFormat: 'yy-mm-dd'});
$('.datetime').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'h:m'
});
$('.time').timepicker({timeFormat: 'h:m'});
});
//--></script> 
<?php echo $footer; ?>