	{{* if we do not have a valid cart we will redirect to shopping-cart.html page *}}
	{{assign var=CartCollection				value=133}}
	{{assign var=TaxCollection				value=151}}
	{{assign var=ShippingCollection			value=139}}
	{{assign var=CartDetailsCollection		value=134}}
	{{assign var=SessionID   		value=''|sessionid}}
	{{getCollectionByCategory CollectionID=$CartCollection Collection_133_1=$SessionID aditionalFilter=' (Collection_133_5<>"on" or Collection_133_5 IS NULL) ' var=CartData OrderColumn='ID'}}
	{{assign var=CartDataItem value=$CartData[0]}}
	{{assign var=CartID value=$CartDataItem.Collection_133_ID}}
	{{assign var=MethodID value=$CartDataItem.Collection_133_17}}
	{{assign var=PaymentMethodID value=$CartDataItem.Collection_133_19}}
	{{getCollectionByCategory CollectionID=$CartDetailsCollection ColumnID=1 Value=$CartID var=CartDetails OrderColumn='ID'}}
	
		
	{{if $CartDetails|@count eq 0 or $CartData|@count eq 0 or $MethodID lt 1}}
		{{redirect page='/shopping-cart.html'}}	
	{{/if}}
	
	{{* if we do not have a valid billing info page we will redirect to personal-information *}}	
	{{getCollectionByCategory CollectionID=138 ColumnID=1 Value=$CartID var=BillingInformation OrderColumn='ID'}}
	{{if $BillingInformation|@count eq 0}}
		{{redirect page='/checkout/personal-information.html'}}	
	{{else}}
		{{assign var=BillingInfo value=$BillingInformation[0]}}
	{{/if}}
	
	
	
	{{getCollectionByCategory CollectionID=$ShippingCollection ColumnID=1 Value=$CartID var=ShippingInformation OrderColumn='ID'}}
	{{if $ShippingInformation|@count eq 0}}
			{{redirect page='/checkout/shipping-information.html'}}	
	{{/if}}
		
	
<div id="middle2">

	{{if $CartData|@count gt 0 and $CartDetails|@count gt 0}}
		<div id="shopping_cart_details">
		{{getcontent id=55}}
		</div>
	{{/if}}
	
	{{getCollectionByCategory CollectionID=138 Collection_138_1=$CartID var=PInfo OrderColumn='ID'}}
	{{if $PInfo|@count neq 0}}
			{{assign var=PinfoData value=$PInfo[0]}}
	{{/if}}
	
	<h1>Your Payment Information</h1>

	 {{if $smarty.get.errors}}
	 {{assign var=errorlist value=$smarty.get.errors}}
	 {{assign var=authorizeerrors    value=$errorlist|explode:'-'}}
	 {{if $authorizeerrors|@count gt 0}}
            <div class="ErrorBox">
			We encountered some problems when checking the information you provided.
			<ul>
			{{assign var=errorscount value=0}}			
			{{foreach from=$authorizeerrors item=v key=k}}
					{{getCollectionByCategory CollectionID=144 ColumnID='ID' Value=$v var=PayError OrderColumn='ID'}}
					{{if $PayError|@count gt 0}}
					{{assign var=PayE value=$PayError[0]}}
					<li>{{$PayE.Collection_144_1}}</li>
					{{assign var=errorscount value=$errorscount|add:'1'}}
					{{/if}}
			{{/foreach}}			
			{{if $errorscount eq 0 and $smarty.get.errors neq ''}}
				<li>{{$smarty.get.errors}}</li>
			{{/if}}
			</ul>
            </div>
     {{/if}}
	 {{/if}}
	

		{{* We need to see if personal info has been completed once *}}
		{{* If yes we need to edit not add again *}}
		
		
		
		
		{{getCollectionByCategory CollectionID=$PaymentMethodID Column=1 Value=$CartID var=PayInfo OrderColumn='ID'}}
		{{if $PayInfo|@count eq 0}}
			{{* if we add for the first time we could try to get the info from personal info *}}
			
		{{else}}
			{{assign var=PMethodPrefix value='Collection_'}}
			{{assign var=PMethodPrefix value=$PMethodPrefix|concat:$PaymentMethodID|concat:'_ID'}}
		
			{{foreach from=$PayInfo item=v key=k }}
				{{assign var=PayInfoID value=$v.$PMethodPrefix}}
				{{CollectionDeleteRow CollectionID=$PaymentMethodID RowID=$PayInfoID}}
			{{/foreach}}
		{{/if}}	
		
		{{getCollectionByCategory CollectionID=147 ColumnID=ID Value=$PaymentMethodID var=PaymentMethodData OrderColumn='ID'}}
		{{assign var=P value=$PaymentMethodData[0]}}
		{{$P.Collection_147_3}}
		<div id="cartform">
			{{ViewCollection mode='Add' CollectionID=$PaymentMethodID}}
		</div>
</div>
