{{assign var=SessionID   		value=''|sessionid}} 
{{RunQuery q="SELECT Collection_129.* FROM Collection_133 INNER JOIN Collection_134 ON Collection_134_1 = Collection_133_ID INNER JOIN Collection_146 ON Collection_146_1 = Collection_134_2 INNER JOIN Collection_129 ON Collection_129_ID = Collection_146_2 WHERE Collection_133_1='"|concat:$SessionID|concat:"' AND (Collection_133_28 IS NULL OR Collection_133_28 = '') Group By Collection_129_ID " ResultsVar=Upsell}}
{{if $Upsell|@count gt 0}}
<h3>You may also consider buying:</h3>
<script type="text/javascript">
		function addToCart(prodid)
		{
		var qty = document.getElementById('q_'+prodid).value;
		var pid = document.getElementById('p_'+prodid).options[document.getElementById('p_'+prodid).selectedIndex].value;
		window.location='/addproduct.html?prodid='+prodid+'&quantity='+qty+'&price='+pid+'&page=shopping-cart.html'
		}
		
		function makeChanges(obj , prodid)
		{
			var img = document.getElementById('image_'+ prodid);
			
			if (obj.options[obj.selectedIndex].img != '')
			{
				img.src = obj.options[obj.selectedIndex].img;
			}
		}
		</script>
			{{assign var=ColectionID value=130}} 
			{{assign var=ProductsColectionID value=129}} 
			{{assign var=PricesColectionID value=131}} 
			{{assign var=CatProdXref value=132}}  
			
			{{assign var=Product value=$Products[0]}}
			{{assign var=ProdPrefix value='Collection_'}} 
			{{assign var=ProdPrefix value=$ProdPrefix|concat:$ProductsColectionID|concat:'_'}} 
			{{assign var='ProductID' value=$ProdPrefix|concat:'ID'}} 
			{{assign var='ProductName' value=$ProdPrefix|concat:'1'}} 
			{{assign var='ShortDesc' value=$ProdPrefix|concat:'2'}} 
			{{assign var='LongDesc' value=$ProdPrefix|concat:'3'}} 
			{{assign var='SmallImage' value=$ProdPrefix|concat:'5'}} 
			{{assign var='BigImage' value=$ProdPrefix|concat:'4'}} 
			{{assign var=PricePrefix value='Collection_'}} 
			{{assign var=PricePrefix value=$PricePrefix|concat:$PricesColectionID|concat:'_'}} 
			{{assign var='PriceID' value=$PricePrefix|concat:'ID'}} 
			{{assign var='PriceName' value=$PricePrefix|concat:'2'}} 
			{{assign var='Price' value=$PricePrefix|concat:'3'}} 
			{{assign var='ItemDesc' value=$PricePrefix|concat:'4'}} 
			{{assign var='PriceImage' value=$PricePrefix|concat:'5'}} 
			
<div id="upsell">		
		{{foreach from=$Upsell item=v key=k}}
					
					<table cellpadding="2" cellspacing="2" border="0" width="100%">
					<tr valign="top">
					<td width="100">
						<div><img id="image_{{$v.$ProductID}}" alt="" src="{{if $v.$BigImage eq ''}}{{if $v.$SmallImage neq ''}}{{$v.$SmallImage}}{{else}}/images/contentimages/image_20_4_54.gif{{/if}}{{else}}{{$v.$BigImage}}{{/if}}" border="0" /></div>
					</td>
					<td>
						<h4>{{$v.$ProductName}}</h4>
						{{getCollectionByCategory ColumnID='1' Value=$v.$ProductID CollectionID=$PricesColectionID OrderColumn='ID' var=Prices}}
						{{if $Prices|@count gt 1}}
							<select name="p_{{$v.$ProductID}}" class="selectbox" onChange="makeChanges(this , {{$v.$ProductID}})">
							{{foreach from=$Prices item=vv key=kk}}
							<option value="{{$vv.$PriceID}}" img="{{if $vv.$PriceImage neq ''}}{{$vv.$PriceImage}}{{/if}}">{{$vv.$PriceName}} ${{$vv.$Price|string_format:'%.2f'}}</option>
							{{/foreach}}
							</select>   <img src="/images/sep.gif" height="10"/>
							<input size="2" name="q_{{$v.$ProductID}}" value="1" />
							  <img src="/images/sep.gif" height="10"/>
							<a href="javascript: addToCart({{$v.$ProductID}});">Add To Cart</a>
						{{else}}
							{{assign var=vv value=$Prices[0]}}
									
									{{if $vv.$PriceName neq ''}}{{$vv.$PriceName}} <br/>	{{/if}}
									{{if $vv.$ItemDesc neq ''}}ITEM #{{$vv.$ItemDesc}} <br/>{{/if}}	
									PRICE ${{$vv.$Price|string_format:'%.2f'}} <br/>
									
									{{if $vv.$PriceImage neq ''}} <font class="designPick" onmouseover="this.style.cursor='hand'" style="CURSOR: hand" onclick="document.getElementById('image_{{$v.$ProductID}}').src='{{$vv.$PriceImage}}'">{{$vv.$PriceName}} </font>{{else}} {{/if}}
									<img src="/images/sep.gif" height="10"/>
									 <input size="2" name="q_{{$v.$ProductID}}_{{$vv.$PriceID}}" id="q_{{$v.$ProductID}}_{{$vv.$PriceID}}" value="1" />
									<img src="/images/sep.gif" height="10"/>
									<a onclick="javascript: void(0);" href="javascript: window.location='/addproduct.html?prodid={{$v.$ProductID}}&quantity='+document.getElementById('q_{{$v.$ProductID}}_{{$vv.$PriceID}}').value+'&price={{$vv.$PriceID}}&page=shopping-cart.html'">Add To Cart</a>
									
						{{/if}}									
		
					</td>
					</tr>
					{{if $v.$ShortDesc neq ''}}
					<tr><td colspan="2">
					<p>{{$v.$ShortDesc|nl2br}}</p>
					</td></tr>	
					{{/if}}
					</table>
					<div class="line"><img src="/images/sep.gif"/></div>
		{{/foreach}}
</div>
{{else}}
<img src="/images/sep.gif"/>
{{/if}}