{{$bHideSocial = true}}
{{include 'head.tpl'}}
</head>
<body>
<div id="page" class="iframe">
<div id="order">
<script type="text/javascript">
	var request_type = '{{$_GET.request_type}}';
	$(document).ready(function(){
		$("form#paczkomaty-form").validate();

		{{if $aPaczkomatyInfo.bNearest}}
			$("form#paczkomaty-form #paczkomaty-nearest-select").rules("add", {required: true});
			
			$('#paczkomaty-nearest-submit').click(function(){
		{{else}}
			$("form#paczkomaty-form #paczkomaty-intown-select").rules("add", {required: true});
			$("form#paczkomaty-form #paczkomaty-town-select").rules("add", {required: true});
			
			$('#paczkomaty-intown-submit').click(function(){
		{{/if}}
			var res = $("form#paczkomaty-form").validate().form();
			if (res)
			{ this.send(); return false;}
			else
			{ return false; }
		});
	});	
</script>

{{if $aPaczkomatyInfo.bNearest}}
	<form id="paczkomaty-form" class="order-paczkomaty">
	<fieldset id="order-paczkomaty-nearest">
	<h2>{{$lang.Paczkomaty_your_nearest_paczkomaty}}</h2>
	<p class="sp">
		<select name="paczkomat" id="paczkomaty-nearest-select">
			<option value="">{{$lang.Paczkomaty_choose_paczkomat}}</option>
			{{foreach from=$aPaczkomaty item=aPaczkomat}}
				<option value="{{$aPaczkomat.name}}: {{$aPaczkomat.town}} {{$aPaczkomat.street}} {{$aPaczkomat.buildingnumber}} {{$aPaczkomat.postcode}} ({{$aPaczkomat.locationdescription}})">{{$aPaczkomat.town}} {{$aPaczkomat.street}} {{$aPaczkomat.buildingnumber}} {{$aPaczkomat.postcode}} ({{$aPaczkomat.locationdescription}})</option>
			{{/foreach}}
		<select>
	</p>
	<p class="sp">{{$lang.Paczkomaty_choose_other_info}}</p>
	</fieldset>
	<fieldset id="order-step">
	<a href="?p=paczkomaty-towns&amp;postcode={{$_GET.postcode}}&amp;request_type=paczkomaty" class="submit submit-styled submit-styled-alt1" id="paczkomaty-other-submit" >{{$lang.Paczkomaty_choose_other}}</a>

	<a href="#" class="submit submit-styled" id="paczkomaty-nearest-submit">{{$lang.Paczkomaty_accept}}</a>
{{else}}
	<form id="paczkomaty-form" class="order-paczkomaty" method="get">
	<fieldset id="order-paczkomaty-intown">
	<h2>{{$lang.Paczkomaty_choose_in_town}}</h2>
	<input type="hidden" name="p" value="paczkomaty-in_town" />
	<p class="sp">
		<select name="town" id="paczkomaty-town-select">
			<option value="">{{$lang.Paczkomaty_choose_town}}</option>
			{{foreach from=$aTowns item=sTown}}
				<option value="{{$sTown}}">{{$sTown}}</option>
			{{/foreach}}
		</select> 
		<select name="intown" id="paczkomaty-intown-select"></select>
	</p>

	<p class="sp">{{$lang.Paczkomaty_choose_town_info}}</p>
	</fieldset>
	<fieldset id="order-step">
	<a href="?p=paczkomaty-nearest&amp;postcode={{$_GET.postcode}}&amp;request_type=paczkomaty" class="submit submit-styled submit-styled-alt1" id="paczkomaty-other-submit" >{{$lang.Paczkomaty_back}}</a>

	<a href="#" class="submit submit-styled" id="paczkomaty-intown-submit">{{$lang.Paczkomaty_accept}}</a>
{{/if}}
</fieldset>
</form>
</div>
</div>

</body>
</html>