function content_55ccec9fd41274_29204611($_smarty_tpl)
    {
        if (!is_callable('smarty_function_cycle')) {
            include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/function.cycle.php';
        }
        if (!is_callable('smarty_modifier_date_format')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/modifier.date_format.php';
        }
        if (!is_callable('smarty_function_set_id')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php';
        }
        fn_preload_lang_vars(array('write_your_review', 'write_your_review'));
        if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") {
            $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null);
            ob_start();
            if ($_smarty_tpl->tpl_vars['_REQUEST']->value['dispatch'] == 'products.view') {
                ?>
   

        
	<?php 
                $_smarty_tpl->tpl_vars["discussion"] = new Smarty_variable(fn_get_discussion($_smarty_tpl->tpl_vars['object_id']->value, $_smarty_tpl->tpl_vars['object_type']->value, true, $_REQUEST), null, 0);
                ?>

	<?php 
                $_smarty_tpl->tpl_vars["posts"] = new Smarty_variable($_smarty_tpl->tpl_vars['discussion']->value['posts'], null, 0);
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['discussion']->value && $_smarty_tpl->tpl_vars['discussion']->value['type'] != "D") {
                    ?>
            <style>
                div.review_post_images{
                    display: block;
                }
                div.review_post_image{
                    display: inline-block;
                    padding: 5px;
                }
                div.review_post_image > img{
                    max-width: 150px;

                }
            </style>
	<div id="content_review_attributes">
	<?php 
                    if ($_smarty_tpl->tpl_vars['wrap']->value == true) {
                        ?>
	<p>&nbsp;</p>
	<?php 
                        $_smarty_tpl->_capture_stack[0][] = array("content", null, null);
                        ob_start();
                        ?>
	<?php 
                        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => $_smarty_tpl->tpl_vars['title']->value), 0);
                        ?>

	<?php 
                    } else {
                        ?>
	<h2 class="reviews-title"><?php 
                        echo $_smarty_tpl->__('customer_reviews');
                        ?>
</h2>
	<?php 
                    }
                    ?>

	<?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] == 'E') {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["posts"] = new Smarty_variable(fn_get_likes(fn_get_review_posts(0, $_REQUEST['page'])), null, 0);
                        ?>
	<?php 
                    } else {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["posts"] = new Smarty_variable(fn_get_likes(fn_get_review_posts($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], $_REQUEST['page'])), null, 0);
                        ?>
	<?php 
                    }
                    ?>

	
	<?php 
                    $_smarty_tpl->tpl_vars["attributes"] = new Smarty_variable(fn_get_review_attributes_work($_smarty_tpl->tpl_vars['object_id']->value), null, 0);
                    ?>
	<?php 
                    if ($_smarty_tpl->tpl_vars['object_type']->value == 'P' && $_smarty_tpl->tpl_vars['attributes']->value) {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['discussion']->value['thread_id']), null, 0);
                        ?>
	
	<?php 
                    } else {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], true), null, 0);
                        ?>
	<?php 
                    }
                    ?>

	<?php 
                    if (!$_smarty_tpl->tpl_vars['ratings']->value || $_smarty_tpl->tpl_vars['ratings']->value['average'] == 0.0 && !$_smarty_tpl->tpl_vars['ratings']->value['rating']) {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], true), null, 0);
                        ?>
	<?php 
                    }
                    ?>
        
        <?php 
                    $_smarty_tpl->tpl_vars["posts_count"] = new Smarty_variable(fn_get_review_posts_count($_smarty_tpl->tpl_vars['discussion']->value['thread_id']), null, 0);
                    ?>
        
        
        
	
	<?php 
                    if (($_smarty_tpl->tpl_vars['discussion']->value['type'] == "R" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") && $_smarty_tpl->tpl_vars['ratings']->value) {
                        ?>
	<div>
		<div class="global-average-rating">
			<h3><?php 
                        echo $_smarty_tpl->__('average_rating');
                        ?>
</h3>
			<p><?php 
                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average']), 'mode' => 'big'), 0);
                        ?>
</p>

			<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['ratings']->value['count'], ENT_QUOTES, 'UTF-8');
                        ?>
 <?php 
                        echo $_smarty_tpl->__('reviews');
                        ?>

		</div>
		<div class="global-attribute-rating">
			<table cellpadding="0" cellspacing="0" class="ga-rating">
			<?php 
                        $_smarty_tpl->tpl_vars["attribute"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["attribute"]->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['attributes']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars["attribute"]->key => $_smarty_tpl->tpl_vars["attribute"]->value) {
                            $_smarty_tpl->tpl_vars["attribute"]->_loop = true;
                            ?>
			<tr>
				<td class="right"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_name'], ENT_QUOTES, 'UTF-8');
                            ?>
&nbsp;=&nbsp;</td>
				<td class="left">
					<?php 
                            $_smarty_tpl->tpl_vars["attr_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], null, 0);
                            ?>
					<?php 
                            echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average_by_attr'][$_smarty_tpl->tpl_vars['attr_id']->value]['value'])), 0);
                            ?>
&nbsp;<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['ratings']->value['average_by_attr'][$_smarty_tpl->tpl_vars['attr_id']->value]['percent'], ENT_QUOTES, 'UTF-8');
                            ?>

				</td>
			</tr>
			<?php 
                        }
                        ?>
			</table>
		</div>
	</div>
	<?php 
                    }
                    ?>
	<div class="clearfix" style="padding-top: 20px;"></div>
	
	<?php 
                    if (strpos("CRB", $_smarty_tpl->tpl_vars['discussion']->value['type']) !== false) {
                        ?>
		<div class="buttons-container">
                     
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "opener_new_post", 'but_text' => __("write_your_review"), 'but_role' => "submit", 'but_target_id' => "new_extended_post_dialog", 'but_meta' => "ty-btn__secondary ty-btn cm-dialog-opener cm-dialog-auto-size", 'data_ca_view_id' => time()), 0);
                        ?>

		</div>

		<?php 
                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/new_post.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('new_post_title' => $_smarty_tpl->tpl_vars['new_post_title']->value), 0);
                        ?>


	<?php 
                    }
                    ?>
	<div class="sort-review-block">
		<label for="sort_review" class="sort-review-label"><?php 
                    echo $_smarty_tpl->__('sort_by');
                    ?>
</label>

		<select id="sort_review" name="sort_review" onchange="$.ceAjax('request', fn_url(this.value), <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                    ?>
