{{if isset( $aBasket )}}
	{{if !empty( $aBasket.aProducts )}}
		<ul id="basket-bar"{{if !$config.users_plugin_active}} class="tabs_4"{{/if}}>	
			<li class="selected">{{$lang.order_bar_basket}}</li>
			{{if $config.users_plugin_active}}<li>{{$lang.order_bar_login}}</li>{{/if}}
			<li>{{$lang.order_bar_personal}}</li>
			<li>{{$lang.order_bar_delivery}}</li>
			<li>{{$lang.order_bar_summary}}</li>
		</ul>
		<div id="basket">
			<script type="text/javascript">
				/*<![CDATA[*/
				$(document).ready(function(){
					$("form#basket-form").validate();
					$("form#basket-form td.quantity input").each(function(){ $(this).rules("add", {required: true, number: true, min: this.quantity_min, max: this.quantity_max}); });
					$("form#basket-form #step-next").click(function(){
						var sum_quantity = $(".quantity input").sumValues();
						var min_quantity = {{$config.min_products_count}};
						if( sum_quantity < min_quantity ){
							message_text = '<h1>{{$lang.too_small_order_header_quantity}}</h1> <p>{{$lang.too_small_order_quantity}}' + min_quantity + '</p>';
							message_text = '<div class="colorbox_message">' + message_text + '</div>';
							$.colorbox({html: message_text});
							return false;
						}
						var summary = $("#summary-cost").html();
						var min_val = {{$config.min_products_summary}};
						if( summary <  min_val ){
							message_text = '<h1>{{$lang.too_small_order_header}}</h1> <p>{{$lang.too_small_order}}' + min_val + '{{$config.currency_symbol}}</p>';
							message_text = '<div class="colorbox_message">' + message_text + '</div>';
							$.colorbox({html: message_text});
							return false;
						}
					});
					$("span.fotolia a").click(function(){ document.global_data['fotolia_cbox_info'] = $(this).parents('tr').prop('id'); }).colorbox({iframe: true, innerWidth: 680, innerHeight: 600});
				});

				var aStockInfo = '{{$aBasket.sStockInfoJSON}}';
				/*]]>*/
			</script>
			<form method="post" id="basket-form" action="{{$aPage.sLinkName}}">
				<fieldset id="ordered-products">
					<table cellspacing="0">
						<thead>
							<tr>
								<th class="image desktop tablet">{{$lang.Photo}}</th>
								<th class="name">{{$lang.Name}}</th>
								{{if $config.iNettoOption > 0}}
									<th class="price netto">{{$lang.NetPrice}} &#91;{{$config.currency_symbol}}&#93;</th>
									<th class="price vat">{{$lang.Vat}}</th>
								{{/if}}
								<th class="price">{{$lang.Price}}{{if $config.iNettoOption > 0}} {{$lang.Gross}}{{/if}} &#91;{{$config.currency_symbol}}&#93;</th>
								<th class="quantity">{{$lang.Quantity}}</th>
								<th class="summary">{{$lang.Summary}}{{if $config.iNettoOption > 0}} {{$lang.Gross}}{{/if}} &#91;{{$config.currency_symbol}}&#93;</th>
								<th class="del"></th>
							</tr>
						</thead>
						<tfoot>
							<tr class="summary">
								<td colspan="{{if $config.iNettoOption > 0}}4{{else}}2{{/if}}"></td>
								<th colspan="2">{{$lang.Summary}}{{if $config.iNettoOption > 0}} {{$lang.Gross}}{{/if}}:</th>
								<td id="summary-cost" class="summary-cost">{{$aBasket.sProductsSummary}}</td>
								<td>&nbsp;</td>
							</tr>

							{{if $aBasket.bDiscountPanelActive}}
								<script type="text/javascript">
									/*<![CDATA[*/
									document.sDiscountValue = {{json_encode( $aBasket.sDiscountCouponValueJS )}};
									document.iProducer = {{json_encode( $aBasket.iDiscountCouponProducer )}};
									document.sProducer = {{json_encode( $aBasket.sDiscountCouponProducer )}};
									$(document).ready(function(){
										$('#basket #ordered-products table').bind("summaryUpdateEvent", function(){
											var code = document.sDiscountValue;
											if( code == null ) code = '0.00';
											if( code !== null ){
												if( code.substr( 0, 1 ) == '-' )
													code = code.substr( 1 );
												if( code.substr( -1 ) == '%' ){
													code = parseFloat(code.slice( 0, -1 ));
													summary = parseFloat($('#summary-cost').html());
													if( document.iProducer === null ){
														summary = (summary * ( 100 - code ) / 100).toFixed(2);
													} else{
														$('tr.producer-' + document.iProducer + ' td.summary').each(function(){
															summary = ( summary - ( parseFloat( $(this).html() ) * code / 100 ) ).toFixed(2);
														});
													}
													$('#summary-cost-discount').html( summary );
													$('#summary-cost-discount-input').prop( 'value', summary );
													var producerInfo = '';
													if( document.sProducer !== null ){
														producerInfo = ' *' + document.sProducer;
													}
													$('#coupon_value').html( '-' + code + '%' + producerInfo );
												} else{
													code = parseFloat(code);
													summary = parseFloat($('#summary-cost').html());
													summary = (summary - code).toFixed(2);
													$('#summary-cost-discount').html( summary );
													$('#summary-cost-discount-input').prop( 'value', summary );
													if( code > 0 )
														$('#coupon_value').html( '-' + code.toFixed(2) );
													else
														$('#coupon_value').html( code.toFixed(2) );
												}
											}
										});

										$('#verify_discount_coupon').click(function(e){
											e.preventDefault();
											var discount = $.get( 'index.php', {'p': 'p_json-verify_discount_coupon', 'sCode': $('#discount_coupon_code').val() }, function(http_response){
												if( http_response === null ){
													code = null;
													document.sDiscountValue = null;
													document.iProducer = null;
													document.sProducer = null;
												} else{
													code = http_response.sDiscountValue;
													document.sDiscountValue = http_response.sDiscountValue;
													document.iProducer = http_response.iProducer;
													document.sProducer = http_response.sProducer;
												}
												if( code === null ){
													if( $('#discount_coupon_code').val() == '{{$lang.Discount_coupon}}' ){
														$('#discount_coupon_code').removeClass( 'correct wrong' );
													} else{
														$('#discount_coupon_code').removeClass( 'correct' ).addClass( 'wrong' );
													}
													code = parseFloat( '0' ).toFixed(2);
													summary = parseFloat($('#summary-cost').html()).toFixed(2);
													$('#summary-cost-discount').html( summary );
													$('#summary-cost-discount-input').prop( 'value', summary );
													$('#coupon_value').html( code );
												} else if( code.substr( -1 ) == '%' ){
														$('#discount_coupon_code').removeClass( 'wrong' ).addClass( 'correct' );
													code = parseFloat(code.slice( 0, -1 ));
													summary = parseFloat($('#summary-cost').html());
													if( document.iProducer === null ){
														summary = (summary * ( 100 - code ) / 100).toFixed(2);
													} else{
														$('tr.producer-' + document.iProducer + ' td.summary').each(function(){
															summary = ( summary - ( parseFloat( $(this).html() ) * code / 100 ) ).toFixed(2);
														});
													}
													$('#summary-cost-discount').html( summary );
													$('#summary-cost-discount-input').prop( 'value', summary );
													var producerInfo = '';
													if( document.sProducer !== null ){
														producerInfo = ' *' + document.sProducer;
													}
													$('#coupon_value').html( '-' + code + '%' + producerInfo );
												} else{
														$('#discount_coupon_code').removeClass( 'wrong' ).addClass( 'correct' );
													code = parseFloat(code);
													summary = parseFloat($('#summary-cost').html());
													summary = (summary - code).toFixed(2);
													$('#summary-cost-discount').html( summary );
													$('#summary-cost-discount-input').prop( 'value', summary );
													$('#coupon_value').html( '-' + code.toFixed(2) );
												}
											});
										});

										$('#discount_coupon_code').each(function(){
											value = jQuery.trim($(this).prop("value"))
											if( value == "" )
											{$(this).prop("value",'{{$lang.Discount_coupon}}').addClass("empty");}
										})
										.focus(function(){
											value = jQuery.trim($(this).prop("value"));
											if (value == '{{$lang.Discount_coupon}}')
											{$(this).prop("value","").removeClass("empty");}
										})
										.focusout(function(){
											value = jQuery.trim($(this).prop("value"));
											if (value == "")
											{$(this).prop("value",'{{$lang.Discount_coupon}}').addClass("empty");}
										});

										$("form#basket-form #summary-cost-discount-input").rules("add", {required: true, number: true, min: 0, messages:{ min: '{{$lang.Negative_order_summary}}' }});
									});
									/*]]>*/
								</script>

								<tr class="discount summary">
									<td colspan="{{if $config.iNettoOption > 0}}5{{else}}3{{/if}}">
										<input class="submit" type="image" id="verify_discount_coupon" value="" name="{{$lang.Check_discount}}" src="" />
										<input id="discount_coupon_code" name="discount_coupon_code" type="text" class="input" value="{{$aBasket.discount_coupon_code}}"/> 
									</td>
									<th>{{$lang.Discount_coupon_value}}</th>
									<td id="coupon_value" class="summary-cost">{{$aBasket.sDiscountCouponValue}}</td>
									<td>&nbsp;</td>
								</tr>

								<tr class="summary">
									<td colspan="{{if $config.iNettoOption > 0}}4{{else}}2{{/if}}">&nbsp;</td>
									<th colspan="2">{{$lang.Summary_after_discount}}:</th>
									<td id="summary-cost-discount" class="summary-cost">{{$aBasket.sProductsSummaryDiscount}}</td>
									<td><input type="hidden" id="summary-cost-discount-input" value="{{$aBasket.sProductsSummaryDiscount}}" /></td>
								</tr>
							{{/if}}

							<tr class="buttons">
								<td colspan="{{if $config.iNettoOption > 0}}8{{else}}6{{/if}}">
									<a id="step-prev" class="submit submit-styled" href="{{$sBackLink}}" title="{{$lang.Continue_shoping}}">{{$lang.Continue_shoping}}</a>
									<button id="save" class="submit submit-styled" type="submit" name="sSave">{{$lang.Save_basket}}</button>
									<button id="step-next" class="submit submit-styled next" type="submit" name="sNext">{{$lang.Basket_next}}</button>
								</td>
							</tr>

							<tr>
								<td colspan="{{if $config.iNettoOption > 0}}8{{else}}6{{/if}}">
									{{if !empty( $config.zagiel_id ) }}
										<script>
										/*<![CDATA[*/
											var zagielSymulatorHref = 'https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/{{$config.zagiel_id}}/wariantSklepu/1/typProduktu/0/wartoscTowarow/';
										/*]]>*/
										</script>
										<a {{if $aBasket.fOrderSummary < $config.zagiel_min_price}}style="display: none"{{/if}} id="zagiel-button" href="https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/{{$config.zagiel_id}}/wariantSklepu/1/typProduktu/0/wartoscTowarow/{{$aBasket.fOrderSummary}}" title="{{$lang.Zagiel_calculate}}"><img src="templates/images/zagiel_oblicz_rate.gif" alt="{{$lang.Zagiel_calculate}}" /></a>
									{{/if}}

									{{if !empty( $config.LR_psp_id ) }}
										{{$LR_forbidden=false}}
										{{foreach from=$aBasket.aProducts item=aProduct}}
											{{$LR_forbidden = $LR_forbidden || in_array($aProduct.iMainCategory, explode(',', $config.LR_categories))}}
										{{/foreach}}
										{{if !$LR_forbidden }}
											<script type="text/javascript">
											/*<![CDATA[*/
												function LR_PoliczRate(koszyk) {
													var iWidth = 820;
													var iHeight = 530;
													var iX = ( screen.availWidth - iWidth ) / 2;
													var iY = ( screen.availHeight - iHeight ) / 2;	
													window.open('https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT='+koszyk, 'Policz_rate', 'height='+iHeight+',width='+iWidth+',top='+iY+',left='+iX+',resizable=yes,scrollbars=yes,status=0;');
													return false;
												}
											/*]]>*/
											</script>
											<a OnClick="return LR_PoliczRate('{{$aBasket.fOrderSummary}}');" target="raty_symulator" id="LR-button" href="https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT={{$aBasket.fOrderSummary}}" title="{{$lang.LR_name}}">
												<img src="https://ewniosek.credit-agricole.pl/eWniosek/res/CA_grafika/oblicz_raty_{{$config.LR_logo_color}}.png" alt="{{$lang.LR_name}}" />
											</a>
										{{/if}}
									{{/if}}
								</td>
							</tr>

							{{if !empty( $config.LR_psp_id ) }}
								{{$LR_forbidden=false}}
								{{foreach from=$aBasket.aProducts item=aProduct}}
									{{$LR_forbidden = $LR_forbidden || in_array($aProduct.iMainCategory, explode(',', $config.LR_categories))}}
								{{/foreach}}
								{{if !$LR_forbidden }}
									<script type="text/javascript">
									/*<![CDATA[*/
										function LR_PoliczRate(koszyk) {
											var iWidth = 820;
											var iHeight = 530;
											var iX = ( screen.availWidth - iWidth ) / 2;
											var iY = ( screen.availHeight - iHeight ) / 2;	
											window.open('https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT='+koszyk, 'Policz_rate', 'height='+iHeight+',width='+iWidth+',top='+iY+',left='+iX+',resizable=yes,scrollbars=yes,status=0;');
											return false;
										}
									/*]]>*/
									</script>
									<tr>
										<td colspan="{{if $config.iNettoOption > 0 && !$MOBILE}}8{{else}}6{{/if}}">
										</td>
									</tr>
								{{/if}}
							{{/if}}
						</tfoot>
						<tbody>
							{{foreach from=$aBasket.aProducts item=aProduct}}
								<tr id="product-{{$aProduct.iProductVariant}}" class="producer-{{$aProduct.iProducer}}">
									<td class="image desktop tablet">
										{{if isset($aProduct.aDataImage)}}
											<a href="{{$aProduct.sLinkName}}" title="{{$aProduct.sName}}"><img src="{{$config.dir_files}}{{$aProductMinSizes.MainBasket}}/{{$aProduct.aDataImage.sFileName}}" alt="{{if !empty($aProduct.aDataImage.sFileDescription)}}{{$aProduct.aDataImage.sFileDescription}} - {{/if}}{{$aProduct.sName}}" /></a>
										{{/if}}
									</td>
									<th class="name">
										<a href="{{$aProduct.sLinkName}}" title="{{$aProduct.sName}}">
											{{$aProduct.sName}}
										</a>
										<span class="availability">{{$aProduct.sAvailability}}</span>

										{{if !empty( $config.fotolia_id ) && $aProduct.iFotolia}}
											<span class="fotolia"><a href="index.php?p=fotolia-choose" title="{{$lang.Fotolia_choose_photo}}">{{$lang.Fotolia_choose_photo}}</a> <input type="text" readonly="readonly" name="aProductsFotolia[{{$aProduct.iProductVariant}}]" value="{{$aProduct.iFotoliaPhoto}}" /></span>
										{{/if}}
									</th>
									{{if $config.iNettoOption > 0}}
										{{*
											0 - brutto
											1 - netto + brutto
											2 - netto
										*}}
										<td class="pc netto">{{number_format( $aProduct.fPrice / ( 1 + $aProduct.fVat ), 2, '.', '' )}}</td>
										<td class="pc vat">{{$aProduct.fVat * 100}}%</td>
									{{/if}}
									<td class="price">{{$aProduct.sPrice}}</td>
									<td class="quantity">
										<input type="text" name="aProducts[{{$aProduct.iProductVariant}}]" value="{{$aProduct.iQuantity}}" size="3" maxlength="4" class="input" id="quantity-{{$aProduct.iProductVariant}}" />
										<span class="quantity-change change" ><a href="#" class="plus" title="+"><span>+</span></a><a href="#" class="minus" title="-"><span>-</span></a></span>
									</td>
									<td class="summary">{{$aProduct.sSummary}}</td>
									<td class="del"><a href="{{$aProduct.sLinkDelete}}" title="{{$lang.Basket_delete}}"><span>{{$lang.Basket_delete}}</span></a></td>
								</tr>
							{{/foreach}}
						</tbody>
					</table>
				</fieldset>
			</form>
		</div>
	{{else}}
		<div class="message" id="error"><h3>{{$lang.Basket_empty}}</h3></div>
	{{/if}}
{{elseif $config.order_login_page == $aPage.iPage}}
	<ul id="basket-bar"{{if !$config.users_plugin_active}} class="tabs_4"{{/if}}>
		<li class="checked">{{$lang.order_bar_basket}}</li>
		{{if $config.users_plugin_active}}<li class="selected">{{$lang.order_bar_login}}</li>{{/if}}
		<li>{{$lang.order_bar_personal}}</li>
		<li>{{$lang.order_bar_delivery}}</li>
		<li>{{$lang.order_bar_summary}}</li>
	</ul>
	<div id="order">
		<div class="block50">
			<h2>{{$lang.Order_login_register}}</h2>
			<script type="text/javascript">
				$(document).ready(function(){
					$('form.order-login').hide();
					$('.login_select').change(function(){
						if( $(this).is(':checked') ){
							$('form.order-login').hide();
							$($(this).val()).show();
						}
					}).first().prop('checked', 'checked').trigger('change');
				});
			</script>
			{{if isset( $aPage.sLinkLogin )}}
				<label><input type="radio" class="login_select" name="login_register" value="#order-login" /> {{$lang.Login_if_you_have_account}}</label>
			{{/if}}
			{{if isset( $aPage.sLinkRegister )}}
				<label><input type="radio" class="login_select" name="login_register" value="#order-register" /> {{$lang.Write_login_and_password_to_register}}</label>
			{{/if}}
			<br/>
			{{if isset( $aPage.sLinkLogin )}}
				<script type="text/javascript">
					/*<![CDATA[*/
					$(document).ready(function(){
						$("form#order-login").validate();
						$("form#order-login #login-login").rules("add", {required: true});
						$("form#order-login #login-password").rules("add", {required: true});
					});
					/*]]>*/
				</script>
				<form action="{{$aPage.sLinkLogin}}" method="post" id="order-login" class="order-login">
					<fieldset>
						<input type="hidden" name="bRedirectOrder" value="1" />
						<table>
							<tr><th><label for="login-login">{{$lang.Login}}</label>:</th><td><input id="login-login" type="text" name="sLogin" value="" class="input" maxlength="30" /></td></tr>
							<tr><th><label for="login-password">{{$lang.Password}}</label>:</th><td><input id="login-password" type="password" name="sPass" value="" class="input" maxlength="30" /></td></tr>
							<tr><td colspan="2" class="buttons"><button type="submit" class="submit submit-styled" id="login">{{$lang.Log_in}}</button></td></tr>
						</table>
					</fieldset>
				</form>
			{{/if}}
			{{if isset( $aPage.sLinkRegister )}}
				<script type="text/javascript">
					/*<![CDATA[*/
					$(document).ready(function(){
						$("form#order-register").validate();
						$("form#order-register #register-login").rules("add", {required: true});
						$("form#order-register #register-email").rules("add", {required: true, email: true});
						$("form#order-register #register-password").rules("add", {required: true});
						$("form#order-register #register-password2").rules("add", {required: true, equalTo: "#register-password"});
					});
					/*]]>*/
				</script>
				<form action="{{$aPage.sLinkRegister}}" method="post" id="order-register" class="order-login">
					<fieldset>
						<input type="hidden" name="sOption" value="save" />
						<table>
							<tr><th><label for="register-login">{{$lang.Login}}</label>:</th><td><input type="text" name="sLogin" value="" class="input" id="register-login" maxlength="30" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_login}}" alt="{{$lang.tooltip_login}}" /></td>
							</tr><tr>
							<th><label for="register-email">{{$lang.Email}}</label>:</th><td><input type="text" name="sEmail" value="" class="input" id="register-email" maxlength="60" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_email}}" alt="{{$lang.tooltip_email}}" /></td>
							</tr><tr>
							<th><label for="register-password">{{$lang.Password}}</label>:</th><td><input type="password" name="sPass" value="" class="input" id="register-password" maxlength="30" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_pass}}" alt="{{$lang.tooltip_pass}}" /> <a href="#" id="generate"></a></td>
							</tr><tr>
							<th><label for="register-password2">{{$lang.Password_confirm}}</label>:</th><td><input type="password" name="sPass2" value="" class="input" id="register-password2" maxlength="30" /></td>
							</tr>
							{{if !empty( $config.recaptcha_private ) && !empty( $config.recaptcha_public )}}
								<script type="text/javascript">
									$(document).ready(function(){
										recaptcha_on('#'+$('.recaptcha_widget').attr('id'));
									});
								</script>
							{{/if}}
							
							{{if isset($sRulesLink)}}
								<tr id="rules"><td colspan="2">
									<script type="text/javascript">
										$(document).ready(function(){
											$("#rules-accept").rules("add", {required: true, messages: {required: "{{$lang.Require_rules_accept}}"}});
											$("#rules2-accept").rules("add", {required: true, messages: {required: "{{$lang.Require_rules_accept}}"}});
										});
									</script>
									<input type="checkbox" class="checkbox" name="iRulesAccept" value="1" alt="{{$lang.Require_rules_accept}}" id="rules-accept" />
									<label for="rules-accept">{{$lang.Rules_accept}} <a href="{{$sRulesLink}}">{{$lang.rules_read}}</a>.</label>
								</td></tr>
							{{/if}}
							<tr id="rules2"><td colspan="2">
								<script type="text/javascript">
									/*<![CDATA[*/
									$(document).ready(function(){
										$("form#personal-data-form #order-rules2-accept").rules("add", {required: true, messages: {required: "{{$lang.Require_rules2_accept}}"}});
									});
									/*]]>*/
								</script>
								<input type="checkbox" class="checkbox" name="iRulesAccept2" value="1" alt="{{$lang.Require_rules2_accept}}" id="rules2-accept" />
								<label for="rules2-accept">{{$lang.Rules2_accept}}</label>
							</td></tr>

							<tr id="newsletter"><td colspan="2">
								<input type="checkbox" class="checkbox" name="iNewsletterAccept" value="1" id="newsletter-accept" />
								<label for="newsletter-accept">{{$lang.Newsletter_accept}}</label>
							</td></tr>
							
							<tr>
								<td colspan="2" class="buttons"><button type="submit" name="sRegister" class="submit submit-styled reCaptcha" id="register">{{$lang.Register}}</button></td>
							</tr>
						</table>
					</fieldset>
				</form>
			{{/if}}
		</div>
		<div class="block50">
			<form action="{{$aPage.sLinkName}}" method="post" id="order-next" class="order-no-login">
				<fieldset>
					<h2>{{$lang.Order_anonymous}}</h2>
					<button type="submit" name="sOrderNext" class="submit submit-styled" id="step-next">{{$lang.No_account_next}}</button>
				</fieldset>
			</form>
		</div>
		<form action="{{$aPage.sLinkName}}" method="post" id="order-step" class="order-login">
			<fieldset>
				<button type="submit" name="sOrderPrev" class="submit submit-styled cancel" id="step-prev">{{$lang.Basket_prev}}</button>
			</fieldset>
		</form>

	</div>
{{elseif $config.order_address_page == $aPage.iPage}}
	<ul id="basket-bar"{{if !$config.users_plugin_active}} class="tabs_4"{{/if}}>
		<li class="checked">{{$lang.order_bar_basket}}</li>
		{{if $config.users_plugin_active}}<li class="checked">{{$lang.order_bar_login}}</li>{{/if}}
		<li class="selected">{{$lang.order_bar_personal}}</li>
		<li>{{$lang.order_bar_delivery}}</li>
		<li>{{$lang.order_bar_summary}}</li>
	</ul>
	<div id="order">
		<script type="text/javascript">
			/*<![CDATA[*/
			$(document).ready(function(){
				var iFilled = 0;
				$('#personal-data-form input, #personal-data-form select').change(function(){
					iFilled++;
				});
				$("form#personal-data-form .cancel").click(function(e){
					e.preventDefault();
					if( iFilled ){
						$.colorbox({html: '<div class="colorbox_message"><h1>{{$lang.accept_head}}</h1> <p>{{$lang.accept_question}}</p><p><a href="#" class="submit-styled" id="save_data_button" title="{{$lang.Yes}}">{{$lang.Yes}}</a> <a href="#" class="submit-styled" id="no_save_data_button" title="{{$lang.No}}">{{$lang.No}}</a></p></div>'});
					} else{
						$('#personal-data-form input, #personal-data-form select').prop( 'disabled', true );
						$('#personal-data-form').append('<input type="hidden" name="sOrderPrev" value="1" />');
						$('#personal-data-form').submit();
					}
				});
				$('#save_data_button').live( 'click', function(e){
					e.preventDefault();
					$.colorbox.close();
					$('#personal-data-form').append('<input type="hidden" name="sOrderPrev" value="1" />');
					$('#personal-data-form').submit();
				});
				$('#no_save_data_button').live( 'click', function(e){
					e.preventDefault();
					$.colorbox.close();
					$('#personal-data-form input, #personal-data-form select').prop( 'disabled', true );
					$('#personal-data-form').append('<input type="hidden" name="sOrderPrev" value="1" />');
					$('#personal-data-form').submit();
				});

				$("form#personal-data-form").validate();
				$("form#personal-data-form #oFirstName").rules("add", {required: true});
				$("form#personal-data-form #oLastName").rules("add", {required: true});
				$("form#personal-data-form #oInvoice").rules("add", {required: true});
				$("form#personal-data-form #oStreet").rules("add", {required: true});
				$("form#personal-data-form #oZipCode").rules("add", {required: true/*, postalCodePL: true*/});
				$("form#personal-data-form #oCity").rules("add", {required: true});
				$("form#personal-data-form #oCountry").rules("add", {required: true});
				$("form#personal-data-form #oPhone").rules("add", {required: true/*, phone: true*/, pattern: '^\\+?[a-zA-Z0-9\\s]+$'});
				$("form#personal-data-form #oEmail").rules("add", {required: true, email: true});
				
				{{if $config.pesel == 2}}
					$('form#personal-data-form #oPesel').rules("add", {required: { depends: function( element ){ return $('#oInvoice').val() == 2; } }, pattern: '^[0-9]{11}$' });
				{{/if}}
				
				$('form#personal-data-form #oCompany').rules("add", {required: { depends: function( element ){ return $('#oInvoice').val() == 1; } } });
				$('form#personal-data-form #oNip').rules("add", {required: { depends: function( element ){ return $('#oInvoice').val() == 1; } }/*, nip: true*/, pattern: '^[a-zA-Z]{0,3}\\s*[0-9]{10}$' });
				
				$("form#personal-data-form #oStreet").on( 'change', function(){
					$( this ).val( $( this ).val().replace( /,/g, ' ' ) );
				});
				
				$("form#personal-data-form #oNip").on( 'change', function(){
					$( this ).val( $( this ).val().replace( /-|\s/g, '' ) );
				});
				
	//			$("form#personal-data-form #oPostalZipCode").rules("add", {postalCodePL: {depends: "#oPostalZipCode:filled"} });
	//			$("form#personal-data-form #oPostalPhone").rules("add", {phone: {depends: "#oPostalPhone:filled"} });
				
				var aRegions = {{$sRegions}};
				
				$('#oCountry').change(function(){
					$('#oRegion').html('<option value="">{{$lang.Choose_region}}</option>');
					var iCountry = $(this).val();
					$.each(aRegions, function( key, region ){
						if( region.iCountry == iCountry ){
							$('#oRegion').append('<option value="' + region.iRegion + '"'+ ( region.iRegion == {{intval( $aOrderInfo.iRegion )}} ? ' selected="selected"' : '' ) +'>' + region.sRegion + '</option>');
						}
					});
					if( $('#oRegion').html() == '<option value="">{{$lang.Choose_region}}</option>'){
						$('#oRegionTR').hide();
					} else{
						$('#oRegionTR').show();
					}
				});
				$('#oCountry').trigger('change');
				
				$('#oPostalCountry').change(function(){
					$('#oPostalRegion').html('<option value="">{{$lang.Choose_region}}</option>');
					var iCountry = $(this).val();
					$.each(aRegions, function( key, region ){
						if( region.iCountry == iCountry ){
							$('#oPostalRegion').append('<option value="' + region.iRegion + '"'+ ( region.iRegion == {{intval( $aOrderInfo.iPostalRegion )}} ? ' selected="selected"' : '' ) +'>' + region.sRegion + '</option>');
						}
					});
					if( $('#oPostalRegion').html() == '<option value="">{{$lang.Choose_region}}</option>'){
						$('#oPostalRegionTR').hide();
					} else{
						$('#oPostalRegionTR').show();
					}
				});
				$('#oPostalCountry').trigger('change');
				
				$('.postal_info').change(function(){
					if( $(this).is(':checked') ){
						$('table.postal_info').hide();
						if( $(this).val().length > 0 ){
							$($(this).val()).show();
						}
					}
				});
				if( $('#postal_info input').filter(function(){ return this.value.length > 0; }).length > 0 ){
					$('input.postal_info').last().prop('checked', 'checked').trigger('change');
				} else{
					$('input.postal_info').first().prop('checked', 'checked').trigger('change');
				}

				$('.company_info').change(function(){
					if( $(this).is(':checked') ){
						$('table.company_info').hide();
						if( $(this).val().length > 0 ){
							$($(this).val()).show();
						}
					}
				});
				if( $('table.company_info input').filter(function(){ return this.value.length > 0; }).length > 0 ){
					$('input.company_info').last().prop('checked', 'checked').trigger('change');
				} else{
					$('input.company_info').first().prop('checked', 'checked').trigger('change');
				}

			});
			/*]]>*/
		</script>
		<form action="{{$aPage.sLinkName}}" method="post" id="personal-data-form" class="order-adress" >
			<div class="block50" >
				<fieldset id="personal-data">
					<h2>{{$lang.Your_personal_information}}</h2>
					<label><input type="radio" name="company_info" class="company_info" value="#private-data" />{{$lang.Your_personal_information_private}}</label>
					<label><input type="radio" name="company_info" class="company_info" value="#company-data" />{{$lang.Your_personal_information_company}}</label>

					<table id="company-data" class="company_info">
						<tr>
							<th>
								<label for="oCompany">{{$lang.Company}}</label>
							</th>
							<td>
								<input type="text" name="sCompanyName" value="{{$aOrderInfo.sCompanyName}}" class="input {{if $aOrderInfo.EsCompanyName}}validation-error{{/if}}" id="oCompany"  maxlength="60" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_company}}" alt="{{$lang.tooltip_company}}" />
							</td>
						</tr>
						<tr>
							<th>
								<label for="oNip">{{$lang.Nip}}</label>
							</th>
							<td>
								<input type="text" name="sNip" value="{{$aOrderInfo.sNip}}"  maxlength="20" class="input {{if $aOrderInfo.EsNip}}validation-error{{/if}}" id="oNip" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_nip}}" alt="{{$lang.tooltip_nip}}" />
							</td>
						</tr>
					</table>

					{{if $config.pesel >= 1}}
						<table id="private-data" class="company_info">
							<tr>
								<th>
									<label for="oPesel">{{$lang.Pesel}}</label>
								</th>
								<td>
									<input type="text" name="sPesel" value="{{$aOrderInfo.sPesel}}"  maxlength="15" class="input {{if $aOrderInfo.EsPesel}}validation-error{{/if}}" id="oPesel" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_pesel}}" alt="{{$lang.tooltip_pesel}}" />
								</td>
							</tr>
						</table>
					{{/if}}

					<table>
						<tr><th><label for="oFirstName">{{$lang.First_name}}</label></th><td><input type="text" name="sFirstName" value="{{$aOrderInfo.sFirstName}}" class="input {{if $aOrderInfo.EsFirstName}}validation-error{{/if}}" id="oFirstName" maxlength="30" /></td></tr>
						<tr><th><label for="oLastName">{{$lang.Last_name}}</label></th><td><input type="text" name="sLastName" value="{{$aOrderInfo.sLastName}}" class="input {{if $aOrderInfo.EsLastName}}validation-error{{/if}}" id="oLastName" maxlength="30" /></td></tr>
						<tr><th><label for="oStreet">{{$lang.Street}}</label></th><td><input type="text" name="sStreet" value="{{$aOrderInfo.sStreet}}" class="input {{if $aOrderInfo.EsStreet}}validation-error{{/if}}" id="oStreet" maxlength="40" /></td></tr>
						<tr><th><label for="oZipCode">{{$lang.Zip_code}}</label></th><td><input type="text" name="sZipCode" value="{{$aOrderInfo.sZipCode}}" class="input {{if $aOrderInfo.EsZipCode}}validation-error{{/if}}" id="oZipCode" maxlength="20" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_zipcode}}" alt="{{$lang.tooltip_zipcode}}" /></td></tr>
						<tr><th><label for="oCity">{{$lang.City}}</label></th><td><input type="text" name="sCity" value="{{$aOrderInfo.sCity}}" class="input {{if $aOrderInfo.EsCity}}validation-error{{/if}}" id="oCity" maxlength="40" /></td></tr>
						<tr><th><label for="oCountry">{{$lang.Country}}</label></th><td><select name="iCountry" id="oCountry" {{if $aOrderInfo.EiCountry}}class="validation-error"{{/if}}><option value="">{{$lang.Choose_country}}</option>{{selectOptions aOptions=$aOrderInfo.aCountries mOption=$aOrderInfo.iCountry}}</select><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_country}}" alt="{{$lang.tooltip_country}}" /></td></tr>
						<tr id="oRegionTR"><th><label for="oRegion">{{$lang.Region}}</label></th><td><select name="iRegion" id="oRegion"></select></td></tr>
						<tr><th><label for="oPhone">{{$lang.Telephone}}</label></th><td><input type="tel" name="sPhone" value="{{$aOrderInfo.sPhone}}" class="input {{if $aOrderInfo.EsPhone}}validation-error{{/if}}" id="oPhone" maxlength="40" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_phone}}" alt="{{$lang.tooltip_phone}}" /></td></tr>
						<tr><th><label for="oEmail">{{$lang.Email}}</label></th><td><input type="text" name="sEmail" value="{{$aOrderInfo.sEmail}}" class="input {{if $aOrderInfo.EsEmail}}validation-error{{/if}}" id="oEmail" maxlength="60" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_email}}" alt="{{$lang.tooltip_email}}" /></td></tr>
					</table>
				</fieldset>
			</div>

			<div class="block50">
				<fieldset id="postal-data">
					<h2>{{$lang.DifrentPostalData}}</h2>
					<label><input type="radio" name="postal_info" class="postal_info" value="" />{{$lang.PostalDataTrue}}</label>
					<label><input type="radio" name="postal_info" class="postal_info" value="#postal_info" />{{$lang.PostalDataFalse}}</label>
					<table id="postal_info" class="postal_info">
						<tr><th><label for="oPostalName">{{$lang.Name}}</label></th><td><input type="text" name="sPostalName" value="{{$aOrderInfo.sPostalName}}" maxlength="40" class="input" onblur="saveUserData( this.name, this.value )" id="oPostalName" /></td></tr>
						<tr><th><label for="oPostalStreet">{{$lang.Street}}</label></th><td><input type="text" name="sPostalStreet" value="{{$aOrderInfo.sPostalStreet}}" maxlength="40" class="input" onblur="saveUserData( this.name, this.value )" id="oPostalStreet" /></td></tr>
						<tr><th><label for="oPostalZipCode">{{$lang.Zip_code}}</label></th><td><input type="text" name="sPostalZipCode" value="{{$aOrderInfo.sPostalZipCode}}" maxlength="20" class="input {{if $aOrderInfo.EsPostalZipCode}}validation-error{{/if}}" onblur="saveUserData( this.name, this.value )" id="oPostalZipCode" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_zipcode}}" alt="{{$lang.tooltip_zipcode}}" /></td></tr>
						<tr><th><label for="oPostalCity">{{$lang.City}}</label></th><td><input type="text" name="sPostalCity" value="{{$aOrderInfo.sPostalCity}}" maxlength="40" class="input" onblur="saveUserData( this.name, this.value )" id="oPostalCity" /></td></tr>
						<tr><th><label for="oPostalCountry">{{$lang.Country}}</label></th><td><select name="iPostalCountry" id="oPostalCountry"><option value="0">{{$lang.Select}}</option>{{selectOptions aOptions=$aOrderInfo.aCountries mOption=$aOrderInfo.iPostalCountry}}</select><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_country}}" alt="{{$lang.tooltip_country}}" /></td></tr>
						<tr id="oPostalRegionTR"><th><label for="oPostalRegion">{{$lang.Region}}</label></th><td><select name="iPostalRegion" id="oPostalRegion"></select></td></tr>
						<tr><th><label for="oPostalPhone">{{$lang.Telephone}}</label></th><td><input type="tel" name="sPostalPhone" value="{{$aOrderInfo.sPostalPhone}}" class="input {{if $aOrderInfo.EsPostalPhone}}validation-error{{/if}}" id="oPostalPhone" maxlength="40" /><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_phone}}" alt="{{$lang.tooltip_phone}}" /></td></tr>
					</table>
				</fieldset>
				<fieldset id="invoice-data">
					<h2>{{$lang.Invoice}}</h2>
					<table>
						<tr><th><label for="oInvoice">{{$lang.Invoice}}</label></th><td><select name="iInvoice" id="oInvoice">{{selectOptions aOptions=$aOrderInfo.aInvoices mOption=$aOrderInfo.iInvoice}}</select><img class="tTip info" src="templates/images/info.png"  title="{{$lang.tooltip_incvoice}}" alt="{{$lang.tooltip_incvoice}}" /></td></tr>
					</table>
					<script type="text/javascript">
						/*<![CDATA[*/
							$(document).ready(function(){
								$('#personal-data-form').find('input, select').change(function(){
									switch( parseInt( $('#oInvoice').val() ) ){
										case 0: $('#invoice_info').html( '<h4>{{$aOrderInfo.aInvoices.0}}</h4><p>' + $('#oFirstName').val() + ' ' + $('#oLastName').val() + '</p>' ); break;
										case 1: $('#invoice_info').html( '<h4>{{$aOrderInfo.aInvoices.1}}</h4><p>' + $('#oCompany').val() + '</p>' ); break;
										case 2: $('#invoice_info').html( '<h4>{{$aOrderInfo.aInvoices.2}}</h4><p>' + $('#oFirstName').val() + ' ' + $('#oLastName').val() + '</p>' ); break;
									}
									$('#invoice_info').html( $('#invoice_info').html() + '<p>' + $('#oStreet').val() + '</p><p>' + $('#oZipCode').val() + ' ' + $('#oCity').val() + '</p><p>' + $('#oCountry option:selected').html() + '</p>' );
									if( parseInt( $('#oInvoice').val() ) == 1 ){
										$('#invoice_info').html( $('#invoice_info').html() + '<p>{{$lang.Nip}}: ' + $('#oNip').val() + '</p>' );
									}
									{{if $config.pesel >= 1}}
										if( parseInt( $('#oInvoice').val() ) == 2 ){
											$('#invoice_info').html( $('#invoice_info').html() + '<p>{{$lang.Pesel}}: ' + $('#oPesel').val() + '</p>' );
										}
									{{/if}}
								});
								$('#oInvoice').trigger('change');
							});
						/*]]>*/
					</script>
					<div id="invoice_info">
					</div>
				</fieldset>

				{{if isset($aOrderInfo.sRulesLink)}}
					<script type="text/javascript">
						/*<![CDATA[*/
						$(document).ready(function(){
							$("form#personal-data-form #order-rules-accept").rules("add", {required: true, messages: {required: "{{$lang.Require_rules_accept}}"}});
						});
						/*]]>*/
					</script>
					<fieldset id="order-rules">
						<input type="checkbox" class="checkbox" name="iRulesAccept" value="1" alt="{{$lang.Require_rules_accept}}" id="order-rules-accept" />
						<label for="order-rules-accept">{{$lang.Rules_accept}} <a href="{{$aOrderInfo.sRulesLink}}" title="{{$lang.rules_read}}">{{$lang.rules_read}}</a>.</label>
					</fieldset>
				{{/if}}
				<script type="text/javascript">
					/*<![CDATA[*/
					$(document).ready(function(){
						$("form#personal-data-form #order-rules2-accept").rules("add", {required: true, messages: {required: "{{$lang.Require_rules2_accept}}"}});
					});
					/*]]>*/
				</script>
				<fieldset id="order-rules2">
					<input type="checkbox" class="checkbox" name="iRulesAccept2" value="1" alt="{{$lang.Require_rules2_accept}}" id="order-rules2-accept" />
					<label for="order-rules2-accept">{{$lang.Rules2_accept}}</label>
				</fieldset>
			
				<fieldset id="order-newsletter">
					<input type="checkbox" class="checkbox" name="iNewsletterAccept" value="1" id="order-newsletter-accept" />
					<label for="order-newsletter-accept">{{$lang.Newsletter_accept}}</label>
				</fieldset>

				{{if !empty( $config.opineo )}}
					<fieldset id="order-zo-ceneo">
						<input type="checkbox" class="checkbox" name="iOpineo" value="1" id="zo-ceneo" checked="checked" />
						<label for="zo-ceneo">{{str_replace( '%sShopName%', $config.website_name, $lang.Ceneo_zo_accept )}}</label>
					</fieldset>			
				{{/if}}
			</div>
					
			<fieldset id="order-step">
				<button type="submit" name="sOrderPrev" class="submit submit-styled cancel" id="step-prev">{{$lang.Basket_prev}}</button>
				<button type="submit" name="sOrderNext" class="submit submit-styled" id="step-next">{{$lang.Basket_next}}</button>
			</fieldset>

		</form>
	</div>
{{elseif $config.order_carrier_payment_page == $aPage.iPage}}
	<ul id="basket-bar"{{if !$config.users_plugin_active}} class="tabs_4"{{/if}}>
		<li class="checked">{{$lang.order_bar_basket}}</li>
		{{if $config.users_plugin_active}}<li class="checked">{{$lang.order_bar_login}}</li>{{/if}}
		<li class="checked">{{$lang.order_bar_personal}}</li>
		<li class="selected">{{$lang.order_bar_delivery}}</li>
		<li>{{$lang.order_bar_summary}}</li>
	</ul>
	<script type="text/javascript">
		/*<![CDATA[*/
		var sCarriers = '{{$aOrderInfo.sCarriersJSON}}';
		var sPayments = '{{$aOrderInfo.sPaymentsJSON}}';
		/*]]>*/
	</script>
	<div id="order">
		<script type="text/javascript">
			/*<![CDATA[*/
			$(document).ready(function(){
				$("form#carrier-payment-form").validate();
				$("form#carrier-payment-form input[name=sCarrierPayment]").rules("add", {required: true, messages: {required: "{{$lang.Require_payment_select}}"}});
			});
			/*]]>*/
		</script>
		<form action="{{$aPage.sLinkName}}" method="post" id="carrier-payment-form" class="order-delivery">
			<fieldset id="order-delivery">
				<input type="hidden" name="mCarrierInfo" value="" />
				<h2>{{$lang.Select_delivery_and_payment}}</h2>
				{{if count( $aPaymentCarriers ) > 0}}
					<ul>
						{{foreach from=$aPaymentCarriers item=aCarrier}}
							<li>
								<strong>{{$aCarrier.sName}}</strong>
								<ul>
									{{foreach from=$aCarrier.aPayments item=aPayment}}
										<li class="payment payment_{{$aPayment.iPayment}}">
											<label>
												<input name="sCarrierPayment" value="{{$aCarrier.iCarrier}};{{$aPayment.iPayment}};{{$aPayment.fPrice}}" id="sCarrierPayment-{{$aCarrier.iCarrier}}-{{$aPayment.iPayment}}" type="radio" class="radio" {{if ( $aPayment.iPayment == $aOrderInfo.iPayment ) && ( $aCarrier.iCarrier == $aOrderInfo.iCarrier )}}checked="checked"{{/if}} />
												{{*<label for="sCarrierPayment-{{$aCarrier.iCarrier}}-{{$aPayment.iPayment}}">*}}
												{{$aPayment.sName}} ({{$aPayment.sPrice}} {{$config.currency_symbol}})
											</label>
											{{$aPayment.sPaymentChannel}}
										</li>
									{{/foreach}}
								</ul>
							</li>
						{{/foreach}}
					</ul>
				{{else}}
					<p class="message" id="error">{{$lang.No_carrier_option_error}}</p>
					<input type="hidden" name="sCarrierPayment" value="" />
				{{/if}}
			</fieldset>

			{{if !empty($aOrderInfo.sPaczkomatyJSON)}}
				<div id="paczkomaty">
					<script type="text/javascript">
						var paczkomatyId = {{$aOrderInfo.sPaczkomatyJSON}}; var pobraniaId = {{$aOrderInfo.sPobraniaJSON}};
						$(document).ready(function(){
//							$("form#carrier-payment-form input#paczkomaty-selected-value").rules("add", {required: true {{* { depends: function(){ return $('#paczkomaty').is(':visible'); } } *}}, messages: {required: "{{$lang.Paczkomaty_no_chose_paczkomat}}"}});
							$('form#carrier-payment-form').submit( function(e){
								if( $('#paczkomaty').is(':visible') && $('input#paczkomaty-selected-value').val().length == 0 ){
									e.preventDefault();
									var message_text = '<div class="colorbox_message"><h1>' + lang_validate_correct_error + '</h1><p>{{$lang.Paczkomaty_no_chose_paczkomat}}</p></div>';
									$.colorbox({html: message_text});
								}
							});
						});
					</script>
					<img src="templates/images/paczkomaty_logo_mini.png" alt="paczkomaty_logo_min" class="paczkomaty_logo_mini" />
					<a id="paczkomaty-button" href="index.php?p=paczkomaty-nearest&amp;postcode={{$aOrderInfo.sZipCode}}&amp;request_type=paczkomaty&amp;paid_on_delivery=&amp;email={{$aOrderInfo.sEmail}}" title="{{$lang.Choose_paczkomat}}">{{$lang.Choose_paczkomat}}</a>
					<p id="paczkomaty-selected" style="display: none;">{{$lang.Chosen_paczkomat}}: <input disabled="disabled" type="hidden" id="paczkomaty-selected-value" readonly="readonly" name="mCarrierInfo" value="{{$aOrderInfo.mCarrierInfo}}"/> <span>{{$aOrderInfo.mCarrierInfo}}</span></p>
					<p id="paczkomaty-empty"><span id="paczkomaty-empty-value">{{$lang.Paczkomaty_no_chose_paczkomat}}</span></p>
					<div class="clear"></div>
				</div>
			{{/if}}
		
			{{if !empty($aOrderInfo.aPBNBanks)}}
				<div id="pbn_banks">
					<script type="text/javascript">
						/*<![CDATA[*/
						var PBNId = {{$aOrderInfo.sPBNJSON}};
						var bShowPBN = false;
						function checkPBNSel(){
							$.each(PBNId, function(id, val){
								$('.payment_'+val.toString()+' input').each(function(){
									if( $(this).is(':checked') ) bShowPBN = true;
								});
							});
							if( bShowPBN ) $('#pbn_banks').stop( true, true ).slideDown(1000);
							else $('#pbn_banks').stop( true, false ).slideUp(1000);
						}
						$(document).ready(function(){
							$.each(PBNId, function(id, val){
								$('.payment_'+val.toString()).hover(function(){bShowPBN = true; checkPBNSel()}, function(){bShowPBN = false; checkPBNSel()});
							});
							$('.payment input').change(function(){
								bShowPBN = false;
								checkPBNSel();
							});
							checkPBNSel();
						});
						/*]]>*/
					</script>
					<h2>{{$lang.Available_banks_PayByNet}}:</h2>
					<ul style="text-align: center">
						{{foreach from=$aOrderInfo.aPBNBanks item=aBank}}
							<li style="display: inline-block;"><div style="height: 58px; width: 120px; background: url({{$aBank.sImage}}) no-repeat center center; display: inline-block; margin: 3px;"></div></li>
						{{/foreach}}
					</ul>
				</div>
			{{/if}}

			<div class="block50">
				<fieldset id="order-comment">
					<h2>{{$lang.Order_comment}}</h2>
					<textarea name="sComment" id="comment" rows="" cols="">{{$aOrderInfo.sComment}}</textarea>
				</fieldset>
			</div>

			{{if $config.gifts}}
				<div class="block50">
					<script type="text/javascript">
						/*<![CDATA[*/
						var gift_cost = parseFloat({{$config.gift_cost}});
						/*]]>*/
					</script>
					<fieldset id="order-gift">
						<h2>{{$lang.Packing_as_gift}}</h2>
						<div><input type="checkbox" name="iGift" value="1" id="order-gift-cb" class="checkbox" {{if $aOrderInfo.iGift}}checked="checked"{{/if}} /> <label for="order-gift-cb">{{$lang.Pack_as_gift}} (+<span id="gift-cost">{{$config.gift_cost}}</span> {{$config.currency_symbol}})</label> </div>
						<div><input type="checkbox" name="iShowClient" value="1" id="order-gift-client" class="checkbox" {{if $aOrderInfo.iShowClient}}checked="checked"{{/if}} /> <label for="order-gift-client">{{$lang.Show_Client}}</label> </div>
						<div><label>{{$lang.Gift_Text}} <input type="text" name="sGiftText" value="{{$aOrderInfo.sGiftText}}" id="order-gift-text" class="input" maxlength="200" /> </label></div>
						<div class="clear"></div>
					</fieldset>
				</div>
			{{/if}}
			<fieldset id="ordered-products">
				<h2>{{$lang.Ordered_products}}</h2>

				<table>
					<thead>
						<tr>
							<th class="image">{{$lang.Photo}}</th>
							<th class="name">{{$lang.Name}}</th>
							<th class="price">{{$lang.Price}}[{{$config.currency_symbol}}]</th>
							<th class="quantity">{{$lang.Quantity}}</th>
							<th class="summary">{{$lang.Summary}} [{{$config.currency_symbol}}]</th>
						</tr>
					</thead>
					<tfoot>
						<tr class="summary-product"><th colspan="4">{{$lang.Order_summary}}:</th><td id="summary-product-cost" class="summary">{{$aOrderProducts.sProductsSummary}}</td></tr>

						{{if $aOrderProducts.bDiscountPanelActive}}
							<tr class="summary-product"><th colspan="4">{{$lang.Discount_coupon_value}}</th><td id="discount-value" class="summary">{{$aOrderProducts.sDiscountCouponValue}}</td></tr>
							<tr class="summary-product"><th colspan="4">{{$lang.Summary_after_discount}}:</th><td id="summary-product-cost-discount" class="summary">{{$aOrderProducts.sProductsSummaryDiscount}}</td></tr>
						{{/if}}

						<tr class="summary-delivery"><th colspan="4">{{$lang.Delivery_and_payment}} (<span id="summary-delivery-carrier">{{$aOrderInfo.sCarrier}}</span>, <span id="summary-delivery-payment">{{$aOrderInfo.sPayment}}</span>):</th><td id="summary-delivery-cost" class="summary">{{$aOrderProducts.sPaymentCarrierPrice}}</td></tr>

						{{if $config.gifts}}
							<tr class="summary-gift"><th colspan="4">{{$lang.Packing_as_gift}}:</th><td id="summary-gift-cost" class="summary">{{$aOrderInfo.sGift}}</td></tr>
						{{/if}}

						<tr class="summary-order"><th colspan="4">{{$lang.Summary_cost}}:</th><td id="summary-order-cost" class="summary">{{$aOrderProducts.sOrderSummary}}</td></tr>
					</tfoot>
					<tbody>
						{{foreach from=$aOrderProducts.aProducts item=aProduct}}
							<tr>
								<td class="image">
									{{if isset($aProduct.aDataImage)}}
										<a href="{{$aProduct.sLinkName}}" title="{{$aProduct.aDataImage.sFileDescription}}"><img src="{{$config.dir_files}}{{$aProductMinSizes.MainBasket}}/{{$aProduct.aDataImage.sFileName}}" alt="{{$aProduct.aDataImage.sFileDescription}}" /></a>
									{{/if}}
								</td>
								<th class="name"><a href="{{$aProduct.sLinkName}}" title="{{$aProduct.sName}}">{{$aProduct.sName}}</a></th>
								<td class="price">{{$aProduct.sPrice}}</td>
								<td class="quantity">{{$aProduct.iQuantity}}</td>
								<td class="summary">{{$aProduct.sSummary}} {{if isset( $aProduct.bDiscount )}}<img class="tTip discount_{{if $aProduct.bDiscount}}true{{else}}false{{/if}}" title="{{if $aProduct.bDiscount}}{{$lang.Discount_affected}}{{else}}{{$lang.Discount_not_affected}}&#10;{{$aProduct.sDiscountInfo}}{{/if}}" src="{{$config.dir_templates}}images/discount.png" />{{/if}}</td>
							</tr>
						{{/foreach}}
					</tbody>
				</table>

			</fieldset>

			<fieldset id="order-step">
				<button type="submit" name="sOrderPrev" class="submit submit-styled cancel" id="step-prev">{{$lang.Basket_prev}}</button>
				<button type="submit" name="sOrderNext" class="submit submit-styled" id="step-next">{{$lang.Basket_next}}</button>
			</fieldset>

			<p>
				{{if !empty( $config.zagiel_id )}}
					<script type="text/javascript">
						var zagielSymulatorHref = 'https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/{{$config.zagiel_id}}/wariantSklepu/1/typProduktu/0/wartoscTowarow/';
					</script>
					<a id="zagiel-button" {{if $aOrderProducts.fOrderSummary < $config.zagiel_min_price}}style="display: none"{{/if}} href="https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/{{$config.zagiel_id}}/wariantSklepu/1/typProduktu/0/wartoscTowarow/{{$aOrderInfo.fSummary}}" title="{{$lang.Zagiel_calculate}}">
						<img src="templates/images/zagiel_oblicz_rate.gif" alt="{{$lang.Zagiel_calculate}}" />
					</a>
				{{/if}}

				{{if !empty( $config.LR_psp_id ) }}
					{{$LR_forbidden=false}}
					{{foreach from=$aOrderProducts.aProducts item=aProduct}}
						{{$LR_forbidden = $LR_forbidden || in_array($aProduct.iMainCategory, explode(',', $config.LR_categories))}}
					{{/foreach}}
					{{if !$LR_forbidden }}
						<script type="text/javascript">
							/*<![CDATA[*/
							function LR_PoliczRate(koszyk) {
								var iWidth = 820;
								var iHeight = 530;
								var iX = ( screen.availWidth - iWidth ) / 2;
								var iY = ( screen.availHeight - iHeight ) / 2;	
								window.open('https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT='+koszyk, 'Policz_rate', 'height='+iHeight+',width='+iWidth+',top='+iY+',left='+iX+',resizable=yes,scrollbars=yes,status=0;');
								return false;
							}
							/*]]>*/
						</script>
						<a OnClick="return LR_PoliczRate('{{$aOrderProducts.fOrderSummary}}');" target="raty_symulator" id="LR-button" href="https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT={{$aBasket.fOrderSummary}}" title="{{$lang.LR_name}}">
							<img src="https://ewniosek.credit-agricole.pl/eWniosek/res/CA_grafika/oblicz_raty_{{$config.LR_logo_color}}.png" alt="{{$lang.LR_name}}" />
						</a>
					{{/if}}
				{{/if}}
			</p>
		</form>
	</div>
{{elseif $config.order_final_page == $aPage.iPage}}
	<ul id="basket-bar"{{if !$config.users_plugin_active}} class="tabs_4"{{/if}}>
		<li class="checked">{{$lang.order_bar_basket}}</li>
		{{if $config.users_plugin_active}}<li class="checked">{{$lang.order_bar_login}}</li>{{/if}}
		<li class="checked">{{$lang.order_bar_personal}}</li>
		<li class="checked">{{$lang.order_bar_delivery}}</li>
		<li class="selected">{{$lang.order_bar_summary}}</li>
	</ul>
	<div id="order">
		<form action="{{$aPage.sLinkName}}" method="post" class="order-summary">
			<div class="block50">
				<fieldset id="personal-data">
					<h2>{{$lang.Your_personal_information}}</h2>
					<table class="table-styled">
						<tr><th>{{$lang.First_name}}:</th><td>{{$aOrderInfo.sFirstName}}</td></tr>
						<tr><th>{{$lang.Last_name}}:</th><td>{{$aOrderInfo.sLastName}}</td></tr>
						{{if !empty( $aOrderInfo.sPesel )}}<tr><th>{{$lang.Pesel}}:</th><td>{{$aOrderInfo.sPesel}}</td></tr>{{/if}}
						<tr><th class="street">{{$lang.Street}}:</th><td class="street">{{$aOrderInfo.sStreet}}</td></tr>
						<tr><th class="zipCode">{{$lang.Zip_code}}:</th><td class="zipCode">{{$aOrderInfo.sZipCode}}</td></tr>
						<tr><th class="city">{{$lang.City}}:</th><td class="city">{{$aOrderInfo.sCity}}</td></tr>
						<tr><th class="country">{{$lang.Country}}:</th><td class="country">{{$aOrderInfo.sCountry}}</td></tr>
						{{if !empty( $aOrderInfo.sRegion )}}<tr><th class="region">{{$lang.Region}}:</th><td class="region">{{$aOrderInfo.sRegion}}</td></tr>{{/if}}
						<tr><th class="phone">{{$lang.Telephone}}:</th><td class="phone">{{$aOrderInfo.sPhone}}</td></tr>
						<tr><th class="email">{{$lang.Email}}:</th><td class="email">{{$aOrderInfo.sEmail}}</td></tr>
					</table>
				</fieldset>
				{{if !$aOrderInfo.sCompanyName == null && !$aOrderInfo.sNip == null}}
					<fieldset id="company-data">
						<h2>{{$lang.Company}}</h2>
						<table class="table-styled">
							<tr><th class="company">{{$lang.Company}}:</th><td class="company">{{$aOrderInfo.sCompanyName}}</td></tr>
							<tr><th class="nip">{{$lang.Nip}}:</th><td class="nip">{{$aOrderInfo.sNip}}</td></tr>
						</table>
					</fieldset>
				{{/if}}
			</div>		
			<div class="block50" >
				<fieldset id="postal-data">
					<h2>{{$lang.PostalData}}</h2>
					<table class="table-styled">
						<tr><th class="postalName">{{$lang.Name}}:</th><td class="postalName">{{if !$aOrderInfo.sPostalName == null}}{{$aOrderInfo.sPostalName}}{{else}}{{$aOrderInfo.sCompanyName}} {{$aOrderInfo.sFirstName}} {{$aOrderInfo.sLastName}}{{/if}}</td></tr>
						<tr><th class="postalstreet">{{$lang.Street}}:</th><td class="postalstreet">{{if !$aOrderInfo.sPostalStreet == null}}{{$aOrderInfo.sPostalStreet}}{{else}}{{$aOrderInfo.sStreet}}{{/if}}</td></tr>
						<tr><th class="postalzipCode">{{$lang.Zip_code}}:</th><td class="postalzipCode">{{if !$aOrderInfo.sPostalZipCode == null}}{{$aOrderInfo.sPostalZipCode}}{{else}}{{$aOrderInfo.sZipCode}}{{/if}}</td></tr>
						<tr><th class="postalcity">{{$lang.City}}:</th><td class="postalcity">{{if !$aOrderInfo.sPostalCity == null}}{{$aOrderInfo.sPostalCity}}{{else}}{{$aOrderInfo.sCity}}{{/if}}</td></tr>
						<tr><th class="postalcountry">{{$lang.Country}}:</th><td class="postalcountry">{{if !$aOrderInfo.sPostalCountry == null}}{{$aOrderInfo.sPostalCountry}}{{else}}{{$aOrderInfo.sCountry}}{{/if}}</td></tr>
						{{if !empty( $aOrderInfo.sPostalRegion ) || !empty( $aOrderInfo.sRegion )}}<tr><th class="postalregion">{{$lang.Region}}:</th><td class="postalregion">{{if !$aOrderInfo.sPostalRegion == null}}{{$aOrderInfo.sPostalRegion}}{{else}}{{$aOrderInfo.sRegion}}{{/if}}</td></tr>{{/if}}
						<tr><th class="postalphone">{{$lang.Phone}}:</th><td class="postalphone">{{if !$aOrderInfo.sPostalPhone == null}}{{$aOrderInfo.sPostalPhone}}{{else}}{{$aOrderInfo.sPhone}}{{/if}}</td></tr>
					</table>
				</fieldset>
			</div>
			<div class="clear"></div>
			<div class="block50">
				<fieldset id="invoice">
					<h2>{{$lang.Invoice}}</h2>
					<table class="table-styled">
						<tr><th class="invoice">{{$aOrderInfo.sInvoice}}</th><td class="invoice">{{if $aOrderInfo.iInvoice == 1}}{{$aOrderInfo.sCompanyName}}{{else}}{{$aOrderInfo.sFirstName}} {{$aOrderInfo.sLastName}}{{/if}}</td></tr>
					</table>
				</fieldset>
			</div>

			<div class="block50">
				<fieldset id="delivery-payment">
					<h2>{{$lang.Delivery_and_payment}}</h2>
					<table class="table-styled">
						<tr><th class="carrier">{{$lang.Carrier}}:</th><td class="carrier">{{$aOrderInfo.aCarrier.sName}}</td></tr>
						{{if $aOrderInfo.iCarrierSystem == $config.carrier_paczkomaty}}
							<tr><th class="carrier">{{$lang.Chosen_paczkomat}}:</th><td class="carrier">{{$aOrderInfo.mCarrierInfo}}</td></tr>
						{{/if}}
						<tr><th class="carrier">{{$lang.Payment}}:</th><td class="carrier">{{$aOrderInfo.aPayment.sName}}</td></tr>
					</table>
				</fieldset>
			</div>
		
			<div class="clear"></div>
			{{if $config.gifts && $aOrderInfo.iGift == true}}
				<div class="block50">
					<fieldset id="order-gift">
						<h2>{{$lang.Packing_as_gift}}</h2>
						<table class="table-styled">
							<tr><th>{{$lang.Pack_as_gift}}:</th><td>{{yesNoTxt bOption=$aOrderInfo.iGift}}</td></tr>
							<tr><th>{{$lang.Show_Client}}:</th><td>{{yesNoTxt bOption=$aOrderInfo.iShowClient}}</td></tr>
							<tr><th>{{$lang.Gift_Text}}:</th><td>{{$aOrderInfo.sGiftText}}</td></tr>
						</table>
					</fieldset>
				</div>
			{{/if}}

			{{if !$aOrderInfo.sComment == null}}
				<div class="block50">
					<fieldset id="order-comment">
						<h2>{{$lang.Order_comment}}</h2>
						<p>{{$aOrderInfo.sComment}}</p>
					</fieldset>
				</div>
			{{/if}}
		
			<div class="clear"></div>
			<div class="block100">
				<fieldset id="ordered-products">
					<h2>{{$lang.Ordered_products}}</h2>
					<table>
						<thead>
							<tr>
								<th class="image">{{$lang.Photo}}</th>
								<th class="name">{{$lang.Name}}</th>
								<th class="price">{{$lang.Price}}[{{$config.currency_symbol}}]</th>
								<th class="quantity">{{$lang.Quantity}}</th>
								<th class="summary">{{$lang.Summary}} [{{$config.currency_symbol}}]</th>
							</tr>
						</thead>
						<tfoot>
							<tr class="summary-product"><th colspan="4">{{$lang.Order_summary}}:</th><td id="summary-product-cost" class="summary">{{$aOrderProducts.sProductsSummary}}</td></tr>
							{{if $aOrderProducts.bDiscountPanelActive}}
								<tr class="summary-product"><th colspan="4">{{$lang.Discount_coupon_value}}</th><td id="discount-value" class="summary">{{$aOrderProducts.sDiscountCouponValue}}</td></tr>
								<tr class="summary-product"><th colspan="4">{{$lang.Summary_after_discount}}:</th><td id="summary-product-cost-discount" class="summary">{{$aOrderProducts.sProductsSummaryDiscount}}</td></tr>
							{{/if}}
							<tr class="summary-delivery"><th colspan="4">{{$lang.Delivery_and_payment}} (<span id="summary-delivery-carrier">{{$aOrderInfo.aCarrier.sName}}</span>, <span id="summary-delivery-payment">{{$aOrderInfo.aPayment.sName}}</span>):</th><td id="summary-delivery-cost" class="summary">{{$aOrderProducts.sPaymentCarrierPrice}}</td></tr>
							{{if $config.gifts}}
								<tr class="summary-gift"><th colspan="4">{{$lang.Packing_as_gift}}:</th><td id="summary-gift-cost" class="summary">{{$aOrderInfo.sGift}}</td></tr>
							{{/if}}
							<tr class="summary-order"><th colspan="4">{{$lang.Summary_cost}}:</th><td id="summary-order-cost" class="summary">{{$aOrderProducts.sOrderSummary}}</td></tr>
						</tfoot>
						<tbody>
							{{foreach from=$aOrderProducts.aProducts item=aProduct}}
								<tr>
									<td class="image">
										{{if isset($aProduct.aDataImage)}}
											<a href="{{$aProduct.sLinkName}}" title="{{$aProduct.aDataImage.sFileDescription}}"><img src="{{$config.dir_files}}{{$aProductMinSizes.MainBasket}}/{{$aProduct.aDataImage.sFileName}}" alt="{{$aProduct.aDataImage.sFileDescription}}" /></a>
										{{/if}}
									</td>
									<th class="name"><a href="{{$aProduct.sLinkName}}" title="{{$aProduct.sName}}">{{$aProduct.sName}}</a></th>
									<td class="price">{{$aProduct.sPrice}}</td>
									<td class="quantity">{{$aProduct.iQuantity}}</td>
									<td class="summary">{{$aProduct.sSummary}} {{if isset( $aProduct.bDiscount )}}<img class="tTip discount_{{if $aProduct.bDiscount}}true{{else}}false{{/if}}" title="{{if $aProduct.bDiscount}}{{$lang.Discount_affected}}{{else}}{{$lang.Discount_not_affected}}&#10;{{$aProduct.sDiscountInfo}}{{/if}}" src="{{$config.dir_templates}}images/discount.png" />{{/if}}</td>
								</tr>
							{{/foreach}}
						</tbody>
					</table>
				</fieldset>
				<div class="clear"></div>
				<fieldset id="order-step">
					<button type="submit" name="sOrderPrev" id="step-prev" class="submit submit-styled cancel">{{$lang.Basket_prev}}</button>
					<button type="submit" name="sOrderNext" id="step-next" class="submit submit-styled">{{$lang.Basket_final}}</button>
				</fieldset>
				{{if !empty( $config.zagiel_id ) && ( ( $aOrderInfo.fSummary + $aOrderInfo.fPaymentCarrierPrice + $aOrderInfo.fGiftCost ) >= $config.zagiel_min_price ) && $aOrderInfo.aPayment.iOuterSystem == $config.zagiel_system}}
					<p style="text-align: right; clear: both; padding-top: 15px;"><a id="zagiel-button" href="https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/{{$config.zagiel_id}}/wariantSklepu/1/typProduktu/0/wartoscTowarow/{{$aOrderInfo.fSummary}}" title="{{$lang.Zagiel_calculate}}"><img src="templates/images/zagiel_oblicz_rate.gif" alt="{{$lang.Zagiel_calculate}}" /></a></p>
				{{/if}}
				{{if !empty( $config.LR_psp_id ) && ( $aOrderInfo.aPayment.iOuterSystem == $config.LR_system)}}
					<script type="text/javascript">
						/*<![CDATA[*/
						function LR_PoliczRate(koszyk) {
							var iWidth = 820;
							var iHeight = 530;
							var iX = ( screen.availWidth - iWidth ) / 2;
							var iY = ( screen.availHeight - iHeight ) / 2;	
							window.open('https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT='+koszyk, 'Policz_rate', 'height='+iHeight+',width='+iWidth+',top='+iY+',left='+iX+',resizable=yes,scrollbars=yes,status=0;');
							return false;
						}
						/*]]>*/
					</script>
					<p style="text-align: right; clear: both; padding-top: 15px;">
						<a OnClick="return LR_PoliczRate('{{$aOrderInfo.fSummary + $aOrderInfo.fPaymentCarrierPrice + $aOrderInfo.fGiftCost}}');" target="raty_symulator" id="LR-button" href="https://ewniosek.credit-agricole.pl/eWniosek/simulator.jsp?PARAM_TYPE=RAT&PARAM_PROFILE={{$config.LR_psp_id}}&PARAM_CREDIT_AMOUNT={{$aOrderInfo.fSummary + $aOrderInfo.fPaymentCarrierPrice + $aOrderInfo.fGiftCost}}" title="{{$lang.LR_name}}">
							<img src="https://ewniosek.credit-agricole.pl/eWniosek/res/CA_grafika/oblicz_raty_{{$config.LR_logo_color}}.png" alt="{{$lang.LR_name}}" />
						</a>
					</p>
				{{/if}}
			</div>
		</form>
	</div>
{{elseif $config.order_summary_page == $aPage.iPage || $config.order_advance_page == $aPage.iPage}}
	<div id="order" class="order-final-confirm">
		{{if $config.order_summary_page == $aPage.iPage}}<div class="message" id="ok"><h3>{{str_replace( '%iOrder%', $aOrderInfo.iOrder, $lang.Order_sent )}}</h3></div>{{/if}}
		<div class="order_details">
			<p>{{$lang.Order_id}}: {{$aOrderInfo.iOrder}}</p>
			{{if $config.order_summary_page == $aPage.iPage}}<p>{{$lang.Carrier}}: {{$aOrderInfo.aCarrier.sName}}</p>{{/if}}
			<p>{{$lang.Payment}}: {{$aOrderInfo.aPayment.sName}}</p>
		</div>

		{{if !empty( $config.opineo )}}
			<script type="text/javascript">
				//<![CDATA[
				ceneo_client_email='{{if $aOrderInfo.iOpineo}}{{$aOrderInfo.sEmail}}{{/if}}';
				ceneo_order_id='{{$aOrderInfo.iOrder}}';
				ceneo_shop_product_ids='{{foreach from=$aOrderInfo.aProducts item=aProduct}}#{{$aProduct.iProduct}}{{/foreach}}';
				ceneo_work_days_to_send_questionnaire={{$aOrderInfo.iDays + 7}};
				//]]>
			</script>
			<script type="text/javascript" src="https://ssl.ceneo.pl/transactions/track/v2/script.js?accountGuid={{$config.opineo}}"></script>
		{{/if}}
		
		{{if !empty( $aOrderInfo.aPayment.sDescription ) || $aOrderInfo.iPaymentSystem}}
			<div id="payment-description">
				{{$aOrderInfo.aPayment.sDescription}} 

				{{if $aOrderInfo.iPaymentSystem && $aOrderInfo.iPaymentSystem != 7}}
					<div id="paymentOuter">
						{{include file='payment.tpl' inline}}

						<script type="text/javascript">
							//<![CDATA[
							if( document.getElementById( 'formPayment' ) )
								setTimeout( "document.getElementById( 'formPayment' ).submit()", 15000 );
							//]]>
						</script>
						<div id="authWindow" class="paymentSystem{{$aOrderInfo.iPaymentSystem}}">
							<a href="#" onclick="document.getElementById( 'formPayment' ).submit();" {{if $aOrderInfo.iPaymentSystem==8}}style="backgroud-image: url(https://ewniosek.credit-agricole.pl/eWniosek/res/CA_grafika/raty_200x73_{{$config.LR_logo_color}}.png)"{{/if}} title="{{if $aOrderInfo.iPaymentSystem == 5 || $aOrderInfo.iPaymentSystem == 8}}{{$lang.open_credit_window}}{{else}}{{$lang.open_authorization_window}}{{/if}}">
								{{if $aOrderInfo.iPaymentSystem == 5 || $aOrderInfo.iPaymentSystem == 8}}
									{{$lang.open_credit_window}}
								{{else}}
									{{$lang.open_authorization_window}}
								{{/if}}
							</a>
						</div>
					</div>
				{{/if}}
			</div>
		{{/if}}

		{{if !empty( $config.trusted_shops_id )}}
			<div id="trustedShopsCheckout" style="display: none;">
				<span id="tsCheckoutOrderNr">{{$aOrderInfo.iOrder}}</span>
				<span id="tsCheckoutBuyerEmail">{{$aOrderInfo.sEmail}}</span>
				<span id="tsCheckoutBuyerId">{{$aOrderInfo.iUser}}</span>
				<span id="tsCheckoutOrderAmount">{{$aOrderInfo.sSummary}}</span>
				<span id="tsCheckoutOrderCurrency">{{$config.currency_symbol_ISO}}</span>
				<span id="tsCheckoutOrderPaymentType">{{if !empty( $aOuterPaymentOption[$aOrderInfo.iPaymentSystem] )}}{{$aOuterPaymentOption[$aOrderInfo.iPaymentSystem]}}{{else}}OTHER{{/if}}</span>
			</div>
		{{/if}}

		{{if $aOrderInfo.aPayment.iPrintForm}}
			<script type="text/javascript">
				//<![CDATA[
				function printPaymentForm(){
					var win = window.open("", "win", "width=750,height=500");
					with (win.document) {
						open("text/html", "replace");
						write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
							"<html><head>\n" +
							"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" +
							"<style type=\"text/css\">@import \"{{$config.dir_templates}}style_PaymentForm.css\";</style>\n"+
							"<style type=\"text/css\"></style>\n" +
							"</head><body onload=\"window.print();\">\n"+
							"<div id=\"druk\"><p id=\"nazwa1\">{{$config.invoices_company_name}}</p><p id=\"nazwa2\">{{$config.invoices_address}} {{$config.invoices_postal_code}} {{$config.invoices_city}}</p>" +
							"<p id=\"konto\">{{$aOrderInfo.account_id}}</p><p id=\"kwota\">{{$aOrderInfo.sSummary}}</p><p id=\"kwota_sl\">{{$aOrderInfo.sSummaryText}}</p>" +
							"<p id=\"nazwaz1\">{{$aOrderInfo.sCompanyNameF}} {{$aOrderInfo.sFirstNameF}} {{$aOrderInfo.sLastNameF}}</p><p id=\"nazwaz2\">{{$aOrderInfo.sStreet}} {{$aOrderInfo.sZipCode}} {{$aOrderInfo.sCity}}</p><p id=\"tytul1\">{{$aOrderInfo.sFirstName}} {{$aOrderInfo.sLastName}}</p><p id=\"tytul2\">{{$lang.Order}} {{$aOrderInfo.iOrder}}{{if $aPage.iPage == $config.order_advance_page}} - {{$lang.Order_advance}}{{/if}}</p></div>" +
							"<img src=\"{{$config.dir_templates}}images/druk_przelewu.jpg\" id=\"tlo\" />\n"+
							"</body></html>");
						close();
					}
				}
				//]]>
			</script>
			<a href="#" onclick="printPaymentForm()" id="PrintFormLink" title="{{$lang.Show_Print_Form}}">{{$lang.Show_Print_Form}}</a>
		{{/if}}
	</div>
{{*elseif $config.order_advance_page == $aPage.iPage}}
	<div id="order" class="order-advance">
		<div class="order_details">
			<p>{{$lang.Order_id}}: {{$aOrderInfo.iOrder}}</p>
			<p>{{$lang.Carrier}}: {{$aOrderInfo.aCarrier.sName}}</p>
			<p>{{$lang.Payment}}: {{$aOrderInfo.aPayment.sName}}</p>
		</div>
	</div>
	{{if !empty( $aOrderInfo.aPayment.sDescription ) || $aOrderInfo.iPaymentSystem}}
		<div id="payment-description">
			{{$aOrderInfo.aPayment.sDescription}} 

			{{if $aOrderInfo.iPaymentSystem && $aOrderInfo.iPaymentSystem != 7}}
				<div id="paymentOuter">
					{{include file='payment.tpl' inline}}

					<script type="text/javascript">
						//<![CDATA[
						if( document.getElementById( 'formPayment' ) )
							setTimeout( "document.getElementById( 'formPayment' ).submit()", 15000 );
						//]]>
					</script>
					<div id="authWindow" class="paymentSystem{{$aOrderInfo.iPaymentSystem}}">
						<a href="#" onclick="document.getElementById( 'formPayment' ).submit();" {{if $aOrderInfo.iPaymentSystem==8}}style="backgroud-image: url(https://ewniosek.credit-agricole.pl/eWniosek/res/CA_grafika/raty_200x73_{{$config.LR_logo_color}}.png)"{{/if}} title="{{if $aOrderInfo.iPaymentSystem == 5 || $aOrderInfo.iPaymentSystem == 8}}{{$lang.open_credit_window}}{{else}}{{$lang.open_authorization_window}}{{/if}}">
							{{if $aOrderInfo.iPaymentSystem == 5 || $aOrderInfo.iPaymentSystem == 8}}
								{{$lang.open_credit_window}}
							{{else}}
								{{$lang.open_authorization_window}}
							{{/if}}
						</a>
					</div>
				</div>
			{{/if}}
		</div>
	{{/if*}}
{{/if}}