{{assign var=ColectionID value=130}} 
{{assign var=ProductsColectionID value=129}} 
{{assign var=PricesColectionID value=131}} 
{{assign var=CatProdXref value=132}}  
			
		{{assign var=ProductToDisplay value=$smarty.get.product}}
		{{getCollectionByCategory ColumnID='ID' Value=$ProductToDisplay CollectionID=$ProductsColectionID Collection_129_8='on' OrderColumn='ID' var=Products}} 
		{{if $Products|@count eq 0}}
			{{getcontent id=4}}
		{{else}}
			{{createOptions CollectionID=23 Column=5 var=Documents}}
			
			{{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'}} 
			{{setPage var='Collection_17_2' value=$Product.$ProductName}}


<div id="submenu">
<div id="smarty_plugin">{{getcontent id=40}}</div>
</div>
<div id="middle2">

		<h1>Product Detail</h1>
        <h2>{{$Product.$ProductName}}</h2>
			
			<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=v value=$Product}}
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr valign="top">
					<td>
								{{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>   <br/>
							<input size="2" name="q_{{$v.$ProductID}}" value="1" />
							  <br/>
							<a href="javascript: addToCart({{$v.$ProductID}});" id="addtocartlink">Add To Cart</a>
						{{else}}
							{{assign var=vv value=$Prices[0]}}
									
									
									
									
									<strong>PRICE:</strong> ${{$vv.$Price|string_format:'%.2f'}} <br/>
									
									<br/>
									 <input size="2" name="q_{{$v.$ProductID}}_{{$vv.$PriceID}}" class="itemquantityfield" id="q_{{$v.$ProductID}}_{{$vv.$PriceID}}" value="1" />
									<br/>
									<a id="addtocartlink" href="javascript://">Add To Cart</a>
									{{capture name=aaaa assign=jq}}
										$('#addtocartlink').click(function(){
												window.location='/addproduct.html?prodid={{$v.$ProductID}}&quantity='+document.getElementById('q_{{$v.$ProductID}}_{{$vv.$PriceID}}').value+'&price={{$vv.$PriceID}}&page=shopping-cart.html';
										});
									{{/capture}}
									{{assign var=JavaScriptJQueryCode value=$JavaScriptJQueryCode|concat:" "|concat:$jq}}
						{{/if}}									
		
					</td>
					<td>
						<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>
					</tr>
					<tr><td colspan="2">
					<h3>Product Description</h3>
									
					<div>{{$v.$LongDesc}}</div>
					
					
					
					
					</td></tr>	
					
					</table>
					dsds
			{{RunQuery ResultsVar=DiscountInfoCode q="SELECT Collection_341.* FROM Collection_342 INNER JOIN Collection_341 ON Collection_342_2 = Collection_341_ID WHERE Collection_342_1 = '"|concat:$v.$ProductID|concat:"' AND Collection_341_3='on' Group By Collection_341_ID Order By Collection_341_2 "}}
			
			{{if $DiscountInfoCode|@count gt 0}}
				<p> </p>
				{{foreach from=$DiscountInfoCode item=vv key=kk}}
					{{fetchstring string=$vv.Collection_341_7}}
				{{/foreach}}
				
			{{/if}}
			
			{{RunQuery ResultsVar=nProducts q="SELECT Collection_129.* FROM Collection_146 INNER JOIN Collection_129 ON Collection_129_ID = Collection_146_2 WHERE Collection_146_1='"|concat:$v.$ProductID|concat:"' AND Collection_129_8='on' Order By Collection_129_1 "}}
			{{if $nProducts|@count gt 0}}
			<p> </p>
			<h3>Product Recommendations</h3>
			<table cellpadding="2" cellspacing="2" border="0" width="480">
			<tr valign="top">
			{{foreach from=$nProducts item=v key=k name=plist}}
			{{if $smarty.foreach.plist.index % 1 eq 0 and $smarty.foreach.plist.index neq 0}}</tr><tr valign="top">{{/if}}
			<td>
			
            		<div class="product">
					<table cellpadding="4" cellspacing="4" border="0" width="100%">
					<tr valign="middle">
						<td>
						<a href="/store-products/{{$v.$ProductID}}.html"><img id="image_{{$v.$ProductID}}" alt="{{$v.$ProductName}}" src="{{if $v.$SmallImage neq ''}}{{$v.$SmallImage}}{{else}}/images/contentimages/image_20_4_54.gif {{/if}}" border="0" /></a>
						</td>
						<td>
						
						<h5><a href="/store-products/{{$v.$ProductID}}.html">{{$v.$ProductName}}</a></h5>
						<p>{{$v.$ShortDesc|nl2br}}</p>
						
						</td>
					</tr>
					<tr>
						<td colspan="2" align="right">
						
						{{getCollectionByCategory ColumnID='1' Value=$v.$ProductID CollectionID=$PricesColectionID OrderColumn='ID' var=Prices}}
									{{if $Prices|@count gt 1}}
										<select name="p_{{$v.$ProductID}}" id="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>   
										<input size="2" name="q_{{$v.$ProductID}}" id="q_{{$v.$ProductID}}" value="1" />
										 
										<a href="javascript: addToCart({{$v.$ProductID}});">Add To Cart</a>
									{{else}}
										{{assign var=vv value=$Prices[0]}}
										<strong>${{$vv.$Price|string_format:'%.2f'}} </strong>
									<input size="2" name="q_{{$v.$ProductID}}" id="q_{{$v.$ProductID}}" value="1" /> 
									<a onclick="javascript: void(0);" href="javascript: addToCart2({{$v.$ProductID}}, {{$vv.$PriceID}});">Add To Cart</a>
									{{/if}}		
						
						</td>
					</tr>
					<tr>
					<td colspan="2">
					{{assign var=ProductIDForOptions value=$v.$ProductID}}		
						{{getcontent id=107}}
					</td>
					</tr>
					</table>
					<hr width="70%" align="center">
					</div>
            
			</td>
			{{/foreach}} 
			</tr>
			</table>
			{{/if}}


</div>
{{/if}}