result_ids: 'content_review_attributes,attributes_head'<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                    ?>
);">

			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=MH&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'MH' || !$_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review']) {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('most_helpful_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=HR&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'HR') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('highest_rating_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=LR&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'LR') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('lowest_rating_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=NW&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'NW') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('newest_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=OD&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'OD') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('oldest_first');
                    ?>
</option>
		</select>
	</div>
	
	<?php 
                    if ($_smarty_tpl->tpl_vars['posts']->value) {
                        ?>
	<?php 
                        echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "pagination_contents_comments_" . (string) $_smarty_tpl->tpl_vars['object_id']->value), 0);
                        ?>

	<?php 
                        $_smarty_tpl->tpl_vars["escaped_current_url"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['config']->value['current_url']), null, 0);
                        ?>
        
	<table cellpadding="0" cellspacing="0" class="posts-table">
	<?php 
                        $_smarty_tpl->tpl_vars['post'] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars['post']->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['posts']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars['post']->key => $_smarty_tpl->tpl_vars['post']->value) {
                            $_smarty_tpl->tpl_vars['post']->_loop = true;
                            ?>
	<tr class="posts<?php 
                            echo smarty_function_cycle(array('values' => ", manage-post"), $_smarty_tpl);
                            ?>
 clear-both" id="post_<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
                            ?>
">
		<td class="r-legend">
			<p class="r-author"><?php 
                            echo htmlspecialchars(htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['name'], ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8');
                            ?>
</p>
			<p class="r-date"><?php 
                            echo htmlspecialchars(smarty_modifier_date_format($_smarty_tpl->tpl_vars['post']->value['timestamp'], (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['date_format'] . ", " . (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['time_format']), ENT_QUOTES, 'UTF-8');
                            ?>
</p>
                        <p class="r-user-age">
                            <?php 
                            echo $_smarty_tpl->__('age_group');
                            ?>
: 
                            <?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 1) {
                                echo $_smarty_tpl->__('24&under');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 2) {
                                echo $_smarty_tpl->__('between25and34');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 3) {
                                echo $_smarty_tpl->__('between35and44');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 4) {
                                echo $_smarty_tpl->__('between45and54');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 5) {
                                echo $_smarty_tpl->__('between55and64');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 6) {
                                echo $_smarty_tpl->__('65andafter');
                                ?>

                            <?php 
                            }
                            ?>
                        </p>
			<?php 
                            if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "R" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") {
                                ?>
				<?php 
                                if ($_smarty_tpl->tpl_vars['attributes']->value) {
                                    ?>
				<table cellpadding="0" cellspacing="0" class="ga-rating">
					<?php 
                                    $_smarty_tpl->tpl_vars["post_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['post']->value['post_id'], null, 0);
                                    ?>
					<?php 
                                    $_smarty_tpl->tpl_vars["attribute"] = new Smarty_Variable();
                                    $_smarty_tpl->tpl_vars["attribute"]->_loop = false;
                                    $_from = $_smarty_tpl->tpl_vars['attributes']->value;
                                    if (!is_array($_from) && !is_object($_from)) {
                                        settype($_from, 'array');
                                    }
                                    foreach ($_from as $_smarty_tpl->tpl_vars["attribute"]->key => $_smarty_tpl->tpl_vars["attribute"]->value) {
                                        $_smarty_tpl->tpl_vars["attribute"]->_loop = true;
                                        ?>
                                    <tr>
					<td class="right"><?php 
                                        echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_name'], ENT_QUOTES, 'UTF-8');
                                        ?>
&nbsp;=&nbsp;</td>
					<td class="left" style="margin-top: 2px;">
						<?php 
                                        $_smarty_tpl->tpl_vars["attr_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], null, 0);
                                        ?>
						<?php 
                                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['rating'][$_smarty_tpl->tpl_vars['post_id']->value][$_smarty_tpl->tpl_vars['attr_id']->value])), 0);
                                        ?>

					</td>
                                    </tr>
				<?php 
                                    }
                                    ?>
				</table>
				<?php 
                                }
                                ?>
			<?php 
                            }
                            ?>
		</td>
		<td class="r-message">
			<?php 
                            if ($_smarty_tpl->tpl_vars['discussion']->value['type'] != "C") {
                                ?>
				<div class="r-subject">

					<?php 
                                if ($_smarty_tpl->tpl_vars['attributes']->value) {
                                    ?>
						<?php 
                                    $_smarty_tpl->tpl_vars["rates"] = new Smarty_variable(fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average_by_post'][$_smarty_tpl->tpl_vars['post_id']->value]), null, 0);
                                    ?>
						<?php 
                                    if ($_smarty_tpl->tpl_vars['rates']->value[$_smarty_tpl->getVariable('smarty')->value['section']['FULL']['index']] != 0 || $_smarty_tpl->tpl_vars['rates']->value[$_smarty_tpl->getVariable('smarty')->value['section']['PART']['index']] != 0) {
                                        ?>

							<?php 
                                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average_by_post'][$_smarty_tpl->tpl_vars['post_id']->value])), 0);
                                        ?>


						<?php 
                                    } else {
                                        ?>
							<?php 
                                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['post']->value['rating_value'])), 0);
                                        ?>

						<?php 
                                    }
                                    ?>
					<?php 
                                } else {
                                    ?>

						<?php 
                                    echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['post']->value['rating_value'])), 0);
                                    ?>

					<?php 
                                }
                                ?>
					<?php 
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['message_title'], ENT_QUOTES, 'UTF-8');
                                ?>

				</div>
			<?php 
                            }
                            ?>
			<?php 
                            if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "C" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") {
                                ?>
				<?php 
                                echo nl2br(htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['message'], ENT_QUOTES, 'UTF-8', true));
                                ?>

			<?php 
                            }
                            ?>
                        <?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['image1'] || $_smarty_tpl->tpl_vars['post']->value['image2']) {
                                ?>
                            <div class="review_post_images">
                                <?php 
                                if ($_smarty_tpl->tpl_vars['post']->value['image1']) {
                                    ?>
                                    <div class="review_post_image"><img class="img_review_post_image" src="/images/review_img/<?php 
                                    echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['image1'], ENT_QUOTES, 'UTF-8');
                                    ?>
" alt="img"  border="0"></div>
                                <?php 
                                }
                                ?>
                                <?php 
                                if ($_smarty_tpl->tpl_vars['post']->value['image1']) {
                                    ?>
                                    <div class="review_post_image"><img class="img_review_post_image" src="/images/review_img/<?php 
                                    echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['image2'], ENT_QUOTES, 'UTF-8');
                                    ?>
" alt="img"  border="0"></div>
                                <?php 
                                }
                                ?>
                            </div>
                        <?php 
                            }
                            ?>
			<div class="r-likes">
				<div class="is-useful float-left"><?php 
                            echo $_smarty_tpl->__('found_useful');
                            ?>
: <strong><?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['likes']['yes']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['likes']['yes'], ENT_QUOTES, 'UTF-8');
                            } else {
                                ?>
0<?php 
                            }
                            ?>
</strong>&nbsp;<?php 
                            echo $_smarty_tpl->__('out_of');
                            ?>
&nbsp;<strong><?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['likes']['votes']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['likes']['votes'], ENT_QUOTES, 'UTF-8');
                            } else {
                                ?>
0<?php 
                            }
                            ?>
</strong></div>
				<?php 
                            echo $_smarty_tpl->__('was_helpful');
                            ?>

				<?php 
                            if ($_smarty_tpl->tpl_vars['auth']->value['user_id']) {
                                ?>
					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_yes'), 'but_meta' => "cm-ajax", 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=review_attributes.likes&like=1&post_id=" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id']), 0);
                                ?>

					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_no'), 'but_meta' => "cm-ajax", 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=review_attributes.likes&like=0&post_id=" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id']), 0);
                                ?>

				<?php 
                            } else {
                                ?>
					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_yes'), 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=auth.login_form&return_url=" . (string) $_smarty_tpl->tpl_vars['escaped_current_url']->value), 0);
                                ?>

					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_no'), 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=auth.login_form&return_url=" . (string) $_smarty_tpl->tpl_vars['escaped_current_url']->value), 0);
                                ?>

				<?php 
                            }
                            ?>
			</div>
		</td>
	</tr>
	<?php 
                        }
                        ?>
	<?php 
                        if ($_smarty_tpl->tpl_vars['object_type']->value == "E" && $_smarty_tpl->tpl_vars['current_post_id']->value) {
                            ?>
	<script type="text/javascript">
	//<![CDATA[
	$(document).ready(function()<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>

		if ($('#post_' + <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['current_post_id']->value, ENT_QUOTES, 'UTF-8');
                            ?>
).length) <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>

			jQuery.scrollToElm($('#post_' + <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['current_post_id']->value, ENT_QUOTES, 'UTF-8');
                            ?>
));
		<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>

	<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>
);
	//]]>
	</script>
	<?php 
                        }
                        ?>
	</table>
        <script type="text/javascript">
	//<![CDATA[
	$(document).ready(function()<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                        ?>

            var userCheckForReview = true;
            var user_product_ordered = 1;
            $('a#opener_new_post').click(function(){
                var checkout_est_url = fn_url('review_attributes.check_user&object_id=<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['object_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
&is_ajax=1');
                var ajax_exectute = $.ajax({
                    url: checkout_est_url,
                    dataType:'html',
                    async:false,
                    cache: false,
                    beforeSend: function(xhr) {
                        xhr.withCredentials = true;
                    },
                });

                 ajax_exectute.done(function(data) {
                    if(typeof data ==="string" ){
                        data = JSON.parse(data);
                    }
                    if(data.text=='notordered'){
                        
                        user_product_ordered = 0;
                    }else if(data.text=='logedout'){
                        window.location.href = fn_url('auth.login_form&return_url=<?php 
                        echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['config']->value['current_url']), ENT_QUOTES, 'UTF-8');
                        ?>
');
                        userCheckForReview = false;
                    }else if(data.text=='allchecked'){
                        
                        user_product_ordered = 1;
                        userCheckForReview = true;
                    }else {
                        user_product_ordered = 1;
                        userCheckForReview = true;
                    }
                 });
                 $('form#add_extended_post_form').trigger('reset');
                 $('div.ls_review_image_container2').remove();
                 $('img#ls_uploadPreview').attr("src","/images/review_img/review_no_image.jpg");
                 $('input#user_product_ordered').val(user_product_ordered);
                 return userCheckForReview;
            });
            
	<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                        ?>
);
	//]]>
        </script>
        <div class="div_show_more_posts_action" style="text-align:center">
            <input type="hidden" value="2" id="input_show_more_posts_action" />
            <input type="hidden" value="<?php 
                        if ($_REQUEST['sort_review']) {
                            echo htmlspecialchars($_REQUEST['sort_review'], ENT_QUOTES, 'UTF-8');
                        } else {
                            ?>
MH<?php 
                        }
                        ?>
