<div id="main_borders">
 <div id="main_inner_borders">
 <h2><strong><?=$title?></strong></h2>
  <? if ($products) { ?>
  <script language="JavaScript" type="text/javascript">
function getResults(sort_options){
		//var country_id=$('#country').val();
 		//persons.options.reset();   
       	var type = "<?php echo $type ?>";
       	var cat_id = "<?php echo $int_cat_id ?>";
		var sort_by = (sort_options.options[sort_options.selectedIndex].value);
		window.location = "http://www.wines2u.gr/product_price/"+type+"/"+cat_id+"/"+sort_by; 
    	//alert(country_id);
		//$.post(base_url+"page/searchSuppliersProducts", { url: $(this).val() }, function (return_prds) {$('#products').append(return_prds);});
	}
</script>
   <? $js = 'onChange="getResults(this);"';  ?>
<div style="float:right; padding:5px;">
<?	echo "<div class='type-select'><label for='sort_options'><strong>".$this->lang->line('sort_by')."&nbsp;&nbsp;</strong></label>";
	if (($sorted=='No') || ($sorted=='priceasc')){
	$options = array(''=>'Select one...', 'name' => $this->lang->line('sort_by_name'), 'pricedesc' => $this->lang->line('sort_by_desc'));
	} else {
	$options = array(''=>'Select one...', 'name' => $this->lang->line('sort_by_name'), 'priceasc' => $this->lang->line('sort_by_asc'));
	}
	echo form_dropdown('sort_options',$options, '', $js) ."</div>"; ?>
</div>
<?php /*?><? if ($by_price=="No") { ?>
<p style="float:right; padding-right:5px;"><? if (($sorted=='No') || ($sorted=='desc')){ ?><?=anchor('product_price/'.$type.'/'.$int_cat_id.'/asc', $this->lang->line('sort_by_price_asc'));?> <? } else { ?><?=anchor('product_price/'.$type.'/'.$int_cat_id.'/desc', $this->lang->line('sort_by_price_desc'));?> <? } ?></p>
<? } ?>
<?php */?>
    <? foreach($products as $result=>$prd): ?>
	<? $url_title = $this->MFuncs->stringURLSafe($prd['name']); ?>
    <? //$product_details = $this->MFuncs->getProductDetails($prd['id']); ?>
   <div class="subcolumns">
   <div class="c25l">
    <center>
                  <? if (($prd['image'] !='') || ($prd['image'] !=NULL)|| ($prd['image'] !=null)) { ?>
                  <?=anchor('product/'.$prd['p_id'].'/'.$url_title, '<img src="'.base_url().'images/prds/thumb/'.$prd['image'].'" style="max-width:120px; max-height:200px;" />');?>
            <? }
		  else { ?>
            <img class="left" src="<?=base_url()?>images/no_image.jpg" style="width:120px; max-height:200px;"/>
            <? } ?>
    </center>
    </div>
   <div class="c75l">
       <div class="subcolumns">
   <div class="c50l">
    <? $prd_name = $this->MFuncs->RemoveTones($prd['name']); ?>
  <h3 style="text-transform:uppercase;"><?=$prd_name?></h3>
  </div>
   <div class="c50r">
   <div align="right">
        <? if ($prd['price']!=0) { ?>
   <strong><?=$this->lang->line('price_txt')?></strong><? if (($prd['offers']=='Yes') && ($prd['offer_price']!=0)) { ?>
			<strike><?=$prd['price']?></strike>&nbsp;&nbsp;<?=$prd['offer_price']?>
			<? } else { ?>
			<?=$prd['price']?>
			<? } ?>
			&nbsp;&euro;&nbsp;<?=$prd['price_txt']?>
		<? } else { ?>
        <p><span  style="color:#C00"><em><?=$this->lang->line('availability_msg')?></em></span></p>
        <? } ?>
   </div>
   </div>
   </div>
   <? if ($prd['description']) { ?>
	<p><? echo strip_tags(word_limiter($prd['description'], 40), '<p><br>')?></p>
    <? } ?>
<?php /*?>   <? if ($product_details['characteristics']) { ?>
	<p><strong><?=$this->lang->line('characteristics_txt')?></strong><? echo strip_tags(word_limiter($product_details['characteristics'], 14), '<p><br>')?></p>
    <? } ?>
<?php */?>    
                 <p align="right">
                    <?=anchor('product/'.$prd['p_id'].'/'.$url_title, "+&nbsp;".$this->lang->line('btn_view'), array('alt' =>$prd['name'],'title' =>$prd['name'] ));?>
             <? if ($prd['available']=='Yes') { ?>
        <? if ($prd['price']!=0) { ?>
                    <br />
                    <div class="buttons"><?=anchor('add_to_cart/'.$prd['p_id'], $this->lang->line('links_add_cart'),array('id'=>'back_btn','class'=>'positive'))?></div>
                    <? } ?>
                  <? } ?>
                  </p>
    </div>
    </div>
    <hr / color="#E1D39C">
    <br />
    <? endforeach ?>
  <center>
    <?php echo $this->pagination->create_links(); ?>
  </center>
  <? } else { ?>
  <br />
  <h5>
    <?=$this->lang->line('no_results')?>
  </h5>
  <? } ?>
</div>
</div>
