{{* funkcja przed usunięciem spacji *
{{function page_tree aPageTree=$aProduct.aPagesTree bCaption=true bMenu=true}}
	{{if $bMenu && isset($aPageTree.sMenu)}}
		{{$aPageTree.sMenu}}
		{{if $bCaption || count( $aPagesTree.aPath ) > 0}}
			&nbsp;&raquo;&nbsp;
		{{/if}}
	{{/if}}
	{{foreach from=$aPageTree.aPath item=aPage}}
		<span><a href="{{$aPage.sLinkName}}">{{$aPage.sName}}</a></span>
		{{if !$aPage@last || $bCaption}}
			&nbsp;&raquo;&nbsp;
		{{/if}}
	{{/foreach}}
	{{if $bCaption}}
		{{$aPageTree.aCurrent.sName}}
	{{/if}}
{{/function}}
*                                    *}}
{{function page_tree aPageTree=$aProduct.aPagesTree bCaption=true bMenu=true}}{{if $bMenu && isset($aPageTree.sMenu)}}{{$aPageTree.sMenu}}{{if $bCaption || count( $aPagesTree.aPath ) > 0}}&nbsp;&raquo;&nbsp;{{/if}}{{/if}}{{foreach from=$aPageTree.aPath item=aPage}}<span><a href="{{$aPage.sLinkName}}">{{$aPage.sName}}</a></span>{{if !$aPage@last || $bCaption}}&nbsp;&raquo;&nbsp;{{/if}}{{/foreach}}{{if $bCaption}}{{$aPageTree.aCurrent.sName}}{{/if}}{{/function}}

{{function name="selectOptions" aOptions=0 mOption=0}}
	{{foreach from=$aOptions item=sOption}}
		<option value="{{$sOption@key}}" {{if $sOption@key == $mOption}}selected="selected"{{/if}}>{{$sOption}}</option>
	{{/foreach}}
{{/function}}

{{function name="yesNoTxt" bOption='0'}}
	{{if $bOption == 1}}
		{{$lang.yes}}
	{{else}}
		{{$lang.no}}
	{{/if}}
{{/function}}

{{function name="countPages" iPages=1 iPageNumber=1 sUrl="" sUrl2="" iCounter=$config.pagination_counter bForum=false}}
	{{if $iPages > 1}}
		{{if empty( $iCounter )}}{{$iCounter = $config.pagination_counter}}{{/if}}
		{{if $iPageNumber > 1}}
			{{capture prev assign=prevPage}}{{$sUrl}}{{if !$bForum}}{{if $iPageNumber > 2}},{{$iPageNumber - 1}}{{/if}}.html{{if !empty( $sUrl2 ) && substr( $sUrl2, 0, 1 ) != '?'}}?{{/if}}{{else}}{{$iPageNumber - 1}}{{/if}}{{$sUrl2}}{{/capture}}
			<a title="{{$iPageNumber - 1}}" href="{{$sUrl}}{{if !$bForum}}{{if $iPageNumber > 2}},{{$iPageNumber - 1}}{{/if}}.html{{if !empty( $sUrl2 ) && substr( $sUrl2, 0, 1 ) != '?'}}?{{/if}}{{else}}{{$iPageNumber - 1}}{{/if}}{{$sUrl2}}" class="prev">&laquo;</a>
		{{/if}}
		{{$iPaginationSpacer = false}}
		{{section name=pages start=1 loop=$iPages+1 step=1}}
			{{if $smarty.section.pages.index != $iPageNumber && (abs($smarty.section.pages.index - $iPageNumber) <= $iCounter || $smarty.section.pages.index <= $iCounter || $smarty.section.pages.index >=  + $iPages - $iCounter + 1)}}
				<a title="{{$smarty.section.pages.index}}" href="{{$sUrl}}{{if !$bForum}}{{if $smarty.section.pages.index > 1}},{{$smarty.section.pages.index}}{{/if}}.html{{if !empty( $sUrl2 ) && substr( $sUrl2, 0, 1 ) != '?'}}?{{/if}}{{else}}{{$smarty.section.pages.index}}{{/if}}{{$sUrl2}}">{{$smarty.section.pages.index}}</a>
			{{$iPaginationSpacer = false}}
			{{elseif $smarty.section.pages.index == $iPageNumber}}
				<strong>{{$smarty.section.pages.index}}</strong>
			{{else}}
				{{if $iPaginationSpacer === false}}
				<strong>...</strong>
				{{$iPaginationSpacer = true}}
				{{/if}}
			{{/if}}
		{{/section}}
		{{if $iPageNumber < $iPages}}
			{{capture next assign=nextPage}}{{$sUrl}}{{if !$bForum}},{{$iPageNumber + 1}}.html{{if !empty( $sUrl2 ) && substr( $sUrl2, 0, 1 ) != '?'}}?{{/if}}{{else}}{{$iPageNumber + 1}}{{/if}}{{$sUrl2}}{{/capture}}
			<a title="{{$iPageNumber + 1}}" href="{{$sUrl}}{{if !$bForum}},{{$iPageNumber + 1}}.html{{if !empty( $sUrl2 ) && substr( $sUrl2, 0, 1 ) != '?'}}?{{/if}}{{else}}{{$iPageNumber + 1}}{{/if}}{{$sUrl2}}" class="next">&raquo;</a>
		{{/if}}
	{{/if}}
{{/function}}