" id="input_sort_review" />
            <?php 
                        if ($_smarty_tpl->tpl_vars['posts_count']->value > count($_smarty_tpl->tpl_vars['posts']->value)) {
                            ?>
            <a onclick="ls_show_more_posts(<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['object_id']->value, ENT_QUOTES, 'UTF-8');
                            ?>
,'<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['object_type']->value, ENT_QUOTES, 'UTF-8');
                            ?>
');return false;" id="show_more_posts"><?php 
                            echo $_smarty_tpl->__('show_more_posts');
                            ?>
</a>
            <?php 
                        }
                        ?>
        </div>

	<?php 
                        echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "pagination_contents_comments_" . (string) $_smarty_tpl->tpl_vars['object_id']->value), 0);
                        ?>

	<?php 
                    } else {
                        ?>
	<p class="no-items ty-no-items"><?php 
                        echo $_smarty_tpl->__('no_posts_found');
                        ?>
</p>
	<?php 
                    }
                    ?>

	<?php 
                    if ($_smarty_tpl->tpl_vars['wrap']->value == true) {
                        ?>
	<?php 
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
		<?php 
                        echo $_smarty_tpl->getSubTemplate("common/group.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('content' => Smarty::$_smarty_vars['capture']['content']), 0);
                        ?>

	<?php 
                    } else {
                        ?>
		<?php 
                        $_smarty_tpl->_capture_stack[0][] = array("mainbox_title", null, null);
                        ob_start();
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8');
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
	<?php 
                    }
                    ?>
	<!--content_review_attributes--></div>

	<?php 
                }
            }
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            if (trim(Smarty::$_smarty_vars['capture']['template_content'])) {
                if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") {
                    ?>
<span class="cm-template-box template-box" data-ca-te-template="addons/altteam_review_attributes/views/discussion/view.tpl" id="<?php 
                    echo smarty_function_set_id(array('name' => "addons/altteam_review_attributes/views/discussion/view.tpl"), $_smarty_tpl);
                    ?>
"><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php 
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                    ?>
<!--[/tpl_id]--></span><?php 
                } else {
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                }
            }
        } else {
            if ($_smarty_tpl->tpl_vars['_REQUEST']->value['dispatch'] == 'products.view') {
                ?>
   

        
	<?php 
                $_smarty_tpl->tpl_vars["discussion"] = new Smarty_variable(fn_get_discussion($_smarty_tpl->tpl_vars['object_id']->value, $_smarty_tpl->tpl_vars['object_type']->value, true, $_REQUEST), null, 0);
                ?>

	<?php 
                $_smarty_tpl->tpl_vars["posts"] = new Smarty_variable($_smarty_tpl->tpl_vars['discussion']->value['posts'], null, 0);
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['discussion']->value && $_smarty_tpl->tpl_vars['discussion']->value['type'] != "D") {
                    ?>
            <style>
                div.review_post_images{
                    display: block;
                }
                div.review_post_image{
                    display: inline-block;
                    padding: 5px;
                }
                div.review_post_image > img{
                    max-width: 150px;

                }
            </style>
	<div id="content_review_attributes">
	<?php 
                    if ($_smarty_tpl->tpl_vars['wrap']->value == true) {
                        ?>
	<p>&nbsp;</p>
	<?php 
                        $_smarty_tpl->_capture_stack[0][] = array("content", null, null);
                        ob_start();
                        ?>
	<?php 
                        echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => $_smarty_tpl->tpl_vars['title']->value), 0);
                        ?>

	<?php 
                    } else {
                        ?>
	<h2 class="reviews-title"><?php 
                        echo $_smarty_tpl->__('customer_reviews');
                        ?>
</h2>
	<?php 
                    }
                    ?>

	<?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] == 'E') {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["posts"] = new Smarty_variable(fn_get_likes(fn_get_review_posts(0, $_REQUEST['page'])), null, 0);
                        ?>
	<?php 
                    } else {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["posts"] = new Smarty_variable(fn_get_likes(fn_get_review_posts($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], $_REQUEST['page'])), null, 0);
                        ?>
	<?php 
                    }
                    ?>

	
	<?php 
                    $_smarty_tpl->tpl_vars["attributes"] = new Smarty_variable(fn_get_review_attributes_work($_smarty_tpl->tpl_vars['object_id']->value), null, 0);
                    ?>
	<?php 
                    if ($_smarty_tpl->tpl_vars['object_type']->value == 'P' && $_smarty_tpl->tpl_vars['attributes']->value) {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['discussion']->value['thread_id']), null, 0);
                        ?>
	
	<?php 
                    } else {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], true), null, 0);
                        ?>
	<?php 
                    }
                    ?>

	<?php 
                    if (!$_smarty_tpl->tpl_vars['ratings']->value || $_smarty_tpl->tpl_vars['ratings']->value['average'] == 0.0 && !$_smarty_tpl->tpl_vars['ratings']->value['rating']) {
                        ?>
		<?php 
                        $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], true), null, 0);
                        ?>
	<?php 
                    }
                    ?>
        
        <?php 
                    $_smarty_tpl->tpl_vars["posts_count"] = new Smarty_variable(fn_get_review_posts_count($_smarty_tpl->tpl_vars['discussion']->value['thread_id']), null, 0);
                    ?>
        
        
        
	
	<?php 
                    if (($_smarty_tpl->tpl_vars['discussion']->value['type'] == "R" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") && $_smarty_tpl->tpl_vars['ratings']->value) {
                        ?>
	<div>
		<div class="global-average-rating">
			<h3><?php 
                        echo $_smarty_tpl->__('average_rating');
                        ?>
</h3>
			<p><?php 
                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average']), 'mode' => 'big'), 0);
                        ?>
</p>

			<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['ratings']->value['count'], ENT_QUOTES, 'UTF-8');
                        ?>
 <?php 
                        echo $_smarty_tpl->__('reviews');
                        ?>

		</div>
		<div class="global-attribute-rating">
			<table cellpadding="0" cellspacing="0" class="ga-rating">
			<?php 
                        $_smarty_tpl->tpl_vars["attribute"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["attribute"]->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['attributes']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars["attribute"]->key => $_smarty_tpl->tpl_vars["attribute"]->value) {
                            $_smarty_tpl->tpl_vars["attribute"]->_loop = true;
                            ?>
			<tr>
				<td class="right"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_name'], ENT_QUOTES, 'UTF-8');
                            ?>
&nbsp;=&nbsp;</td>
				<td class="left">
					<?php 
                            $_smarty_tpl->tpl_vars["attr_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], null, 0);
                            ?>
					<?php 
                            echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average_by_attr'][$_smarty_tpl->tpl_vars['attr_id']->value]['value'])), 0);
                            ?>
&nbsp;<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['ratings']->value['average_by_attr'][$_smarty_tpl->tpl_vars['attr_id']->value]['percent'], ENT_QUOTES, 'UTF-8');
                            ?>

				</td>
			</tr>
			<?php 
                        }
                        ?>
			</table>
		</div>
	</div>
	<?php 
                    }
                    ?>
	<div class="clearfix" style="padding-top: 20px;"></div>
	
	<?php 
                    if (strpos("CRB", $_smarty_tpl->tpl_vars['discussion']->value['type']) !== false) {
                        ?>
		<div class="buttons-container">
                     
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_id' => "opener_new_post", 'but_text' => __("write_your_review"), 'but_role' => "submit", 'but_target_id' => "new_extended_post_dialog", 'but_meta' => "ty-btn__secondary ty-btn cm-dialog-opener cm-dialog-auto-size", 'data_ca_view_id' => time()), 0);
                        ?>

		</div>

		<?php 
                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/new_post.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('new_post_title' => $_smarty_tpl->tpl_vars['new_post_title']->value), 0);
                        ?>


	<?php 
                    }
                    ?>
	<div class="sort-review-block">
		<label for="sort_review" class="sort-review-label"><?php 
                    echo $_smarty_tpl->__('sort_by');
                    ?>
</label>

		<select id="sort_review" name="sort_review" onchange="$.ceAjax('request', fn_url(this.value), <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                    ?>
result_ids: 'content_review_attributes,attributes_head'<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                    ?>
);">

			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=MH&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'MH' || !$_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review']) {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('most_helpful_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=HR&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'HR') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('highest_rating_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=LR&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'LR') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('lowest_rating_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=NW&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'NW') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('newest_first');
                    ?>
</option>
			<option value="<?php 
                    echo htmlspecialchars(fn_url("products.view&product_id=" . (string) $_smarty_tpl->tpl_vars['object_id']->value . "&sort_review=OD&selected_section=review_attributes"), ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['_REQUEST']->value['sort_review'] == 'OD') {
                        ?>
selected="selected"<?php 
                    }
                    ?>
><?php 
                    echo $_smarty_tpl->__('oldest_first');
                    ?>
</option>
		</select>
	</div>
	
	<?php 
                    if ($_smarty_tpl->tpl_vars['posts']->value) {
                        ?>
	<?php 
                        echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "pagination_contents_comments_" . (string) $_smarty_tpl->tpl_vars['object_id']->value), 0);
                        ?>

	<?php 
                        $_smarty_tpl->tpl_vars["escaped_current_url"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['config']->value['current_url']), null, 0);
                        ?>
        
	<table cellpadding="0" cellspacing="0" class="posts-table">
	<?php 
                        $_smarty_tpl->tpl_vars['post'] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars['post']->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['posts']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        foreach ($_from as $_smarty_tpl->tpl_vars['post']->key => $_smarty_tpl->tpl_vars['post']->value) {
                            $_smarty_tpl->tpl_vars['post']->_loop = true;
                            ?>
	<tr class="posts<?php 
                            echo smarty_function_cycle(array('values' => ", manage-post"), $_smarty_tpl);
                            ?>
 clear-both" id="post_<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
                            ?>
">
		<td class="r-legend">
			<p class="r-author"><?php 
                            echo htmlspecialchars(htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['name'], ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8');
                            ?>
</p>
			<p class="r-date"><?php 
                            echo htmlspecialchars(smarty_modifier_date_format($_smarty_tpl->tpl_vars['post']->value['timestamp'], (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['date_format'] . ", " . (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['time_format']), ENT_QUOTES, 'UTF-8');
                            ?>
</p>
                        <p class="r-user-age">
                            <?php 
                            echo $_smarty_tpl->__('age_group');
                            ?>
: 
                            <?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 1) {
                                echo $_smarty_tpl->__('24&under');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 2) {
                                echo $_smarty_tpl->__('between25and34');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 3) {
                                echo $_smarty_tpl->__('between35and44');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 4) {
                                echo $_smarty_tpl->__('between45and54');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 5) {
                                echo $_smarty_tpl->__('between55and64');
                                ?>

                            <?php 
                            } elseif ($_smarty_tpl->tpl_vars['post']->value['user_age'] == 6) {
                                echo $_smarty_tpl->__('65andafter');
                                ?>

                            <?php 
                            }
                            ?>
                        </p>
			<?php 
                            if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "R" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") {
                                ?>
				<?php 
                                if ($_smarty_tpl->tpl_vars['attributes']->value) {
                                    ?>
				<table cellpadding="0" cellspacing="0" class="ga-rating">
					<?php 
                                    $_smarty_tpl->tpl_vars["post_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['post']->value['post_id'], null, 0);
                                    ?>
					<?php 
                                    $_smarty_tpl->tpl_vars["attribute"] = new Smarty_Variable();
                                    $_smarty_tpl->tpl_vars["attribute"]->_loop = false;
                                    $_from = $_smarty_tpl->tpl_vars['attributes']->value;
                                    if (!is_array($_from) && !is_object($_from)) {
                                        settype($_from, 'array');
                                    }
                                    foreach ($_from as $_smarty_tpl->tpl_vars["attribute"]->key => $_smarty_tpl->tpl_vars["attribute"]->value) {
                                        $_smarty_tpl->tpl_vars["attribute"]->_loop = true;
                                        ?>
                                    <tr>
					<td class="right"><?php 
                                        echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_name'], ENT_QUOTES, 'UTF-8');
                                        ?>
&nbsp;=&nbsp;</td>
					<td class="left" style="margin-top: 2px;">
						<?php 
                                        $_smarty_tpl->tpl_vars["attr_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], null, 0);
                                        ?>
						<?php 
                                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['rating'][$_smarty_tpl->tpl_vars['post_id']->value][$_smarty_tpl->tpl_vars['attr_id']->value])), 0);
                                        ?>

					</td>
                                    </tr>
				<?php 
                                    }
                                    ?>
				</table>
				<?php 
                                }
                                ?>
			<?php 
                            }
                            ?>
		</td>
		<td class="r-message">
			<?php 
                            if ($_smarty_tpl->tpl_vars['discussion']->value['type'] != "C") {
                                ?>
				<div class="r-subject">

					<?php 
                                if ($_smarty_tpl->tpl_vars['attributes']->value) {
                                    ?>
						<?php 
                                    $_smarty_tpl->tpl_vars["rates"] = new Smarty_variable(fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average_by_post'][$_smarty_tpl->tpl_vars['post_id']->value]), null, 0);
                                    ?>
						<?php 
                                    if ($_smarty_tpl->tpl_vars['rates']->value[$_smarty_tpl->getVariable('smarty')->value['section']['FULL']['index']] != 0 || $_smarty_tpl->tpl_vars['rates']->value[$_smarty_tpl->getVariable('smarty')->value['section']['PART']['index']] != 0) {
                                        ?>

							<?php 
                                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average_by_post'][$_smarty_tpl->tpl_vars['post_id']->value])), 0);
                                        ?>


						<?php 
                                    } else {
                                        ?>
							<?php 
                                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['post']->value['rating_value'])), 0);
                                        ?>

						<?php 
                                    }
                                    ?>
					<?php 
                                } else {
                                    ?>

						<?php 
                                    echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['post']->value['rating_value'])), 0);
                                    ?>

					<?php 
                                }
                                ?>
					<?php 
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['message_title'], ENT_QUOTES, 'UTF-8');
                                ?>

				</div>
			<?php 
                            }
                            ?>
			<?php 
                            if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "C" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") {
                                ?>
				<?php 
                                echo nl2br(htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['message'], ENT_QUOTES, 'UTF-8', true));
                                ?>

			<?php 
                            }
                            ?>
                        <?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['image1'] || $_smarty_tpl->tpl_vars['post']->value['image2']) {
                                ?>
                            <div class="review_post_images">
                                <?php 
                                if ($_smarty_tpl->tpl_vars['post']->value['image1']) {
                                    ?>
                                    <div class="review_post_image"><img class="img_review_post_image" src="/images/review_img/<?php 
                                    echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['image1'], ENT_QUOTES, 'UTF-8');
                                    ?>
" alt="img"  border="0"></div>
                                <?php 
                                }
                                ?>
                                <?php 
                                if ($_smarty_tpl->tpl_vars['post']->value['image1']) {
                                    ?>
                                    <div class="review_post_image"><img class="img_review_post_image" src="/images/review_img/<?php 
                                    echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['image2'], ENT_QUOTES, 'UTF-8');
                                    ?>
" alt="img"  border="0"></div>
                                <?php 
                                }
                                ?>
                            </div>
                        <?php 
                            }
                            ?>
			<div class="r-likes">
				<div class="is-useful float-left"><?php 
                            echo $_smarty_tpl->__('found_useful');
                            ?>
: <strong><?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['likes']['yes']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['likes']['yes'], ENT_QUOTES, 'UTF-8');
                            } else {
                                ?>
0<?php 
                            }
                            ?>
</strong>&nbsp;<?php 
                            echo $_smarty_tpl->__('out_of');
                            ?>
&nbsp;<strong><?php 
                            if ($_smarty_tpl->tpl_vars['post']->value['likes']['votes']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['likes']['votes'], ENT_QUOTES, 'UTF-8');
                            } else {
                                ?>
0<?php 
                            }
                            ?>
</strong></div>
				<?php 
                            echo $_smarty_tpl->__('was_helpful');
                            ?>

				<?php 
                            if ($_smarty_tpl->tpl_vars['auth']->value['user_id']) {
                                ?>
					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_yes'), 'but_meta' => "cm-ajax", 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=review_attributes.likes&like=1&post_id=" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id']), 0);
                                ?>

					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_no'), 'but_meta' => "cm-ajax", 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=review_attributes.likes&like=0&post_id=" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id']), 0);
                                ?>

				<?php 
                            } else {
                                ?>
					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_yes'), 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=auth.login_form&return_url=" . (string) $_smarty_tpl->tpl_vars['escaped_current_url']->value), 0);
                                ?>

					<?php 
                                echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_role' => '', 'but_text' => __('review_attributes_no'), 'but_href' => (string) $_smarty_tpl->tpl_vars['index_script']->value . "?dispatch=auth.login_form&return_url=" . (string) $_smarty_tpl->tpl_vars['escaped_current_url']->value), 0);
                                ?>

				<?php 
                            }
                            ?>
			</div>
		</td>
	</tr>
	<?php 
                        }
                        ?>
	<?php 
                        if ($_smarty_tpl->tpl_vars['object_type']->value == "E" && $_smarty_tpl->tpl_vars['current_post_id']->value) {
                            ?>
	<script type="text/javascript">
	//<![CDATA[
	$(document).ready(function()<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>

		if ($('#post_' + <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['current_post_id']->value, ENT_QUOTES, 'UTF-8');
                            ?>
).length) <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>

			jQuery.scrollToElm($('#post_' + <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['current_post_id']->value, ENT_QUOTES, 'UTF-8');
                            ?>
));
		<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>

	<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                            ?>
);
	//]]>
	</script>
	<?php 
                        }
                        ?>
	</table>
        <script type="text/javascript">
	//<![CDATA[
	$(document).ready(function()<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['ldelim']->value, ENT_QUOTES, 'UTF-8');
                        ?>

            var userCheckForReview = true;
            var user_product_ordered = 1;
            $('a#opener_new_post').click(function(){
                var checkout_est_url = fn_url('review_attributes.check_user&object_id=<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['object_id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
&is_ajax=1');
                var ajax_exectute = $.ajax({
                    url: checkout_est_url,
                    dataType:'html',
                    async:false,
                    cache: false,
                    beforeSend: function(xhr) {
                        xhr.withCredentials = true;
                    },
                });

                 ajax_exectute.done(function(data) {
                    if(typeof data ==="string" ){
                        data = JSON.parse(data);
                    }
                    if(data.text=='notordered'){
                        
                        user_product_ordered = 0;
                    }else if(data.text=='logedout'){
                        window.location.href = fn_url('auth.login_form&return_url=<?php 
                        echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['config']->value['current_url']), ENT_QUOTES, 'UTF-8');
                        ?>
');
                        userCheckForReview = false;
                    }else if(data.text=='allchecked'){
                        
                        user_product_ordered = 1;
                        userCheckForReview = true;
                    }else {
                        user_product_ordered = 1;
                        userCheckForReview = true;
                    }
                 });
                 $('form#add_extended_post_form').trigger('reset');
                 $('div.ls_review_image_container2').remove();
                 $('img#ls_uploadPreview').attr("src","/images/review_img/review_no_image.jpg");
                 $('input#user_product_ordered').val(user_product_ordered);
                 return userCheckForReview;
            });
            
	<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['rdelim']->value, ENT_QUOTES, 'UTF-8');
                        ?>
);
	//]]>
        </script>
        <div class="div_show_more_posts_action" style="text-align:center">
            <input type="hidden" value="2" id="input_show_more_posts_action" />
            <input type="hidden" value="<?php 
                        if ($_REQUEST['sort_review']) {
                            echo htmlspecialchars($_REQUEST['sort_review'], ENT_QUOTES, 'UTF-8');
                        } else {
                            ?>
MH<?php 
                        }
                        ?>