{{function name="sitemap_products" aProducts=0}}
<ul class="products">
	{{foreach from=$aProducts item=aListProduct}}
		<li><a href="{{$aListProduct.sLinkName}}" title="{{$aListProduct.sName}}">{{$aListProduct.sName}}</a></li>
	{{/foreach}}
</ul>
{{/function}}

{{function name="sitemap_sub" aSubPages=0 iDepth=0}}
<ul class="sub{{$iDepth}}">
	{{foreach from=$aSubPages item=aSubPage}}
	<li><a href="{{$aSubPage.sLinkName}}" title="{{$aSubPage.sName}}">{{$aSubPage.sName}}</a>
		{{if is_array( $aSubPage.aSubPages )}}
			{{sitemap_sub aSubPages=$aSubPage.aSubPages iDepth=$iDepth+1}}
		{{/if}}
		{{if is_array( $aSubPage.aProducts )}}
			{{sitemap_products aProducts=$aSubPage.aProducts}}
		{{/if}}
	</li>
	{{/foreach}}
</ul>
{{/function}}

<div id="page" class="page_id_{{$aPage.iPage}}">

	<h1 {{if $aPage.iStatus == 0}}class="admin"{{/if}}>
		{{if $smarty.session.bSellSmartUser}}
			<a class="page-edit" href="admin.php?p=p-form&amp;iPage={{$aPage.iPage}}" target="_blank"><img title="{{$lang.Edit}}" alt="{{$lang.Edit}}" src="{{$config.dir_templates}}admin/images/ico/edit.png" /></a>
		{{/if}}
		{{if !empty( $aPage.sDisplayTitle )}}
			{{str_replace( '&amp;', '&', $aPage.sDisplayTitle )}}
		{{else}}
			{{str_replace( '&amp;', '&', $aPage.sName )}}
		{{/if}}
	</h1>
	<div id="breadcrumb">{{$lang.You_are_in}}:&nbsp;{{page_tree aPageTree=$aPage.aPagesTree bCaption=1 bMenu=1}}</div>

	{{if is_array( $aMessage )}}
		<div class="cb_message">
			<h1>{{$aMessage.header}}</h1>
			{{$aMessage.content}}
		</div>
	{{elseif is_array($aOrderErrors.0) || is_array($aOrderErrors.1) || is_array($aBasketErrors)}}
		<div class="cb_message">
			<h1>{{$lang.BasketErrorHeader}}</h1>
			{{foreach from=$aOrderErrors.0 item=sOrderError}}
				<div class="message" id="order_error">{{$sOrderError}}</div>
			{{/foreach}}
			{{foreach from=$aOrderErrors.1 item=sOrderError}}
				<div class="message" id="order_warning">{{$sOrderError}}</div>
			{{/foreach}}
			{{foreach from=$aBasketErrors item=sOrderError}}
				<div class="message" id="basket_error">{{$sOrderError}}</div>
			{{/foreach}}
		</div>
	{{elseif isset( $aPage.bEmailSend )}}
		<div class="cb_message">
			<h1>{{$lang.Email}}</h1>
			{{if $aPage.bEmailSend}}
				<p class="message">
					{{$lang.Mail_send_correct}}
				</p>
			{{else}}
				<p class="message error">
					{{$lang.Mail_send_error}}
				</p>
			{{/if}}
		</div>
	{{/if}}

	{{if $aPage.iPage == $config.page_search}}
		<script type="text/javascript">
			$(document).ready(function(){
				$('#search_advanced_slide').click(function(e){
					e.preventDefault();
					$('#search-page-form .adv').toggle();
					ElementQueries.update();
				});
				$('#search-page-form .adv').hide();
			});
		</script>
		<form action="{{$aPage.sLinkName}}" method="post" id="search-page-form" class="box-rounded form-styled">
			<div class="phrase"><label for="search-sPhrase">{{$lang.Search_phrase}}</label> <input type="text" name="sPhrase" value="{{$aPage.aSearchData.sPhrase}}" id="search-sPhrase" class="input" /></div>
			{{if !$config.prices_off}}
				<div class="price-from"><label for="search-sPriceFrom">{{$lang.price_from}}</label> <input type="text" name="sPriceFrom" value="{{$aPage.aSearchData.sPriceFrom}}" id="search-sPriceFrom" class="input" /></div>
				<div class="price-to"><label for="search-sPriceTo">{{$lang.price_to_to}}</label> <input type="text" name="sPriceTo" value="{{$aPage.aSearchData.sPriceTo}}" id="search-sPriceTo" class="input" /></div>
			{{/if}}
			{{if $config.search_products_description}}
				<div class="search-full"><input id="search-iFullSearch" type="hidden" name="iFullSearch" value="1" /> <label for="search-iFullSearch">{{$lang.Search_in_full_description}}</label></div>
			{{/if}}
			<div class="producer">
				<label for="search-iProducer">{{$lang.Producer}}</label>
				<select name="iProducer" id="search-iProducer" class="select">
					<option value="">{{$lang.All_producers}}</option>
					{{foreach from=$aPage.aSearchData.aProducers item=aProducer}}
						<option value="{{$aProducer.iProducer}}" {{if $aProducer.iProducer == $aPage.aSearchData.iProducer}}selected="selected"{{/if}}>{{$aProducer.sName}}</option>
					{{/foreach}}
				</select>
			</div>
			<div class="category">
				<label for="search-iCategory">{{$lang.Category}}</label>
				<select name="iCategory" id="search-iCategory">
					<option value="">{{$lang.All_categories}}</option>
			
					{{function name="subcategory_search" aSubcategories=Array() level=1}}
						{{foreach from=$aSubcategories item=aCategory}}
							<option value="{{$aCategory.iPage}}" {{if $aCategory.bSelected}}selected="selected"{{/if}}>{{str_repeat( "&nbsp;&nbsp;", $level )}}{{$aCategory.sName}}</option>
							{{subcategory_search aSubcategories=$aCategory.aSubcategories level=$level+1}}
						{{/foreach}}
					{{/function}}
			
					{{foreach from=$aPage.aSearchData.aSearchCategories item=aCategory}}
						<option value="{{$aCategory.iPage}}" {{if $aCategory.bSelected}}selected="selected"{{/if}}>{{$aCategory.sName}}</option>
						{{subcategory_search aSubcategories=$aCategory.aSubcategories}}
					{{/foreach}}
				</select>
			</div>
			<div class="clear" style="display: block;"></div>
			<a href="#" id="search_advanced_slide" class="submit">{{$lang.Searchengine_full}} &#x25BC;</a>
			<div class="adv">
				<div class="catalog-number"><label for="search-sCatalogNumber">{{$lang.Catalog_num}}</label> <input type="text" name="sCatalogNumber" value="{{$aPage.aSearchData.sCatalogNumber}}" id="search-sCatalogNumber" class="input" /></div>
				<div class="index"><label for="search-sProductIndex">{{$lang.Product_index}}</label> <input type="text" name="sProductIndex" value="{{$aPage.aSearchData.sProductIndex}}" id="search-sProductIndex" class="input" /></div>
				{{if is_array($aPage.aSearchData.aAttributes) && count($aPage.aSearchData.aAttributes) > 0 && $config.show_attributes_in_search}}
					<div class="attributes">
						<h2>{{$lang.Attributes}}</h2>	
						{{foreach from=$aPage.aSearchData.aAttributes item=aAttribute key=iAttribute}}
							<div class="attribute">
								<label for="search-aAttributeValue-{{$iAttribute}}">{{$aAttribute.sName}}</label>
								<select name="aAttributeValue[{{$iAttribute}}]" id="search-aAttributeValue-{{$iAttribute}}">
									<option value="">{{$lang.All}}</option>
									{{foreach from=$aAttribute.aAValues key=iValue item=sValue}}
										<option value="{{$iValue}}" {{if $iValue == $aPage.aSearchData.aSelectedAttributes.$iAttribute}}selected="selected"{{/if}}>{{$sValue}}</option>
									{{/foreach}}
								</select>
							</div>
						{{/foreach}}
					</div>
				{{/if}}
			</div>
			<div class="clear" style="display: block;"></div>
			<input type="submit" value="{{$lang.Search}}" class="submit submit-styled" />
		</form>
	{{/if}}


	{{$cl=true}}
	{{foreach from=$aPage.aBlocks item=aBlock}}
		{{if $aBlock.iWidthType == 100}}
			{{$cl=true}}
		{{else}}
			{{if $cl}}
				<div class="clear"></div>
				{{$cl=false}}
			{{else}}
				{{$cl=true}}
			{{/if}}
		{{/if}}
		<div class="block{{$aBlock.iWidthType}}">
			{{if !empty( $aBlock.sTitle )}}<h2>{{$aBlock.sTitle}}</h2>{{/if}}
			{{if $aBlock.sType == 'TEXT'}}
				<div class="description" {{if !empty( $aBlock.iColumnWidth )}}style="-moz-columns: {{$aBlock.iColumnWidth}}px; -webkit-columns: {{$aBlock.iColumnWidth}}px; columns: {{$aBlock.iColumnWidth}}px;"{{/if}}>{{$aBlock.sText}}</div>
			{{/if}}
			{{if $aBlock.sType == 'FORM'}}
				<script type="text/javascript">
					$(function(){
						$('#form-{{$aBlock.iElement}}').validate();
						{{foreach from=$aBlock.aFormFields item=aField}}
							{{if $aField.iRequired}}$('#form-{{$aBlock.iElement}} #field_{{$aBlock.iElement}}_{{$aField.iFormField}}{{if $aField.sType == 'RADIO' || $aField.sType == 'CHECKBOX'}}_1{{/if}}').rules('add', {required: true});{{/if}}
							{{if $aField.iEmail}}$('#form-{{$aBlock.iElement}} #field_{{$aBlock.iElement}}_{{$aField.iFormField}}').rules('add', {email: true});{{/if}}
						{{/foreach}}
					});
				</script>
				<form action="" method="post" id="form-{{$aBlock.iElement}}" class="custom-form">
					<fieldset>
						<table>
							{{foreach from=$aBlock.aFormFields item=aField}}
								<tr>
									{{if $aField.sType == 'INPUT'}}<th><label for="field_{{$aBlock.iElement}}_{{$aField.iFormField}}">{{$aField.sName}}:</label></th><td><input type="text" name="field_{{$aField.iFormField}}" id="field_{{$aBlock.iElement}}_{{$aField.iFormField}}" /></td>{{/if}}
									{{if $aField.sType == 'TEXT'}}<th><label for="field_{{$aBlock.iElement}}_{{$aField.iFormField}}">{{$aField.sName}}:</label></th><td><textarea name="field_{{$aField.iFormField}}" id="field_{{$aBlock.iElement}}_{{$aField.iFormField}}"></textarea></td>{{/if}}
									{{if $aField.sType == 'SELECT'}}<th><label for="field_{{$aBlock.iElement}}_{{$aField.iFormField}}">{{$aField.sName}}:</label></th><td><select name="field_{{$aField.iFormField}}" id="field_{{$aBlock.iElement}}_{{$aField.iFormField}}">{{selectOptions aOptions=$aField.aValues mOption=-1}}</select></td>{{/if}}
									{{if $aField.sType == 'RADIO'}}<th><label>{{$aField.sName}}:</label></th><td>{{foreach from=$aField.aValues item=sValue}}<label><input type="radio" name="field_{{$aField.iFormField}}" id="field_{{$aBlock.iElement}}_{{$aField.iFormField}}_{{$sValue@iteration}}" value="{{$sValue}}" /> {{$sValue}}</label>{{/foreach}}</td>{{/if}}
									{{if $aField.sType == 'CHECKBOX'}}<th><label>{{$aField.sName}}:</label></th><td>{{foreach from=$aField.aValues item=sValue}}<label><input type="checkbox" name="field_{{$aField.iFormField}}[]" id="field_{{$aBlock.iElement}}_{{$aField.iFormField}}_{{$sValue@iteration}}" value="{{$sValue}}" /> {{$sValue}}</label>{{/foreach}}</td>{{/if}}
								</tr>
							{{/foreach}}
							<tr>
								<td colspan="2" class="buttons">
									<input id="custom-form-{{$aBlock.iElement}}" class="submit styled reCaptcha" type="submit" name="commit_{{$aBlock.iElement}}" value="{{$lang.send}}" />
								</td>
							</tr>
						</table>
					</fieldset>
				</form>
			{{/if}}
			{{if $aBlock.sType == 'GALLERY' || $aBlock.sType == 'FILES' || $aBlock.sType == 'VIDEO' || $aBlock.sType == 'AUDIO'}}
				{{$aBlock.sFiles}}
			{{/if}}
			{{if $aBlock.sType == 'POLL'}}

				<h3>{{$aBlock.aPoll.sQuestion}}</h3>
				{{if !$aBlock.aPoll.bAnswered}}
					<form class="poll_options" action="" method="post">
						<ul>
							{{foreach from=$aBlock.aPoll.aPollAnswers item=aAnswer}}
								<li><label><input type="radio" name="poll_{{$aBlock.iElement}}" value="{{$aAnswer.iAnswerId}}" class="radio" />{{$aAnswer@iteration}}. {{$aAnswer.sText}}</label></li>
							{{/foreach}}
						</ul>
						<input type="submit" class="submit" value="{{$lang.vote}}" />
					</form>
				{{/if}}
				<div style="position: relative; width: 90%; {{*calc(80% - 100px);*}} padding-bottom: 100%{{*calc(80% - 100px)*}}; margin: 20px auto; clear: both;">
					<div style="position: absolute; width: 100%; height: 100%;">
						<canvas id="chart_{{$aBlock.iElement}}" style="width: 100%; height: 100%;"></canvas>
					</div>
				</div>

				<script type="text/javascript">
					$(document).ready(function(){
						{{$aColors = ["rgba(77,83,96,0.5)","rgba(151,187,205,0.5)","rgba(220,220,220,0.5)","rgba(247,70,74,0.5)","rgba(70,191,189,0.5)","rgba(253,180,92,0.5)","rgba(148,159,177,0.5)"]}}
						
						var chart_{{$aBlock.iElement}} = $('#chart_{{$aBlock.iElement}}');
						var oChart_{{$aBlock.iElement}} = new Chart(chart_{{$aBlock.iElement}}, {
							type: 'pie',
							data: {
								labels: [{{foreach from=$aBlock.aPoll.aPollAnswers item=aAnswer}}"{{$aAnswer.sText}}"{{if !$aAnswer@last}},{{/if}}{{/foreach}}],
								datasets: [{
									data: [
										{{foreach from=$aBlock.aPoll.aPollAnswers item=aAnswer}}"{{$aAnswer.iVotes}}"{{if !$aAnswer@last}},{{/if}}{{/foreach}}
									],
									backgroundColor: [
										{{foreach from=$aBlock.aPoll.aPollAnswers item=aAnswer}}"{{$aColors[$aAnswer@iteration % count($aColors)]}}"{{if !$aAnswer@last}},{{/if}}{{/foreach}}
									]
								}]
							},
							options: {
								legend: {
									display: false
								}
							}
						});
					});
				</script>
			{{elseif $aBlock.sType == 'SUBPAGES' || $aBlock.sType == 'EXT_SUBPAGES'}}
				{{if $aBlock.aSubpages.bDetailsDisplay}}
					{{* Widok szczegółowy *}}
					{{foreach from=$aBlock.aSubpages.aList item=aSubpage}}
						<article class="subpage column{{$aBlock.aSubpages.iColumncount}} {{if ($aSubpage@iteration - 1) % $aBlock.aSubpages.iColumncount == 0}}clear{{/if}} {{if $aSubpage.iStatus == 0}}admin{{/if}}">
							<h3><a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}}">{{$aSubpage.sName}}</a></h3>
							{{if isset( $aSubpage.sDate )}}<span class="date">{{$aSubpage.sDate}}</span>{{/if}}
							{{if $aBlock.aSubpages.bImageDisplay}}
								<div class="photo">
									{{if isset( $aSubpage.aDataImage )}}
										<a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}} - {{if !empty( $aSubpage.aDataImage.sFileDescription )}}{{$aSubpage.aDataImage.sFileDescription}} - {{/if}}{{$aSubpage.aDataImage.sFileName}}"><img src="{{$config.dir_files}}{{$aPageMinSizes.Subpage}}/{{$aSubpage.aDataImage.sFileName}}"  alt="{{$aSubpage.sName}} - {{if !empty( $aSubpage.aDataImage.sFileDescription )}}{{$aSubpage.aDataImage.sFileDescription}} - {{/if}}{{$aSubpage.aDataImage.sFileName}}" /></a>
									{{else}}
										<a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}}"><img src="{{$config.dir_files}}{{$aPageMinSizes.Subpage}}/nophoto.png" alt="{{$aSubpage.sName}}" /></a>
									{{/if}}
								</div>
							{{/if}}
							{{$aSubpage.sDescriptionShort}}
							{{if !empty( $aSubpage.aTags )}}<div class="tags">{{foreach from=$aSubpage.aTags item=sTag}}<a href="{{$sLinkSearch}}?sPhrase=&amp;sTag={{str_replace( ' ', '_', $sTag )}}" title="{{$sTag}}">{{$sTag}}</a> {{/foreach}}</div>{{/if}}
							<div class="clear more"><a href="{{$aSubpage.sLinkName}}" class="more" title="{{$aSubpage.sName}}{{if !empty( $aSubPage.sMoreLink )}} - {{$aSubPage.sMoreLink}}{{/if}}">{{if !empty( $aSubPage.sMoreLink )}}{{$aSubPage.sMoreLink}}{{else}}{{$lang.more}}{{/if}} &raquo;</a></div>
						</article>
					{{/foreach}}
				{{elseif $aBlock.aSubpages.bImageDisplay}}
					{{* Widok galerii *}}
					<div class="subpages-gallery">
						{{foreach from=$aBlock.aSubpages.aList item=aSubpage}}
							<figure class="photo {{if $aSubpage.iStatus == 0}}admin{{/if}}">
								{{if isset( $aSubpage.aDataImage )}}
									<a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}} - {{if !empty( $aSubpage.aDataImage.sFileDescription )}}{{$aSubpage.aDataImage.sFileDescription}} - {{/if}}{{$aSubpage.aDataImage.sFileName}}"><img src="{{$config.dir_files}}{{$aPageMinSizes.Subpage}}/{{$aSubpage.aDataImage.sFileName}}"  alt="{{$aSubpage.sName}} - {{if !empty( $aSubpage.aDataImage.sFileDescription )}}{{$aSubpage.aDataImage.sFileDescription}} - {{/if}}{{$aSubpage.aDataImage.sFileName}}" /></a>
								{{else}}
									<a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}}"><img src="{{$config.dir_files}}{{$aPageMinSizes.Subpage}}/nophoto.png" alt="{{$aSubpage.sName}}" /></a>
								{{/if}}
								<figcaption><a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}}">{{$aSubpage.sName}}</a></figcaption>
							</figure>
						{{/foreach}}
					</div>
				{{else}}
					{{* Widok listy nazw *}}
					<ul class="subpages-list">
						{{foreach from=$aBlock.aSubpages.aList item=aSubpage}}
							<li class="subpage {{if $aSubpage.iStatus == 0}}admin{{/if}}">
								<a href="{{$aSubpage.sLinkName}}" title="{{$aSubpage.sName}}">{{$aSubpage.sName}}</a>
							</li>
						{{/foreach}}
					</ul>
				{{/if}}
				{{if $aBlock.sType == 'SUBPAGES'}}
					<div class="pages clear">
						{{$sUrl = str_replace( '.html', '', $aBlock.aSubpages.aMainpage.sLinkName )}}
						{{if substr_count( $sUrl, ',' ) < 1}}{{$sUrl = $sUrl|cat:','}}{{/if}}
						{{countPages iPages=$aBlock.aSubpages.aPagesCountData.iCount iPageNumber=$aBlock.aSubpages.aPagesCountData.iPageNumber sUrl=$sUrl|cat:","|cat:$aBlock.iElement sUrl2=$sUrlExt}}
					</div>
				{{else}}
					<a href="{{$aBlock.aSubpages.aMainpage.sLinkName}}" class="clear more ext_subpages" title="{{$aBlock.aSubpages.aMainpage.sName}}{{if !empty( $aBlock.aSubpages.aMainpage.sMoreLink )}} - {{$aBlock.aSubpages.aMainpage.sMoreLink}}{{/if}}">{{if !empty( $aBlock.aSubpages.aMainpage.sMoreLink )}}{{$aBlock.aSubpages.aMainpage.sMoreLink}}{{else}}{{$lang.more}}{{/if}} &raquo;</a>
				{{/if}}
			{{elseif $aBlock.sType == 'FILTER'}}
				{{$sFilterUrlExt = substr( preg_replace( '/(\&amp;)+/', '&amp;', preg_replace( '/aFilter(Select)?Attributes\[0\]\[[0-9]*]=[0-9]+/', '', $sUrlExt ) ), 1 )}}
				{{if count( $aBlock.aFilterProducers ) > 0}}
					{{foreach from=$aBlock.aFilterProducers item=aAttribute}}
						<ul class="producers-filter">
							{{foreach from=$aAttribute.aValues item=aValue}}
								<li><a href="?{{$aPage.sLinkName2}}{{$sFilterUrlExt}}&amp;aFilterAttributes[{{$aAttribute@key}}][{{$aValue.iValue}}]=1" rel="nofollow" title="{{$aValue.sValue}}">
									{{if !empty( $aValue.sLogoUrl )}}
										<img src="{{$config.dir_files}}{{$aProducersMinSizes.2}}/{{$aValue.sLogoUrl}}" alt="{{$aValue.sValue}}" />
									{{else}}
										<span>{{$aValue.sValue}}</span>
									{{/if}}
								</a></li>
							{{/foreach}}
							{{if count( $_GET.aFilterAttributes.0 ) > 0 || count( $_GET.aFilterSelectAttributes.0 ) > 0}}
								<li>
									<a href="?{{$aPage.sLinkName2}}{{$sFilterUrlExt}}">wyczyść</a>
								</li>
							{{/if}}
						</ul>
					{{/foreach}}
				{{/if}}
			{{elseif $aBlock.sType == 'ADVSEARCHER'}}
				{{if isset( $aBlock.aAdvsearcherColumns ) && !empty( $aBlock.aAdvsearcherColumns )}}
					<div class="advsearchercolumns">
						<script type="text/javascript">
							$(document).ready(function(){
								/* <![CDATA[ */
								$('.advsearcher_column select').change(function(){
									var select = this;
									$(select).closest('label').nextAll('label').find('select').html( '<option value="">{{$lang.Select}}</option>' ).prop('disabled', true);
									if( $(select).val() > 0 ){
										$.get('index.php', {'p': 'advsearcher-getsub', 'iValue': $(select).val()}, function( data ){
											$(select).closest('label').next('label').find('select').html( '<option value="">{{$lang.Select}}</option>' + data ).prop('disabled', false);
										});
									}
								});
								/* ]]> */
							});
						</script>
						<form method="post">
							<fieldset>
								{{foreach from=$aBlock.aAdvsearcherColumns item=sColumn}}
									<label class="advsearcher_column">
										<span>{{$sColumn}}</span>
										<select class="advsearcher_add_{{$sColumn@key}} {{if $sColumn@last}}advsearcher_add_last{{/if}}" {{if !is_array( $aBlock.aAdvsearcherValues[$sColumn@key] ) || empty( $aBlock.aAdvsearcherValues[$sColumn@key] )}}disabled="disabled"{{/if}} name="aAdvsearcherValues[{{$sColumn@key}}]">
											<option value="0">{{$lang.Select}}</option>
											{{if is_array( $aBlock.aAdvsearcherValues[$sColumn@key] )}}{{foreach from=$aBlock.aAdvsearcherValues[$sColumn@key] item=sValue}}<option value="{{$sValue@key}}" {{if $smarty.session['iAdvsearcherValue_'|cat:$sColumn@key] == $sValue@key}}selected="selected"{{/if}}>{{$sValue}}</option>{{/foreach}}{{/if}}
										</select>
									</label>
								{{/foreach}}
							</fieldset>
							<div class="advsearcher_go">
								<input type="submit" value="{{$lang.apply}}" class="submit" title="{{$lang.apply}}"/>
								<a href="?clear-advsearcher=1" title="{{$lang.clear}}">{{$lang.clear}}</a>
							</div>
						</form>
						{{if !empty( $aBlock.sAdvsearcherPath )}}<p class="advsearcher_path">{{$lang.advsearcher_path}}<strong>{{$aBlock.sAdvsearcherPath}}</strong> <a href="?clear-advsearcher=1" title="{{$lang.clear}}">{{$lang.clear}}</a></p>{{/if}}
					</div>
				{{/if}}
				
			{{elseif $aBlock.sType == 'PRODUCTS' || $aBlock.sType == 'HL'}}
				{{include file='products_list.tpl' aBlock=$aBlock}}
			{{elseif $aBlock.sType == 'SITEMAP'}}
				<ul class="site_map">
					{{foreach from=$aBlock.aSiteMap item=aSubPage}}
						<li><a href="{{$aSubPage.sLinkName}}" title="{{$aSubPage.sName}}">{{$aSubPage.sName}}</a>
							{{if is_array( $aSubPage.aSubPages )}}
								{{sitemap_sub aSubPages=$aSubPage.aSubPages iDepth=1}}
							{{/if}}
							{{if is_array( $aSubPage.aProducts )}}
								{{sitemap_products aProducts=$aSubPage.aProducts}}
							{{/if}}
						</li>
					{{/foreach}}
				</ul>
			{{elseif $aBlock.sType == 'COMMENTS'}}
				{{if count( $aBlock.aComments ) > 0}}
					<ul class="pages-comments comments">
						{{foreach from=$aBlock.aComments item=aComment}}
							<li>
								<p class="comment-content">{{$aComment.sContent}}</p>
								<p class="comment-author">{{$aComment.sName}}, <span class="date">{{$aComment.sDate}}</span></p>
							</li>
						{{/foreach}}
					</ul>
				{{/if}}
				<script type="text/javascript">
					$(document).ready(function(){
						$("form#pages-comment-{{$aBlock.iElement}}").validate();
						$("form#pages-comment-{{$aBlock.iElement}} input#comment-name-{{$aBlock.iElement}}").rules("add", {required: true, minlength: 2});
						$("form#pages-comment-{{$aBlock.iElement}} textarea#comment-content-{{$aBlock.iElement}}").rules("add", {required: true});
					});
				</script>
				<form action="{{$aPage.sLinkName}}" method="post" id="pages-comment-{{$aBlock.iElement}}" class="pages-comment form-styled">
					<fieldset>
						<input type="hidden" name="sOption" value="saveComment" />

						<label>{{$lang.Name_and_surname}}: <input type="text" name="sName" class="input" value="{{$_SESSION.sUserName}}" id="comment-name-{{$aBlock.iElement}}" /></label>
						<label>{{$lang.Comment_content}}: <textarea name="sContent" id="comment-content-{{$aBlock.iElement}}" class="textarea" cols="30" rows="5"></textarea></label>
						<input type="submit" id="custom_form{{$aBlock.iElement}}" value="{{$lang.Add_comment}}" class="submit submit-styled reCaptcha" />
					</fieldset>
				</form>
			{{elseif $aBlock.sType == 'FORUM'}}
				{{if isset( $aBlock.aForum.aTopic )}}
					{{* TEMAT *}}
					<script type="text/javascript">
						$(document).ready(function(){
							$('.forum.posts a.edit').click(function(e){
								e.preventDefault();
								var post = $(this).closest('tr').find('.text');
								var text = post.html();
								var postid = $(this).attr('href').substr(1);
								post.html('<form action="?iTopic={{$aBlock.aForum.aTopic.iTopic}}" method="post"><textarea name="sText">'+text.replace(/\<br\/?\>/g,"\r\n").trim()+'</textarea><input type="hidden" name="iPost" value="'+postid+'" /><input type="submit" class="styled submit submit-styled" value="{{$lang.Forum_save}}" /></form>');
								$(this).remove();
							});
							$('h2 a.edit').click(function(e){
								e.preventDefault();
								var post = $(this).closest('span');
								$(this).remove();
								var text = post.html();
								post.html('<form action="?iTopic={{$aBlock.aForum.aTopic.iTopic}}" method="post"><input type="text" name="sTopic" value="'+text.trim()+'"/><input type="submit" class="styled submit submit-styled" value="{{$lang.Forum_save}}" /></form>');
							});
						});
					</script>
					<h2>{{$lang.Forum}} - <span>{{if $aBlock.aForum.bModerator}}<a class="edit"><img src="templates/admin/images/ico/edit.png" alt="edit" /></a>{{/if}} {{$aBlock.aForum.aTopic.sTopic}}</span></h2>
					<table class="forum posts">
						{{foreach from=$aBlock.aForum.aPosts item=aPost}}
							<tr>
								<td class="info">
									{{$lang.Forum_author}}: {{$aPost.sLogin}}<br />
									{{$lang.Forum_date}}: {{date( 'Y-m-d H:i:s', $aPost.iTime )}}
									{{if $aPost.iUser == $_SESSION.iUserClient || $aBlock.aForum.bModerator}}
										<br/>
										<a class="edit" href="#{{$aPost.iPost}}"><img src="templates/admin/images/ico/edit.png" alt="edit" /></a>
									{{/if}}
									{{if $aBlock.aForum.bModerator}}
										<a class="delete" href="?iTopic={{$aBlock.aForum.aTopic.iTopic}}&amp;iPostDelete={{$aPost.iPost}}"><img src="templates/admin/images/ico/delete.png" alt="delete" /></a>
									{{/if}}
								</td>
								<td>
									<div class="text">
										{{$aPost.sText}}
									</div>
									{{if !empty( $aPost.iModificationTime )}}
										<hr/>
										{{$lang.Forum_date_modify}} {{date( 'Y-m-d H:i:s', $aPost.iModificationTime )}}
									{{/if}}
								</td>
							</tr>
						{{/foreach}}
						<tfoot>
							{{if $aBlock.aForum.aPostsPages.iCount > 1}}
								<tr>
									<td colspan="2">
										<div class="pages">{{$lang.Pages}}: {{countPages iPages=$aBlock.aForum.aPostsPages.iCount iPageNumber=$aBlock.aForum.aPostsPages.iPageNumber sUrl=$aBlock.sLinkName|cat:$aBlock.aForum.aTopic.sLinkName|cat:'&amp;iPage=' bForum=true}}</div>
									</td>
								</tr>
							{{/if}}
						
							<tr class="replay {{if !$aBlock.aForum.aTopic.iClosed && !empty( $_SESSION.iUserClient )}}form{{/if}}">
								<td colspan="2">
									{{if $aBlock.aForum.aTopic.iClosed}}
										{{$lang.Forum_topic_closed}}
									{{elseif !empty( $_SESSION.iUserClient )}}
										<form method="post" action="?iTopic={{$aBlock.aForum.aTopic.iTopic}}">
											<label>{{$lang.Forum_text}}: <textarea name="sText"></textarea></label>
											<input type="submit" class="styled submit submit-styled" value="{{$lang.Forum_add_post}}" />
										</form>
									{{else}}
										{{$lang.Forum_login_to_post}}<br/>
										<a href="{{$aBlock.sLinkLogin}}">{{$lang.Forum_login_link}}</a>
									{{/if}}
								</td>
							</tr>
						</tfoot>
					</table>
				{{else}}
					{{* LISTA TEMATÓW *}}
					<h2>{{$lang.Forum}}</h2>
					<table class="forum topics">
						<thead>
							<tr>
								<th>{{$lang.Forum_topic}}</th>
								<th>{{$lang.Forum_first_post}}</th>
								<th>{{$lang.Forum_last_post}}</th>
								<th>{{$lang.Forum_posts}}</th>
								<th>{{$lang.Forum_views}}</th>
								{{if $aBlock.aForum.bModerator}}<th></th>{{/if}}
							</tr>
						</thead>
						{{foreach from=$aBlock.aForum.aTopics item=aTopic}}
							<tr>
								<td><a href="{{$aTopic.sLinkName}}">{{$aTopic.sTopic}}</a></td>
								<td class="postinfo">
									{{$aTopic.sLogin}}<br/>
									{{date( 'Y-m-d', $aTopic.iTime )}}<br/>
									{{date( 'H:i:s', $aTopic.iTime )}}
								</td>
								<td class="postinfo">
									{{$aTopic.sLastLogin}}<br/>
									{{date( 'Y-m-d', $aTopic.iLastPost )}}<br/>
									{{date( 'H:i:s', $aTopic.iLastPost )}}
								</td>
								<td class="postinfo">{{$aTopic.iPosts}}</td>
								<td class="postinfo">{{$aTopic.iViews}}</td>
								{{if $aBlock.aForum.bModerator}}
									<td>
										<a class="delete" href="?iTopicDelete={{$aTopic.iTopic}}"><img src="templates/admin/images/ico/delete.png" alt="delete" /></a>
										{{if $aTopic.iClosed}}
											<a class="open" href="?iTopicOpen={{$aTopic.iTopic}}"><img src="templates/admin/images/ico/open_topic.png" alt="open" /></a>
										{{else}}
											<a class="close" href="?iTopicClose={{$aTopic.iTopic}}"><img src="templates/admin/images/ico/close_topic.png" alt="close" /></a>
										{{/if}}
									</td>
								{{/if}}
							</tr>
						{{/foreach}}
						<tfoot>
							{{if $aBlock.aForum.aTopicsPages.iCount > 1}}
								<tr>
									<td colspan="{{if $aBlock.aForum.bModerator}}6{{else}}5{{/if}}">
										<div class="pages">{{$lang.Pages}}: {{countPages iPages=$aBlock.aForum.aTopicsPages.iCount iPageNumber=$aBlock.aForum.aTopicsPages.iPageNumber sUrl=$aBlock.sLinkName|cat:'?iPage=' bForum=true}}</div>
									</td>
								</tr>
							{{/if}}
							<tr class="replay {{if !empty( $_SESSION.iUserClient )}}form{{/if}}">
								<td colspan="{{if $aBlock.aForum.bModerator}}6{{else}}5{{/if}}">
									{{if !empty( $_SESSION.iUserClient )}}
										<form method="post" action="">
											<label>{{$lang.Forum_topic}}: <input name="sTopic" type="text" value="" /></label>
											<label>{{$lang.Forum_text}}: <textarea name="sText"></textarea></label>
											<input type="submit" class="styled submit submit-styled" value="{{$lang.Forum_add_topic}}" />
										</form>
									{{else}}
										{{$lang.Forum_login_to_post}}<br/>
										<a href="{{$aBlock.sLinkLogin}}">{{$lang.Forum_login_link}}</a>
									{{/if}}
								</td>
							</tr>
						</tfoot>
					</table>
				{{/if}}
			{{elseif $aBlock.sType == 'BANNER'}}
				{{$aBlock.aBanner[3]}}
			{{/if}}
		</div>
	{{/foreach}}
	
	<div class="clear"></div>
	
	{{include file='order.tpl' inline}}

	{{$SMARTY_sUsersPanel}}
	
	<div class="clear"></div>
</div>