" id="input_sort_review" />
            <?php 
                        if ($_smarty_tpl->tpl_vars['posts_count']->value > count($_smarty_tpl->tpl_vars['posts']->value)) {
                            ?>
            <a onclick="ls_show_more_posts(<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['object_id']->value, ENT_QUOTES, 'UTF-8');
                            ?>
,'<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['object_type']->value, ENT_QUOTES, 'UTF-8');
                            ?>
');return false;" id="show_more_posts"><?php 
                            echo $_smarty_tpl->__('show_more_posts');
                            ?>
</a>
            <?php 
                        }
                        ?>
        </div>

	<?php 
                        echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "pagination_contents_comments_" . (string) $_smarty_tpl->tpl_vars['object_id']->value), 0);
                        ?>

	<?php 
                    } else {
                        ?>
	<p class="no-items ty-no-items"><?php 
                        echo $_smarty_tpl->__('no_posts_found');
                        ?>
</p>
	<?php 
                    }
                    ?>

	<?php 
                    if ($_smarty_tpl->tpl_vars['wrap']->value == true) {
                        ?>
	<?php 
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
		<?php 
                        echo $_smarty_tpl->getSubTemplate("common/group.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('content' => Smarty::$_smarty_vars['capture']['content']), 0);
                        ?>

	<?php 
                    } else {
                        ?>
		<?php 
                        $_smarty_tpl->_capture_stack[0][] = array("mainbox_title", null, null);
                        ob_start();
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8');
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
	<?php 
                    }
                    ?>
	<!--content_review_attributes--></div>

	<?php 
                }
            }
        }
    }
    function content_55ccec9f7b1266_22892671($_smarty_tpl)
    {
        if (!is_callable('smarty_function_set_id')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php';
        }
        if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") {
            $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null);
            ob_start();
            $_smarty_tpl->tpl_vars["object_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['product_id'], null, 0);
            $_smarty_tpl->tpl_vars["object_type"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['discussion']['object_type'], null, 0);
            $_smarty_tpl->tpl_vars["attributes"] = new Smarty_variable(fn_get_review_attributes_work($_smarty_tpl->tpl_vars['object_id']->value), null, 0);
            ?>

<?php 
            if ($_smarty_tpl->tpl_vars['attributes']->value) {
                ?>
<div id="attributes_head">
	<?php 
                $_smarty_tpl->tpl_vars["rev_count"] = new Smarty_variable(fn_get_review_count($_smarty_tpl->tpl_vars['object_id']->value, $_smarty_tpl->tpl_vars['object_type']->value, $_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id']), null, 0);
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['product']->value['product_id'] && $_smarty_tpl->tpl_vars['attributes']->value) {
                    ?>
	
		<?php 
                    $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id']), null, 0);
                    ?>
	<?php 
                } else {
                    ?>
		<?php 
                    $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id'], true), null, 0);
                    ?>
	<?php 
                }
                ?>
	<?php 
                if ($_smarty_tpl->tpl_vars['attributes']->value && !$_smarty_tpl->tpl_vars['ratings']->value || $_smarty_tpl->tpl_vars['ratings']->value['average'] == 0.0 && !$_smarty_tpl->tpl_vars['ratings']->value['rating']) {
                    ?>
		<?php 
                    $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id'], true), null, 0);
                    ?>
	<?php 
                }
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['ratings']->value['average']) {
                    ?>
		<?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
<a style="text-decoration: none;" onclick="$('#review_attributes').click(); $.scrollToElm($('#review_attributes')); return false;"><?php 
                    }
                    echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average'])), 0);
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
</a><?php 
                    }
                    ?>
		<?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
<a style="text-decoration: none;" onclick="$('#review_attributes').click(); $.scrollToElm($('#review_attributes')); return false;"><?php 
                    }
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['rev_count']->value, ENT_QUOTES, 'UTF-8');
                    ?>
&nbsp;<?php 
                    echo $_smarty_tpl->__('reviews');
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
</a><?php 
                    }
                    ?>
	<?php 
                }
                ?>
<!--attributes_head--></div>
<?php 
            } else {
                ?>

	<?php 
                $_smarty_tpl->tpl_vars["average_rating"] = new Smarty_variable(fn_get_average_rating($_smarty_tpl->tpl_vars['object_id']->value, $_smarty_tpl->tpl_vars['object_type']->value), null, 0);
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['average_rating']->value) {
                    ?>
		<?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
<a onclick="$('#review_attributes').click(); return false;"><?php 
                    }
                    echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['average_rating']->value), 'mode' => 'big'), 0);
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
</a><?php 
                    }
                    ?>
	<?php 
                }
                ?>

<?php 
            }
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            if (trim(Smarty::$_smarty_vars['capture']['template_content'])) {
                if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") {
                    ?>
<span class="cm-template-box template-box" data-ca-te-template="addons/altteam_review_attributes/hooks/products/main_info_title.post.tpl" id="<?php 
                    echo smarty_function_set_id(array('name' => "addons/altteam_review_attributes/hooks/products/main_info_title.post.tpl"), $_smarty_tpl);
                    ?>
"><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php 
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                    ?>
<!--[/tpl_id]--></span><?php 
                } else {
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                }
            }
        } else {
            $_smarty_tpl->tpl_vars["object_id"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['product_id'], null, 0);
            $_smarty_tpl->tpl_vars["object_type"] = new Smarty_variable($_smarty_tpl->tpl_vars['product']->value['discussion']['object_type'], null, 0);
            $_smarty_tpl->tpl_vars["attributes"] = new Smarty_variable(fn_get_review_attributes_work($_smarty_tpl->tpl_vars['object_id']->value), null, 0);
            ?>

<?php 
            if ($_smarty_tpl->tpl_vars['attributes']->value) {
                ?>
<div id="attributes_head">
	<?php 
                $_smarty_tpl->tpl_vars["rev_count"] = new Smarty_variable(fn_get_review_count($_smarty_tpl->tpl_vars['object_id']->value, $_smarty_tpl->tpl_vars['object_type']->value, $_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id']), null, 0);
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['product']->value['product_id'] && $_smarty_tpl->tpl_vars['attributes']->value) {
                    ?>
	
		<?php 
                    $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id']), null, 0);
                    ?>
	<?php 
                } else {
                    ?>
		<?php 
                    $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id'], true), null, 0);
                    ?>
	<?php 
                }
                ?>
	<?php 
                if ($_smarty_tpl->tpl_vars['attributes']->value && !$_smarty_tpl->tpl_vars['ratings']->value || $_smarty_tpl->tpl_vars['ratings']->value['average'] == 0.0 && !$_smarty_tpl->tpl_vars['ratings']->value['rating']) {
                    ?>
		<?php 
                    $_smarty_tpl->tpl_vars["ratings"] = new Smarty_variable(fn_get_review_ratings($_smarty_tpl->tpl_vars['product']->value['discussion']['thread_id'], true), null, 0);
                    ?>
	<?php 
                }
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['ratings']->value['average']) {
                    ?>
		<?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
<a style="text-decoration: none;" onclick="$('#review_attributes').click(); $.scrollToElm($('#review_attributes')); return false;"><?php 
                    }
                    echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['ratings']->value['average'])), 0);
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
</a><?php 
                    }
                    ?>
		<?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
<a style="text-decoration: none;" onclick="$('#review_attributes').click(); $.scrollToElm($('#review_attributes')); return false;"><?php 
                    }
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['rev_count']->value, ENT_QUOTES, 'UTF-8');
                    ?>
&nbsp;<?php 
                    echo $_smarty_tpl->__('reviews');
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
</a><?php 
                    }
                    ?>
	<?php 
                }
                ?>
<!--attributes_head--></div>
<?php 
            } else {
                ?>

	<?php 
                $_smarty_tpl->tpl_vars["average_rating"] = new Smarty_variable(fn_get_average_rating($_smarty_tpl->tpl_vars['object_id']->value, $_smarty_tpl->tpl_vars['object_type']->value), null, 0);
                ?>

	<?php 
                if ($_smarty_tpl->tpl_vars['average_rating']->value) {
                    ?>
		<?php 
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
<a onclick="$('#review_attributes').click(); return false;"><?php 
                    }
                    echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/discussion/components/stars.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('stars' => fn_get_discussion_rating($_smarty_tpl->tpl_vars['average_rating']->value), 'mode' => 'big'), 0);
                    if ($_smarty_tpl->tpl_vars['runtime']->value['controller'] == "products" && $_smarty_tpl->tpl_vars['runtime']->value['mode'] == "view") {
                        ?>
</a><?php 
                    }
                    ?>
	<?php 
                }
                ?>

<?php 
            }
        }
    }
            $msg = __('thanks_for_vote');
            fn_set_notification('N', $title, $msg);
        } else {
            fn_set_notification('E', __('error'), __('no_more_vote'), 'I');
        }
    }
    exit;
}
if ($mode == 'view_posts') {
    $posts = array();
    $object_id = $_REQUEST["object_id"];
    if ($object_id) {
        $object_type = $_REQUEST['object_type'];
        $page = $_REQUEST["page"];
        $discussion = fn_get_discussion($object_id, $object_type, true, $_REQUEST);
        $attributes = fn_get_review_attributes_work($object_id);
        $no_atributes = true;
        if ($attributes) {
            $no_atributes = false;
        }
        $ratings = fn_get_review_ratings($discussion["thread_id"], $no_atributes);
        $posts = fn_get_review_posts($discussion['thread_id'], $page);
    }
    Registry::set('runtime.root_template', 'addons/altteam_review_attributes/views/view_posts.tpl');
    $discussion_object_types = array('P' => 'product', 'C' => 'category', 'A' => 'page', 'O' => 'order', 'E' => 'home_page');
    //get the values from the settings
    $getDiscutionsPostPerPageSettings = db_get_field("\n                SELECT ?:settings_objects.value\n                FROM ?:settings_objects\n                    JOIN ?:settings_sections ON ?:settings_sections.section_id = ?:settings_objects.section_id\n                WHERE \n                    ?:settings_sections.name = 'discussion'\n                    AND ?:settings_objects.name=?s\n            ", $discussion_object_types[$object_type] . "_posts_per_page");
    //
    $total_posts = db_get_field("SELECT COUNT(*) FROM ?:discussion_posts WHERE ?:discussion_posts.status = 'A' AND ?:discussion_posts.thread_id=?i", $discussion["thread_id"]);
    if ($page * $getDiscutionsPostPerPageSettings >= $total_posts) {
        fn_set_notification('N', __('notice'), null);
    function content_55cdb2acb94026_74420224($_smarty_tpl)
    {
        if (!is_callable('smarty_function_script')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.script.php';
        }
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        fn_preload_lang_vars(array('add_post', 'add_post', 'no_data', 'general', 'name', 'your_rating', 'your_message', 'images', 'ls_review_image_label', 'add', 'new_post', 'text_enabled_testimonials_notice'));
        ?>
<style>
    .ls_review_image_container, .ls_review_image_container2 {
        position: relative;
        text-align: center;
        width: 150px;
    }
    .ls_review_image_container > input, .ls_review_image_container2 > input {
        cursor: pointer;
        height: 100%;
        left: 0;
        opacity: 0;
        position: absolute;
        top: 0px;
    }
    .ls_review_image_container:hover .ls_upload_label, .ls_review_image_container2:hover .ls_upload_label2 {
        display: block;
    }

</style>

<?php 
        if ($_smarty_tpl->tpl_vars['discussion']->value && !$_smarty_tpl->tpl_vars['discussion']->value['is_empty']) {
            ?>

<?php 
            $_smarty_tpl->tpl_vars['allow_save'] = new Smarty_variable(false, null, 0);
            ?>

<?php 
            if (($_smarty_tpl->tpl_vars['discussion']->value['object_type'] != "M" || !$_smarty_tpl->tpl_vars['runtime']->value['company_id']) && fn_check_view_permissions("discussion.update")) {
                $_smarty_tpl->tpl_vars['allow_save'] = new Smarty_variable(true, null, 0);
            }
            ?>
<div class="<?php 
            if ($_smarty_tpl->tpl_vars['allow_save']->value) {
                ?>
cm-no-hide-input<?php 
            } else {
                ?>
cm-hide-inputs<?php 
            }
            ?>
" id="content_discussion">
<div class="clearfix">
    <div class="buttons-container buttons-bg pull-right">
    <?php 
            if ($_smarty_tpl->tpl_vars['allow_save']->value) {
                ?>
            <?php 
                if (fn_check_view_permissions("discussion_manager")) {
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] == "E") {
                        ?>
                    <?php 
                        $_smarty_tpl->_capture_stack[0][] = array("adv_buttons", null, null);
                        ob_start();
                        ?>
                        <?php 
                        echo $_smarty_tpl->getSubTemplate("common/popupbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "add_new_post", 'title' => __("add_post"), 'icon' => "icon-plus", 'act' => "general", 'link_class' => "cm-dialog-switch-avail"), 0);
                        ?>

                    <?php 
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
                <?php 
                    } else {
                        ?>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("common/popupbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "add_new_post", 'link_text' => __("add_post"), 'act' => "general", 'link_class' => "cm-dialog-switch-avail"), 0);
                        ?>

                <?php 
                    }
                    ?>
            <?php 
                }
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['discussion']->value['posts']) {
                    ?>
                <?php 
                    $_smarty_tpl->tpl_vars['show_save_btn'] = new Smarty_variable(true, null, 2);
                    $_ptr = $_smarty_tpl->parent;
                    while ($_ptr != null) {
                        $_ptr->tpl_vars['show_save_btn'] = clone $_smarty_tpl->tpl_vars['show_save_btn'];
                        $_ptr = $_ptr->parent;
                    }
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] == "E") {
                        ?>
                    <?php 
                        $_smarty_tpl->_capture_stack[0][] = array("buttons_insert", null, null);
                        ob_start();
                        ?>
                <?php 
                    }
                    ?>
                <?php 
                    if (fn_check_view_permissions("discussion.m_delete")) {
                        ?>
                    <?php 
                        $_smarty_tpl->_capture_stack[0][] = array("tools_list", null, null);
                        ob_start();
                        ?>
                        <li><?php 
                        smarty_template_function_btn($_smarty_tpl, array('type' => "delete_selected", 'dispatch' => "dispatch[discussion.m_delete]", 'form' => "update_posts_form"));
                        ?>
</li>
                    <?php 
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
                    <?php 
                        smarty_template_function_dropdown($_smarty_tpl, array('content' => Smarty::$_smarty_vars['capture']['tools_list']));
                        ?>

                <?php 
                    }
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] == "E") {
                        ?>
                    <?php 
                        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                        if (!empty($_capture_buffer)) {
                            if (isset($_capture_assign)) {
                                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                            }
                            if (isset($_capture_append)) {
                                $_smarty_tpl->append($_capture_append, ob_get_contents());
                            }
                            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                        } else {
                            $_smarty_tpl->capture_error();
                        }
                        ?>
                <?php 
                    }
                    ?>
            <?php 
                }
                ?>
    <?php 
            }
            ?>
    </div>
</div><br>


<?php 
            if ($_smarty_tpl->tpl_vars['discussion']->value['posts']) {
                ?>

<?php 
                echo smarty_function_script(array('src' => "js/addons/discussion/discussion.js"), $_smarty_tpl);
                ?>


<?php 
                echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('save_current_page' => true, 'id' => "pagination_discussion", 'search' => $_smarty_tpl->tpl_vars['discussion']->value['search']), 0);
                ?>


<div class="posts-container">

<?php 
                $_smarty_tpl->tpl_vars["post"] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars["post"]->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['discussion']->value['posts'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars["post"]->key => $_smarty_tpl->tpl_vars["post"]->value) {
                    $_smarty_tpl->tpl_vars["post"]->_loop = true;
                    ?>
<div class="post-item <?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] == "O") {
                        if ($_smarty_tpl->tpl_vars['post']->value['user_id'] == $_smarty_tpl->tpl_vars['user_id']->value) {
                            ?>
incoming<?php 
                        } else {
                            ?>
outgoing<?php 
                        }
                    }
                    ?>
">
    <?php 
                    $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "discussion:items_list_row"));
                    $_block_repeat = true;
                    echo smarty_block_hook(array('name' => "discussion:items_list_row"), null, $_smarty_tpl, $_block_repeat);
                    while ($_block_repeat) {
                        ob_start();
                        ?>

		<?php 
                        echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/review_attributes/components/post.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('post' => $_smarty_tpl->tpl_vars['post']->value, 'type' => $_smarty_tpl->tpl_vars['discussion']->value['type']), 0);
                        ?>

    <?php 
                        $_block_content = ob_get_clean();
                        $_block_repeat = false;
                        echo smarty_block_hook(array('name' => "discussion:items_list_row"), $_block_content, $_smarty_tpl, $_block_repeat);
                    }
                    array_pop($_smarty_tpl->smarty->_tag_stack);
                    ?>

</div>
<?php 
                }
                ?>
</div>
<?php 
                echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "pagination_discussion", 'search' => $_smarty_tpl->tpl_vars['discussion']->value['search']), 0);
                ?>


<?php 
            } else {
                ?>
    <p class="no-items"><?php 
                echo $_smarty_tpl->__("no_data");
                ?>
</p>
<?php 
            }
            ?>

<?php 
            if (fn_check_view_permissions("discussion_manager")) {
                ?>
    <?php 
                $_smarty_tpl->_capture_stack[0][] = array("add_new_picker", null, null);
                ob_start();
                ?>
    <div class="tabs cm-j-tabs">
        <ul class="nav nav-tabs">
            <li id="tab_add_post" class="cm-js cm-active active"><a><?php 
                echo $_smarty_tpl->__("general");
                ?>
</a></li>
        </ul>
    </div>

    <div class="cm-tabs-content" id="content_tab_add_post">
    <input type ="hidden" name="post_data[thread_id]" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['discussion']->value['thread_id'], ENT_QUOTES, 'UTF-8');
                ?>
" />
    <input type ="hidden" name="redirect_url" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['config']->value['current_url'], ENT_QUOTES, 'UTF-8');
                ?>
&amp;selected_section=discussion" />

    <div class="control-group">
        <label for="post_data_name" class="cm-required control-label"><?php 
                echo $_smarty_tpl->__("name");
                ?>
:</label>
        <div class="controls">
            <input type="text" name="post_data[name]" id="post_data_name" value="<?php 
                if ($_smarty_tpl->tpl_vars['auth']->value['user_id']) {
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['user_info']->value['firstname'], ENT_QUOTES, 'UTF-8');
                    ?>
 <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['user_info']->value['lastname'], ENT_QUOTES, 'UTF-8');
                }
                ?>
" disabled="disabled">
        </div>
    </div>

	<div class="control-group">
        <label for="post_data_message_title" class="control-label"><?php 
                echo $_smarty_tpl->__('subject');
                ?>
:</label>
        <div class="controls">
            <input type="text" name="post_data[message_title]" id="post_data_message_title" disabled="disabled">
        </div>
    </div>
	
	<?php 
                $_smarty_tpl->tpl_vars["attributes"] = new Smarty_variable(fn_get_review_attributes_work($_smarty_tpl->tpl_vars['product_data']->value['product_id']), null, 0);
                ?>

    <?php 
                if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "R" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B") {
                    ?>
    <div class="control-group">
        <label for="rating_value" class="control-label cm-required cm-multiple-radios"><?php 
                    echo $_smarty_tpl->__("your_rating");
                    ?>
</label>
        <div class="controls clearfix">
			<?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['object_type'] != 'P' || !$_smarty_tpl->tpl_vars['attributes']->value) {
                        ?>
	            <?php 
                        echo $_smarty_tpl->getSubTemplate("addons/discussion/views/discussion_manager/components/rate.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('rate_id' => "rating_value", 'rate_name' => "post_data[rating_value]", 'disabled' => true), 0);
                        ?>

				<?php 
                    } elseif ($_smarty_tpl->tpl_vars['attributes']->value) {
                        ?>
                    
                    <?php 
                        $_smarty_tpl->tpl_vars["addon_images_path"] = new Smarty_variable((string) $_smarty_tpl->tpl_vars['images_dir']->value . "/addons/altteam_review_attributes/images/", null, 0);
                        ?>

					<table cellpadding="0" cellspacing="0" class="rating-table">
						<tr>
							<th>&nbsp;</th>
							<th><img src="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['addon_images_path']->value, ENT_QUOTES, 'UTF-8');
                        ?>
star_mini_full.png" /></th>
							<th><img src="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['addon_images_path']->value, ENT_QUOTES, 'UTF-8');
                        ?>
star_mini_full.png" /></th>
							<th><img src="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['addon_images_path']->value, ENT_QUOTES, 'UTF-8');
                        ?>
star_mini_full.png" /></th>
							<th><img src="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['addon_images_path']->value, ENT_QUOTES, 'UTF-8');
                        ?>
star_mini_full.png" /></th>
							<th><img src="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['addon_images_path']->value, ENT_QUOTES, 'UTF-8');
                        ?>
star_mini_full.png" /></th>
							<th>&nbsp;</th>
						</tr>
						<?php 
                        $_smarty_tpl->tpl_vars["attribute"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["attribute"]->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['attributes']->value;
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        $_smarty_tpl->tpl_vars['smarty']->value['foreach']["attr"]['iteration'] = 0;
                        foreach ($_from as $_smarty_tpl->tpl_vars["attribute"]->key => $_smarty_tpl->tpl_vars["attribute"]->value) {
                            $_smarty_tpl->tpl_vars["attribute"]->_loop = true;
                            $_smarty_tpl->tpl_vars['smarty']->value['foreach']["attr"]['iteration']++;
                            ?>
						<tr>
							<td class="right gray-line"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_name'], ENT_QUOTES, 'UTF-8');
                            ?>
&nbsp;=&nbsp;</td>
							<td class="valign"><input type="radio" name="post_data[attributes][<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], ENT_QUOTES, 'UTF-8');
                            ?>
]" value="1" /></td>
							<td class="valign"><input type="radio" name="post_data[attributes][<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], ENT_QUOTES, 'UTF-8');
                            ?>
]" value="2" /></td>
							<td class="valign"><input type="radio" name="post_data[attributes][<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], ENT_QUOTES, 'UTF-8');
                            ?>
]" value="3" /></td>
							<td class="valign"><input type="radio" name="post_data[attributes][<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], ENT_QUOTES, 'UTF-8');
                            ?>
]" value="4" /></td>
							<td class="valign"><input type="radio" name="post_data[attributes][<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['attribute']->value['attr_id'], ENT_QUOTES, 'UTF-8');
                            ?>
]" value="5" checked="checked" /></td>
							<td class="attr_val gray-line"> (<span id="value_attr_row_<?php 
                            echo htmlspecialchars($_smarty_tpl->getVariable('smarty')->value['foreach']['attr']['iteration'], ENT_QUOTES, 'UTF-8');
                            ?>
">5</span> <?php 
                            echo $_smarty_tpl->__('stars');
                            ?>
)</td>
						</tr>
						<?php 
                        }
                        ?>
					</table>

				<?php 
                    } else {
                        ?>
				<?php 
                    }
                    ?>
        </div>
    </div>
    <?php 
                }
                ?>
    
    <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "discussion:add_post"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "discussion:add_post"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    ?>

    <?php 
                    if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "C" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "R") {
                        ?>
    <div class="control-group">
        <label for="message" class="control-label"><?php 
                        echo $_smarty_tpl->__("your_message");
                        ?>
:</label>
        <div class="controls">
            <textarea name="post_data[message]" id="message" class="input-textarea-long" cols="70" rows="8" disabled="disabled"></textarea>
        </div>
    </div>
    <?php 
                    }
                    ?>
    <?php 
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "discussion:add_post"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

    <?php 
                if ($_smarty_tpl->tpl_vars['discussion']->value['type'] == "C" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "B" || $_smarty_tpl->tpl_vars['discussion']->value['type'] == "R") {
                    ?>
    
    <div class="control-group ty-control-group">
	<label class="control-label"><?php 
                    echo $_smarty_tpl->__('age_group');
                    ?>
:</label>
        <select id="review_user_age_group" name="post_data[user_age]">
            <option value='1'><?php 
                    echo $_smarty_tpl->__('24&under');
                    ?>
</option>
            <option value='2'><?php 
                    echo $_smarty_tpl->__('between25and34');
                    ?>
</option>
            <option value='3'><?php 
                    echo $_smarty_tpl->__('between35and44');
                    ?>
</option>
            <option value='4'><?php 
                    echo $_smarty_tpl->__('between45and54');
                    ?>
</option>
            <option value='5'><?php 
                    echo $_smarty_tpl->__('between55and64');
                    ?>
</option>
            <option value='6'><?php 
                    echo $_smarty_tpl->__('65andafter');
                    ?>
</option>
        </select>
    </div>
    
    <div class="control-group ty-control-group">
        <label class="control-label"><?php 
                    echo $_smarty_tpl->__("images");
                    ?>
:</label>
        <div class="controls">
            <div class="ls_review_image_container <?php 
                    if (!$_smarty_tpl->tpl_vars['discussion']->value['post_data']['image1']) {
                        ?>
no-image<?php 
                    }
                    ?>
"> 
                <img id="ls_uploadPreview" src="/images/review_img/review_no_image.jpg" />
                <label class="ls_upload_label"><?php 
                    echo $_smarty_tpl->__("ls_review_image_label");
                    ?>
</label>
                <input id="ls_uploadImage" type="file" name="post_data[image1]" /> 
            </div>
            
        </div>
    </div>
    
    </div>
    <?php 
                }
                ?>
    <div class="buttons-container">
        <?php 
                echo $_smarty_tpl->getSubTemplate("buttons/save_cancel.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("add"), 'but_name' => "dispatch[discussion.add_extended]", 'cancel_action' => "close", 'hide_first_button' => false), 0);
                ?>

    </div>
    <?php 
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
                ?>
    <?php 
                echo $_smarty_tpl->getSubTemplate("common/popupbox.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('id' => "add_new_post", 'text' => __("new_post"), 'content' => Smarty::$_smarty_vars['capture']['add_new_picker'], 'act' => "fake"), 0);
                ?>

<?php 
            }
            ?>

</div>

<?php 
        } elseif ($_smarty_tpl->tpl_vars['discussion']->value['is_empty']) {
            ?>

<?php 
            echo $_smarty_tpl->__("text_enabled_testimonials_notice", array("[link]" => fn_url("addons.manage#groupdiscussion")));
            ?>


<?php 
        }
        ?>

    
    <script type="text/javascript">
	
	//$(document).ready(function(){
            function ls_PreviewImage(file_field_id, file_field_preview_id) {

                var oFReader = new FileReader();
                //oFReader.readAsDataURL(document.getElementById("ls_uploadImage").files[0]);
                oFReader.readAsDataURL(document.getElementById(file_field_id).files[0]);
                oFReader.onload = function (oFREvent) {
                    //document.getElementById("ls_uploadPreview").src = oFREvent.target.result;
                    document.getElementById(file_field_preview_id).src = oFREvent.target.result;
                };
            }
            
	//});
            $(document).on("change", "#ls_uploadImage", function () {
                var file = this.files[0];
                if (file.size > 2 * 1024 * 1024) {
                 //Too large Image. Only image smaller than 2MB can be uploaded.");
                  if ($('#ls_frontend_language').text() == 'ro') {
                      var limit_warning="Dimensiunea imaginii trebuie sa fie sub 2MB";
                    } else {
                      var limit_warning="Too large Image. Only image smaller than 2MB can be uploaded.";
                    }
                    if (!$('.ls_warning_limit_image').length) {
                        var objectToAppend = $('.ls_user_image_container');
                        if($('.ls_review_image_container').length>0){

                            objectToAppend = $('.ls_review_image_container');
                        }

                        objectToAppend.append('<div class="ls_warning_limit_image">' + limit_warning + '</div>');
                        setTimeout(function(){ 
                            $('div.ls_warning_limit_image').remove(); }, 3000); 
                    }
                } else {
                    //do the image preview
                //    console.log('file size ok');
                    ls_PreviewImage('ls_uploadImage', 'ls_uploadPreview');
                    if($('.ls_review_image_container').length>0){
                        var label_text = $('label.ls_upload_label').html();
                        var newUploadTagHtml = '<div class="ls_review_image_container2 no-image"><img id="ls_uploadPreview2" src="/images/review_img/review_no_image.jpg" /><label class="ls_upload_label">'+label_text+'</label><input id="ls_uploadImage2" type="file" name="post_data[image2]" /></div>';
                        $('.ls_review_image_container').parent().append(newUploadTagHtml);
                    }
                }        
            });

            $(document).on("change", "#ls_uploadImage2", function () {
                var file = this.files[0];
                if (file.size > 2 * 1024 * 1024) {
                 //Too large Image. Only image smaller than 2MB can be uploaded.");
                  if ($('#ls_frontend_language').text() == 'ro') {
                      var limit_warning="Dimensiunea imaginii trebuie sa fie sub 2MB";
                    } else {
                      var limit_warning="Too large Image. Only image smaller than 2MB can be uploaded.";
                    }
                    if (!$('.ls_warning_limit_image2').length) {
                        var objectToAppend = $('.ls_user_image_container');
                        if($('.ls_review_image_container2').length>0){

                            objectToAppend = $('.ls_review_image_container2');
                        }

                        objectToAppend.append('<div class="ls_warning_limit_image2">' + limit_warning + '</div>');
                        setTimeout(function(){ 
                            $('div.ls_warning_limit_image2').remove(); }, 3000); 
                    }
                } else {
                    //do the image preview
                //    console.log('file size ok');
                    ls_PreviewImage('ls_uploadImage2', 'ls_uploadPreview2');
                }        
            });
	
</script><?php 
    }
    return array(CONTROLLER_STATUS_REDIRECT, 'review_attributes' . $suffix);
}
if ($mode == 'manage') {
    // 	if (!defined('REVIEW_ATTRIBUTES_VERSION') || REVIEW_ATTRIBUTES_VERSION != Registry::get('settings.review_attributes_version')) {
    // 		$menu['upgrade'] = array (
    // 			'title' => __('upgrade'),
    // 			'href' => INDEX_SCRIPT . '?dispatch=review_attributes.upgrade',
    // 		);
    // 		Registry::set('navigation.dynamic.sections', $menu);
    // 		Registry::set('navigation.dynamic.active_section', $mode);
    // 	}
    $review_attributes = fn_get_review_attributes();
    Registry::get('view')->assign('review_attributes', $review_attributes);
} elseif ($mode == 'apply') {
    //[Ruslan]
    $review_attributes = fn_get_review_attributes_work();
    // 	$products = db_get_fields('SELECT DISTINCT object_id FROM ?:review_attributes_links');
    //
    // 	foreach ($products as $k => $prod_id) {
    // 		$prod_list[$k]['product_id'] = $prod_id;
    // 		$prod_list[$k]['attr_ids'] = db_get_fields('SELECT attr_id FROM ?:review_attributes_links WHERE object_id = ?i', $prod_id);
    // 	}
    Registry::get('view')->assign('review_attributes', $review_attributes);
    //[/Ruslan]
} elseif ($mode == 'upgrade') {
    $addon = 'altteam_review_attributes';
    $rewrite_opts = array();
    $xml = simplexml_load_file(Registry::get('config.dir.addons') . $addon . '/addon.xml');
    if (isset($xml->opt_settings)) {
        $options = db_get_field("SELECT options FROM ?:addons WHERE addon = ?s", $addon);
        $options = fn_parse_addon_options($options);
    function content_55cdb2acc11bd7_65040675($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_modifier_date_format')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/modifier.date_format.php';
        }
        fn_preload_lang_vars(array('approved', 'disapprove', 'not_approved', 'approve', 'approved', 'not_approved', 'delete', 'ip_address'));
        $_smarty_tpl->tpl_vars["current_redirect_url"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['config']->value['current_url']), null, 0);
        if ($_smarty_tpl->tpl_vars['_REQUEST']->value['dispatch'] == 'products.update') {
            ?>
	<?php 
            $_smarty_tpl->tpl_vars["post"] = new Smarty_variable(fn_get_post_attributes(fn_get_post_title($_smarty_tpl->tpl_vars['post']->value), $_smarty_tpl->tpl_vars['_REQUEST']->value['product_id']), null, 0);
            ?>
	<?php 
            $_smarty_tpl->tpl_vars["attributes"] = new Smarty_variable(fn_get_review_attributes_work($_smarty_tpl->tpl_vars['_REQUEST']->value['product_id']), null, 0);
        }
        ?>
<div class="summary">
    <input type="text" name="posts[<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
        ?>
][name]" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['name'], ENT_QUOTES, 'UTF-8');
        ?>
" size="40" class="input-hidden">
	<input type="text" name="posts[<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
        ?>
][message_title]" class="input-hidden" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['message_title'], ENT_QUOTES, 'UTF-8');
        ?>
" />
    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "discussion:update_post"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "discussion:update_post"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

        <?php 
            if ($_smarty_tpl->tpl_vars['type']->value == "C" || $_smarty_tpl->tpl_vars['type']->value == "B" || $_smarty_tpl->tpl_vars['type']->value == "R") {
                ?>
            <textarea name="posts[<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
                ?>
][message]" cols="80" rows="5" class="input-hidden"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['message'], ENT_QUOTES, 'UTF-8');
                ?>
</textarea>
        <?php 
            }
            ?>
    <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "discussion:update_post"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

</div>
<div class="tools">
    <div class="pull-left">
        <?php 
        if (fn_check_view_permissions("discussion.m_delete")) {
            ?>
            <input type="checkbox" name="delete_posts[<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
            ?>
]" id="delete_checkbox_<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
            ?>
"  class="pull-left cm-item" value="Y">
        <?php 
        }
        ?>
        <div class="hidden-tools pull-left cm-statuses">
            <?php 
        if (fn_check_view_permissions("discussion.update")) {
            ?>
                <span class="cm-status-a <?php 
            if ($_smarty_tpl->tpl_vars['post']->value['status'] == "D") {
                ?>
hidden<?php 
            }
            ?>
">
                    <span class="label label-success"><?php 
            echo $_smarty_tpl->__("approved");
            ?>
</span>
                    <a class="cm-status-switch icon-thumbs-down cm-tooltip" title="<?php 
            echo $_smarty_tpl->__("disapprove");
            ?>
" data-ca-status="D" data-ca-post-id="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
            ?>
"></a>
                </span>
                <span class="cm-status-d <?php 
            if ($_smarty_tpl->tpl_vars['post']->value['status'] == "A") {
                ?>
hidden<?php 
            }
            ?>
">
                    <span class="label label-important"><?php 
            echo $_smarty_tpl->__("not_approved");
            ?>
</span>
                    <a class="cm-status-switch icon-thumbs-up cm-tooltip" title="<?php 
            echo $_smarty_tpl->__("approve");
            ?>
" data-ca-status="A" data-ca-post-id="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['post_id'], ENT_QUOTES, 'UTF-8');
            ?>
"></a>
                </span>
            <?php 
        } else {
            ?>
                <span class="cm-status-<?php 
            echo htmlspecialchars(mb_strtolower($_smarty_tpl->tpl_vars['post']->value['status'], 'UTF-8'), ENT_QUOTES, 'UTF-8');
            ?>
">
                    <?php 
            if ($_smarty_tpl->tpl_vars['post']->value['status'] == "A") {
                ?>
                        <span class="label label-success"><?php 
                echo $_smarty_tpl->__("approved");
                ?>
</span>
                    <?php 
            } else {
                ?>
                        <span class="label label-important"><?php 
                echo $_smarty_tpl->__("not_approved");
                ?>
</span>
                    <?php 
            }
            ?>
                </span>
            <?php 
        }
        ?>
            <?php 
        if (fn_check_view_permissions("discussion.delete")) {
            ?>
                <a class="icon-trash cm-tooltip cm-confirm" href="<?php 
            echo htmlspecialchars(fn_url("discussion.delete?post_id=" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id'] . "&redirect_url=" . (string) $_smarty_tpl->tpl_vars['current_redirect_url']->value), ENT_QUOTES, 'UTF-8');
            ?>
" title="<?php 
            echo $_smarty_tpl->__("delete");
            ?>
"></a>
            <?php 
        }
        ?>
        </div>
    </div>


    <div class="pull-right">
        <span class="muted"><?php 
        echo htmlspecialchars(smarty_modifier_date_format($_smarty_tpl->tpl_vars['post']->value['timestamp'], (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['date_format'] . ", " . (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['time_format']), ENT_QUOTES, 'UTF-8');
        ?>
 / <?php 
        echo $_smarty_tpl->__("ip_address");
        ?>
:&nbsp;<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['ip_address'], ENT_QUOTES, 'UTF-8');
        ?>
</span>

        <?php 
        if ($_smarty_tpl->tpl_vars['type']->value == "R" || $_smarty_tpl->tpl_vars['type']->value == "B") {
            ?>
			<?php 
            echo $_smarty_tpl->getSubTemplate("addons/altteam_review_attributes/views/review_attributes/components/rate.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('rate_id' => "rating_" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id'], 'rate_value' => $_smarty_tpl->tpl_vars['post']->value['rating_value'], 'rate_name' => "posts[" . (string) $_smarty_tpl->tpl_vars['post']->value['post_id'] . "][rating_value]"), 0);
            ?>


        <?php 
        }
        ?>
    </div>

    <?php 
        if ($_smarty_tpl->tpl_vars['show_object_link']->value) {
            ?>
        <a href="<?php 
            echo htmlspecialchars(fn_url($_smarty_tpl->tpl_vars['post']->value['object_data']['url']), ENT_QUOTES, 'UTF-8');
            ?>
" class="post-object" title="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['object_data']['description'], ENT_QUOTES, 'UTF-8');
            ?>
"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['post']->value['object_data']['description'], ENT_QUOTES, 'UTF-8');
            ?>
</a>
    <?php 
        }
        ?>
</div>
<?php 
    }